19 bool linkVerticesWithMesh)
22 theVertices(_theVertices),
23 verticesLinked(linkVerticesWithMesh) {}
112 }
catch (
const std::bad_alloc&) {
121 }
catch (
const std::bad_alloc&) {
134 if (
static_cast<size_t>(triIndex) >=
m_triIndexes.size()) {
151 weights.
x = sqrt(((P - B).
cross(C - B)).norm2d()) ;
152 weights.
y = sqrt(((P - C).
cross(A - C)).norm2d()) ;
153 weights.
z = sqrt(((P - A).
cross(B - A)).norm2d()) ;
156 double sum = weights.
x + weights.
y + weights.
z;
void normalize()
Sets vector norm to unity.
Vector3Tpl< PointCoordinateType > toPC() const
Vector3Tpl< double > toDouble() const
Cast operator to a double vector (explicit call version)
void setValidity(bool state)
Sets bonding box validity.
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the cloud bounding box.
A generic 3D point cloud with index-based point access.
virtual const CCVector3 * getPoint(unsigned index) const =0
Returns the ith point.
virtual bool normalsAvailable() const
Returns whether normals are available.
virtual const CCVector3 * getNormal(unsigned index) const
If per-point normals are available, returns the one at a specific index.
A generic mesh with index-based vertex access.
std::function< void(GenericTriangle &)> genericTriangleAction
Generic function to apply to a triangle (used by foreach)
A generic triangle interface.
virtual bool resize(unsigned n)
Resizes the mesh database.
unsigned globalIterator
Iterator on the list of triangles.
void forEach(genericTriangleAction action) override
Fast iteration mechanism.
~SimpleMesh() override
SimpleMesh destructor.
SimpleTriangle dummyTriangle
Dump triangle structure to transmit temporary data.
GenericTriangle * _getNextTriangle() override
Returns the next triangle (relatively to the global iterator position)
bool normalsAvailable() const override
Returns whether normals are available.
BoundingBox m_bbox
Bounding-box.
virtual void addTriangle(unsigned i1, unsigned i2, unsigned i3)
Adds a triangle to the mesh.
VerticesIndexes * getNextTriangleVertIndexes() override
VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex) override
Returns the indexes of the vertices of a given triangle.
GenericIndexedCloud * theVertices
The associated point cloud (vertices)
SimpleMesh(GenericIndexedCloud *_theVertices, bool linkVerticesWithMesh=false)
SimpleMesh Constructor.
void getTriangleVertices(unsigned triangleIndex, CCVector3 &A, CCVector3 &B, CCVector3 &C) const override
Returns the vertices of a given triangle.
void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax) override
Returns the mesh bounding-box.
virtual bool reserve(unsigned n)
Reserves the memory to store the triangles (as 3 indexes each)
void placeIteratorAtBeginning() override
Places the mesh iterator at the beginning.
GenericTriangle * _getTriangle(unsigned triangleIndex) override
Returns the ith triangle.
bool interpolateNormals(unsigned triIndex, const CCVector3 &P, CCVector3 &N) override
Interpolates normal(s) inside a given triangle.
TriangleIndexesContainer m_triIndexes
The triangles indexes.
__host__ __device__ float3 cross(float3 a, float3 b)
Generic file read and write utility for python interface.
Triangle described by the indexes of its 3 vertices.