Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.hpp

    rf1ef60a r125b3c  
    2323#include <list>
    2424#include <set>
     25#include <stack>
    2526
    2627#include "atom_particleinfo.hpp"
     
    4748#define VRMLSUffix ".wrl"
    4849
     50#define ParallelEpsilon 1e-3
     51
    4952// ======================================================= some template functions =========================================
    5053
    5154#define PointMap map < int, class BoundaryPointSet * >
     55#define PointSet set < class BoundaryPointSet * >
     56#define PointList list < class BoundaryPointSet * >
    5257#define PointPair pair < int, class BoundaryPointSet * >
    5358#define PointTestPair pair < PointMap::iterator, bool >
     59
    5460#define CandidateList list <class CandidateForTesselation *>
     61#define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
    5562
    5663#define LineMap multimap < int, class BoundaryLineSet * >
     64#define LineSet set < class BoundaryLineSet * >
     65#define LineList list < class BoundaryLineSet * >
    5766#define LinePair pair < int, class BoundaryLineSet * >
    5867#define LineTestPair pair < LineMap::iterator, bool >
    5968
    6069#define TriangleMap map < int, class BoundaryTriangleSet * >
     70#define TriangleSet set < class BoundaryTriangleSet * >
     71#define TriangleList list < class BoundaryTriangleSet * >
    6172#define TrianglePair pair < int, class BoundaryTriangleSet * >
    6273#define TriangleTestPair pair < TrianglePair::iterator, bool >
    6374
     75#define PolygonMap map < int, class BoundaryPolygonSet * >
     76#define PolygonSet set < class BoundaryPolygonSet * >
     77#define PolygonList list < class BoundaryPolygonSet * >
     78
    6479#define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    6580#define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
     81
     82#define TesselPointList list <TesselPoint *>
     83#define TesselPointSet set <TesselPoint *>
    6684
    6785/********************************************** declarations *******************************/
     
    114132    TriangleMap triangles;
    115133    int Nr;
     134    bool skipped;
    116135};
    117136
     
    139158    class BoundaryLineSet *lines[3];
    140159    Vector NormalVector;
     160    Vector SphereCenter;
    141161    int Nr;
    142162};
    143163
    144164ostream & operator << (ostream &ost, const BoundaryTriangleSet &a);
     165
     166
     167// ======================================================== class BoundaryTriangleSet =======================================
     168
     169/** Set of BoundaryPointSet.
     170 * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has
     171 * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation
     172 * class (i.e. no allocation, no deletion).
     173 * \note we assume that the set of endpoints reside (more or less) on a plane.
     174 */
     175class BoundaryPolygonSet {
     176  public:
     177    BoundaryPolygonSet();
     178    ~BoundaryPolygonSet();
     179
     180    Vector * GetNormalVector(const Vector &NormalVector) const;
     181    void GetCenter(Vector *center) const;
     182    bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
     183    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
     184    bool ContainsBoundaryPoint(const TesselPoint * const point) const;
     185    bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;
     186    bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;
     187    bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;
     188    bool ContainsPresentTupel(const PointSet &endpoints) const;
     189    TriangleSet * GetAllContainedTrianglesFromEndpoints() const;
     190    bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);
     191
     192    PointSet endpoints;
     193    int Nr;
     194};
     195
     196ostream & operator << (ostream &ost, const BoundaryPolygonSet &a);
    145197
    146198// =========================================================== class TESSELPOINT ===========================================
     
    170222  virtual ~PointCloud();
    171223
     224  virtual const char * const GetName() const { return "unknown"; };
    172225  virtual Vector *GetCenter() const { return NULL; };
    173226  virtual TesselPoint *GetPoint() const { return NULL; };
     
    177230  virtual void GoToFirst() const {};
    178231  virtual void GoToLast() const {};
    179   virtual bool IsEmpty() const { return false; };
    180   virtual bool IsEnd() const { return false; };
     232  virtual bool IsEmpty() const { return true; };
     233  virtual bool IsEnd() const { return true; };
    181234};
    182235
     
    185238class CandidateForTesselation {
    186239  public :
     240  CandidateForTesselation(BoundaryLineSet* currentBaseLine);
    187241  CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
    188242  ~CandidateForTesselation();
    189243
    190   TesselPoint *point;
     244  TesselPointList pointlist;
    191245  BoundaryLineSet *BaseLine;
    192246  Vector OptCenter;
    193247  Vector OtherOptCenter;
    194 };
     248  double ShortestAngle;
     249  double OtherShortestAngle;
     250};
     251
     252ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
    195253
    196254// =========================================================== class TESSELATION ===========================================
     
    210268    void AddTesselationTriangle();
    211269    void AddTesselationTriangle(const int nr);
     270    void AddCandidateTriangle(CandidateForTesselation CandidateLine);
    212271    void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
    213272    void RemoveTesselationLine(class BoundaryLineSet *line);
     
    218277    void FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
    219278    void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
    220     void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const;
    221     bool FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
     279    void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;
     280    bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
    222281    int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
    223282    class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
     
    235294    void RemoveDegeneratedTriangles();
    236295    void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC);
     296    int CorrectAllDegeneratedPolygons();
    237297
    238298    set<TesselPoint*> * GetAllConnectedPoints(const TesselPoint* const Point) const;
     
    240300    list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
    241301    list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
    242     list<TesselPoint*> * GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const;
     302    list<TesselPoint*> * GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
    243303    class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
    244304    list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const;
     
    259319    PointMap PointsOnBoundary;
    260320    LineMap LinesOnBoundary;
     321    CandidateMap OpenLines;
    261322    TriangleMap TrianglesOnBoundary;
    262323    int PointsOnBoundaryCount;
     
    286347    mutable PointMap::const_iterator InternalPointer;
    287348
    288     bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
     349    //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
    289350};
    290351
Note: See TracChangeset for help on using the changeset viewer.