# project a spline on a surface

This topic is 3076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,

I build a natural cubic spline through n points picked on triangles surface.
I would like project the spline on the surface along the normal face direction and find the intersection between projected spline and triangle edge.
How can do it? Can you suggest me a way to do it?

Ale.

##### Share on other sites
I'm not exactly sure what you're trying to do here... if you project any curve from a triangle's surface along the face normal direction then it just moves away from the surface; it won't ever intersect the edges of that triangle (assuming the curve is fully contained within the triangle to begin with).

Maybe you can draw a picture of what you need?

##### Share on other sites
Quote:
 Original post by ApochPiQI'm not exactly sure what you're trying to do here... if you project any curve from a triangle's surface along the face normal direction then it just moves away from the surface; it won't ever intersect the edges of that triangle (assuming the curve is fully contained within the triangle to begin with).Maybe you can draw a picture of what you need?

Ok, in my first picture I picked some points on the bunny surface and then I
build a closed natural cubic spline to interpolate them. As you can see
the picked points (white colored) and the spline (blue colored). My spline pass inside the triangle surface. But I would like a spline that follow the surface.

I draw with the brush what I need. A draw a black line represent the projection of the blue spline on bunny surface and the green points represent black line intersection with triangles edge.

Thanks.

Ale.

##### Share on other sites
Someone else may have a better solution than this, but the first thing that came to mind would be to do something like the following:

• Start with a single segment of the curve, e.g. the first two points clicked. Once we go through the following steps for that segment, we can repeat them for subsequent segments to finish the job.

• Get a list of all intersections between the segment and the mesh, including the start and endpoints themselves.

• Divide up the original segment into subsegments, one subsegment per intersection. You should end up with a list of each "piece" of the original segment that is "inside" or "outside" the mesh itself. If piece N is inside the mesh, piece N+1 (or N-1) should be outside, and so on. As above, we will repeat a simple set of steps for every subsegment in the list.

• For each relevant polygon, project the current subsegment onto the polygon's plane. If the projected subsegment does not overlap the polygon at all, ignore the polygon and move on to the next polygon. If the projected subsegment lies entirely inside the polygon, move the subsegment's endpoints to the projected positions on the polygon plane, and move on to the next subsegment. Otherwise, for each point where the subsegment intersects the polygon, insert a new control point (i.e. divide the subsegment in two parts at the intersection point) and repeat the above process recursively until you stop dividing the subsegment or otherwise making changes.

• At this point you should have a list of control points lying along the surface of the mesh; since they will follow every seam between polygons precisely, you might actually get less accurate results by converting to a spline at this point. Assuming the polygon detail level is high enough, just using a linear-segment curve should be Good Enough for most purposes.

Hope that at least gets you started in the right direction [smile]

1. 1
2. 2
Rutin
28
3. 3
4. 4
khawk
14
5. 5

• 11
• 11
• 23
• 10
• 9
• ### Forum Statistics

• Total Topics
633648
• Total Posts
3013112
×