Blender V2.61 - r43446
Defines | Functions

BOP_Face2Face.cpp File Reference

#include "BOP_Face2Face.h"
#include "BOP_BBox.h"

Go to the source code of this file.

Defines

#define sA_sB   12
#define sB_sA   21
#define sX_sA   31
#define sA_sX   13
#define sX_sB   32
#define sB_sX   23
#define sX_sX   33
#define sA_sA_sB   112
#define sB_sB_sA   221
#define sB_sA_sA   211
#define sA_sB_sB   122
#define sA_sB_sA   121
#define sB_sA_sB   212
#define sA_sX_sB   132
#define sB_sX_sA   231
#define sX_sA_sB   312
#define sX_sB_sA   321
#define sA_sB_sX   123
#define sB_sA_sX   213
#define sA_sA_sB_sB   1122
#define sB_sB_sA_sA   2211
#define sA_sB_sA_sB   1212
#define sB_sA_sB_sA   2121
#define sA_sB_sB_sA   1221
#define sB_sA_sA_sB   2112

Functions

void BOP_intersectCoplanarFaces (BOP_Mesh *mesh, BOP_Faces *facesB, BOP_Face *faceA, BOP_Face *faceB, bool invert)
void BOP_intersectCoplanarFaces (BOP_Mesh *mesh, BOP_Faces *facesB, BOP_Face *faceB, BOP_Segment sA, MT_Plane3 planeA, bool invert)
void BOP_intersectNonCoplanarFaces (BOP_Mesh *mesh, BOP_Faces *facesA, BOP_Faces *facesB, BOP_Face *faceA, BOP_Face *faceB)
void BOP_getPoints (BOP_Mesh *mesh, BOP_Face *faceA, BOP_Segment &sA, MT_Plane3 planeB, MT_Point3 *points, unsigned int *faces, unsigned int &size, unsigned int faceValue)
void BOP_mergeSort (MT_Point3 *points, unsigned int *face, unsigned int &size, bool &invertA, bool &invertB)
void BOP_createXS (BOP_Mesh *mesh, BOP_Face *faceA, BOP_Face *faceB, BOP_Segment sA, BOP_Segment sB, bool invert, BOP_Segment *segments)
void BOP_createXS (BOP_Mesh *mesh, BOP_Face *faceA, BOP_Face *faceB, MT_Plane3 planeA, MT_Plane3 planeB, BOP_Segment sA, BOP_Segment sB, bool invert, BOP_Segment *segments)
BOP_Index BOP_getVertexIndex (BOP_Mesh *mesh, MT_Point3 point, unsigned int cfgA, unsigned int cfgB, BOP_Index vA, BOP_Index vB, bool invert)
BOP_Index BOP_getVertexIndex (BOP_Mesh *mesh, MT_Point3 point, unsigned int cfg, BOP_Index v)
void triangulate (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Segment s)
BOP_FaceBOP_getOppositeFace (BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Edge *edge)
bool BOP_overlap (MT_Vector3 normal, MT_Point3 p1, MT_Point3 p2, MT_Point3 p3, MT_Point3 q1, MT_Point3 q2, MT_Point3 q3)
void BOP_mergeVertexs (BOP_Mesh *mesh, unsigned int firstFace)
void BOP_Face2Face (BOP_Mesh *mesh, BOP_Faces *facesA, BOP_Faces *facesB)
void BOP_sew (BOP_Mesh *mesh, BOP_Faces *facesA, BOP_Faces *facesB)
bool BOP_containsFace (BOP_Faces *faces, BOP_Face *face)
void BOP_removeOverlappedFaces (BOP_Mesh *mesh, BOP_Faces *facesA, BOP_Faces *facesB)

Detailed Description

Definition in file BOP_Face2Face.cpp.


Define Documentation

#define sA_sA_sB   112

Definition at line 50 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sA_sB_sB   1122

Definition at line 63 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sB   12

Definition at line 42 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sB_sA   121

Definition at line 54 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sB_sA_sB   1212

Definition at line 65 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sB_sB   122

Definition at line 53 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sB_sB_sA   1221

Definition at line 67 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sB_sX   123

Definition at line 60 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sX   13

Definition at line 45 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sA_sX_sB   132

Definition at line 56 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sA   21

Definition at line 43 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sA_sA   211

Definition at line 52 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sA_sA_sB   2112

Definition at line 68 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sA_sB   212

Definition at line 55 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sA_sB_sA   2121

Definition at line 66 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sA_sX   213

Definition at line 61 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sB_sA   221

Definition at line 51 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sB_sA_sA   2211

Definition at line 64 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sX   23

Definition at line 47 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sB_sX_sA   231

Definition at line 57 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sX_sA   31

Definition at line 44 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sX_sA_sB   312

Definition at line 58 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sX_sB   32

Definition at line 46 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sX_sB_sA   321

Definition at line 59 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().

#define sX_sX   33

Definition at line 48 of file BOP_Face2Face.cpp.

Referenced by BOP_createXS().


Function Documentation

bool BOP_containsFace ( BOP_Faces faces,
BOP_Face face 
)

Returns if a face is in the set of faces.

Parameters:
facesset of faces
faceface to be searched
Returns:
if the face is inside faces

Definition at line 1120 of file BOP_Face2Face.cpp.

Referenced by BOP_getOppositeFace().

void BOP_createXS ( BOP_Mesh mesh,
BOP_Face faceA,
BOP_Face faceB,
BOP_Segment  sA,
BOP_Segment  sB,
bool  invert,
BOP_Segment segments 
)

Computes the x-segment of two segments (the shared interval). The segments needs to have sA.m_cfg1 > 0 && sB.m_cfg1 > 0 .

Parameters:
meshmesh that contains the faces, edges and vertices
faceAface of object A
faceBface of object B
sAsegment of intersection between faceA and planeB
sBsegment of intersection between faceB and planeA
invertindicates if faceA has priority over faceB
segmemtsarray of the output x-segments

Definition at line 661 of file BOP_Face2Face.cpp.

References BOP_Face::getPlane(), and invert().

Referenced by BOP_intersectCoplanarFaces(), and BOP_intersectNonCoplanarFaces().

void BOP_createXS ( BOP_Mesh mesh,
BOP_Face faceA,
BOP_Face faceB,
MT_Plane3  planeA,
MT_Plane3  planeB,
BOP_Segment  sA,
BOP_Segment  sB,
bool  invert,
BOP_Segment segments 
)

Computes the x-segment of two segments (the shared interval). The segments needs to have sA.m_cfg1 > 0 && sB.m_cfg1 > 0 .

Parameters:
meshmesh that contains the faces, edges and vertices
faceAface of object A
faceBface of object B
planeAplane of faceA
planeBplane of faceB
sAsegment of intersection between faceA and planeB
sBsegment of intersection between faceB and planeA
invertindicates if faceA has priority over faceB
segmemtsarray of the output x-segments

Definition at line 684 of file BOP_Face2Face.cpp.

References BOP_getPoints(), BOP_getVertexIndex(), BOP_mergeSort(), BOP_Segment::createUndefinedCfg(), BOP_Segment::getConfig(), i, BOP_Segment::invert(), label(), BOP_Segment::m_cfg1, BOP_Segment::m_cfg2, BOP_Segment::m_v1, BOP_Segment::m_v2, sA_sA_sB, sA_sA_sB_sB, sA_sB, sA_sB_sA, sA_sB_sA_sB, sA_sB_sB, sA_sB_sB_sA, sA_sB_sX, sA_sX, sA_sX_sB, sB_sA, sB_sA_sA, sB_sA_sA_sB, sB_sA_sB, sB_sA_sB_sA, sB_sA_sX, sB_sB_sA, sB_sB_sA_sA, sB_sX, sB_sX_sA, size(), BOP_Segment::sort(), sX_sA, sX_sA_sB, sX_sB, sX_sB_sA, and sX_sX.

void BOP_Face2Face ( BOP_Mesh mesh,
BOP_Faces facesA,
BOP_Faces facesB 
)

Computes intersections between faces of both lists.

Parameters:
meshmesh that contains the faces, edges and vertices
facesAset of faces from object A
facesBset of faces from object B

Two optimizations were added here: 1) keep the bounding box for a face once it's created; this is especially important for B faces, since they were being created and recreated over and over 2) associate a "split" index in the faceB vector with each A face; when an A face is split, we will not need to recheck any B faces have already been checked against that original A face

Definition at line 161 of file BOP_Face2Face.cpp.

References BOP_containsPoint(), BOP_intersectCoplanarFaces(), BOP_intersectNonCoplanarFaces(), BOP_orientation(), BROKEN, BOP_Face::getBBox(), BOP_Face::getPlane(), BOP_Face::getSplit(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Mesh::getVertex(), BOP_BBox::intersect(), NULL, PHANTOM, BOP_Face::setBBox(), and BOP_Face::setSplit().

Referenced by BOP_intersectionBoolOp().

BOP_Face * BOP_getOppositeFace ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Edge edge 
)

Returns the first face of faces that shares the input edge of face.

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces
faceinput face
edgeface's edge
Returns:
first face that shares the edge of input face

Definition at line 1140 of file BOP_Face2Face.cpp.

References BOP_containsFace(), BROKEN, BOP_Mesh::getFace(), BOP_Edge::getFaces(), BOP_Face::getTAG(), and NULL.

Referenced by triangulate().

void BOP_getPoints ( BOP_Mesh mesh,
BOP_Face faceA,
BOP_Segment sA,
MT_Plane3  planeB,
MT_Point3 points,
unsigned int *  faces,
unsigned int &  size,
unsigned int  faceValue 
)

Obtains the points of the segment created from the intersection between faceA and planeB.

Parameters:
meshmesh that contains the faces, edges and vertices
faceAintersected face
sAsegment of the intersection between faceA and planeB
planeBintersected plane
pointsarray of points where the new points are saved
facesarray of relative face index to the points
sizesize of arrays points and faces
faceValuerelative face index of new points

Definition at line 430 of file BOP_Face2Face.cpp.

References BOP_splitEdge(), BOP_Segment::getEdge(), BOP_Vertex::getPoint(), BOP_Segment::getVertex(), BOP_Mesh::getVertex(), BOP_Segment::isDefined(), BOP_Segment::isEdge(), BOP_Segment::isVertex(), BOP_Segment::m_cfg1, BOP_Segment::m_cfg2, BOP_Segment::m_v1, BOP_Segment::m_v2, and size().

Referenced by BOP_createXS().

BOP_Index BOP_getVertexIndex ( BOP_Mesh mesh,
MT_Point3  point,
unsigned int  cfg,
BOP_Index  v 
)

Computes the vertex index of a point.

Parameters:
meshmesh that contains the faces, edges and vertices
cfgconfiguration of point
vvertex index of point
Returns:
final vertex index in the mesh

Definition at line 1018 of file BOP_Face2Face.cpp.

References BOP_Mesh::addVertex(), and BOP_Segment::isVertex().

BOP_Index BOP_getVertexIndex ( BOP_Mesh mesh,
MT_Point3  point,
unsigned int  cfgA,
unsigned int  cfgB,
BOP_Index  vA,
BOP_Index  vB,
bool  invert 
)

Computes the vertex index of a point.

Parameters:
meshmesh that contains the faces, edges and vertices
pointinput point
cfgAconfiguration of point on faceA
cfgBconfiguration of point on faceB
vAvertex index of point on faceA
vBvertex index of point on faceB
invertindicates if vA has priority over vB
Returns:
final vertex index in the mesh

Definition at line 983 of file BOP_Face2Face.cpp.

References BOP_Mesh::addVertex(), BOP_Segment::isVertex(), and BOP_Mesh::replaceVertexIndex().

Referenced by BOP_createXS().

void BOP_intersectCoplanarFaces ( BOP_Mesh mesh,
BOP_Faces facesB,
BOP_Face faceB,
BOP_Segment  sA,
MT_Plane3  planeA,
bool  invert 
)

Triangulates faceB using segment sA and planeA.

Parameters:
meshmesh that contains the faces, edges and vertices
facesBset of faces from object B
faceBface from object B
sAsegment to intersect with faceB
planeAplane to intersect with faceB
invertindicates if sA has priority over faceB

Definition at line 347 of file BOP_Face2Face.cpp.

References BOP_createXS(), BOP_mergeVertexs(), BOP_splitFace(), BOP_Mesh::getNumFaces(), BOP_Segment::isDefined(), BOP_Segment::m_cfg1, NULL, and triangulate().

void BOP_intersectCoplanarFaces ( BOP_Mesh mesh,
BOP_Faces facesB,
BOP_Face faceA,
BOP_Face faceB,
bool  invert 
)

Triangulates faceB using edges of faceA that both are complanars.

Parameters:
meshmesh that contains the faces, edges and vertices
facesBset of faces from object B
faceAface from object A
faceBface from object B
invertindicates if faceA has priority over faceB

Definition at line 272 of file BOP_Face2Face.cpp.

References BROKEN, BOP_Segment::createVertexCfg(), MT_Vector3::cross(), BOP_Face::getOriginalFace(), BOP_Face::getPlane(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Mesh::getVertex(), BOP_Segment::m_cfg1, BOP_Segment::m_cfg2, BOP_Segment::m_v1, BOP_Segment::m_v2, MT_Vector3::normalized(), MT_Vector3::safe_normalized(), MT_Tuple4::x(), MT_Tuple4::y(), and MT_Tuple4::z().

Referenced by BOP_Face2Face(), and BOP_sew().

void BOP_intersectNonCoplanarFaces ( BOP_Mesh mesh,
BOP_Faces facesA,
BOP_Faces facesB,
BOP_Face faceA,
BOP_Face faceB 
)

Triangulates faceB using edges of faceA that both are not complanars.

Parameters:
meshmesh that contains the faces, edges and vertices
facesBset of faces from object B
faceAface from object A
faceBface from object B

Definition at line 374 of file BOP_Face2Face.cpp.

References BOP_createXS(), BOP_mergeVertexs(), BOP_splitFace(), BOP_Mesh::getNumFaces(), BOP_Face::getPlane(), BOP_Segment::isDefined(), BOP_Segment::m_cfg1, and triangulate().

Referenced by BOP_Face2Face().

void BOP_mergeSort ( MT_Point3 points,
unsigned int *  face,
unsigned int &  size,
bool &  invertA,
bool &  invertB 
)

Sorts the colinear points and relative face indices.

Parameters:
pointsarray of points where the new points are saved
facesarray of relative face index to the points
sizesize of arrays points and faces
invertAindicates if points of same relative face had been exchanged

Definition at line 480 of file BOP_Face2Face.cpp.

References BOP_fuzzyZero(), distance(), MT_Point3::distance(), i, and size().

Referenced by BOP_createXS().

void BOP_mergeVertexs ( BOP_Mesh mesh,
unsigned int  firstFace 
)

Tests if faces since firstFace have all vertexs non-coincident of colinear, otherwise repairs the mesh.

Parameters:
meshmesh that contains the faces, edges and vertices
firstFacefirst face index to be tested

Definition at line 404 of file BOP_Face2Face.cpp.

References BOP_collinear(), BROKEN, BOP_Mesh::getFace(), BOP_Mesh::getNumFaces(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Mesh::getVertex(), PHANTOM, and BOP_Face::setTAG().

Referenced by BOP_intersectCoplanarFaces(), and BOP_intersectNonCoplanarFaces().

bool BOP_overlap ( MT_Vector3  normal,
MT_Point3  p1,
MT_Point3  p2,
MT_Point3  p3,
MT_Point3  q1,
MT_Point3  q2,
MT_Point3  q3 
)

Computes if triangle p1,p2,p3 is overlapped with triangle q1,q2,q3.

Parameters:
normalnormal of the triangle p1,p2,p3
p1point of first triangle
p2point of first triangle
p3point of first triangle
q1point of second triangle
q2point of second triangle
q3point of second triangle
Returns:
if there is overlapping between both triangles

Definition at line 1217 of file BOP_Face2Face.cpp.

References BOP_classify(), BOP_createTAG(), MT_Vector3::cross(), IN_IN_IN, and OUT_OUT_OUT.

Referenced by BOP_removeOverlappedFaces().

void BOP_removeOverlappedFaces ( BOP_Mesh mesh,
BOP_Faces facesA,
BOP_Faces facesB 
)

Removes faces from facesB that are overlapped with anyone from facesA.

Parameters:
meshmesh that contains the faces, edges and vertices
facesAset of faces from object A
facesBset of faces from object B

Definition at line 1171 of file BOP_Face2Face.cpp.

References BOP_containsPoint(), BOP_overlap(), BROKEN, BOP_Face::getPlane(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Mesh::getVertex(), i, OVERLAPPED, BOP_Face::setTAG(), MT_Tuple4::x(), MT_Tuple4::y(), and MT_Tuple4::z().

Referenced by BOP_intersectionBoolOp().

void BOP_sew ( BOP_Mesh mesh,
BOP_Faces facesA,
BOP_Faces facesB 
)

Computes intesections of coplanars faces from object A with faces from object B.

Parameters:
meshmesh that contains the faces, edges and vertices
facesAset of faces from object A
facesBset of faces from object B

Definition at line 235 of file BOP_Face2Face.cpp.

References BOP_containsPoint(), BOP_intersectCoplanarFaces(), BOP_orientation(), BROKEN, BOP_Face::getPlane(), BOP_Face::getTAG(), BOP_Face::getVertex(), BOP_Mesh::getVertex(), and PHANTOM.

Referenced by BOP_intersectionBoolOp().

void triangulate ( BOP_Mesh mesh,
BOP_Faces faces,
BOP_Face face,
BOP_Segment  s 
)

Triangulates the input face according to the specified segment.

Parameters:
meshmesh that contains the faces, edges and vertices
facesset of faces that contains the original face and the new triangulated faces
faceface to be triangulated
ssegment used to triangulate face

Definition at line 1038 of file BOP_Face2Face.cpp.

References BOP_getOppositeFace(), BOP_triangulateA(), BOP_triangulateB(), BOP_triangulateC(), BOP_triangulateD(), BOP_triangulateE(), BOP_triangulateF(), credits_svn_gen::e, BOP_Segment::getEdge(), BOP_Face::getEdgeIndex(), BOP_Edge::getVertex1(), BOP_Edge::getVertex2(), BOP_Segment::isEdge(), BOP_Segment::isIn(), BOP_Segment::isUndefined(), BOP_Segment::isVertex(), BOP_Segment::m_cfg1, BOP_Segment::m_cfg2, BOP_Segment::m_v1, BOP_Segment::m_v2, and NULL.

Referenced by BOP_intersectCoplanarFaces(), and BOP_intersectNonCoplanarFaces().