ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvCropTool.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // CV_DB_LIB
11 #include <ecvBBox.h>
12 
13 class ccHObject;
14 class ccGLMatrix;
15 
17 
19 class ccCropTool {
20 public:
22 
28  static ccHObject* Crop(ccHObject* entity,
29  const ccBBox& box,
30  bool inside = true,
31  const ccGLMatrix* meshRotation = 0);
32 };
ccPointCloud::addScalarField
int addScalarField(const char *uniqueName) override
Creates a new scalar field and registers it.
Definition: ecvPointCloud.cpp:4210
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
ecvMaterial.h
ccGenericMesh::materialsShown
virtual bool materialsShown() const
Sets whether textures/material should be displayed or not.
Definition: ecvGenericMesh.h:198
TexCoords2D
2D texture coordinates
Definition: ecvAdvancedTypes.h:138
ccGenericMesh::showNormals
void showNormals(bool state) override
Sets normals visibility.
Definition: ecvGenericMesh.cpp:44
ecvCropTool.h
ccObject::isKindOf
bool isKindOf(CV_CLASS_ENUM type) const
Definition: ecvObject.h:128
ccMaterial::Shared
QSharedPointer< ccMaterial > Shared
Shared type.
Definition: ecvMaterial.h:33
ccMesh::computePerVertexNormals
bool computePerVertexNormals()
Computes per-vertex normals.
Definition: ecvMesh.cpp:246
cloudViewer::ManualSegmentationTools::MeshCutterParams
Input/output parameters for the segmentMeshWithAAPlane method.
Definition: ManualSegmentationTools.h:121
ccArray::currentSize
unsigned currentSize() const
Definition: ecvArray.h:112
Tuple3Tpl::x
Type x
Definition: CVGeom.h:137
cloudViewer::ReferenceCloud::size
unsigned size() const override
Returns the number of points.
Definition: ReferenceCloud.h:41
ccGLMatrixTpl::inverse
ccGLMatrixTpl< T > inverse() const
Returns inverse transformation.
Definition: ecvGLMatrixTpl.h:1325
cloudViewer::VerticesIndexes::i2
unsigned i2
Definition: GenericIndexedMesh.h:19
ccMaterialSet::clone
ccMaterialSet * clone() const
Clones materials set.
Definition: ecvMaterialSet.cpp:655
ccDrawableObject::normalsShown
virtual bool normalsShown() const
Returns whether normals are shown or not.
Definition: ecvDrawableObject.h:91
ccGenericMesh::hasTriNormals
virtual bool hasTriNormals() const =0
Returns whether the mesh has per-triangle normals.
ccGenericMesh::getTriangleMtlIndex
virtual int getTriangleMtlIndex(unsigned triangleIndex) const =0
Returns a given triangle material indexes.
ccGenericMesh::computeInterpolationWeights
virtual void computeInterpolationWeights(unsigned triIndex, const CCVector3 &P, CCVector3d &weights) const
Returns the (barycentric) interpolation weights for a given triangle.
Definition: ecvGenericMesh.cpp:476
cloudViewer::VerticesIndexes
Triangle described by the indexes of its 3 vertices.
Definition: GenericIndexedMesh.h:16
ccMesh::size
virtual unsigned size() const override
Returns the number of triangles.
Definition: ecvMesh.cpp:2143
ccPointCloud::crop
cloudViewer::ReferenceCloud * crop(const ccBBox &box, bool inside=true) override
Crops the cloud inside (or outside) a bounding box.
Definition: ecvPointCloud.cpp:4900
ccGenericMesh::hasPerTriangleTexCoordIndexes
virtual bool hasPerTriangleTexCoordIndexes() const =0
Returns whether this mesh as per-triangle triplets of tex coords indexes.
cloudViewer::ScalarField::getValue
ScalarType & getValue(std::size_t index)
Definition: ScalarField.h:92
cloudViewer::ManualSegmentationTools::MeshCutterParams::bbMax
CCVector3d bbMax
Definition: ManualSegmentationTools.h:130
ccGenericMesh::getMaterialSet
virtual const ccMaterialSet * getMaterialSet() const =0
CV_TYPES::MESH
@ MESH
Definition: CVTypes.h:105
ccDrawableObject::setGLTransformation
virtual void setGLTransformation(const ccGLMatrix &trans)
Associates entity with a GL transformation (rotation + translation)
Definition: ecvDrawableObject.cpp:54
ccMesh::getTriangleVertIndexes
cloudViewer::VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex) override
Returns the indexes of the vertices of a given triangle.
Definition: ecvMesh.cpp:2599
ccMesh::addTriangleTexCoordIndexes
void addTriangleTexCoordIndexes(int i1, int i2, int i3)
Adds a triplet of tex coords indexes for next triangle.
Definition: ecvMesh.cpp:3678
ccPointCloud::unallocateColors
void unallocateColors()
Erases the cloud colors.
Definition: ecvPointCloud.cpp:1171
ccObject::isA
bool isA(CV_CLASS_ENUM type) const
Definition: ecvObject.h:131
ccBBox
Bounding box structure.
Definition: ecvBBox.h:25
cloudViewer::PointCloudTpl::getNumberOfScalarFields
unsigned getNumberOfScalarFields() const
Returns the number of associated (and active) scalar fields.
Definition: PointCloudTpl.h:345
ccMesh::setMaterialSet
void setMaterialSet(ccMaterialSet *materialSet, bool autoReleaseOldMaterialSet=true)
Sets associated material set (may be shared)
Definition: ecvMesh.cpp:492
CV_TYPES::POINT_CLOUD
@ POINT_CLOUD
Definition: CVTypes.h:104
ccGenericMesh::getAssociatedCloud
virtual ccGenericPointCloud * getAssociatedCloud() const =0
Returns the vertices cloud.
cloudViewer::PointCloudTpl::getPoint
const CCVector3 * getPoint(unsigned index) const override
Definition: PointCloudTpl.h:143
ecvBBox.h
cloudViewer::ManualSegmentationTools::MeshCutterParams::generateOutsideMesh
bool generateOutsideMesh
Definition: ManualSegmentationTools.h:124
ccGenericMesh::importParametersFrom
void importParametersFrom(const ccGenericMesh *mesh)
Imports the parameters from another mesh.
Definition: ecvGenericMesh.cpp:452
cloudViewer::ManualSegmentationTools::MeshCutterParams::outsideMesh
SimpleMesh * outsideMesh
Definition: ManualSegmentationTools.h:123
CVLog.h
cloudViewer::PointCloudTpl::size
unsigned size() const override
Definition: PointCloudTpl.h:38
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
ccPointCloud::resizeTheRGBTable
bool resizeTheRGBTable(bool fillWithWhite=false)
Resizes the RGB colors array.
Definition: ecvPointCloud.cpp:1226
ccGenericMesh::getTriangleTexCoordinates
virtual void getTriangleTexCoordinates(unsigned triIndex, TexCoords2D *&tx1, TexCoords2D *&tx2, TexCoords2D *&tx3) const =0
Returns per-triangle texture coordinates (pointer to)
cloudViewer::ScalarField
A simple scalar field (to be associated to a point cloud)
Definition: ScalarField.h:25
ccPointCloud::From
static ccPointCloud * From(const cloudViewer::GenericIndexedCloud *cloud, const ccGenericPointCloud *sourceCloud=nullptr)
Creates a new point cloud object from a GenericIndexedCloud.
Definition: ecvPointCloud.cpp:114
cloudViewer::GenericCloud::getPointScalarValue
virtual ScalarType getPointScalarValue(unsigned pointIndex) const =0
Returns the ith point associated scalar value.
ccGenericMesh::hasMaterials
virtual bool hasMaterials() const =0
ccDrawableObject::hasScalarFields
virtual bool hasScalarFields() const
Returns whether one or more scalar fields are instantiated.
Definition: ecvDrawableObject.h:105
ccDrawableObject::hasNormals
virtual bool hasNormals() const
Returns whether normals are enabled or not.
Definition: ecvDrawableObject.h:89
ccPointCloud::setCurrentDisplayedScalarField
void setCurrentDisplayedScalarField(int index)
Sets the currently displayed scalar field.
Definition: ecvPointCloud.cpp:3227
cloudViewer::PointCloudTpl::getScalarField
ScalarField * getScalarField(int index) const
Returns a pointer to a specific scalar field.
Definition: PointCloudTpl.h:354
ccGenericPointCloud::importParametersFrom
void importParametersFrom(const ccGenericPointCloud *cloud)
Imports the parameters from another cloud.
Definition: ecvGenericPointCloud.cpp:228
cloudViewer::ManualSegmentationTools::MeshCutterParams::trackOrigIndexes
bool trackOrigIndexes
Definition: ManualSegmentationTools.h:132
ManualSegmentationTools.h
ccMesh::reservePerTriangleMtlIndexes
bool reservePerTriangleMtlIndexes()
Reserves memory to store per-triangle material index.
Definition: ecvMesh.cpp:3734
cloudViewer::ScalarField::fill
void fill(ScalarType fillValue=0)
Fills the array with a particular value.
Definition: ScalarField.h:77
ccDrawableObject::showColors
virtual void showColors(bool state)
Sets colors visibility.
Definition: ecvDrawableObject.h:84
size
int size
Definition: FileIOFactory.cpp:130
ecvColor::LookUpTable::at
Rgb at(size_t color_id)
Definition: ecvColorTypes.cpp:77
ccMesh::getTriangleMtlIndex
int getTriangleMtlIndex(unsigned triangleIndex) const override
Returns a given triangle material indexes.
Definition: ecvMesh.cpp:3761
ccArray::reserveSafe
bool reserveSafe(size_t count)
Reserves memory (no exception thrown)
Definition: ecvArray.h:56
ccMaterial
Mesh (triangle) material.
Definition: ecvMaterial.h:28
ccGenericPointCloud
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
SimpleMesh.h
Vector3Tpl< PointCoordinateType >
TexCoords2D::tx
float tx
Definition: ecvAdvancedTypes.h:144
ccPointCloud::partialClone
ccPointCloud * partialClone(const cloudViewer::ReferenceCloud *selection, int *warnings=nullptr, bool withChildEntities=true) const
Creates a new point cloud object from a ReferenceCloud (selection)
Definition: ecvPointCloud.cpp:290
cloudViewer::SimpleMesh::vertices
const GenericIndexedCloud * vertices() const
Returns the vertices.
Definition: SimpleMesh.h:67
ccHObject::applyGLTransformation_recursive
void applyGLTransformation_recursive(const ccGLMatrix *trans=nullptr)
Applies the active OpenGL transformation to the entity (recursive)
Definition: ecvHObject.cpp:948
cloudViewer::ManualSegmentationTools::MeshCutterParams::origTriIndexesMapOutside
std::vector< unsigned > origTriIndexesMapOutside
Definition: ManualSegmentationTools.h:134
cloudViewer::VerticesIndexes::i3
unsigned i3
Definition: GenericIndexedMesh.h:19
ccCropTool::Crop
static ccHObject * Crop(ccHObject *entity, const ccBBox &box, bool inside=true, const ccGLMatrix *meshRotation=0)
Crops the input entity.
Definition: ecvCropTool.cpp:23
cloudViewer::VerticesIndexes::i
unsigned i[3]
Definition: GenericIndexedMesh.h:21
ecvMesh.h
ccArray::addElement
void addElement(const Type &value)
Definition: ecvArray.h:105
ecvScalarField.h
ccGenericMesh
Generic mesh interface.
Definition: ecvGenericMesh.h:28
ccDrawableObject::colorsShown
virtual bool colorsShown() const
Returns whether colors are shown or not.
Definition: ecvDrawableObject.h:82
TextureCoordsContainer
Array of 2D texture coordinates.
Definition: ecvAdvancedTypes.h:151
ccDrawableObject::showSF
virtual void showSF(bool state)
Sets active scalarfield visibility.
Definition: ecvDrawableObject.h:108
ccMesh::setTexCoordinatesTable
void setTexCoordinatesTable(TextureCoordsContainer *texCoordsTable, bool autoReleaseOldTable=true)
Sets per-triangle texture coordinates array (may be shared)
Definition: ecvMesh.cpp:3598
ccGenericMesh::interpolateColors
virtual bool interpolateColors(unsigned triIndex, const CCVector3 &P, ecvColor::Rgb &C)=0
Interpolates RGB colors inside a given triangle.
Tuple3Tpl::z
Type z
Definition: CVGeom.h:137
ccMesh::computePerTriangleNormals
bool computePerTriangleNormals()
Computes per-triangle normals.
Definition: ecvMesh.cpp:331
TexCoords2D::ty
float ty
Definition: ecvAdvancedTypes.h:144
cloudViewer::ManualSegmentationTools::MeshCutterParams::insideMesh
SimpleMesh * insideMesh
Definition: ManualSegmentationTools.h:122
cloudViewer::GenericIndexedMesh::getTriangleVertIndexes
virtual VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex)=0
Returns the indexes of the vertices of a given triangle.
cloudViewer::ManualSegmentationTools::MeshCutterParams::origTriIndexesMapInside
std::vector< unsigned > origTriIndexesMapInside
Definition: ManualSegmentationTools.h:133
Vector3Tpl::dot
Type dot(const Vector3Tpl &v) const
Dot product.
Definition: CVGeom.h:408
ccGLMatrix
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
ccMesh::setTriangleMtlIndex
void setTriangleMtlIndex(unsigned triangleIndex, int mtlIndex)
Sets triangle material indexes.
Definition: ecvMesh.cpp:3756
ccPointCloud::deleteAllScalarFields
void deleteAllScalarFields() override
Deletes all scalar fields associated to this cloud.
Definition: ecvPointCloud.cpp:3253
ccDrawableObject::sfShown
virtual bool sfShown() const
Returns whether active scalar field is visible.
Definition: ecvDrawableObject.h:117
ccGenericMesh::showMaterials
virtual void showMaterials(bool state)
Sets whether textures should be displayed or not.
Definition: ecvGenericMesh.h:201
CVLog::Warning
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
cloudViewer::ReferenceCloud
A very simple point cloud (no point duplication)
Definition: ReferenceCloud.h:29
ecvColor::RgbTpl
RGB color structure.
Definition: ecvColorTypes.h:49
ecvMaterialSet.h
ccMesh
Triangular mesh.
Definition: ecvMesh.h:35
NAN_VALUE
constexpr ScalarType NAN_VALUE
NaN as a ScalarType value.
Definition: CVConst.h:76
ccDrawableObject::hasColors
virtual bool hasColors() const
Returns whether colors are enabled or not.
Definition: ecvDrawableObject.h:80
ccMaterialSet
Mesh (triangle) material.
Definition: ecvMaterialSet.h:16
ccHObject
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
Tuple3Tpl::y
Type y
Definition: CVGeom.h:137
ccObject::getName
virtual QString getName() const
Returns object name.
Definition: ecvObject.h:72
cloudViewer::BoundingBoxTpl::maxCorner
const Vector3Tpl< T > & maxCorner() const
Returns max corner (const)
Definition: BoundingBox.h:156
cloudViewer::ManualSegmentationTools::segmentMeshWithAABox
static bool segmentMeshWithAABox(GenericIndexedMesh *mesh, GenericIndexedCloudPersist *vertices, MeshCutterParams &ioParams, GenericProgressCallback *progressCb=nullptr)
Definition: ManualSegmentationTools.cpp:887
cloudViewer::SimpleMesh
A simple mesh structure, with index-based vertex access.
Definition: SimpleMesh.h:26
ccCropTool
Cropping tool.
Definition: ecvCropTool.h:19
Tuple3Tpl::u
Type u[3]
Definition: CVGeom.h:139
cloudViewer::ManualSegmentationTools::MeshCutterParams::bbMin
CCVector3d bbMin
Definition: ManualSegmentationTools.h:130
ccScalarField::importParametersFrom
void importParametersFrom(const ccScalarField *sf)
Imports the parameters from another scalar field.
Definition: ecvScalarField.cpp:633
ccMesh::addTriangleMtlIndex
void addTriangleMtlIndex(int mtlIndex)
Adds triangle material index for next triangle.
Definition: ecvMesh.cpp:3751
ccHObject::addChild
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
Definition: ecvHObject.cpp:534
ccObject::setEnabled
virtual void setEnabled(bool state)
Sets the "enabled" property.
Definition: ecvObject.h:102
ecvHObject.h
cloudViewer::LessThanEpsilon
bool LessThanEpsilon(float x)
Test a floating point number against our epsilon (a very small number).
Definition: CVMath.h:23
ccPointCloud::setPointColor
void setPointColor(size_t pointIndex, const ecvColor::Rgb &col)
Sets a particular point color.
Definition: ecvPointCloud.cpp:1649
Vector3Tpl< double >::fromArray
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
Definition: CVGeom.h:268
ecvPointCloud.h
ccScalarField
A scalar field associated to display-related parameters.
Definition: ecvScalarField.h:19
cloudViewer::VerticesIndexes::i1
unsigned i1
Definition: GenericIndexedMesh.h:19
cloudViewer::BoundingBoxTpl::minCorner
const Vector3Tpl< T > & minCorner() const
Returns min corner (const)
Definition: BoundingBox.h:154