Why plane direction is changing, when curve tangents are same, RhinoCommon


#1

Why plane direction is changing in places, when curve/arc tangents are same?
Please see the attached 3dm file.profile_EXTRUSION_ARC1.3dm (1.1 MB)


GetPerpendicularFrames planes changing directions
(David Rutten) #2

What arc tangents?

When you create a plane from origin point and normal vector then the results will not be smoothly consistent across all possible directions. This is because the problem is actually underdefined. There’s an infinite number of different planes that all share the same origin and z-axis and Rhino just has to pick one of these.

If you want to generate planes that do not suddenly flip then you must use the actual curve geometry to guide the plane orientation. You can do so with the Curve.GetPerpendicularFrames method, which is smart enough to reduce rotation between successive planes to a minimum.


#3

Thanks!
I was using FrameAt but suddenly it started to give horizontal plane.
So, I have to use Perpendicular Frames…

FrameAt was giving me horizontal planes.


(David Rutten) #4

The curve frame is a plane which uses the curve tangent direction and the curvature plane for orientation. So if the curve is on the XY plane, then the frame will also be flat (though I’m not sure how it behaves if the curve has no curvature at all).


#5

OK . Now understood. Thank a lot !


#6

What is the equivalent command to GetPerpendicularFrame() in c++ sdk?

I have exactly the same problem that the normal planes suddenly flip using the point and the normal vector method.

I tried to use FrameAt() and then rotate the generated plane using transformations:

... 
ON_Plane Frame;
Curve.FrameAt(a, Frame); // "a" is the parametric value of a point on "Curve"

// Get the point coordinates and the tangent vector
ON_3dPoint Current_Point{};
ON_3dVector Current_Point_Tangent{};
Curve.EvTangent(a, Current_Point, Current_Point_Tangent);

// rotate the Frame so that the frame normal and the tangent vector are in the same direction`
xform.Rotation(Frame.Normal(), Current_Point_Tangent, Current_Point);
Frame.Transform(xform);

But the final planes are still different in orientation.


(Dale Fugier) #7

Hi @resammc,

RhinoCommon’s Curve.GetPerpendicularFrames calls the RhinoGet1RailFrames C++ SDK function.

https://developer.rhino3d.com/api/cpp/group___rhino.html#ga5e746ae6c44d17f87297c037d4789515

– Dale


#8

Thanks a lot @dale. I’ll give it a try.

PS. Perfect! Works like a charm. Many thanks…