BramJ Posted October 4, 2011 Report Share Posted October 4, 2011 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? Quote Link to comment
GregSands Posted October 4, 2011 Report Share Posted October 4, 2011 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. Quote Link to comment
BramJ Posted October 6, 2011 Author Report Share Posted October 6, 2011 Thanks for the tips Should be able to start working on it some more on monday Quote Link to comment
BramJ Posted October 12, 2011 Author Report Share Posted October 12, 2011 A little update: I have implented this using lvODE, in the end it was pretty simple Quote Link to comment
GregSands Posted October 12, 2011 Report Share Posted October 12, 2011 A little update: I have implented this using lvODE, in the end it was pretty simple That's probably a much nicer and easier way to go. Glad it was simple. Quote Link to comment
vugie Posted October 13, 2011 Report Share Posted October 13, 2011 That's probably a much nicer and easier way to go. Glad it was simple. And I'm glad it was lvODE Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.