Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: A little direction please...

  1. #1
    Member
    Join Date
    2017-03
    Posts
    7


    Question A little direction please...

    I apologize first, if my posting here offends anyone.

    I am not an AUGI type (in fact, I do not know surveying, math, etc.). I was doing a search on 'Survey, curves, arc', and came across this posting on your forums...http://forums.augi.com/showthread.ph...nts-on-a-curve. It does look related to what I am looking for.

    I am trying to take survey curve information, and (in a C# program), translate it to use in C# SkiaSharp DrawPath project. My posting here has not gotten any replies (SkiaSharp is fairly new, and there are no examples of what I am trying to do)... https://forums.xamarin.com/discussio...h-image#latest.

    I am trying to convert the survey curve information to what the ArcTo method...https://developer.xamarin.com/api/me...ystem.Boolean/, is looking for..." public Void ArcTo (SKRect oval, Single startAngle, Single sweepAngle, Boolean forceMoveTo) "

    oval The bounding oval defining the shape and size of the arc.
    startAngle The starting angle (in degrees) where the arc begins.
    sweepAngle The sweep angle (in degrees) measured clockwise.
    forceMoveTo Whether to always begin a new contour with the arc.

    I do not have the foggiest idea of what values from the survey curve info to use to create what is required for each of the method parameters, or how to create that info.

    Even if it is just pointing me else (telling me where to go...figuratively ), I would appreciate it.

  2. #2
    Super Moderator CAtDiva's Avatar
    Join Date
    2015-10
    Location
    Where pedals spin to move wheels
    Posts
    281


    Default Re: A little direction please...

    Thread moved for better responses.

  3. #3
    I could stop if I wanted to
    Join Date
    2014-08
    Posts
    280


    Default Re: A little direction please...

    what type of curve are you working with it sounds like a spiral which is considerably more complex

  4. #4
    Super Moderator CAtDiva's Avatar
    Join Date
    2015-10
    Location
    Where pedals spin to move wheels
    Posts
    281


    Default Re: A little direction please...

    Someone suggested this might be better in a programming sub-forum. If another mod knows of a better place, feel free to relocate it.

  5. #5
    Member
    Join Date
    2017-03
    Posts
    7


    Default Re: A little direction please...

    remi678731


    What type of curve...I don't know (not being a survey\math type). Using the info on that survey, that I posted, someone else came up with this, but did not replace the w, C D, etc., with the survey info...


    abs(W) = L / R
    (A + W) modulo 2pi ≡ arctangent((Ey-Cy) / (Ex-Cx));

    Use both equations to get the right value for W.

    So it looks like you have or can calculate:

    S = starting point of the arc.
    E = ending point of the arc,
    R = radius of the arc (so it must be a section of circle)
    L = arc length.

    Skia needs C, the center of the circle that the arc is part of. From the definintion of a circle:

    distance(C, S) = R
    distance(C, E) = R

    (Cx-Sx)^2 + (Cy-Sy)^2 = R^2
    (Cx-Ex)^2 + (Cy-Ey)^2 = R^2


    Solve for C = {Cx,Cy}. Throw one answer away.

    Skia also needs the start angle A and the sweep W.

    A = arctangent((Sy-Cy) / (Sx-Cx)) ;
    W = arctangent((Ey-Cy) / (Ex-Cx)) - A;

    The bounding rectangle of the circle is {Cx-R,Cy-R,Cx+R,Cy+R}

    SkPath path;

    path.arcTo({Cx-R,Cy-R,Cx+R,Cy+R}, radian2degree(A), radian2degree(W), false);

  6. #6
    Active Member
    Join Date
    2007-06
    Posts
    95


    Default Re: A little direction please...

    Is there some reason to use the:
    public Void ArcTo (SKRect oval, Single startAngle, Single sweepAngle, Boolean forceMoveTo)

    overload for the AddArc Method?

    It seems that the Curve Info table gives you enough to find both the startpoint (via endpoint of previous line) and endpoint (via chord length and bearing) of the arc as well as the radius. Couldn't the overload:
    public Void ArcTo (SKPoint point1, SKPoint point2, Single radius)

    be used?

  7. #7
    Member
    Join Date
    2017-03
    Posts
    7


    Default Re: A little direction please...

    Thanks for replying.

    I am not a graphics\GIS type, so all this is fairly new to me. I do not know what to take from the curve info table, what formula to use to get the values needed for the method calls, let alone which of the overrides to use.

    You are saying to use the 'ArcTo (SKPoint point1, SKPoint point2, Single radius)', which is more then I knew, but I unclear on what values to use.

    endpoint of previous line - the last point\straight line, in the drawline ?
    endpoint (via chord length and bearing) of the arc = ?
    radius = ?

  8. #8
    Active Member
    Join Date
    2007-06
    Posts
    95


    Default Re: A little direction please...

    Let me first say that I have no experience whatsoever with SkiaSharp. The method call look similar to both XAML and AutoCAD’s.

    In one of the links you said “ I can take a survey map line, like ‘N 06 27 11 E’ 488.27, and can come up with 54.87623 -485.1765”.
    I take that to mean you can project a bearing and distance from your current position(position as an SKPoint, perhaps).

    That’s good because the Curve Info Table includes data describing the arc’s chord (A chord is the straight line between the two endpoints of an arc)
    So if you processed the Chord Bearing and Chord Length from the Curve Info Table(the same way you were able to derive 54.87623 -485.1765) you could use the current position’s SKPoint.Offset method. For example using N 06 27 11 E :
    SKPoint arcEndpoint = CurrentPosition.Offset(54.87623 -485.1765)

    Those two points, as well as the appropriate radius, may then be used with :
    public Void ArcTo (SKPoint point1, SKPoint point2, Single radius)

    So the theory goes.

  9. #9
    Member
    Join Date
    2017-03
    Posts
    7


    Default Re: A little direction please...

    I have been trying to understand your instructions, made some progress, but not enough.

    There are 9 coordinates...
    54.87623 -485.1765, 1
    179.7689 -507.0286, 2 C1
    65.13455 -501.0532, 3
    89.57177 -528.5947, 4 C2
    37.36042 -1038.036, 5
    88.97673 -1027.655, 6 L1
    160.4506 -1012.855, 7
    196.4012 -1004.363, 8 L2
    358.8415 -965.3903 9

    Property layout...
    Property.PNG

    This is the C# SkiaSharp code. I have the x,y coordinates (above) in two separate arrays...

    using (var path = new SKPath())
    {
    path.MoveTo(MyGlobals.strX[0], MyGlobals.strY[0]); // [0]
    for (int i = 1; i < MyGlobals.strX.Length; i++) // [1] +
    {
    if (i == 1)
    {
    //SKPoint SkPoint1 = new SKPoint(MyGlobals.strX[0], MyGlobals.strY[0]);
    SKPoint SkPoint2 = new SKPoint(MyGlobals.strX[1], MyGlobals.strY[1]); //curve
    SKPoint SkPoint3 = new SKPoint(MyGlobals.strX[0], MyGlobals.strY[0]); //create 0 again for use with offset
    SkPoint3.Offset(SkPoint2); //x=234.6451 y=-992.2051
    //path.ArcTo(SkPoint1, SkPoint3, 335);
    path.ArcTo(SkPoint2, SkPoint3, 335);
    continue;
    }
    if (i == 3)
    {
    //SKPoint SkPoint1 = new SKPoint(MyGlobals.strX[2], MyGlobals.strY[2]);
    SKPoint SkPoint2 = new SKPoint(MyGlobals.strX[3], MyGlobals.strY[3]); //curve
    SKPoint SkPoint3 = new SKPoint(MyGlobals.strX[2], MyGlobals.strY[2]); //create 2 again for use with offset
    SkPoint3.Offset(SkPoint2); //x=154.7063 y=-1029.648
    //path.ArcTo(SkPoint1, SkPoint3, 25);
    path.ArcTo(SkPoint2, SkPoint3, 25);
    continue;
    }

    path.LineTo(MyGlobals.strX[i], MyGlobals.strY[i]);
    }


    path.Close();

    And this is the SkiaSharp DrawPath draws...
    SkiaSharpImage.PNG

    Obviously I am not doing this correctly. I am getting curves, but it looks nothing like the other attached property image.

  10. #10
    Active Member
    Join Date
    2007-06
    Posts
    95


    Default Re: A little direction please...

    To generate the number of direction vectors , there seems to be a missing coordinate in you listing above. Presumably it is MyGlobals.StrX[0], MyGlobals,strY[0]. Based on what I see in AutoCAD, I’d say it is around 350, -975.

    Perhaps, for the time being, we just limit the task to generating straight lines (i.e., the chord line for the arcs) even it’s just to help me visualize that general process with SkiaSharp.

    The attached PDF shows what happens when I import those coordinates into AutoCAD, and possible fixes for the demonstrated issues. Augi is not letting me upload files at this time.

    Is it possible that there is a glitch in the algorithm that converts Direction and Magnitude into coordinates?

Page 1 of 2 12 LastLast

Similar Threads

  1. LOOKING FOR DIRECTION
    By oLDsCHOOL in forum Revit Architecture - General
    Replies: 5
    Last Post: 2012-03-29, 09:04 PM
  2. I need a direction here
    By burninin1 in forum Inventor - General
    Replies: 7
    Last Post: 2008-12-14, 05:54 PM
  3. grain direction
    By danilojrmercado in forum Revit - Rendering
    Replies: 6
    Last Post: 2008-12-03, 08:11 PM
  4. Direction of a box in VBA
    By ruselgun in forum VBA/COM Interop
    Replies: 1
    Last Post: 2008-09-23, 04:18 PM
  5. direction of surfaces
    By ibn_seeena in forum MDT - General
    Replies: 3
    Last Post: 2008-02-19, 06:12 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •