Changeset 822 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 04/26/06 08:11:30 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r811 r822 2022 2022 optFloat, 2023 2023 "vsp_bsp_construction_min_band=", 2024 "0. 4");2024 "0.1"); 2025 2025 2026 2026 RegisterOption("VspBspTree.Construction.maxBand", 2027 2027 optFloat, 2028 2028 "vsp_bsp_construction_min_band=", 2029 "0.6"); 2029 "0.9"); 2030 2031 RegisterOption("VspBspTree.Construction.useDrivingAxisForMaxCost", 2032 optBool, 2033 "vsp_bsp_construction_use_drivingaxis_for_maxcost=", 2034 "false"); 2030 2035 2031 2036 RegisterOption("VspBspTree.Construction.epsilon", -
GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp
r810 r822 1564 1564 1565 1565 // allows faster split because we have axis aligned kd tree boxes 1566 if ( 0&& isKdNode)1566 if (1 && isKdNode) 1567 1567 { 1568 1568 nCostRatio[axis] = EvalAxisAlignedSplitCost(tData, … … 1604 1604 else 1605 1605 { 1606 1606 1607 nCostRatio[axis] = 1607 1608 BestCostRatioHeuristics(*tData.mRays, … … 1610 1611 axis, 1611 1612 nPosition[axis]); 1613 1614 1612 1615 } 1613 1616 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r811 r822 781 781 const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 782 782 783 Debug << "number of leaves: " << numLeaves << endl;784 cout << "number of leaves: " << numLeaves << endl;783 //Debug << "number of leaves: " << numLeaves << endl; 784 //cout << "number of leaves: " << numLeaves << endl; 785 785 786 786 if (useHisto) … … 2147 2147 mColorCode = 1; 2148 2148 2149 Exporter *exporter = Exporter::GetExporter("final_view_cells. wrl");2149 Exporter *exporter = Exporter::GetExporter("final_view_cells.x3d"); 2150 2150 2151 2151 cout << "exporting view cells after merge (pvs size) ... "; … … 4014 4014 mColorCode = 1; 4015 4015 4016 Exporter *exporter = Exporter::GetExporter("final_view_cells. wrl");4016 Exporter *exporter = Exporter::GetExporter("final_view_cells.x3d"); 4017 4017 4018 4018 if (exporter) -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r810 r822 130 130 environment->GetFloatValue("VspBspTree.Construction.minBand", mMinBand); 131 131 environment->GetFloatValue("VspBspTree.Construction.maxBand", mMaxBand); 132 environment->GetBoolValue("VspBspTree.Construction.useDrivingAxisForMaxCost", mUseDrivingAxisForMaxCost); 132 133 133 134 //-- debug output … … 159 160 Debug << "priority queue type: " << mNodePriorityQueueType << endl; 160 161 Debug << "empty view cells merge: " << mEmptyViewCellsMergeAllowed << endl; 161 Debug << " octree: " << mCirculatingAxis << endl;162 Debug << "circulating axis: " << mCirculatingAxis << endl; 162 163 Debug << "minband: " << mMinBand << endl; 163 164 Debug << "maxband: " << mMaxBand << endl; 164 165 Debug << "use driving axis for max cost: " << mUseDrivingAxisForMaxCost << endl; 165 166 166 167 Debug << "Split plane strategy: "; … … 728 729 ++ mBspStats.polySplits; 729 730 731 // if it was a kd node (i.e., a box) and the split axis is axis aligned, it is still a kd node 730 732 tFrontData.mIsKdNode = tBackData.mIsKdNode = (tData.mIsKdNode && (splitAxis < 3)); 731 733 tFrontData.mAxis = tBackData.mAxis = splitAxis; … … 1219 1221 const float minBox = box.Min(axis); 1220 1222 const float maxBox = box.Max(axis); 1223 1221 1224 const float sizeBox = maxBox - minBox; 1222 1225 … … 1239 1242 float minSum = 1e20f; 1240 1243 1244 1241 1245 // if no border can be found, take mid split 1242 1246 position = minBox + 0.5f * sizeBox; 1247 1248 // the relative cost ratio 1249 float ratio = /*Limits::Infinity;*/99999999.0; 1250 bool splitPlaneFound = false; 1243 1251 1244 1252 Intersectable::NewMail(); … … 1282 1290 vector<SortableEntry>::const_iterator ci, ci_end = mSplitCandidates->end(); 1283 1291 1284 for (ci = mSplitCandidates->begin(); ci <ci_end; ++ ci)1292 for (ci = mSplitCandidates->begin(); ci != ci_end; ++ ci) 1285 1293 { 1286 1294 VssRay *ray; … … 1325 1333 } 1326 1334 1335 1336 1327 1337 // Note: sufficient to compare size of bounding boxes of front and back side? 1328 1338 if (((*ci).value >= minBand) && ((*ci).value <= maxBand)) … … 1330 1340 sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); 1331 1341 1332 // cout<< "pos=" << (*ci).value << "\t pvs=(" << pvsl << "," << pvsr << ")" << endl;1333 // cout<<"cost= "<<sum<<endl;1342 //Debug << "pos=" << (*ci).value << "\t pvs=(" << pvsl << "," << pvsr << ")" << endl; 1343 //Debug << "cost= " << sum << endl; 1334 1344 1335 1345 if (sum < minSum) 1336 1346 { 1347 splitPlaneFound = true; 1348 1337 1349 minSum = sum; 1338 1350 position = (*ci).value; … … 1344 1356 } 1345 1357 1346 Debug << "pos: " << position << " sizebox: " << sizeBox << " pvs: " << pvsSize << endl; 1347 1358 1348 1359 // -- compute cost 1349 1360 const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); … … 1362 1373 const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack; 1363 1374 1364 float ratio = mPvsFactor * newRenderCost / (oldRenderCost + Limits::Small); 1365 1366 //Debug << "costRatio=" << ratio << " pos=" << position << " t=" << (position - minBox) / (maxBox - minBox) 1367 // <<"\t q=(" << queriesBack << "," << queriesFront << ")\t r=(" << raysBack << "," << raysFront << ")" << endl; 1375 if (splitPlaneFound) 1376 { 1377 ratio = mPvsFactor * newRenderCost / (oldRenderCost + Limits::Small); 1378 } 1379 //if (axis != 1) 1380 //Debug << "axis=" << axis << " costRatio=" << ratio << " pos=" << position << " t=" << (position - minBox) / (maxBox - minBox) 1381 // <<"\t pb=(" << pvsBack << ")\t pf=(" << pvsFront << ")" << endl; 1368 1382 1369 1383 return ratio; … … 1388 1402 BspNodeGeometry *nBackGeom[3]; 1389 1403 1404 // set to NULL, so I can find out which gemetry was stored 1390 1405 for (int i = 0; i < 3; ++ i) 1391 1406 { … … 1394 1409 } 1395 1410 1396 int bestAxis = -1;1397 1398 1411 // create bounding box of node geometry 1399 1412 AxisAlignedBox3 box; … … 1402 1415 if (1) 1403 1416 { 1417 // get bounding box from geometry 1404 1418 tData.mGeometry->GetBoundingBox(box); 1405 1419 } … … 1414 1428 1415 1429 int sAxis = 0; 1430 int bestAxis; 1431 1432 if (mUseDrivingAxisForMaxCost) 1433 bestAxis = box.Size().DrivingAxis(); 1434 else 1435 bestAxis = -1; 1436 1437 // mximum cost ratio for axis to be valid: 1438 // if exceeded, spatial mid split is used instead 1439 const float maxCostRatio = 0.9f; 1440 1416 1441 // hack : subdivide along driving axis up to certain depth 1417 1442 int maxDepthForDrivingAxis = 0; 1443 const maxCostRatioForHeur = 0.99; 1418 1444 1419 1445 const bool useSpecialAxis = mOnlyDrivingAxis || mUseRandomAxis || 1420 mCirculatingAxis || (tData.mDepth < maxDepthForDrivingAxis);1446 mCirculatingAxis; 1421 1447 1422 1448 … … 1426 1452 else if (mCirculatingAxis) 1427 1453 sAxis = (tData.mAxis + 1) % 3; 1428 else if (mOnlyDrivingAxis || (tData.mDepth < maxDepthForDrivingAxis))1454 else if (mOnlyDrivingAxis) 1429 1455 sAxis = box.Size().DrivingAxis(); 1430 1456 … … 1433 1459 //Debug << "axis: " << sAxis << " drivingaxis: " << box.Size().DrivingAxis(); 1434 1460 1435 for (axis = 0; axis < 3 ; ++ axis)1461 for (axis = 0; axis < 3 ; ++ axis) 1436 1462 { 1437 1463 if (!useSpecialAxis || (axis == sAxis)) 1438 1464 { 1439 if (!mUseCostHeuristics) 1440 { 1465 //-- place split plane using heuristics 1466 1467 if (mUseCostHeuristics) 1468 { 1469 nCostRatio[axis] = 1470 BestCostRatioHeuristics(*tData.mRays, 1471 box, 1472 tData.mPvs, 1473 axis, 1474 nPosition[axis]); 1475 } 1476 1477 //-- split plane position is spatial median 1478 //-- use median split if cost ratio very low as 1479 //-- there are not enough visibility cues 1480 1481 else //if (!mUseCostHeuristics || (nCostRatio[axis] > maxCostRatioForHeur)) 1482 { 1483 1441 1484 nPosition[axis] = (box.Min()[axis] + box.Max()[axis]) * 0.5f; 1442 1485 Vector3 normal(0,0,0); normal[axis] = 1.0f; 1443 1486 1444 1487 // allows faster split because we have axis aligned kd tree boxes 1445 if ( 0 &&isKdNode)1488 if (isKdNode) 1446 1489 { 1447 1490 nCostRatio[axis] = EvalAxisAlignedSplitCost(tData, … … 1455 1498 1456 1499 // create back geometry from box 1500 // NOTE: the geometry is saved when possible 1457 1501 pos = box.Max(); pos[axis] = nPosition[axis]; 1458 1502 AxisAlignedBox3 bBox(box.Min(), pos); … … 1462 1506 nBackGeom[axis] = new BspNodeGeometry(fPolys); 1463 1507 1464 // create front geometry from box1508 //-- create front geometry from box 1465 1509 pos = box.Min(); pos[axis] = nPosition[axis]; 1466 1510 AxisAlignedBox3 fBox(pos, box.Max()); … … 1481 1525 } 1482 1526 } 1483 else 1484 { 1485 nCostRatio[axis] = 1486 BestCostRatioHeuristics(*tData.mRays, 1487 box, 1488 tData.mPvs, 1489 axis, 1490 nPosition[axis]); 1491 } 1492 1493 if (bestAxis == -1) 1494 { 1495 bestAxis = axis; 1496 } 1497 else if (nCostRatio[axis] < nCostRatio[bestAxis]) 1498 { 1499 bestAxis = axis; 1500 } 1501 1527 1528 1529 if (!mUseDrivingAxisForMaxCost) 1530 { 1531 if (bestAxis == -1) 1532 { 1533 bestAxis = axis; 1534 } 1535 else if (nCostRatio[axis] < nCostRatio[bestAxis]) 1536 { 1537 bestAxis = axis; 1538 } 1539 } 1540 else 1541 { 1542 // NOTE: takes longest axis split if cost ratio exceeds threshold 1543 if (nCostRatio[axis] < min(maxCostRatio, nCostRatio[bestAxis])) 1544 { 1545 bestAxis = axis; 1546 } 1547 //else if (nCostRatio[axis] < nCostRatio[bestAxis]) 1548 // Debug << "warning!! different path taken: " << axis << " " << bestAxis << endl; 1549 1550 } 1502 1551 } 1503 1552 } … … 1520 1569 plane = Plane3(normal, nPosition[bestAxis]); 1521 1570 1571 //Debug << "best axis: " << bestAxis << " pos " << nPosition[bestAxis] << endl; 1572 //Debug << "!!!!!!!!!!!!!!" << endl; 1522 1573 return nCostRatio[bestAxis]; 1523 1574 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
r810 r822 744 744 float mCtDivCi; 745 745 746 bool mUseDrivingAxisForMaxCost; 746 747 //-- axis aligned split criteria 747 748 float mAxisAlignedCtDivCi; -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r811 r822 14 14 #include "SceneGraph.h" 15 15 #include "PreprocessorThread.h" 16 #include "RenderSampler.h"16 //#include "RenderSampler.h" 17 17 18 18 #include <QApplication> … … 63 63 else 64 64 if (preprocessorType == "render") 65 p = new RenderSampler();65 ;// p = new RenderSampler(); 66 66 else { 67 67 cerr<<"Unknown preprocessor type"<<endl;
Note: See TracChangeset
for help on using the changeset viewer.