I have a set of discrete points and using them, I performed Delaunay's triangulation.
I want to calculate all the edge lengths from a vertex to the neighboring vertices.
How can I do/code this in c++?
I haven't tested the code that you posted, but the problem seems trivial.
In your main
function after you draw all the triangles/points, get the list of all the triangles from subdiv
with:
vector<Vec6f> triangleList; subdiv.getTriangleList(triangleList);
(just like in the draw_delaunay(...)
function)
Now you just iterate the triangles and compare each point of each triangle to your vertex.
v = point - your_vertex
= Sqrt(vx^2 + vy^2)
. There may be duplicates of some edges, so if you want to avoid it, just create a set and add all the point there and calculate the norms later.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.