17 #ifndef DUALEDGETRIANGULATION_H 18 #define DUALEDGETRIANGULATION_H 29 #include <QTextStream> 30 #include <QMessageBox> 33 #include <QStringList> 34 #include <QProgressDialog> 70 virtual double getXMax()
const override {
return xMax; }
72 virtual double getXMin()
const override {
return xMin; }
74 virtual double getYMax()
const override {
return yMax; }
76 virtual double getYMin()
const override {
return yMin; }
82 virtual void setEdgeColor(
int r,
int g,
int b )
override;
100 virtual bool swapEdge(
double x,
double y )
override;
117 const static unsigned int mDefaultStorageForPoints = 100000;
121 const static unsigned int mDefaultStorageForHalfEdges = 300006;
137 unsigned int insertEdge(
int dual,
int next,
int point,
bool mbreak,
bool forced );
139 int insertForcedSegment(
int p1,
int p2,
bool breakline );
143 const static int nBaseOfRuns = 300000;
145 int baseEdgeOfPoint(
int point );
147 int baseEdgeOfTriangle(
Point3D* point );
149 bool checkSwap(
unsigned int edge,
unsigned int recursiveDeep );
151 void doSwap(
unsigned int edge,
unsigned int recursiveDeep );
153 void doOnlySwap(
unsigned int edge );
165 bool swapPossible(
unsigned int edge );
169 bool halfEdgeBBoxTest(
int edge,
double xlowleft,
double ylowleft,
double xupright,
double yupright )
const;
171 double swapMinAngle(
int edge )
const;
173 int splitHalfEdge(
int edge,
float position );
175 bool edgeOnConvexHull(
int edge );
185 , mTriangleInterpolator( nullptr )
187 , mEdgeColor( 0, 255, 0 )
188 , mForcedEdgeColor( 0, 0, 255 )
189 , mBreakEdgeColor( 100, 100, 0 )
193 , mEdgeWithPoint( 0 )
195 , mTwiceInsPoint( 0 )
Triangulation * mDecorator
Pointer to the decorator using this triangulation.
Triangulation::forcedCrossBehaviour mForcedCrossBehaviour
Member to store the behaviour in case of crossing forced segments.
QVector< Point3D * > mPointVector
Stores pointers to all points in the triangulations (including the points contained in the lines) ...
virtual int addPoint(Point3D *p)=0
Adds a point to the triangulation Ownership is transferred to this class.
virtual bool swapEdge(double x, double y)=0
Reads the content of a taff-file.
virtual void setBreakEdgeColor(int r, int g, int b)=0
Sets the color of the breaklines.
virtual void setEdgeColor(int r, int g, int b)=0
Sets the color of the normal edges.
int mTwiceInsPoint
If a point has been inserted twice, its number is stored in this member.
static const unsigned int mDefaultStorageForHalfEdges
Default value for the number of storable HalfEdges at the beginning.
the status of the first inserted forced line is reset to that of a normal edge (so that the second in...
virtual bool calcPoint(double x, double y, Point3D *result)=0
Calculates x-, y and z-value of the point on the surface and assigns it to 'result'.
bool halfEdgeBBoxTest(int edge, double xlowleft, double ylowleft, double xupright, double yupright) const
Tests, if the bounding box of the halfedge with index i intersects the specified bounding box...
virtual bool saveAsShapefile(const QString &fileName) const =0
Saves the triangulation as a (line) shapefile.
double yMin
Y-coordinate of the lower left corner of the bounding box.
virtual int getNumberOfPoints() const override
Returns the number of points.
virtual void performConsistencyTest()=0
Performs a consistency check, remove this later.
virtual void ruppertRefinement()=0
Adds points to make the triangles better shaped (algorithm of ruppert)
This class represents a line.
double xMax
X-coordinate of the upper right corner of the bounding box.
unsigned int mUnstableEdge
If an instability occurs in 'baseEdgeOfTriangle', mUnstableEdge is set to the value of the current ed...
forcedCrossBehaviour
Enumeration describing the behaviour, if two forced lines cross.
DualEdgeTriangulation is an implementation of a triangulation class based on the dual edge data struc...
static const unsigned int mDefaultStorageForPoints
Default value for the number of storable points at the beginning.
virtual bool pointInside(double x, double y)=0
Returns true, if the point with coordinates x and y is inside the convex hull and false otherwise...
Point3D is a class to represent a three dimensional point.
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
virtual double getYMax() const override
Returns the largest y-coordinate value of the bounding box.
This is an interface for interpolator classes for triangulations.
double yMax
Y-coordinate of the upper right corner of the bounding box.
void setDecorator(Triangulation *d)
virtual QList< int > * getSurroundingTriangles(int pointno)=0
Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise...
QColor mForcedEdgeColor
Color to paint the forced edges.
virtual double getYMin() const override
Returns the smallest x-coordinate value of the bounding box.
virtual double getXMax() const override
Returns the largest x-coordinate value of the bounding box.
virtual Point3D * getPoint(unsigned int i) const override
Draws the points, edges and the forced lines.
virtual int getNumberOfPoints() const =0
Returns the number of points.
virtual void addLine(Line3D *line, bool breakline)=0
Adds a line (e.g.
virtual void setForcedEdgeColor(int r, int g, int b)=0
Sets the color of the forced edges.
Interface for Triangulation classes.
QColor mBreakEdgeColor
Color to paint the breaklines.
virtual void setForcedCrossBehaviour(Triangulation::forcedCrossBehaviour b)=0
Draws the points, edges and the forced lines.
unsigned int mEdgeWithPoint
If an inserted point is exactly on an existing edge, 'baseEdgeOfTriangle' returns -20 and sets the va...
virtual double getXMin() const override
Returns the smallest x-coordinate value of the bounding box.
unsigned int mEdgeInside
Number of an edge which does not point to the virtual point.
TriangleInterpolator * mTriangleInterpolator
Association to an interpolator object.
virtual bool calcNormal(double x, double y, Vector3D *result)=0
Calculates the normal at a point on the surface and assigns it to 'result'.
virtual bool getTriangle(double x, double y, Point3D *p1, int *n1, Point3D *p2, int *n2, Point3D *p3, int *n3)=0
Finds out in which triangle the point with coordinates x and y is and assigns the numbers of the vert...
const T & at(int i) const
QVector< HalfEdge * > mHalfEdge
Stores pointers to the HalfEdges.
virtual QList< int > * getPointsAroundEdge(double x, double y)=0
Returns a value list with the numbers of the four points, which would be affected by an edge swap...
int count(const T &value) const
virtual void eliminateHorizontalTriangles()=0
Eliminates the horizontal triangles by swapping.
QColor mEdgeColor
Color to paint the normal edges.
virtual Point3D * getPoint(unsigned int i) const =0
Returns a pointer to the point with number i.
double xMin
X-coordinate of the lower left corner of the bounding box.
virtual int getOppositePoint(int p1, int p2)=0
Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedg...
unsigned int mEdgeOutside
Number of an edge on the outside of the convex hull.
virtual void setTriangleInterpolator(TriangleInterpolator *interpolator)=0
Sets an interpolator object.