reverse a curve's direction?

billy2
billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
Is there a simple way to reverse the direction of a curve?

evEdgeTangentLine(context, { "edge" : curve, "parameter" : i }).origin;

such that i=0 moves to the opposite end of the curve.

Comments

  • ilya_baran
    ilya_baran Onshape Employees, Developers, HDM Posts: 1,278 image
    We don't have a way to do that currently.  What is your use-case?
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    edited December 2016
    fit spline, I was hoping I wouldn't have to deal with this, but it won't fix itself.

    Below are dis-jointed arcs, it'd be nice to change the direction for arc on left.

    I think I'll have to pass through my curve selection list and check the direction for each curve.



    Here's another example, the direction isn't correct.

    Highlighted spline's direction is different from 2nd spline. 2nd spline is mirrored from 1st so the geometry was created correctly.



    I think I have to sort the list and get the curve directions to all line up.

    Do you know a special algorithm like 'dirty man in the middle' that will fix this in one line of code?




  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    I have the closed option working:


  • billy2
    billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,206 PRO
    It was more than 1 line of code