Changeset 1344 for GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp
- Timestamp:
- 09/12/06 17:39:08 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp
r1328 r1344 10 10 11 11 Polygon3::Polygon3(): 12 mMaterial(NULL), mParent(NULL), mPiercingRays(0) 12 mMaterial(NULL), 13 mParent(NULL), 14 mPiercingRays(0) 13 15 , mPlane(NULL) 14 16 { 15 // mostly there will be triangles16 //mVertices.reserve(3);17 17 } 18 18 19 19 Polygon3::Polygon3(const VertexContainer &vertices): 20 mMaterial(NULL), mParent(NULL), mPiercingRays(0) 20 mMaterial(NULL), 21 mParent(NULL), 22 mPiercingRays(0) 21 23 , mPlane(NULL) 22 24 { … … 27 29 28 30 Polygon3::Polygon3(MeshInstance *parent): 29 mMaterial(NULL), mParent(parent), mPiercingRays(0) 31 mMaterial(NULL), 32 mParent(parent), 33 mPiercingRays(0) 30 34 , mPlane(NULL) 31 35 {} … … 33 37 34 38 Polygon3::Polygon3(Face *face, Mesh *parentMesh): 35 mMaterial(NULL), mParent(NULL), mPiercingRays(0) 36 , mPlane(NULL) 39 mMaterial(NULL), 40 mParent(NULL), 41 mPiercingRays(0), 42 mPlane(NULL) 37 43 { 38 44 mVertices.reserve(face->mVertexIndices.size()); 39 45 40 VertexIndexContainer::iterator it = face->mVertexIndices.begin(); 41 for (; it != face->mVertexIndices.end(); ++it) 46 VertexIndexContainer::iterator it, it_end = face->mVertexIndices.end(); 47 48 for (it = face->mVertexIndices.begin(); it != it_end; ++ it) 42 49 { 43 50 mVertices.push_back(parentMesh->mVertices[*it]); … … 54 61 #else 55 62 if (!mPlane) 63 { 56 64 mPlane = new Plane3(mVertices[0], mVertices[1], mVertices[2]); 65 } 66 57 67 return *mPlane; 58 68 #endif … … 65 75 mVertices[0] - mVertices[1])); 66 76 } 77 67 78 68 79 void Polygon3::Split(const Plane3 &partition, … … 72 83 { 73 84 Vector3 ptA = mVertices.back(); 74 75 85 int sideA = partition.Side(ptA, epsilon); 76 77 VertexContainer::const_iterator it;78 79 Vector3 lastSplit;80 81 86 bool foundSplit = false; 82 87 Vector3 lastSplit; 88 83 89 //-- find line - plane intersections 84 for (it = mVertices.begin(); it != mVertices.end(); ++ it) 90 91 VertexContainer::const_iterator it, it_end = mVertices.end(); 92 93 for (it = mVertices.begin(); it != it_end; ++ it) 85 94 { 86 95 Vector3 ptB = *it;
Note: See TracChangeset
for help on using the changeset viewer.