Offset Point on Surface in RhinoCommon

As mentioned in the title - I need to offset point on the surface.

The way I can do it now is the following:

  • Offset input curve (Curve.OffsetOnSurface) with certain distance
  • Get a point on the basic curve
  • Find closest point on the offset curve.

But actually I don’t need an offset curve.
Any way to make it faster?

Thanks in advance,

Can you add a picture of what you’re trying to do?

The problem I have with understanding this is, that there is no way to offset a point, because it lacks any information about a direction. You can only move it somewhere in space.

If you have the surface parameters for the point, call NormalAt() to get the normal vector. Then add Point + dist*Normal. If you don’t have the parameters, call ClosestPoint to get them.

Example is below:

yes, but direction I need is actually a perpendicular to the offset curve.

Ah I see.

Well I’d probably draw a circle around the curve, with it’s normal parallel to the curve, and then intersect the geometrys to get the point.

Oh. That’s very different, and not so easy. The direction will be the cross product of the normal with the curve tangent. You can make a circle of radius dist in the plane given by the point and the curve tangent and intersect it with the surface.

If you want to measure the distance along the surface then Intersect the plane with the surface and find the distance along the curve. If I remember correctly, this is how OffsetCurveOnSurface figures out the points it fits the results to.

1 Like

Rhinocommon for R6 has a .GetLocalPerpPoint method that I was using for stuff like this.

Edit: missed the part where you don’t need the curve. This works for finding the perp location on a curve from a sample point and seed param on curve.

Ok, thank you all, guys.

This means that Curve/Surface intersection will work faster than Curve.OffsetOnSurface, right?

Not necessarily but probably. I looked at the code to be sure. Apparently (it was a while ago) I wrote special case intersection code for this that uses the fact that I know the start and end of the intersection curve and assumes that there is only one result. The general intersector doesn’t get to make those assumptions.

(Edit) My last comment was about surface-surface intersection. Yes, one call to curve-surface intersection will be faster than OffsetCurveOnSurface.