pmike
Topic Author
Posts: 28
Joined: 31 Oct 2012, 09:29

StreamGeometryContext.ArcTo Method

06 May 2014, 20:31

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.
 
User avatar
jsantos
Site Admin
Posts: 2909
Joined: 20 Jan 2012, 17:18
Contact:

Re: StreamGeometryContext.ArcTo Method

06 May 2014, 20:37

Hi!

Can you paste the code that is giving you trouble?

Thanks!
 
pmike
Topic Author
Posts: 28
Joined: 31 Oct 2012, 09:29

Re: StreamGeometryContext.ArcTo Method

06 May 2014, 20:53

Our code very simular to this WPF-example (adapted for NoesisGUI):
...
    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);
...
1st arc in Clockwise, 2nd - Counterclockwise, but 2nd arc draw like Clockwise.
 
pmike
Topic Author
Posts: 28
Joined: 31 Oct 2012, 09:29

Re: StreamGeometryContext.ArcTo Method

07 May 2014, 10:58

Here is code fragment from Unity3D for drawing dial (p - input parameter from 0 to 1):
        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;
        }
 
User avatar
sfernandez
Site Admin
Posts: 1920
Joined: 22 Dec 2011, 19:20

Re: StreamGeometryContext.ArcTo Method

07 May 2014, 13:59

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.
 
pmike
Topic Author
Posts: 28
Joined: 31 Oct 2012, 09:29

Re: StreamGeometryContext.ArcTo Method

07 May 2014, 14:46

Thanks for answers!
When you are planning to release the next version?
 
User avatar
jsantos
Site Admin
Posts: 2909
Joined: 20 Jan 2012, 17:18
Contact:

Re: StreamGeometryContext.ArcTo Method

07 May 2014, 18:56

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.
 
User avatar
jsantos
Site Admin
Posts: 2909
Joined: 20 Jan 2012, 17:18
Contact:

Re: StreamGeometryContext.ArcTo Method

20 May 2014, 18:50

Fixed in v1.1.8
 
pmike
Topic Author
Posts: 28
Joined: 31 Oct 2012, 09:29

Re: StreamGeometryContext.ArcTo Method

06 Apr 2015, 14:41

The same bug in version 1.2.1.
 
User avatar
jsantos
Site Admin
Posts: 2909
Joined: 20 Jan 2012, 17:18
Contact:

Re: StreamGeometryContext.ArcTo Method

06 Apr 2015, 15:04

Please, try in the last version (1.2.2) and if the error persists (probably) report a bug.

Thanks!

Who is online

Users browsing this forum: No registered users and 0 guests