QGIS API Documentation 3.99.0-Master (09f76ad7019)
Loading...
Searching...
No Matches
NormVecDecorator.h
Go to the documentation of this file.
1/***************************************************************************
2 NormVecDecorator.h - description
3 -------------------
4 copyright : (C) 2004 by Marco Hugentobler
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef NORMVECDECORATOR_H
18#define NORMVECDECORATOR_H
19
20#include "MathUtils.h"
21#include "TriDecorator.h"
23#include "qgis_analysis.h"
24#include "qgis_sip.h"
25#include "qgslogger.h"
26
27#include <QString>
28
29using namespace Qt::StringLiterals;
30
31#define SIP_NO_FILE
32
33class QgsFeedback;
34
40class ANALYSIS_EXPORT NormVecDecorator : public TriDecorator
41{
42 public:
53 ~NormVecDecorator() override;
54 int addPoint( const QgsPoint &p ) override;
56 bool calcNormal( double x, double y, QgsPoint &result SIP_OUT ) override;
58 bool calcNormalForPoint( double x, double y, int pointIndex, Vector3D *result SIP_OUT );
59 bool calcPoint( double x, double y, QgsPoint &result SIP_OUT ) override;
61 void eliminateHorizontalTriangles() override;
63 bool estimateFirstDerivative( int pointno );
65 bool estimateFirstDerivatives( QgsFeedback *feedback = nullptr );
67 Vector3D *getNormal( int n ) const;
69 bool getTriangle( double x, double y, QgsPoint &p1 SIP_OUT, Vector3D *v1 SIP_OUT, QgsPoint &p2 SIP_OUT, Vector3D *v2 SIP_OUT, QgsPoint &p3 SIP_OUT, Vector3D *v3 SIP_OUT ) SIP_PYNAME( getTriangleVertices );
71 bool getTriangle( double x, double y, QgsPoint &p1 SIP_OUT, int &ptn1 SIP_OUT, Vector3D *v1 SIP_OUT, PointState *state1 SIP_OUT, QgsPoint &p2 SIP_OUT, int &ptn2 SIP_OUT, Vector3D *v2 SIP_OUT, PointState *state2 SIP_OUT, QgsPoint &p3 SIP_OUT, int &ptn3 SIP_OUT, Vector3D *v3 SIP_OUT, PointState *state3 SIP_OUT );
73 PointState getState( int pointno ) const;
75 void setTriangleInterpolator( TriangleInterpolator *inter ) override;
77 bool swapEdge( double x, double y ) override;
78
79 bool saveTriangulation( QgsFeatureSink *sink, QgsFeedback *feedback = nullptr ) const override;
80
81 QgsMesh triangulationToMesh( QgsFeedback *feedback = nullptr ) const override;
82
83 protected:
86 static const unsigned int DEFAULT_STORAGE_FOR_NORMALS = 100000;
90 QVector<Vector3D *> *mNormVec;
92 QVector<PointState> *mPointState;
94 void setState( int pointno, PointState s );
95
96 private:
97 NormVecDecorator( const NormVecDecorator & ) = delete;
98 NormVecDecorator &operator=( const NormVecDecorator & ) = delete;
99};
100
101#ifndef SIP_RUN
102
109
117
122
124{
125 if ( mNormVec )
126 {
127 return mNormVec->at( n );
128 }
129 else
130 {
131 QgsDebugError( u"warning, null pointer"_s );
132 return nullptr;
133 }
134}
135
136#endif
137
138#endif
Decorator class which adds the functionality of estimating normals at the data points.
void setTriangleInterpolator(TriangleInterpolator *inter) override
Sets an interpolator.
QVector< PointState > * mPointState
Vector who stores, it a point is not on a breakline, if it is a normal point of the breakline or if i...
bool alreadyestimated
Is true, if the normals already have been estimated.
Vector3D * getNormal(int n) const
Returns a pointer to the normal vector for the point with the number n.
static const unsigned int DEFAULT_STORAGE_FOR_NORMALS
TriangleInterpolator * mInterpolator
Association with an interpolator object.
void setState(int pointno, PointState s)
Sets the state (BreakLine, Normal, EndPoint) of a point.
QVector< Vector3D * > * mNormVec
Vector that stores the normals for the points. If 'estimateFirstDerivatives()' was called and there i...
PointState
Enumeration for the state of a point. Normal means, that the point is not on a BreakLine,...
An interface for objects which accept features via addFeature(s) methods.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:53
Interface for Triangulation classes.
virtual QgsMesh triangulationToMesh(QgsFeedback *feedback=nullptr) const =0
Returns a QgsMesh corresponding to the triangulation.
virtual bool saveTriangulation(QgsFeatureSink *sink, QgsFeedback *feedback=nullptr) const =0
Saves the triangulation features to a feature sink.
bool swapEdge(double x, double y) override
Reads the content of a taff-file.
void setTriangleInterpolator(TriangleInterpolator *interpolator) override
Sets an interpolator object.
void eliminateHorizontalTriangles() override
Eliminates the horizontal triangles by swapping.
int addPoint(const QgsPoint &p) override
Adds a point to the triangulation.
TriDecorator()=default
bool calcPoint(double x, double y, QgsPoint &result) override
Calculates x-, y and z-value of the point on the surface and assigns it to 'result'.
bool calcNormal(double x, double y, QgsPoint &result) override
Calculates the normal at a point on the surface and assigns it to 'result'.
An interface for interpolator classes for triangulations.
Represents a 3D-Vector, capable of storing x, y and z-coordinates in double values.
Definition Vector3D.h:37
#define SIP_PYNAME(name)
Definition qgis_sip.h:89
#define SIP_OUT
Definition qgis_sip.h:58
#define QgsDebugError(str)
Definition qgslogger.h:59
Mesh - vertices, edges and faces.