Blender V2.61 - r43446
Functions

BOP_Triangulator.cpp File Reference

#include "BOP_Triangulator.h"
#include <iostream>

Go to the source code of this file.

Functions

void BOP_addFace (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_TAG tag)
void BOP_splitQuad (BOP_Mesh *mesh, MT_Plane3 plane, BOP_Index v1, BOP_Index v2, BOP_Index v3, BOP_Index v4, BOP_Face *triangles[], BOP_Index original)
BOP_Index BOP_getTriangleVertex (BOP_Mesh *mesh, BOP_Index v1, BOP_Index v2, BOP_Index v3, BOP_Index v4)
BOP_Index BOP_getNearestVertex (BOP_Mesh *mesh, BOP_Index u, BOP_Index v1, BOP_Index v2)
bool BOP_isInsideCircle (BOP_Mesh *mesh, BOP_Index v1, BOP_Index v2, BOP_Index v3, BOP_Index v4, BOP_Index v5)
bool BOP_isInsideCircle (BOP_Mesh *mesh, BOP_Index v1, BOP_Index v2, BOP_Index v3, BOP_Index w)
void BOP_triangulateC_split (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v1, BOP_Index v2, BOP_Index v3, BOP_Index v4, BOP_Index v5)
void BOP_triangulateD_split (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v1, BOP_Index v2, BOP_Index v3, BOP_Index v4, BOP_Index v5)
void BOP_triangulateA (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v, unsigned int e)
void BOP_triangulateB (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v)
void BOP_triangulateC (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v1, BOP_Index v2)
void BOP_triangulateD (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v1, BOP_Index v2, unsigned int e)
void BOP_triangulateE (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v1, BOP_Index v2, unsigned int e1, unsigned int e2)
void BOP_triangulateF (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Index v1, BOP_Index v2, unsigned int e)

Detailed Description

Definition in file BOP_Triangulator.cpp.


Function Documentation

void BOP_addFace ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_TAG  tag 
)

Adds the new face into the faces set and the mesh and sets it a new tag.

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains oldFace
faceinput face to be added
tagtag of the new face

Definition at line 422 of file BOP_Triangulator.cpp.

References BOP_Mesh::addFace(), BOP_Face::getVertex(), and BOP_Face::setTAG().

Referenced by BOP_triangulateA(), BOP_triangulateB(), BOP_triangulateC_split(), BOP_triangulateD_split(), BOP_triangulateE(), and BOP_triangulateF().

BOP_Index BOP_getNearestVertex ( BOP_Mesh mesh,
BOP_Index  u,
BOP_Index  v1,
BOP_Index  v2 
)

Returns which of vertex v1 or v2 is nearest to u.

Parameters:
meshmesh that contains the faces, edges and vertices
ureference vertex index
v1first vertex index
v2second vertex index
Returns:
the nearest vertex index

Definition at line 530 of file BOP_Triangulator.cpp.

References BOP_comp(), MT_Point3::distance(), BOP_Vertex::getPoint(), and BOP_Mesh::getVertex().

Referenced by BOP_triangulateD_split().

BOP_Index BOP_getTriangleVertex ( BOP_Mesh mesh,
BOP_Index  v1,
BOP_Index  v2,
BOP_Index  v3,
BOP_Index  v4 
)

Returns the vertex (v3 or v4) that splits the quad (v1,v2,v3,v4) in the best pair of triangles.

Parameters:
meshmesh that contains the faces, edges and vertices
v1first vertex index
v2second vertex index
v3third vertex index
v4fourth vertex index
Returns:
v3 if the best split triangles are (v1,v2,v3) and (v1,v3,v4), v4 otherwise

Definition at line 514 of file BOP_Triangulator.cpp.

References BOP_isInsideCircle().

Referenced by BOP_triangulateC_split().

bool BOP_isInsideCircle ( BOP_Mesh mesh,
BOP_Index  v1,
BOP_Index  v2,
BOP_Index  v3,
BOP_Index  v4,
BOP_Index  v5 
)

Computes if vertexs v4 and v5 are not inside the circle defined by v1,v2,v3 (seems to be a nice triangle)

Parameters:
meshmesh that contains the faces, edges and vertices
v1first vertex index
v2second vertex index
v3third vertex index
v4fourth vertex index
v5five vertex index
Returns:
if v1,v2,v3 defines a nice triangle against v4,v5

Definition at line 549 of file BOP_Triangulator.cpp.

References BOP_isInsideCircle(), BOP_Vertex::getPoint(), and BOP_Mesh::getVertex().

bool BOP_isInsideCircle ( BOP_Mesh mesh,
BOP_Index  v1,
BOP_Index  v2,
BOP_Index  v3,
BOP_Index  w 
)

Computes if vertex w is not inside the circle defined by v1,v2,v3 (seems to be a nice triangle)

Parameters:
meshmesh that contains the faces, edges and vertices
v1first vertex index
v2second vertex index
v3third vertex index
wfourth vertex index
Returns:
if v1,v2,v3 defines a nice triangle against w

Definition at line 567 of file BOP_Triangulator.cpp.

References BOP_isInsideCircle(), BOP_Vertex::getPoint(), and BOP_Mesh::getVertex().

void BOP_splitQuad ( BOP_Mesh mesh,
MT_Plane3  plane,
BOP_Index  v1,
BOP_Index  v2,
BOP_Index  v3,
BOP_Index  v4,
BOP_Face triangles[],
BOP_Index  original 
)

Computes the best quad triangulation.

Parameters:
meshmesh that contains the faces, edges and vertices
planeplane used to create the news faces
v1first vertex index
v2second vertex index
v3third vertex index
v4fourth vertex index
trianglesarray of faces where the new two faces will be saved
originalface index to the new faces

Definition at line 470 of file BOP_Triangulator.cpp.

References BOP_concave(), BOP_isInsideCircle(), BOP_orientation(), BOP_Vertex::getPoint(), and BOP_Mesh::getVertex().

Referenced by BOP_triangulateC_split(), BOP_triangulateE(), and BOP_triangulateF().

void BOP_triangulateA ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v,
unsigned int  e 
)

Triangulates the face in two new faces by splitting one edge.

* /|\ / | \ / | \ / | \ / | \ *-----x-----*

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
vvertex index that intersects the edge
erelative edge index used to triangulate the face

Definition at line 67 of file BOP_Triangulator.cpp.

References BOP_addFace(), BROKEN, BOP_Face::freeBBox(), BOP_Face::getOriginalFace(), BOP_Face::getPlane(), BOP_Face::getSplit(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Face::setSplit(), and BOP_Face::setTAG().

Referenced by triangulate().

void BOP_triangulateB ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v 
)

Triangulates the face in three new faces by one inner point.

* / \ / \ / \ / x \ / \ *-----------*

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
vvertex index that lays inside face

Definition at line 117 of file BOP_Triangulator.cpp.

References BOP_addFace(), BROKEN, BOP_Face::freeBBox(), BOP_Face::getOriginalFace(), BOP_Face::getPlane(), BOP_Face::getSplit(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Face::setSplit(), and BOP_Face::setTAG().

Referenced by triangulate().

void BOP_triangulateC ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v1,
BOP_Index  v2 
)

Triangulates the face in five new faces by two inner points.

* / \ / \ / \ / x x \ / \ *-----------*

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
v1first vertex index that lays inside face
v2second vertex index that lays inside face

Definition at line 154 of file BOP_Triangulator.cpp.

References BOP_isInsideCircle(), BOP_triangulateC_split(), and BOP_Face::getVertex().

Referenced by triangulate().

void BOP_triangulateC_split ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v1,
BOP_Index  v2,
BOP_Index  v3,
BOP_Index  v4,
BOP_Index  v5 
)

Triangulates the face (v1,v2,v3) in five new faces by two inner points (v4,v5), where v1 v4 v5 defines the nice triangle and v4 v5 v2 v3 defines the quad to be tesselated.

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
v1first vertex index that defines the original triangle
v2second vertex index that defines the original triangle
v3third vertex index that defines the original triangle
v4first vertex index that lays inside face
v5second vertex index that lays inside face

Definition at line 186 of file BOP_Triangulator.cpp.

References BOP_addFace(), BOP_getTriangleVertex(), BOP_splitQuad(), BROKEN, BOP_Face::freeBBox(), BOP_Face::getOriginalFace(), BOP_Face::getPlane(), BOP_Face::getSplit(), BOP_Face::getTAG(), BOP_Face::setSplit(), BOP_Face::setTAG(), and simple_enum_gen::w.

Referenced by BOP_triangulateC().

void BOP_triangulateD ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v1,
BOP_Index  v2,
unsigned int  e 
)

Triangulates the face in three new faces by splitting twice an edge.

* / \ / \ / \ / \ / \ *---x---x---*

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
v1first vertex index that intersects the edge
v2second vertex index that intersects the edge
erelative edge index used to triangulate the face

Definition at line 239 of file BOP_Triangulator.cpp.

References BOP_triangulateD_split(), and BOP_Face::getVertex().

Referenced by triangulate().

void BOP_triangulateD_split ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v1,
BOP_Index  v2,
BOP_Index  v3,
BOP_Index  v4,
BOP_Index  v5 
)

Triangulates the face (v1,v2,v3) in three new faces by splitting twice an edge.

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
v1first vertex index that defines the original triangle
v2second vertex index that defines the original triangle
v3third vertex index that defines the original triangle
v4first vertex index that lays on the edge
v5second vertex index that lays on the edge

Definition at line 267 of file BOP_Triangulator.cpp.

References BOP_addFace(), BOP_getNearestVertex(), BROKEN, BOP_Face::freeBBox(), BOP_Face::getOriginalFace(), BOP_Face::getPlane(), BOP_Face::getSplit(), BOP_Face::getTAG(), BOP_Face::setSplit(), BOP_Face::setTAG(), and simple_enum_gen::w.

Referenced by BOP_triangulateD().

void BOP_triangulateE ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v1,
BOP_Index  v2,
unsigned int  e1,
unsigned int  e2 
)

Triangulates the face in three new faces by splitting two edges.

* / \ / \ x x / \ / \ *-----------*

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
v1vertex index that intersects the first edge
v1vertex index that intersects the second edge
e1first relative edge index used to triangulate the face
e2second relative edge index used to triangulate the face

Definition at line 307 of file BOP_Triangulator.cpp.

References BOP_addFace(), BOP_splitQuad(), BROKEN, BOP_Face::freeBBox(), BOP_Face::getOriginalFace(), BOP_Face::getPlane(), BOP_Face::getSplit(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Face::setSplit(), and BOP_Face::setTAG().

Referenced by triangulate().

void BOP_triangulateF ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Index  v1,
BOP_Index  v2,
unsigned int  e 
)

Triangulates the face in four new faces by one edge and one inner point.

* / \ / \ x x \ / \ / \ *-----------*

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains face and will contains new faces
faceinput face to be triangulate
v1vertex index that lays inside face
v2vertex index that intersects the edge
erelative edge index used to triangulate the face

Definition at line 375 of file BOP_Triangulator.cpp.

References BOP_addFace(), BOP_splitQuad(), BROKEN, BOP_Face::freeBBox(), BOP_Face::getOriginalFace(), BOP_Face::getPlane(), BOP_Face::getSplit(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Face::setSplit(), and BOP_Face::setTAG().

Referenced by triangulate().