[Insight-users] Get the coordinate of source and destination of a QuadEdge
David Doria
daviddoria+itk at gmail.com
Tue Sep 15 14:09:13 EDT 2009
Consider a mesh like this:
MeshType::PointType p0,....
p0[0]= -1.0; p0[1]= -1.0; p0[2]= 0.0; // first point ( -1, -1, 0 )
....
mesh->SetPoint( 0, p0 );
.....
Then I add lines connecting these points. Then I get an edge:
MeshType::QEPrimal* edge = mesh->GetEdge(); //not sure which edge this
is getting?
And the indices of the points that make up this edge:
MeshType::CoordRepType origin = edge->GetOrigin();
MeshType::CoordRepType destination = edge->GetDestination();
std::cout << "origin: " << origin << std::endl;
std::cout << "Destination: " << destination << std::endl;
Now I want to get back my original coordinate (-1, -1, 0). This compiles,
but segfaults (the output of origin and destination was 3, 2, respectively,
so these are valid point indices on the mesh):
MeshType::PointType* p;
mesh->GetPoint(origin, p );
std::cout << "p: " << p[0] << " " << p[1] << " " << p[2] << std::endl;
The bottom line is: how do I get the coordinate of a point (and potentially
other attached information) by it's mesh index?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090915/d4df8190/attachment.htm>
More information about the Insight-users
mailing list