Back

BaseCamera

**Overview** The BaseCamera component serves as an abstract base class for defining various types of cameras in the SOFA (Simulation Open Framework Architecture) framework. It provides fundamental functionalities and properties common to all camera objects, such as position, orientation, field of view, near/far clipping planes, and viewport dimensions. **Properties & Data Members** - **Position**: `Data<type::Vec3> d_position` - Stores the 3D position of the camera in world coordinates. - **Orientation**: `Data<Quat> d_orientation` - Represents the orientation (rotation) of the camera using a quaternion. - **Look At Point**: `Data<type::Vec3> d_lookAt` - Indicates where the camera is looking at, specified by a 3D point in world coordinates. - **Distance to Look At**: `Data<double> d_distance` - Distance between the camera's position and its look-at point. - **Field of View (FOV)**: `Data<double> d_fieldOfView` - Defines the vertical field of view angle for the camera, typically used in perspective projection cameras. - **Near Clipping Plane**: `Data<double> d_zNear` - Distance to the near clipping plane from the viewer's position; anything closer will not be rendered. - **Far Clipping Plane**: `Data<double> d_zFar` - Distance to the far clipping plane from the viewer's position; objects beyond this distance are not visible. - **Compute Z Clip Planes**: `Data<bool> d_computeZClip` - Boolean flag that, when true, automatically computes near and far clipping planes based on the scene’s bounding box. - **Bounding Box Min/Max Points**: `Data<type::Vec3> d_minBBox`, `d_maxBBox` - Minimum and maximum points of the scene's bounding box used for automatic camera positioning or zooming. - **Viewport Dimensions**: `Data<unsigned int> d_widthViewport, d_heightViewport` - Width and height of the viewport (render target). - **Camera Type**: `Data<sofa::helper::OptionsGroup> d_type` - Enumerates different types of cameras such as Perspective or Orthographic. - **Activation Flag**: `Data<bool> d_activated` - Controls whether the camera is active and participates in rendering. **Initialization & Activation Methods** - `init()`: Called during initialization to set up default properties and configurations. - `reinit()`: Allows reinitialization after changes to scene or settings have been made. - `activate()`, `desactivate()` - Methods for turning the camera on/off, which also sets/unsets the d_activated Data member accordingly. **Camera Transformations & Conversions** The BaseCamera provides several methods for converting between screen coordinates (pixels), viewport coordinates (normalized [0.0, 1.0]), and world coordinates (3D space). It supports common operations such as translation (`translate()`, `translateLookAt()`), rotation (`rotate()`, `rotateWorldAroundPoint()`), setting camera position/orientation with `setView()`, and fitting the view to a specified sphere or bounding box using `fitSphere()`, `fitBoundingBox()`. The `toRay()` method converts screen points into 3D rays in world space, useful for mouse picking or similar interactions. **Matrix Extraction & OpenGL Compatibility** The component can output its model-view matrix and projection matrix as 16-element arrays of doubles, suitable for use with OpenGL. Methods like `getModelViewMatrix()`, `getProjectionMatrix()` retrieve these matrices in a format ready to be passed directly to shaders or rendering pipelines. **Customization & Stereoscopic Support** Derived classes can override the `manageEvent()` method to handle custom events and implement specific behavior based on input devices, application logic, etc. The BaseCamera also supports stereoscopic rendering through properties like stereo mode (`get/setStereoMode`), strategy (`get/setStereoStrategy`), and shift value (`get/setStereoShift`). **Drawing & Debugging** The component provides a `draw()` method for visualizing the camera's view frustum or other elements in the scene, useful for debugging purposes. A virtual `drawCamera()` method is intended to be overridden by derived classes to provide class-specific visualization.

abstract
The `BaseCamera` component defines fundamental camera properties such as position, orientation, field of view, and clipping planes in the SOFA framework.
sheet
# BaseCamera ## Overview The `BaseCamera` is an abstract base class for defining various types of cameras within the SOFA framework. It provides essential functionalities including position (`d_position`), orientation (`d_orientation`), field of view (`d_fieldOfView`), near and far clipping planes (`d_zNear`, `d_zFar`), and viewport dimensions (`d_widthViewport`, `d_heightViewport`). The component supports both perspective and orthographic projections. ## Parameters and Data The significant data fields exposed by the `BaseCamera` include: - **Position**: `Data<type::Vec3> d_position` - Stores the 3D position of the camera in world coordinates. - **Orientation**: `Data<Quat> d_orientation` - Represents the orientation (rotation) of the camera using a quaternion. - **Look At Point**: `Data<type::Vec3> d_lookAt` - Indicates where the camera is looking at, specified by a 3D point in world coordinates. - **Distance to Look At**: `Data<double> d_distance` - Distance between the camera's position and its look-at point. - **Field of View (FOV)**: `Data<double> d_fieldOfView` - Defines the vertical field of view angle for the camera, typically used in perspective projection cameras. - **Near Clipping Plane**: `Data<double> d_zNear` - Distance to the near clipping plane from the viewer's position; anything closer will not be rendered. - **Far Clipping Plane**: `Data<double> d_zFar` - Distance to the far clipping plane from the viewer's position; objects beyond this distance are not visible. - **Compute Z Clip Planes**: `Data<bool> d_computeZClip` - Boolean flag that, when true, automatically computes near and far clipping planes based on the scene’s bounding box. - **Bounding Box Min/Max Points**: `Data<type::Vec3> d_minBBox`, `d_maxBBox` - Minimum and maximum points of the scene's bounding box used for automatic camera positioning or zooming. - **Viewport Dimensions**: `Data<unsigned int> d_widthViewport, d_heightViewport` - Width and height of the viewport (render target). - **Camera Type**: `Data<sofa::helper::OptionsGroup> d_type` - Enumerates different types of cameras such as Perspective or Orthographic. - **Activation Flag**: `Data<bool> d_activated` - Controls whether the camera is active and participates in rendering. ## Mathematical Model ### Position and Orientation The position of the camera is defined by a vector \(\mathbf{p} = (x, y, z)\). The orientation is represented using a quaternion \(q = w + xi + yj + zk\), which can be decomposed into a rotation matrix \(R(q)\): egin{equation*} R(q) = \begin{bmatrix} 1-2(y^2+z^2) & 2(xy-wz) & 2(xz+wy) \\ 2(xy+wz) & 1-2(x^2+z^2) & 2(yz-wx) \\ 2(xz-wy) & 2(yz+wx) & 1-2(x^2+y^2) \end{bmatrix} \end{equation*} ### Look At Point and Distance The distance between the camera position \(\mathbf{p} = (x, y, z)\) and the look-at point \(\mathbf{l} = (l_x, l_y, l_z)\) is given by: egin{equation*} d_{distance} = ||\mathbf{l} - \mathbf{p}|| = \sqrt{(l_x - x)^2 + (l_y - y)^2 + (l_z - z)^2} \end{equation*} ### Field of View and Projection Matrices The projection matrix depends on whether it is an orthographic or perspective projection. #### Orthographic Projection Matrix For an orthographic projection, the projection matrix \(P_{ortho}\) can be defined as: egin{equation*} P_{ortho} = \begin{bmatrix} 1/(r-l) & 0 & 0 & -(r+l)/(2(r-l)) \\ 0 & 1/(t-b) & 0 & -(t+b)/(2(t-b)) \\ 0 & 0 & -2/(f-n) & -(f+n)/(2(f-n)) \\ 0 & 0 & 0 & 1 \end{bmatrix} \end{equation*} where \(l, r, t, b\) are the left, right, top, and bottom clipping planes respectively, and \(n, f\) are the near and far clipping planes. #### Perspective Projection Matrix For a perspective projection, the matrix is given by: egin{equation*} P_{persp} = \begin{bmatrix} 1/\tan(fovy/2) & 0 & 0 & 0 \\ 0 & 1/h & 0 & 0 \\ 0 & 0 & -(f+n)/(f-n) & -2fn/(f-n) \\ 0 & 0 & -1 & 0 \end{bmatrix} \end{equation*} where \(fovy\) is the vertical field of view in radians, and \(h\) is the aspect ratio (width/height). ### Clipping Planes Near (`d_zNear`) and far (`d_zFar`) clipping planes define the range of distances from the camera where objects are rendered. Anything closer than `zNear` or farther than `zFar` will not be visible. #### Automatic Z-Clip Plane Computation If `d_computeZClip` is true, the near and far clipping planes can be automatically computed based on the bounding box of the scene defined by its minimum (`d_minBBox`) and maximum (`d_maxBBox`) points. The center \(C\) and radius \(R\) of the scene are: egin{equation*} C = (d_{minBBox} + d_{maxBBox})/2 \end{equation*} egin{equation*} R = ||d_{maxBBox} - d_{minBBox}|| / 2 \end{equation*} The near and far clipping planes can then be set to a reasonable distance around the scene: egin{align*} z_{Near} &= C_z - R \times k_1 \\ z_{Far} &= C_z + R \times k_2 \end{align*} where \(k_1, k_2\) are scaling factors. ## Practical Notes The `BaseCamera` component is intended to be subclassed for specific camera types and behaviors. It provides methods for setting up the camera view (`setView()`, `setDefaultView()`), fitting the view to a bounding box or sphere (`fitBoundingBox()`, `fitSphere()`), and handling stereoscopic rendering through properties like stereo mode, strategy, and shift value.
title
BaseCamera Component Documentation
description
**Overview** The BaseCamera component serves as an abstract base class for defining various types of cameras in the SOFA (Simulation Open Framework Architecture) framework. It provides fundamental functionalities and properties common to all camera objects, such as position, orientation, field of view, near/far clipping planes, and viewport dimensions. **Properties & Data Members** - **Position**: `Data<type::Vec3> d_position` - Stores the 3D position of the camera in world coordinates. - **Orientation**: `Data<Quat> d_orientation` - Represents the orientation (rotation) of the camera using a quaternion. - **Look At Point**: `Data<type::Vec3> d_lookAt` - Indicates where the camera is looking at, specified by a 3D point in world coordinates. - **Distance to Look At**: `Data<double> d_distance` - Distance between the camera's position and its look-at point. - **Field of View (FOV)**: `Data<double> d_fieldOfView` - Defines the vertical field of view angle for the camera, typically used in perspective projection cameras. - **Near Clipping Plane**: `Data<double> d_zNear` - Distance to the near clipping plane from the viewer's position; anything closer will not be rendered. - **Far Clipping Plane**: `Data<double> d_zFar` - Distance to the far clipping plane from the viewer's position; objects beyond this distance are not visible. - **Compute Z Clip Planes**: `Data<bool> d_computeZClip` - Boolean flag that, when true, automatically computes near and far clipping planes based on the scene’s bounding box. - **Bounding Box Min/Max Points**: `Data<type::Vec3> d_minBBox`, `d_maxBBox` - Minimum and maximum points of the scene's bounding box used for automatic camera positioning or zooming. - **Viewport Dimensions**: `Data<unsigned int> d_widthViewport, d_heightViewport` - Width and height of the viewport (render target). - **Camera Type**: `Data<sofa::helper::OptionsGroup> d_type` - Enumerates different types of cameras such as Perspective or Orthographic. - **Activation Flag**: `Data<bool> d_activated` - Controls whether the camera is active and participates in rendering. **Initialization & Activation Methods** - `init()`: Called during initialization to set up default properties and configurations. - `reinit()`: Allows reinitialization after changes to scene or settings have been made. - `activate()`, `desactivate()` - Methods for turning the camera on/off, which also sets/unsets the d_activated Data member accordingly. **Camera Transformations & Conversions** The BaseCamera provides several methods for converting between screen coordinates (pixels), viewport coordinates (normalized [0.0, 1.0]), and world coordinates (3D space). It supports common operations such as translation (`translate()`, `translateLookAt()`), rotation (`rotate()`, `rotateWorldAroundPoint()`), setting camera position/orientation with `setView()`, and fitting the view to a specified sphere or bounding box using `fitSphere()`, `fitBoundingBox()`. The `toRay()` method converts screen points into 3D rays in world space, useful for mouse picking or similar interactions. **Matrix Extraction & OpenGL Compatibility** The component can output its model-view matrix and projection matrix as 16-element arrays of doubles, suitable for use with OpenGL. Methods like `getModelViewMatrix()`, `getProjectionMatrix()` retrieve these matrices in a format ready to be passed directly to shaders or rendering pipelines. **Customization & Stereoscopic Support** Derived classes can override the `manageEvent()` method to handle custom events and implement specific behavior based on input devices, application logic, etc. The BaseCamera also supports stereoscopic rendering through properties like stereo mode (`get/setStereoMode`), strategy (`get/setStereoStrategy`), and shift value (`get/setStereoShift`). **Drawing & Debugging** The component provides a `draw()` method for visualizing the camera's view frustum or other elements in the scene, useful for debugging purposes. A virtual `drawCamera()` method is intended to be overridden by derived classes to provide class-specific visualization.
tags
  • Base Camera
  • SOFA Component
  • 3D Rendering
  • OpenGL Integration
  • Stereo Vision
examples
see_also
source_code_links
  • {'url': './src/engine/BaseCamera.h'}
maths
# Mathematical and Physical Description of BaseCamera Component ## Position and Orientation The `BaseCamera` in the SOFA framework is fundamentally defined by its position (`d_position`) and orientation (`d_orientation`). The position is a vector \( extbf{p} = (x, y, z) \) that indicates where the camera is located in 3D space. Orientation is represented using a quaternion \( q = (w, x, y, z) \), which allows for efficient and numerically stable rotations without gimbal lock. ### Quaternion Representation of Orientation A quaternion \( q \) can be decomposed as: \[ q = w + xi + yj + zk \] where \( i^2 = j^2 = k^2 = ijk = -1 \). The rotation matrix \( R \) corresponding to this quaternion is given by: \[ R(q) = \begin{bmatrix} 1-2(y^2+z^2) & 2(xy-wz) & 2(xz+wy) \\ 2(xy+wz) & 1-2(x^2+z^2) & 2(yz-wx) \\ 2(xz-wy) & 2(yz+wx) & 1-2(x^2+y^2) \end{bmatrix} \] The rotation matrix \( R(q) \) can then be used to transform vectors from the camera's local coordinate system to the world coordinate system. ## Look At Point and Distance The `BaseCamera` also has a look-at point (`d_lookAt`) which defines where the camera is directed. The distance between the camera position and this point is stored in `d_distance`. Given the current position \( extbf{p} = (x, y, z) \) and look-at point \( extbf{l} = (l_x, l_y, l_z) \), the distance can be computed as: \[ d_{distance} = || extbf{l} - extbf{p}|| = \sqrt{(l_x - x)^2 + (l_y - y)^2 + (l_z - z)^2} \] ## Field of View and Projection Matrices The camera has a field of view (`d_fieldOfView`) which defines the extent of the visible scene in degrees. The projection matrix depends on whether it is an orthographic or perspective projection. ### Orthographic Projection Matrix For an orthographic projection, the projection matrix \( P_{ortho} \) can be defined as: \[ P_{ortho} = \begin{bmatrix} 1/(r-l) & 0 & 0 & -(r+l)/(2(r-l)) \\ 0 & 1/(t-b) & 0 & -(t+b)/(2(t-b)) \\ 0 & 0 & -2/(f-n) & -(f+n)/(2(f-n)) \\ 0 & 0 & 0 & 1 \end{bmatrix} \] where \( l, r, t, b \) are the left, right, top, and bottom clipping planes respectively, and \( n, f \) are the near and far clipping planes. ### Perspective Projection Matrix For a perspective projection, the matrix is given by: \[ P_{persp} = \begin{bmatrix} 1/ an(fovy/2) & 0 & 0 & 0 \\ 0 & 1/h & 0 & 0 \\ 0 & 0 & -(f+n)/(f-n) & -2fn/(f-n) \\ 0 & 0 & -1 & 0 \end{bmatrix} \] where \( fovy \) is the vertical field of view in radians, and \( h \) is the aspect ratio (width/height). ## Clipping Planes Near (`d_zNear`) and far (`d_zFar`) clipping planes define the range of distances from the camera where objects are rendered. Anything closer than `zNear` or farther than `zFar` will not be visible. ### Automatic Z-Clip Plane Computation If `d_computeZClip` is true, the near and far clipping planes can be automatically computed based on the bounding box of the scene defined by its minimum (`d_minBBox`) and maximum (`d_maxBBox`) points. The center \( C \) and radius \( R \) of the scene are: \[ C = (d_{minBBox} + d_{maxBBox})/2 \] \[ R = ||d_{maxBBox} - d_{minBBox}|| / 2 \] The near and far clipping planes can then be set to a reasonable distance around the scene: \[ z_{Near} = C_z - R \times k_1 \] \[ z_{Far} = C_z + R \times k_2 \] where \( k_1, k_2 \) are scaling factors. ## Viewport Dimensions and Aspect Ratio The viewport dimensions (`d_widthViewport`, `d_heightViewport`) define the size of the render target. The aspect ratio (\( A = width/height \)) is used in perspective projection matrices to maintain correct proportions when changing window sizes. ### Scene Bounding Box Fit Methods like `fitSphere()` and `fitBoundingBox()` adjust camera parameters so that the entire scene or specified sphere/boundingBox is visible within the defined field of view. These methods typically update position, orientation, and distance based on the bounding box dimensions to ensure all relevant objects are included in the rendered image. ## Ray Casting The method `toRay()` converts a screen point (usually mouse cursor position) into a ray in world coordinates for picking or other interactive purposes. Given a normalized viewport coordinate \( (u, v) \), the corresponding ray in camera space can be computed and transformed to world space using the inverse of the model-view matrix. ## Conclusion The `BaseCamera` component provides foundational functionality for defining and manipulating cameras within 3D environments, utilizing mathematical concepts such as vectors, quaternions, matrices, and projection transformations. Its design supports both orthographic and perspective projections with configurable parameters to control field of view, clipping planes, and viewport dimensions.
{
  "name": "BaseCamera",
  "main": {
    "name": "BaseCamera",
    "namespace": "sofa::component::visual",
    "module": "Sofa.Component.Visual",
    "include": "sofa/component/visual/BaseCamera.h",
    "doc": "",
    "inherits": [
      "BaseObject"
    ],
    "templates": [],
    "data_fields": [
      {
        "name": "d_position",
        "type": "type::Vec3",
        "xmlname": "position",
        "help": "Camera's position"
      },
      {
        "name": "d_orientation",
        "type": "Quat",
        "xmlname": "orientation",
        "help": "Camera's orientation"
      },
      {
        "name": "d_lookAt",
        "type": "type::Vec3",
        "xmlname": "lookAt",
        "help": "Camera's look at"
      },
      {
        "name": "d_distance",
        "type": "double",
        "xmlname": "distance",
        "help": "Distance between camera and look at"
      },
      {
        "name": "d_fieldOfView",
        "type": "double",
        "xmlname": "fieldOfView",
        "help": "Camera's FOV"
      },
      {
        "name": "d_zNear",
        "type": "double",
        "xmlname": "zNear",
        "help": "Camera's zNear"
      },
      {
        "name": "d_zFar",
        "type": "double",
        "xmlname": "zFar",
        "help": "Camera's zFar"
      },
      {
        "name": "d_computeZClip",
        "type": "bool",
        "xmlname": "computeZClip",
        "help": "Compute Z clip planes (Near and Far) according to the bounding box"
      },
      {
        "name": "d_minBBox",
        "type": "type::Vec3",
        "xmlname": "minBBox",
        "help": "minBBox"
      },
      {
        "name": "d_maxBBox",
        "type": "type::Vec3",
        "xmlname": "maxBBox",
        "help": "maxBBox"
      },
      {
        "name": "d_widthViewport",
        "type": "unsigned int",
        "xmlname": "widthViewport",
        "help": "widthViewport"
      },
      {
        "name": "d_heightViewport",
        "type": "unsigned int",
        "xmlname": "heightViewport",
        "help": "heightViewport"
      },
      {
        "name": "d_type",
        "type": "sofa::helper::OptionsGroup",
        "xmlname": "projectionType",
        "help": "Camera Type (0 = Perspective, 1 = Orthographic)"
      },
      {
        "name": "d_activated",
        "type": "bool",
        "xmlname": "activated",
        "help": "Camera activated ?"
      },
      {
        "name": "d_fixedLookAtPoint",
        "type": "bool",
        "xmlname": "fixedLookAt",
        "help": "keep the lookAt point always fixed"
      }
    ],
    "links": [],
    "methods": [
      {
        "name": "init",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "reinit",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "bwdInit",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "activate",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "desactivate",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "isActivated",
        "return_type": "bool",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "exportParametersInFile",
        "return_type": "bool",
        "params": [
          {
            "name": "viewFilename",
            "type": "const int &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "importParametersFromFile",
        "return_type": "bool",
        "params": [
          {
            "name": "viewFilename",
            "type": "const int &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "translate",
        "return_type": "void",
        "params": [
          {
            "name": "t",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "translateLookAt",
        "return_type": "void",
        "params": [
          {
            "name": "t",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "rotate",
        "return_type": "void",
        "params": [
          {
            "name": "r",
            "type": "const Quat &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "moveCamera",
        "return_type": "void",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          },
          {
            "name": "q",
            "type": "const Quat &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "rotateCameraAroundPoint",
        "return_type": "void",
        "params": [
          {
            "name": "rotation",
            "type": "Quat &"
          },
          {
            "name": "point",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "rotateWorldAroundPoint",
        "return_type": "void",
        "params": [
          {
            "name": "rotation",
            "type": "Quat &"
          },
          {
            "name": "point",
            "type": "const type::Vec3 &"
          },
          {
            "name": "orientationCam",
            "type": "Quat"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "rotateWorldAroundPoint",
        "return_type": "void",
        "params": [
          {
            "name": "rotation",
            "type": "Quat &"
          },
          {
            "name": "point",
            "type": "const type::Vec3 &"
          },
          {
            "name": "orientationCam",
            "type": "Quat"
          },
          {
            "name": "positionCam",
            "type": "type::Vec3"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "screenToViewportPoint",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "screenToWorldPoint",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "viewportToScreenPoint",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "viewportToWorldPoint",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "worldToScreenPoint",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "worldToViewportPoint",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "viewportPointToRay",
        "return_type": "type::Ray",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "screenPointToRay",
        "return_type": "type::Ray",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "toRay",
        "return_type": "type::Ray",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "cameraToWorldCoordinates",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "worldToCameraCoordinates",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "cameraToWorldTransform",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "v",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "worldToCameraTransform",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "v",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "screenToWorldCoordinates",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "x",
            "type": "int"
          },
          {
            "name": "y",
            "type": "int"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "worldToScreenCoordinates",
        "return_type": "type::Vec2",
        "params": [
          {
            "name": "p",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "fitSphere",
        "return_type": "void",
        "params": [
          {
            "name": "center",
            "type": "const type::Vec3 &"
          },
          {
            "name": "radius",
            "type": "SReal"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "fitBoundingBox",
        "return_type": "void",
        "params": [
          {
            "name": "min",
            "type": "const type::Vec3 &"
          },
          {
            "name": "max",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getPosition",
        "return_type": "type::Vec3",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getOrientation",
        "return_type": "Quat",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getLookAt",
        "return_type": "type::Vec3",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getDistance",
        "return_type": "double",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getFieldOfView",
        "return_type": "double",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getHorizontalFieldOfView",
        "return_type": "double",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getCameraType",
        "return_type": "unsigned int",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setCameraType",
        "return_type": "void",
        "params": [
          {
            "name": "type",
            "type": "unsigned int"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setBoundingBox",
        "return_type": "void",
        "params": [
          {
            "name": "min",
            "type": "const type::Vec3 &"
          },
          {
            "name": "max",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setViewport",
        "return_type": "void",
        "params": [
          {
            "name": "w",
            "type": "unsigned int"
          },
          {
            "name": "h",
            "type": "unsigned int"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getZNear",
        "return_type": "double",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getZFar",
        "return_type": "double",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setView",
        "return_type": "void",
        "params": [
          {
            "name": "position",
            "type": "const type::Vec3 &"
          },
          {
            "name": "orientation",
            "type": "const Quat &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setDefaultView",
        "return_type": "void",
        "params": [
          {
            "name": "gravity",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getModelViewMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "mat",
            "type": "double[16]"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getProjectionMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "mat",
            "type": "double[16]"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getOpenGLModelViewMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "mat",
            "type": "double[16]"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getOpenGLProjectionMatrix",
        "return_type": "void",
        "params": [
          {
            "name": "mat",
            "type": "double[16]"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getOrientationFromLookAt",
        "return_type": "Quat",
        "params": [
          {
            "name": "pos",
            "type": "const type::Vec3 &"
          },
          {
            "name": "lookat",
            "type": "const type::Vec3 &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getLookAtFromOrientation",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "pos",
            "type": "const type::Vec3 &"
          },
          {
            "name": "distance",
            "type": "const double &"
          },
          {
            "name": "orientation",
            "type": "const Quat &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getPositionFromOrientation",
        "return_type": "type::Vec3",
        "params": [
          {
            "name": "lookAt",
            "type": "const type::Vec3 &"
          },
          {
            "name": "distance",
            "type": "const double &"
          },
          {
            "name": "orientation",
            "type": "const Quat &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "manageEvent",
        "return_type": "void",
        "params": [
          {
            "name": "event",
            "type": "core::objectmodel::Event *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": true,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "internalUpdate",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "handleEvent",
        "return_type": "void",
        "params": [
          {
            "name": "event",
            "type": "sofa::core::objectmodel::Event *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "computeZ",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "isStereo",
        "return_type": "bool",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setCurrentSide",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "Side"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getCurrentSide",
        "return_type": "Side",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setStereoEnabled",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "bool"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getStereoEnabled",
        "return_type": "bool",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setStereoMode",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "StereoMode"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getStereoMode",
        "return_type": "StereoMode",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setStereoStrategy",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "StereoStrategy"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getStereoStrategy",
        "return_type": "StereoStrategy",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "setStereoShift",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "double"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "getStereoShift",
        "return_type": "double",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "draw",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "const core::visual::VisualParams *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "computeClippingPlane",
        "return_type": "void",
        "params": [
          {
            "name": "vp",
            "type": "const core::visual::VisualParams *"
          },
          {
            "name": "zNear",
            "type": "double &"
          },
          {
            "name": "zFar",
            "type": "double &"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "drawCamera",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "const core::visual::VisualParams *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "updateOutputData",
        "return_type": "void",
        "params": [],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "protected"
      }
    ]
  },
  "desc": {
    "title": "BaseCamera Component Documentation",
    "description": "**Overview**\n\nThe BaseCamera component serves as an abstract base class for defining various types of cameras in the SOFA (Simulation Open Framework Architecture) framework. It provides fundamental functionalities and properties common to all camera objects, such as position, orientation, field of view, near/far clipping planes, and viewport dimensions.\n\n**Properties & Data Members**\n\n- **Position**: `Data<type::Vec3> d_position` - Stores the 3D position of the camera in world coordinates.\n- **Orientation**: `Data<Quat> d_orientation` - Represents the orientation (rotation) of the camera using a quaternion.\n- **Look At Point**: `Data<type::Vec3> d_lookAt` - Indicates where the camera is looking at, specified by a 3D point in world coordinates.\n- **Distance to Look At**: `Data<double> d_distance` - Distance between the camera's position and its look-at point.\n- **Field of View (FOV)**: `Data<double> d_fieldOfView` - Defines the vertical field of view angle for the camera, typically used in perspective projection cameras.\n- **Near Clipping Plane**: `Data<double> d_zNear` - Distance to the near clipping plane from the viewer's position; anything closer will not be rendered.\n- **Far Clipping Plane**: `Data<double> d_zFar` - Distance to the far clipping plane from the viewer's position; objects beyond this distance are not visible.\n- **Compute Z Clip Planes**: `Data<bool> d_computeZClip` - Boolean flag that, when true, automatically computes near and far clipping planes based on the scene’s bounding box.\n- **Bounding Box Min/Max Points**: `Data<type::Vec3> d_minBBox`, `d_maxBBox` - Minimum and maximum points of the scene's bounding box used for automatic camera positioning or zooming.\n- **Viewport Dimensions**: `Data<unsigned int> d_widthViewport, d_heightViewport` - Width and height of the viewport (render target).\n- **Camera Type**: `Data<sofa::helper::OptionsGroup> d_type` - Enumerates different types of cameras such as Perspective or Orthographic.\n- **Activation Flag**: `Data<bool> d_activated` - Controls whether the camera is active and participates in rendering.\n\n**Initialization & Activation Methods**\n\n- `init()`: Called during initialization to set up default properties and configurations.\n- `reinit()`: Allows reinitialization after changes to scene or settings have been made.\n- `activate()`, `desactivate()` - Methods for turning the camera on/off, which also sets/unsets the d_activated Data member accordingly.\n\n**Camera Transformations & Conversions**\n\nThe BaseCamera provides several methods for converting between screen coordinates (pixels), viewport coordinates (normalized [0.0, 1.0]), and world coordinates (3D space). It supports common operations such as translation (`translate()`, `translateLookAt()`), rotation (`rotate()`, `rotateWorldAroundPoint()`), setting camera position/orientation with `setView()`, and fitting the view to a specified sphere or bounding box using `fitSphere()`, `fitBoundingBox()`. The `toRay()` method converts screen points into 3D rays in world space, useful for mouse picking or similar interactions.\n\n**Matrix Extraction & OpenGL Compatibility**\n\nThe component can output its model-view matrix and projection matrix as 16-element arrays of doubles, suitable for use with OpenGL. Methods like `getModelViewMatrix()`, `getProjectionMatrix()` retrieve these matrices in a format ready to be passed directly to shaders or rendering pipelines.\n\n**Customization & Stereoscopic Support**\n\nDerived classes can override the `manageEvent()` method to handle custom events and implement specific behavior based on input devices, application logic, etc. The BaseCamera also supports stereoscopic rendering through properties like stereo mode (`get/setStereoMode`), strategy (`get/setStereoStrategy`), and shift value (`get/setStereoShift`).\n\n**Drawing & Debugging**\n\nThe component provides a `draw()` method for visualizing the camera's view frustum or other elements in the scene, useful for debugging purposes. A virtual `drawCamera()` method is intended to be overridden by derived classes to provide class-specific visualization.\n",
    "tags": [
      "Base Camera",
      "SOFA Component",
      "3D Rendering",
      "OpenGL Integration",
      "Stereo Vision"
    ],
    "examples": [],
    "see_also": [],
    "source_code_links": [
      {
        "url": "./src/engine/BaseCamera.h"
      }
    ]
  },
  "maths": {
    "maths": "# Mathematical and Physical Description of BaseCamera Component\n\n## Position and Orientation\n\nThe `BaseCamera` in the SOFA framework is fundamentally defined by its position (`d_position`) and orientation (`d_orientation`). The position is a vector \\( \textbf{p} = (x, y, z) \\) that indicates where the camera is located in 3D space. Orientation is represented using a quaternion \\( q = (w, x, y, z) \\), which allows for efficient and numerically stable rotations without gimbal lock.\n\n### Quaternion Representation of Orientation\nA quaternion \\( q \\) can be decomposed as:\n\\[ q = w + xi + yj + zk \\]\nwhere \\( i^2 = j^2 = k^2 = ijk = -1 \\). The rotation matrix \\( R \\) corresponding to this quaternion is given by:\n\\[\nR(q) = \n\\begin{bmatrix}\n    1-2(y^2+z^2) & 2(xy-wz)     & 2(xz+wy)      \\\\\n    2(xy+wz)       & 1-2(x^2+z^2) & 2(yz-wx)      \\\\\n    2(xz-wy)       & 2(yz+wx)     & 1-2(x^2+y^2)\n\\end{bmatrix}\n\\]\nThe rotation matrix \\( R(q) \\) can then be used to transform vectors from the camera's local coordinate system to the world coordinate system.\n\n## Look At Point and Distance\nThe `BaseCamera` also has a look-at point (`d_lookAt`) which defines where the camera is directed. The distance between the camera position and this point is stored in `d_distance`. Given the current position \\( \textbf{p} = (x, y, z) \\) and look-at point \\( \textbf{l} = (l_x, l_y, l_z) \\), the distance can be computed as:\n\\[\nd_{distance} = ||\textbf{l} - \textbf{p}|| = \n\\sqrt{(l_x - x)^2 + (l_y - y)^2 + (l_z - z)^2}\n\\]\n\n## Field of View and Projection Matrices\nThe camera has a field of view (`d_fieldOfView`) which defines the extent of the visible scene in degrees. The projection matrix depends on whether it is an orthographic or perspective projection.\n\n### Orthographic Projection Matrix\nFor an orthographic projection, the projection matrix \\( P_{ortho} \\) can be defined as:\n\\[\nP_{ortho} = \n\\begin{bmatrix}\n    1/(r-l) & 0          & 0        & -(r+l)/(2(r-l)) \\\\\n    0       & 1/(t-b)   & 0        & -(t+b)/(2(t-b)) \\\\\n    0       & 0          & -2/(f-n) & -(f+n)/(2(f-n)) \\\\\n    0       & 0          & 0        & 1\n\\end{bmatrix}\n\\]\nwhere \\( l, r, t, b \\) are the left, right, top, and bottom clipping planes respectively, and \\( n, f \\) are the near and far clipping planes.\n\n### Perspective Projection Matrix\nFor a perspective projection, the matrix is given by:\n\\[\nP_{persp} = \n\\begin{bmatrix}\n    1/\tan(fovy/2) & 0      & 0             & 0 \\\\\n    0              & 1/h   & 0             & 0 \\\\\n    0              & 0      & -(f+n)/(f-n)  & -2fn/(f-n) \\\\\n    0              & 0      & -1            & 0\n\\end{bmatrix}\n\\]\nwhere \\( fovy \\) is the vertical field of view in radians, and \\( h \\) is the aspect ratio (width/height).\n\n## Clipping Planes\nNear (`d_zNear`) and far (`d_zFar`) clipping planes define the range of distances from the camera where objects are rendered. Anything closer than `zNear` or farther than `zFar` will not be visible.\n\n### Automatic Z-Clip Plane Computation\nIf `d_computeZClip` is true, the near and far clipping planes can be automatically computed based on the bounding box of the scene defined by its minimum (`d_minBBox`) and maximum (`d_maxBBox`) points. The center \\( C \\) and radius \\( R \\) of the scene are:\n\\[\nC = (d_{minBBox} + d_{maxBBox})/2\n\\]\n\\[\nR = ||d_{maxBBox} - d_{minBBox}|| / 2\n\\]\nThe near and far clipping planes can then be set to a reasonable distance around the scene:\n\\[ z_{Near} = C_z - R \\times k_1 \\]\n\\[ z_{Far} = C_z + R \\times k_2 \\]\nwhere \\( k_1, k_2 \\) are scaling factors.\n\n## Viewport Dimensions and Aspect Ratio\nThe viewport dimensions (`d_widthViewport`, `d_heightViewport`) define the size of the render target. The aspect ratio (\\( A = width/height \\)) is used in perspective projection matrices to maintain correct proportions when changing window sizes.\n\n### Scene Bounding Box Fit\nMethods like `fitSphere()` and `fitBoundingBox()` adjust camera parameters so that the entire scene or specified sphere/boundingBox is visible within the defined field of view. These methods typically update position, orientation, and distance based on the bounding box dimensions to ensure all relevant objects are included in the rendered image.\n\n## Ray Casting\nThe method `toRay()` converts a screen point (usually mouse cursor position) into a ray in world coordinates for picking or other interactive purposes. Given a normalized viewport coordinate \\( (u, v) \\), the corresponding ray in camera space can be computed and transformed to world space using the inverse of the model-view matrix.\n\n## Conclusion\nThe `BaseCamera` component provides foundational functionality for defining and manipulating cameras within 3D environments, utilizing mathematical concepts such as vectors, quaternions, matrices, and projection transformations. Its design supports both orthographic and perspective projections with configurable parameters to control field of view, clipping planes, and viewport dimensions."
  },
  "summary": {
    "abstract": "The `BaseCamera` component defines fundamental camera properties such as position, orientation, field of view, and clipping planes in the SOFA framework.",
    "sheet": "# BaseCamera\n\n## Overview\n\nThe `BaseCamera` is an abstract base class for defining various types of cameras within the SOFA framework. It provides essential functionalities including position (`d_position`), orientation (`d_orientation`), field of view (`d_fieldOfView`), near and far clipping planes (`d_zNear`, `d_zFar`), and viewport dimensions (`d_widthViewport`, `d_heightViewport`). The component supports both perspective and orthographic projections.\n\n## Parameters and Data\n\nThe significant data fields exposed by the `BaseCamera` include:\n\n- **Position**: `Data<type::Vec3> d_position` - Stores the 3D position of the camera in world coordinates.\n- **Orientation**: `Data<Quat> d_orientation` - Represents the orientation (rotation) of the camera using a quaternion.\n- **Look At Point**: `Data<type::Vec3> d_lookAt` - Indicates where the camera is looking at, specified by a 3D point in world coordinates.\n- **Distance to Look At**: `Data<double> d_distance` - Distance between the camera's position and its look-at point.\n- **Field of View (FOV)**: `Data<double> d_fieldOfView` - Defines the vertical field of view angle for the camera, typically used in perspective projection cameras.\n- **Near Clipping Plane**: `Data<double> d_zNear` - Distance to the near clipping plane from the viewer's position; anything closer will not be rendered.\n- **Far Clipping Plane**: `Data<double> d_zFar` - Distance to the far clipping plane from the viewer's position; objects beyond this distance are not visible.\n- **Compute Z Clip Planes**: `Data<bool> d_computeZClip` - Boolean flag that, when true, automatically computes near and far clipping planes based on the scene’s bounding box.\n- **Bounding Box Min/Max Points**: `Data<type::Vec3> d_minBBox`, `d_maxBBox` - Minimum and maximum points of the scene's bounding box used for automatic camera positioning or zooming.\n- **Viewport Dimensions**: `Data<unsigned int> d_widthViewport, d_heightViewport` - Width and height of the viewport (render target).\n- **Camera Type**: `Data<sofa::helper::OptionsGroup> d_type` - Enumerates different types of cameras such as Perspective or Orthographic.\n- **Activation Flag**: `Data<bool> d_activated` - Controls whether the camera is active and participates in rendering.\n\n## Mathematical Model\n\n### Position and Orientation\n\nThe position of the camera is defined by a vector \\(\\mathbf{p} = (x, y, z)\\). The orientation is represented using a quaternion \\(q = w + xi + yj + zk\\), which can be decomposed into a rotation matrix \\(R(q)\\):\n\n\begin{equation*}\n    R(q) = \n    \\begin{bmatrix}\n        1-2(y^2+z^2) & 2(xy-wz)     & 2(xz+wy)      \\\\\n        2(xy+wz)       & 1-2(x^2+z^2) & 2(yz-wx)      \\\\\n        2(xz-wy)       & 2(yz+wx)     & 1-2(x^2+y^2)\n    \\end{bmatrix}\n\\end{equation*}\n\n### Look At Point and Distance\n\nThe distance between the camera position \\(\\mathbf{p} = (x, y, z)\\) and the look-at point \\(\\mathbf{l} = (l_x, l_y, l_z)\\) is given by:\n\n\begin{equation*}\n    d_{distance} = ||\\mathbf{l} - \\mathbf{p}|| = \n    \\sqrt{(l_x - x)^2 + (l_y - y)^2 + (l_z - z)^2}\n\\end{equation*}\n\n### Field of View and Projection Matrices\n\nThe projection matrix depends on whether it is an orthographic or perspective projection.\n\n#### Orthographic Projection Matrix\n\nFor an orthographic projection, the projection matrix \\(P_{ortho}\\) can be defined as:\n\n\begin{equation*}\n    P_{ortho} = \n    \\begin{bmatrix}\n        1/(r-l) & 0          & 0        & -(r+l)/(2(r-l)) \\\\\n        0       & 1/(t-b)   & 0        & -(t+b)/(2(t-b)) \\\\\n        0       & 0          & -2/(f-n) & -(f+n)/(2(f-n)) \\\\\n        0       & 0          & 0        & 1\n    \\end{bmatrix}\n\\end{equation*}\n\nwhere \\(l, r, t, b\\) are the left, right, top, and bottom clipping planes respectively, and \\(n, f\\) are the near and far clipping planes.\n\n#### Perspective Projection Matrix\n\nFor a perspective projection, the matrix is given by:\n\n\begin{equation*}\n    P_{persp} = \n    \\begin{bmatrix}\n        1/\\tan(fovy/2) & 0      & 0             & 0 \\\\\n        0              & 1/h   & 0             & 0 \\\\\n        0              & 0      & -(f+n)/(f-n)  & -2fn/(f-n) \\\\\n        0              & 0      & -1            & 0\n    \\end{bmatrix}\n\\end{equation*}\n\nwhere \\(fovy\\) is the vertical field of view in radians, and \\(h\\) is the aspect ratio (width/height).\n\n### Clipping Planes\n\nNear (`d_zNear`) and far (`d_zFar`) clipping planes define the range of distances from the camera where objects are rendered. Anything closer than `zNear` or farther than `zFar` will not be visible.\n\n#### Automatic Z-Clip Plane Computation\n\nIf `d_computeZClip` is true, the near and far clipping planes can be automatically computed based on the bounding box of the scene defined by its minimum (`d_minBBox`) and maximum (`d_maxBBox`) points. The center \\(C\\) and radius \\(R\\) of the scene are:\n\n\begin{equation*}\n    C = (d_{minBBox} + d_{maxBBox})/2\n\\end{equation*}\n\n\begin{equation*}\n    R = ||d_{maxBBox} - d_{minBBox}|| / 2\n\\end{equation*}\n\nThe near and far clipping planes can then be set to a reasonable distance around the scene:\n\n\begin{align*}\n    z_{Near} &= C_z - R \\times k_1 \\\\\n    z_{Far} &= C_z + R \\times k_2\n\\end{align*}\n\nwhere \\(k_1, k_2\\) are scaling factors.\n\n## Practical Notes\n\nThe `BaseCamera` component is intended to be subclassed for specific camera types and behaviors. It provides methods for setting up the camera view (`setView()`, `setDefaultView()`), fitting the view to a bounding box or sphere (`fitBoundingBox()`, `fitSphere()`), and handling stereoscopic rendering through properties like stereo mode, strategy, and shift value."
  }
}