- Timestamp:
- 09/29/05 01:48:20 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r298 r301 15 15 # viewcells ../data/atlanta/atlanta_viewcells_large.x3d 16 16 # viewcells ../data/atlanta/atlanta_viewcells_large2.x3d 17 viewcells ../data/vienna/viewcells-25-sel.x3d18 #viewcells ../data/vienna/viewcells-25.x3d17 # viewcells ../data/vienna/viewcells-25-sel.x3d 18 viewcells ../data/vienna/viewcells-25.x3d 19 19 # viewcells ../data/vienna/viewcells-large-sel.x3d 20 20 } … … 75 75 # least splits + balanced polygons 76 76 #splitPlaneStrategy 12 77 # 77 #axis aligned + vertical axis 78 78 #splitPlaneStrategy 66 79 79 # axis aligned + balanced view cells 80 #splitPlaneStrategy 1880 splitPlaneStrategy 18 81 81 # largest polygon area 82 splitPlaneStrategy 3282 #splitPlaneStrategy 32 83 83 # axus aligned + balanced polygons 84 84 #splitPlaneStrategy 72 … … 89 89 maxViewCells 999999 90 90 Termination { 91 maxPolysForAxisAligned 5091 maxPolysForAxisAligned 20 92 92 maxPolygons 0 93 93 maxDepth 100 -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp
r300 r301 122 122 for (it = mVertices.begin(); it != it_end; ++it) 123 123 vtx.push_back(rot * (*it)); 124 125 Vector3 cur = vtx.back(); 124 125 //-- compute area 126 Vector3 last = vtx.back(); 126 127 127 128 float area = 0.0f; 128 129 for (it = vtx.begin(); it != vtx.end(); ++it) 129 130 { 130 area += cur.y * (*it).x - cur.x * (*it).y;131 132 cur= *it;133 } 134 131 area += last.y * (*it).x - last.x * (*it).y; 132 133 last = *it; 134 } 135 //Debug << "area: " << area * 0.5 << endl; 135 136 return area * 0.5f; 136 137 } … … 219 220 // check if area exceeds certain size 220 221 if (AREA_LIMIT > GetArea()) 222 { 223 //Debug << "area too small: " << GetArea() << endl; 221 224 return false; 225 } 222 226 #else 223 227 Vector3 vtx = mVertices.back(); -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r299 r301 457 457 458 458 if (!poly->Valid()) 459 Debug << "Input polygon not valid: " << *poly << endl; 460 459 Debug << "Input polygon not valid: " << *poly 460 << endl << "Area: " << poly->GetArea() << endl; 461 461 462 ++ polysNum; 462 463 } … … 580 581 if ((tData.mPolygons->size() <= sTermMaxPolygons) || (tData.mDepth >= sTermMaxDepth)) 581 582 { 582 //#ifdef _DEBUG583 #ifdef _DEBUG 583 584 Debug << "subdivision terminated at depth " << tData.mDepth << ", #polys: " << (int)tData.mPolygons->size() << endl; 584 //#endif585 #endif 585 586 586 587 EvaluateLeafStats(tData); … … 735 736 Polygon3::IncludeInBox(polys, box); 736 737 737 int axis = box.Size().DrivingAxis(); 738 int objectsBack = 0, objectsFront = 0; 739 int axis = 0; 740 float costRatio = MAX_FLOAT; 741 Vector3 position; 742 743 for (int i=0; i < 3; i++) 744 { 745 float p = 0; 746 float r = 0;/*BestCostRatio(leaf, 747 box, 748 i, 749 p, 750 objectsBack, 751 objectsFront);*/ 752 if (r < costRatio) 753 { 754 costRatio = r; 755 axis = i; 756 position = p; 757 } 758 } 759 760 //if (costRatio > mMaxCostRatio) axis = -1; 761 Vector3 norm(0,0,0); norm[axis] = 1.0f; 762 return Plane3(norm, position); 763 764 /*int axis = box.Size().DrivingAxis(); 738 765 Vector3 norm(0,0,0); norm[axis] = 1; 739 740 Vector3 pt = (box.Min()[axis] + box.Max()[axis]) * 0.5f; 741 742 return Plane3(norm, pt); 766 Vector3 pt = (box.Min()[axis] + box.Max()[axis]) * 0.5f;*/ 767 //Debug << "splitting axis aligned" << endl; 768 //return Plane3(norm, pt); 743 769 } 744 770 … … 786 812 } 787 813 } 788 Debug << "Plane lowest cost: " << lowestCost << endl;814 //Debug << "Plane lowest cost: " << lowestCost << endl; 789 815 790 816 return polys[bestPlaneIdx]->GetSupportingPlane(); … … 798 824 float BspTree::EvalSplitPlane(const PolygonContainer &polys, const Plane3 &candidatePlane) const 799 825 { 800 float sumBalancedPolys = 0; 801 float sumBalancedViewCells = 0; 802 float sumSplits = 0; 803 float sumPolyArea = 0; 804 float verticalAxis = 0; 826 float val = 0; 805 827 806 828 if (sSplitPlaneStrategy & VERTICAL_AXIS) … … 809 831 // want to put a penalty on the dot product between the "tiny" vertical axis 810 832 // and the split plane axis 811 verticalAxis = fabs(DotProd(candidatePlane.mNormal, tinyAxis)) * (float)polys.size(); 833 val += sVerticalSplitsFactor * 834 fabs(DotProd(candidatePlane.mNormal, tinyAxis)) * (float)polys.size(); 812 835 } 813 836 //-- strategies where the effect of the split plane on the polygons is tested 814 if ((sSplitPlaneStrategy & BALANCED_POLYS) 815 (sSplitPlaneStrategy & LEAST_SPLITS) 837 if ((sSplitPlaneStrategy & BALANCED_POLYS) || 838 (sSplitPlaneStrategy & LEAST_SPLITS) || 816 839 (sSplitPlaneStrategy & LARGEST_POLY_AREA)) 817 840 { 818 841 PolygonContainer::const_iterator it, it_end = polys.end(); 819 842 float sumBalancedPolys = 0; 843 float sumSplits = 0; 844 820 845 for (it = polys.begin(); it != it_end; ++ it) 821 846 { … … 830 855 if (sSplitPlaneStrategy & LARGEST_POLY_AREA) 831 856 { 832 Debug << "polygon area: " << (*it)->GetArea() << " "; 833 sumPolyArea += (*it)->GetArea(); 857 if (classification == Polygon3::COINCIDENT) 858 { 859 float area = (*it)->GetArea(); 860 //Debug << "polygon area: " << area << " "; 861 if (area) val += 100.0f/area; 862 } 834 863 } 835 }Debug << "\n"; 864 } 865 val += sBalancedPolysFactor * fabs(sumBalancedPolys) + 866 sLeastSplitsFactor * sumSplits; 836 867 } 837 868 … … 841 872 ObjectContainer frontViewCells; 842 873 ObjectContainer backViewCells; 874 875 float sumBalancedViewCells = 0; 843 876 844 877 PolygonContainer::const_iterator it, it_end = polys.end(); … … 868 901 { 869 902 intersect = *frontIt; 870 sumBalancedViewCells += 1 ;903 sumBalancedViewCells += 1.0f; 871 904 } 872 905 } … … 883 916 } 884 917 } 918 919 val += sBalancedViewCellsFactor * fabs(sumBalancedViewCells); 885 920 } 886 921 887 922 // return linear combination of the sums 888 return sBalancedPolysFactor * fabs(sumBalancedPolys) + 889 sBalancedViewCellsFactor * fabs(sumBalancedViewCells) + 890 sLeastSplitsFactor * sumSplits + 891 sVerticalSplitsFactor * verticalAxis + 892 sumPolyArea; 923 return val; 893 924 } 894 925
Note: See TracChangeset
for help on using the changeset viewer.