Class CFrustum
Defined in File CFrustum.h
Inheritance Relationships
Base Types
public mrpt::viz::CVisualObject(Class CVisualObject)public mrpt::viz::VisualObjectParams_Triangles(Class VisualObjectParams_Triangles)public mrpt::viz::VisualObjectParams_Lines(Class VisualObjectParams_Lines)
Class Documentation
-
class CFrustum : public virtual mrpt::viz::CVisualObject, public virtual mrpt::viz::VisualObjectParams_Triangles, public virtual mrpt::viz::VisualObjectParams_Lines
A solid or wireframe frustum in 3D (a rectangular truncated pyramid), with arbitrary (possibly assymetric) field-of-view angles.
You can switch whether to show only the lines, the surface of the frustum, or both. By default only the lines are drawn.
The color of the object (via CVisualObject::setColor()) affects the color of lines. To set the color of planes use setPlaneColor()
As usual in MRPT, the +X axis is assumed to by the main direction, in this case of the pyramid axis.
The horizontal and vertical FOVs can be set directly with setHorzFOV() and setVertFOV() if they are symmetric, or with setHorzFOVAsymmetric() and setVertFOVAsymmetric() otherwise.
All FOV angles are positive numbers. FOVs must be below 90deg on each side (below 180deg in total). If you try to set FOVs to larger values they’ll truncated to 89.9deg.

See also
mrpt::viz::Scene, mrpt::viz::CRenderizable
Public Functions
-
inline void setPlaneColor(const mrpt::img::TColor &c)
Changes the color of the planes; to change color of lines, use CRenderizable base methods.
-
inline const mrpt::img::TColor &getPlaneColor() const
-
void setNearFarPlanes(const float near_distance, const float far_distance)
Changes distance of near & far planes
-
inline float getNearPlaneDistance() const
-
inline float getFarPlaneDistance() const
-
void setHorzFOV(const float fov_horz_degrees)
Changes horizontal FOV (symmetric)
-
void setVertFOV(const float fov_vert_degrees)
Changes vertical FOV (symmetric)
-
void setHorzFOVAsymmetric(const float fov_horz_left_degrees, const float fov_horz_right_degrees)
Changes horizontal FOV (asymmetric)
-
void setVertFOVAsymmetric(const float fov_vert_down_degrees, const float fov_vert_up_degrees)
Changes vertical FOV (asymmetric)
-
inline float getHorzFOV() const
-
inline float getVertFOV() const
-
inline float getHorzFOVLeft() const
-
inline float getHorzFOVRight() const
-
inline float getVertFOVDown() const
-
inline float getVertFOVUp() const
-
virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose. Returns true if the ray effectively collisions with the object (returning the distance to the origin of the ray in “dist”), or false in other case. “dist” variable yields undefined behaviour when false is returned
-
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()
-
CFrustum()
Basic empty constructor. Set all parameters to default.
-
CFrustum(float near_distance, float far_distance, float horz_FOV_degrees, float vert_FOV_degrees, float lineWidth, bool draw_lines, bool draw_planes)
Constructor with some parameters
-
CFrustum(const mrpt::img::TCamera &intrinsics, double focalDistScale = 5e-3)
Constructor from camera intrinsic parameters: creates a frustrum with the correct vertical and horizontal FOV angles for the given camera model, in wireframe.
Note
(New in MRPT 2.1.8)
- Parameters:
intrinsics – Camera intrinsics. Distortion is ignored here.
focalDistScale – Scale for the far plane, in meters/pixels.
-
~CFrustum() override = default
Destructor
Protected Functions
-
std::array<mrpt::math::TPoint3Df, 8> computeFrustumCorners() const
Protected Attributes
-
float m_min_distance = {0.1f}
Near and far planes
-
float m_max_distance = {1.f}
-
float m_fov_horz_left
Semi FOVs (in radians)
-
float m_fov_horz_right
-
float m_fov_vert_down
Semi FOVs (in radians)
-
float m_fov_vert_up
-
bool m_draw_lines = {true}
-
bool m_draw_planes = {false}
-
mrpt::img::TColor m_planes_color
-
inline void setPlaneColor(const mrpt::img::TColor &c)