Changeset 1db34af
- Timestamp:
- Nov 28, 2009, 3:48:41 PM (16 years ago)
- Children:
- f4df97
- Parents:
- 2dff2d (diff), ea3627 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/tesselation.cpp
r2dff2d r1db34af 4132 4132 /// 2. Go through all lines not contained in degenerated triangles. 4133 4133 UniquePolygonSet ListofFours; 4134 UniquePolygonSet TestedPolygons; 4134 4135 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) { 4135 4136 Log() << Verbose(1) << "Current Line is: " << *(LineRunner->second) << endl; … … 4148 4149 TriangleSet *T = Four->GetAllContainedTrianglesFromEndpoints(); 4149 4150 4150 /// 2c. check whether triangles are not already simply degenerated. 4151 /// 2c1. Check whether all triangles have (besides sign) same normal vector) 4152 TriangleSet::const_iterator Runner = T->begin(); 4153 Vector NormalVector; 4154 NormalVector.CopyVector(&(*Runner)->NormalVector); 4155 Runner++; 4156 bool IsPlanar = true; 4157 for (; Runner != T->end(); Runner++) { 4158 if (fabs(fabs(NormalVector.ScalarProduct(&(*Runner)->NormalVector)) - 1.) > MYEPSILON) // check whether all NormalVectors are parallel 4159 IsPlanar = false; 4160 } 4161 4162 /// 2c2. check whether triangles are not already simply degenerated. 4151 4163 size_t DegeneratedCount = 0; 4152 4164 for (TriangleSet::const_iterator Runner = T->begin(); Runner != T->end(); Runner++) { … … 4155 4167 } 4156 4168 Log() << Verbose(1) << "Found " << DegeneratedCount << " degenerated triangles." << endl; 4157 if (DegeneratedCount == 0) { 4158 /// 2c. Find all pairs of those triangles that contain the four endpoints 4159 const int counter = CountTrianglePairContainingPolygon(Four, T); 4160 Log() << Verbose(1) << "There are " << counter << " pairs for this polygon of four." << endl; 4161 if (counter %3 == 0) { 4162 /// 2d. Check the number of pairs, if greater 1, we have a degenerated polygon (mark down for later use) 4163 pair < UniquePolygonSet::iterator, bool > Tester = ListofFours.insert(Four); 4164 if (Tester.second) { 4165 Log() << Verbose(0) << "ACCEPT: We have a degenerated polygon." << *Four << endl; 4169 4170 if (IsPlanar) { 4171 if(DegeneratedCount == 0) { 4172 /// 2c. Find all pairs of those triangles that contain the four endpoints 4173 const int counter = CountTrianglePairContainingPolygon(Four, T); 4174 Log() << Verbose(1) << "There are " << counter << " pairs for this polygon of four." << endl; 4175 if (counter %3 == 0) { 4176 /// 2d. Check the number of pairs, if greater 1, we have a degenerated polygon (mark down for later use) 4177 pair < UniquePolygonSet::iterator, bool > Tester = ListofFours.insert(Four); 4178 if (Tester.second) { 4179 Log() << Verbose(0) << "ACCEPT: We have a degenerated polygon." << *Four << endl; 4180 } else { 4181 Log() << Verbose(0) << "REJECT: Degenerated polygon already present." << *Four << endl; 4182 delete(Four); 4183 } 4166 4184 } else { 4167 Log() << Verbose(0) << "REJECT: Degenerated polygon already present." << *Four << endl;4185 Log() << Verbose(0) << "REJECT: Seems to be the edge line of a degenerated polygon only." << *Four << endl; 4168 4186 delete(Four); 4169 4187 } 4170 4188 } else { 4171 Log() << Verbose(0) << "REJECT: Seems to be the edge line of a degenerated polygon only." << *Four<< endl;4189 Log() << Verbose(0) << "REJECT: This polygon contains some simply degenerated triangles." << endl; 4172 4190 delete(Four); 4173 4191 } 4174 4192 } else { 4175 Log() << Verbose(0) << "REJECT: This polygon contains some simply degenerated triangles." << endl;4193 Log() << Verbose(0) << "REJECT: This polygon does not lay on a plane." << endl; 4176 4194 delete(Four); 4177 4195 }
Note:
See TracChangeset
for help on using the changeset viewer.