EndPoint.h
Go to the documentation of this file.00001
00002 #ifndef _ENDPOINT_H_
00003 #define _ENDPOINT_H_
00004
00005 #include "Shared/Measures.h"
00006 #include "Point.h"
00007
00008 namespace DualCoding {
00009
00010 class EndPoint : public Point {
00011 private:
00012
00013
00014 bool valid;
00015
00016
00017
00018 bool active;
00019
00020
00021 mutable bool rendering_valid;
00022
00023
00024 int nsamples;
00025
00026 public:
00027 friend class LineData;
00028 friend class BoundaryDetector;
00029 friend class PolygonData;
00030
00031 EndPoint()
00032 : Point(), valid(true), active(true), rendering_valid(false), nsamples(1) {};
00033
00034 EndPoint(coordinate_t const &xp, coordinate_t const &yp, coordinate_t const &zp=0)
00035 : Point(xp,yp,zp), valid(true), active(true), rendering_valid(false), nsamples(1) {};
00036
00037 EndPoint(const Point& otherPt)
00038 : Point(otherPt), valid(true), active(true), rendering_valid(false), nsamples(1) {};
00039
00040 bool isValid() const { return valid; }
00041 void setValid(bool _valid) { valid = _valid; }
00042
00043 bool isActive() const { return active; }
00044 void setActive(bool _active) {
00045 if ( active != _active ) rendering_valid = false;
00046 active = _active;
00047 }
00048
00049 bool isMatchFor(const EndPoint& other, float dist_thresh) const {return distanceFrom(other) <= dist_thresh; }
00050 bool operator==(const EndPoint& other) const { return isMatchFor(other,5); }
00051
00052
00053
00054
00055 void checkValidity(int width, int height, int edge_thresh);
00056
00057 void updateParams(const EndPoint& other);
00058 void updateParams(const EndPoint& other, unsigned int num_updates);
00059
00060 private:
00061 void clearNumUpdates(void) { nsamples=0; };
00062 void setNumUpdates(long _nsamples) { nsamples = _nsamples; };
00063
00064 public:
00065 void incrementNumUpdates(void) { nsamples++; };
00066 void decrementNumUpdates(void) { nsamples--; };
00067 int numUpdates(void) const { return nsamples; };
00068 };
00069
00070 }
00071
00072 #endif