Core 1.0
MeshTopo Class Reference

Core triangle mesh with indexed neighboring triangles. More...

#include <mesh.h>

Inheritance diagram for MeshTopo:
Mesh

Public Member Functions

 MeshTopo ()
 Empty.
 
 MeshTopo (const Mesh &)
 Create a topological mesh from a mesh.
 
 ~MeshTopo ()
 Empty.
 
void EdgeCollapse (const double &)
 Perform a simple edge collapse algorithm over a triangle mesh.
 

Protected Member Functions

void EdgeCollapse (int)
 Collapse an edge in the triangle mesh.
 
- Protected Member Functions inherited from Mesh
void AddTriangle (int, int, int, int)
 Add a triangle to the geometry.
 
void AddSmoothTriangle (int, int, int, int, int, int)
 Add a smooth triangle to the geometry.
 
void AddSmoothQuadrangle (int, int, int, int, int, int, int, int)
 Add a smmoth quadrangle to the geometry.
 
void AddQuadrangle (int, int, int, int)
 Add a quadrangle to the geometry.
 
void AddQuadrangle (int, int, int, int, int)
 Add a quadrangle to the geometry.
 
void AddPentagon (int, int, int, int, int, int)
 Add a pentagon to the geometry.
 
void AddArray (int, int)
 Add a grid structure.
 
int NextIndex (int) const
 Compute the next index of an edge in a triangle.
 
int PrevIndex (int) const
 Compute the previous index of an edge in a triangle.
 
int BaseIndex (int) const
 Compute the base triangle index given an edge index.
 
 Mesh ()
 Initialize the mesh to empty.
 
 Mesh (const Mesh2 &)
 Initialize the structure from a two dimensional mesh.
 
 Mesh (const QVector< Vector > &)
 Create a mesh from a set of vertices.
 
 Mesh (const QVector< Vector > &, const QVector< int > &, bool=true)
 Create a mesh from a set of vertices and a set of triangle indexes.
 
 Mesh (const QVector< Vector > &, const QVector< Vector > &, const QVector< int > &, const QVector< int > &)
 Create the mesh.
 
 ~Mesh ()
 Empty.
 
void Reserve (int, int, int, int)
 Reserve memory for arrays.
 
Triangle GetTriangle (int) const
 Get a triangle.
 
const Vector Vertex (int) const
 Get a vertex.
 
VectorVertex (int)
 Acces to a vertex.
 
Vector Vertex (int, int) const
 Get a vertex from a specific triangle.
 
Vector Normal (int) const
 Get a normal.
 
int Triangles () const
 Get the number of triangles.
 
int Vertexes () const
 Get the number of vertices in the geometry.
 
int Normals () const
 Get the number of normals in the geometry.
 
bool Manifold () const
 Check if a mesh is manifold.
 
void Append (const Mesh &)
 Merge two meshes into a single one.
 
QVector< VectorGetVertices () const
 Get the array of vertices.
 
QVector< VectorGetNormals () const
 Get the array of normals.
 
QVector< int > VertexIndexes () const
 Return the set of vertex indexes.
 
QVector< int > NormalIndexes () const
 Return the set of normal indexes.
 
QVector< TriangleGetTriangles () const
 Returns the geometry as a set of triangles.
 
int VertexIndex (int, int) const
 Get the vertex index of a given triangle.
 
int VertexIndex (int) const
 Get the vertex index.
 
int NormalIndex (int, int) const
 Get the normal index of a given triangle.
 
int NormalIndex (int) const
 Get the normal index.
 
Vector operator[] (int) const
 Get a vertex.
 
double R (const Vector &) const
 Compute the squared distance to the mesh.
 
double Signed (const Vector &) const
 Compute the signed distance to the mesh.
 
bool Intersect (const Ray &, double &, int &) const
 Compute the intersection between a ray and the mesh.
 
int Intersections (const Ray &) const
 Compute the number of intersections between a ray and the mesh.
 
bool Inside (const Vector &) const
 Check if a point is inside or outside of the object.
 
Box GetBox () const
 Compute the bounding box of the object.
 
Sphere GetSphere () const
 Compute the bounding sphere of the object.
 
double AverageEdgeLength () const
 Compute the average edge length.
 
void EdgeLengthRange (double &, double &) const
 Compute the range of edge lengths.
 
QVector< int > AspectRatios (int=4) const
 Compute the histogram of the aspect ratio of the triangles of the mesh.
 
void EdgeCollapse (const double &)
 Run a simple edge collapse algorithm over a triangle mesh.
 
void Transform (const Frame &)
 Transforms the mesh given a transformation.
 
void Transform (const FrameScaled &)
 Transforms the mesh given a transformation.
 
Mesh Transformed (const FrameScaled &) const
 Transforms the mesh given a transformation.
 
void InverseTransform (const FrameScaled &)
 Inverse transform.
 
void Symmetry (const Plane &)
 Apply a planar symmetry to the object.
 
void Rotate (const Matrix &)
 Rotate the mesh.
 
void Translate (const Vector &)
 Translate the mesh.
 
void Scale (const Vector &)
 Scale the mesh.
 
void Scale (const double &)
 Scale the mesh.
 
void SmoothNormals ()
 Smooth the normals of the mesh.
 
int IsSmooth (int) const
 Check if the ith triangle in the mesh is a flat or smooth triangle.
 
 Mesh (const Capsule &, int, int=2)
 Creates a capsule.
 
 Mesh (const Quadrangle &, int, int)
 Generate a grid geometry over an input quadrangle.
 
 Mesh (const Quadrangle &)
 Generate a quadrangle.
 
 Mesh (const Octahedron &)
 Creates the mesh of an octaedron.
 
 Mesh (const Pyramid &)
 Creates the mesh of an octaedron.
 
 Mesh (const Box &)
 Creates an axis aligned box.
 
 Mesh (const Triangle &)
 Creates a triangle.
 
 Mesh (const Sphere &, int)
 Creates a sphere, using polar coordinates.
 
 Mesh (const SphereSet &, int)
 Creates a set of spheres.
 
 Mesh (const Cylinder &, int, bool=true, bool=true)
 Creates a cylinder.
 
 Mesh (const Disc &, int)
 Creates a disc.
 
 Mesh (const Dodecahedron &)
 This function creates the mesh of a dodecahedron.
 
 Mesh (const Icosahedron &)
 Create the mesh of an icosahedron.
 
 Mesh (const QVector< Vector > &, const QVector< Vector > &, const Vector &, const Vector &)
 Create a generalized cylinder with star-shaped contours.
 
 Mesh (const Torus &, int, int, int=-1, int=-1)
 Create the mesh of an torus.
 
 Mesh (const Cuboctahedron &)
 Create the mesh of a cuboctahedron.
 
 Mesh (const Icosidodecahedron &)
 Create the mesh of an icosidodecahedron.
 
 Mesh (const Hexagonal &)
 Create the mesh of a hexagonal prism.
 
 Mesh (const Cone &, int)
 Creates the mesh of a cone.
 
 Mesh (const Rectangles &, int, int)
 Generate a grid geometry over an input rectangle.
 
 Mesh (const Cuboid &)
 Creates the mesh of a cuboid.
 
 Mesh (const QuadricSurface &, const Box2 &, int, int)
 Generate a grid geometry and polygonize the quadric surface.
 
 Mesh (const Voxel &)
 Generate the surface of the voxel.
 
 Mesh (const Ellipsoid &, int=17)
 Creates an ellipsoid.
 
 Mesh (const QuadricCurve &, const double &, int, int)
 Create a swept-sphere along a quadric curve.
 
 Mesh (const CubicCurve &, const double &, int, int)
 Create a swept-sphere along a cubic curve.
 
 Mesh (const CubicCurveSet &, const double &, int, int)
 Create a swept-sphere along a cubic curve.
 
 Mesh (const QuadricCurveSet &, const double &, int, int=2)
 Create a swept-sphere along a set of quadric curves.
 
Mesh ShrinkedTriangles (const double &) const
 Scales (shrinks) all the triangles of the model.
 
void Load (const QString &)
 Import a mesh from an .obj file.
 
void SaveObj (const QString &, const QString &=QString("mesh")) const
 Save the mesh in .obj format, with vertices and normals.
 

Protected Attributes

QVector< int > tarray
 Neighbouring half edge, from which it is possible to derive the neighboring triangle.
 
- Protected Attributes inherited from Mesh
QVector< Vectorvertices
 Vertices.
 
QVector< Vectornormals
 Normals.
 
QVector< int > varray
 Vertex indexes.
 
QVector< int > narray
 Normal indexes.
 

Additional Inherited Members

- Static Protected Member Functions inherited from Mesh
static Mesh Hull (const QVector< Vector > &)
 Compute the convex hull.
 
static Mesh Extrusion (const PointCurve &, const PointCurve2 &)
 Extrude a contour along a point curve.
 
static Mesh Extrusion (const PointCurve &, const QVector< PointCurve2 > &)
 Extrude a set of contour along a point curve.
 
static Mesh ExtrusionRotation (const PointCurve2 &, const double &, const double &, int, const Vector &=Vector::Null)
 Circular extrusion of a point curve.
 
static Mesh ExtrusionRotation (const PointCurve2 &, int, const Vector &=Vector::Null)
 Circular extrusion of a point curve.
 
static Mesh Extrusion4new (Vector, Vector, const QVector< PointCurve > &)
  Warning Extrusion d'un ensemble de contours autour d'une position et en fonction d'une direction.
 
static Mesh Extrusion3new (const PointCurve &, const QVector< PointCurve > &, QVector< int >, QVector< double >)
  Warning Extrusion le long d'une courbe en utilisant différents profils. Le choix des profils est paramétré par des indices et des distances.
 
static Mesh extrusion5new (Vector, Vector, const QVector< PointCurve > &, const QVector< PointCurve > &)
  Warning Extrusion d'un ensemble de contours autour d'une position et en fonction d'une direction ou chaque contour a une normale.
 
static Mesh extrusion8new (QVector< Vector >, double, double, double)
  Warning Extrusion en pointillés
 
static Mesh Arrow (const Vector &, const Vector &, const double &, const double &, const double &, int)
 Creates an arrow. The object has 3n+2 vertices, 2n+2 normals and 6n triangles.
 

Detailed Description

Core triangle mesh with indexed neighboring triangles.

The topological array stores the index of the (oriented) edge of the opposite triangle, from which the index of the opposite triangle can be derived by dividing by 3.

Constructor & Destructor Documentation

◆ MeshTopo()

MeshTopo::MeshTopo ( const Mesh & mesh)
explicit

Create a topological mesh from a mesh.

Parameters
meshThe mesh.

Member Function Documentation

◆ EdgeCollapse() [1/2]

void MeshTopo::EdgeCollapse ( const double & epsilon)

Perform a simple edge collapse algorithm over a triangle mesh.

See also
Mesh::EdgeCollapse(const double&)
Parameters
epsilonThreshold length for collapsing an edge.

◆ EdgeCollapse() [2/2]

void MeshTopo::EdgeCollapse ( int i)
protected

Collapse an edge in the triangle mesh.

Parameters
iEdge index.