Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arc Segment between two points and a radius

Tags:

c#

geometry

wpf

I am trying to paint an arc segment using WPF, but I somehow cannot figure out how to do this using the ArcSegment-Element.

I have two points of the arc given (P1 and P2) and I also have the center of the circle and the radius.

enter image description here

like image 440
Eggi Avatar asked Feb 22 '14 17:02

Eggi


People also ask

How do you find the arc length between two points on a circle?

For a circle, the arc length formula is θ times the radius of a circle. The arc length formula in radians can be expressed as, arc length = θ × r, when θ is in radian. Arc Length = θ × (π/180) × r, where θ is in degree, where, L = Length of an Arc.


1 Answers

Create a PathFigure with P1 as StartPoint and an ArcSegment with P2 as Point and a quadratic Size that contains the radius.

Example: P1 = (150,100), P2 = (50,50), Radius = 100, i.e. Size=(100,100):

<Path Stroke="Black">
    <Path.Data>
        <PathGeometry>
            <PathFigure StartPoint="150,100">
                <ArcSegment Size="100,100" Point="50,50"/>
            </PathFigure>
        </PathGeometry>
    </Path.Data>
</Path>

or shorter:

<Path Stroke="Black" Data="M150,100 A100,100 0 0 0 50,50"/>
like image 120
Clemens Avatar answered Nov 05 '22 12:11

Clemens