Changeset 750
- Timestamp:
- 04/12/06 08:18:49 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp
r534 r750 49 49 return box; 50 50 } 51 51 52 52 53 int … … 461 462 AddFace(new Face(index + 0, index + 1, index + 2, index + 3) ); 462 463 } 464 465 466 467 Mesh *CreateBox(const AxisAlignedBox3 &box) 468 { 469 Mesh *mesh = new Mesh; 470 // add 8 vertices of the box 471 int index = (int)mesh->mVertices.size(); 472 for (int i=0; i < 8; i++) { 473 Vector3 v; 474 box.GetVertex(i, v); 475 mesh->mVertices.push_back(v); 476 } 477 478 mesh->AddFace(new Face(index + 0, index + 1, index + 3, index + 2) ); 479 mesh->AddFace(new Face(index + 0, index + 2, index + 6, index + 4) ); 480 mesh->AddFace(new Face(index + 4, index + 6, index + 7, index + 5) ); 481 482 mesh->AddFace(new Face(index + 3, index + 1, index + 5, index + 7) ); 483 mesh->AddFace(new Face(index + 0, index + 4, index + 5, index + 1) ); 484 mesh->AddFace(new Face(index + 2, index + 3, index + 7, index + 6) ); 485 486 return mesh; 487 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h
r693 r750 155 155 return s<<"Mesh #vertices="<<(int)mVertices.size()<<" #faces="<<(int)mFaces.size(); 156 156 } 157 158 157 158 friend Mesh *CreateBox(const AxisAlignedBox3 &box); 159 159 }; 160 160 -
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h
r574 r750 102 102 void Triangulate(vector<Triangle3> &triangles); 103 103 /** 104 Adds polygon to mesh 104 Adds polygon to mesh description as a face 105 105 */ 106 106 void AddToMesh(Mesh &mesh); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r749 r750 15 15 16 16 Preprocessor *preprocessor; 17 18 19 static void AddGeometry(SceneGraph *scene) 20 { 21 AxisAlignedBox3 sceneBox = scene->GetBox(); 22 23 int n = 200; 24 25 if (0){ 26 // form figure 27 for (int i = 0; i < n; ++ i) 28 { 29 for (int j = 0; j < n; ++ j) 30 { 31 const Vector3 scale2((float)j * 0.8 / n + 0.1, 0.05, (float)i * 0.8 / (float)n + 0.1); 32 33 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 34 35 Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 36 AxisAlignedBox3 box(pt2, pt2 + boxSize); 37 Mesh *mesh = CreateBox(box); 38 39 mesh->Preprocess(); 40 41 MeshInstance *mi = new MeshInstance(mesh); 42 scene->mRoot->mGeometry.push_back(mi); 43 } 44 } 45 46 for (int i = 0; i < n; ++ i) 47 { 48 for (int j = 0; j < n; ++ j) 49 { 50 const Vector3 scale2(0.15, (float)j * 0.8 / n + 0.1, (float)i * 0.8 / (float)n + 0.1); 51 52 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 53 54 Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 55 AxisAlignedBox3 box(pt2, pt2 + boxSize); 56 Mesh *mesh = CreateBox(box); 57 58 mesh->Preprocess(); 59 60 MeshInstance *mi = new MeshInstance(mesh); 61 scene->mRoot->mGeometry.push_back(mi); 62 } 63 } 64 65 for (int i = 0; i < n; ++ i) 66 { 67 const Vector3 scale2(2, 0.2, (float)i * 0.8 / (float)n + 0.1); 68 69 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 70 71 //Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 72 Vector3 boxSize = sceneBox.Size() * Vector3(0.005, 0.02, 0.005); 73 AxisAlignedBox3 box(pt2 + 0.1, pt2 + boxSize); 74 Mesh *mesh = CreateBox(box); 75 76 mesh->Preprocess(); 77 78 MeshInstance *mi = new MeshInstance(mesh); 79 scene->mRoot->mGeometry.push_back(mi); 80 } 81 82 scene->mRoot->UpdateBox(); 83 } 84 // plane separating areas 85 if(1) 86 { 87 const Vector3 scale(1.0, 0.0, 0); 88 89 Vector3 pt = sceneBox.Min() + scale * (sceneBox.Max() - sceneBox.Min()); 90 91 Plane3 cuttingPlane(Vector3(1, 0, 0), pt); 92 93 Mesh *planeMesh = new Mesh(); 94 95 Polygon3 *poly = sceneBox.CrossSection(cuttingPlane); 96 97 poly->AddToMesh(*planeMesh); 98 99 planeMesh->Preprocess(); 100 101 MeshInstance *planeMi = new MeshInstance(planeMesh); 102 scene->mRoot->mGeometry.push_back(planeMi); 103 } 104 } 105 17 106 18 107 Preprocessor::Preprocessor(): … … 76 165 return (int)filenames.size(); 77 166 } 167 78 168 79 169 bool … … 124 214 125 215 if (result) { 126 216 // HACK 217 mSceneGraph->mRoot->UpdateBox(); 218 AddGeometry(mSceneGraph); 127 219 mSceneGraph->AssignObjectIds(); 128 220 int intersectables, faces; … … 132 224 cout<<"#NUM_FACES (Total numner of faces)\n"<<faces<<endl; 133 225 mSceneGraph->CollectObjects(&mObjects); 134 mSceneGraph->mRoot->UpdateBox();226 //mSceneGraph->mRoot->UpdateBox(); 135 227 136 228 /* Exporter *exporter = Exporter::GetExporter("testload.x3d"); -
GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
r726 r750 184 184 fclose(file); 185 185 186 186 187 *proot = root; 187 188 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r746 r750 372 372 } 373 373 374 //exporter->SetWireframe();374 exporter->SetWireframe(); 375 375 ExportViewCellsForViz(exporter); 376 376 -
GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
r712 r750 572 572 else 573 573 { 574 // HACK: enlarge in y directon 575 mViewSpaceBox = new AxisAlignedBox3(mKdTree->GetBox()); 576 577 if (0) { 578 //Vector3 pmin = mViewSpaceBox->Min(); 579 Vector3 size = mViewSpaceBox->Size(); 580 //size[1] *= 1.25; 581 Vector3 enlarge(size[0] * 0.25f, size[1] * 0.0f, size[2] * 0.25f); 582 583 mViewSpaceBox->Enlarge(enlarge); 584 } else { 585 // $$ JB temporary 586 AxisAlignedBox3 box = *mViewSpaceBox; 587 float s = box.Size(0); 588 box.Scale(0.8f); 589 box.SetMax(0, box.Max(0) + s*0.8f); 590 box.SetMin(0, box.Min(0) + s*0.8f); 591 *mViewSpaceBox = box; 592 } 593 574 // HACK: enlarge in y directon 575 mViewSpaceBox = new AxisAlignedBox3(mKdTree->GetBox()); 576 577 if (1) 578 { 579 //Vector3 pmin = mViewSpaceBox->Min(); 580 Vector3 size = mViewSpaceBox->Size(); 581 //size[1] *= 1.25; 582 //Vector3 enlarge(size[0] * 0.25f, size[1] * 0.0f, size[2] * 0.25f); 583 Vector3 enlarge(size[0] * 4.0f, 0.0f, 0.0f); 584 585 //mViewSpaceBox->Enlarge(enlarge); 586 mViewSpaceBox->SetMax(mViewSpaceBox->Max() + enlarge); 587 } 588 else 589 { 590 // $$ JB temporary 591 AxisAlignedBox3 box = *mViewSpaceBox; 592 593 float s = box.Size(0); 594 595 box.Scale(0.8f); 596 box.SetMax(0, box.Max(0) + s*0.8f); 597 box.SetMin(0, box.Min(0) + s*0.8f); 598 *mViewSpaceBox = box; 599 } 594 600 } 595 601 //Debug << "view space box: " << *mViewSpaceBox << endl;
Note: See TracChangeset
for help on using the changeset viewer.