本文整理汇总了C++中TriangleList::add方法的典型用法代码示例。如果您正苦于以下问题:C++ TriangleList::add方法的具体用法?C++ TriangleList::add怎么用?C++ TriangleList::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriangleList
的用法示例。
在下文中一共展示了TriangleList::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcOptPrim
unsigned int TriangleAdjacencyGraph::calcOptPrim ( unsigned extIteration,
bool doStrip, bool doFan,
unsigned minFanTriangles )
{
int iteration = extIteration;
bool sample = iteration > 1 ? true : false;
bool checkRevOrder = sample;
TriangleList degreeBag[4];
TriangleList *fList = 0;
int cost = 0, sampleCost = 0;
int stripCost = 0, revCost = 0, fanCost = 0, triCost = 0;
int bestCost = 0, worstCost = 0, lowDegree;
unsigned int i, n;
WalkCase walkCase = START;
Triangle *triangle, *next;
HalfEdge *twin = 0, *gateEdge = 0, *halfEdge = 0;
bool doMainLoop = true;
unsigned int seed = 1, bestSeed = 1;
int mostDegree = 3;
unsigned triangleLeft = _trianglePool.countElem();
srand(1);
if (doFan) {
n = _temporaryVector.size();
fanCost = 0;
// find fans
for (i = 0; i < n; i++)
if ( (_temporaryVector[i].size() >= minFanTriangles) &&
(gateEdge = _temporaryVector[i][0].second) &&
(gateEdge->triangle->valid()) ) {
for ( halfEdge = gateEdge->next->next->twin;
(halfEdge && halfEdge->triangle->valid() && (halfEdge != gateEdge));
halfEdge = halfEdge->next->next->twin )
;
if (halfEdge == gateEdge) {
// fan is closed; mark every triangle
triangle = 0;
fList = new TriangleList;
for ( halfEdge = gateEdge;
!triangle || (halfEdge != gateEdge);
halfEdge = halfEdge->next->next->twin ) {
triangle = halfEdge->triangle;
_validTriangleBag.release(*triangle);
triangle->drop();
triangle->state = FAN_PART;
fList->add(*triangle);
}
_fanBag.push_back(Primitive(i,fList));
fanCost += (_temporaryVector[i].size() + 2);
triangleLeft -= _temporaryVector[i].size();
}
}
}
if (doStrip && iteration) {
// push every triangle into the according degree bag
degreeBag[mostDegree].paste(_validTriangleBag);
for (triangle = degreeBag[mostDegree].first; triangle; triangle = next) {
next = triangle->next;
if (triangle->valid()) {
if (triangle->state != mostDegree) {
degreeBag[mostDegree].release(*triangle);
_validTriangleBag.release(*triangle);
degreeBag[triangle->state].add( *triangle);
}
}
else {
cerr << "INVALID TRIANGLE IN VALID TRIANGLE BAG\n" << endl;
}
}
for (iteration--; iteration >= 0; iteration--) {
seed = iteration ? rand() : bestSeed;
srand (seed);
fList = 0;
cost = 0;
doMainLoop = true;
walkCase = START;
// run the main loop
while (doMainLoop) {
switch (walkCase) {
case START:
stripCost = 0;
triangle = 0;
for (lowDegree = 1; lowDegree < 4; lowDegree++)
if ((degreeBag[lowDegree].empty() == false)) {
if (sample) {
// pick a random triangle
//.........这里部分代码省略.........