Changeset 473 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
- Timestamp:
- 12/20/05 20:33:42 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r472 r473 355 355 356 356 app << "#N_PMINRAYSLEAVES ( Percentage of leaves with minimal number of rays)\n" 357 << minRaysNodes * 100 / (double)Leaves() << endl; 357 << minRaysNodes * 100 / (double)Leaves() << endl; 358 359 app << "#N_MAXCOSTNODES ( Percentage of leaves with terminated because of max cost ratio )\n" 360 << maxCostNodes * 100 / (double)Leaves() << endl; 358 361 359 362 app << "#N_PMINAREALEAVES ( Percentage of leaves with mininum area )\n" … … 412 415 mRoot = new BspLeaf(); 413 416 414 tStack.push(BspTraversalData(mRoot, polys, 0, mRootCell, new BoundedRayContainer(), 0, 415 mBox.SurfaceArea(), new BspNodeGeometry())); 417 tStack.push(BspTraversalData(mRoot, 418 polys, 419 0, 420 mRootCell, 421 new BoundedRayContainer(), 422 0, 423 mBox.SurfaceArea(), 424 new BspNodeGeometry())); 416 425 417 426 while (!tStack.empty()) … … 1142 1151 if (!data.mPolygons->empty()) 1143 1152 { 1144 Polygon3 *nextPoly = (*data.mPolygons)[ Random((int)data.mPolygons->size())];1153 Polygon3 *nextPoly = (*data.mPolygons)[(int)RandomValue(0, (int)data.mPolygons->size() - 1)]; 1145 1154 return nextPoly->GetSupportingPlane(); 1146 1155 } 1147 1156 else 1148 1157 { 1149 const int candidateIdx = Random((int)data.mRays->size());1158 const int candidateIdx = (int)RandomValue(0, (int)data.mRays->size() - 1); 1150 1159 BoundedRay *bRay = (*data.mRays)[candidateIdx]; 1151 1160 … … 1177 1186 int limit = Min((int)data.mPolygons->size(), mMaxPolyCandidates); 1178 1187 1179 int candidateIdx = limit ;1188 int candidateIdx = limit - 1; 1180 1189 1181 1190 for (int i = 0; i < limit; ++ i) … … 1207 1216 for (int i = 0; i < mMaxRayCandidates / 2; ++ i) 1208 1217 { 1209 candidateIdx = Random((int)rays->size());1218 candidateIdx = (int)RandomValue(0, (int)rays->size() - 1); 1210 1219 BoundedRay *bRay = (*rays)[candidateIdx]; 1211 1220 … … 1242 1251 for (int j = 0; j < 3; j ++) 1243 1252 { 1244 idx[j] = Random((int)rays->size() * 2);1253 idx[j] = (int)RandomValue(0, (int)rays->size() * 2 - 1); 1245 1254 1246 1255 if (idx[j] >= (int)rays->size()) … … 1279 1288 int BspTree::GetNextCandidateIdx(int currentIdx, PolygonContainer &polys) 1280 1289 { 1281 const int candidateIdx = Random(currentIdx --);1290 const int candidateIdx = (int)RandomValue(0, currentIdx --); 1282 1291 1283 1292 // swap candidates to avoid testing same plane 2 times … … 1285 1294 1286 1295 return currentIdx; 1287 //return Random((int)polys.size());1296 //return (int)RandomValue(0, (int)polys.size() - 1); 1288 1297 } 1289 1298 … … 1329 1338 for (int i = 0; i < limit; ++ i) 1330 1339 { 1331 const int testIdx = useRand ? Random(limit) : i;1340 const int testIdx = useRand ? (int)RandomValue(0, limit - 1) : i; 1332 1341 1333 1342 Polygon3 *poly = polys[testIdx]; … … 1494 1503 for (int i = 0; i < limit; ++ i) 1495 1504 { 1496 const int testIdx = useRand ? Random(limit) : i;1505 const int testIdx = useRand ? (int)RandomValue(0, limit - 1) : i; 1497 1506 1498 1507 BoundedRay *bRay = rays[testIdx]; … … 2076 2085 { 2077 2086 int splits = 0; 2078 2087 2079 2088 while (!rays.empty()) 2080 2089 {
Note: See TracChangeset
for help on using the changeset viewer.