TriDecorator class
Decorator class for Triangulations (s.
Contents
Decorator pattern in Gamma et al.).
Base classes
- class Triangulation
- Interface for Triangulation classes.
Derived classes
- class NormVecDecorator
- Decorator class which adds the functionality of estimating normals at the data points.
Constructors, destructors, conversion operators
- TriDecorator() defaulted
- Constructor for TriDecorator.
Public functions
-
void addLine(const QVector<QgsPoint>& points,
QgsInterpolator::
SourceType lineType) override - Adds a line (e.g.
- auto addPoint(const QgsPoint& point) -> int override
- Adds a point to the triangulation.
- void addTriangulation(Triangulation* t) virtual
- Adds an association to a triangulation.
- auto calcNormal(double x, double y, Vector3D* result) -> bool override
- Calculates the normal at a point on the surface and assigns it to 'result'.
- auto calcPoint(double x, double y, QgsPoint& result) -> bool override
- Calculates x-, y and z-value of the point on the surface and assigns it to 'result'.
- void eliminateHorizontalTriangles() override
- Eliminates the horizontal triangles by swapping.
- auto getNumberOfPoints() const -> int override
- Returns the number of points.
- auto getOppositePoint(int p1, int p2) -> int override
- Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedge).
- auto getPoint(int i) const -> QgsPoint* override
- Returns a pointer to the point with number i. Any virtual points must have the number -1.
- auto getPointsAroundEdge(double x, double y) -> QList<int>* override
- Returns a value list with the numbers of the four points, which would be affected by an edge swap.
- auto getSurroundingTriangles(int pointno) -> QList<int> override
- Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise) a point.
- auto getTriangle(double x, double y, QgsPoint& p1, int& n1, QgsPoint& p2, int& n2, QgsPoint& p3, int& n3) -> bool override
- Finds out in which triangle the point with coordinates x and y is and assigns the numbers of the vertices to 'n1', 'n2' and 'n3' and the vertices to 'p1', 'p2' and 'p3'.
- auto getTriangle(double x, double y, QgsPoint& p1, QgsPoint& p2, QgsPoint& p3) -> bool override
- Finds out, in which triangle the point with coordinates x and y is and assigns the points at the vertices to 'p1', 'p2' and 'p3.
- auto getXMax() const -> double override
- Returns the largest x-coordinate value of the bounding box.
- auto getXMin() const -> double override
- Returns the smallest x-coordinate value of the bounding box.
- auto getYMax() const -> double override
- Returns the largest y-coordinate value of the bounding box.
- auto getYMin() const -> double override
- Returns the smallest x-coordinate value of the bounding box.
- void performConsistencyTest() override
- Performs a consistency check, remove this later.
- auto pointInside(double x, double y) -> bool override
- Returns true, if the point with coordinates x and y is inside the convex hull and false otherwise.
- void ruppertRefinement() override
- Adds points to make the triangles better shaped (algorithm of ruppert)
- void setBreakEdgeColor(int r, int g, int b) override
- Sets the color of the breaklines.
- void setEdgeColor(int r, int g, int b) override
- Sets the color of the normal edges.
-
void setForcedCrossBehavior(Triangulation::
ForcedCrossBehavior b) override - Draws the points, edges and the forced lines.
- void setForcedEdgeColor(int r, int g, int b) override
- Sets the color of the forced edges.
- void setTriangleInterpolator(TriangleInterpolator* interpolator) override
- Sets an interpolator object.
- auto swapEdge(double x, double y) -> bool override
- Reads the content of a taff-file.
Protected variables
- Triangulation* mTIN
- Association with a Triangulation object.
Function documentation
void TriDecorator:: addLine(const QVector<QgsPoint>& points,
QgsInterpolator:: SourceType lineType) override
Adds a line (e.g.
a break-, structure- or an isoline) to the triangulation, by specifying a list of source points.
bool TriDecorator:: calcNormal(double x,
double y,
Vector3D* result) override
Calculates the normal at a point on the surface and assigns it to 'result'.
| Returns | true in case of success and false in case of failure |
|---|
int TriDecorator:: getOppositePoint(int p1,
int p2) override
Returns the number of the point opposite to the triangle points p1, p2 (which have to be on a halfedge).
Returns -1 if point is a virtual point. Returns -10 if point crosses over edges.
QList<int>* TriDecorator:: getPointsAroundEdge(double x,
double y) override
Returns a value list with the numbers of the four points, which would be affected by an edge swap.
This function is e.g. needed by NormVecDecorator to know the points, for which the normals have to be recalculated. The list has to be deleted by the code which calls this method
QList<int> TriDecorator:: getSurroundingTriangles(int pointno) override
Returns a pointer to a value list with the information of the triangles surrounding (counterclockwise) a point.
Four integer values describe a triangle, the first three are the number of the half edges of the triangle and the fourth is -10, if the third (and most counterclockwise) edge is a breakline, and -20 otherwise. Any virtual point needs to have the number -1
void TriDecorator:: setForcedCrossBehavior(Triangulation:: ForcedCrossBehavior b) override
Draws the points, edges and the forced lines.
Sets the behavior of the triangulation in case of crossing forced lines
bool TriDecorator:: swapEdge(double x,
double y) override
Reads the content of a taff-file.
Saves the content to a taff file Swaps the edge which is closest to the point with x and y coordinates (if this is possible)