Skip to content

raisin::CameraFrustum ​

class · #include <rayrai/CameraFrustum.hpp>

Visual helper that renders camera frustum edges.

The frustum mesh is updated from either a rayrai Camera or a raisim DepthCamera and rendered using a Visuals instance.

Constructors & destructor ​

CameraFrustum ​

cpp
CameraFrustum(
    std::shared_ptr<Visuals> visual,
    std::shared_ptr<OpenGLMesh> mesh)

Construct a frustum helper with a visual and mesh.

Parameters

ParameterDescription
visualVisuals object used for rendering.
meshOpenGL line mesh representing the frustum edges.

Public member functions ​

updateFromCamera ​

cpp
void updateFromCamera(const Camera &camera)

Update frustum mesh from a rayrai camera.

Handles both perspective (vertical FOV from Camera::zoom) and orthographic (Camera::orthoScale) projections. The drawn far distance is clamped to 10 m. Requires a current OpenGL context (the mesh is re-uploaded).

Parameters

ParameterDescription
cameraSource camera.

updateFromDepthCamera ​

cpp
void updateFromDepthCamera(raisim::DepthCamera &depthCam)

Update frustum mesh from a raisim depth camera.

Calls depthCam.updatePose() first. The sensor's horizontal FOV is read as radians, or as degrees when it exceeds pi. The drawn far distance is clamped to 10 m. Requires a current OpenGL context.

Parameters

ParameterDescription
depthCamSource depth camera.

updatePerspective ​

cpp
void updatePerspective(
    const glm::vec3 &position,
    const glm::quat &orientation,
    float horizontalFov,
    float aspect,
    float nearDistance,
    float farDistance)

Update a perspective frustum from an explicit world-space sensor pose.

The sensor convention is local +X forward and local +Z up, matching RaiSim RGB and depth cameras.

Parameters

ParameterDescription
positionSensor position in world coordinates.
orientationSensor-to-world orientation (normalized internally; identity if degenerate).
horizontalFovHorizontal field of view in radians, clamped to (0, ~179 deg).
aspectImage width divided by image height.
nearDistanceNear-plane distance.
farDistanceFar-plane distance used to size the visualization.

setColor ​

cpp
void setColor(const glm::vec4 &color)

Set the frustum color.

Parameters

ParameterDescription
colorRGBA color.

setDetectable ​

cpp
void setDetectable(bool detectable)

Set the capture/detection render category on the frustum visual.

Camera frustums are usually viewer-only helpers and should normally remain non-detectable so they do not appear in external-camera or generated capture images. Set this to true only when the frustum helper itself should be included by detectable-only visualization passes.

Parameters

ParameterDescription
detectableTrue to include the frustum visual in detectable-only render passes; false to keep it viewer-only for those passes.

See also VisualCategory

getVisual ​

cpp
std::shared_ptr<Visuals> getVisual() const

Get the underlying Visuals object.

Returns Shared pointer to the visual.

RaiSim — physics for robotics and AI.