#ifndef EDGEMESH_HPP #define EDGEMESH_HPP #include "beam.hpp" #include "polymesh.hpp" #include "utilities.hpp" #include "vcgtrimesh.hpp" #include #include #include #include using EdgeIndex = size_t; class VCGEdgeMeshEdgeType; class VCGEdgeMeshVertexType; struct VCGEdgeMeshUsedTypes : public vcg::UsedTypes::AsVertexType, vcg::Use::AsEdgeType> {}; class VCGEdgeMeshVertexType : public vcg::Vertex {}; class VCGEdgeMeshEdgeType : public vcg::Edge {}; class VCGEdgeMesh : public vcg::tri::TriMesh, std::vector> { const std::string plyPropertyBeamDimensionsID{"beam_dimensions"}; const std::string plyPropertyBeamMaterialID{"beam_material"}; VCGEdgeMesh::PerEdgeAttributeHandle handleBeamDimensions; VCGEdgeMesh::PerEdgeAttributeHandle handleBeamMaterial; protected: Eigen::MatrixX2i eigenEdges; Eigen::MatrixX3d eigenVertices; Eigen::MatrixX3d eigenEdgeNormals; std::string label{"No_name"}; void getEdges(Eigen::MatrixX2i &edges); void getVertices(Eigen::MatrixX3d &vertices); public: VCGEdgeMesh(); template size_t getIndex(const MeshElement &meshElement) { return vcg::tri::Index(*this, meshElement); } void updateEigenEdgeAndVertices(); void copy(VCGEdgeMesh &mesh); void getEdges(Eigen::MatrixX3d &edgeStartingPoints, Eigen::MatrixX3d &edgeEndingPoints) const; Eigen::MatrixX3d getNormals() const; bool loadUsingDefaultLoader(const std::string &plyFilename); bool hasProperty(const std::vector &v, const std::string &propertyName); bool hasPlyEdgeProperty(const std::string &plyFilename, const std::vector &edgeProperties, const std::string &plyEdgePropertyName); bool plyFileHasAllRequiredFields(const std::string &plyFilename); bool loadUsingNanoply(const std::string &plyFilename); bool loadFromPly(const std::string plyFilename); bool savePly(const std::string plyFilename); bool createGrid(const size_t squareGridDimension); bool createGrid(const size_t desiredWidth, const size_t desiredHeight); void createSpiral(const float °reesOfArm, const size_t &numberOfSamples); Eigen::MatrixX2i getEigenEdges() const; Eigen::MatrixX3d getEigenVertices() const; Eigen::MatrixX3d getEigenEdgeNormals() const; std::vector getBeamDimensions() const; std::vector getBeamMaterial() const; void printVertexCoordinates(const size_t &vi) const; void registerForDrawing() const; std::string getLabel() const; void setLabel(const std::string &value); private: void GeneratedRegularSquaredPattern( const double angleDeg, std::vector> &pattern, const size_t &desiredNumberOfSamples); }; using VectorType = VCGEdgeMesh::CoordType; using CoordType = VCGEdgeMesh::CoordType; using VertexPointer = VCGEdgeMesh::VertexPointer; using EdgePointer = VCGEdgeMesh::EdgePointer; using ConstVCGEdgeMesh = VCGEdgeMesh; #endif // EDGEMESH_HPP