#pragma once #include "AbstractMesh.h" #include "Point.h" #include "Node.h" #include #include #include #include class Edge; class TriFace; using NodePtr = std::unique_ptr; using EdgePtr = std::unique_ptr; using TriFacePtr = std::unique_ptr; using VecNodes = std::vector; using VecEdges = std::vector; using VecFaces = std::vector; class TriMesh : public AbstractMesh { public: TriMesh() = default; ~TriMesh(); void populate(VecNodes& nodes, VecEdges& edges, VecFaces& faces); template std::vector getVerticesFlat(T scaleX = 1.0, T scaleY = 1.0, T scaleZ = 1.0) const { std::vector ret(3*mNodes.size()); for(std::size_t idx = 0; idxgetPoint().getX()/scaleX; ret[3*idx + 1] = node->getPoint().getY()/scaleY; ret[3*idx + 2] = node->getPoint().getZ()/scaleZ; } return ret; } std::vector getFaceNodeIds() const; void addConstantFaceVectorAttribute(const std::string& tag, const std::vector& values); void addConstantNodeVectorAttribute(const std::string& tag, const std::vector& values); std::vector > getFaceVectorAttributes(const std::string& tag); std::vector > getNodeVectorAttributes(const std::string& tag); void addVectorAttribute(const std::string& tag, const std::vector& values); bool hasVectorAttribute(const std::string& tag) const; std::vector getVectorAttribute(const std::string& tag) const; MeshType getType() const { return MeshType::TRI; } private: std::unordered_map > mVectorAttributes; VecNodes mNodes; VecEdges mEdges; VecFaces mFaces; };