PDA

View Full Version : distance to vertex


yznah
01-08-2004, 09:50 PM
i wanted to know if there is any way to get the list of the vertex or the nearest vertex from a given position, in any other way than the ugly method that consists to test of every vertex of the mesh ;)

nendo
01-09-2004, 09:29 AM
try `closestPointOnMesh`which come with the bonus game tools
(plugin closestPointOnMesh.mll).

jdj
01-15-2004, 02:57 PM
Originally posted by yznah
i wanted to know if there is any way to get the list of the vertex or the nearest vertex from a given position, in any other way than the ugly method that consists to test of every vertex of the mesh ;)

...in the world of computers I am afraid that you need to go ugly all the time... :shrug: ...even if you do it in a plugin.

Cheers!
/ Daniel

Marcel
01-16-2004, 10:38 AM
I had the same problem, testing every vertex is very slow. I asked the question to my programmer co-worker, and he said a 'hash table' could speed things up. The concept is very simple:

You get all the vertex data
You sort the data from small to large numbers

Now whenever you need to see if a vertex value is within a certain margin you test the vertices above and below you in the hash table. If you test the vertex above and the value is too big you know all the values above are bigger so you can stop testing. Same principle with lower values.

Ofcourse this is a lot of work to implement, but it could speed things up a lot.
I took the easy way and put in a progressbar instead. :thumbsup:

CGTalk Moderation
01-17-2006, 02:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.