Algorithm for limiting a moving point to a 3d surface

I'm not sure where to start looking for information on this, so I'm asking here. Hopefully this is not too general. I wrote a particle library in C ++ and am trying to add the ability to contain particles on the mesh surface. Not a hard constraint, however - I want the particles to be able to slide across the surface when exposed to forces.

So, imagine I have an arbitrary concave mesh with n triangular edges. Then I have a 3D point (particle) positioned on one of the faces. A apply a directional force to this particle to make it move, but I want it to move in the surface topology, not just move linearly in space. It should move smoothly across the surface and always touch the mesh triangle.

I thought about the linear movement of the particle first, and then snapped it to the closest point on the surface, but that would run into a lot of problems, for example, the particle could snap to other non-adjacent parts of the mesh simply because they are at a shorter distance from the particle after moving it by force.

Then I thought about checking its barycentric coordinates and using them to determine which adjacent triangle it should move to if it leaves the boundaries of its current triangle ... but that seems like a very inefficient solution riddled with other problems (like if force moves the particle outside of all adjacent triangles).

Then I thought about using the UVW coordinates to figure out where the particle would go, but that wouldn't work either.

Any ideas?

Here's an image to help illustrate the problem:

enter image description here

+3


source to share





All Articles