#include "ct_mesh.h" #include "ct_cloud/tools/abstract/ct_abstractglobalcloudmanagert.h" #include "ct_mesh/tools/ct_meshallocatort.h" #include "ct_mesh/ct_face.h" #include "ct_mesh/ct_edge.h" #ifdef _MSC_VER #define _USE_MATH_DEFINES #include #endif CT_Mesh::CT_Mesh() { m_pVert = NULL; m_pFace = NULL; m_pHedge = NULL; } CT_Mesh::~CT_Mesh() { clear(); } CT_AbstractModifiablePointCloudIndex& CT_Mesh::vert() const { return *pVert(); } CT_AbstractModifiableFaceCloudIndex& CT_Mesh::face() const { return *pFace(); } CT_AbstractModifiableEdgeCloudIndex& CT_Mesh::hedge() const { return *pHedge(); } CT_AbstractModifiablePointCloudIndex* CT_Mesh::pVert() const { if(m_vert == NULL) return NULL; return m_vert->abstractModifiableCloudIndexT(); } CT_AbstractModifiableFaceCloudIndex* CT_Mesh::pFace() const { if(m_face == NULL) return NULL; return m_face->abstractModifiableCloudIndexT(); } CT_AbstractModifiableEdgeCloudIndex* CT_Mesh::pHedge() const { if(m_hedge == NULL) return NULL; return m_hedge->abstractModifiableCloudIndexT(); } CT_AbstractPointCloudIndex* CT_Mesh::abstractVert() const { return m_pVert; } CT_AbstractFaceCloudIndex* CT_Mesh::abstractFace() const { return m_pFace; } CT_AbstractEdgeCloudIndex* CT_Mesh::abstractHedge() const { return m_pHedge; } CT_MPCIR CT_Mesh::registeredVert() const { return m_vert; } CT_MFCIR CT_Mesh::registeredFace() const { return m_face; } CT_MECIR CT_Mesh::registeredHedge() const { return m_hedge; } void CT_Mesh::createCylinder(double radius, double height, int sides, double xPos, double yPos, double zPos) { clear(); double inc = (2.0 * M_PI) / ((double)sides); double theta = 0; CT_MutablePointIterator vi = CT_MeshAllocatorT::AddVertices(this, 2*sides); CT_MutableFaceIterator fi = CT_MeshAllocatorT::AddFaces(this, 2*sides); CT_MutableEdgeIterator ei = CT_MeshAllocatorT::AddHEdges(this, 6*sides); vi.next(); fi.next(); ei.next(); double minH = 0; double maxH = height; CT_Point v; v(0) = maxH + xPos; v(1) = radius + yPos; v(2) = zPos; vi.replaceCurrentPoint(v); size_t p = vi.cIndex(); for(size_t i=0; iglobalCloudManager()->setEnableSyncForCIR(m_newEdge[i].data(), false); // disable sync of all face created s = m_newFace.size(); for(size_t i=0; iglobalCloudManager()->setEnableSyncForCIR(m_newFace[i].data(), false); // clear edge s = m_newEdge.size(); for(size_t i=0; i