35 if ( i < 0 || j < 0 || k < 0 )
37 QgsDebugMsg( QStringLiteral(
"Invalid parameters for Bernstein poly calculation!" ) );
60 double zu =
point1.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp1.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp2.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp3.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp4.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp7.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
61 double zv =
cp1.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp2.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
point2.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp4.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp5.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp8.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
62 double zw =
cp3.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp4.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp5.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp7.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp8.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp10.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
64 endpointUXY.
setZ( 3 * ( zu - zv ) );
66 endpointVXY.
setZ( 3 * ( zv - zw ) );
67 Vector3D v1( endpointUXY.
x() - x, endpointUXY.
y() - y, endpointUXY.
z() );
68 Vector3D v2( endpointVXY.
x() - x, endpointVXY.
y() - y, endpointVXY.
z() );
69 result->
setX( v1.getY()*v2.getZ() - v1.getZ()*v2.getY() );
70 result->
setY( v1.getZ()*v2.getX() - v1.getX()*v2.getZ() );
71 result->
setZ( v1.getX()*v2.getY() - v1.getY()*v2.getX() );
79 double zu =
point2.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp9.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp16.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp5.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp13.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp8.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
80 double zv =
cp9.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp16.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
point3.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp13.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp15.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp12.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
81 double zw =
cp5.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp13.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp15.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp8.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp12.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp10.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
83 endpointUXY.
setZ( 3 * ( zu - zv ) );
85 endpointVXY.
setZ( 3 * ( zv - zw ) );
86 Vector3D v1( endpointUXY.
x() - x, endpointUXY.
y() - y, endpointUXY.
z() );
87 Vector3D v2( endpointVXY.
x() - x, endpointVXY.
y() - y, endpointVXY.
z() );
88 result->
setX( v1.getY()*v2.getZ() - v1.getZ()*v2.getY() );
89 result->
setY( v1.getZ()*v2.getX() - v1.getX()*v2.getZ() );
90 result->
setZ( v1.getX()*v2.getY() - v1.getY()*v2.getX() );
99 double zu =
point3.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp14.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp6.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp15.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp11.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp12.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
100 double zv =
cp14.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp6.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
point1.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp11.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp3.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp7.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
101 double zw =
cp15.
z() *
calcBernsteinPoly( 2, 2, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp11.
z() *
calcBernsteinPoly( 2, 1, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp3.
z() *
calcBernsteinPoly( 2, 0, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp12.
z() *
calcBernsteinPoly( 2, 1, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp7.
z() *
calcBernsteinPoly( 2, 0, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp10.
z() *
calcBernsteinPoly( 2, 0, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() );
103 endpointUXY.
setZ( 3 * ( zu - zv ) );
105 endpointVXY.
setZ( 3 * ( zv - zw ) );
106 Vector3D v1( endpointUXY.
x() - x, endpointUXY.
y() - y, endpointUXY.
z() );
107 Vector3D v2( endpointVXY.
x() - x, endpointVXY.
y() - y, endpointVXY.
z() );
108 result->
setX( v1.getY()*v2.getZ() - v1.getZ()*v2.getY() );
109 result->
setY( v1.getZ()*v2.getX() - v1.getX()*v2.getZ() );
110 result->
setZ( v1.getX()*v2.getY() - v1.getY()*v2.getX() );
149 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
163 double z =
point1.
z() *
calcBernsteinPoly( 3, 3, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp1.
z() *
calcBernsteinPoly( 3, 2, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp2.
z() *
calcBernsteinPoly( 3, 1, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
point2.
z() *
calcBernsteinPoly( 3, 0, 3, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp3.
z() *
calcBernsteinPoly( 3, 2, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp4.
z() *
calcBernsteinPoly( 3, 1, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp5.
z() *
calcBernsteinPoly( 3, 0, 2, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp7.
z() *
calcBernsteinPoly( 3, 1, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp8.
z() *
calcBernsteinPoly( 3, 0, 1, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp10.
z() *
calcBernsteinPoly( 3, 0, 0, 3, barycoord.
x(), barycoord.
y(), barycoord.
z() );
173 double z =
cp10.
z() *
calcBernsteinPoly( 3, 0, 0, 3, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp8.
z() *
calcBernsteinPoly( 3, 1, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp5.
z() *
calcBernsteinPoly( 3, 2, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
point2.
z() *
calcBernsteinPoly( 3, 3, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp12.
z() *
calcBernsteinPoly( 3, 0, 1, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp13.
z() *
calcBernsteinPoly( 3, 1, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp9.
z() *
calcBernsteinPoly( 3, 2, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp15.
z() *
calcBernsteinPoly( 3, 0, 2, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp16.
z() *
calcBernsteinPoly( 3, 1, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
point3.
z() *
calcBernsteinPoly( 3, 0, 3, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() );
183 double z =
point1.
z() *
calcBernsteinPoly( 3, 0, 3, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp3.
z() *
calcBernsteinPoly( 3, 0, 2, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp7.
z() *
calcBernsteinPoly( 3, 0, 1, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp10.
z() *
calcBernsteinPoly( 3, 0, 0, 3, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp6.
z() *
calcBernsteinPoly( 3, 1, 2, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp11.
z() *
calcBernsteinPoly( 3, 1, 1, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp12.
z() *
calcBernsteinPoly( 3, 1, 0, 2, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp14.
z() *
calcBernsteinPoly( 3, 2, 1, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
cp15.
z() *
calcBernsteinPoly( 3, 2, 0, 1, barycoord.
x(), barycoord.
y(), barycoord.
z() ) +
point3.
z() *
calcBernsteinPoly( 3, 3, 0, 0, barycoord.
x(), barycoord.
y(), barycoord.
z() );
225 int ptn1, ptn2, ptn3;
230 mTIN->
getTriangle( x, y,
point1, ptn1, &v1, &state1,
point2, ptn2, &v2, &state2,
point3, ptn3, &v3, &state3 );
462 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
471 int ptn1, ptn2, ptn3;
476 mTIN->
getTriangle( x, y, &
point1, &ptn1, &v1, &state1, &
point2, &ptn2, &v2, &state2, &
point3, &ptn3, &v3, &state3 );
545 if ( state2 == NormVecDecorator::Breakline )
562 if ( state3 == NormVecDecorator::Breakline )
584 if ( state1 == NormVecDecorator::Breakline )
598 if ( state2 == NormVecDecorator::Breakline )
611 if ( state3 == NormVecDecorator::Breakline )
641 MathUtils::derVec( &cp1cp2, &odir3, &midpoint3cp4,
cp4.getX() - midpoint3.getX(),
cp4.getY() - midpoint3.getY() );
642 cp4.
setZ( midpoint3.getZ() + midpoint3cp4.
getZ() );
731 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
Decorator class which adds the functionality of estimating normals at the data points.
void setX(double x)
Sets the x-component of the vector.
QgsPoint lpoint3
Stores point3 of the last run.
void setZ(double z)
Sets the point's z-coordinate.
double der2Y
Derivative in y-direction at point2.
QgsPoint cp9
Control point 9.
void standardise()
Standardises the vector.
QgsPoint cp6
Control point 6.
virtual void setTriangulation(NormVecDecorator *tin)
QgsPoint cp2
Control point 2.
bool ANALYSIS_EXPORT BarycentricToXY(double u, double v, double w, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *result)
void init(double x, double y)
Finds out, in which triangle the point with the coordinates x and y is.
bool ANALYSIS_EXPORT calcBarycentricCoordinates(double x, double y, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *result)
Calculates the barycentric coordinates of a point (x,y) with respect to p1, p2, p3 and stores the thr...
bool getTriangle(double x, double y, QgsPoint &p1, Vector3D *v1, QgsPoint &p2, Vector3D *v2, QgsPoint &p3, Vector3D *v3)
Finds out, in which triangle a point with coordinates x and y is and assigns the triangle points to p...
QgsPoint cp14
Control point 14.
QgsPoint cp8
Control point 8.
double getZ() const
Returns the z-component of the vector.
QgsPoint point3
Third point of the triangle in x-,y-,z-coordinates.
QgsPoint cp10
Control point 10.
double der3X
Derivative in x-direction at point3.
QgsPoint cp13
Control point 13.
QgsPoint cp15
Control point 15.
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
void setZ(double z)
Sets the z-component of the vector.
double der1X
Derivative in x-direction at point1.
QgsPoint cp1
Control point 1.
QgsPoint cp5
Control point 5.
QgsPoint cp12
Control point 12.
QgsPoint lpoint1
Stores point1 of the last run.
double calcBernsteinPoly(int n, int i, int j, int k, double u, double v, double w)
Calculates the Bernsteinpolynomials to calculate the Beziertriangle. 'n' is three in the cubical case...
Point geometry type, with support for z-dimension and m-values.
void setX(double x)
Sets the point's x-coordinate.
void setY(double y)
Sets the point's y-coordinate.
QgsPoint cp4
Control point 4.
bool calcPoint(double x, double y, QgsPoint &result) override
Performs a linear interpolation in a triangle and assigns the x-,y- and z-coordinates to point...
PointState
Enumeration for the state of a point. Normal means, that the point is not on a BreakLine, BreakLine means that the point is on a breakline (but not an end point of it) and EndPoint means, that it is an endpoint of a breakline.
QgsPoint cp7
Control point 7.
double getY() const
Returns the y-component of the vector.
QgsPoint lpoint2
Stores point2 of the last run.
QgsPoint cp3
Control point 3.
double der3Y
Derivative in y-direction at point3.
void setY(double y)
Sets the y-component of the vector.
CloughTocherInterpolator()=default
Standard constructor.
bool calcNormalForPoint(double x, double y, int point, Vector3D *result)
Calculates the normal of a triangle-point for the point with coordinates x and y. This is needed...
double getX() const
Returns the x-component of the vector.
void ANALYSIS_EXPORT normalFromPoints(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, Vector3D *vec)
Calculates the normal vector of the plane through the points p1, p2 and p3 and assigns the result to ...
bool calcNormVec(double x, double y, Vector3D *result) override
Calculates the normal vector and assigns it to vec (not implemented at the moment) ...
double der1Y
Derivative in y-direction at point1.
double mEdgeTolerance
Tolerance of the barycentric coordinates at the borders of the triangles (to prevent errors because o...
double der2X
Derivative in x-direction at point2.
QgsPoint cp11
Control point 11.
QgsPoint point2
Second point of the triangle in x-,y-,z-coordinates.
QgsPoint cp16
Control point 16.
QgsPoint point1
First point of the triangle in x-,y-,z-coordinates.
bool ANALYSIS_EXPORT derVec(const Vector3D *v1, const Vector3D *v2, Vector3D *result, double x, double y)
Calculates the z-component of a vector with coordinates 'x' and 'y'which is in the same tangent plane...
int ANALYSIS_EXPORT faculty(int n)
Faculty function.
NormVecDecorator * mTIN
Association with a triangulation object.