📄 ibgoedge.cxx
字号:
#include "ibgoctree.hxx"
#include "cogwarnings.hxx"
void ibgOctree::findEdges()
{
wzIndex edge=edges.create();
wzIndex rc,s,i,f,p;
wzRangeLoop(faces,f){
wzIndex l=fLine[f];
for(s=0;s<LineSides;s++){
p = getPlane(l,s);
if(!p){
// that's possible - no plane in a direction which intersects a cube;
continue;
}
// now, we have to identify the face as on one of the four sides of the plane.
// note that one of the end points of the line may be a middle point.
ibgIndex bnu=lNodeDown[l]; // doubles some getPlane-code
ibgIndex bno=lNodeUp[l];
ibgIndex d = lDirection(l);
ibgIndex piu = lsPlane[d][s], pio = lsPlane[down(d)][s];
wzAssert(p==bnPlane[piu][bnu]); wzAssert(p==bnPlane[pio][bno]);
ibgIndex buu=pNode[pReverse[piu]][p];
ibgIndex boo=pNode[pReverse[pio]][p];
wzAssert((buu==bnu) || (boo==bno));
piu = lsPlane[d][sOther[s]], pio = lsPlane[down(d)][sOther[s]];
ibgIndex bru=pNode[pReverse[piu]][p];
ibgIndex bro=pNode[pReverse[pio]][p];
wzAssert(bru != buu);
wzAssert(bru != bro);
wzAssert(bru != boo);
wzAssert(bro != buu);
wzAssert(bro != boo);
wzAssert(buu != boo);
// now it seems clear that we have found the 4 nodes correctly.
// time to search for the edge intersection with the plane.
try{
cogFlag1 f1(fPoint[f],fPointDown[f],fPointUp[f]);
cogFlag2 f2(ePoint[edge],ePointFace[edge],ePointDown[edge],ePointUp[edge]);
rc=geo->Square(f2,f1,
cogSquare(nPoint[bnBase[buu]],
nPoint[bnBase[boo]],
nPoint[bnBase[bro]],
nPoint[bnBase[bru]]));
if(rc!=cogRCEdgeFound){
// establishing connection to the other face omitted yet;
// means, no pair establishment yet.
continue;
}
for(i=0;i<PlaneSides;i++){
eVertex[i][edge] = 0;
if(!pEdge[p]) noteEdgeOnCube(p,edge,i);
}
eFace[edge] = f; fEdge[s][f]=edge;
ePlane[edge]= p; eNext[edge] = pEdge[p]; pEdge[p] = edge;
eIdent[edge]= 0; // means, not yet implemented;
edge = edges.create();
}catch(...){
cogInfoEdgeProblems();
}
}
}
edges.destroy(edge);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -