#ifndef EDGEMESH_HPP #define EDGEMESH_HPP #include "beam.hpp" #include "mesh.hpp" #include "utilities.hpp" #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>, Mesh { 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(); /* * The copy function shold be a virtual function of the base interface Mesh class. * https://stackoverflow.com/questions/2354210/can-a-class-member-function-template-be-virtual * use type erasure (?) * */ bool copy(VCGEdgeMesh &mesh); void removeDuplicateVertices(); void deleteDanglingVertices(); void deleteDanglingVertices(vcg::tri::Allocator::PointerUpdater &pu); void getEdges(Eigen::MatrixX3d &edgeStartingPoints, Eigen::MatrixX3d &edgeEndingPoints) const; Eigen::MatrixX3d getNormals() const; bool plyFileHasAllRequiredFields(const std::string &plyFilename); bool loadUsingNanoply(const std::string &plyFilename); bool load(const std::string &plyFilename) override; bool save(const std::string &plyFilename) override; bool createSpanGrid(const size_t squareGridDimension); bool createSpanGrid(const size_t desiredWidth, const size_t desiredHeight); void createSpiral(const float °reesOfArm, const size_t &numberOfSamples); Eigen::MatrixX2i getEigenEdges() const; Eigen::MatrixX3d getEigenVertices(); Eigen::MatrixX3d getEigenEdgeNormals() const; void printVertexCoordinates(const size_t &vi) const; #ifdef POLYSCOPE_DEFINED polyscope::CurveNetwork *registerForDrawing( const std::optional> &desiredColor = std::nullopt, const bool &shouldEnable = true); void unregister() const; void drawInitialFrames(polyscope::CurveNetwork *polyscopeHandle_initialMesh) const; #endif 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