Ignore:
Timestamp:
Oct 27, 2009, 4:11:22 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
069034
Parents:
55a71b
Message:

Huge refactoring to make const what is const (ticket #38), continued.

  • too many changes because of too many cross-references to be able to list them up here.
  • NOTE that "make check" runs fine and did catch several error.
  • note that we had to use const_iterator several times when the map, ... was declared const.
  • at times we changed an allocated LinkedCell LCList(...) into

const LinkedCell *LCList;
LCList = new LinkedCell(...);

  • also mutable (see ticket #5) was used, e.g. for molecule::InternalPointer (PointCloud changes are allowed, because they are just accounting).

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/tesselation.hpp

    r55a71b ra9b2a0a  
    8383  public:
    8484    BoundaryPointSet();
    85     BoundaryPointSet(TesselPoint *Walker);
     85    BoundaryPointSet(TesselPoint * Walker);
    8686    ~BoundaryPointSet();
    8787
     
    9595};
    9696
    97 ostream & operator << (ostream &ost, BoundaryPointSet &a);
     97ostream & operator << (ostream &ost, const BoundaryPointSet &a);
    9898
    9999// ======================================================== class BoundaryLineSet ==========================================
     
    102102  public:
    103103    BoundaryLineSet();
    104     BoundaryLineSet(class BoundaryPointSet *Point[2], int number);
     104    BoundaryLineSet(class BoundaryPointSet *Point[2], const int number);
    105105    ~BoundaryLineSet();
    106106
     
    116116};
    117117
    118 ostream & operator << (ostream &ost, BoundaryLineSet &a);
     118ostream & operator << (ostream &ost, const BoundaryLineSet &a);
    119119
    120120// ======================================================== class BoundaryTriangleSet =======================================
     
    142142};
    143143
    144 ostream & operator << (ostream &ost, BoundaryTriangleSet &a);
     144ostream & operator << (ostream &ost, const BoundaryTriangleSet &a);
    145145
    146146// =========================================================== class TESSELPOINT ===========================================
     
    170170  virtual ~PointCloud();
    171171
    172   virtual Vector *GetCenter(ofstream *out) { return NULL; };
    173   virtual TesselPoint *GetPoint() { return NULL; };
    174   virtual TesselPoint *GetTerminalPoint() { return NULL; };
    175   virtual void GoToNext() {};
    176   virtual void GoToPrevious() {};
    177   virtual void GoToFirst() {};
    178   virtual void GoToLast() {};
    179   virtual bool IsEmpty() { return false; };
    180   virtual bool IsEnd() { return false; };
     172  virtual Vector *GetCenter(ofstream *out) const { return NULL; };
     173  virtual TesselPoint *GetPoint() const { return NULL; };
     174  virtual TesselPoint *GetTerminalPoint() const { return NULL; };
     175  virtual void GoToNext() const {};
     176  virtual void GoToPrevious() const {};
     177  virtual void GoToFirst() const {};
     178  virtual void GoToLast() const {};
     179  virtual bool IsEmpty() const { return false; };
     180  virtual bool IsEnd() const { return false; };
    181181};
    182182
     
    204204    virtual ~Tesselation();
    205205
    206     void AddTesselationPoint(TesselPoint* Candidate, int n);
    207     void AddTesselationLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
    208     void AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, int n);
     206    void AddTesselationPoint(TesselPoint* Candidate, const int n);
     207    void AddTesselationLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
     208    void AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
    209209    void AddTesselationTriangle();
    210     void AddTesselationTriangle(int nr);
     210    void AddTesselationTriangle(const int nr);
    211211    void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
    212212    void RemoveTesselationLine(class BoundaryLineSet *line);
    213213    void RemoveTesselationPoint(class BoundaryPointSet *point);
    214214
    215     class BoundaryPointSet *GetCommonEndpoint(class BoundaryLineSet * line1, class BoundaryLineSet * line2);
    216215
    217216    // concave envelope
    218     void FindStartingTriangle(ofstream *out, const double RADIUS, class LinkedCell *LC);
    219     void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, class LinkedCell *LC);
    220     void FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, class LinkedCell *LC);
    221     bool FindNextSuitableTriangle(ofstream *out, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, LinkedCell *LC);
     217    void FindStartingTriangle(ofstream *out, const double RADIUS, const LinkedCell *LC);
     218    void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
     219    void FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC);
     220    bool FindNextSuitableTriangle(ofstream *out, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
    222221    int CheckPresenceOfTriangle(ofstream *out, class TesselPoint *Candidates[3]);
    223222    class BoundaryTriangleSet * GetPresentTriangle(ofstream *out, TesselPoint *Candidates[3]);
    224223
    225224    // convex envelope
    226     void TesselateOnBoundary(ofstream *out, PointCloud *cloud);
     225    void TesselateOnBoundary(ofstream *out, const PointCloud * const cloud);
    227226    void GuessStartingTriangle(ofstream *out);
    228     bool InsertStraddlingPoints(ofstream *out, PointCloud *cloud, LinkedCell *LC);
     227    bool InsertStraddlingPoints(ofstream *out, const PointCloud *cloud, const LinkedCell *LC);
    229228    double RemovePointFromTesselatedSurface(ofstream *out, class BoundaryPointSet *point);
    230229    class BoundaryLineSet * FlipBaseline(ofstream *out, class BoundaryLineSet *Base);
     
    236235    void AddBoundaryPointByDegeneratedTriangle(ofstream *out, class TesselPoint *point, LinkedCell *LC);
    237236
    238     set<TesselPoint*> * GetAllConnectedPoints(ofstream *out, TesselPoint* Point);
    239     set<BoundaryTriangleSet*> *GetAllTriangles(ofstream *out, class BoundaryPointSet *Point);
    240     list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(ofstream *out, TesselPoint* Point);
    241     list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(ofstream *out, TesselPoint* Point);
    242     list<TesselPoint*> * GetCircleOfConnectedPoints(ofstream *out, TesselPoint* Point, Vector *Reference = NULL);
    243     list<BoundaryTriangleSet*> *FindTriangles(TesselPoint* Points[3]);
    244     list<BoundaryTriangleSet*> * FindClosestTrianglesToPoint(ofstream *out, Vector *x, LinkedCell* LC);
    245     class BoundaryTriangleSet * FindClosestTriangleToPoint(ofstream *out, Vector *x, LinkedCell* LC);
    246     bool IsInnerPoint(ofstream *out, Vector Point, LinkedCell* LC);
    247     bool IsInnerPoint(ofstream *out, TesselPoint *Point, LinkedCell* LC);
    248     bool AddBoundaryPoint(TesselPoint *Walker, int n);
     237    set<TesselPoint*> * GetAllConnectedPoints(ofstream *out, const TesselPoint* const Point) const;
     238    set<BoundaryTriangleSet*> *GetAllTriangles(ofstream *out, const BoundaryPointSet * const Point) const;
     239    list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(ofstream *out, const TesselPoint* const Point) const;
     240    list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(ofstream *out, const TesselPoint* const Point) const;
     241    list<TesselPoint*> * GetCircleOfConnectedPoints(ofstream *out, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
     242    class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
     243    list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const;
     244    list<BoundaryTriangleSet*> * FindClosestTrianglesToPoint(ofstream *out, const Vector *x, const LinkedCell* LC) const;
     245    class BoundaryTriangleSet * FindClosestTriangleToPoint(ofstream *out, const Vector *x, const LinkedCell* LC) const;
     246    bool IsInnerPoint(ofstream *out, const Vector &Point, const LinkedCell* const LC) const;
     247    bool IsInnerPoint(ofstream *out, const TesselPoint * const Point, const LinkedCell* const LC) const;
     248    bool AddBoundaryPoint(TesselPoint * Walker, const int n);
    249249
    250250    // print for debugging
    251     void PrintAllBoundaryPoints(ofstream *out);
    252     void PrintAllBoundaryLines(ofstream *out);
    253     void PrintAllBoundaryTriangles(ofstream *out);
     251    void PrintAllBoundaryPoints(ofstream *out) const;
     252    void PrintAllBoundaryLines(ofstream *out) const;
     253    void PrintAllBoundaryTriangles(ofstream *out) const;
    254254
    255255    // store envelope in file
    256     void Output(ofstream *out, const char *filename, PointCloud *cloud);
     256    void Output(ofstream *out, const char *filename, const PointCloud * const cloud);
    257257
    258258    PointMap PointsOnBoundary;
     
    264264
    265265    // PointCloud implementation for PointsOnBoundary
    266     virtual Vector *GetCenter(ofstream *out);
    267     virtual TesselPoint *GetPoint();
    268     virtual TesselPoint *GetTerminalPoint();
    269     virtual void GoToNext();
    270     virtual void GoToPrevious();
    271     virtual void GoToFirst();
    272     virtual void GoToLast();
    273     virtual bool IsEmpty();
    274     virtual bool IsEnd();
     266    virtual Vector *GetCenter(ofstream *out) const;
     267    virtual TesselPoint *GetPoint() const;
     268    virtual TesselPoint *GetTerminalPoint() const;
     269    virtual void GoToNext() const;
     270    virtual void GoToPrevious() const;
     271    virtual void GoToFirst() const;
     272    virtual void GoToLast() const;
     273    virtual bool IsEmpty() const;
     274    virtual bool IsEnd() const;
    275275
    276276    class BoundaryPointSet *BPS[2];
     
    283283    class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
    284284
    285     PointMap::iterator InternalPointer;
     285    mutable PointMap::const_iterator InternalPointer;
    286286};
    287287
Note: See TracChangeset for help on using the changeset viewer.