48 #include <Eigen/Dense>
58 m_selectionBehavior(SELECTION_AA_BBOX),
69 m_selectionBehavior(object.m_selectionBehavior),
78 for (std::map<ccHObject*, int>::const_iterator it =
m_dependencies.begin();
84 it->first->onDeletionOf(
this);
89 it->first->removeDependencyFlag(
93 if (it->first->isShareable())
117 for (std::map<ccHObject*, int>::const_iterator it =
m_dependencies.begin();
123 it->first->onUpdateOf(
this);
129 switch (objectType) {
136 return new ccMesh(
nullptr);
211 "[ccHObject::New] This object (type %i) can't be "
212 "constructed this way (yet)!",
226 const QString& classId,
230 if (!externalFactories) {
253 const Eigen::Vector3d&
color) {
255 Eigen::Vector3d clipped_color =
color;
256 if (
color.minCoeff() < 0 ||
color.maxCoeff() > 1) {
258 "[ccHObject::ResizeAndPaintUniformColor] invalid color in "
259 "PaintUniformColor, clipping to [0, 1]");
260 clipped_color = clipped_color.array()
261 .max(Eigen::Vector3d(0, 0, 0).array())
263 clipped_color = clipped_color.array()
264 .min(Eigen::Vector3d(1, 1, 1).array())
267 for (
size_t i = 0; i <
size; i++) {
268 colors[i] = clipped_color;
273 const std::vector<Eigen::Vector3d>&
points) {
275 return Eigen::Vector3d(0.0, 0.0, 0.0);
277 return std::accumulate(
279 [](
const Eigen::Vector3d&
a,
const Eigen::Vector3d& b) {
280 return a.array().min(b.array()).matrix();
285 const std::vector<Eigen::Vector3d>&
points) {
287 return Eigen::Vector3d(0.0, 0.0, 0.0);
289 return std::accumulate(
291 [](
const Eigen::Vector3d&
a,
const Eigen::Vector3d& b) {
292 return a.array().max(b.array()).matrix();
297 const std::vector<Eigen::Vector3d>&
points) {
298 Eigen::Vector3d center(0, 0, 0);
302 center = std::accumulate(
points.begin(),
points.end(), center);
303 center /= double(
points.size());
308 std::vector<Eigen::Vector3d>&
points) {
309 for (
auto& point :
points) {
310 Eigen::Vector4d new_point =
312 Eigen::Vector4d(point(0), point(1), point(2), 1.0);
313 point = new_point.head<3>() / new_point(3);
318 std::vector<Eigen::Vector3d>&
normals) {
320 Eigen::Vector4d new_normal =
323 normal = new_normal.head<3>();
328 const Eigen::Matrix4d& transformation,
329 std::vector<Eigen::Matrix3d>& covariances) {
334 std::vector<Eigen::Vector3d>&
points,
336 Eigen::Vector3d transform = translation;
340 for (
auto& point :
points) {
346 std::vector<Eigen::Vector3d>&
points,
347 const Eigen::Vector3d& center) {
348 for (
auto& point :
points) {
349 point = (point - center) * scale + center;
354 std::vector<Eigen::Vector3d>&
points,
355 const Eigen::Vector3d& center) {
356 for (
auto& point :
points) {
357 point = R * (point - center) + center;
362 std::vector<Eigen::Vector3d>&
normals) {
372 std::vector<Eigen::Matrix3d>& covariances) {
373 for (
auto& covariance : covariances) {
374 covariance = R * covariance * R.transpose();
423 return Eigen::AngleAxisd(phi,
rotation / phi).toRotationMatrix();
436 Eigen::AngleAxisd rollAngle(
437 Eigen::AngleAxisd(
rotation(2), Eigen::Vector3d::UnitX()));
438 Eigen::AngleAxisd pitchAngle(
439 Eigen::AngleAxisd(
rotation(1), Eigen::Vector3d::UnitY()));
440 Eigen::AngleAxisd yawAngle(
441 Eigen::AngleAxisd(
rotation(0), Eigen::Vector3d::UnitZ()));
442 Eigen::Matrix3d rotation_matrix;
443 rotation_matrix = yawAngle * pitchAngle * rollAngle;
444 return rotation_matrix;
458 if (!otherObject || flags < 0) {
459 CVLog::Error(
"[ccHObject::addDependency] Invalid arguments");
462 }
else if (flags == 0) {
468 std::map<ccHObject*, int>::iterator it =
473 if ((it->second & flags) == flags)
return;
488 std::map<ccHObject*, int>::const_iterator it =
509 if ((flags & flag) == flag) {
510 flags = (flags & (~flag));
535 int dependencyFlags ,
549 "[ccHObject::addChild] Leaf objects shouldn't have any child!");
555 if (insertIndex < 0 ||
556 static_cast<size_t>(insertIndex) >=
m_children.size())
560 }
catch (
const std::bad_alloc&) {
571 if (dependencyFlags != 0) {
588 count += child->getChildCountRecursive();
614 bool strict )
const {
616 if ((!strict && child->isKindOf(filter)) ||
617 (strict && child->isA(filter))) {
622 if (std::find(filteredChildren.begin(), filteredChildren.end(),
624 filteredChildren.end())
626 filteredChildren.push_back(child);
632 child->filterChildren(filteredChildren,
true, filter, strict);
636 return static_cast<unsigned>(filteredChildren.size());
640 for (
size_t i = 0; i <
m_children.size(); ++i)
641 if (
m_children[i] == child)
return static_cast<int>(i);
656 newParent.
addChild(child, parentDependencyFlags);
665 bool forceFatherDependent ) {
668 int childDependencyFlags = child->getDependencyFlagsWith(
this);
674 child->removeDependencyWith(
this);
676 newParent.
addChild(child, fatherDependencyFlags);
677 child->addDependency(&newParent, childDependencyFlags);
681 assert(child->getParent() == &newParent ||
688 unsigned secondChildIndex) {
702 if (!parent)
return false;
704 if (parent ==
this)
return true;
735 child->removeFromRenderScreen(
true);
742 bool hasGLTrans =
false;
760 bool onlyEnabledChildren ) {
764 if (!onlyEnabledChildren || child->isEnabled()) {
779 child->setRedrawFlagRecursive(redraw);
787 child->setForceRedrawRecursive(redraw);
800 child->setPointSizeRecursive(pSize);
807 if (poly && poly->
getWidth() != with) {
813 child->setLineWidthRecursive(with);
822 if (child->isEnabled()) {
824 if (child->isGLTransEnabled()) {
831 if (!relative && box.
isValid()) {
851 octree->setVisible(
false);
911 rmInfos.push_back(rminfo);
915 child->getTypeID_recursive(rmInfos,
true);
925 hdInfos.push_back(hdinfo);
929 child->getTypeID_recursive(hdInfos,
true);
960 transToApply = &transTemp;
970 child->applyGLTransformation_recursive(transToApply);
979 unsigned childMaxID = child->findMaxUniqueID_recursive();
980 if (
id < childMaxID) {
1047 child->removeDependencyWith(
this);
1049 if (child->getParent() ==
this) {
1050 child->setParent(
nullptr);
1064 if (pos < 0 ||
static_cast<size_t>(pos) >=
m_children.size()) {
1091 }
else if (child->
getParent() ==
this) {
1118 assert(out.isOpen() && (out.openMode() & QIODevice::WriteOnly));
1121 if (dataVersion < 23) {
1133 uint32_t serializableCount = 0;
1135 if (child->isSerializable()) {
1136 ++serializableCount;
1140 if (out.write(
reinterpret_cast<const char*
>(&serializableCount),
1141 sizeof(uint32_t)) < 0)
1146 if (child->isSerializable()) {
1147 if (!child->toFile(out, dataVersion))
return false;
1157 if (dataVersion >= 45) {
1171 minVersion = std::max(minVersion, child->minimumFileVersion());
1185 uint32_t serializableCount = 0;
1186 if (in.read(
reinterpret_cast<char*
>(&serializableCount), 4) < 0)
1190 for (uint32_t i = 0; i < serializableCount; ++i) {
1195 if (dataVersion >= 35 && dataVersion <= 47 &&
1214 size_t originalFilePos = in.pos();
1218 in.seek(originalFilePos);
1220 QString childName = child->
getName();
1240 QString(
"[ccHObject::fromFile] Couldn't find a plugin "
1241 "able to deserialize custom object '%1' "
1242 "(class_ID = %2 / plugin_ID = %3)")
1254 if (child->
fromFile(in, dataVersion, flags, oldToNewIDMap)) {
1269 if (dataVersion >= 23) {
1279 if (dataVersion >= 45) {
1292 assert(in.isOpen() && (in.openMode() & QIODevice::ReadOnly));
1303 assert(out.isOpen() && (out.openMode() & QIODevice::WriteOnly));
1306 if (dataVersion < 20) {
1315 if (out.write(
reinterpret_cast<const char*
>(&
m_visible),
sizeof(
bool)) < 0)
1330 if (out.write(
reinterpret_cast<const char*
>(&
m_sfDisplayed),
sizeof(
bool)) <
1355 if (dataVersion >= 24) {
1375 assert(in.isOpen() && (in.openMode() & QIODevice::ReadOnly));
1381 if (in.read(
reinterpret_cast<char*
>(&
m_visible),
sizeof(
bool)) < 0)
1393 if (in.read(
reinterpret_cast<char*
>(&
m_sfDisplayed),
sizeof(
bool)) < 0)
1416 if (dataVersion >= 24) {
1417 if (in.read(
reinterpret_cast<char*
>(&
m_showNameIn3D),
sizeof(
bool)) <
1435 0.75f,
nullptr, &font);
1474 if (
context.decimateCloudOnMove &&
context.currentLODLevel > 0) {
1485 bool useClipPlanes = (draw3D && !
m_clipPlanes.empty());
1486 if (useClipPlanes) {
1493 if (useClipPlanes) {
1549 if (
m_selected && draw3D && drawInThisContext &&
1560 context.viewID, axesGridProps);
1622 child->updateNameIn3DRecursive();
1655 bool withGLFeatures ) {
1671 bool withGLFeatures ,
bool onlyEnabledChildren ) {
1675 if (!onlyEnabledChildren || child->isEnabled()) {
1676 box += child->getGlobalBB_recursive(withGLFeatures,
1677 onlyEnabledChildren);
1686 std::vector<hideInfo> hdInfos;
1690 for (
const hideInfo& hdInfo : hdInfos) {
1693 context.hideShowEntityType = hdInfo.hideType;
1694 context.viewID = hdInfo.hideId;
1697 context.viewID = hdInfo.hideId;
1729 context.viewID = hdInfo.hideId;
1751 }
catch (
const std::bad_alloc&) {
1752 CVLog::Warning(
"Not enough memory to push the current display state");
1762 if (state && apply) {
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
static bool ErrorDebug(const char *format,...)
Same as Error, but works only in Debug mode.
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Array of RGB colors for each point.
Array of compressed 3D normals (single index)
Array of (uncompressed) 3D normals (Nx,Ny,Nz)
Array of 2D texture coordinates.
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
2D label (typically attached to points)
void clearLabel(bool ignoreCaption=true)
void update2DLabelView(CC_DRAW_CONTEXT &context, bool updateScreen=true)
void draw(CC_DRAW_CONTEXT &context) override
Draws entity and its children.
Camera (projective) sensor.
Coordinate System (primitive)
static QString DefautMetaDataClassName()
Returns the default key for the "class name" metadata.
static QString DefautMetaDataPluginName()
Returns the default key for the "plugin name" metadata.
Generic interface for (3D) drawable entities.
bool m_sfDisplayed
Specifies whether scalar field should be displayed.
virtual float getOpacity() const
virtual bool isVisible() const
Returns whether entity is visible or not.
bool m_colorsDisplayed
Specifies whether colors should be displayed.
virtual void lockVisibility(bool state)
Locks/unlocks visibility.
virtual void setVisible(bool state)
Sets entity visibility.
bool m_visible
Specifies whether the object is visible or not.
virtual void applyDisplayState(const DisplayState &state)
Applies a display state.
virtual bool isGLTransEnabled() const
Returns whether a GL transformation is enabled or not.
virtual const ccGLMatrix & getGLTransformation() const
Returns associated GL transformation.
virtual void toggleClipPlanes(CC_DRAW_CONTEXT &context, bool enable)
Enables or disables clipping planes (OpenGL)
bool m_glTransEnabled
Current GL transformation activation state.
virtual void setRedraw(bool state)
Sets entity redraw mode.
ccGLMatrix m_glTrans
Current GL transformation.
bool m_selected
Specifies whether the object is selected or not.
virtual void showNameIn3D(bool state)
Sets whether name should be displayed in 3D.
CCVector3d m_nameIn3DPos
Last 2D position of the '3D' name.
virtual bool nameShownIn3D() const
Returns whether name is displayed in 3D or not.
bool m_lockedVisibility
Specifies whether the visibility can be changed by user or not.
std::vector< DisplayState::Shared > m_displayStateStack
The stack of pushed display states.
bool m_showNameIn3D
Whether name is displayed in 3D or not.
virtual void setForceRedraw(bool state)
Sets force redraw.
virtual void resetGLTransformation()
Resets associated GL transformation.
bool m_colorIsOverridden
Temporary (unique) color activation state.
bool m_normalsDisplayed
Specifies whether normals should be displayed.
ccClipPlaneSet m_clipPlanes
Active clipping planes (used for display only)
ecvColor::Rgb m_tempColor
Temporary (unique) color.
static Container::Shared GetUniqueInstance()
QSharedPointer< Container > Shared
Shared pointer type.
virtual ccHObject * buildObject(const QString &metaName)=0
Custom object building method.
Profile extrusion (primitive)
Ground-based Laser sensor.
bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads data from binary stream.
virtual bool isIdentity() const
Returns whether this matrix is equal to identity.
bool toFile(QFile &out, short dataVersion) const override
Saves data to binary stream.
virtual void toIdentity()
Sets matrix to identity.
static Eigen::Matrix< double, 4, 4 > ToEigenMatrix4(const ccGLMatrixTpl< float > &mat)
Float version of ccGLMatrixTpl.
A 3D cloud interface with associated features (color, normals, octree, etc.)
unsigned char getPointSize() const
Returns current point size.
void setPointSize(unsigned size=0)
Sets point size.
Generic primitive interface.
virtual void clearDrawings()
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context)
static ccPolyline * ToPolyline(ccHObject *obj)
Converts current object to ccPolyline (if possible)
static cc2DViewportLabel * To2DViewportLabel(ccHObject *obj)
Converts current object to cc2DViewportLabel (if possible)
static ccSensor * ToSensor(ccHObject *obj)
Converts current object to ccSensor (if possible)
static ccGenericPrimitive * ToPrimitive(ccHObject *obj)
Converts current object to ccGenericPrimitive (if possible)
static ccOctree * ToOctree(ccHObject *obj)
Converts current object to ccOctree (if possible)
static ccPlanarEntityInterface * ToPlanarEntity(ccHObject *obj)
Converts current object to ccPlanarEntityInterface (if possible)
static ccKdTree * ToKdTree(ccHObject *obj)
Converts current object to ccKdTree (if possible)
static ccGenericPointCloud * ToGenericPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccGenericPointCloud.
static cc2DLabel * To2DLabel(ccHObject *obj)
Converts current object to cc2DLabel (if possible)
Hierarchical CLOUDVIEWER Object.
virtual void notifyGeometryUpdate()
static Eigen::Matrix3d GetRotationMatrixFromAxisAngle(const Eigen::Vector3d &rotation)
Get Rotation Matrix from AxisAngle RotationType.
static Eigen::Vector3d ComputeMinBound(const std::vector< Eigen::Vector3d > &points)
Compute min bound of a list points.
virtual ecvOrientedBBox GetOrientedBoundingBox() const
void setLineWidthRecursive(PointCoordinateType width)
virtual SelectionBehavior getSelectionBehavior() const
Returns selection behavior.
bool fromFileNoChildren(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
Custom version of ccSerializableObject::fromFile.
static Eigen::Matrix3d GetRotationMatrixFromYXZ(const Eigen::Vector3d &rotation)
Get Rotation Matrix from YXZ RotationType.
void hideBB(CC_DRAW_CONTEXT context)
virtual void redrawDisplay(bool forceRedraw=true, bool only2D=false)
Redraws associated display.
static Eigen::Matrix3d GetRotationMatrixFromEulerAngle(const Eigen::Vector3d &rotation)
Get Rotation Matrix from Euler angle.
static Eigen::Matrix3d GetRotationMatrixFromXYZ(const Eigen::Vector3d &rotation)
Get Rotation Matrix from XYZ RotationType.
virtual void drawMeOnly(CC_DRAW_CONTEXT &context)
Draws the entity only (not its children)
void draw(CC_DRAW_CONTEXT &context) override
Draws entity and its children.
void setRemoveType(CC_DRAW_CONTEXT &context)
bool toFile(QFile &out, short dataVersion) const override
Saves data to binary stream.
virtual void setParent(ccHObject *anObject)
Sets parent object.
void setHideShowType(CC_DRAW_CONTEXT &context)
virtual ccBBox getBB_recursive(bool withGLFeatures=false, bool onlyEnabledChildren=true)
Returns the bounding-box of this entity and it's children.
virtual GlobalBoundingBox getOwnGlobalBB(bool withGLFeatures=false)
bool m_isDeleting
Flag to safely handle dependencies when the object is being deleted.
SelectionBehavior
Behavior when selected.
static void ResizeAndPaintUniformColor(std::vector< Eigen::Vector3d > &colors, std::size_t size, const Eigen::Vector3d &color)
Resizes the colors vector and paints a uniform color.
cloudViewer::BoundingBoxTpl< double > GlobalBoundingBox
Global (non-shifted) bounding-box.
virtual bool isShareable() const
Returns whether object is shareable or not.
bool getAbsoluteGLTransformation(ccGLMatrix &trans) const
ccGLMatrix m_glTransHistory
Cumulative GL transformation.
ENTITY_TYPE getEntityType() const
virtual short minimumFileVersion_MeOnly() const
void transferChildren(ccHObject &newParent, bool forceFatherDependent=false)
Transfer all children to another parent.
int getChildIndex(const ccHObject *aChild) const
Returns child index.
void removeFromRenderScreen(bool recursive=true)
virtual bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
Loads own object data.
int getIndex() const
Returns index relatively to its parent or -1 if no parent.
static Eigen::Vector3d ComputeCenter(const std::vector< Eigen::Vector3d > &points)
Computer center of a list of points.
bool isSerializable() const override
Returns whether object is serializable of not.
int getDependencyFlagsWith(const ccHObject *otherObject)
Returns the dependency flags with a given object.
void removeAllChildren()
Removes all children.
SelectionBehavior m_selectionBehavior
Selection behavior.
std::map< ccHObject *, int > m_dependencies
Dependencies map.
short minimumFileVersion() const override
Returns the minimum file version required to save this instance.
static void RotateCovariances(const Eigen::Matrix3d &R, std::vector< Eigen::Matrix3d > &covariances)
Rotate all covariance matrices with the rotation matrix R.
void removeDependencyWith(ccHObject *otherObject)
Removes any dependency flags with a given object.
ccHObject * find(unsigned uniqueID)
Finds an entity in this object hierarchy.
void addDependency(ccHObject *otherObject, int flags, bool additive=true)
Adds a new dependence (additive or not)
void detachChild(ccHObject *child)
Detaches a specific child.
virtual bool isDisplayed() const
Returns whether the object is actually displayed (visible) or not.
bool isAncestorOf(const ccHObject *anObject) const
Returns true if the current object is an ancestor of the specified one.
static void RotateNormals(const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &normals)
Rotate all normals with the rotation matrix R.
virtual bool toFile_MeOnly(QFile &out, short dataVersion) const
Save own object data.
QString getViewId() const
static void TransformNormals(const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &normals)
Transforms the normals with the transformation matrix.
void applyGLTransformation_recursive(const ccGLMatrix *trans=nullptr)
Applies the active OpenGL transformation to the entity (recursive)
unsigned getChildrenNumber() const
Returns the number of children.
void setPointSizeRecursive(int pSize)
virtual void drawNameIn3D()
Draws the entity name in 3D.
virtual ccBBox getDisplayBB_recursive(bool relative)
Returns the bounding-box of this entity and it's children WHEN DISPLAYED.
unsigned int getChildCountRecursive() const
Returns the total number of children under this object recursively.
virtual ccBBox getOwnFitBB(ccGLMatrix &trans)
Returns best-fit bounding-box (if available)
virtual void drawBB(CC_DRAW_CONTEXT &context, const ecvColor::Rgb &col)
Draws the entity (and its children) bounding-box.
void getTypeID_recursive(std::vector< removeInfo > &rmInfos, bool relative)
void setRedrawFlagRecursive(bool redraw=false)
virtual void applyGLTransformation(const ccGLMatrix &trans)
Applies a GL transformation to the entity.
void updateNameIn3DRecursive()
static ccHObject * New(CV_CLASS_ENUM objectType, const char *name=nullptr)
Static factory.
static void TranslatePoints(const Eigen::Vector3d &translation, std::vector< Eigen::Vector3d > &points, bool relative)
Apply translation to the geometry coordinates.
DEPENDENCY_FLAGS
Dependency flags.
@ DP_NOTIFY_OTHER_ON_DELETE
@ DP_NOTIFY_OTHER_ON_UPDATE
unsigned findMaxUniqueID_recursive() const
Returns the max 'unique ID' of this entity and its siblings.
static Eigen::Matrix3d GetRotationMatrixFromZYX(const Eigen::Vector3d &rotation)
Get Rotation Matrix from ZYX RotationType.
ccHObject * getParent() const
Returns parent object.
void detachAllChildren()
Removes a specific child.
ccHObject(QString name=QString())
Default constructor.
virtual bool isBranchEnabled() const
Returns whether the object and all its ancestors are enabled.
static Eigen::Matrix3d GetRotationMatrixFromQuaternion(const Eigen::Vector4d &rotation)
Get Rotation Matrix from Quaternion.
static void RotatePoints(const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d ¢er)
Rotate all points with the rotation matrix R.
void transferChild(ccHObject *child, ccHObject &newParent)
Transfer a given child to another parent.
virtual ~ccHObject() override
Default destructor.
void removeDependencyFlag(ccHObject *otherObject, DEPENDENCY_FLAGS flag)
Removes a given dependency flag.
ccHObject * m_parent
Parent.
void removeChild(ccHObject *child)
virtual GlobalBoundingBox getGlobalBB_recursive(bool withGLFeatures=false, bool onlyEnabledChildren=true)
Returns the global bounding-box of this entity and it's children.
unsigned filterChildren(Container &filteredChildren, bool recursive=false, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, bool strict=false) const
Collects the children corresponding to a certain pattern.
bool pushDisplayState() override
Pushes the current display state (overridden)
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
void swapChildren(unsigned firstChildIndex, unsigned secondChildIndex)
Swaps two children.
static void TransformPoints(const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &points)
Transforms all points with the transformation matrix.
virtual void onDeletionOf(const ccHObject *obj)
This method is called when another object is deleted.
virtual ccBBox getOwnBB(bool withGLFeatures=false)
Returns the entity's own bounding-box.
bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads data from binary stream.
static Eigen::Matrix3d GetRotationMatrixFromXZY(const Eigen::Vector3d &rotation)
Get Rotation Matrix from XZY RotationType.
static Eigen::Matrix3d GetRotationMatrixFromYZX(const Eigen::Vector3d &rotation)
Get Rotation Matrix from YZX RotationType.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
static void ScalePoints(const double scale, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d ¢er)
Scale the coordinates of all points by the scaling factor scale.
void setForceRedrawRecursive(bool redraw=false)
virtual ccBBox GetAxisAlignedBoundingBox() const
Returns an axis-aligned bounding box of the geometry.
static void TransformCovariances(const Eigen::Matrix4d &transformation, std::vector< Eigen::Matrix3d > &covariances)
Transforms all covariance matrices with the transformation.
void popDisplayState(bool apply=true) override
Pops the last pushed display state (overridden)
static Eigen::Matrix3d GetRotationMatrixFromZXY(const Eigen::Vector3d &rotation)
Get Rotation Matrix from ZXY RotationType.
void showBB(CC_DRAW_CONTEXT context)
static Eigen::Vector3d ComputeMaxBound(const std::vector< Eigen::Vector3d > &points)
Compute max bound of a list points.
ccHObject * getChild(unsigned childPos) const
Returns the ith child.
Container m_children
Children.
virtual QIcon getIcon() const
Returns the icon associated to this entity.
CV_CLASS_ENUM getClassID() const override
Returns class ID.
void hideObject_recursive(bool recursive)
Mesh (triangle) material.
Generic "CLOUDVIEWER Object" template.
virtual bool getRemoveFlag()
Returns removeFlag.
short minimumFileVersion() const override
Returns the minimum file version required to save this instance.
virtual QString getName() const
Returns object name.
virtual unsigned getUniqueID() const
Returns object unique ID.
bool isA(CV_CLASS_ENUM type) const
static CV_CLASS_ENUM ReadClassIDFromFile(QFile &in, short dataVersion)
Helper: reads out class ID from a binary stream.
QVariant getMetaData(const QString &key) const
Returns a given associated meta data.
virtual void setName(const QString &name)
Sets object name.
virtual void setEnabled(bool state)
Sets the "enabled" property.
virtual bool isEnabled() const
Returns whether the object is enabled or not.
bool toFile(QFile &out, short dataVersion) const override
Saves data to binary stream.
bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Reimplemented from ccSerializableObject::fromFile.
bool isKindOf(CV_CLASS_ENUM type) const
Interface for a planar entity.
void glDrawNormal(CC_DRAW_CONTEXT &context, const CCVector3 &pos, float scale, const ecvColor::Rgb *color=0)
Draws a normal vector (OpenGL)
void clearNormalVector(CC_DRAW_CONTEXT &context)
void showNormalVector(bool state)
Show normal vector.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
PointCoordinateType getWidth() const
Returns the width of the line.
void setWidth(PointCoordinateType width)
Sets the width of the line.
Generic sensor interface.
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context)
virtual void clearDrawings()
static bool CorruptError()
Sends a custom error message (corrupted file) and returns 'false'.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
static bool ReadError()
Sends a custom error message (read error) and returns 'false'.
static bool WriteError()
Sends a custom error message (write error) and returns 'false'.
Vector3Tpl< T > getCenter() const
Returns center.
const Vector3Tpl< T > & maxCorner() const
Returns max corner (const)
const Vector3Tpl< T > & minCorner() const
Returns min corner (const)
bool isValid() const
Returns whether bounding box is valid or not.
static const ParamStruct & Parameters()
Returns the stored values of each parameter.
static ecvOrientedBBox CreateFromAxisAlignedBoundingBox(const ccBBox &aabox)
virtual ecvOrientedBBox & Transform(const Eigen::Matrix4d &transformation) override
Apply transformation (4x4 matrix) to the geometry coordinates.
void draw(CC_DRAW_CONTEXT &context) override
Draws entity and its children.
unsigned char ColorCompType
Default color components type (R,G and B)
#define MACRO_SkipUnselected(context)
#define MACRO_Draw2D(context)
#define MACRO_Draw3D(context)
#define MACRO_Foreground(context)
#define MACRO_EntityPicking(context)
#define MACRO_SkipSelected(context)
Eigen::Matrix3d RotationMatrixX(double radians)
Eigen::Matrix3d RotationMatrixY(double radians)
Eigen::Matrix3d RotationMatrixZ(double radians)
void swap(cloudViewer::core::SmallVectorImpl< T > &LHS, cloudViewer::core::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
Data Axes Grid properties structure Encapsulates all properties for vtkCubeAxesActor configuration.
HObjectDisplayState(const ccHObject &obj)
QSharedPointer< DisplayState > Shared
OpenGL camera parameters.
bool project(const CCVector3d &input3D, CCVector3d &output2D, bool *inFrustum=nullptr) const
Projects a 3D point in 2D (+ normalized 'z' coordinate)
ecvColor::Rgbub bbDefaultCol
Default bounding-box color.
unsigned char defaultLineWidth
unsigned char currentLineWidth
MESH_RENDERING_MODE meshRenderingMode
double bbOpacity
Bounding-box opacity (0.0 to 1.0)
ecvColor::Rgbub bbDefaultCol
Bounding-boxes color.
unsigned bbLineWidth
Bounding-box line width.
bool showBBOnSelected
Show bounding-box on selected objects.
ENTITY_TYPE hideType
Hide type.
QString hideId
Hide viewId.
ENTITY_TYPE removeType
Remove type.
QString removeId
Remove viewId.