Class CBox
Defined in File CBox.h
Inheritance Relationships
Base Types
public mrpt::viz::CVisualObject(Class CVisualObject)public mrpt::viz::VisualObjectParams_Lines(Class VisualObjectParams_Lines)public mrpt::viz::VisualObjectParams_Triangles(Class VisualObjectParams_Triangles)
Class Documentation
-
class CBox : public virtual mrpt::viz::CVisualObject, public virtual mrpt::viz::VisualObjectParams_Lines, public virtual mrpt::viz::VisualObjectParams_Triangles
A solid or wireframe box in 3D, defined by 6 rectangular faces parallel to the planes X, Y and Z (note that the object can be translated and rotated afterwards as any other CVisualObject object using the “object pose” in the base class).
Three drawing modes are possible:
Wireframe: setWireframe(true). Used color is the CVisualObject color
Solid box: setWireframe(false). Used color is the CVisualObject color
Solid box with border: setWireframe(false) + enableBoxBorder(true). Solid color is the CVisualObject color, border line can be set with setBoxBorderColor().

See also
Geometry Configuration
-
void setBoxCorners(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2)
Set the position and size of the box, from two corners in 3D
-
inline void getBoxCorners(mrpt::math::TPoint3D &corner1, mrpt::math::TPoint3D &corner2) const
Get the current box corners
-
inline const mrpt::math::TPoint3D &getCornerMin() const
Returns the minimum corner
-
inline const mrpt::math::TPoint3D &getCornerMax() const
Returns the maximum corner
Rendering Style
-
inline void setWireframe(bool is_wireframe = true)
Sets wireframe rendering mode (true) or solid mode (false, default)
-
inline bool isWireframe() const
Returns true if wireframe mode is enabled
-
inline void enableBoxBorder(bool drawBorder = true)
Enable/disable drawing a border around solid boxes
-
inline bool isBoxBorderEnabled() const
Returns true if box border is enabled
-
inline void setBoxBorderColor(const mrpt::img::TColor &c)
Set the color of the box border lines
-
inline mrpt::img::TColor getBoxBorderColor() const
Get the color of the box border lines
CVisualObject Interface
-
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const override
Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates. This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.
See also
getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()
-
virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
See also
-
virtual void updateBuffers() const override
Updates the internal geometry buffers for rendering.
This is called automatically by the rendering system when hasToUpdateBuffers() returns true (i.e., after notifyChange() was called).
Public Functions
-
CBox() = default
Basic empty constructor. Set all parameters to default.
-
CBox(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2, bool is_wireframe = false, float lineWidth = 1.0)
Constructor with all the parameters
-
~CBox() override = default
Destructor
Protected Attributes
-
mrpt::math::TPoint3D m_corner_min = {-1, -1, -1}
Corners coordinates
-
mrpt::math::TPoint3D m_corner_max = {1, 1, 1}
-
bool m_wireframe = false
true: wireframe, false (default): solid
-
bool m_draw_border = true
Draw line borders to solid box (default: true)
-
mrpt::img::TColor m_solidborder_color = {0, 0, 0}
Color of the solid box borders.