# How works "Offset curve on Surface"?

Hello everyone,
currently I’m working on my project about 3D-Print path planning on curved surface.
I have made a easy example in the picture.
I want to know how this function works principally? Because i need to write it in my thesis.offset on Surface.gh (7.0 KB)
offset on surface.3dm (3.4 MB)

I mean if I have given a curve, surface and distance, welche mathematic method or formula will be used, especially for offset on a curved surface?

Thank you very much

I doubt McNeel will provide the details of the algorithm used in Rhino. They usually consider details of algorithms to be proprietary.

I think so as well.

Maybe it’s not Rhino’s, but the simple geometric version, which only works for curves without kinks, could be.

1. Extract the points that define the curve.
2. Move the points on the surface.
2.1) Use the cross product of the tangent on the curve and the normal on the surface (using the closest point parameter) to have the direction.
2.2) Assign a magnitude small enough to accept the error in approximation of curvature and big enough so you don’t have to do 100000 iterations.
2.3) Move points.
2.4) Repeat step 2 until it meets a termination condition (e.g. offset distance).
3. Create a new curve with the offset points.

You can check the limits of this algorithm in the Offset On Surface Variable component of Peacock.

This becomes much more complicated when it is a polycurve.

1. Explode the curve.
2. Extract the points that generate each segment.
3. Move the points on the surface.
4. Create an offset segment with those points.
5. Extend the segments until they intersect with the previous and the next one.
6. Trim parts and join them.

You can also trim the surface from the curve to offset, and reconstruct it in such a way that you can simulate the offset of the curve using an isocurve.

Maybe there is a mathematical version that uses a mapping transformation from a euclidean space to the 2d space of the surface with which to offset correctly in 2d and then remape it back to the surface, but are mathematical too deep for me.

This stuff is really slow, here is an example I was using for a bit different reason might help.

CurveOffset.gh (121.8 KB)

Hi Dani,
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}