Class CCamera
Defined in File CCamera.h
Inheritance Relationships
Base Type
public mrpt::viz::CVisualObject(Class CVisualObject)
Class Documentation
-
class CCamera : public mrpt::viz::CVisualObject
Defines the intrinsic and extrinsic camera coordinates from which to render a 3D scene.
By default, each viewport has its own camera, accessible via Viewport::getCamera(), but if a CCamera object is added as an object to be rendered, it will override the internal viewport camera.
Available projection models:
Projective model, parameterized via setProjectiveFOVdeg() (vertical field of view, in degrees)
Projective model, by means of a computer vision pinhole intrinsic parameter set: see setProjectiveFromPinhole()
Orthogonal projection model: use setProjectiveModel(false), or setOrthogonal(), or
No projection mode: use
setNoProjection(). Viewport coordinates are fixed to bottomLeft=(-1,-1) to rightTop=(+1,+1).
Defining the position and orientation of a camera is possible by:
Using an “orbit” model: defined by a “pointing to” point, a distance to object, and azimuth + elevation angles; or
Directly giving the SE(3) camera pose, setting the set6DOFMode() to
trueand storing the desired pose with CVisualObject::setPose(). Pose axis convention is +Z pointing forwards, +X right, +Y down.See also
opengl::Scene
Projection model (camera intrinsic parameters)
-
inline void setProjectiveModel(bool v = true)
Enable/Disable projective mode (vs. orthogonal).
-
inline void setOrthogonal(bool v = true)
Enable/Disable orthogonal mode (vs. projective)
-
inline void setProjectiveFromPinhole(const mrpt::img::TCamera &camIntrinsics)
-
inline void setNoProjection()
Disable all coordinate transformations and allow direct use of pixel coordinates, that is, the projection matrix is the identity.
In this mode, (-1,-1) is the bottom-left corner and (+1,+1) the top-right corner, per OpenGL defaults. This mode can be disabled calling setProjectiveModel() or setOrthogonal()
-
inline void setProjectiveFOVdeg(float ang)
Vertical field-of-View in degs, only when projectiveModel=true (default=30 deg).
-
inline float getProjectiveFOVdeg() const
Field-of-View in degs, only when projectiveModel=true (default=30 deg).
-
inline bool hasPinholeModel() const
-
inline const std::optional<mrpt::img::TCamera> &getPinholeModel() const
-
inline bool isProjective() const
-
inline bool isOrthogonal() const
-
inline bool isNoProjection() const
Defines camera pose (camera extrinsic parameters)
-
inline void setPointingAt(float x, float y, float z)
-
template<class POSEORPOINT>
inline void setPointingAt(const POSEORPOINT &p)
-
inline void setPointingAt(const mrpt::math::TPoint3D &p)
-
inline float getPointingAtX() const
-
inline float getPointingAtY() const
-
inline float getPointingAtZ() const
-
inline mrpt::math::TPoint3Df getPointingAt() const
-
inline float getZoomDistance() const
-
inline float getAzimuthDegrees() const
-
inline float getElevationDegrees() const
-
inline float getRollDegrees() const
-
inline void setZoomDistance(float z)
-
inline void setAzimuthDegrees(float ang)
-
inline void setElevationDegrees(float ang)
-
inline void setRollDegrees(float ang)
-
inline void set6DOFMode(bool v)
Set 6DOFMode, if enabled camera is set according to its pose, set via CVisualObject::setPose(). (default=false). Conventionally, eye is set looking towards +Z axis, “down” is the +Y axis, right is “+X” axis. In this mode azimuth/elevation are ignored.
-
inline bool is6DOFMode() const
Public Functions
-
CCamera() = default
-
~CCamera() override = default
-
virtual void toYAMLMap(mrpt::containers::yaml &propertiesMap) const override
Used from Scene::asYAML().
Note
(New in MRPT 2.4.2)
-
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const override
In this class, returns a fixed box (max,max,max), (-max,-max,-max).
Protected Attributes
-
float m_pointingX = {0}
-
float m_pointingY = {0}
-
float m_pointingZ = {0}
-
float m_eyeDistance = {10}
-
float m_azimuthDeg = {45}
-
float m_elevationDeg = {45}
-
float m_eyeRollDeg = {0}
-
bool m_projectiveModel = {true}
If set to true (default), camera model is projective, otherwise, it’s orthogonal.
-
bool m_useNoProjection = false
-
std::optional<mrpt::img::TCamera> m_pinholeModel
If defined, it overrides m_projectiveFOVdeg.
-
float m_projectiveFOVdeg = {30}
Field-of-View in degs, only when projectiveModel=true and there is no pinhole model assigned. (default=30 deg).
-
bool m_6DOFMode = {false}
If set to true, camera pose is used when rendering the viewport