PDA

View Full Version : Point projection in open inventor



artmansoft
02-27-2010, 10:37 AM
I have a model in open inventor and I want to project point (0,0,0) to the nearest position in the model. What should I do?

mikeheck
03-04-2010, 05:06 PM
I don't know a simple solution for the general case (but would be interested to hear of one). It's more of a computational geometry question than an Inventor question per se. Using SoRayPickAction is a simple solution in some special cases. For example if you are "flying" over some terrain and need to find your relative altitude, simply apply a pick action with a ray pointing straight "down". If the model is relatively symmetrical, applying a pick action with a ray from your point to the geometric center of the model could give an approximately correct answer. In the general case I suppose you could examine all the vertices in the model and either find the closest vertex (which is the solution) or find the triangle with the closest vertices then apply a ray pick action with a ray from your point through the geometric center of the triangle. If you have to do this frequently then sorting the vertices, for example into an octree, would be better than a brute force search.

-Mike