Changeset a9b2a0a for molecuilder/src/boundary.cpp
- Timestamp:
- Oct 27, 2009, 4:11:22 PM (16 years ago)
- Children:
- 069034
- Parents:
- 55a71b
- File:
-
- 1 edited
-
molecuilder/src/boundary.cpp (modified) (45 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/boundary.cpp
r55a71b ra9b2a0a 26 26 * \param *BoundaryPoints NDIM set of boundary points defining the convex envelope on each projected plane 27 27 * \param *mol molecule structure representing the cluster 28 * \param *&TesselStruct Tesselation structure with triangles 28 29 * \param IsAngstroem whether we have angstroem or atomic units 29 30 * \return NDIM array of the diameters 30 31 */ 31 double *GetDiametersOfCluster(ofstream *out, Boundaries *BoundaryPtr, molecule *mol,bool IsAngstroem)32 double *GetDiametersOfCluster(ofstream *out, const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem) 32 33 { 33 34 // get points on boundary of NULL was given as parameter 34 35 bool BoundaryFreeFlag = false; 35 Boundaries *BoundaryPoints = BoundaryPtr;36 36 double OldComponent = 0.; 37 37 double tmp = 0.; … … 42 42 int component = 0; 43 43 int Othercomponent = 0; 44 Boundaries:: iterator Neighbour;45 Boundaries:: iterator OtherNeighbour;44 Boundaries::const_iterator Neighbour; 45 Boundaries::const_iterator OtherNeighbour; 46 46 double *GreatestDiameter = new double[NDIM]; 47 47 48 if (BoundaryPoints == NULL) { 48 const Boundaries *BoundaryPoints; 49 if (BoundaryPtr == NULL) { 49 50 BoundaryFreeFlag = true; 50 BoundaryPoints = GetBoundaryPoints(out, mol );51 BoundaryPoints = GetBoundaryPoints(out, mol, TesselStruct); 51 52 } else { 53 BoundaryPoints = BoundaryPtr; 52 54 *out << Verbose(1) << "Using given boundary points set." << endl; 53 55 } … … 63 65 Othercomponent = (axis + 1 + ((j + 1) & 1)) % NDIM; 64 66 //*out << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl; 65 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner 66 != BoundaryPoints[axis].end(); runner++) 67 { 67 for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 68 68 //*out << Verbose(2) << "Current runner is " << *(runner->second.second) << "." << endl; 69 69 // seek for the neighbours pair where the Othercomponent sign flips … … 74 74 DistanceVector.CopyVector(&runner->second.second->x); 75 75 DistanceVector.SubtractVector(&Neighbour->second.second->x); 76 do 77 { // seek for neighbour pair where it flips 76 do { // seek for neighbour pair where it flips 78 77 OldComponent = DistanceVector.x[Othercomponent]; 79 78 Neighbour++; … … 83 82 DistanceVector.SubtractVector(&Neighbour->second.second->x); 84 83 //*out << Verbose(3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl; 85 } 86 while ((runner != Neighbour) && (fabs(OldComponent / fabs( 84 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 87 85 OldComponent) - DistanceVector.x[Othercomponent] / fabs( 88 86 DistanceVector.x[Othercomponent])) < MYEPSILON)); // as long as sign does not flip 89 if (runner != Neighbour) 90 { 87 if (runner != Neighbour) { 91 88 OtherNeighbour = Neighbour; 92 89 if (OtherNeighbour == BoundaryPoints[axis].begin()) // make it wrap around … … 133 130 * \param *out output stream for debugging 134 131 * \param *mol molecule structure representing the cluster 135 */ 136 Boundaries *GetBoundaryPoints(ofstream *out, molecule *mol) 132 * \param *&TesselStruct pointer to Tesselation structure 133 */ 134 Boundaries *GetBoundaryPoints(ofstream *out, const molecule *mol, Tesselation *&TesselStruct) 137 135 { 138 136 atom *Walker = NULL; … … 148 146 Vector ProjectedVector; 149 147 Boundaries *BoundaryPoints = new Boundaries[NDIM]; // first is alpha, second is (r, nr) 150 double radius = 0.;151 148 double angle = 0.; 152 149 … … 172 169 173 170 // correct for negative side 174 radius = ProjectedVector.NormSquared();171 const double radius = ProjectedVector.NormSquared(); 175 172 if (fabs(radius) > MYEPSILON) 176 173 angle = ProjectedVector.Angle(&AngleReferenceVector); … … 188 185 *out << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl; 189 186 *out << Verbose(2) << "New vector: " << *Walker << endl; 190 double tmp= ProjectedVector.NormSquared();191 if (( tmp- BoundaryTestPair.first->second.first) > MYEPSILON) {192 BoundaryTestPair.first->second.first = tmp;187 const double ProjectedVectorNorm = ProjectedVector.NormSquared(); 188 if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) { 189 BoundaryTestPair.first->second.first = ProjectedVectorNorm; 193 190 BoundaryTestPair.first->second.second = Walker; 194 *out << Verbose(2) << "Keeping new vector due to larger projected distance " << tmp<< "." << endl;195 } else if (fabs( tmp- BoundaryTestPair.first->second.first) < MYEPSILON) {191 *out << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl; 192 } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) { 196 193 helper.CopyVector(&Walker->x); 197 194 helper.SubtractVector(MolCenter); 198 tmp= helper.NormSquared();195 const double oldhelperNorm = helper.NormSquared(); 199 196 helper.CopyVector(&BoundaryTestPair.first->second.second->x); 200 197 helper.SubtractVector(MolCenter); 201 if (helper.NormSquared() < tmp) {198 if (helper.NormSquared() < oldhelperNorm) { 202 199 BoundaryTestPair.first->second.second = Walker; 203 200 *out << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl; 204 201 } else { 205 *out << Verbose(2) << "Keeping present vector due to larger distance to molecule center " << tmp<< "." << endl;202 *out << Verbose(2) << "Keeping present vector due to larger distance to molecule center " << oldhelperNorm << "." << endl; 206 203 } 207 204 } else { 208 *out << Verbose(2) << "Keeping present vector due to larger projected distance " << tmp<< "." << endl;205 *out << Verbose(2) << "Keeping present vector due to larger projected distance " << ProjectedVectorNorm << "." << endl; 209 206 } 210 207 } … … 305 302 /** Tesselates the convex boundary by finding all boundary points. 306 303 * \param *out output stream for debugging 307 * \param *mol molecule structure with Atom's and Bond's 304 * \param *mol molecule structure with Atom's and Bond's. 308 305 * \param *TesselStruct Tesselation filled with points, lines and triangles on boundary on return 309 306 * \param *LCList atoms in LinkedCell list … … 311 308 * \return *TesselStruct is filled with convex boundary and tesselation is stored under \a *filename. 312 309 */ 313 void FindConvexBorder(ofstream *out, molecule* mol, classLinkedCell *LCList, const char *filename)310 void FindConvexBorder(ofstream *out, const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename) 314 311 { 315 312 bool BoundaryFreeFlag = false; … … 318 315 cout << Verbose(1) << "Begin of FindConvexBorder" << endl; 319 316 320 if ( mol->TesselStruct != NULL) // free if allocated321 delete( mol->TesselStruct);322 mol->TesselStruct = new class Tesselation;317 if (TesselStruct != NULL) // free if allocated 318 delete(TesselStruct); 319 TesselStruct = new class Tesselation; 323 320 324 321 // 1. Find all points on the boundary 325 322 if (BoundaryPoints == NULL) { 326 323 BoundaryFreeFlag = true; 327 BoundaryPoints = GetBoundaryPoints(out, mol );324 BoundaryPoints = GetBoundaryPoints(out, mol, TesselStruct); 328 325 } else { 329 326 *out << Verbose(1) << "Using given boundary points set." << endl; … … 348 345 for (int axis = 0; axis < NDIM; axis++) 349 346 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) 350 if (! mol->TesselStruct->AddBoundaryPoint(runner->second.second, 0))347 if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0)) 351 348 *out << Verbose(3) << "WARNING: Point " << *(runner->second.second) << " is already present!" << endl; 352 349 353 *out << Verbose(2) << "I found " << mol->TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;350 *out << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl; 354 351 // now we have the whole set of edge points in the BoundaryList 355 352 … … 362 359 363 360 // 3a. guess starting triangle 364 mol->TesselStruct->GuessStartingTriangle(out);361 TesselStruct->GuessStartingTriangle(out); 365 362 366 363 // 3b. go through all lines, that are not yet part of two triangles (only of one so far) 367 mol->TesselStruct->TesselateOnBoundary(out, mol);364 TesselStruct->TesselateOnBoundary(out, mol); 368 365 369 366 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 370 if (! mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList))367 if (!TesselStruct->InsertStraddlingPoints(out, mol, LCList)) 371 368 *out << Verbose(1) << "Insertion of straddling points failed!" << endl; 372 369 373 *out << Verbose(2) << "I created " << mol->TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << mol->TesselStruct->LinesOnBoundary.size() << " lines and " << mol->TesselStruct->PointsOnBoundary.size() << " points." << endl;370 *out << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 374 371 375 372 // 4. Store triangles in tecplot file … … 380 377 OutputName.append(TecplotSuffix); 381 378 ofstream *tecplot = new ofstream(OutputName.c_str()); 382 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);379 WriteTecplotFile(out, tecplot, TesselStruct, mol, 0); 383 380 tecplot->close(); 384 381 delete(tecplot); … … 389 386 OutputName.append(Raster3DSuffix); 390 387 ofstream *rasterplot = new ofstream(OutputName.c_str()); 391 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);388 WriteRaster3dFile(out, rasterplot, TesselStruct, mol); 392 389 rasterplot->close(); 393 390 delete(rasterplot); … … 400 397 do { 401 398 AllConvex = true; 402 for (LineMap::iterator LineRunner = mol->TesselStruct->LinesOnBoundary.begin(); LineRunner != mol->TesselStruct->LinesOnBoundary.end(); LineRunner++) {399 for (LineMap::iterator LineRunner = TesselStruct->LinesOnBoundary.begin(); LineRunner != TesselStruct->LinesOnBoundary.end(); LineRunner++) { 403 400 line = LineRunner->second; 404 401 *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl; … … 407 404 408 405 // flip the line 409 if ( mol->TesselStruct->PickFarthestofTwoBaselines(out, line) == 0.)406 if (TesselStruct->PickFarthestofTwoBaselines(out, line) == 0.) 410 407 *out << Verbose(1) << "ERROR: Correction of concave baselines failed!" << endl; 411 408 else { 412 mol->TesselStruct->FlipBaseline(out, line);409 TesselStruct->FlipBaseline(out, line); 413 410 *out << Verbose(1) << "INFO: Correction of concave baselines worked." << endl; 414 411 } … … 418 415 419 416 // 3e. we need another correction here, for TesselPoints that are below the surface (i.e. have an odd number of concave triangles surrounding it) 420 // if (! mol->TesselStruct->CorrectConcaveTesselPoints(out))417 // if (!TesselStruct->CorrectConcaveTesselPoints(out)) 421 418 // *out << Verbose(1) << "Correction of concave tesselpoints failed!" << endl; 422 419 423 *out << Verbose(2) << "I created " << mol->TesselStruct->TrianglesOnBoundary.size() << " triangles with " << mol->TesselStruct->LinesOnBoundary.size() << " lines and " << mol->TesselStruct->PointsOnBoundary.size() << " points." << endl;420 *out << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 424 421 425 422 // 4. Store triangles in tecplot file … … 429 426 OutputName.append(TecplotSuffix); 430 427 ofstream *tecplot = new ofstream(OutputName.c_str()); 431 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);428 WriteTecplotFile(out, tecplot, TesselStruct, mol, 0); 432 429 tecplot->close(); 433 430 delete(tecplot); … … 437 434 OutputName.append(Raster3DSuffix); 438 435 ofstream *rasterplot = new ofstream(OutputName.c_str()); 439 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);436 WriteRaster3dFile(out, rasterplot, TesselStruct, mol); 440 437 rasterplot->close(); 441 438 delete(rasterplot); … … 458 455 * \return true - all removed, false - something went wrong 459 456 */ 460 bool RemoveAllBoundaryPoints(ofstream *out, class Tesselation * TesselStruct, molecule *mol, char *filename)457 bool RemoveAllBoundaryPoints(ofstream *out, class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 461 458 { 462 459 int i=0; … … 481 478 // store envelope 482 479 sprintf(number, "-%04d", i++); 483 StoreTrianglesinFile(out, mol, filename, number);480 StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, number); 484 481 } 485 482 … … 511 508 * \return volume difference between the non- and the created convex envelope 512 509 */ 513 double ConvexizeNonconvexEnvelope(ofstream *out, class Tesselation * TesselStruct, molecule *mol, char *filename)510 double ConvexizeNonconvexEnvelope(ofstream *out, class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 514 511 { 515 512 double volume = 0; … … 539 536 sprintf(dummy, "-first-%d", run); 540 537 //CalculateConcavityPerBoundaryPoint(out, TesselStruct); 541 StoreTrianglesinFile(out, mol, filename, dummy);538 StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, dummy); 542 539 543 540 PointRunner = TesselStruct->PointsOnBoundary.begin(); … … 555 552 volume += TesselStruct->RemovePointFromTesselatedSurface(out, point); 556 553 sprintf(dummy, "-first-%d", ++run); 557 StoreTrianglesinFile(out, mol, filename, dummy);554 StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, dummy); 558 555 Concavity = true; 559 556 break; … … 565 562 sprintf(dummy, "-second-%d", run); 566 563 //CalculateConcavityPerBoundaryPoint(out, TesselStruct); 567 StoreTrianglesinFile(out, mol, filename, dummy);564 StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, dummy); 568 565 569 566 // second step: PickFarthestofTwoBaselines … … 579 576 volume += tmp; 580 577 if (tmp != 0.) { 581 mol->TesselStruct->FlipBaseline(out, line);578 TesselStruct->FlipBaseline(out, line); 582 579 Concavity = true; 583 580 } … … 611 608 612 609 CalculateConcavityPerBoundaryPoint(out, TesselStruct); 613 StoreTrianglesinFile(out, mol, filename, "");610 StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, ""); 614 611 615 612 // end … … 668 665 * \param *out output stream for debugging 669 666 * \param *mol molecule with atoms and bonds 667 * \param *&TesselStruct Tesselation with boundary triangles 670 668 * \param *filename prefix of filename 671 669 * \param *extraSuffix intermediate suffix 672 670 */ 673 void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix)671 void StoreTrianglesinFile(ofstream *out, const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix) 674 672 { 675 673 // 4. Store triangles in tecplot file … … 680 678 OutputName.append(TecplotSuffix); 681 679 ofstream *tecplot = new ofstream(OutputName.c_str()); 682 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);680 WriteTecplotFile(out, tecplot, TesselStruct, mol, 0); 683 681 tecplot->close(); 684 682 delete(tecplot); … … 689 687 OutputName.append(Raster3DSuffix); 690 688 ofstream *rasterplot = new ofstream(OutputName.c_str()); 691 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);689 WriteRaster3dFile(out, rasterplot, TesselStruct, mol); 692 690 rasterplot->close(); 693 691 delete(rasterplot); … … 701 699 * \param *configuration needed for path to store convex envelope file 702 700 * \param *mol molecule structure representing the cluster 701 * \param *&TesselStruct Tesselation structure with triangles on return 703 702 * \param ClusterVolume guesstimated cluster volume, if equal 0 we used VolumeOfConvexEnvelope() instead. 704 703 * \param celldensity desired average density in final cell … … 722 721 723 722 IsAngstroem = configuration->GetIsAngstroem(); 724 GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, IsAngstroem);725 BoundaryPoints = GetBoundaryPoints(out, mol );723 GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, TesselStruct, IsAngstroem); 724 BoundaryPoints = GetBoundaryPoints(out, mol, TesselStruct); 726 725 LinkedCell LCList(mol, 10.); 727 FindConvexBorder(out, mol, &LCList, NULL);726 FindConvexBorder(out, mol, TesselStruct, &LCList, NULL); 728 727 729 728 // some preparations beforehand … … 821 820 LinkedCell *LCList[List->ListOfMolecules.size()]; 822 821 double phi[NDIM]; 822 class Tesselation *TesselStruct[List->ListOfMolecules.size()]; 823 823 824 824 *out << Verbose(0) << "Begin of FillBoxWithMolecule" << endl; … … 828 828 *out << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl; 829 829 LCList[i] = new LinkedCell((*ListRunner), 5.); // get linked cell list 830 if ( (*ListRunner)->TesselStruct== NULL) {830 if (TesselStruct[i] == NULL) { 831 831 *out << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl; 832 FindNonConvexBorder((ofstream *)&cout, (*ListRunner), LCList[i], 5., NULL);832 FindNonConvexBorder((ofstream *)&cout, (*ListRunner), TesselStruct[i], (const LinkedCell *&)LCList[i], 5., NULL); 833 833 } 834 834 i++; … … 868 868 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) { 869 869 // get linked cell list 870 if ( (*ListRunner)->TesselStruct== NULL) {870 if (TesselStruct[i] == NULL) { 871 871 *out << Verbose(1) << "ERROR: TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl; 872 872 FillIt = false; 873 } else 874 FillIt = FillIt && (!(*ListRunner)->TesselStruct->IsInnerPoint(out, CurrentPosition, LCList[i++])); 873 } else { 874 FillIt = FillIt && (!TesselStruct[i]->IsInnerPoint(out, CurrentPosition, LCList[i])); 875 i++; 876 } 875 877 } 876 878 … … 947 949 * \param *out output stream for debugging 948 950 * \param *mol molecule structure with Atom's and Bond's 949 * \param * TessTesselation filled with points, lines and triangles on boundary on return950 * \param * LCList atoms in LinkedCell list951 * \param *&TesselStruct Tesselation filled with points, lines and triangles on boundary on return 952 * \param *&LCList atoms in LinkedCell list 951 953 * \param RADIUS radius of the virtual sphere 952 954 * \param *filename filename prefix for output of vertex data 953 955 */ 954 void FindNonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const double RADIUS, const char *filename = NULL)956 void FindNonConvexBorder(ofstream *out, const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 955 957 { 956 958 bool freeLC = false; … … 961 963 962 964 *out << Verbose(1) << "Entering search for non convex hull. " << endl; 963 if ( mol->TesselStruct == NULL) {965 if (TesselStruct == NULL) { 964 966 *out << Verbose(1) << "Allocating Tesselation struct ..." << endl; 965 mol->TesselStruct= new Tesselation;967 TesselStruct= new Tesselation; 966 968 } else { 967 delete( mol->TesselStruct);969 delete(TesselStruct); 968 970 *out << Verbose(1) << "Re-Allocating Tesselation struct ..." << endl; 969 mol->TesselStruct = new Tesselation;971 TesselStruct = new Tesselation; 970 972 } 971 973 … … 979 981 980 982 // 1. get starting triangle 981 mol->TesselStruct->FindStartingTriangle(out, RADIUS, LCList);983 TesselStruct->FindStartingTriangle(out, RADIUS, LCList); 982 984 983 985 // 2. expand from there 984 baseline = mol->TesselStruct->LinesOnBoundary.begin();986 baseline = TesselStruct->LinesOnBoundary.begin(); 985 987 baseline++; // skip first line 986 while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {988 while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) { 987 989 if (baseline->second->triangles.size() == 1) { 988 990 // 3. find next triangle 989 TesselationFailFlag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.991 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 990 992 OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag; 991 993 if (!TesselationFailFlag) … … 994 996 // write temporary envelope 995 997 if (filename != NULL) { 996 if ((DoSingleStepOutput && (( mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration997 mol->TesselStruct->Output(out, filename, mol);998 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 999 TesselStruct->Output(out, filename, mol); 998 1000 } 999 1001 } 1000 baseline = mol->TesselStruct->LinesOnBoundary.end();1002 baseline = TesselStruct->LinesOnBoundary.end(); 1001 1003 *out << Verbose(2) << "Baseline set to end." << endl; 1002 1004 } else { … … 1006 1008 } 1007 1009 1008 if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {1009 baseline = mol->TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines1010 if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) { 1011 baseline = TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines 1010 1012 OneLoopWithoutSuccessFlag = false; 1011 1013 } … … 1013 1015 } 1014 1016 // check envelope for consistency 1015 CheckListOfBaselines(out, mol->TesselStruct);1017 CheckListOfBaselines(out, TesselStruct); 1016 1018 1017 1019 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1018 // mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList);1020 //->InsertStraddlingPoints(out, mol, LCList); 1019 1021 // mol->GoToFirst(); 1020 1022 // class TesselPoint *Runner = NULL; … … 1022 1024 // Runner = mol->GetPoint(); 1023 1025 // *out << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl; 1024 // if (! mol->TesselStruct->IsInnerPoint(out, Runner, LCList)) {1026 // if (!->IsInnerPoint(out, Runner, LCList)) { 1025 1027 // *out << Verbose(2) << Runner->Name << " is outside of envelope, adding via degenerated triangles." << endl; 1026 // mol->TesselStruct->AddBoundaryPointByDegeneratedTriangle(out, Runner, LCList);1028 // ->AddBoundaryPointByDegeneratedTriangle(out, Runner, LCList); 1027 1029 // } else { 1028 1030 // *out << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl; … … 1032 1034 1033 1035 // Purges surplus triangles. 1034 mol->TesselStruct->RemoveDegeneratedTriangles();1036 TesselStruct->RemoveDegeneratedTriangles(); 1035 1037 1036 1038 // check envelope for consistency 1037 CheckListOfBaselines(out, mol->TesselStruct);1039 CheckListOfBaselines(out, TesselStruct); 1038 1040 1039 1041 // write final envelope 1040 CalculateConcavityPerBoundaryPoint(out, mol->TesselStruct);1041 StoreTrianglesinFile(out, mol, filename, "");1042 CalculateConcavityPerBoundaryPoint(out, TesselStruct); 1043 StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, ""); 1042 1044 1043 1045 if (freeLC)
Note:
See TracChangeset
for help on using the changeset viewer.
