Finding out the nearest vertices from a picked point.

16 views
Skip to first unread message

Dave

unread,
Oct 18, 2010, 9:39:22 PM10/18/10
to O3D-discuss
Hi,

For example, if I had a mesh and I had picked a point on the mesh, how
can O3D know which vertex have the nearest distance with that picked
point?

Do I really have to loop through the vertex buffer and calculate the
euclidean distance for every single vertices? That sounds like a
performance killer to me especially running in Javascript. Or is there
any way to harness GPU power to do such intensive calculation using
O3D or WebGL syntax?

Regards,
Dave

Nicolas Kassis

unread,
Oct 19, 2010, 12:11:29 AM10/19/10
to o3d-d...@googlegroups.com
Just wondering because I do something similar. Can you find the index
of the triangle you are hitting and the 3 vertices in it? That's
basically what I've done.

NIc

> --
> You received this message because you are subscribed to the Google Groups "O3D-discuss" group.
> To post to this group, send email to o3d-d...@googlegroups.com.
> To unsubscribe from this group, send email to o3d-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/o3d-discuss?hl=en.
>
>

--
-----------------
Nicolas Kassis

Dave

unread,
Oct 19, 2010, 9:32:05 PM10/19/10
to O3D-discuss
Hi Nicolas,

That can be a good idea, since picking had already looped through the
index buffer already.

But one more thing I would like to ask is that, which is taking this
idea into the next step, how about finding the closest vertices with
the selected vertices. E.g. I had select a vertex, and I would like to
find the other closest vertex that is connected to the selected
vertex. How can I achieve this without looping through the vertex
buffer since it doesn't have picking to find out the indexes.

What I am trying to achieve is that the user can draw a simple line on
the 3D mesh, the drawn line will determine the starting vertex and the
ending vertex, and can select a series of vertices in between that
connect between the start vertex and end vertex.

The 3D mesh is quite dense, often contains 65,000 polygons.

Any help from O3D developers is also highly appreciate as well.

Thanks

Regards,
Dave
> > For more options, visit this group athttp://groups.google.com/group/o3d-discuss?hl=en.
>
> --
> -----------------
> Nicolas Kassis

Nicolas Kassis

unread,
Oct 19, 2010, 11:02:09 PM10/19/10
to o3d-d...@googlegroups.com
Yeah I understand what you mean I think, are the vertices repeated or
do you use the same vertices for multiple polygons?

Nic

> For more options, visit this group at http://groups.google.com/group/o3d-discuss?hl=en.
>
>

--
-----------------
Nicolas Kassis

Dave

unread,
Oct 21, 2010, 1:30:25 AM10/21/10
to O3D-discuss
Hi Nicholas,

Some vertices may be repeated due to the reason that I'm using UV per-
vertex (I have no idea how to make it UV per-wedge to work), so yeah
the vertices are repeated.

Regards,
Dave
Reply all
Reply to author
Forward
0 new messages