Exemplo n.º 1
0
/**
 * testPlane
 */
void BOP_Mesh::testPlane(BOP_Face *face)
{
	MT_Plane3 plane1(m_vertexs[face->getVertex(0)]->getPoint(), 
					 m_vertexs[face->getVertex(1)]->getPoint(),
					 m_vertexs[face->getVertex(2)]->getPoint());

	if (BOP_orientation(plane1,face->getPlane()) < 0) {	  
		cout << "Test Plane " << face << " v1: ";
		cout << m_vertexs[face->getVertex(0)]->getPoint() << " v2: ";
		cout << m_vertexs[face->getVertex(1)]->getPoint() << " v3: ";
		cout << m_vertexs[face->getVertex(2)]->getPoint() << " plane: ";
		cout << face->getPlane() << endl;
		cout << "Incorrect vertices order!!! plane1: " << plane1 << " (";
		cout << BOP_orientation(plane1,face->getPlane()) << ") " <<  " invert ";
		cout <<  MT_Plane3(m_vertexs[face->getVertex(2)]->getPoint(),
						   m_vertexs[face->getVertex(1)]->getPoint(),
						   m_vertexs[face->getVertex(0)]->getPoint()) << endl;
		if (BOP_collinear(m_vertexs[face->getVertex(0)]->getPoint(),
						  m_vertexs[face->getVertex(1)]->getPoint(),
						  m_vertexs[face->getVertex(2)]->getPoint())) {
			cout << " COLLINEAR!!!" << endl;
		}
		else {
			cout << endl;
		}
	}
}
Exemplo n.º 2
0
/**
 * Triangulates faceB using segment sA and planeA.
 * @param mesh mesh that contains the faces, edges and vertices
 * @param facesB set of faces from object B
 * @param faceB face from object B
 * @param sA segment to intersect with faceB
 * @param planeA plane to intersect with faceB
 * @param invert indicates if sA has priority over faceB
 */
void BOP_intersectCoplanarFaces(BOP_Mesh*   mesh, 
								BOP_Faces*  facesB, 
								BOP_Face*   faceB, 
								BOP_Segment sA, 
								MT_Plane3   planeA, 
								bool        invert)
{
	BOP_Segment sB = BOP_splitFace(planeA,mesh,faceB);

	if (BOP_Segment::isDefined(sB.m_cfg1)) {
		BOP_Segment xSegment[2];
		BOP_createXS(mesh,NULL,faceB,planeA,MT_Plane3(),sA,sB,invert,xSegment);
		if (BOP_Segment::isDefined(xSegment[1].m_cfg1)) {
			unsigned int sizefaces = mesh->getNumFaces();
			triangulate(mesh,facesB,faceB,xSegment[1]);
			BOP_mergeVertexs(mesh,sizefaces);
		}
	}
}