void PMap(const pair<IntVect, TriInCell>& p) { // print out map pout() << "cell "; PIV(p.first); pout() << "\n"; pout() << " verts: "; PVec(p.second.vertices); pout() << "\n"; pout() << " tris : "; PVec(p.second.triangles); pout() << "\n"; }
void PMap(const CellMap& m) { // print out map CellMap::const_iterator it; pout() << "Cell Map has " << m.size() << " cells\n"; for ( it = m.begin(); it != m.end(); it++) { pout() << "cell "; PIV(it->first); pout() << "\n"; pout() << " verts: "; PVec(it->second.vertices); pout() << "\n"; pout() << " tris : "; PVec(it->second.triangles); pout() << "\n"; } }
void PVec(const Vector< Vector<IntVect> >& v) { if (v.size()<1) return; for (int i=0; i<v.size(); i++) { pout() << "\n " << i << ": "; PVec(v[i]); } }
bool Partition::JudgeIntersection(SFace* Fa, SFace* Fb, char* curveName, orientationFaceA oriA, EdgeCurveVertex curveA, EdgeCurveVertex curveB, CPoint3D pointA) { CVector3D aDir = Fa->position_->verAxis;//Fa法线 CVector3D bDir = Fb->position_->verAxis; if (!strcmp(Fa->name_, "plane")&&!strcmp(Fb->name_, "plane")) //平面平面 { double result; if(oriA.orientedEdgeOri == oriA.edgeCurveOri) { CVector3D vect(curveA.cartesianEnd.x - curveA.cartesianStart.x, curveA.cartesianEnd.y - curveA.cartesianStart.y, curveA.cartesianEnd.z - curveA.cartesianStart.z);//交线向量 result = (aDir*vect) | bDir; //(A法线叉积交线向量EF)点积 B法线 } else { CVector3D vect(curveA.cartesianStart.x - curveA.cartesianEnd.x, curveA.cartesianStart.y - curveA.cartesianEnd.y, curveA.cartesianStart.z - curveA.cartesianEnd.z); result = (aDir*vect) | bDir; } if(result > 0) return true; else return false; } else if( strcmp(Fa->name_, "plane")== 0 && strcmp(Fb->name_, "plane")!=0 )//平面 曲面 { double result; CPoint3D P(curveA.cartesianStart.x, curveA.cartesianStart.y, curveA.cartesianStart.z); if(oriA.orientedEdgeOri == oriA.edgeCurveOri) { CVector3D PVec(pointA.x - P.x, pointA.y - P.y, pointA.z - P.z); if(oriA.advancedFaceOri == 'T') { CVector3D RVec = PVec*bDir; result = aDir | (RVec*bDir); } else { CVector3D RVec = bDir * PVec; result = aDir | (RVec*bDir); } if(result > 0) return true; else return false; } else { CVector3D PVec(P.x - pointA.x, P.y - pointA.y, P.z - pointA.z); if(oriA.advancedFaceOri == 'T') { CVector3D RVec = PVec*bDir; result = aDir | (RVec*bDir); } else { CVector3D RVec = bDir * PVec; result = aDir | (RVec*bDir); } if(result > 0) return true; else return false; } } else if(strcmp(Fa->name_, "plane")!= 0 && strcmp(Fb->name_, "plane") != 0)//曲面 曲面 { double result; if(oriA.orientedEdgeOri == oriA.edgeCurveOri) { CVector3D FaVector, FbVector; CVector3D PVec(pointA.x - curveA.cartesianStart.x, pointA.y - curveA.cartesianStart.y, pointA.z - curveA.cartesianStart.z); if (oriA.advancedFaceOri == 'T') FaVector = (PVec * aDir) * aDir; else FaVector = aDir * (PVec * aDir); CPoint3D pB = curveB.cartesianStart;//Fb 相交边对应的start CVector3D vec(curveB.cartesianStart.x - curveA.cartesianStart.x, curveB.cartesianStart.y - curveA.cartesianStart.y, curveB.cartesianStart.z - curveA.cartesianStart.z); CVector3D RvecB = PVec * vec; if (oriA.advancedFaceOri == 'T') FbVector = RvecB * vec; else FbVector = vec * RvecB; result = ((PVec * aDir)*FbVector) | FaVector; if (result > 0) return true; else return false; } } }