RhinoCommon discrepancy

Hello,
I’m developing a GH plugin in C# VS. I use the RhinoCommon Curve.PerpendicularFrameAt method that gives slightly different results than the Grasshopper’s native “perpendicular frame.” Mismatching is more inconsistent while working on sharp corners on closed curves. Why does it happen? Is it a bug or an accepted norm? Thx.

Hi @Bakuri_Gogua,

Looks like GH is using Curve.GetPerpendicularFrames.

– Dale

Hello @dale ,
sorry for my late response. Yep, that was the case. Thank you

@dale, I have one more question. I scripted a GH component using GetPerpendicularFrames (modified it slightly to get only one frame at a given parameter). It works fine with most curves but has an issue with the rectangle when it is rotated around the X-axis (same on Y axis). with my script the frame tilts when reaching a slope. Can you please help how to solve the issue?

@Bakuri_Gogua - can you share a .GH file that isn’t doing what you want?

Thanks,

– Dale

@dale, since my plugin is not published yet I can’t share my GH file technically, but I have solved the issue myself by incorporating my logic and tweaking some options…but I didn’t delete my post eigther, idk if it is appropriate or not.
anyway, thank you so much. :pray:

@dale, Hello,
sorry to bother you again, but I badly need the functionality of the GH native component - “Nurbs Curve PWK”, inside my project. Is there any Rhinocommon method, or should we make some mathematical groundwork ourselves? Thanks.

@Bakuri_Gogua - the SDK samples on GitHub have examples that create both rational and non-rational NURBS curves.

– Dale

1 Like

@dale, Thanks for the link; it was very helpful. However, I would like to share a few insights with you.

  1. Non-Rational Nurbs sample code(Non-Rational) missing one line of code. After line 55, there should be a calculation for homogeneous points.
  2. Domain calculations are inaccurate(compared to Rhino/Grasshopper handling) since they map the parameter space based on the curve’s length, instead of using knots to define the NURBS curve domain.

Hi @Bakuri_Gogua,

  1. The weight of a control point for a non-rational NURBS curve is 1.0. But you are welcome to perform the useless homogeneous point computation if you want.

  2. Poorly parameterized objects may not intersect and trim properly when combined with other objects. “Poorly parameterized” means the curve’s domain or the surface’s u or v spaces are tiny or huge compared to the size of the object. When curves and surfaces are parameterized with a [0,1] domain, both the accuracy and the precision of geometric calculations like derivatives, intersections and closest points are reduced, sometimes dramatically. Ideally the domain of a curve is close to it’s length and the domains of a surface is close to is average breadth in the appropriate direction.

— Dale

I got it. :pray: