18 QString&
error)
const {
25 error =
"invalid feature type";
30 error =
"Neighborhood features shouldn't be associated to a STAT "
36 error =
"Feature has a second cloud associated but no MATH operation "
41 if (std::isnan(
scale)) {
42 error =
"No scale defined";
57 error =
"internal error (no input core points)";
72 resultSFName +=
"@" + QString::number(
scale);
90 error = QString(
"Failed to prepare scalar %1 @ scale %2")
100 QString::number(
scale);
107 generatedScalarFields,
112 error = QString(
"Failed to prepare scalar field for %1 @ scale %2")
126 error =
"internal error (no input core points)";
140 corePoints.cloud->setCurrentDisplayedScalarField(sfIndex1);
150 error =
"Failed to perform the MATH operation";
199 double& outputValue)
const {
200 outputValue = std::numeric_limits<double>::quiet_NaN();
202 size_t kNN = pointsInNeighbourhood.size();
247 &pointsInNeighbourhood,
static_cast<unsigned>(kNN));
254 &pointsInNeighbourhood,
static_cast<unsigned>(kNN));
263 &pointsInNeighbourhood,
static_cast<unsigned>(kNN));
272 outputValue = (
type ==
Dip ? dip_deg : dipDir_deg);
278 outputValue =
static_cast<double>(kNN);
283 &pointsInNeighbourhood,
static_cast<unsigned>(kNN));
290 &pointsInNeighbourhood,
static_cast<unsigned>(kNN));
303 minZ = maxZ = pointsInNeighbourhood[0].point->z;
304 for (
size_t i = 1; i < kNN; ++i) {
305 if (minZ > pointsInNeighbourhood[i].
point->z)
306 minZ = pointsInNeighbourhood[i].point->z;
307 else if (maxZ < pointsInNeighbourhood[i].
point->z)
308 maxZ = pointsInNeighbourhood[i].point->z;
312 outputValue = maxZ - minZ;
314 outputValue = maxZ - queryPoint.
z;
316 outputValue = queryPoint.
z - minZ;
327 &pointsInNeighbourhood,
static_cast<unsigned>(kNN));
331 double r = sqrt(pointsInNeighbourhood.back().squareDistd);
332 if (r > std::numeric_limits<double>::epsilon()) {
333 double d = (queryPoint - *G).normd();
constexpr PointCoordinateType PC_ONE
'1' as a PointCoordinateType value
float PointCoordinateType
Type of the coordinates of a (N-D) point.
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
bool setBehavior(cloudViewer::ScalarField *sf, Behavior behavior)
static void ConvertNormalToDipAndDipDir(const CCVector3 &N, PointCoordinateType &dip_deg, PointCoordinateType &dipDir_deg)
Converts a normal vector to geological 'dip direction & dip' parameters.
A kind of ReferenceCloud based on the DgmOctree::NeighboursSet structure.
std::vector< PointDescriptor > NeighboursSet
A set of neighbours.
ScalarType computeCurvature(const CCVector3 &P, CurvatureType cType)
Computes the curvature of a set of point (by fitting a 2.5D quadric)
ScalarType computeRoughness(const CCVector3 &P, const CCVector3 *roughnessUpDir=nullptr)
const CCVector3 * getGravityCenter()
Returns gravity center.
GeomFeature
Geometric feature computed from eigen values/vectors.
const CCVector3 * getLSPlaneNormal()
Returns best interpolating plane (Least-square) normal vector.
double computeFeature(GeomFeature feature)
Computes the given feature on a set of point.
ScalarType computeMomentOrder1(const CCVector3 &P)
virtual void computeMinAndMax()
Determines the min and max values.
const char * getName() const
Returns scalar field name.
static void error(char *msg)
static bool CheckSFExistence(ccPointCloud *cloud, const char *resultSFName)
virtual bool checkValidity(QString corePointRole, QString &error) const
Checks the feature definition validity.
bool sf2WasAlreadyExisting
static ScalarType PerformMathOp(double s1, double s2, Operation op)
Performs a mathematical operation between two scalars.
static QString OpToString(Operation op)
double scale
Scale (diameter)
static cloudViewer::ScalarField * PrepareSF(ccPointCloud *cloud, const char *resultSFName, SFCollector *generatedScalarFields, SFCollector::Behavior behavior)
bool sf1WasAlreadyExisting
bool computeValue(cloudViewer::DgmOctree::NeighboursSet &pointsInNeighbourhood, const CCVector3 &queryPoint, double &outputValue) const
Compute the feature value on a set of points.
cloudViewer::ScalarField * sf1
Feature values.
virtual bool prepare(const CorePoints &corePoints, QString &error, cloudViewer::GenericProgressCallback *progressCb=nullptr, SFCollector *generatedScalarFields=nullptr) override
Prepares the feature (compute the scalar field, etc.)
virtual bool checkValidity(QString corePointRole, QString &error) const override
Checks the feature definition validity.
virtual bool finish(const CorePoints &corePoints, QString &error) override
Finishes the feature preparation (update the scalar field, etc.)
virtual QString toString() const override
Returns the formatted description.
NeighborhoodFeatureType type
Neighborhood feature type.
cloudViewer::ScalarField * sf2
static QString ToString(NeighborhoodFeatureType type)