Changeset 1011 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 06/12/06 16:36:26 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r1006 r1011 68 68 bool randomize = false; 69 69 Environment::GetSingleton()->GetBoolValue("VspBspTree.Construction.randomize", randomize); 70 if (randomize) 71 Randomize(); // initialise random generator for heuristics 70 if (randomize) Randomize(); // initialise random generator for heuristics 72 71 73 72 //-- termination criteria for autopartition … … 87 86 Environment::GetSingleton()->GetFloatValue("VspBspTree.Termination.minGlobalCostRatio", mTermMinGlobalCostRatio); 88 87 Environment::GetSingleton()->GetIntValue("VspBspTree.Termination.globalCostMissTolerance", mTermGlobalCostMissTolerance); 89 90 // HACK//mTermMinPolygons = 25;91 88 92 89 //-- factors for bsp tree split plane heuristics … … 2736 2733 const int side = plane.Side(bRay.ExtrapOrigin()); 2737 2734 2735 ++ splits; 2736 2738 2737 if (side <= 0) 2739 2738 { -
GTP/trunk/Lib/Vis/Preprocessing/src/VspKdTree.cpp
r1006 r1011 147 147 } 148 148 149 149 150 void VspKdInterior::Print(ostream &s) const 150 151 { … … 165 166 } 166 167 168 167 169 int VspKdInterior::ComputeRayIntersection(const RayInfo &rayData, float &t) 168 170 { … … 170 172 } 171 173 174 172 175 VspKdNode *VspKdInterior::GetBack() const 173 176 { 174 177 return mBack; 175 178 } 179 176 180 177 181 VspKdNode *VspKdInterior::GetFront() const -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
r1010 r1011 124 124 {} 125 125 126 126 127 VspInterior::~VspInterior() 127 128 { … … 130 131 } 131 132 133 132 134 bool VspInterior::IsLeaf() const 133 135 { … … 135 137 } 136 138 139 137 140 VspNode *VspInterior::GetBack() 138 141 { … … 140 143 } 141 144 145 142 146 VspNode *VspInterior::GetFront() 143 147 { … … 145 149 } 146 150 151 147 152 AxisAlignedPlane VspInterior::GetPlane() const 148 153 { 149 154 return mPlane; 150 155 } 156 151 157 152 158 void VspInterior::ReplaceChildLink(VspNode *oldChild, VspNode *newChild) … … 157 163 mFront = newChild; 158 164 } 165 159 166 160 167 void VspInterior::SetupChildLinks(VspNode *b, VspNode *f) … … 527 534 { 528 535 return 529 (mOutOfMemory 530 || (mVspStats.Leaves() >= mMaxViewCells) 531 || (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 532 ); 536 (mOutOfMemory || 537 (mVspStats.Leaves() >= mMaxViewCells) || 538 (mGlobalCostMisses >= mTermGlobalCostMissTolerance)); 533 539 } 534 540 … … 680 686 backData.mRays = new RayInfoContainer(); 681 687 682 683 688 //-- subdivide rays 684 #if TODO685 689 SplitRays(splitPlane, 686 690 *tData.mRays, 687 691 *frontData.mRays, 688 692 *backData.mRays); 689 #endif 690 691 // compute pvs 693 694 //-- compute pvs 692 695 frontData.mPvs = ComputePvsSize(*frontData.mRays); 693 696 backData.mPvs = ComputePvsSize(*backData.mRays); 694 697 695 698 // split front and back node geometry and compute area 696 697 // if geometry was not already computed698 // TODO699 700 #if TODO701 699 tData.mBoundingBox.Split(splitPlane.mAxis, splitPlane.mPosition, 702 700 frontData.mBoundingBox, backData.mBoundingBox); 703 701 704 #endif705 702 706 703 frontData.mProbability = frontData.mBoundingBox.GetVolume(); … … 1039 1036 int bestAxis = -1; 1040 1037 1041 #if 01042 // maximum cost ratio for axis to be valid:1043 // if exceeded, spatial mid split is used instead1044 const maxCostRatioForHeur = 0.99f;1045 #endif1046 1038 1047 1039 // if we use some kind of specialised fixed axis … … 1146 1138 } 1147 1139 1148 #if TODO 1149 pFront = geomFront.GetVolume(); 1140 AxisAlignedBox3 frontBox; 1141 AxisAlignedBox3 backBox; 1142 1143 data.mBoundingBox.Split(candidatePlane.mAxis, candidatePlane.mPosition, frontBox, backBox); 1144 1145 pFront = frontBox.GetVolume(); 1150 1146 pBack = pOverall - pFront; 1151 #endif1152 1147 1153 1148 … … 1399 1394 Intersectable::NewMail(); 1400 1395 ViewCell::NewMail(); 1396 1401 1397 Vector3 entp = ray.Extrap(mint); 1402 1398 Vector3 extp = ray.Extrap(maxt); … … 1651 1647 1652 1648 1653 int VspOspTree::SplitRays(const Plane3 &plane,1654 RayInfoContainer &rays,1655 RayInfoContainer &frontRays,1656 RayInfoContainer &backRays) const1657 {1658 int splits = 0;1659 1660 RayInfoContainer::const_iterator it, it_end = rays.end();1661 1662 for (it = rays.begin(); it != it_end; ++ it)1663 {1664 RayInfo bRay = *it;1665 1666 VssRay *ray = bRay.mRay;1667 float t;1668 1669 // get classification and receive new t1670 const int cf = bRay.ComputeRayIntersection(plane, t);1671 1672 switch (cf)1673 {1674 case -1:1675 backRays.push_back(bRay);1676 break;1677 case 1:1678 frontRays.push_back(bRay);1679 break;1680 case 0:1681 {1682 //-- split ray1683 //-- test if start point behind or in front of plane1684 const int side = plane.Side(bRay.ExtrapOrigin());1685 1686 if (side <= 0)1687 {1688 backRays.push_back(RayInfo(ray, bRay.GetMinT(), t));1689 frontRays.push_back(RayInfo(ray, t, bRay.GetMaxT()));1690 }1691 else1692 {1693 frontRays.push_back(RayInfo(ray, bRay.GetMinT(), t));1694 backRays.push_back(RayInfo(ray, t, bRay.GetMaxT()));1695 }1696 }1697 break;1698 default:1699 Debug << "Should not come here" << endl;1700 break;1701 }1702 }1703 1704 return splits;1705 }1706 1707 1708 1649 int VspOspTree::FindNeighbors(VspNode *n, vector<VspLeaf *> &neighbors, 1709 1650 const bool onlyUnmailed) const … … 1849 1790 int hits = 0; 1850 1791 #if TODO 1851 stack< BspRayTraversalData> tStack;1792 stack<VspRayTraversalData> tStack; 1852 1793 1853 1794 float mint = 0.0f, maxt = 1.0f; … … 2195 2136 } 2196 2137 2197 } 2138 2139 int VspOspTree::SplitRays(const AxisAlignedPlane &plane, 2140 RayInfoContainer &rays, 2141 RayInfoContainer &frontRays, 2142 RayInfoContainer &backRays) const 2143 { 2144 int splits = 0; 2145 2146 RayInfoContainer::const_iterator rit, rit_end = rays.end(); 2147 2148 for (rit = rays.begin(); rit != rit_end; ++ rit) 2149 { 2150 RayInfo bRay = *rit; 2151 2152 VssRay *ray = bRay.mRay; 2153 float t; 2154 2155 // get classification and receive new t 2156 //-- test if start point behind or in front of plane 2157 const int side = plane.ComputeRayIntersection(bRay, t); 2158 2159 if (side == 0) 2160 { 2161 ++ splits; 2162 2163 if (ray->HasPosDir(plane.mAxis)) 2164 { 2165 backRays.push_back(RayInfo(ray, bRay.GetMinT(), t)); 2166 frontRays.push_back(RayInfo(ray, t, bRay.GetMaxT())); 2167 } 2168 else 2169 { 2170 frontRays.push_back(RayInfo(ray, bRay.GetMinT(), t)); 2171 backRays.push_back(RayInfo(ray, t, bRay.GetMaxT())); 2172 } 2173 } 2174 else if (side == 1) 2175 { 2176 frontRays.push_back(bRay); 2177 } 2178 else 2179 { 2180 backRays.push_back(bRay); 2181 } 2182 2183 } 2184 2185 return splits; 2186 } 2187 2188 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
r1010 r1011 35 35 { 36 36 public: 37 38 int ComputeRayIntersection(const RayInfo &rayData, float &t) const 39 { 40 return rayData.ComputeRayIntersection(mAxis, mPosition, t); 41 } 42 37 43 int mAxis; 38 44 float mPosition; … … 742 748 @returns the number of splits 743 749 */ 744 int SplitRays(const Plane3&plane,750 int SplitRays(const AxisAlignedPlane &plane, 745 751 RayInfoContainer &rays, 746 752 RayInfoContainer &frontRays,
Note: See TracChangeset
for help on using the changeset viewer.