source: src/Tesselation/tesselation.hpp@ bdf6c8

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since bdf6c8 was bdf6c8, checked in by Frederik Heber <heber@…>, 13 years ago

Added getter for surface area to class Tesselation.

  • Property mode set to 100644
File size: 8.2 KB
Line 
1/*
2 * tesselation.hpp
3 *
4 * The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors.
5 * As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
6 *
7 * Created on: Aug 3, 2009
8 * Author: heber
9 */
10
11#ifndef TESSELATION_HPP_
12#define TESSELATION_HPP_
13
14using namespace std;
15
16/*********************************************** includes ***********************************/
17
18// include config.h
19#ifdef HAVE_CONFIG_H
20#include <config.h>
21#endif
22
23#include <map>
24#include <list>
25#include <set>
26#include <stack>
27
28#include "Atom/atom_particleinfo.hpp"
29#include "BoundaryMaps.hpp"
30#include "BoundaryPointSet.hpp"
31#include "LinearAlgebra/Vector.hpp"
32#include "Atom/TesselPoint.hpp"
33
34
35/****************************************** forward declarations *****************************/
36
37class BoundaryPointSet;
38class BoundaryLineSet;
39class BoundaryTriangleSet;
40class CandidateForTesselation;
41class IPointCloud;
42class LinkedCell_deprecated;
43class Plane;
44class Tesselation;
45
46/********************************************** definitions *********************************/
47
48enum { DoTecplotOutput=1 };
49enum { DoRaster3DOutput=1 };
50enum { DoVRMLOutput=0 };
51
52extern "C" const char *TecplotSuffix;
53extern "C" const char *Raster3DSuffix;
54extern "C" const char *VRMLSUffix;
55
56extern "C" const double ParallelEpsilon;
57
58// ======================================================= some template functions =========================================
59
60/********************************************** declarations *******************************/
61
62// =========================================================== class TESSELATION ===========================================
63
64/** Is iterable container of TesselPoints.
65 */
66class Tesselation {
67 public:
68
69 Tesselation();
70 virtual ~Tesselation();
71
72 double getVolumeOfConvexEnvelope(const bool IsAngstroem) const;
73 double getAreaOfEnvelope(const bool IsAngstroem) const;
74
75 void AddTesselationPoint(TesselPoint* Candidate, const int n);
76 void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
77 void AddTesselationLine(const Vector * OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
78 void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
79 void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
80 void AddTesselationTriangle();
81 void AddTesselationTriangle(const int nr);
82 void AddCandidateTriangle(CandidateForTesselation &CandidateLine, enum centers type);
83 void AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell_deprecated *LC);
84 void AddCandidatePolygon(CandidateForTesselation CandidateLine, const double RADIUS, const LinkedCell_deprecated *LC);
85 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
86 void RemoveTesselationLine(class BoundaryLineSet *line);
87 void RemoveTesselationPoint(class BoundaryPointSet *point);
88 bool CheckDegeneracy(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell_deprecated *LC) const;
89
90
91 // concave envelope
92 bool FindStartingTriangle(const double RADIUS, const LinkedCell_deprecated *LC);
93 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell_deprecated *LC);
94 void FindThirdPointForTesselation(const Vector &NormalVector, const Vector &SearchDirection, const Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class BoundaryPointSet * const ThirdNode, const double RADIUS, const LinkedCell_deprecated *LC) const;
95 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, const BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell_deprecated *LC);
96 bool FindCandidatesforOpenLines(const double RADIUS, const LinkedCell_deprecated *&LCList);
97 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
98 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
99
100 // convex envelope
101 void TesselateOnBoundary(IPointCloud & cloud);
102 void GuessStartingTriangle();
103 bool InsertStraddlingPoints(IPointCloud & cloud, const LinkedCell_deprecated *LC);
104 double RemovePointFromTesselatedSurface(class BoundaryPointSet *point);
105 class BoundaryLineSet * FlipBaseline(class BoundaryLineSet *Base);
106 double PickFarthestofTwoBaselines(class BoundaryLineSet *Base);
107 class BoundaryPointSet *IsConvexRectangle(class BoundaryLineSet *Base);
108 IndexToIndex * FindAllDegeneratedTriangles();
109 IndexToIndex * FindAllDegeneratedLines();
110 void RemoveDegeneratedTriangles();
111 void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell_deprecated *LC);
112 int CorrectAllDegeneratedPolygons();
113
114 TesselPointSet * GetAllConnectedPoints(const TesselPoint* const Point) const;
115 TriangleSet * GetAllTriangles(const BoundaryPointSet * const Point) const;
116 ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
117 ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
118 TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
119 TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
120 class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
121 TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
122 TriangleList * FindClosestTrianglesToVector(const Vector &x, const LinkedCell_deprecated* LC) const;
123 BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell_deprecated* LC) const;
124 bool IsInnerPoint(const Vector &Point, const LinkedCell_deprecated* const LC) const;
125 double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
126 double GetDistanceToSurface(const Vector &Point, const LinkedCell_deprecated* const LC) const;
127 BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell_deprecated* const LC) const;
128 bool AddBoundaryPoint(TesselPoint * Walker, const int n);
129 DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell_deprecated* LC) const;
130 BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell_deprecated* LC) const;
131
132 // print for debugging
133 void PrintAllBoundaryPoints(ofstream *out) const;
134 void PrintAllBoundaryLines(ofstream *out) const;
135 void PrintAllBoundaryTriangles(ofstream *out) const;
136
137 // store envelope in file
138 void Output(const char *filename, IPointCloud & cloud);
139
140 PointMap PointsOnBoundary;
141 LineMap LinesOnBoundary;
142 CandidateMap OpenLines;
143 TriangleMap TrianglesOnBoundary;
144 int PointsOnBoundaryCount;
145 int LinesOnBoundaryCount;
146 int TrianglesOnBoundaryCount;
147
148 typedef PointMap::iterator iterator;
149 typedef PointMap::const_iterator const_iterator;
150 iterator begin() { return PointsOnBoundary.begin(); }
151 const_iterator begin() const { return PointsOnBoundary.begin(); }
152 iterator end() { return PointsOnBoundary.end(); }
153 const_iterator end() const { return PointsOnBoundary.end(); }
154
155 class BoundaryPointSet *BPS[2];
156 class BoundaryLineSet *BLS[3];
157 class BoundaryTriangleSet *BTS;
158 class BoundaryTriangleSet *LastTriangle;
159 int TriangleFilesWritten;
160
161 private:
162 static const double HULLEPSILON; //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
163
164 mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
165
166 mutable PointMap::const_iterator InternalPointer;
167
168 //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell_deprecated * const LC) const;
169 void FindDegeneratedCandidatesforOpenLines(TesselPoint * const Sprinter, const Vector * const OptCenter);
170};
171
172#endif /* TESSELATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.