Silverlight 3 ArcSegment to always draw circle's

Posted by kapaboo on Stack Overflow See other posts from Stack Overflow or by kapaboo
Published on 2010-05-03T21:20:45Z Indexed on 2010/05/03 21:28 UTC
Read the original article Hit count: 212

Filed under:
|
|
|
|

Hi everyone,
Ok, my arcSegment must always draw Circle's. For this reason I calculate the Arc's Width with the following formula:

arcXRadius = (4 * Math.Pow(height, 2) + Math.Pow(distanceArcPoints, 2)) / (8 * height);

so Arcs.Size = (arcXRadius,height)

But seems that the height is scaled down when drawn. I want to add a small Circle to the Arc's middle (highest point) so when you drag it it changes the arc Height but also changes the Width so it will remain a circle.

Here's how I calculate the Circle's (highest) point:

Point middlePoint = GetMiddlePoint(arcPointA,arcPointB); double arcYRadius = arcSegment.Size.Height; if (arcYRadius <= 0) return middlePoint; double angle = arcSegment.RotationAngle;

        Point ellinewPoint = new Point();
        ellinewPoint.X = Math.Cos((angle + 90) * Math.PI / 180) * arcYRadius + middlePoint.X;
        ellinewPoint.Y = Math.Sin((angle + 90) * Math.PI / 180) * arcYRadius + middlePoint.Y;

Until Arc's.Size.Height Property gets Closer to the Width my Circle is not at the right Point.

So maybe someone can give me a hint or tell me what am I doing wrong.

Cheers,

kapaboo

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about c#