| [357fba] | 1 | /*
 | 
|---|
 | 2 |  * tesselation.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors. As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
 | 
|---|
 | 5 |  *
 | 
|---|
 | 6 |  *  Created on: Aug 3, 2009
 | 
|---|
 | 7 |  *      Author: heber
 | 
|---|
 | 8 |  */
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | #ifndef TESSELATION_HPP_
 | 
|---|
 | 11 | #define TESSELATION_HPP_
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 | using namespace std;
 | 
|---|
 | 14 | 
 | 
|---|
| [f66195] | 15 | /*********************************************** includes ***********************************/
 | 
|---|
 | 16 | 
 | 
|---|
| [357fba] | 17 | // include config.h
 | 
|---|
 | 18 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 19 | #include <config.h>
 | 
|---|
 | 20 | #endif
 | 
|---|
 | 21 | 
 | 
|---|
 | 22 | #include <map>
 | 
|---|
 | 23 | #include <list>
 | 
|---|
| [7c14ec] | 24 | #include <set>
 | 
|---|
| [856098] | 25 | #include <stack>
 | 
|---|
| [357fba] | 26 | 
 | 
|---|
| [6b919f8] | 27 | #include "atom_particleinfo.hpp"
 | 
|---|
| [4455f4] | 28 | #include "helpers.hpp"
 | 
|---|
| [6b919f8] | 29 | #include "vector.hpp"
 | 
|---|
| [357fba] | 30 | 
 | 
|---|
| [f66195] | 31 | /****************************************** forward declarations *****************************/
 | 
|---|
 | 32 | 
 | 
|---|
| [357fba] | 33 | class BoundaryPointSet;
 | 
|---|
 | 34 | class BoundaryLineSet;
 | 
|---|
 | 35 | class BoundaryTriangleSet;
 | 
|---|
| [f66195] | 36 | class LinkedCell;
 | 
|---|
| [357fba] | 37 | class TesselPoint;
 | 
|---|
 | 38 | class PointCloud;
 | 
|---|
 | 39 | class Tesselation;
 | 
|---|
 | 40 | 
 | 
|---|
| [f66195] | 41 | /********************************************** definitions *********************************/
 | 
|---|
 | 42 | 
 | 
|---|
| [57066a] | 43 | #define DoTecplotOutput 1
 | 
|---|
| [09898c] | 44 | #define DoRaster3DOutput 1
 | 
|---|
| [734816] | 45 | #define DoVRMLOutput 0
 | 
|---|
| [57066a] | 46 | #define TecplotSuffix ".dat"
 | 
|---|
 | 47 | #define Raster3DSuffix ".r3d"
 | 
|---|
 | 48 | #define VRMLSUffix ".wrl"
 | 
|---|
 | 49 | 
 | 
|---|
| [fad93c] | 50 | #define ParallelEpsilon 1e-3
 | 
|---|
 | 51 | 
 | 
|---|
| [357fba] | 52 | // ======================================================= some template functions =========================================
 | 
|---|
 | 53 | 
 | 
|---|
| [c15ca2] | 54 | #define IndexToIndex map <int, int>
 | 
|---|
 | 55 | 
 | 
|---|
| [357fba] | 56 | #define PointMap map < int, class BoundaryPointSet * >
 | 
|---|
| [262bae] | 57 | #define PointSet set < class BoundaryPointSet * >
 | 
|---|
 | 58 | #define PointList list < class BoundaryPointSet * >
 | 
|---|
| [357fba] | 59 | #define PointPair pair < int, class BoundaryPointSet * >
 | 
|---|
 | 60 | #define PointTestPair pair < PointMap::iterator, bool >
 | 
|---|
| [262bae] | 61 | 
 | 
|---|
| [357fba] | 62 | #define CandidateList list <class CandidateForTesselation *>
 | 
|---|
| [1e168b] | 63 | #define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
 | 
|---|
| [357fba] | 64 | 
 | 
|---|
 | 65 | #define LineMap multimap < int, class BoundaryLineSet * >
 | 
|---|
| [262bae] | 66 | #define LineSet set < class BoundaryLineSet * >
 | 
|---|
 | 67 | #define LineList list < class BoundaryLineSet * >
 | 
|---|
| [357fba] | 68 | #define LinePair pair < int, class BoundaryLineSet * >
 | 
|---|
 | 69 | #define LineTestPair pair < LineMap::iterator, bool >
 | 
|---|
 | 70 | 
 | 
|---|
 | 71 | #define TriangleMap map < int, class BoundaryTriangleSet * >
 | 
|---|
| [262bae] | 72 | #define TriangleSet set < class BoundaryTriangleSet * >
 | 
|---|
 | 73 | #define TriangleList list < class BoundaryTriangleSet * >
 | 
|---|
| [357fba] | 74 | #define TrianglePair pair < int, class BoundaryTriangleSet * >
 | 
|---|
 | 75 | #define TriangleTestPair pair < TrianglePair::iterator, bool >
 | 
|---|
 | 76 | 
 | 
|---|
| [262bae] | 77 | #define PolygonMap map < int, class BoundaryPolygonSet * >
 | 
|---|
 | 78 | #define PolygonSet set < class BoundaryPolygonSet * >
 | 
|---|
 | 79 | #define PolygonList list < class BoundaryPolygonSet * >
 | 
|---|
 | 80 | 
 | 
|---|
| [97498a] | 81 | #define DistanceToPointMap multimap <double, class BoundaryPointSet * >
 | 
|---|
 | 82 | #define DistanceToPointPair pair <double, class BoundaryPointSet * >
 | 
|---|
| [c15ca2] | 83 | 
 | 
|---|
| [357fba] | 84 | #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
 | 
|---|
 | 85 | #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
 | 
|---|
 | 86 | 
 | 
|---|
| [f67b6e] | 87 | #define TesselPointList list <TesselPoint *>
 | 
|---|
| [262bae] | 88 | #define TesselPointSet set <TesselPoint *>
 | 
|---|
| [f67b6e] | 89 | 
 | 
|---|
| [244a84] | 90 | #define ListOfTesselPointList list<list <TesselPoint *> *>
 | 
|---|
 | 91 | 
 | 
|---|
| [6613ec] | 92 | enum centers {Opt, OtherOpt};
 | 
|---|
 | 93 | 
 | 
|---|
| [f66195] | 94 | /********************************************** declarations *******************************/
 | 
|---|
| [357fba] | 95 | 
 | 
|---|
 | 96 | template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
 | 
|---|
 | 97 | {
 | 
|---|
 | 98 |   if (endpoint1->Nr < endpoint2->Nr) {
 | 
|---|
 | 99 |     endpoints[0] = endpoint1;
 | 
|---|
 | 100 |     endpoints[1] = endpoint2;
 | 
|---|
 | 101 |   } else {
 | 
|---|
 | 102 |     endpoints[0] = endpoint2;
 | 
|---|
 | 103 |     endpoints[1] = endpoint1;
 | 
|---|
 | 104 |   }
 | 
|---|
 | 105 | };
 | 
|---|
 | 106 | 
 | 
|---|
 | 107 | // ======================================================== class BoundaryPointSet =========================================
 | 
|---|
 | 108 | 
 | 
|---|
 | 109 | class BoundaryPointSet {
 | 
|---|
 | 110 |   public:
 | 
|---|
 | 111 |     BoundaryPointSet();
 | 
|---|
| [9473f6] | 112 |     BoundaryPointSet(TesselPoint * const Walker);
 | 
|---|
| [357fba] | 113 |     ~BoundaryPointSet();
 | 
|---|
 | 114 | 
 | 
|---|
| [9473f6] | 115 |     void AddLine(BoundaryLineSet * const line);
 | 
|---|
| [357fba] | 116 | 
 | 
|---|
 | 117 |     LineMap lines;
 | 
|---|
 | 118 |     int LinesCount;
 | 
|---|
 | 119 |     TesselPoint *node;
 | 
|---|
| [16d866] | 120 |     double value;
 | 
|---|
| [357fba] | 121 |     int Nr;
 | 
|---|
 | 122 | };
 | 
|---|
 | 123 | 
 | 
|---|
| [776b64] | 124 | ostream & operator << (ostream &ost, const BoundaryPointSet &a);
 | 
|---|
| [357fba] | 125 | 
 | 
|---|
 | 126 | // ======================================================== class BoundaryLineSet ==========================================
 | 
|---|
 | 127 | 
 | 
|---|
 | 128 | class BoundaryLineSet {
 | 
|---|
 | 129 |   public:
 | 
|---|
 | 130 |     BoundaryLineSet();
 | 
|---|
| [9473f6] | 131 |     BoundaryLineSet(BoundaryPointSet * const Point[2], const int number);
 | 
|---|
 | 132 |     BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number);
 | 
|---|
| [357fba] | 133 |     ~BoundaryLineSet();
 | 
|---|
 | 134 | 
 | 
|---|
| [9473f6] | 135 |     void AddTriangle(BoundaryTriangleSet * const triangle);
 | 
|---|
 | 136 |     bool IsConnectedTo(const BoundaryLineSet * const line) const;
 | 
|---|
 | 137 |     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
 | 
|---|
 | 138 |     bool CheckConvexityCriterion() const;
 | 
|---|
 | 139 |     class BoundaryPointSet *GetOtherEndpoint(const BoundaryPointSet * const point) const;
 | 
|---|
| [357fba] | 140 | 
 | 
|---|
 | 141 |     class BoundaryPointSet *endpoints[2];
 | 
|---|
 | 142 |     TriangleMap triangles;
 | 
|---|
 | 143 |     int Nr;
 | 
|---|
| [1e168b] | 144 |     bool skipped;
 | 
|---|
| [357fba] | 145 | };
 | 
|---|
 | 146 | 
 | 
|---|
| [776b64] | 147 | ostream & operator << (ostream &ost, const BoundaryLineSet &a);
 | 
|---|
| [357fba] | 148 | 
 | 
|---|
 | 149 | // ======================================================== class BoundaryTriangleSet =======================================
 | 
|---|
 | 150 | 
 | 
|---|
 | 151 | class BoundaryTriangleSet {
 | 
|---|
 | 152 |   public:
 | 
|---|
 | 153 |     BoundaryTriangleSet();
 | 
|---|
| [9473f6] | 154 |     BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number);
 | 
|---|
| [357fba] | 155 |     ~BoundaryTriangleSet();
 | 
|---|
 | 156 | 
 | 
|---|
| [9473f6] | 157 |     void GetNormalVector(const Vector &NormalVector);
 | 
|---|
 | 158 |     void GetCenter(Vector * const center) const;
 | 
|---|
 | 159 |     bool GetIntersectionInsideTriangle(const Vector * const MolCenter, const Vector * const x, Vector * const Intersection) const;
 | 
|---|
 | 160 |     double GetClosestPointInsideTriangle(const Vector * const x, Vector * const ClosestPoint) const;
 | 
|---|
 | 161 |     bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
 | 
|---|
 | 162 |     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
 | 
|---|
 | 163 |     bool ContainsBoundaryPoint(const TesselPoint * const point) const;
 | 
|---|
 | 164 |     class BoundaryPointSet *GetThirdEndpoint(const BoundaryLineSet * const line) const;
 | 
|---|
 | 165 |     bool IsPresentTupel(const BoundaryPointSet * const Points[3]) const;
 | 
|---|
 | 166 |     bool IsPresentTupel(const BoundaryTriangleSet * const T) const;
 | 
|---|
| [357fba] | 167 | 
 | 
|---|
 | 168 |     class BoundaryPointSet *endpoints[3];
 | 
|---|
 | 169 |     class BoundaryLineSet *lines[3];
 | 
|---|
 | 170 |     Vector NormalVector;
 | 
|---|
| [b998c3] | 171 |     Vector SphereCenter;
 | 
|---|
| [357fba] | 172 |     int Nr;
 | 
|---|
 | 173 | };
 | 
|---|
 | 174 | 
 | 
|---|
| [776b64] | 175 | ostream & operator << (ostream &ost, const BoundaryTriangleSet &a);
 | 
|---|
| [357fba] | 176 | 
 | 
|---|
| [262bae] | 177 | 
 | 
|---|
 | 178 | // ======================================================== class BoundaryTriangleSet =======================================
 | 
|---|
 | 179 | 
 | 
|---|
 | 180 | /** Set of BoundaryPointSet.
 | 
|---|
 | 181 |  * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has
 | 
|---|
 | 182 |  * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation
 | 
|---|
 | 183 |  * class (i.e. no allocation, no deletion).
 | 
|---|
 | 184 |  * \note we assume that the set of endpoints reside (more or less) on a plane.
 | 
|---|
 | 185 |  */
 | 
|---|
 | 186 | class BoundaryPolygonSet {
 | 
|---|
 | 187 |   public:
 | 
|---|
 | 188 |     BoundaryPolygonSet();
 | 
|---|
 | 189 |     ~BoundaryPolygonSet();
 | 
|---|
 | 190 | 
 | 
|---|
 | 191 |     Vector * GetNormalVector(const Vector &NormalVector) const;
 | 
|---|
 | 192 |     void GetCenter(Vector *center) const;
 | 
|---|
 | 193 |     bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
 | 
|---|
 | 194 |     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
 | 
|---|
 | 195 |     bool ContainsBoundaryPoint(const TesselPoint * const point) const;
 | 
|---|
 | 196 |     bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;
 | 
|---|
 | 197 |     bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;
 | 
|---|
 | 198 |     bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;
 | 
|---|
 | 199 |     bool ContainsPresentTupel(const PointSet &endpoints) const;
 | 
|---|
| [856098] | 200 |     TriangleSet * GetAllContainedTrianglesFromEndpoints() const;
 | 
|---|
| [262bae] | 201 |     bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);
 | 
|---|
 | 202 | 
 | 
|---|
 | 203 |     PointSet endpoints;
 | 
|---|
 | 204 |     int Nr;
 | 
|---|
 | 205 | };
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 | ostream & operator << (ostream &ost, const BoundaryPolygonSet &a);
 | 
|---|
 | 208 | 
 | 
|---|
| [357fba] | 209 | // =========================================================== class TESSELPOINT ===========================================
 | 
|---|
 | 210 | 
 | 
|---|
 | 211 | /** Is a single point of the set of Vectors, also a super-class to be inherited and and its functions to be implemented.
 | 
|---|
 | 212 |  */
 | 
|---|
| [4455f4] | 213 | class TesselPoint : virtual public ParticleInfo {
 | 
|---|
| [357fba] | 214 | public:
 | 
|---|
 | 215 |   TesselPoint();
 | 
|---|
| [5c7bf8] | 216 |   virtual ~TesselPoint();
 | 
|---|
| [357fba] | 217 | 
 | 
|---|
 | 218 |   Vector *node;   // pointer to position of the dot in space
 | 
|---|
| [5c7bf8] | 219 | 
 | 
|---|
 | 220 |   virtual ostream & operator << (ostream &ost);
 | 
|---|
| [357fba] | 221 | };
 | 
|---|
 | 222 | 
 | 
|---|
 | 223 | ostream & operator << (ostream &ost, const TesselPoint &a);
 | 
|---|
 | 224 | 
 | 
|---|
 | 225 | // =========================================================== class POINTCLOUD ============================================
 | 
|---|
 | 226 | 
 | 
|---|
 | 227 | /** Super-class for all point clouds structures, also molecules. They have to inherit this structure and implement the virtual function to access the Vectors.
 | 
|---|
 | 228 |  * This basically encapsulates a list structure.
 | 
|---|
 | 229 |  */
 | 
|---|
 | 230 | class PointCloud {
 | 
|---|
 | 231 | public:
 | 
|---|
 | 232 |   PointCloud();
 | 
|---|
| [ab1932] | 233 |   virtual ~PointCloud();
 | 
|---|
| [357fba] | 234 | 
 | 
|---|
| [6a7f78c] | 235 |   virtual const char * const GetName() const { return "unknown"; };
 | 
|---|
| [e138de] | 236 |   virtual Vector *GetCenter() const { return NULL; };
 | 
|---|
| [776b64] | 237 |   virtual TesselPoint *GetPoint() const { return NULL; };
 | 
|---|
 | 238 |   virtual TesselPoint *GetTerminalPoint() const { return NULL; };
 | 
|---|
| [71b20e] | 239 |   virtual int GetMaxId() const { return 0; };
 | 
|---|
| [776b64] | 240 |   virtual void GoToNext() const {};
 | 
|---|
 | 241 |   virtual void GoToPrevious() const {};
 | 
|---|
 | 242 |   virtual void GoToFirst() const {};
 | 
|---|
 | 243 |   virtual void GoToLast() const {};
 | 
|---|
| [6a7f78c] | 244 |   virtual bool IsEmpty() const { return true; };
 | 
|---|
 | 245 |   virtual bool IsEnd() const { return true; };
 | 
|---|
| [357fba] | 246 | };
 | 
|---|
 | 247 | 
 | 
|---|
 | 248 | // ======================================================== class CandidateForTesselation =========================================
 | 
|---|
 | 249 | 
 | 
|---|
 | 250 | class CandidateForTesselation {
 | 
|---|
 | 251 |   public :
 | 
|---|
| [1e168b] | 252 |   CandidateForTesselation(BoundaryLineSet* currentBaseLine);
 | 
|---|
| [09898c] | 253 |   CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, BoundaryPointSet *point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
 | 
|---|
| [357fba] | 254 |   ~CandidateForTesselation();
 | 
|---|
 | 255 | 
 | 
|---|
| [734816] | 256 |   bool CheckValidity(const double RADIUS, const LinkedCell *LC) const;
 | 
|---|
 | 257 | 
 | 
|---|
| [f67b6e] | 258 |   TesselPointList pointlist;
 | 
|---|
| [09898c] | 259 |   const BoundaryLineSet * BaseLine;
 | 
|---|
 | 260 |   const BoundaryPointSet * ThirdPoint;
 | 
|---|
 | 261 |   const BoundaryTriangleSet *T;
 | 
|---|
 | 262 |   Vector OldCenter;
 | 
|---|
| [357fba] | 263 |   Vector OptCenter;
 | 
|---|
 | 264 |   Vector OtherOptCenter;
 | 
|---|
| [1e168b] | 265 |   double ShortestAngle;
 | 
|---|
 | 266 |   double OtherShortestAngle;
 | 
|---|
| [357fba] | 267 | };
 | 
|---|
 | 268 | 
 | 
|---|
| [1e168b] | 269 | ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
 | 
|---|
 | 270 | 
 | 
|---|
| [357fba] | 271 | // =========================================================== class TESSELATION ===========================================
 | 
|---|
 | 272 | 
 | 
|---|
 | 273 | /** Contains the envelope to a PointCloud.
 | 
|---|
 | 274 |  */
 | 
|---|
| [5c7bf8] | 275 | class Tesselation : public PointCloud {
 | 
|---|
| [357fba] | 276 |   public:
 | 
|---|
 | 277 | 
 | 
|---|
 | 278 |     Tesselation();
 | 
|---|
| [5c7bf8] | 279 |     virtual ~Tesselation();
 | 
|---|
| [357fba] | 280 | 
 | 
|---|
| [776b64] | 281 |     void AddTesselationPoint(TesselPoint* Candidate, const int n);
 | 
|---|
| [f1ef60a] | 282 |     void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
 | 
|---|
| [f07f86d] | 283 |     void AddTesselationLine(const Vector * const OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
 | 
|---|
| [474961] | 284 |     void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
 | 
|---|
 | 285 |     void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
 | 
|---|
| [16d866] | 286 |     void AddTesselationTriangle();
 | 
|---|
| [776b64] | 287 |     void AddTesselationTriangle(const int nr);
 | 
|---|
| [6613ec] | 288 |     void AddCandidateTriangle(CandidateForTesselation &CandidateLine, enum centers type);
 | 
|---|
| [711ac2] | 289 |     void AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC);
 | 
|---|
| [474961] | 290 |     void AddCandidatePolygon(CandidateForTesselation CandidateLine, const double RADIUS, const LinkedCell *LC);
 | 
|---|
| [16d866] | 291 |     void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
 | 
|---|
 | 292 |     void RemoveTesselationLine(class BoundaryLineSet *line);
 | 
|---|
 | 293 |     void RemoveTesselationPoint(class BoundaryPointSet *point);
 | 
|---|
| [6613ec] | 294 |     bool CheckDegeneracy(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC) const;
 | 
|---|
| [16d866] | 295 | 
 | 
|---|
| [357fba] | 296 | 
 | 
|---|
 | 297 |     // concave envelope
 | 
|---|
| [ce70970] | 298 |     bool FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
 | 
|---|
| [776b64] | 299 |     void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
 | 
|---|
| [f07f86d] | 300 |     void FindThirdPointForTesselation(const Vector &NormalVector, const Vector &SearchDirection, const Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class BoundaryPointSet  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;
 | 
|---|
 | 301 |     bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, const BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
 | 
|---|
| [6613ec] | 302 |     bool FindCandidatesforOpenLines(const double RADIUS, const LinkedCell *&LCList);
 | 
|---|
| [f1ef60a] | 303 |     int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
 | 
|---|
| [e138de] | 304 |     class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
 | 
|---|
| [357fba] | 305 | 
 | 
|---|
 | 306 |     // convex envelope
 | 
|---|
| [e138de] | 307 |     void TesselateOnBoundary(const PointCloud * const cloud);
 | 
|---|
 | 308 |     void GuessStartingTriangle();
 | 
|---|
 | 309 |     bool InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC);
 | 
|---|
 | 310 |     double RemovePointFromTesselatedSurface(class BoundaryPointSet *point);
 | 
|---|
 | 311 |     class BoundaryLineSet * FlipBaseline(class BoundaryLineSet *Base);
 | 
|---|
 | 312 |     double PickFarthestofTwoBaselines(class BoundaryLineSet *Base);
 | 
|---|
 | 313 |     class BoundaryPointSet *IsConvexRectangle(class BoundaryLineSet *Base);
 | 
|---|
| [244a84] | 314 |     IndexToIndex * FindAllDegeneratedTriangles();
 | 
|---|
 | 315 |     IndexToIndex * FindAllDegeneratedLines();
 | 
|---|
| [7c14ec] | 316 |     void RemoveDegeneratedTriangles();
 | 
|---|
| [e138de] | 317 |     void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC);
 | 
|---|
| [262bae] | 318 |     int CorrectAllDegeneratedPolygons();
 | 
|---|
| [16d866] | 319 | 
 | 
|---|
| [244a84] | 320 |     TesselPointSet * GetAllConnectedPoints(const TesselPoint* const Point) const;
 | 
|---|
 | 321 |     TriangleSet * GetAllTriangles(const BoundaryPointSet * const Point) const;
 | 
|---|
 | 322 |     ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
 | 
|---|
 | 323 |     ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
 | 
|---|
 | 324 |     TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
 | 
|---|
 | 325 |     TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const;
 | 
|---|
 | 326 |     class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
 | 
|---|
 | 327 |     TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
 | 
|---|
 | 328 |     TriangleList * FindClosestTrianglesToVector(const Vector *x, const LinkedCell* LC) const;
 | 
|---|
 | 329 |     BoundaryTriangleSet * FindClosestTriangleToVector(const Vector *x, const LinkedCell* LC) const;
 | 
|---|
| [241485] | 330 |     bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
 | 
|---|
| [244a84] | 331 |     double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
 | 
|---|
| [8db598] | 332 |     double GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const;
 | 
|---|
 | 333 |     BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
 | 
|---|
| [776b64] | 334 |     bool AddBoundaryPoint(TesselPoint * Walker, const int n);
 | 
|---|
| [97498a] | 335 |     DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const;
 | 
|---|
| [c15ca2] | 336 |     BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector *x, const LinkedCell* LC) const;
 | 
|---|
| [ab1932] | 337 | 
 | 
|---|
| [0077b5] | 338 |     // print for debugging
 | 
|---|
| [776b64] | 339 |     void PrintAllBoundaryPoints(ofstream *out) const;
 | 
|---|
 | 340 |     void PrintAllBoundaryLines(ofstream *out) const;
 | 
|---|
 | 341 |     void PrintAllBoundaryTriangles(ofstream *out) const;
 | 
|---|
| [0077b5] | 342 | 
 | 
|---|
| [57066a] | 343 |     // store envelope in file
 | 
|---|
| [e138de] | 344 |     void Output(const char *filename, const PointCloud * const cloud);
 | 
|---|
| [0077b5] | 345 | 
 | 
|---|
| [357fba] | 346 |     PointMap PointsOnBoundary;
 | 
|---|
 | 347 |     LineMap LinesOnBoundary;
 | 
|---|
| [1e168b] | 348 |     CandidateMap OpenLines;
 | 
|---|
| [357fba] | 349 |     TriangleMap TrianglesOnBoundary;
 | 
|---|
 | 350 |     int PointsOnBoundaryCount;
 | 
|---|
 | 351 |     int LinesOnBoundaryCount;
 | 
|---|
 | 352 |     int TrianglesOnBoundaryCount;
 | 
|---|
 | 353 | 
 | 
|---|
| [5c7bf8] | 354 |     // PointCloud implementation for PointsOnBoundary
 | 
|---|
| [776b64] | 355 |     virtual Vector *GetCenter(ofstream *out) const;
 | 
|---|
 | 356 |     virtual TesselPoint *GetPoint() const;
 | 
|---|
 | 357 |     virtual TesselPoint *GetTerminalPoint() const;
 | 
|---|
 | 358 |     virtual void GoToNext() const;
 | 
|---|
 | 359 |     virtual void GoToPrevious() const;
 | 
|---|
 | 360 |     virtual void GoToFirst() const;
 | 
|---|
 | 361 |     virtual void GoToLast() const;
 | 
|---|
 | 362 |     virtual bool IsEmpty() const;
 | 
|---|
 | 363 |     virtual bool IsEnd() const;
 | 
|---|
| [5c7bf8] | 364 | 
 | 
|---|
| [357fba] | 365 |     class BoundaryPointSet *BPS[2];
 | 
|---|
 | 366 |     class BoundaryLineSet *BLS[3];
 | 
|---|
 | 367 |     class BoundaryTriangleSet *BTS;
 | 
|---|
| [57066a] | 368 |     class BoundaryTriangleSet *LastTriangle;
 | 
|---|
 | 369 |     int TriangleFilesWritten;
 | 
|---|
| [5c7bf8] | 370 | 
 | 
|---|
| [08ef35] | 371 |   private:
 | 
|---|
| [f1ef60a] | 372 |     mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
 | 
|---|
| [08ef35] | 373 | 
 | 
|---|
| [776b64] | 374 |     mutable PointMap::const_iterator InternalPointer;
 | 
|---|
| [f1ef60a] | 375 | 
 | 
|---|
| [f67b6e] | 376 |     //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
 | 
|---|
| [6613ec] | 377 |     void FindDegeneratedCandidatesforOpenLines(TesselPoint * const Sprinter, const Vector * const OptCenter);
 | 
|---|
| [357fba] | 378 | };
 | 
|---|
 | 379 | 
 | 
|---|
 | 380 | 
 | 
|---|
 | 381 | #endif /* TESSELATION_HPP_ */
 | 
|---|