Name: Anonymous 2012-01-04 5:45
Hi /prog/
I'm trying to define a polygon, inside the polygon I have a vertexes array, a edges array and a faces array.
edges contains the indexes of the vertexes array of the two points connected.
something like this:
now this works fine, but if I order the vertex array, I mess up with the edges, and will be really complicated to restore all the indexes...
is it Possible to make an edge like a reference for a vertex? Like a pointer to the vertex in the vertex array?
I'm trying to define a polygon, inside the polygon I have a vertexes array, a edges array and a faces array.
edges contains the indexes of the vertexes array of the two points connected.
something like this:
std::vector<vertex> vertexes;
std::vector<edge> edges;
typedef std::vector<edge>::const_iterator cEdgeIt;
void render_edges(Polygon p){
for(cEdgeIt = p.edges.begin(); cEdgeIt != p.edges.end(); ++cEdgeIt){
edge e = *cEdgeIt;
vertex1 = vertexes[e[0]];
vertex2 = vertexes[e[1]];
drawLine(vertex1, vertex2);
}
}now this works fine, but if I order the vertex array, I mess up with the edges, and will be really complicated to restore all the indexes...
is it Possible to make an edge like a reference for a vertex? Like a pointer to the vertex in the vertex array?