Jump to content

3D Meshes, determine if meshes are intersecting?


BramJ

Recommended Posts

Hello,

I'm building software to control a machine to align a sensor in a camera.

There needs to be a way to limit the movement of the head to prevent damage to the camera, sensor or the machine. Currently this is done by limiting each axis so that you get a box in which the head can move. But this also limits the movement in areas where the head should be able to move freely (to the left and right of camera for instance). I could offcourse define more boxes but it would be even greater if I could load the complex 3D shapes of the machine, head and camera (didn't try yet, but should be possible from what I read) and display them in a 3D Picture box and then determine if the meshes are intersecting or not.

Does anyone have any idea how I can determine if the meshes are intersecting? Any tips in which direction I need to look?

Link to comment

It probably depends on how large your meshes are. If they don't have many vertices, the brute force approach is simplest and perhaps fast enough. Something like checking that all your vertices in one object are on the "outside" of the triangles of your second object. There are a few ways to compute that - I think one easy one is to compute the scalar triple product [a . (b x c) or det(a b c)] of the vectors a = v1-p, b=v2-p, c=v3-p between a point p(x,y,z) and the vertices v1, v2, v3 of a triangle - the sign of this product/determinant is positive if [p1, p2, p3] are clockwise, and negative if anticlockwise. That gives some idea which side of the triangle you're on. I imagine you also want to stop before they intersect, not after, so checking the distance to the plane of each triangle is also fairly easy.

Searching for "collision detection algorithm" gives a few possibilities, but most are game related or overly complex.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.