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.
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.
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"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With