17 const std::vector<ccMPlanePoint> &fittingPoints,
18 const QString &planeName)
const {
21 static_cast<unsigned int>(fittingPoints.size()));
22 std::for_each(fittingPoints.cbegin(), fittingPoints.cend(),
24 planeCloud.addPoint(point.getCoordinates());
30 setupPlaneUiDisplay(plane, planeName);
40 bool signedMeasurement)
const {
47 std::tie(scalarFieldPlane, scalarIndex) =
48 findOrCreateScalarfieldForCloud(cloud);
49 scalarFieldPlane->clear();
51 addPointDistancesToScalarfield(scalarFieldPlane, cloud, equation,
64 if (scalarIndex != -1) {
73 bool signedMeasurement)
const {
77 if (signedMeasurement) {
82 computePoint2PlaneDistance(&
point, equation));
86 void ccMeasurementDevice::setupPlaneUiDisplay(
ccPlane *plane,
87 const QString planeName)
const {
98 std::tuple<ccScalarField *, int>
99 ccMeasurementDevice::findOrCreateScalarfieldForCloud(
104 if (scalarIndex == -1) {
106 scalarFieldPlane->reserve(cloud->
size());
112 return std::make_tuple(scalarFieldPlane, scalarIndex);
115 void ccMeasurementDevice::addPointDistancesToScalarfield(
119 bool signedMeasurement)
const {
120 for (
unsigned int i = 0; i < cloud->
size(); ++i) {
122 if (signedMeasurement) {
125 computePoint2PlaneDistance(P, equation));
129 computePoint2PlaneDistance(P, equation)));
float PointCoordinateType
Type of the coordinates of a (N-D) point.
constexpr char const * MPLANE_SCALARFIELD_NAME
virtual void setVisible(bool state)
Sets entity visibility.
virtual void showColors(bool state)
Sets colors visibility.
virtual void showSF(bool state)
Sets active scalarfield visibility.
virtual void setOpacity(float opacity)
Set opacity activation state.
void enableStippling(bool state)
Enables polygon stippling.
virtual void setColor(const ecvColor::Rgb &col)
Sets primitive color (shortcut)
void applyGLTransformation_recursive(const ccGLMatrix *trans=nullptr)
Applies the active OpenGL transformation to the entity (recursive)
virtual void setSelectionBehavior(SelectionBehavior mode)
Sets selection behavior (when displayed)
virtual void redrawDisplay(bool forceRedraw=true, bool only2D=false)
Redraws associated display.
void createScalarFieldForCloud(const ccPlane *plane, ccPointCloud *cloud, bool signedMeasurement) const
void deleteScalarFieldFromCloud(ccPointCloud *cloud) const
ccPlane * fitPlaneToPoints(const std::vector< ccMPlanePoint > &fittingPoints, const QString &planeName) const
float measurePointToPlaneDistance(const ccPlane *plane, const CCVector3 &point, bool signedMeasurement) const
virtual void setName(const QString &name)
Sets object name.
static ccPlane * Fit(cloudViewer::GenericIndexedCloudPersist *cloud, double *rms=0)
Fits a plane primitive on a cloud.
CCVector3 getNormal() const override
Returns the entity normal.
void getEquation(CCVector3 &N, PointCoordinateType &constVal) const
Returns the equation of the plane.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
void setCurrentDisplayedScalarField(int index)
Sets the currently displayed scalar field.
int addScalarField(const char *uniqueName) override
Creates a new scalar field and registers it.
void showSFColorsScale(bool state)
Sets whether color scale should be displayed or not.
void deleteScalarField(int index) override
Deletes a specific scalar field.
bool reserveThePointsTable(unsigned _numberOfPoints)
Reserves memory to store the points coordinates.
A scalar field associated to display-related parameters.
void computeMinAndMax() override
Determines the min and max values.
int getScalarFieldIndexByName(const char *name) const
Returns the index of a scalar field represented by its name.
ScalarField * getScalarField(int index) const
Returns a pointer to a specific scalar field.
unsigned size() const override
const CCVector3 * getPoint(unsigned index) const override
void addElement(ScalarType value)
__host__ __device__ int2 abs(int2 v)