本文整理汇总了C++中BOP_Face::getOriginalFace方法的典型用法代码示例。如果您正苦于以下问题:C++ BOP_Face::getOriginalFace方法的具体用法?C++ BOP_Face::getOriginalFace怎么用?C++ BOP_Face::getOriginalFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOP_Face
的用法示例。
在下文中一共展示了BOP_Face::getOriginalFace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Creates a list of lists L1, L2, ... LN where
* LX = mesh faces with vertex v that come from the same original face
* and without any of the vertices that appear before v in vertices
* @param facesByOriginalFace list of faces lists
* @param vertices vector with vertices indexs that contains v
* @param v vertex index
*/
void BOP_Merge2::getFaces(BOP_LFaces &facesByOriginalFace, BOP_Indexs vertices, BOP_Index v)
{
// Get edges with vertex v
BOP_Indexs edgeIndexs = m_mesh->getVertex(v)->getEdges();
const BOP_IT_Indexs edgeEnd = edgeIndexs.end();
for(BOP_IT_Indexs edgeIndex = edgeIndexs.begin();edgeIndex != edgeEnd;edgeIndex++) {
// Foreach edge, add its no broken faces to the output list
BOP_Edge* edge = m_mesh->getEdge(*edgeIndex);
BOP_Indexs faceIndexs = edge->getFaces();
const BOP_IT_Indexs faceEnd = faceIndexs.end();
for(BOP_IT_Indexs faceIndex=faceIndexs.begin();faceIndex!=faceEnd;faceIndex++) {
BOP_Face* face = m_mesh->getFace(*faceIndex);
if (face->getTAG() != BROKEN) {
// Search if the face contains any of the forbidden vertices
bool found = false;
for(BOP_IT_Indexs vertex = vertices.begin();*vertex!= v;vertex++) {
if (face->containsVertex(*vertex)) {
// face contains a forbidden vertex!
found = true;
break;
}
}
if (!found) {
// Search if we already have created a list with the
// faces that come from the same original face
const BOP_IT_LFaces lfEnd = facesByOriginalFace.end();
for(BOP_IT_LFaces facesByOriginalFaceX=facesByOriginalFace.begin();
facesByOriginalFaceX!=lfEnd; facesByOriginalFaceX++) {
if (((*facesByOriginalFaceX)[0])->getOriginalFace() == face->getOriginalFace()) {
// Search that the face has not been added to the list before
for(unsigned int i = 0;i<(*facesByOriginalFaceX).size();i++) {
if ((*facesByOriginalFaceX)[i] == face) {
found = true;
break;
}
}
if (!found) {
// Add face to the list
if (face->getTAG()==OVERLAPPED) facesByOriginalFaceX->insert(facesByOriginalFaceX->begin(),face);
else facesByOriginalFaceX->push_back(face);
found = true;
}
break;
}
}
if (!found) {
// Create a new list and add the current face
BOP_Faces facesByOriginalFaceX;
facesByOriginalFaceX.push_back(face);
facesByOriginalFace.push_back(facesByOriginalFaceX);
}
}
}
}
}
}
示例2: BOP_intersectCoplanarFaces
/**
* Triangulates faceB using edges of faceA that both are complanars.
* @param mesh mesh that contains the faces, edges and vertices
* @param facesB set of faces from object B
* @param faceA face from object A
* @param faceB face from object B
* @param invert indicates if faceA has priority over faceB
*/
void BOP_intersectCoplanarFaces(BOP_Mesh* mesh,
BOP_Faces* facesB,
BOP_Face* faceA,
BOP_Face* faceB,
bool invert)
{
unsigned int oldSize = facesB->size();
unsigned int originalFaceB = faceB->getOriginalFace();
MT_Point3 p1 = mesh->getVertex(faceA->getVertex(0))->getPoint();
MT_Point3 p2 = mesh->getVertex(faceA->getVertex(1))->getPoint();
MT_Point3 p3 = mesh->getVertex(faceA->getVertex(2))->getPoint();
MT_Vector3 normal(faceA->getPlane().x(),faceA->getPlane().y(),faceA->getPlane().z());
MT_Vector3 p1p2 = p2-p1;
MT_Plane3 plane1((p1p2.cross(normal).normalized()),p1);
BOP_Segment sA;
sA.m_cfg1 = BOP_Segment::createVertexCfg(1);
sA.m_v1 = faceA->getVertex(0);
sA.m_cfg2 = BOP_Segment::createVertexCfg(2);
sA.m_v2 = faceA->getVertex(1);
BOP_intersectCoplanarFaces(mesh,facesB,faceB,sA,plane1,invert);
MT_Vector3 p2p3 = p3-p2;
MT_Plane3 plane2((p2p3.cross(normal).normalized()),p2);
sA.m_cfg1 = BOP_Segment::createVertexCfg(2);
sA.m_v1 = faceA->getVertex(1);
sA.m_cfg2 = BOP_Segment::createVertexCfg(3);
sA.m_v2 = faceA->getVertex(2);
if (faceB->getTAG() == BROKEN) {
for(unsigned int idxFace = oldSize; idxFace < facesB->size(); idxFace++) {
BOP_Face *face = (*facesB)[idxFace];
if (face->getTAG() != BROKEN && originalFaceB == face->getOriginalFace())
BOP_intersectCoplanarFaces(mesh,facesB,face,sA,plane2,invert);
}
}
else {
BOP_intersectCoplanarFaces(mesh,facesB,faceB,sA,plane2,invert);
}
MT_Vector3 p3p1 = p1-p3;
MT_Plane3 plane3((p3p1.cross(normal).safe_normalized()),p3);
sA.m_cfg1 = BOP_Segment::createVertexCfg(3);
sA.m_v1 = faceA->getVertex(2);
sA.m_cfg2 = BOP_Segment::createVertexCfg(1);
sA.m_v2 = faceA->getVertex(0);
if (faceB->getTAG() == BROKEN) {
for(unsigned int idxFace = oldSize; idxFace < facesB->size(); idxFace++) {
BOP_Face *face = (*facesB)[idxFace];
if (face->getTAG() != BROKEN && originalFaceB == face->getOriginalFace())
BOP_intersectCoplanarFaces(mesh,facesB,face,sA,plane3,invert);
}
}
else {
BOP_intersectCoplanarFaces(mesh,facesB,faceB,sA,plane3,invert);
}
}