- Timestamp:
- 10/30/05 15:08:39 (19 years ago)
- Location:
- trunk/VUT
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj
r338 r361 153 153 </File> 154 154 <File 155 RelativePath="..\src\Halton.cpp"> 156 </File> 157 <File 158 RelativePath="..\src\Halton.h"> 159 </File> 160 <File 155 161 RelativePath="..\src\Intersectable.h"> 156 162 </File> -
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r352 r361 56 56 57 57 Sampling { 58 totalSamples 20000 058 totalSamples 20000 59 59 samplesPerPass 2 60 60 } … … 69 69 70 70 # filename ../data/atlanta/atlanta_viewcells_large.x3d 71 #filename ../data/vienna/viewcells-25-sel.x3d72 filename ../data/vienna/viewcells-25.x3d71 filename ../data/vienna/viewcells-25-sel.x3d 72 # filename ../data/vienna/viewcells-25.x3d 73 73 # filename ../data/vienna/viewcells-large-sel.x3d 74 74 } … … 77 77 Construction { 78 78 # input fromRays 79 #input fromViewCells80 input fromSceneGeometry81 samples 15000 079 input fromViewCells 80 # input fromSceneGeometry 81 samples 15000 82 82 sideTolerance 0.005 83 83 } … … 123 123 # autopartition 124 124 maxRays -1 125 maxPolygons 250125 maxPolygons 0 126 126 maxDepth 100 127 127 -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp
r360 r361 383 383 bool onBackSide = false; 384 384 385 int count = 0; 386 387 // find possible line-plane intersections 385 // find intersections 388 386 for (it = polys.begin(); it != polys.end(); ++ it) 389 387 { 390 int cf = (*it)->ClassifyPlane(plane);388 const int cf = (*it)->ClassifyPlane(plane); 391 389 392 390 if (cf == FRONT_SIDE) … … 395 393 onBackSide = true; 396 394 397 //TODO: check if split goes through vertex398 if ((cf == SPLIT) || (onFrontSide && onBackSide)) // split399 {395 if ((cf == SPLIT) || (cf == COINCIDENT) || (onFrontSide && onBackSide)) 396 { 397 Debug << "here" << endl; 400 398 return SPLIT; 401 399 } … … 411 409 } 412 410 413 return COINCIDENT; // plane and polygon are coincident414 } 411 return SPLIT; 412 } -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r360 r361 620 620 Exporter *exporter = Exporter::GetExporter("viewCells.x3d"); 621 621 622 if (exporter) 622 // export leaves 623 if (0 && exporter) 623 624 { 624 //exporter->ExportLeavesGeometry(mBspTree, leaves); 625 626 delete exporter; 625 vector<BspLeaf *> leaves; 626 mBspTree->CollectLeaves(leaves); 627 vector<BspLeaf *> randLeaves; 628 vector<BspLeaf *> neighbors; 629 630 for (int k = 0; k < 1; ++ k) 631 { 632 BspLeaf *leaf = leaves[Random((int)leaves.size())]; 633 randLeaves.push_back(leaf); 634 mBspTree->FindNeighbors(leaf, neighbors, false); 635 } 636 637 exporter->ExportLeavesGeometry(*mBspTree, randLeaves); 638 exporter->SetWireframe(); 639 exporter->ExportLeavesGeometry(*mBspTree, neighbors); 640 641 delete exporter; 627 642 } 643 644 vector<BspLeaf *> leaves; 645 mBspTree->CollectLeaves(leaves); 646 647 for (int k = 0; k < 100; ++ k) 648 { 649 vector<BspLeaf *> randLeaves; 650 vector<BspLeaf *> neighbors; 651 652 char s[64]; sprintf(s, "bsp-vc%04d.x3d", k); 653 Exporter *exporter = Exporter::GetExporter(s); 654 655 BspLeaf *leaf = leaves[Random((int)leaves.size())]; 656 Debug << "\noutput leaf " << k << endl; 657 randLeaves.push_back(leaf); 658 mBspTree->FindNeighbors(leaf, neighbors, false); 659 660 exporter->ExportLeavesGeometry(*mBspTree, randLeaves); 661 exporter->SetWireframe(); 662 exporter->ExportLeavesGeometry(*mBspTree, neighbors); 663 664 delete exporter; 665 } 628 666 629 667 for (int j = 0; j < pvsViewCells.size(); ++ j) -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r360 r361 1686 1686 } 1687 1687 1688 void BspTree::ExtractSplitPlanes(BspNode *n, vector<Plane3 *> planes, vector<bool> sides) const 1689 { 1690 while (!n->IsRoot()) 1691 { 1692 if (!n->IsLeaf()) 1693 planes.push_back(dynamic_cast<BspInterior *>(n)->GetPlane()); 1694 1695 sides.push_back(n->GetParent()->mFront == n); 1696 1688 void BspTree::ExtractSplitPlanes(BspNode *n, vector<Plane3 *> &planes, vector<bool> &sides) const 1689 { 1690 BspNode *lastNode; 1691 do 1692 { 1693 lastNode = n; 1697 1694 n = n->GetParent(); 1698 } 1695 1696 if (n) 1697 { 1698 BspInterior *interior = dynamic_cast<BspInterior *>(n); 1699 1700 planes.push_back(dynamic_cast<BspInterior *>(interior)->GetPlane()); 1701 sides.push_back(interior->mFront == lastNode); 1702 } 1703 } 1704 while (n); 1699 1705 } 1700 1706 … … 1763 1769 DEL_PTR(frontPoly); 1764 1770 } 1771 inside = true; 1765 1772 break; 1766 1773 1767 1774 case Polygon3::BACK_SIDE: 1768 if (sides[ i])1775 if (sides[j]) 1769 1776 inside = false; 1770 1777 break; 1771 1778 case Polygon3::FRONT_SIDE: 1772 if (!sides[ i])1779 if (!sides[j]) 1773 1780 inside = false; 1774 1781 break; … … 1785 1792 } 1786 1793 1787 int BspTree::FindNeighbors(BspNode *n, vector<BspNode *> &neighbors, bool onlyUnmailed) 1794 int BspTree::FindNeighbors(BspNode *n, vector<BspLeaf *> &neighbors, 1795 const bool onlyUnmailed) const 1788 1796 { 1789 1797 PolygonContainer cell; … … 1793 1801 stack<BspNode *> nodeStack; 1794 1802 nodeStack.push(mRoot); 1803 1804 // planes needed to verify that we found neighbor leaf. 1805 vector<Plane3 *> planes; 1806 vector<bool> sides; 1807 1808 ExtractSplitPlanes(n, planes, sides); 1795 1809 1796 1810 while (!nodeStack.empty()) … … 1799 1813 nodeStack.pop(); 1800 1814 1801 if (node->IsLeaf()) 1802 { 1803 if (node != n && (!onlyUnmailed || !node->Mailed())) 1804 neighbors.push_back(node); 1805 } 1815 if (node->IsLeaf()) 1816 { 1817 if (node != n && (!onlyUnmailed || !node->Mailed())) 1818 { 1819 // test all planes of current node on neighbour 1820 PolygonContainer neighborCandidate; 1821 ConstructGeometry(node, neighborCandidate); 1822 1823 bool isAdjacent = true; 1824 for (int i = 0; (i < planes.size()) && isAdjacent; ++ i) 1825 { 1826 const int cf = 1827 Polygon3::ClassifyPlane(neighborCandidate, *planes[i]); 1828 1829 if ((cf == Polygon3::BACK_SIDE) && sides[i]) 1830 isAdjacent = false; 1831 else if ((cf == Polygon3::FRONT_SIDE) && !sides[i]) 1832 isAdjacent = false; 1833 } 1834 1835 if (isAdjacent) 1836 neighbors.push_back(dynamic_cast<BspLeaf *>(node)); 1837 } 1838 } 1806 1839 else 1807 1840 { … … 1811 1844 1812 1845 if (cf == Polygon3::FRONT_SIDE) 1813 nodeStack.push(interior->m Back);1846 nodeStack.push(interior->mFront); 1814 1847 else 1815 1848 if (cf == Polygon3::BACK_SIDE) 1816 nodeStack.push(interior->m Front);1849 nodeStack.push(interior->mBack); 1817 1850 else 1818 1851 { … … 1822 1855 } 1823 1856 } 1824 1825 }1857 } 1858 1826 1859 return (int)neighbors.size(); 1827 1860 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r360 r361 365 365 /** finds neighbouring leaves of this tree node. 366 366 */ 367 int FindNeighbors(BspNode *n, vector<BspNode *> &neighbors, bool onlyUnmailed); 367 int FindNeighbors(BspNode *n, vector<BspLeaf *> &neighbors, 368 const bool onlyUnmailed) const; 368 369 369 370 /** Extracts geometry associated with the split plane leading to this node. … … 603 604 /** Extracts the split planes representing the space bounded by node n. 604 605 */ 605 void ExtractSplitPlanes(BspNode *n, vector<Plane3 *> planes, vector<bool>sides) const;606 void ExtractSplitPlanes(BspNode *n, vector<Plane3 *> &planes, vector<bool> &sides) const; 606 607 607 608 /// Pointer to the root of the tree
Note: See TracChangeset
for help on using the changeset viewer.