OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    Graphic3d_Camera Class Reference

    Forward declaration. More...

    #include <Graphic3d_Camera.hxx>

    Inheritance diagram for Graphic3d_Camera:

    Public Types

    enum  Projection {
      Projection_Orthographic , Projection_Perspective , Projection_Stereo , Projection_MonoLeftEye ,
      Projection_MonoRightEye
    }
     Enumerates supported monographic projections. More...
    enum  FocusType { FocusType_Absolute , FocusType_Relative }
     Enumerates approaches to define stereographic focus. More...
    enum  IODType { IODType_Absolute , IODType_Relative }
     Enumerates approaches to define Intraocular distance. More...
    typedef void base_type
     Returns a type descriptor about this object.

    Public Member Functions

     Graphic3d_Camera ()
     Default constructor. Initializes camera with the following properties: Eye (0, 0, -2); Center (0, 0, 0); Up (0, 1, 0); Type (Orthographic); FOVy (45); Scale (1000); IsStereo(false); ZNear (0.001); ZFar (3000.0); Aspect(1); ZFocus(1.0); ZFocusType(Relative); IOD(0.05); IODType(Relative).
     Graphic3d_Camera (const occ::handle< Graphic3d_Camera > &theOther)
     Copy constructor.
    void CopyMappingData (const occ::handle< Graphic3d_Camera > &theOtherCamera)
     Initialize mapping related parameters from other camera handle.
    void CopyOrientationData (const occ::handle< Graphic3d_Camera > &theOtherCamera)
     Initialize orientation related parameters from other camera handle.
    void Copy (const occ::handle< Graphic3d_Camera > &theOther)
     Copy properties of another camera.
    Public camera properties
    const gp_DirDirection () const
     Get camera look direction.
    void SetDirectionFromEye (const gp_Dir &theDir)
     Sets camera look direction preserving the current Eye() position. WARNING! This method does NOT verify that the current Up() vector is orthogonal to the new Direction.
    void SetDirection (const gp_Dir &theDir)
     Sets camera look direction and computes the new Eye position relative to current Center. WARNING! This method does NOT verify that the current Up() vector is orthogonal to the new Direction.
    const gp_DirUp () const
     Get camera Up direction vector.
    void SetUp (const gp_Dir &theUp)
     Sets camera Up direction vector, orthogonal to camera direction. WARNING! This method does NOT verify that the new Up vector is orthogonal to the current Direction().
    void OrthogonalizeUp ()
     Orthogonalize up direction vector.
    gp_Dir OrthogonalizedUp () const
     Return a copy of orthogonalized up direction vector.
    gp_Dir SideRight () const
     Right side direction.
    const gp_PntEye () const
     Get camera Eye position.
    void MoveEyeTo (const gp_Pnt &theEye)
     Sets camera Eye position. Unlike SetEye(), this method only changes Eye point and preserves camera direction.
    void SetEyeAndCenter (const gp_Pnt &theEye, const gp_Pnt &theCenter)
     Sets camera Eye and Center positions.
    void SetEye (const gp_Pnt &theEye)
     Sets camera Eye position. WARNING! For backward compatibility reasons, this method also changes view direction, so that the new direction is computed from new Eye position to old Center position.
    gp_Pnt Center () const
     Get Center of the camera, e.g. the point where camera looks at. This point is computed as Eye() translated along Direction() at Distance().
    void SetCenter (const gp_Pnt &theCenter)
     Sets Center of the camera, e.g. the point where camera looks at. This methods changes camera direction, so that the new direction is computed from current Eye position to specified Center position.
    double Distance () const
     Get distance of Eye from camera Center.
    void SetDistance (const double theDistance)
     Set distance of Eye from camera Center.
    double Scale () const
     Get camera scale.
    void SetScale (const double theScale)
     Sets camera scale. For orthographic projection the scale factor corresponds to parallel scale of view mapping (i.e. size of viewport). For perspective camera scale is converted to distance. The scale specifies equal size of the view projection in both dimensions assuming that the aspect is 1.0. The projection height and width are specified with the scale and correspondingly multiplied by the aspect.
    const gp_XYZAxialScale () const
     Get camera axial scale.
    void SetAxialScale (const gp_XYZ &theAxialScale)
     Set camera axial scale.
    void SetProjectionType (const Projection theProjection)
     Change camera projection type. When switching to perspective projection from orthographic one, the ZNear and ZFar are reset to default values (0.001, 3000.0) if less than 0.0.
    Projection ProjectionType () const
    bool IsOrthographic () const
     Check that the camera projection is orthographic.
    bool IsStereo () const
     Check whether the camera projection is stereo. Please note that stereo rendering is now implemented with support of Quad buffering.
    void SetFOVy (const double theFOVy)
     Set Field Of View (FOV) in y axis for perspective projection. Field of View in x axis is automatically scaled from view aspect ratio.
    double FOVy () const
     Get Field Of View (FOV) in y axis.
    double FOVx () const
     Get Field Of View (FOV) in x axis.
    double FOV2d () const
     Get Field Of View (FOV) restriction for 2D on-screen elements; 180 degrees by default. When 2D FOV is smaller than FOVy or FOVx, 2D elements defined within offset from view corner will be extended to fit into specified 2D FOV. This can be useful to make 2D elements sharply visible, like in case of HMD normally having extra large FOVy.
    void SetFOV2d (double theFOV)
     Set Field Of View (FOV) restriction for 2D on-screen elements.
    bool FitMinMax (const Bnd_Box &theBox, const double theResolution, const bool theToEnlargeIfLine)
     Adjust camera to fit in specified AABB.
    bool ZFitAll (const double theScaleFactor, const Bnd_Box &theMinMax, const Bnd_Box &theGraphicBB, double &theZNear, double &theZFar) const
     Estimate Z-min and Z-max planes of projection volume to match the displayed objects. The methods ensures that view volume will be close by depth range to the displayed objects. Fitting assumes that for orthogonal projection the view volume contains the displayed objects completely. For zoomed perspective view, the view volume is adjusted such that it contains the objects or their parts, located in front of the camera.
    void ZFitAll (const double theScaleFactor, const Bnd_Box &theMinMax, const Bnd_Box &theGraphicBB)
     Change Z-min and Z-max planes of projection volume to match the displayed objects.
    void SetZRange (const double theZNear, const double theZFar)
     Change the Near and Far Z-clipping plane positions. For orthographic projection, theZNear, theZFar can be negative or positive. For perspective projection, only positive values are allowed. Program error exception is raised if non-positive values are specified for perspective projection or theZNear >= theZFar.
    double ZNear () const
     Get the Near Z-clipping plane position.
    double ZFar () const
     Get the Far Z-clipping plane position.
    bool IsZeroToOneDepth () const
     Return TRUE if camera should calculate projection matrix for [0, 1] depth range or for [-1, 1] range. FALSE by default.
    void SetZeroToOneDepth (bool theIsZeroToOne)
     Set using [0, 1] depth range or [-1, 1] range.
    void SetAspect (const double theAspect)
     Changes width / height display ratio.
    double Aspect () const
     Get camera display ratio.
    void SetZFocus (const FocusType theType, const double theZFocus)
     Sets stereographic focus distance.
    double ZFocus () const
     Get stereographic focus value.
    FocusType ZFocusType () const
     Get stereographic focus definition type.
    void SetIOD (const IODType theType, const double theIOD)
     Sets Intraocular distance.
    double IOD () const
     Get Intraocular distance value.
    IODType GetIODType () const
     Get Intraocular distance definition type.
    const Graphic3d_CameraTileTile () const
     Get current tile.
    void SetTile (const Graphic3d_CameraTile &theTile)
     Sets the Tile defining the drawing sub-area within View. Note that tile defining a region outside the view boundaries is also valid - use method Graphic3d_CameraTile::Cropped() to assign a cropped copy.
    void SetIdentityOrientation ()
     Sets camera parameters to make current orientation matrix identity one.
    Basic camera operations
    void Transform (const gp_Trsf &theTrsf)
     Transform orientation components of the camera: Eye, Up and Center points.
    gp_XYZ ViewDimensions () const
     Calculate view plane size at center (target) point and distance between ZFar and ZNear planes.
    gp_XYZ ViewDimensions (const double theZValue) const
     Calculate view plane size at center point with specified Z offset and distance between ZFar and ZNear planes.
    double NDC2dOffsetX () const
     Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVx exceeds FOV2d.
    double NDC2dOffsetY () const
     Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVy exceeds FOV2d.
    void Frustum (gp_Pln &theLeft, gp_Pln &theRight, gp_Pln &theBottom, gp_Pln &theTop, gp_Pln &theNear, gp_Pln &theFar) const
     Calculate WCS frustum planes for the camera projection volume. Frustum is a convex volume determined by six planes directing inwards. The frustum planes are usually used as inputs for camera algorithms. Thus, if any changes to projection matrix calculation are necessary, the frustum planes calculation should be also touched.
    Projection methods
    gp_Pnt Project (const gp_Pnt &thePnt) const
     Project point from world coordinate space to normalized device coordinates (mapping).
    gp_Pnt UnProject (const gp_Pnt &thePnt) const
     Unproject point from normalized device coordinates to world coordinate space.
    gp_Pnt ConvertView2Proj (const gp_Pnt &thePnt) const
     Convert point from view coordinate space to projection coordinate space.
    gp_Pnt ConvertProj2View (const gp_Pnt &thePnt) const
     Convert point from projection coordinate space to view coordinate space.
    gp_Pnt ConvertWorld2View (const gp_Pnt &thePnt) const
     Convert point from world coordinate space to view coordinate space.
    gp_Pnt ConvertView2World (const gp_Pnt &thePnt) const
     Convert point from view coordinate space to world coordinates.
    Camera modification state
    const Graphic3d_WorldViewProjStateWorldViewProjState () const
    size_t ProjectionState () const
     Returns modification state of camera projection matrix.
    size_t WorldViewState () const
     Returns modification state of camera world view transformation matrix.
    Lazily-computed orientation and projection matrices derived from camera parameters
    const NCollection_Mat4< double > & OrientationMatrix () const
     Get orientation matrix.
    const NCollection_Mat4< float > & OrientationMatrixF () const
     Get orientation matrix of float precision.
    const NCollection_Mat4< double > & ProjectionMatrix () const
     Get monographic or middle point projection matrix used for monographic rendering and for point projection / unprojection.
    const NCollection_Mat4< float > & ProjectionMatrixF () const
     Get monographic or middle point projection matrix of float precision used for monographic rendering and for point projection / unprojection.
    const NCollection_Mat4< double > & ProjectionStereoLeft () const
    const NCollection_Mat4< float > & ProjectionStereoLeftF () const
    const NCollection_Mat4< double > & ProjectionStereoRight () const
    const NCollection_Mat4< float > & ProjectionStereoRightF () const
    void InvalidateProjection ()
     Invalidate state of projection matrix. The matrix will be updated on request.
    void InvalidateOrientation ()
     Invalidate orientation matrix. The matrix will be updated on request.
    void StereoProjection (NCollection_Mat4< double > &theProjL, NCollection_Mat4< double > &theHeadToEyeL, NCollection_Mat4< double > &theProjR, NCollection_Mat4< double > &theHeadToEyeR) const
     Get stereo projection matrices.
    void StereoProjectionF (NCollection_Mat4< float > &theProjL, NCollection_Mat4< float > &theHeadToEyeL, NCollection_Mat4< float > &theProjR, NCollection_Mat4< float > &theHeadToEyeR) const
     Get stereo projection matrices.
    void ResetCustomProjection ()
     Unset all custom frustums and projection matrices.
    bool IsCustomStereoFrustum () const
     Return TRUE if custom stereo frustums are set.
    void SetCustomStereoFrustums (const Aspect_FrustumLRBT< double > &theFrustumL, const Aspect_FrustumLRBT< double > &theFrustumR)
     Set custom stereo frustums. These can be retrieved from APIs like OpenVR.
    bool IsCustomStereoProjection () const
     Return TRUE if custom stereo projection matrices are set.
    void SetCustomStereoProjection (const NCollection_Mat4< double > &theProjL, const NCollection_Mat4< double > &theHeadToEyeL, const NCollection_Mat4< double > &theProjR, const NCollection_Mat4< double > &theHeadToEyeR)
     Set custom stereo projection matrices.
    bool IsCustomMonoProjection () const
     Return TRUE if custom projection matrix is set.
    void SetCustomMonoProjection (const NCollection_Mat4< double > &theProj)
     Set custom projection matrix.
    void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
     Dumps the content of me into the stream.
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transientoperator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool IsKind (const opencascade::handle< Standard_Type > &theType) const
     Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    bool IsKind (const char *const theTypeName) const
     Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    Standard_TransientThis () const
     Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Static Public Member Functions

    static void Interpolate (const occ::handle< Graphic3d_Camera > &theStart, const occ::handle< Graphic3d_Camera > &theEnd, const double theT, occ::handle< Graphic3d_Camera > &theCamera)
     Linear interpolation tool for camera orientation and position. This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.
    static constexpr const char * get_type_name ()
     Returns a type descriptor about this object.
    static const opencascade::handle< Standard_Type > & get_type_descriptor ()
     Returns type descriptor of Standard_Transient class.

    Managing projection and orientation cache

    enum  {
      FrustumVert_LeftBottomNear , FrustumVert_LeftBottomFar , FrustumVert_LeftTopNear , FrustumVert_LeftTopFar ,
      FrustumVert_RightBottomNear , FrustumVert_RightBottomFar , FrustumVert_RightTopNear , FrustumVert_RightTopFar ,
      FrustumVerticesNB
    }
     Enumerates vertices of view volume. More...
    void FrustumPoints (NCollection_Array1< NCollection_Vec3< double > > &thePoints, const NCollection_Mat4< double > &theModelWorld=NCollection_Mat4< double >()) const
     Fill array of current view frustum corners. The size of this array is equal to FrustumVerticesNB. The order of vertices is as defined in FrustumVert_* enumeration.

    Detailed Description

    Forward declaration.

    Camera class provides object-oriented approach to setting up projection and orientation properties of 3D view.

    Member Enumeration Documentation

    ◆ anonymous enum

    anonymous enum

    Enumerates vertices of view volume.

    Enumerator
    FrustumVert_LeftBottomNear 
    FrustumVert_LeftBottomFar 
    FrustumVert_LeftTopNear 
    FrustumVert_LeftTopFar 
    FrustumVert_RightBottomNear 
    FrustumVert_RightBottomFar 
    FrustumVert_RightTopNear 
    FrustumVert_RightTopFar 
    FrustumVerticesNB 

    ◆ FocusType

    Enumerates approaches to define stereographic focus.

    • FocusType_Absolute : focus is specified as absolute value.
    • FocusType_Relative : focus is specified relative to (as coefficient of) camera focal length.
    Enumerator
    FocusType_Absolute 
    FocusType_Relative 

    ◆ IODType

    Enumerates approaches to define Intraocular distance.

    • IODType_Absolute : Intraocular distance is defined as absolute value.
    • IODType_Relative : Intraocular distance is defined relative to (as coefficient of) camera focal length.
    Enumerator
    IODType_Absolute 
    IODType_Relative 

    ◆ Projection

    Enumerates supported monographic projections.

    • Projection_Orthographic : orthographic projection.
    • Projection_Perspective : perspective projection.
    • Projection_Stereo : stereographic projection.
    • Projection_MonoLeftEye : mono projection for stereo left eye.
    • Projection_MonoRightEye : mono projection for stereo right eye.
    Enumerator
    Projection_Orthographic 
    Projection_Perspective 
    Projection_Stereo 
    Projection_MonoLeftEye 
    Projection_MonoRightEye 

    Constructor & Destructor Documentation

    ◆ Graphic3d_Camera() [1/2]

    Graphic3d_Camera::Graphic3d_Camera ( )

    Default constructor. Initializes camera with the following properties: Eye (0, 0, -2); Center (0, 0, 0); Up (0, 1, 0); Type (Orthographic); FOVy (45); Scale (1000); IsStereo(false); ZNear (0.001); ZFar (3000.0); Aspect(1); ZFocus(1.0); ZFocusType(Relative); IOD(0.05); IODType(Relative).

    ◆ Graphic3d_Camera() [2/2]

    Graphic3d_Camera::Graphic3d_Camera ( const occ::handle< Graphic3d_Camera > & theOther)

    Copy constructor.

    Parameters
    [in]theOtherthe camera to copy from.

    Member Function Documentation

    ◆ Aspect()

    double Graphic3d_Camera::Aspect ( ) const
    inline

    Get camera display ratio.

    Returns
    display ratio.

    ◆ AxialScale()

    const gp_XYZ & Graphic3d_Camera::AxialScale ( ) const
    inline

    Get camera axial scale.

    Returns
    Camera's axial scale.

    ◆ Center()

    gp_Pnt Graphic3d_Camera::Center ( ) const
    inline

    Get Center of the camera, e.g. the point where camera looks at. This point is computed as Eye() translated along Direction() at Distance().

    Returns
    the point where the camera looks at.

    ◆ ConvertProj2View()

    gp_Pnt Graphic3d_Camera::ConvertProj2View ( const gp_Pnt & thePnt) const

    Convert point from projection coordinate space to view coordinate space.

    Parameters
    [in]thePntthe point in NDC.
    Returns
    point in VCS.

    ◆ ConvertView2Proj()

    gp_Pnt Graphic3d_Camera::ConvertView2Proj ( const gp_Pnt & thePnt) const

    Convert point from view coordinate space to projection coordinate space.

    Parameters
    [in]thePntthe point in VCS.
    Returns
    point in NDC.

    ◆ ConvertView2World()

    gp_Pnt Graphic3d_Camera::ConvertView2World ( const gp_Pnt & thePnt) const

    Convert point from view coordinate space to world coordinates.

    Parameters
    [in]thePntthe 3D point in VCS.
    Returns
    point in WCS.

    ◆ ConvertWorld2View()

    gp_Pnt Graphic3d_Camera::ConvertWorld2View ( const gp_Pnt & thePnt) const

    Convert point from world coordinate space to view coordinate space.

    Parameters
    [in]thePntthe 3D point in WCS.
    Returns
    point in VCS.

    ◆ Copy()

    void Graphic3d_Camera::Copy ( const occ::handle< Graphic3d_Camera > & theOther)

    Copy properties of another camera.

    Parameters
    [in]theOtherthe camera to copy from.

    ◆ CopyMappingData()

    void Graphic3d_Camera::CopyMappingData ( const occ::handle< Graphic3d_Camera > & theOtherCamera)

    Initialize mapping related parameters from other camera handle.

    ◆ CopyOrientationData()

    void Graphic3d_Camera::CopyOrientationData ( const occ::handle< Graphic3d_Camera > & theOtherCamera)

    Initialize orientation related parameters from other camera handle.

    ◆ Direction()

    const gp_Dir & Graphic3d_Camera::Direction ( ) const
    inline

    Get camera look direction.

    Returns
    camera look direction.

    ◆ Distance()

    double Graphic3d_Camera::Distance ( ) const
    inline

    Get distance of Eye from camera Center.

    Returns
    the distance.

    ◆ DumpJson()

    void Graphic3d_Camera::DumpJson ( Standard_OStream & theOStream,
    int theDepth = -1 ) const

    Dumps the content of me into the stream.

    ◆ Eye()

    const gp_Pnt & Graphic3d_Camera::Eye ( ) const
    inline

    Get camera Eye position.

    Returns
    camera eye location.

    ◆ FitMinMax()

    bool Graphic3d_Camera::FitMinMax ( const Bnd_Box & theBox,
    const double theResolution,
    const bool theToEnlargeIfLine )

    Adjust camera to fit in specified AABB.

    ◆ FOV2d()

    double Graphic3d_Camera::FOV2d ( ) const
    inline

    Get Field Of View (FOV) restriction for 2D on-screen elements; 180 degrees by default. When 2D FOV is smaller than FOVy or FOVx, 2D elements defined within offset from view corner will be extended to fit into specified 2D FOV. This can be useful to make 2D elements sharply visible, like in case of HMD normally having extra large FOVy.

    ◆ FOVx()

    double Graphic3d_Camera::FOVx ( ) const
    inline

    Get Field Of View (FOV) in x axis.

    Returns
    the FOV value in degrees.

    ◆ FOVy()

    double Graphic3d_Camera::FOVy ( ) const
    inline

    Get Field Of View (FOV) in y axis.

    Returns
    the FOV value in degrees.

    ◆ Frustum()

    void Graphic3d_Camera::Frustum ( gp_Pln & theLeft,
    gp_Pln & theRight,
    gp_Pln & theBottom,
    gp_Pln & theTop,
    gp_Pln & theNear,
    gp_Pln & theFar ) const

    Calculate WCS frustum planes for the camera projection volume. Frustum is a convex volume determined by six planes directing inwards. The frustum planes are usually used as inputs for camera algorithms. Thus, if any changes to projection matrix calculation are necessary, the frustum planes calculation should be also touched.

    Parameters
    [out]theLeftthe frustum plane for left side of view.
    [out]theRightthe frustum plane for right side of view.
    [out]theBottomthe frustum plane for bottom side of view.
    [out]theTopthe frustum plane for top side of view.
    [out]theNearthe frustum plane for near side of view.
    [out]theFarthe frustum plane for far side of view.

    ◆ FrustumPoints()

    void Graphic3d_Camera::FrustumPoints ( NCollection_Array1< NCollection_Vec3< double > > & thePoints,
    const NCollection_Mat4< double > & theModelWorld = NCollection_Mat4< double >() ) const

    Fill array of current view frustum corners. The size of this array is equal to FrustumVerticesNB. The order of vertices is as defined in FrustumVert_* enumeration.

    ◆ GetIODType()

    IODType Graphic3d_Camera::GetIODType ( ) const
    inline

    Get Intraocular distance definition type.

    Returns
    definition type used for Intraocular distance.

    ◆ Interpolate()

    void Graphic3d_Camera::Interpolate ( const occ::handle< Graphic3d_Camera > & theStart,
    const occ::handle< Graphic3d_Camera > & theEnd,
    const double theT,
    occ::handle< Graphic3d_Camera > & theCamera )
    static

    Linear interpolation tool for camera orientation and position. This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.

    See also
    NCollection_Lerp<occ::handle<Graphic3d_Camera>>

    Eye/Center interpolation is performed through defining an anchor point in-between Center and Eye. The anchor position is defined as point near to the camera point which has smaller translation part. The main idea is to keep the distance between Center and Eye (which will change if Center and Eye translation will be interpolated independently). E.g.:

    • When both Center and Eye are moved at the same vector -> both will be just translated by straight line;
    • When Center is not moved -> camera Eye will move around Center through arc;
    • When Eye is not moved -> camera Center will move around Eye through arc;
    • When both Center and Eye are move by different vectors -> transformation will be something in between, and will try interpolate linearly the distance between Center and Eye.

    This transformation might be not in line with user expectations. In this case, application might define intermediate camera positions for interpolation or implement own interpolation logic.

    Parameters
    [in]theStartinitial camera position
    [in]theEndfinal camera position
    [in]theTstep between initial and final positions within [0,1] range
    [out]theCamerainterpolation result

    ◆ InvalidateOrientation()

    void Graphic3d_Camera::InvalidateOrientation ( )

    Invalidate orientation matrix. The matrix will be updated on request.

    ◆ InvalidateProjection()

    void Graphic3d_Camera::InvalidateProjection ( )

    Invalidate state of projection matrix. The matrix will be updated on request.

    ◆ IOD()

    double Graphic3d_Camera::IOD ( ) const
    inline

    Get Intraocular distance value.

    Returns
    absolute or relative IOD value depending on its definition type.

    ◆ IsCustomMonoProjection()

    bool Graphic3d_Camera::IsCustomMonoProjection ( ) const
    inline

    Return TRUE if custom projection matrix is set.

    ◆ IsCustomStereoFrustum()

    bool Graphic3d_Camera::IsCustomStereoFrustum ( ) const
    inline

    Return TRUE if custom stereo frustums are set.

    ◆ IsCustomStereoProjection()

    bool Graphic3d_Camera::IsCustomStereoProjection ( ) const
    inline

    Return TRUE if custom stereo projection matrices are set.

    ◆ IsOrthographic()

    bool Graphic3d_Camera::IsOrthographic ( ) const
    inline

    Check that the camera projection is orthographic.

    Returns
    boolean flag that indicates whether the camera's projection is orthographic or not.

    ◆ IsStereo()

    bool Graphic3d_Camera::IsStereo ( ) const
    inline

    Check whether the camera projection is stereo. Please note that stereo rendering is now implemented with support of Quad buffering.

    Returns
    boolean flag indicating whether the stereographic L/R projection is chosen.

    ◆ IsZeroToOneDepth()

    bool Graphic3d_Camera::IsZeroToOneDepth ( ) const
    inline

    Return TRUE if camera should calculate projection matrix for [0, 1] depth range or for [-1, 1] range. FALSE by default.

    ◆ MoveEyeTo()

    void Graphic3d_Camera::MoveEyeTo ( const gp_Pnt & theEye)

    Sets camera Eye position. Unlike SetEye(), this method only changes Eye point and preserves camera direction.

    Parameters
    [in]theEyethe location of camera's Eye.
    See also
    SetEye()

    ◆ NDC2dOffsetX()

    double Graphic3d_Camera::NDC2dOffsetX ( ) const
    inline

    Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVx exceeds FOV2d.

    ◆ NDC2dOffsetY()

    double Graphic3d_Camera::NDC2dOffsetY ( ) const
    inline

    Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVy exceeds FOV2d.

    ◆ OrientationMatrix()

    const NCollection_Mat4< double > & Graphic3d_Camera::OrientationMatrix ( ) const

    Get orientation matrix.

    Returns
    camera orientation matrix.

    ◆ OrientationMatrixF()

    const NCollection_Mat4< float > & Graphic3d_Camera::OrientationMatrixF ( ) const

    Get orientation matrix of float precision.

    Returns
    camera orientation matrix.

    ◆ OrthogonalizedUp()

    gp_Dir Graphic3d_Camera::OrthogonalizedUp ( ) const

    Return a copy of orthogonalized up direction vector.

    ◆ OrthogonalizeUp()

    void Graphic3d_Camera::OrthogonalizeUp ( )

    Orthogonalize up direction vector.

    ◆ Project()

    gp_Pnt Graphic3d_Camera::Project ( const gp_Pnt & thePnt) const

    Project point from world coordinate space to normalized device coordinates (mapping).

    Parameters
    [in]thePntthe 3D point in WCS.
    Returns
    mapped point in NDC.

    ◆ ProjectionMatrix()

    const NCollection_Mat4< double > & Graphic3d_Camera::ProjectionMatrix ( ) const

    Get monographic or middle point projection matrix used for monographic rendering and for point projection / unprojection.

    Returns
    monographic projection matrix.

    ◆ ProjectionMatrixF()

    const NCollection_Mat4< float > & Graphic3d_Camera::ProjectionMatrixF ( ) const

    Get monographic or middle point projection matrix of float precision used for monographic rendering and for point projection / unprojection.

    Returns
    monographic projection matrix.

    ◆ ProjectionState()

    size_t Graphic3d_Camera::ProjectionState ( ) const
    inline

    Returns modification state of camera projection matrix.

    ◆ ProjectionStereoLeft()

    const NCollection_Mat4< double > & Graphic3d_Camera::ProjectionStereoLeft ( ) const
    Returns
    stereographic matrix computed for left eye. Please note that this method is used for rendering for Projection_Stereo.

    ◆ ProjectionStereoLeftF()

    const NCollection_Mat4< float > & Graphic3d_Camera::ProjectionStereoLeftF ( ) const
    Returns
    stereographic matrix of float precision computed for left eye. Please note that this method is used for rendering for Projection_Stereo.

    ◆ ProjectionStereoRight()

    const NCollection_Mat4< double > & Graphic3d_Camera::ProjectionStereoRight ( ) const
    Returns
    stereographic matrix computed for right eye. Please note that this method is used for rendering for Projection_Stereo.

    ◆ ProjectionStereoRightF()

    const NCollection_Mat4< float > & Graphic3d_Camera::ProjectionStereoRightF ( ) const
    Returns
    stereographic matrix of float precision computed for right eye. Please note that this method is used for rendering for Projection_Stereo.

    ◆ ProjectionType()

    Projection Graphic3d_Camera::ProjectionType ( ) const
    inline
    Returns
    camera projection type.

    ◆ ResetCustomProjection()

    void Graphic3d_Camera::ResetCustomProjection ( )

    Unset all custom frustums and projection matrices.

    ◆ Scale()

    double Graphic3d_Camera::Scale ( ) const

    Get camera scale.

    Returns
    camera scale factor.

    ◆ SetAspect()

    void Graphic3d_Camera::SetAspect ( const double theAspect)

    Changes width / height display ratio.

    Parameters
    [in]theAspectthe display ratio.

    ◆ SetAxialScale()

    void Graphic3d_Camera::SetAxialScale ( const gp_XYZ & theAxialScale)

    Set camera axial scale.

    Parameters
    [in]theAxialScalethe axial scale vector.

    ◆ SetCenter()

    void Graphic3d_Camera::SetCenter ( const gp_Pnt & theCenter)

    Sets Center of the camera, e.g. the point where camera looks at. This methods changes camera direction, so that the new direction is computed from current Eye position to specified Center position.

    Parameters
    [in]theCenterthe point where the camera looks at.

    ◆ SetCustomMonoProjection()

    void Graphic3d_Camera::SetCustomMonoProjection ( const NCollection_Mat4< double > & theProj)

    Set custom projection matrix.

    ◆ SetCustomStereoFrustums()

    void Graphic3d_Camera::SetCustomStereoFrustums ( const Aspect_FrustumLRBT< double > & theFrustumL,
    const Aspect_FrustumLRBT< double > & theFrustumR )

    Set custom stereo frustums. These can be retrieved from APIs like OpenVR.

    ◆ SetCustomStereoProjection()

    void Graphic3d_Camera::SetCustomStereoProjection ( const NCollection_Mat4< double > & theProjL,
    const NCollection_Mat4< double > & theHeadToEyeL,
    const NCollection_Mat4< double > & theProjR,
    const NCollection_Mat4< double > & theHeadToEyeR )

    Set custom stereo projection matrices.

    Parameters
    [in]theProjLleft eye projection matrix
    [in]theHeadToEyeLleft head to eye translation matrix
    [in]theProjRright eye projection matrix
    [in]theHeadToEyeRright head to eye translation matrix

    ◆ SetDirection()

    void Graphic3d_Camera::SetDirection ( const gp_Dir & theDir)

    Sets camera look direction and computes the new Eye position relative to current Center. WARNING! This method does NOT verify that the current Up() vector is orthogonal to the new Direction.

    Parameters
    [in]theDirthe direction.

    ◆ SetDirectionFromEye()

    void Graphic3d_Camera::SetDirectionFromEye ( const gp_Dir & theDir)

    Sets camera look direction preserving the current Eye() position. WARNING! This method does NOT verify that the current Up() vector is orthogonal to the new Direction.

    Parameters
    [in]theDirthe direction.

    ◆ SetDistance()

    void Graphic3d_Camera::SetDistance ( const double theDistance)

    Set distance of Eye from camera Center.

    Parameters
    [in]theDistancethe distance.

    ◆ SetEye()

    void Graphic3d_Camera::SetEye ( const gp_Pnt & theEye)

    Sets camera Eye position. WARNING! For backward compatibility reasons, this method also changes view direction, so that the new direction is computed from new Eye position to old Center position.

    Parameters
    [in]theEyethe location of camera's Eye.
    See also
    MoveEyeTo(), SetEyeAndCenter()

    ◆ SetEyeAndCenter()

    void Graphic3d_Camera::SetEyeAndCenter ( const gp_Pnt & theEye,
    const gp_Pnt & theCenter )

    Sets camera Eye and Center positions.

    Parameters
    [in]theEyethe location of camera's Eye
    [in]theCenterthe location of camera's Center

    ◆ SetFOV2d()

    void Graphic3d_Camera::SetFOV2d ( double theFOV)

    Set Field Of View (FOV) restriction for 2D on-screen elements.

    ◆ SetFOVy()

    void Graphic3d_Camera::SetFOVy ( const double theFOVy)

    Set Field Of View (FOV) in y axis for perspective projection. Field of View in x axis is automatically scaled from view aspect ratio.

    Parameters
    [in]theFOVythe FOV in degrees.

    ◆ SetIdentityOrientation()

    void Graphic3d_Camera::SetIdentityOrientation ( )

    Sets camera parameters to make current orientation matrix identity one.

    ◆ SetIOD()

    void Graphic3d_Camera::SetIOD ( const IODType theType,
    const double theIOD )

    Sets Intraocular distance.

    Parameters
    [in]theTypethe IOD definition type. IOD can be defined as absolute value or relatively to (as coefficient of) camera focal length.
    [in]theIODthe Intraocular distance.

    ◆ SetProjectionType()

    void Graphic3d_Camera::SetProjectionType ( const Projection theProjection)

    Change camera projection type. When switching to perspective projection from orthographic one, the ZNear and ZFar are reset to default values (0.001, 3000.0) if less than 0.0.

    Parameters
    [in]theProjectionthe camera projection type.

    ◆ SetScale()

    void Graphic3d_Camera::SetScale ( const double theScale)

    Sets camera scale. For orthographic projection the scale factor corresponds to parallel scale of view mapping (i.e. size of viewport). For perspective camera scale is converted to distance. The scale specifies equal size of the view projection in both dimensions assuming that the aspect is 1.0. The projection height and width are specified with the scale and correspondingly multiplied by the aspect.

    Parameters
    [in]theScalethe scale factor.

    ◆ SetTile()

    void Graphic3d_Camera::SetTile ( const Graphic3d_CameraTile & theTile)

    Sets the Tile defining the drawing sub-area within View. Note that tile defining a region outside the view boundaries is also valid - use method Graphic3d_CameraTile::Cropped() to assign a cropped copy.

    Parameters
    theTiletile definition

    ◆ SetUp()

    void Graphic3d_Camera::SetUp ( const gp_Dir & theUp)

    Sets camera Up direction vector, orthogonal to camera direction. WARNING! This method does NOT verify that the new Up vector is orthogonal to the current Direction().

    Parameters
    [in]theUpthe Up direction vector.
    See also
    OrthogonalizeUp().

    ◆ SetZeroToOneDepth()

    void Graphic3d_Camera::SetZeroToOneDepth ( bool theIsZeroToOne)
    inline

    Set using [0, 1] depth range or [-1, 1] range.

    ◆ SetZFocus()

    void Graphic3d_Camera::SetZFocus ( const FocusType theType,
    const double theZFocus )

    Sets stereographic focus distance.

    Parameters
    [in]theTypethe focus definition type. Focus can be defined as absolute value or relatively to (as coefficient of) coefficient of camera focal length.
    [in]theZFocusthe focus absolute value or coefficient depending on the passed definition type.

    ◆ SetZRange()

    void Graphic3d_Camera::SetZRange ( const double theZNear,
    const double theZFar )

    Change the Near and Far Z-clipping plane positions. For orthographic projection, theZNear, theZFar can be negative or positive. For perspective projection, only positive values are allowed. Program error exception is raised if non-positive values are specified for perspective projection or theZNear >= theZFar.

    Parameters
    [in]theZNearthe distance of the plane from the Eye.
    [in]theZFarthe distance of the plane from the Eye.

    ◆ SideRight()

    gp_Dir Graphic3d_Camera::SideRight ( ) const
    inline

    Right side direction.

    ◆ StereoProjection()

    void Graphic3d_Camera::StereoProjection ( NCollection_Mat4< double > & theProjL,
    NCollection_Mat4< double > & theHeadToEyeL,
    NCollection_Mat4< double > & theProjR,
    NCollection_Mat4< double > & theHeadToEyeR ) const

    Get stereo projection matrices.

    Parameters
    [out]theProjLleft eye projection matrix
    [out]theHeadToEyeLleft head to eye translation matrix
    [out]theProjRright eye projection matrix
    [out]theHeadToEyeRright head to eye translation matrix

    ◆ StereoProjectionF()

    void Graphic3d_Camera::StereoProjectionF ( NCollection_Mat4< float > & theProjL,
    NCollection_Mat4< float > & theHeadToEyeL,
    NCollection_Mat4< float > & theProjR,
    NCollection_Mat4< float > & theHeadToEyeR ) const

    Get stereo projection matrices.

    Parameters
    [out]theProjLleft eye projection matrix
    [out]theHeadToEyeLleft head to eye translation matrix
    [out]theProjRright eye projection matrix
    [out]theHeadToEyeRright head to eye translation matrix

    ◆ Tile()

    const Graphic3d_CameraTile & Graphic3d_Camera::Tile ( ) const
    inline

    Get current tile.

    ◆ Transform()

    void Graphic3d_Camera::Transform ( const gp_Trsf & theTrsf)

    Transform orientation components of the camera: Eye, Up and Center points.

    Parameters
    [in]theTrsfthe transformation to apply.

    ◆ UnProject()

    gp_Pnt Graphic3d_Camera::UnProject ( const gp_Pnt & thePnt) const

    Unproject point from normalized device coordinates to world coordinate space.

    Parameters
    [in]thePntthe NDC point.
    Returns
    3D point in WCS.

    ◆ Up()

    const gp_Dir & Graphic3d_Camera::Up ( ) const
    inline

    Get camera Up direction vector.

    Returns
    Camera's Up direction vector.

    ◆ ViewDimensions() [1/2]

    gp_XYZ Graphic3d_Camera::ViewDimensions ( ) const
    inline

    Calculate view plane size at center (target) point and distance between ZFar and ZNear planes.

    Returns
    values in form of gp_Pnt (Width, Height, Depth).

    ◆ ViewDimensions() [2/2]

    gp_XYZ Graphic3d_Camera::ViewDimensions ( const double theZValue) const

    Calculate view plane size at center point with specified Z offset and distance between ZFar and ZNear planes.

    Parameters
    [in]theZValuethe distance from the eye in eye-to-center direction
    Returns
    values in form of gp_Pnt (Width, Height, Depth).

    ◆ WorldViewProjState()

    const Graphic3d_WorldViewProjState & Graphic3d_Camera::WorldViewProjState ( ) const
    inline
    Returns
    projection modification state of the camera.

    ◆ WorldViewState()

    size_t Graphic3d_Camera::WorldViewState ( ) const
    inline

    Returns modification state of camera world view transformation matrix.

    ◆ ZFar()

    double Graphic3d_Camera::ZFar ( ) const
    inline

    Get the Far Z-clipping plane position.

    Returns
    the distance of the plane from the Eye.

    ◆ ZFitAll() [1/2]

    void Graphic3d_Camera::ZFitAll ( const double theScaleFactor,
    const Bnd_Box & theMinMax,
    const Bnd_Box & theGraphicBB )
    inline

    Change Z-min and Z-max planes of projection volume to match the displayed objects.

    ◆ ZFitAll() [2/2]

    bool Graphic3d_Camera::ZFitAll ( const double theScaleFactor,
    const Bnd_Box & theMinMax,
    const Bnd_Box & theGraphicBB,
    double & theZNear,
    double & theZFar ) const

    Estimate Z-min and Z-max planes of projection volume to match the displayed objects. The methods ensures that view volume will be close by depth range to the displayed objects. Fitting assumes that for orthogonal projection the view volume contains the displayed objects completely. For zoomed perspective view, the view volume is adjusted such that it contains the objects or their parts, located in front of the camera.

    Parameters
    [in]theScaleFactorthe scale factor for Z-range. The range between Z-min, Z-max projection volume planes evaluated by z fitting method will be scaled using this coefficient. Program error exception is thrown if negative or zero value is passed.
    [in]theMinMaxapplicative min max boundaries.
    [in]theGraphicBBreal graphical boundaries (not accounting infinite flag).

    ◆ ZFocus()

    double Graphic3d_Camera::ZFocus ( ) const
    inline

    Get stereographic focus value.

    Returns
    absolute or relative stereographic focus value depending on its definition type.

    ◆ ZFocusType()

    FocusType Graphic3d_Camera::ZFocusType ( ) const
    inline

    Get stereographic focus definition type.

    Returns
    definition type used for stereographic focus.

    ◆ ZNear()

    double Graphic3d_Camera::ZNear ( ) const
    inline

    Get the Near Z-clipping plane position.

    Returns
    the distance of the plane from the Eye.

    The documentation for this class was generated from the following file: