StreamGeometryContext.ArcTo Method
When drawing a pie chart, using a code ArcTo() method, 2 arcs (Clockwise and then Counterclockwise) looks like one direction arcs. It seems in some cases the direction of the arcs are ignored.
Re: StreamGeometryContext.ArcTo Method
Hi!
Can you paste the code that is giving you trouble?
Thanks!
Can you paste the code that is giving you trouble?
Thanks!
Re: StreamGeometryContext.ArcTo Method
Our code very simular to this WPF-example (adapted for NoesisGUI):
1st arc in Clockwise, 2nd - Counterclockwise, but 2nd arc draw like Clockwise.
Code: Select all
...
bool largeArc = WedgeAngle>180.0;
Size outerArcSize = new Size(Radius, Radius);
Size innerArcSize = new Size(InnerRadius, InnerRadius);
context.BeginFigure(innerArcStartPoint, true, true);
context.LineTo(outerArcStartPoint, true, true);
context.ArcTo(outerArcEndPoint, outerArcSize, 0, largeArc,
SweepDirection.Clockwise, true, true);
context.LineTo(innerArcEndPoint, true, true);
context.ArcTo(innerArcStartPoint, innerArcSize, 0, largeArc,
SweepDirection.Counterclockwise, true, true);
...
Re: StreamGeometryContext.ArcTo Method
Here is code fragment from Unity3D for drawing dial (p - input parameter from 0 to 1):
Code: Select all
void DrawDialStrip(float p)
{
if (dialPath == null)
{
dialPath = new Path();
dialPath.SetFill(new SolidColorBrush(stripColor));
AssociatedObject.GetChildren().Add(dialPath);
}
float a = startAngleRad + (finishAngleRad - startAngleRad) * p;
bool isLargeArc = Mathf.Abs(a - startAngleRad) > Mathf.PI;
var geometry = new StreamGeometry();
using (var context = geometry.Open())
{
context.BeginFigure(startPoint1, true);
context.ArcTo(GetPointFromPolarCoord(a, r1), new Size(r1, r1), 0, isLargeArc, isClockwise);
context.LineTo(GetPointFromPolarCoord(a, r2));
context.ArcTo(startPoint2, new Size(r2, r2), 0, isLargeArc, !isClockwise);
}
dialPath.SetData(geometry);
}
Point GetPointFromPolarCoord(float a, float r)
{
return new Point(r * Mathf.Cos(a), -r * Mathf.Sin(a)) + centerPoint;
}
-
-
sfernandez
Site Admin
- Posts: 2908
- Joined:
Re: StreamGeometryContext.ArcTo Method
We found the bug in the code, we will solve it for the next release. Thanks for reporting.
Meanwhile, if useful, this bug does not appears when using isLargeArc = true.
Meanwhile, if useful, this bug does not appears when using isLargeArc = true.
Re: StreamGeometryContext.ArcTo Method
Thanks for answers!
When you are planning to release the next version?
When you are planning to release the next version?
Re: StreamGeometryContext.ArcTo Method
noesisGUI v1.1.8 is planned for the next week, anyway you can file us a bug to track this problem.
Thanks for your patience.
Thanks for your patience.
Re: StreamGeometryContext.ArcTo Method
Fixed in v1.1.8
Re: StreamGeometryContext.ArcTo Method
Please, try in the last version (1.2.2) and if the error persists (probably) report a bug.
Thanks!
Thanks!
Who is online
Users browsing this forum: No registered users and 10 guests