но я не могу понять одного: в каком месте сохранять координаты вершин?
struct HalfEdgeHandle { int64_t index = -1; };
struct VertexHandle { int64_t index = -1; };
struct FaceHandle { int64_t index = -1; };
struct HalfEdge{
//The face it belongs to, is invalid (== -1) if a boundary half-edge
FaceHandle fh;
//The vertex it points to is always valid
VertexHandle dst;
HalfEdgeHandle twin;
//The next HalfEdge in the CCW order is always valid
HalfEdgeHandle next;
//The previous HalfEdge in the CCW order can be stored for the optimization purposes. For the triangle meshes prev = next->next->next
HalfEdgeHandle prev;
};
struct Face{
//One of the HalfEdges belonging to the Face, always valid
HalfEdgeHandle heh;
};
struct Vertex{
//An outgoing HalfEdge from this vertex. It is == -1 if the vertex is isolated
HalfEdgeHandle heh;
};
class HalfEdgeTable{
public:
VertexHandle addVertex(glm::vec3 position);
FaceHandle addFace(VertexHandle vh0, VertexHandle vh1, VertexHandle vh2);
//Builds twins for half-edges. This function must be called in the end
void connectTwins();public: const
std::vector<Vertex>& getVertices() const;
const std::vector<Face>& getFaces() const;
private:
// TODO
};
логика мне говорит, что в Vertex?
Обсуждают сегодня