Changes in / [34e0592:1d9b7aa]
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r34e0592 r1d9b7aa 118 118 * \param *mol molecule structure with atom positions 119 119 */ 120 void WriteVrmlFile(ofstream *out, ofstream *vrmlfile, class Tesselation *Tess, class molecule *mol)120 void write_vrml_file(ofstream *out, ofstream *vrmlfile, class Tesselation *Tess, class molecule *mol) 121 121 { 122 122 atom *Walker = mol->start; … … 172 172 * \param *mol molecule structure with atom positions 173 173 */ 174 void WriteRaster3dFile(ofstream *out, ofstream *rasterfile, class Tesselation *Tess, class molecule *mol)174 void write_raster3d_file(ofstream *out, ofstream *rasterfile, class Tesselation *Tess, class molecule *mol) 175 175 { 176 176 atom *Walker = mol->start; … … 227 227 * \param N arbitrary number to differentiate various zones in the tecplot format 228 228 */ 229 void WriteTecplotFile(ofstream *out, ofstream *tecplot, class Tesselation *TesselStruct, class molecule *mol, int N)229 void write_tecplot_file(ofstream *out, ofstream *tecplot, class Tesselation *TesselStruct, class molecule *mol, int N) 230 230 { 231 231 if ((tecplot != NULL) && (TesselStruct != NULL)) { … … 440 440 * \return *TesselStruct is filled with convex boundary and tesselation is stored under \a *filename. 441 441 */ 442 void Find ConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename)442 void Find_convex_border(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename) 443 443 { 444 444 bool BoundaryFreeFlag = false; 445 445 Boundaries *BoundaryPoints = NULL; 446 446 447 cout << Verbose(1) << "Begin of FindConvexBorder" << endl;447 cout << Verbose(1) << "Begin of find_convex_border" << endl; 448 448 449 449 if (mol->TesselStruct != NULL) // free if allocated … … 509 509 OutputName.append(TecplotSuffix); 510 510 ofstream *tecplot = new ofstream(OutputName.c_str()); 511 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);511 write_tecplot_file(out, tecplot, mol->TesselStruct, mol, 0); 512 512 tecplot->close(); 513 513 delete(tecplot); … … 518 518 OutputName.append(Raster3DSuffix); 519 519 ofstream *rasterplot = new ofstream(OutputName.c_str()); 520 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);520 write_raster3d_file(out, rasterplot, mol->TesselStruct, mol); 521 521 rasterplot->close(); 522 522 delete(rasterplot); … … 556 556 OutputName.append(TecplotSuffix); 557 557 ofstream *tecplot = new ofstream(OutputName.c_str()); 558 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);558 write_tecplot_file(out, tecplot, mol->TesselStruct, mol, 0); 559 559 tecplot->close(); 560 560 delete(tecplot); … … 564 564 OutputName.append(Raster3DSuffix); 565 565 ofstream *rasterplot = new ofstream(OutputName.c_str()); 566 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);566 write_raster3d_file(out, rasterplot, mol->TesselStruct, mol); 567 567 rasterplot->close(); 568 568 delete(rasterplot); … … 575 575 delete[] (BoundaryPoints); 576 576 577 cout << Verbose(1) << "End of FindConvexBorder" << endl;577 cout << Verbose(1) << "End of find_convex_border" << endl; 578 578 }; 579 579 … … 732 732 OutputName.append(TecplotSuffix); 733 733 ofstream *tecplot = new ofstream(OutputName.c_str()); 734 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);734 write_tecplot_file(out, tecplot, mol->TesselStruct, mol, 0); 735 735 tecplot->close(); 736 736 delete(tecplot); … … 741 741 OutputName.append(Raster3DSuffix); 742 742 ofstream *rasterplot = new ofstream(OutputName.c_str()); 743 WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);743 write_raster3d_file(out, rasterplot, mol->TesselStruct, mol); 744 744 rasterplot->close(); 745 745 delete(rasterplot); … … 816 816 class Tesselation *TesselStruct = NULL; 817 817 LinkedCell LCList(mol, 10.); 818 Find ConvexBorder(out, mol, &LCList, NULL);818 Find_convex_border(out, mol, &LCList, NULL); 819 819 double clustervolume; 820 820 if (ClusterVolume == 0) … … 957 957 if ((*ListRunner)->TesselStruct == NULL) { 958 958 *out << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl; 959 Find NonConvexBorder((ofstream *)&cout, (*ListRunner), LCList[i], NULL, 5.);959 Find_non_convex_border((ofstream *)&cout, (*ListRunner), LCList[i], NULL, 5.); 960 960 } 961 961 i++; … … 1082 1082 * \para RADIUS radius of the virtual sphere 1083 1083 */ 1084 void Find NonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename, const double RADIUS)1084 void Find_non_convex_border(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename, const double RADIUS) 1085 1085 { 1086 1086 int N = 0; … … 1101 1101 LineMap::iterator baseline; 1102 1102 LineMap::iterator testline; 1103 *out << Verbose(0) << "Begin of Find NonConvexBorder\n";1103 *out << Verbose(0) << "Begin of Find_non_convex_border\n"; 1104 1104 bool flag = false; // marks whether we went once through all baselines without finding any without two triangles 1105 1105 bool failflag = false; … … 1110 1110 } 1111 1111 1112 mol->TesselStruct->Find StartingTriangle(out, RADIUS, LCList);1112 mol->TesselStruct->Find_starting_triangle(out, RADIUS, LCList); 1113 1113 1114 1114 baseline = mol->TesselStruct->LinesOnBoundary.begin(); … … 1119 1119 while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (flag)) { 1120 1120 if (baseline->second->triangles.size() == 1) { 1121 failflag = mol->TesselStruct->Find NextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, N, LCList); //the line is there, so there is a triangle, but only one.1121 failflag = mol->TesselStruct->Find_next_suitable_triangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, N, LCList); //the line is there, so there is a triangle, but only one. 1122 1122 flag = flag || failflag; 1123 1123 if (!failflag) 1124 cerr << "WARNING: Find NextSuitableTriangle failed." << endl;1124 cerr << "WARNING: Find_next_suitable_triangle failed." << endl; 1125 1125 // write temporary envelope 1126 1126 if ((DoSingleStepOutput && (mol->TesselStruct->TrianglesOnBoundaryCount % SingleStepWidth == 0))) { // if we have a new triangle and want to output each new triangle configuration … … 1138 1138 *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 1139 1139 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 1140 WriteTecplotFile(out, tempstream, mol->TesselStruct, mol, TriangleFilesWritten);1140 write_tecplot_file(out, tempstream, mol->TesselStruct, mol, TriangleFilesWritten); 1141 1141 tempstream->close(); 1142 1142 tempstream->flush(); … … 1152 1152 *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 1153 1153 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 1154 WriteRaster3dFile(out, tempstream, mol->TesselStruct, mol);1154 write_raster3d_file(out, tempstream, mol->TesselStruct, mol); 1155 1155 // // include the current position of the virtual sphere in the temporary raster3d file 1156 1156 // // make the circumsphere's center absolute again … … 1191 1191 } 1192 1192 1193 // Purges surplus triangles.1194 mol->TesselStruct->RemoveDegeneratedTriangles();1195 1196 1193 // write final envelope 1197 1194 if (filename != 0) { … … 1201 1198 OutputName.append(TecplotSuffix); 1202 1199 ofstream *tecplot = new ofstream(OutputName.c_str()); 1203 WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, -1);1200 write_tecplot_file(out, tecplot, mol->TesselStruct, mol, -1); 1204 1201 tecplot->close(); 1205 1202 delete(tecplot); … … 1209 1206 OutputName.append(Raster3DSuffix); 1210 1207 ofstream *raster = new ofstream(OutputName.c_str()); 1211 WriteRaster3dFile(out, raster, mol->TesselStruct, mol);1208 write_raster3d_file(out, raster, mol->TesselStruct, mol); 1212 1209 raster->close(); 1213 1210 delete(raster); … … 1260 1257 // << "for atom " << a << " (inside)." << endl; 1261 1258 1259 1262 1260 if (freeLC) 1263 1261 delete(LCList); 1264 *out << Verbose(0) << "End of Find NonConvexBorder\n";1262 *out << Verbose(0) << "End of Find_non_convex_border\n"; 1265 1263 }; 1266 1264 -
src/boundary.hpp
r34e0592 r1d9b7aa 37 37 void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity); 38 38 molecule * FillBoxWithMolecule(ofstream *out, MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandAtomDisplacement, double RandMolDisplacement, bool DoRandomRotation); 39 void Find ConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename);40 void Find NonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LC, const char *tempbasename, const double RADIUS);39 void Find_convex_border(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename); 40 void Find_non_convex_border(ofstream *out, molecule* mol, class LinkedCell *LC, const char *tempbasename, const double RADIUS); 41 41 double ConvexizeNonconvexEnvelope(ofstream *out, class Tesselation *TesselStruct, molecule *mol, char *filename); 42 void Find NextSuitablePoint(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);42 void Find_next_suitable_point(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC); 43 43 Boundaries *GetBoundaryPoints(ofstream *out, molecule *mol); 44 44 void CalculateConcavityPerBoundaryPoint(ofstream *out, class Tesselation *TesselStruct); -
src/builder.cpp
r34e0592 r1d9b7aa 584 584 LinkedCell LCList(mol, 10.); 585 585 class Tesselation *TesselStruct = NULL; 586 Find ConvexBorder((ofstream *)&cout, mol, &LCList, NULL);586 Find_convex_border((ofstream *)&cout, mol, &LCList, NULL); 587 587 double clustervolume = VolumeOfConvexEnvelope((ofstream *)&cout, TesselStruct, configuration); 588 588 cout << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl; … … 644 644 Vector x,y,z,n; // coordinates for absolute point in cell volume 645 645 double *factor; // unit factor if desired 646 double bond, min Bond;646 double bond, min_bond; 647 647 char choice; // menu choice char 648 648 bool valid; … … 683 683 first = mol->AskAtom("Enter first (fixed) atom: "); 684 684 second = mol->AskAtom("Enter second (shifting) atom: "); 685 min Bond = 0.;685 min_bond = 0.; 686 686 for (int i=NDIM;i--;) 687 min Bond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);688 min Bond = sqrt(minBond);689 cout << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << min Bond << " a.u." << endl;687 min_bond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]); 688 min_bond = sqrt(min_bond); 689 cout << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << min_bond << " a.u." << endl; 690 690 cout << Verbose(0) << "Enter new bond length [a.u.]: "; 691 691 cin >> bond; 692 692 for (int i=NDIM;i--;) { 693 second->x.x[i] -= (second->x.x[i]-first->x.x[i])/min Bond*(minBond-bond);693 second->x.x[i] -= (second->x.x[i]-first->x.x[i])/min_bond*(min_bond-bond); 694 694 } 695 695 //cout << Verbose(0) << "New coordinates of Atom " << second->nr << " are: "; … … 1325 1325 int j; 1326 1326 double volume = 0.; 1327 enum ConfigStatus config Present = absent;1327 enum ConfigStatus config_present = absent; 1328 1328 clock_t start,end; 1329 1329 int argptr; … … 1425 1425 if (output == NULL) { 1426 1426 cout << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl; 1427 config Present = absent;1427 config_present = absent; 1428 1428 } else { 1429 1429 cout << "Empty configuration file." << endl; 1430 1430 ConfigFileName = argv[1]; 1431 config Present = empty;1431 config_present = empty; 1432 1432 output.close(); 1433 1433 } … … 1440 1440 cout << "new syntax." << endl; 1441 1441 configuration.Load(ConfigFileName, periode, mol); 1442 config Present = present;1442 config_present = present; 1443 1443 break; 1444 1444 case 0: 1445 1445 cout << "old syntax." << endl; 1446 1446 configuration.LoadOld(ConfigFileName, periode, mol); 1447 config Present = present;1447 config_present = present; 1448 1448 break; 1449 1449 default: 1450 1450 cout << "Unknown syntax or empty, yet present file." << endl; 1451 config Present = empty;1451 config_present = empty; 1452 1452 } 1453 1453 } 1454 1454 } else 1455 config Present = absent;1455 config_present = absent; 1456 1456 // 4. parse again through options, now for those depending on elements db and config presence 1457 1457 argptr = 1; … … 1460 1460 if (argv[argptr][0] == '-') { 1461 1461 argptr++; 1462 if ((config Present == present) || (configPresent == empty)) {1462 if ((config_present == present) || (config_present == empty)) { 1463 1463 switch(argv[argptr-1][1]) { 1464 1464 case 'p': … … 1474 1474 else { 1475 1475 cout << Verbose(2) << "File found and parsed." << endl; 1476 config Present = present;1476 config_present = present; 1477 1477 } 1478 1478 } … … 1494 1494 if (first->type != NULL) { 1495 1495 mol->AddAtom(first); // add to molecule 1496 if ((config Present == empty) && (mol->AtomCount != 0))1497 config Present = present;1496 if ((config_present == empty) && (mol->AtomCount != 0)) 1497 config_present = present; 1498 1498 } else 1499 1499 cerr << Verbose(1) << "Could not find the specified element." << endl; … … 1505 1505 } 1506 1506 } 1507 if (config Present == present) {1507 if (config_present == present) { 1508 1508 switch(argv[argptr-1][1]) { 1509 1509 case 'M': … … 1627 1627 start = clock(); 1628 1628 LinkedCell LCList(mol, atof(argv[argptr])*2.); 1629 Find NonConvexBorder((ofstream *)&cout, mol, &LCList, argv[argptr+1], atof(argv[argptr]));1629 Find_non_convex_border((ofstream *)&cout, mol, &LCList, argv[argptr+1], atof(argv[argptr])); 1630 1630 //FindDistributionOfEllipsoids((ofstream *)&cout, &T, &LCList, N, number, filename.c_str()); 1631 1631 end = clock(); … … 1871 1871 cout << Verbose(1) << "Storing tecplot data in " << argv[argptr] << "." << endl; 1872 1872 LinkedCell LCList(mol, 10.); 1873 //Find ConvexBorder((ofstream *)&cout, mol, &LCList, argv[argptr]);1874 Find NonConvexBorder((ofstream *)&cout, mol, &LCList, argv[argptr], 10.);1873 //Find_convex_border((ofstream *)&cout, mol, &LCList, argv[argptr]); 1874 Find_non_convex_border((ofstream *)&cout, mol, &LCList, argv[argptr], 10.); 1875 1875 1876 1876 double volumedifference = ConvexizeNonconvexEnvelope((ofstream *)&cout, mol->TesselStruct, mol, argv[argptr]); -
src/config.hpp
r34e0592 r1d9b7aa 18 18 #include "molecules.hpp" 19 19 #include "periodentafel.hpp" 20 21 class ConfigFileBuffer {22 public:23 char **buffer;24 int *LineMapping;25 int CurrentLine;26 int NoLines;27 28 ConfigFileBuffer();29 ConfigFileBuffer(char *filename);30 ~ConfigFileBuffer();31 32 void InitMapping();33 void MapIonTypesInBuffer(int NoAtoms);34 };35 20 36 21 /** The config file. -
src/molecules.hpp
r34e0592 r1d9b7aa 303 303 }; 304 304 305 class ConfigFileBuffer { 306 public: 307 char **buffer; 308 int *LineMapping; 309 int CurrentLine; 310 int NoLines; 311 312 ConfigFileBuffer(); 313 ConfigFileBuffer(char *filename); 314 ~ConfigFileBuffer(); 315 316 void InitMapping(); 317 void MapIonTypesInBuffer(int NoAtoms); 318 }; 319 305 320 306 321 #endif /*MOLECULES_HPP_*/ -
src/tesselation.cpp
r34e0592 r1d9b7aa 219 219 return true; 220 220 } 221 double angle = GetAngle(helper[0], helper[1], BaseLineNormal);221 double angle = getAngle(helper[0], helper[1], BaseLineNormal); 222 222 if ((angle - M_PI) > -MYEPSILON) { 223 223 *out << Verbose(2) << "ACCEPT: Angle is greater than pi: convex." << endl; … … 1402 1402 1403 1403 1404 /** Finds the starting triangle for FindNonConvexBorder().1405 * Looks at the outermost point per axis, then Find SecondPointForTesselation()1406 * for the second and Find NextSuitablePointViaAngleOfSphere() for the third1404 /** Finds the starting triangle for find_non_convex_border(). 1405 * Looks at the outermost point per axis, then Find_second_point_for_Tesselation() 1406 * for the second and Find_next_suitable_point_via_Angle_of_Sphere() for the third 1407 1407 * point are called. 1408 1408 * \param *out output stream for debugging … … 1410 1410 * \param *LC LinkedCell structure with neighbouring TesselPoint's 1411 1411 */ 1412 void Tesselation::Find StartingTriangle(ofstream *out, const double RADIUS, LinkedCell *LC)1413 { 1414 cout << Verbose(1) << "Begin of Find StartingTriangle\n";1412 void Tesselation::Find_starting_triangle(ofstream *out, const double RADIUS, LinkedCell *LC) 1413 { 1414 cout << Verbose(1) << "Begin of Find_starting_triangle\n"; 1415 1415 int i = 0; 1416 1416 LinkedNodes *List = NULL; … … 1418 1418 TesselPoint* SecondPoint = NULL; 1419 1419 TesselPoint* MaxPoint[NDIM]; 1420 double max Coordinate[NDIM];1420 double max_coordinate[NDIM]; 1421 1421 Vector Oben; 1422 1422 Vector helper; … … 1428 1428 for (i = 0; i < 3; i++) { 1429 1429 MaxPoint[i] = NULL; 1430 max Coordinate[i] = -1;1430 max_coordinate[i] = -1; 1431 1431 } 1432 1432 … … 1440 1440 if (List != NULL) { 1441 1441 for (LinkedNodes::iterator Runner = List->begin();Runner != List->end();Runner++) { 1442 if ((*Runner)->node->x[i] > max Coordinate[i]) {1442 if ((*Runner)->node->x[i] > max_coordinate[i]) { 1443 1443 cout << Verbose(2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl; 1444 max Coordinate[i] = (*Runner)->node->x[i];1444 max_coordinate[i] = (*Runner)->node->x[i]; 1445 1445 MaxPoint[i] = (*Runner); 1446 1446 } … … 1458 1458 1459 1459 BTS = NULL; 1460 CandidateList *Opt Candidates = new CandidateList();1460 CandidateList *Opt_Candidates = new CandidateList(); 1461 1461 for (int k=0;k<NDIM;k++) { 1462 1462 Oben.x[k] = 1.; … … 1465 1465 1466 1466 double ShortestAngle; 1467 TesselPoint* Opt Candidate = NULL;1467 TesselPoint* Opt_Candidate = NULL; 1468 1468 ShortestAngle = 999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant. 1469 1469 1470 Find SecondPointForTesselation(FirstPoint, NULL, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...1471 SecondPoint = Opt Candidate;1470 Find_second_point_for_Tesselation(FirstPoint, NULL, Oben, Opt_Candidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1471 SecondPoint = Opt_Candidate; 1472 1472 if (SecondPoint == NULL) // have we found a second point? 1473 1473 continue; … … 1500 1500 1501 1501 //cout << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n"; 1502 Find ThirdPointForTesselation(1503 Oben, SearchDirection, helper, BLS[0], NULL, *&Opt Candidates, &ShortestAngle, RADIUS, LC1502 Find_third_point_for_Tesselation( 1503 Oben, SearchDirection, helper, BLS[0], NULL, *&Opt_Candidates, &ShortestAngle, RADIUS, LC 1504 1504 ); 1505 1505 cout << Verbose(1) << "List of third Points is "; 1506 for (CandidateList::iterator it = Opt Candidates->begin(); it != OptCandidates->end(); ++it) {1506 for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) { 1507 1507 cout << " " << *(*it)->point; 1508 1508 } 1509 1509 cout << endl; 1510 1510 1511 for (CandidateList::iterator it = Opt Candidates->begin(); it != OptCandidates->end(); ++it) {1511 for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) { 1512 1512 // add third triangle point 1513 1513 AddTesselationPoint((*it)->point, 2); … … 1526 1526 1527 1527 // if we do not reach the end with the next step of iteration, we need to setup a new first line 1528 if (it != Opt Candidates->end()--) {1528 if (it != Opt_Candidates->end()--) { 1529 1529 FirstPoint = (*it)->BaseLine->endpoints[0]->node; 1530 1530 SecondPoint = (*it)->point; … … 1541 1541 // remove all candidates from the list and then the list itself 1542 1542 class CandidateForTesselation *remover = NULL; 1543 for (CandidateList::iterator it = Opt Candidates->begin(); it != OptCandidates->end(); ++it) {1543 for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) { 1544 1544 remover = *it; 1545 1545 delete(remover); 1546 1546 } 1547 Opt Candidates->clear();1547 Opt_Candidates->clear(); 1548 1548 } 1549 1549 } … … 1551 1551 // remove all candidates from the list and then the list itself 1552 1552 class CandidateForTesselation *remover = NULL; 1553 for (CandidateList::iterator it = Opt Candidates->begin(); it != OptCandidates->end(); ++it) {1553 for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) { 1554 1554 remover = *it; 1555 1555 delete(remover); 1556 1556 } 1557 delete(Opt Candidates);1558 cout << Verbose(1) << "End of Find StartingTriangle\n";1557 delete(Opt_Candidates); 1558 cout << Verbose(1) << "End of Find_starting_triangle\n"; 1559 1559 }; 1560 1560 … … 1568 1568 * @param *LC LinkedCell structure with neighbouring points 1569 1569 */ 1570 bool Tesselation::Find NextSuitableTriangle(ofstream *out, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, LinkedCell *LC)1571 { 1572 cout << Verbose(0) << "Begin of Find NextSuitableTriangle\n";1570 bool Tesselation::Find_next_suitable_triangle(ofstream *out, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, LinkedCell *LC) 1571 { 1572 cout << Verbose(0) << "Begin of Find_next_suitable_triangle\n"; 1573 1573 bool result = true; 1574 CandidateList *Opt Candidates = new CandidateList();1574 CandidateList *Opt_Candidates = new CandidateList(); 1575 1575 1576 1576 Vector CircleCenter; … … 1629 1629 1630 1630 // add third point 1631 Find ThirdPointForTesselation(1632 T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, Opt Candidates,1631 Find_third_point_for_Tesselation( 1632 T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, Opt_Candidates, 1633 1633 &ShortestAngle, RADIUS, LC 1634 1634 ); … … 1638 1638 } 1639 1639 1640 if (Opt Candidates->begin() == OptCandidates->end()) {1640 if (Opt_Candidates->begin() == Opt_Candidates->end()) { 1641 1641 cerr << "WARNING: Could not find a suitable candidate." << endl; 1642 1642 return false; 1643 1643 } 1644 1644 cout << Verbose(1) << "Third Points are "; 1645 for (CandidateList::iterator it = Opt Candidates->begin(); it != OptCandidates->end(); ++it) {1645 for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) { 1646 1646 cout << " " << *(*it)->point; 1647 1647 } … … 1649 1649 1650 1650 BoundaryLineSet *BaseRay = &Line; 1651 for (CandidateList::iterator it = Opt Candidates->begin(); it != OptCandidates->end(); ++it) {1651 for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) { 1652 1652 cout << Verbose(1) << " Third point candidate is " << *(*it)->point 1653 1653 << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; … … 1668 1668 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1669 1669 1670 if (CheckLineCriteria ForDegeneratedTriangle(TPS)) {1670 if (CheckLineCriteriaforDegeneratedTriangle(TPS)) { 1671 1671 AddTesselationLine(TPS[0], TPS[1], 0); 1672 1672 AddTesselationLine(TPS[0], TPS[2], 1); … … 1697 1697 // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 1698 1698 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1699 if (CheckLineCriteria ForDegeneratedTriangle(TPS)) {1699 if (CheckLineCriteriaforDegeneratedTriangle(TPS)) { 1700 1700 AddTesselationLine(TPS[0], TPS[1], 0); 1701 1701 AddTesselationLine(TPS[0], TPS[2], 1); … … 1735 1735 // remove all candidates from the list and then the list itself 1736 1736 class CandidateForTesselation *remover = NULL; 1737 for (CandidateList::iterator it = Opt Candidates->begin(); it != OptCandidates->end(); ++it) {1737 for (CandidateList::iterator it = Opt_Candidates->begin(); it != Opt_Candidates->end(); ++it) { 1738 1738 remover = *it; 1739 1739 delete(remover); 1740 1740 } 1741 delete(Opt Candidates);1742 cout << Verbose(0) << "End of Find NextSuitableTriangle\n";1741 delete(Opt_Candidates); 1742 cout << Verbose(0) << "End of Find_next_suitable_triangle\n"; 1743 1743 return result; 1744 1744 }; … … 2047 2047 * \param *Candidate pointer to candidate node on return 2048 2048 * \param Oben vector indicating the outside 2049 * \param Opt Candidate reference to recommended candidate on return2049 * \param Opt_Candidate reference to recommended candidate on return 2050 2050 * \param Storage[3] array storing angles and other candidate information 2051 2051 * \param RADIUS radius of virtual sphere 2052 2052 * \param *LC LinkedCell structure with neighbouring points 2053 2053 */ 2054 void Tesselation::Find SecondPointForTesselation(TesselPoint* a, TesselPoint* Candidate, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, LinkedCell *LC)2055 { 2056 cout << Verbose(2) << "Begin of Find SecondPointForTesselation" << endl;2054 void Tesselation::Find_second_point_for_Tesselation(TesselPoint* a, TesselPoint* Candidate, Vector Oben, TesselPoint*& Opt_Candidate, double Storage[3], double RADIUS, LinkedCell *LC) 2055 { 2056 cout << Verbose(2) << "Begin of Find_second_point_for_Tesselation" << endl; 2057 2057 Vector AngleCheck; 2058 2058 double norm = -1., angle; … … 2092 2092 if (a != Candidate) { 2093 2093 // Calculate center of the circle with radius RADIUS through points a and Candidate 2094 Vector OrthogonalizedOben, a Candidate, Center;2094 Vector OrthogonalizedOben, a_Candidate, Center; 2095 2095 double distance, scaleFactor; 2096 2096 2097 2097 OrthogonalizedOben.CopyVector(&Oben); 2098 a Candidate.CopyVector(a->node);2099 a Candidate.SubtractVector(Candidate->node);2100 OrthogonalizedOben.ProjectOntoPlane(&a Candidate);2098 a_Candidate.CopyVector(a->node); 2099 a_Candidate.SubtractVector(Candidate->node); 2100 OrthogonalizedOben.ProjectOntoPlane(&a_Candidate); 2101 2101 OrthogonalizedOben.Normalize(); 2102 distance = 0.5 * a Candidate.Norm();2102 distance = 0.5 * a_Candidate.Norm(); 2103 2103 scaleFactor = sqrt(((RADIUS * RADIUS) - (distance * distance))); 2104 2104 OrthogonalizedOben.Scale(scaleFactor); … … 2111 2111 AngleCheck.CopyVector(&Center); 2112 2112 AngleCheck.SubtractVector(a->node); 2113 norm = a Candidate.Norm();2113 norm = a_Candidate.Norm(); 2114 2114 // second point shall have smallest angle with respect to Oben vector 2115 2115 if (norm < RADIUS*2.) { … … 2118 2118 //cout << Verbose(3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 2119 2119 cout << Verbose(3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n"; 2120 Opt Candidate = Candidate;2120 Opt_Candidate = Candidate; 2121 2121 Storage[0] = angle; 2122 2122 //cout << Verbose(3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]); 2123 2123 } else { 2124 //cout << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *Opt Candidate << endl;2124 //cout << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *Opt_Candidate << endl; 2125 2125 } 2126 2126 } else { … … 2135 2135 } 2136 2136 } 2137 cout << Verbose(2) << "End of Find SecondPointForTesselation" << endl;2137 cout << Verbose(2) << "End of Find_second_point_for_Tesselation" << endl; 2138 2138 }; 2139 2139 … … 2161 2161 * holds. Then, the normalized projection onto the SearchDirection is either +1 or -1 and thus states whether 2162 2162 * the angle is uniquely in either (0,M_PI] or [M_PI, 2.*M_PI). 2163 * @param NormalVector normal direction of the base triangle (here the unit axis vector, \sa Find StartingTriangle())2163 * @param NormalVector normal direction of the base triangle (here the unit axis vector, \sa Find_starting_triangle()) 2164 2164 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine 2165 2165 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle … … 2167 2167 * @param ThirdNode third point to avoid in search 2168 2168 * @param candidates list of equally good candidates to return 2169 * @param ShortestAngle the current path length on this circle band for the current Opt Candidate2169 * @param ShortestAngle the current path length on this circle band for the current Opt_Candidate 2170 2170 * @param RADIUS radius of sphere 2171 2171 * @param *LC LinkedCell structure with neighbouring points 2172 2172 */ 2173 void Tesselation::Find ThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, LinkedCell *LC)2173 void Tesselation::Find_third_point_for_Tesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, LinkedCell *LC) 2174 2174 { 2175 2175 Vector CircleCenter; // center of the circle, i.e. of the band of sphere's centers … … 2188 2188 CandidateForTesselation *optCandidate = NULL; 2189 2189 2190 cout << Verbose(1) << "Begin of Find ThirdPointForTesselation" << endl;2190 cout << Verbose(1) << "Begin of Find_third_point_for_Tesselation" << endl; 2191 2191 2192 2192 //cout << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; … … 2345 2345 if (candidates->size() > 1) { 2346 2346 candidates->unique(); 2347 candidates->sort( SortCandidates);2348 } 2349 2350 cout << Verbose(1) << "End of Find ThirdPointForTesselation" << endl;2347 candidates->sort(sortCandidates); 2348 } 2349 2350 cout << Verbose(1) << "End of Find_third_point_for_Tesselation" << endl; 2351 2351 }; 2352 2352 … … 2397 2397 } 2398 2398 2399 trianglePoints[0] = FindClosestPoint(x, SecondPoint, LC);2399 trianglePoints[0] = findClosestPoint(x, SecondPoint, LC); 2400 2400 2401 2401 // check whether closest point is "too close" :), then it's inside … … 2408 2408 return NULL; 2409 2409 } 2410 list<TesselPoint*> *connectedPoints = GetCircleOfConnectedPoints(out, trianglePoints[0]);2411 list<TesselPoint*> *connectedClosestPoints = GetNeighboursOnCircleOfConnectedPoints(out, connectedPoints, trianglePoints[0], x);2410 list<TesselPoint*> *connectedPoints = getCircleOfConnectedPoints(out, trianglePoints[0]); 2411 list<TesselPoint*> *connectedClosestPoints = getNeighboursonCircleofConnectedPoints(out, connectedPoints, trianglePoints[0], x); 2412 2412 delete(connectedPoints); 2413 2413 trianglePoints[1] = connectedClosestPoints->front(); … … 2497 2497 * @return list of the all points linked to the provided one 2498 2498 */ 2499 list<TesselPoint*> * Tesselation:: GetCircleOfConnectedPoints(ofstream *out, TesselPoint* Point)2499 list<TesselPoint*> * Tesselation::getCircleOfConnectedPoints(ofstream *out, TesselPoint* Point) 2500 2500 { 2501 2501 list<TesselPoint*> *connectedPoints = new list<TesselPoint*>; … … 2558 2558 * @return list of the two points linked to the provided one and closest to the point to be checked, 2559 2559 */ 2560 list<TesselPoint*> * Tesselation:: GetNeighboursOnCircleOfConnectedPoints(ofstream *out, list<TesselPoint*> *connectedPoints, TesselPoint* Point, Vector* Reference)2560 list<TesselPoint*> * Tesselation::getNeighboursonCircleofConnectedPoints(ofstream *out, list<TesselPoint*> *connectedPoints, TesselPoint* Point, Vector* Reference) 2561 2561 { 2562 2562 map<double, TesselPoint*> anglesOfPoints; … … 2597 2597 helper.SubtractVector(Point->node); 2598 2598 helper.ProjectOntoPlane(&PlaneNormal); 2599 double angle = GetAngle(helper, AngleZero, OrthogonalVector);2599 double angle = getAngle(helper, AngleZero, OrthogonalVector); 2600 2600 *out << Verbose(2) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl; 2601 2601 anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner))); … … 2644 2644 return 0.; 2645 2645 } 2646 list<TesselPoint*> *CircleofPoints = GetCircleOfConnectedPoints(out, point->node);2646 list<TesselPoint*> *CircleofPoints = getCircleOfConnectedPoints(out, point->node); 2647 2647 2648 2648 // remove all triangles … … 2716 2716 * \return true - there is such a line (i.e. creation of degenerated triangle is valid), false - no such line (don't create) 2717 2717 */ 2718 bool CheckLineCriteria ForDegeneratedTriangle(class BoundaryPointSet *nodes[3])2718 bool CheckLineCriteriaforDegeneratedTriangle(class BoundaryPointSet *nodes[3]) 2719 2719 { 2720 2720 bool result = false; … … 2750 2750 /** Sort function for the candidate list. 2751 2751 */ 2752 bool SortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2)2752 bool sortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2) 2753 2753 { 2754 2754 Vector BaseLineVector, OrthogonalVector, helper; … … 2800 2800 * @return point which is second closest to the provided one 2801 2801 */ 2802 TesselPoint* FindSecondClosestPoint(const Vector* Point, LinkedCell* LC)2802 TesselPoint* findSecondClosestPoint(const Vector* Point, LinkedCell* LC) 2803 2803 { 2804 2804 LinkedNodes *List = NULL; … … 2846 2846 }; 2847 2847 2848 2849 2848 2850 /** 2849 2851 * Finds the point which is closest to the provided one. … … 2855 2857 * @return point which is closest to the provided one, NULL if none found 2856 2858 */ 2857 TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, LinkedCell* LC)2859 TesselPoint* findClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, LinkedCell* LC) 2858 2860 { 2859 2861 LinkedNodes *List = NULL; … … 2902 2904 return closestPoint; 2903 2905 }; 2906 2904 2907 2905 2908 /** … … 2968 2971 } 2969 2972 2970 /**2971 * Finds all degenerated triangles within the tesselation structure.2972 *2973 * @return map of keys of degenerated triangle pairs, each triangle occurs twice2974 * in the list, once as key and once as value2975 */2976 map<int, int> Tesselation::FindAllDegeneratedTriangles()2977 {2978 map<int, int> DegeneratedTriangles;2979 2980 // sanity check2981 if (LinesOnBoundary.empty()) {2982 cout << Verbose(1) << "Warning: FindAllDegeneratedTriangles() was called without any tesselation structure.";2983 return DegeneratedTriangles;2984 }2985 2986 LineMap::iterator LineRunner1, LineRunner2;2987 2988 for (LineRunner1 = LinesOnBoundary.begin(); LineRunner1 != LinesOnBoundary.end(); ++LineRunner1) {2989 for (LineRunner2 = LinesOnBoundary.begin(); LineRunner2 != LinesOnBoundary.end(); ++LineRunner2) {2990 if ((LineRunner1->second != LineRunner2->second)2991 && (LineRunner1->second->endpoints[0] == LineRunner2->second->endpoints[0])2992 && (LineRunner1->second->endpoints[1] == LineRunner2->second->endpoints[1])2993 ) {2994 TriangleMap::iterator TriangleRunner1 = LineRunner1->second->triangles.begin(),2995 TriangleRunner2 = LineRunner2->second->triangles.begin();2996 2997 for (; TriangleRunner1 != LineRunner1->second->triangles.end(); ++TriangleRunner1) {2998 for (; TriangleRunner2 != LineRunner2->second->triangles.end(); ++TriangleRunner2) {2999 if ((TriangleRunner1->second != TriangleRunner2->second)3000 && (TriangleRunner1->second->endpoints[0] == TriangleRunner2->second->endpoints[0])3001 && (TriangleRunner1->second->endpoints[1] == TriangleRunner2->second->endpoints[1])3002 && (TriangleRunner1->second->endpoints[2] == TriangleRunner2->second->endpoints[2])3003 ) {3004 DegeneratedTriangles[TriangleRunner1->second->Nr] = TriangleRunner2->second->Nr;3005 DegeneratedTriangles[TriangleRunner2->second->Nr] = TriangleRunner1->second->Nr;3006 }3007 }3008 }3009 }3010 }3011 }3012 3013 cout << Verbose(1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles.size() << " triangles." << endl;3014 map<int,int>::iterator it;3015 for (it = DegeneratedTriangles.begin(); it != DegeneratedTriangles.end(); it++)3016 cout << Verbose(2) << (*it).first << " => " << (*it).second << endl;3017 3018 return DegeneratedTriangles;3019 }3020 3021 /**3022 * Purges degenerated triangles from the tesselation structure if they are not3023 * necessary to keep a single point within the structure.3024 */3025 void Tesselation::RemoveDegeneratedTriangles()3026 {3027 map<int, int> DegeneratedTriangles = FindAllDegeneratedTriangles();3028 3029 for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles.begin();3030 TriangleKeyRunner != DegeneratedTriangles.end(); ++TriangleKeyRunner3031 ) {3032 BoundaryTriangleSet *triangle = TrianglesOnBoundary.find(TriangleKeyRunner->first)->second,3033 *partnerTriangle = TrianglesOnBoundary.find(TriangleKeyRunner->second)->second;3034 3035 bool trianglesShareLine = false;3036 for (int i = 0; i < 3; ++i)3037 for (int j = 0; j < 3; ++j)3038 trianglesShareLine = trianglesShareLine || triangle->lines[i] == partnerTriangle->lines[j];3039 3040 if (trianglesShareLine3041 && (triangle->endpoints[1]->LinesCount > 2)3042 && (triangle->endpoints[2]->LinesCount > 2)3043 && (triangle->endpoints[0]->LinesCount > 2)3044 ) {3045 cout << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;3046 RemoveTesselationTriangle(triangle);3047 cout << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;3048 RemoveTesselationTriangle(partnerTriangle);3049 DegeneratedTriangles.erase(DegeneratedTriangles.find(partnerTriangle->Nr));3050 } else {3051 cout << Verbose(1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle3052 << " and its partner " << *partnerTriangle << " because it is essential for at"3053 << " least one of the endpoints to be kept in the tesselation structure." << endl;3054 }3055 }3056 }3057 3058 2973 /** Gets the angle between a point and a reference relative to the provided center. 3059 2974 * We have two shanks point and reference between which the angle is calculated … … 3065 2980 * @return angle between point and reference 3066 2981 */ 3067 double GetAngle(const Vector &point, const Vector &reference, const Vector OrthogonalVector)2982 double getAngle(const Vector &point, const Vector &reference, const Vector OrthogonalVector) 3068 2983 { 3069 2984 if (reference.IsZero()) -
src/tesselation.hpp
r34e0592 r1d9b7aa 20 20 #include <map> 21 21 #include <list> 22 #include <set>23 22 24 23 … … 204 203 205 204 // concave envelope 206 void Find StartingTriangle(ofstream *out, const double RADIUS, class LinkedCell *LC);207 void Find SecondPointForTesselation(class TesselPoint* a, class TesselPoint* Candidate, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, class LinkedCell *LC);208 void Find ThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, class LinkedCell *LC);209 bool Find NextSuitableTriangle(ofstream *out, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, LinkedCell *LC);205 void Find_starting_triangle(ofstream *out, const double RADIUS, class LinkedCell *LC); 206 void Find_second_point_for_Tesselation(class TesselPoint* a, class TesselPoint* Candidate, Vector Oben, class TesselPoint*& Opt_Candidate, double Storage[3], double RADIUS, class LinkedCell *LC); 207 void Find_third_point_for_Tesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, class LinkedCell *LC); 208 bool Find_next_suitable_triangle(ofstream *out, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N, LinkedCell *LC); 210 209 int CheckPresenceOfTriangle(ofstream *out, class TesselPoint *Candidates[3]); 211 210 … … 218 217 bool PickFarthestofTwoBaselines(ofstream *out, class BoundaryLineSet *Base); 219 218 class BoundaryPointSet *IsConvexRectangle(ofstream *out, class BoundaryLineSet *Base); 220 map<int, int> FindAllDegeneratedTriangles(); 221 void RemoveDegeneratedTriangles(); 222 223 list<TesselPoint*> * GetCircleOfConnectedPoints(ofstream *out, TesselPoint* Point); 224 list<TesselPoint*> * GetNeighboursOnCircleOfConnectedPoints(ofstream *out, list<TesselPoint*> *connectedPoints, TesselPoint* Point, Vector* Reference); 219 220 221 list<TesselPoint*> * getCircleOfConnectedPoints(ofstream *out, TesselPoint* Point); 222 list<TesselPoint*> * getNeighboursonCircleofConnectedPoints(ofstream *out, list<TesselPoint*> *connectedPoints, TesselPoint* Point, Vector* Reference); 225 223 list<BoundaryTriangleSet*> *FindTriangles(TesselPoint* Points[3]); 226 224 list<BoundaryTriangleSet*> * FindClosestTrianglesToPoint(ofstream *out, Vector *x, LinkedCell* LC); … … 264 262 }; 265 263 266 bool CheckLineCriteria ForDegeneratedTriangle(class BoundaryPointSet *nodes[3]);267 bool SortCandidates(class CandidateForTesselation* candidate1, class CandidateForTesselation* candidate2);268 TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, LinkedCell* LC);269 TesselPoint* FindSecondClosestPoint(const Vector*, LinkedCell*);270 double GetAngle(const Vector &point, const Vector &reference, const Vector OrthogonalVector);264 bool CheckLineCriteriaforDegeneratedTriangle(class BoundaryPointSet *nodes[3]); 265 bool sortCandidates(class CandidateForTesselation* candidate1, class CandidateForTesselation* candidate2); 266 TesselPoint* findClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, LinkedCell* LC); 267 TesselPoint* findSecondClosestPoint(const Vector*, LinkedCell*); 268 double getAngle(const Vector &point, const Vector &reference, const Vector OrthogonalVector); 271 269 Vector * GetClosestPointBetweenLine(ofstream *out, class BoundaryLineSet *Base, class BoundaryLineSet *OtherBase); 272 270 -
src/tesselationhelpers.cpp
r34e0592 r1d9b7aa 8 8 #include "tesselationhelpers.hpp" 9 9 10 double DetGet(gsl_matrix *A, int inPlace) {10 double det_get(gsl_matrix *A, int inPlace) { 11 11 /* 12 12 inPlace = 1 => A is replaced with the LU decomposed copy. … … 36 36 }; 37 37 38 void GetSphere(Vector *center, Vector &a, Vector &b, Vector &c, double RADIUS)38 void get_sphere(Vector *center, Vector &a, Vector &b, Vector &c, double RADIUS) 39 39 { 40 40 gsl_matrix *A = gsl_matrix_calloc(3,3); … … 46 46 gsl_matrix_set(A, i, 2, c.x[i]); 47 47 } 48 m11 = DetGet(A, 1);48 m11 = det_get(A, 1); 49 49 50 50 for(int i=0;i<3;i++) { … … 53 53 gsl_matrix_set(A, i, 2, c.x[i]); 54 54 } 55 m12 = DetGet(A, 1);55 m12 = det_get(A, 1); 56 56 57 57 for(int i=0;i<3;i++) { … … 60 60 gsl_matrix_set(A, i, 2, c.x[i]); 61 61 } 62 m13 = DetGet(A, 1);62 m13 = det_get(A, 1); 63 63 64 64 for(int i=0;i<3;i++) { … … 67 67 gsl_matrix_set(A, i, 2, b.x[i]); 68 68 } 69 m14 = DetGet(A, 1);69 m14 = det_get(A, 1); 70 70 71 71 if (fabs(m11) < MYEPSILON) … … 101 101 * @param Umkreisradius double radius of circumscribing circle 102 102 */ 103 void Get CenterOfSphere(Vector* Center, Vector a, Vector b, Vector c, Vector *NewUmkreismittelpunkt, Vector* Direction, Vector* AlternativeDirection,103 void Get_center_of_sphere(Vector* Center, Vector a, Vector b, Vector c, Vector *NewUmkreismittelpunkt, Vector* Direction, Vector* AlternativeDirection, 104 104 double HalfplaneIndicator, double AlternativeIndicator, double alpha, double beta, double gamma, double RADIUS, double Umkreisradius) 105 105 { … … 107 107 double Restradius; 108 108 Vector OtherCenter; 109 cout << Verbose(3) << "Begin of Get CenterOfSphere.\n";109 cout << Verbose(3) << "Begin of Get_center_of_sphere.\n"; 110 110 Center->Zero(); 111 111 helper.CopyVector(&a); … … 153 153 Center->AddVector(&TempNormal); 154 154 cout << Verbose(0) << "Center of sphere of circumference is " << *Center << ".\n"; 155 GetSphere(&OtherCenter, a, b, c, RADIUS);155 get_sphere(&OtherCenter, a, b, c, RADIUS); 156 156 cout << Verbose(0) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n"; 157 cout << Verbose(3) << "End of Get CenterOfSphere.\n";157 cout << Verbose(3) << "End of Get_center_of_sphere.\n"; 158 158 }; 159 159 … … 307 307 gsl_multimin_fminimizer *s = NULL; 308 308 gsl_vector *ss, *x; 309 gsl_multimin_function minex Function;309 gsl_multimin_function minex_func; 310 310 311 311 size_t iter = 0; … … 324 324 325 325 /* Initialize method and iterate */ 326 minex Function.n = NDIM;327 minex Function.f = &MinIntersectDistance;328 minex Function.params = (void *)∥326 minex_func.n = NDIM; 327 minex_func.f = &MinIntersectDistance; 328 minex_func.params = (void *)∥ 329 329 330 330 s = gsl_multimin_fminimizer_alloc(T, NDIM); 331 gsl_multimin_fminimizer_set(s, &minex Function, x, ss);331 gsl_multimin_fminimizer_set(s, &minex_func, x, ss); 332 332 333 333 do { -
src/tesselationhelpers.hpp
r34e0592 r1d9b7aa 28 28 #include "vector.hpp" 29 29 30 double DetGet(gsl_matrix *A, int inPlace);31 void GetSphere(Vector *center, Vector &a, Vector &b, Vector &c, double RADIUS);32 void Get CenterOfSphere(Vector* Center, Vector a, Vector b, Vector c, Vector *NewUmkreismittelpunkt, Vector* Direction, Vector* AlternativeDirection, double HalfplaneIndicator, double AlternativeIndicator, double alpha, double beta, double gamma, double RADIUS, double Umkreisradius);30 double det_get(gsl_matrix *A, int inPlace); 31 void get_sphere(Vector *center, Vector &a, Vector &b, Vector &c, double RADIUS); 32 void Get_center_of_sphere(Vector* Center, Vector a, Vector b, Vector c, Vector *NewUmkreismittelpunkt, Vector* Direction, Vector* AlternativeDirection, double HalfplaneIndicator, double AlternativeIndicator, double alpha, double beta, double gamma, double RADIUS, double Umkreisradius); 33 33 void GetCenterofCircumcircle(Vector *Center, Vector *a, Vector *b, Vector *c); 34 34 double GetPathLengthonCircumCircle(Vector &CircleCenter, Vector &CirclePlaneNormal, double CircleRadius, Vector &NewSphereCenter, Vector &OldSphereCenter, Vector &NormalVector, Vector &SearchDirection); … … 36 36 bool existsIntersection(Vector point1, Vector point2, Vector point3, Vector point4); 37 37 38 //bool Choose_preferable_third_point(atom *Candidate, atom *OptCandidate, class BoundaryLineSet *BaseLine, atom *ThirdNode, Tesselation *Tess); 39 40 38 41 #endif /* TESSELATIONHELPERS_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.