本文整理汇总了C++中Triangulation::setLink方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangulation::setLink方法的具体用法?C++ Triangulation::setLink怎么用?C++ Triangulation::setLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangulation
的用法示例。
在下文中一共展示了Triangulation::setLink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addVertexOnEdge
void addVertexOnEdge(Triangulation& trist,
FIndex triIJK,
FIndex triILJ,
shared_ptr<DAGNode> triRJK,
shared_ptr<DAGNode> triRKI,
shared_ptr<DAGNode> triRIL,
shared_ptr<DAGNode> triRLJ) {
// Add the new triangles
triRJK->fIndex_ = trist.addLinkedTri(triRJK->tri_);
triRKI->fIndex_ = trist.addLinkedTri(triRKI->tri_);
triRIL->fIndex_ = trist.addLinkedTri(triRIL->tri_);
triRLJ->fIndex_ = trist.addLinkedTri(triRLJ->tri_);
// Get the edge indicies (at least iIdx)
int rIdx, iIdx, lIdx;
triRIL->tri_.get(rIdx, iIdx, lIdx);
const LinkedTriangle& ltriIJK = trist[triIJK];
int ijkEdgeIdxIJ, ijkEdgeIdxJK, ijkEdgeIdxKI;
ltriIJK.getEdgeIndices(iIdx, ijkEdgeIdxIJ, ijkEdgeIdxJK, ijkEdgeIdxKI);
const LinkedTriangle& ltriILJ = trist[triILJ];
int iljEdgeIdxIL, iljEdgeIdxLJ, iljEdgeIdxJI;
ltriILJ.getEdgeIndices(iIdx, iljEdgeIdxIL, iljEdgeIdxLJ, iljEdgeIdxJI);
// Get reference to adjacent triangles
FIndex adjIndexKI = ltriIJK.links_[ijkEdgeIdxKI];
FIndex adjIndexIL = ltriILJ.links_[iljEdgeIdxIL];
FIndex adjIndexLJ = ltriILJ.links_[iljEdgeIdxLJ];
FIndex adjIndexJK = ltriIJK.links_[ijkEdgeIdxJK];
// internal links (4x: RK, RI, RL, RJ)
trist.setLink(triRJK->fIndex_, 2, triRKI->fIndex_); // RK
trist.setLink(triRKI->fIndex_, 2, triRIL->fIndex_); // RI
trist.setLink(triRIL->fIndex_, 2, triRLJ->fIndex_); // RL
trist.setLink(triRLJ->fIndex_, 2, triRJK->fIndex_); // RL
// external links (4x: JK, KI, IL, LJ)
// PERF: if store what the other edge idx is, could save lookup.
trist.setLink(triRJK->fIndex_, 1, adjIndexJK);
trist.setLink(triRKI->fIndex_, 1, adjIndexKI);
trist.setLink(triRIL->fIndex_, 1, adjIndexIL);
trist.setLink(triRLJ->fIndex_, 1, adjIndexLJ);
// remove old triangles
trist.removeLinkedTri(triIJK);
trist.removeLinkedTri(triILJ);
#ifdef TRIANGULATION_CHECK
assert(trist.checkConsistent());
#endif
}
示例2: addVertexInTri
void addVertexInTri(Triangulation& trist,
FIndex triIJK,
shared_ptr<DAGNode> triRIJ,
shared_ptr<DAGNode> triRJK,
shared_ptr<DAGNode> triRKI) {
// Add the new triangles
triRIJ->fIndex_ = trist.addLinkedTri(triRIJ->tri_);
triRJK->fIndex_ = trist.addLinkedTri(triRJK->tri_);
triRKI->fIndex_ = trist.addLinkedTri(triRKI->tri_);
// It can be assumed that call to this fn,
// the given shared_ptr<DAGNode> contain points in order.
//
// But, no knowledge about the triangle referenced
// by triIJK
int rIdx, iIdx, jIdx;
triRIJ->tri_.get(rIdx, iIdx, jIdx);
const LinkedTriangle& ltriIJK = trist[triIJK];
int edgeIdxIJ, edgeIdxJK, edgeIdxKI;
ltriIJK.getEdgeIndices(iIdx, edgeIdxIJ, edgeIdxJK, edgeIdxKI);
// Get reference to adjacent triangles,
// (might not actually be triangles)
FIndex adjIndexIJ = ltriIJK.links_[edgeIdxIJ];
FIndex adjIndexJK = ltriIJK.links_[edgeIdxJK];
FIndex adjIndexKI = ltriIJK.links_[edgeIdxKI];
// unlink ... not necessary.
// internal links (3x: RI, RJ, RK)
trist.setLink(triRIJ->fIndex_, 2, triRJK->fIndex_); // RJ
trist.setLink(triRJK->fIndex_, 2, triRKI->fIndex_); // RK
trist.setLink(triRKI->fIndex_, 2, triRIJ->fIndex_); // RI
// external links (3x: IJ, JK, KI)
// PERF: if store what the other edge idx is, could save lookup.
trist.setLink(triRIJ->fIndex_, 1, adjIndexIJ); // RJ
trist.setLink(triRJK->fIndex_, 1, adjIndexJK); // RK
trist.setLink(triRKI->fIndex_, 1, adjIndexKI); // RI
// remove old triangles
trist.removeLinkedTri(triIJK);
#ifdef TRIANGULATION_CHECK
assert(trist.checkConsistent());
#endif
}
示例3: flipTriangles
void flipTriangles(Triangulation& trist,
FIndex triIJK,
FIndex triJIL,
shared_ptr<DAGNode> triILK,
shared_ptr<DAGNode> triLJK) {
// Add the new triangles
triILK->fIndex_ = trist.addLinkedTri(triILK->tri_);
triLJK->fIndex_ = trist.addLinkedTri(triLJK->tri_);
// Get the edge indicies (at least iIdx)
int iIdx, lIdx, kIdx;
triILK->tri_.get(iIdx, lIdx, kIdx);
const LinkedTriangle& ltriIJK = trist[triIJK];
int ijkEdgeIdxIJ, ijkEdgeIdxJK, ijkEdgeIdxKI;
ltriIJK.getEdgeIndices(iIdx, ijkEdgeIdxIJ, ijkEdgeIdxJK, ijkEdgeIdxKI);
const LinkedTriangle& ltriJIL = trist[triJIL];
int jilEdgeIdxJI, jilEdgeIdxIL, jilEdgeIdxLJ;
ltriJIL.getEdgeIndices(iIdx, jilEdgeIdxIL, jilEdgeIdxLJ, jilEdgeIdxJI);
// Get reference to adjacent triangles
FIndex adjIndexKI = ltriIJK.links_[ijkEdgeIdxKI];
FIndex adjIndexIL = ltriJIL.links_[jilEdgeIdxIL];
FIndex adjIndexLJ = ltriJIL.links_[jilEdgeIdxLJ];
FIndex adjIndexJK = ltriIJK.links_[ijkEdgeIdxJK];
// internal links (1x: KL)
trist.setLink(triLJK->fIndex_, 2, triILK->fIndex_);
// external links (4x: JK, KI, IL, LJ)
// PERF: if store what the other edge idx is, could save lookup.
trist.setLink(triLJK->fIndex_, 0, adjIndexLJ); // LJ
trist.setLink(triLJK->fIndex_, 1, adjIndexJK); // JK
trist.setLink(triILK->fIndex_, 0, adjIndexIL); // IL
trist.setLink(triILK->fIndex_, 2, adjIndexKI); // KI
// remove old triangles
trist.removeLinkedTri(triIJK);
trist.removeLinkedTri(triJIL);
#ifdef TRIANGULATION_CHECK
assert(trist.checkConsistent());
#endif
}