
Advertisement
Sign in to follow this
Followers
0
How to find nearest vertex of a mesh to some other point?
By
ryt
, in Graphics and GPU Programming
This topic is 3079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.
If you intended to correct an error in the post then please contact us.
Recommended Posts
David_pb 1046
Maybe you can get it faster with a bit preprocessing. Some time ago I saw an approach, used in ASSIMP. They used an arbitrary plane to create a sorted list (the sort key was the distance of vertex to plane), after the list is created you simply take the distance of your reference vertex to the plane and search the closest entry, since the list is sorted you can do a binary search to gather some speed.
0
David Neubelt 866
Is the mesh convex or concave?
If it's convex then it's simple. Pick a vertex and walk towards the point you want to go to. That is walk in the direction of smaller distance. You'll find the point much faster then comparing all distances.
You will have to maintain connectivity in your mesh though.
Concave walking can also be done but it is a little more complicated.
= Dave
If it's convex then it's simple. Pick a vertex and walk towards the point you want to go to. That is walk in the direction of smaller distance. You'll find the point much faster then comparing all distances.
You will have to maintain connectivity in your mesh though.
Concave walking can also be done but it is a little more complicated.
= Dave
0
RobTheBloke 2553
Quote:
Original post by ryt
I dont understand why do you put this in dot_product()? I understand why are you subtracting, so you could get a vector from mesh_pt to other_pt and with other code I see what are you trying to accomplish.
dot(a,b)
{
return a.x*b.x + a.y*b.y + a.z*b.z;
}
lengthSquared(a)
{
#if 0
return a.x*a.x + a.y*a.y + a.z*a.z;
#else
// or....
return dot(a,a);
#endif
}
length(a)
{
return sqrt( lengthSquared(a,a) );
}
0
AndyFirth 162
if you're trying to deform mesh A based on proximity to a plane then do it in the vertex shader.
Use the planar distance and smoothstep towards the centre of the model along the normal to the vertex... this will also give you a "bouncy" look.
Use the planar distance and smoothstep towards the centre of the model along the normal to the vertex... this will also give you a "bouncy" look.
0
Sign in to follow this
Followers
0

Advertisement
Share this post
Link to post
Share on other sites