Given a circle of radius R (radius is set by the user). You can also set a degree, a number from 0 to 360. It is necessary to draw an arc of this given angle. 360 full circle, 180 half, this is understandable.
Made through CombinedGeometry ( GeometryCombineMode: Intersect ) - made PathFigure from LineSegment , ArcSegment , LineSegment in such a sequence. With the use of Transform , twisted lines and this ArcSegment was drawn between them.
Sorry, the code that I can’t write here is not at hand. Generally it looks like this - you need to draw an arc of a given angle, i.e. a circle is given, the arc will represent part of the circle. So I think, without all these CombinedGeometry , using mostly one ArcSegment can be implemented accurately. Can anyone come across such a puzzle.

    2 answers 2

    You can make it easier, without turns, just have to remember a little trigonometry.

    Here is an example with angles of 60 degrees:

    <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <StackPanel> <Path Stroke="Red" StrokeThickness="2"> <Path.Data> <PathGeometry Figures="M 100 100 l 100 0 a 100 100 60 0 1 -50 86.6 z"/> </Path.Data> </Path> <Path Stroke="Red" StrokeThickness="2"> <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigure StartPoint="100,100" IsClosed="True"> <LineSegment Point="200,100"/> <ArcSegment Point="150,186.6" RotationAngle="60" Size="100,100" IsLargeArc="False" SweepDirection="Clockwise"/> </PathFigure> </PathGeometry.Figures> </PathGeometry> </Path.Data> </Path> </StackPanel> </Page> 

    Such arcs are obtained:
    two arcs of 60 degrees

      I decided to add, suddenly someone will come in handy: below is the code that I did with the turns and transformations. This is part of the code from the editor, so do not be embarrassed about the coordinates and other things, but I think the basic meaning will be clear.

       RotateTransform transformStart; RotateTransform transformEnd; rx = 0.5 * radius; // Расчитываем угол поворота и определяем параметры нашим "трансформаторам" double angle = ((valSegment - minimalValue) / (maximalValue - minimalValue)) * sizeSegment; transStart.Angle = 360 - (sizeSegment / 2); transStart.CenterX = origin.X + rx; transStart.CenterY = origin.Y + rx; transEnd.Angle = sizeSegment; transEnd.CenterX = origin.X + rx; transEnd.CenterY = origin.Y + rx; Pen penContur = new Pen(ColorCountur, thiknessContour); DrawingContext dc = Drawing.Open(); EllipseGeometry ell = new EllipseGeometry(); ell.Center = new Point((origin.X + rx +rx)-rx, origin.Y + rx); ell.RadiusX = rx; ell.RadiusY = rx; LineGeometry lineGem = new LineGeometry(); lineGem.StartPoint = new Point(origin.X + rx, origin.Y + rx); lineGem.EndPoint = new Point(origin.X + rx, origin.Y + (-rx)); dc.PushTransform(transStart); Point transPoint = transEnd.Transform(lineGem.EndPoint); Point start = new Point(lineGem.EndPoint.X, lineGem.EndPoint.Y); ArcSegment arcs = new ArcSegment(new Point(transPoint.X, transPoint.Y), new Size(radius, radius), 0, true, SweepDirection.Clockwise, true); start = new Point(origin.X + rx, origin.Y + rx); LineSegment segLine1 = new LineSegment(new Point(lineGem.EndPoint.X, lineGem.EndPoint.Y), false); LineSegment segLine2 = new LineSegment(new Point(transPoint.X, transPoint.Y), false); PathFigure figure = new PathFigure(start, new PathSegment[] { segLine1, arcs, segLine2 }, false); PathGeometry geo = new PathGeometry(new PathFigure[] { figure }); CombinedGeometry comb = new CombinedGeometry(GeometryCombineMode.Intersect, ell, geo); dc.DrawGeometry(Brushes.White, penContur, comb); 

      Now, thanks to VladD , without transformations and combinations, I do this:

       // вычисляем новые координаты public Point GetCoordinate(double angle, double radius) { double newAngle = (Math.PI / 180.0) * (angle - 90); double rx = radius * Math.Cos(newAngle); double ry = radius * Math.Sin(newAngle); return new Point(rx, ry); } 

      then just substitute everything you need in ArcSegment. Something like this.

      • Monsieur knows a lot about perversions) - AlexeyM