20 m_associatedGenericCloud(aCloud) {
38 if (node && node->
isNode()) {
60 if (node && node->
isNode()) {
136 if (entityPickingMode) {
153 std::vector<Leaf*> leaves;
154 if (!
getLeaves(leaves) || leaves.empty())
return false;
158 const char c_defaultSFName[] =
"Kd-tree indexes";
168 for (
size_t i = 0; i < leaves.size(); ++i) {
171 for (
unsigned j = 0; j < subset->
size(); ++j)
189 std::vector<Leaf*> leaves;
190 if (!
getLeaves(leaves) || leaves.empty())
return false;
196 for (
size_t i = 0; i < leaves.size(); ++i) {
200 for (
unsigned j = 0; j < subset->
size(); ++j)
223 if (node && node->
parent) {
254 for (
int i = 0; i < 3; ++i) {
337 const int* userDataFilter ) {
338 if (!
m_root)
return false;
342 if (!cellBox.
isValid())
return false;
349 }
catch (
const std::bad_alloc&) {
constexpr PointCoordinateType PC_NAN
'NaN' as a PointCoordinateType value
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Recursive visitor for ccKdTree::drawMeOnly.
DrawMeOnlyVisitor(const ccBBox &box)
void visit(CC_DRAW_CONTEXT &context, ccKdTree::BaseNode *node)
Recursive visitor for ccKdTree::getCellBBox.
void visit(ccKdTree::BaseNode *node)
Recursive visitor for ccKdTree::getNeighborLeaves.
ccKdTree::LeafSet * m_neighbors
bool m_userDataFilterEnabled
void visit(ccKdTree::BaseNode *node)
void setUserDataFilter(int value)
int m_userDataFilterValue
GetNeighborLeavesVisitor(ccKdTree::BaseNode *cell, ccKdTree::LeafSet &neighbors, const ccBBox &cellBox, const ccBBox &treeBox)
ccKdTree::BaseNode * m_targetCell
Recursive visitor for ccKdTree::multiplyBoundingBox.
PointCoordinateType m_multFactor
void visit(ccKdTree::BaseNode *node)
MultiplyBoundingBoxVisitor(PointCoordinateType multFactor)
Recursive visitor for ccKdTree::translateBoundingBox.
TranslateBoundingBoxVisitor(const CCVector3 &T)
void visit(ccKdTree::BaseNode *node)
virtual void lockVisibility(bool state)
Locks/unlocks visibility.
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.
A 3D cloud interface with associated features (color, normals, octree, etc.)
ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
Hierarchical CLOUDVIEWER Object.
bool getNeighborLeaves(BaseNode *cell, ccKdTree::LeafSet &neighbors, const int *userDataFilter=0)
Returns the neighbor leaves around a given cell.
void translateBoundingBox(const CCVector3 &T)
Translates the bounding-box of the tree.
std::unordered_set< Leaf * > LeafSet
A set of leaves.
virtual void drawMeOnly(CC_DRAW_CONTEXT &context) override
Draws the entity only (not its children)
ccKdTree(ccGenericPointCloud *aCloud)
Default constructor.
ccGenericPointCloud * m_associatedGenericCloud
Associated cloud.
bool convertCellIndexToRandomColor()
Flag points with a random color per leaf.
ccBBox getCellBBox(BaseNode *node) const
Returns the bounding-box of a given cell.
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
void multiplyBoundingBox(const PointCoordinateType multFactor)
Multiplies the bounding-box of the tree.
bool convertCellIndexToSF()
Flag points with cell index (as a scalar field)
bool isA(CV_CLASS_ENUM type) const
virtual bool isEnabled() const
Returns whether the object is enabled or not.
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.
bool resizeTheRGBTable(bool fillWithWhite=false)
Resizes the RGB colors array.
void setPointColor(size_t pointIndex, const ecvColor::Rgb &col)
Sets a particular point color.
T minDistTo(const BoundingBoxTpl< T > &bbox) const
const Vector3Tpl< T > & maxCorner() const
Returns max corner (const)
void setValidity(bool state)
Sets bonding box validity.
const Vector3Tpl< T > & minCorner() const
Returns min corner (const)
bool isValid() const
Returns whether bounding box is valid or not.
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the cloud bounding box.
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.
void setCurrentScalarField(int index)
Sets both the INPUT & OUTPUT scalar field.
A very simple point cloud (no point duplication)
void setPointScalarValue(unsigned pointIndex, ScalarType value) override
Sets the ith point associated scalar value.
unsigned size() const override
Returns the number of points.
virtual unsigned getPointGlobalIndex(unsigned localIndex) const
virtual void computeMinAndMax()
Determines the min and max values.
PointCoordinateType splitValue
BaseNode * m_root
Root node.
bool getLeaves(LeafVector &leaves) const
Returns all leaf nodes.
GenericIndexedCloudPersist * m_associatedCloud
Associated cloud.
static Rgb Random(bool lightOnly=true)
Generates a random color.
#define MACRO_Draw3D(context)
#define MACRO_FastEntityPicking(context)
#define MACRO_EntityPicking(context)
Generic file read and write utility for python interface.
constexpr Rgb green(0, MAX, 0)
ecvColor::Rgbub bbDefaultCol
Default bounding-box color.
ENTITY_TYPE removeEntityType
MESH_RENDERING_MODE meshRenderingMode