Jump to content
  • Advertisement
Sign in to follow this  
alessio_pi_

project a spline on a surface

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

If you intended to correct an error in the post then please contact us.

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?


Thanks in advance.


Ale.

Share this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Quote:
Original post by ApochPiQ
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?


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.

http://picasaweb.google.it/Ale211734/IMMAGINILAVORO?authkey=Gv1sRgCIj1jsX9-q-vhQE#5491543618469790258


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.

http://picasaweb.google.it/Ale211734/IMMAGINILAVORO?authkey=Gv1sRgCIj1jsX9-q-vhQE#5491543630499650866

Thanks.


Ale.



Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!