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_TransformPers Class Reference

    Transformation Persistence definition. More...

    #include <Graphic3d_TransformPers.hxx>

    Inheritance diagram for Graphic3d_TransformPers:

    Public Member Functions

     Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode)
     Set transformation persistence.
     Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode, const gp_Pnt &thePnt)
     Set Zoom/Rotate transformation persistence with an anchor 3D point. Anchor point defines the origin of Local Coordinate system within World Coordinate system. Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.
     Graphic3d_TransformPers (const Graphic3d_TransModeFlags theMode, const Aspect_TypeOfTriedronPosition theCorner, const NCollection_Vec2< int > &theOffset=NCollection_Vec2< int >(0, 0))
     Set 2d/trihedron transformation persistence with a corner and 2D offset. 2D offset defines the origin of Local Coordinate system as projection of 2D point on screen plane into World Coordinate system. Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d. The offset is a positive displacement from the view corner in pixels.
    bool IsZoomOrRotate () const
     Return true for Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers modes.
    bool IsTrihedronOr2d () const
     Return true for Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d modes.
    bool IsOrthoPers () const
     Return true for Graphic3d_TMF_OrthoPers mode.
    bool IsAxial () const
     Return true for Graphic3d_TMF_AxialScalePers modes.
    Graphic3d_TransModeFlags Mode () const
     Transformation persistence mode flags.
    Graphic3d_TransModeFlags Flags () const
     Transformation persistence mode flags.
    void SetPersistence (const Graphic3d_TransModeFlags theMode, const gp_Pnt &thePnt)
     Set Zoom/Rotate transformation persistence with an anchor 3D point. Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.
    void SetPersistence (const Graphic3d_TransModeFlags theMode, const Aspect_TypeOfTriedronPosition theCorner, const NCollection_Vec2< int > &theOffset)
     Set 2d/trihedron transformation persistence with a corner and 2D offset. Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d.
    gp_Pnt AnchorPoint () const
     Return the anchor point for zoom/rotate transformation persistence.
    void SetAnchorPoint (const gp_Pnt &thePnt)
     Set the anchor point for zoom/rotate transformation persistence.
    Aspect_TypeOfTriedronPosition Corner2d () const
     Return the corner for 2d/trihedron transformation persistence.
    void SetCorner2d (const Aspect_TypeOfTriedronPosition thePos)
     Set the corner for 2d/trihedron transformation persistence.
    NCollection_Vec2< int > Offset2d () const
     Return the offset from the corner for 2d/trihedron transformation persistence.
    void SetOffset2d (const NCollection_Vec2< int > &theOffset)
     Set the offset from the corner for 2d/trihedron transformation persistence.
    virtual double persistentScale (const occ::handle< Graphic3d_Camera > &theCamera, const int theViewportWidth, const int theViewportHeight) const
     Find scale value based on the camera position and view dimensions.
    virtual NCollection_Mat3< double > persistentRotationMatrix (const occ::handle< Graphic3d_Camera > &theCamera, const int theViewportWidth, const int theViewportHeight) const
     Create orientation matrix based on camera and view dimensions. Default implementation locks rotation by nullifying rotation component. Camera and view dimensions are not used, by default.
    template<class T>
    void Apply (const occ::handle< Graphic3d_Camera > &theCamera, const NCollection_Mat4< T > &theProjection, const NCollection_Mat4< T > &theWorldView, const int theViewportWidth, const int theViewportHeight, Bnd_Box &theBoundingBox) const
     Apply transformation to bounding box of presentation.
    template<class T>
    void Apply (const occ::handle< Graphic3d_Camera > &theCamera, const NCollection_Mat4< T > &theProjection, const NCollection_Mat4< T > &theWorldView, const int theViewportWidth, const int theViewportHeight, BVH_Box< T, 3 > &theBoundingBox) const
     Apply transformation to bounding box of presentation.
    template<class T>
    NCollection_Mat4< T > Compute (const occ::handle< Graphic3d_Camera > &theCamera, const NCollection_Mat4< T > &theProjection, const NCollection_Mat4< T > &theWorldView, const int theViewportWidth, const int theViewportHeight, const bool theToApplyProjPers=false) const
     Compute transformation. Computed matrix can be applied to model world transformation of an object to implement effect of transformation persistence.
    template<class T>
    void Apply (const occ::handle< Graphic3d_Camera > &theCamera, const NCollection_Mat4< T > &theProjection, NCollection_Mat4< T > &theWorldView, const int theViewportWidth, const int theViewportHeight, const gp_Pnt *theAnchor=nullptr, const bool theToApplyProjPers=true) const
     Apply transformation persistence on specified matrices.
    virtual NCollection_Mat4< double > ComputeApply (occ::handle< Graphic3d_Camera > &theCamera, const int theViewportWidth, const int theViewportHeight, const gp_Pnt *theAnchor=nullptr) const
     Perform computations for applying transformation persistence on specified matrices.
    virtual 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_Transient & operator= (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_Transient * This () 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 bool IsZoomOrRotate (Graphic3d_TransModeFlags theMode)
     Return true if specified mode is zoom/rotate transformation persistence.
    static bool IsTrihedronOr2d (Graphic3d_TransModeFlags theMode)
     Return true if specified mode is 2d/trihedron transformation persistence.
    static bool IsOrthoPers (Graphic3d_TransModeFlags theMode)
     Return true if specified mode is orthographic projection transformation persistence.
    static bool IsAxial (Graphic3d_TransModeFlags theMode)
     Return true if specified mode is axial transformation persistence.
    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.

    Additional Inherited Members

    typedef void base_type
     Returns a type descriptor about this object.

    Detailed Description

    Transformation Persistence definition.

    Transformation Persistence defines a mutable Local Coordinate system which depends on camera position, so that visual appearance of the object becomes partially immutable while camera moves. Object visually preserves particular property such as size, placement, rotation or their combination.

    Graphic3d_TMF_ZoomPers, Graphic3d_TMF_RotatePers and Graphic3d_TMF_ZoomRotatePers define Local Coordinate system having origin in specified anchor point defined in World Coordinate system, while Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d define origin as 2D offset from screen corner in pixels.

    Graphic3d_TMF_2d, Graphic3d_TMF_TriedronPers and Graphic3d_TMF_ZoomPers defines Local Coordinate system where length units are pixels. Beware that Graphic3d_RenderingParams::ResolutionRatio() will be ignored! For other Persistence flags, normal (world) length units will apply.

    Graphic3d_TMF_AxialPers and Graphic3d_TMF_AxialZoomPers defines persistence in the axial scale, i.e., keeps the object visual coherence when the camera's axial scale is changed. Meant to be used by objects such as Manipulators and trihedrons. WARNING: Graphic3d_TMF_None is not permitted for defining instance of this class - NULL handle should be used for this purpose!

    Constructor & Destructor Documentation

    ◆ Graphic3d_TransformPers() [1/3]

    Graphic3d_TransformPers::Graphic3d_TransformPers ( const Graphic3d_TransModeFlags theMode)
    inline

    Set transformation persistence.

    ◆ Graphic3d_TransformPers() [2/3]

    Graphic3d_TransformPers::Graphic3d_TransformPers ( const Graphic3d_TransModeFlags theMode,
    const gp_Pnt & thePnt )
    inline

    Set Zoom/Rotate transformation persistence with an anchor 3D point. Anchor point defines the origin of Local Coordinate system within World Coordinate system. Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.

    ◆ Graphic3d_TransformPers() [3/3]

    Graphic3d_TransformPers::Graphic3d_TransformPers ( const Graphic3d_TransModeFlags theMode,
    const Aspect_TypeOfTriedronPosition theCorner,
    const NCollection_Vec2< int > & theOffset = NCollection_Vec2<int>(0, 0) )
    inline

    Set 2d/trihedron transformation persistence with a corner and 2D offset. 2D offset defines the origin of Local Coordinate system as projection of 2D point on screen plane into World Coordinate system. Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d. The offset is a positive displacement from the view corner in pixels.

    Member Function Documentation

    ◆ AnchorPoint()

    gp_Pnt Graphic3d_TransformPers::AnchorPoint ( ) const
    inline

    Return the anchor point for zoom/rotate transformation persistence.

    ◆ Apply() [1/3]

    template<class T>
    void Graphic3d_TransformPers::Apply ( const occ::handle< Graphic3d_Camera > & theCamera,
    const NCollection_Mat4< T > & theProjection,
    const NCollection_Mat4< T > & theWorldView,
    const int theViewportWidth,
    const int theViewportHeight,
    Bnd_Box & theBoundingBox ) const

    Apply transformation to bounding box of presentation.

    Parameters
    [in]theCameracamera definition
    [in]theProjectionthe projection transformation matrix.
    [in]theWorldViewthe world view transformation matrix.
    [in]theViewportWidththe width of viewport (for 2d persistence).
    [in]theViewportHeightthe height of viewport (for 2d persistence).
    theBoundingBox[in/out] the bounding box to transform.

    ◆ Apply() [2/3]

    template<class T>
    void Graphic3d_TransformPers::Apply ( const occ::handle< Graphic3d_Camera > & theCamera,
    const NCollection_Mat4< T > & theProjection,
    const NCollection_Mat4< T > & theWorldView,
    const int theViewportWidth,
    const int theViewportHeight,
    BVH_Box< T, 3 > & theBoundingBox ) const

    Apply transformation to bounding box of presentation.

    Parameters
    [in]theCameracamera definition
    [in]theProjectionthe projection transformation matrix.
    [in]theWorldViewthe world view transformation matrix.
    [in]theViewportWidththe width of viewport (for 2d persistence).
    [in]theViewportHeightthe height of viewport (for 2d persistence).
    theBoundingBox[in/out] the bounding box to transform.

    ◆ Apply() [3/3]

    template<class T>
    void Graphic3d_TransformPers::Apply ( const occ::handle< Graphic3d_Camera > & theCamera,
    const NCollection_Mat4< T > & theProjection,
    NCollection_Mat4< T > & theWorldView,
    const int theViewportWidth,
    const int theViewportHeight,
    const gp_Pnt * theAnchor = nullptr,
    const bool theToApplyProjPers = true ) const

    Apply transformation persistence on specified matrices.

    Parameters
    [in]theCameracamera definition
    [in]theProjectionprojection matrix to modify
    theWorldView[in/out] world-view matrix to modify
    [in]theViewportWidthviewport width
    [in]theViewportHeightviewport height
    [in]theAnchorif not NULL, overrides anchor point
    [in]theToApplyProjPersif should apply projection persistence to matrix (for orthographic persistence).

    ◆ Compute()

    template<class T>
    NCollection_Mat4< T > Graphic3d_TransformPers::Compute ( const occ::handle< Graphic3d_Camera > & theCamera,
    const NCollection_Mat4< T > & theProjection,
    const NCollection_Mat4< T > & theWorldView,
    const int theViewportWidth,
    const int theViewportHeight,
    const bool theToApplyProjPers = false ) const

    Compute transformation. Computed matrix can be applied to model world transformation of an object to implement effect of transformation persistence.

    Parameters
    [in]theCameracamera definition
    [in]theProjectionthe projection transformation matrix.
    [in]theWorldViewthe world view transformation matrix.
    [in]theViewportWidththe width of viewport (for 2d persistence).
    [in]theViewportHeightthe height of viewport (for 2d persistence).
    [in]theToApplyProjPersif should apply projection persistence to matrix (for orthographic persistence).
    Returns
    transformation matrix to be applied to model world transformation of an object.

    ◆ ComputeApply()

    virtual NCollection_Mat4< double > Graphic3d_TransformPers::ComputeApply ( occ::handle< Graphic3d_Camera > & theCamera,
    const int theViewportWidth,
    const int theViewportHeight,
    const gp_Pnt * theAnchor = nullptr ) const
    inlinevirtual

    Perform computations for applying transformation persistence on specified matrices.

    Parameters
    [in]theCameracamera definition
    [in]theViewportWidthviewport width
    [in]theViewportHeightviewport height
    [in]theAnchorif not NULL, overrides anchor point

    ◆ Corner2d()

    Aspect_TypeOfTriedronPosition Graphic3d_TransformPers::Corner2d ( ) const
    inline

    Return the corner for 2d/trihedron transformation persistence.

    ◆ DumpJson()

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

    Dumps the content of me into the stream.

    ◆ Flags()

    Graphic3d_TransModeFlags Graphic3d_TransformPers::Flags ( ) const
    inline

    Transformation persistence mode flags.

    ◆ IsAxial() [1/2]

    bool Graphic3d_TransformPers::IsAxial ( ) const
    inline

    Return true for Graphic3d_TMF_AxialScalePers modes.

    ◆ IsAxial() [2/2]

    bool Graphic3d_TransformPers::IsAxial ( Graphic3d_TransModeFlags theMode)
    inlinestatic

    Return true if specified mode is axial transformation persistence.

    ◆ IsOrthoPers() [1/2]

    bool Graphic3d_TransformPers::IsOrthoPers ( ) const
    inline

    Return true for Graphic3d_TMF_OrthoPers mode.

    ◆ IsOrthoPers() [2/2]

    bool Graphic3d_TransformPers::IsOrthoPers ( Graphic3d_TransModeFlags theMode)
    inlinestatic

    Return true if specified mode is orthographic projection transformation persistence.

    ◆ IsTrihedronOr2d() [1/2]

    bool Graphic3d_TransformPers::IsTrihedronOr2d ( ) const
    inline

    Return true for Graphic3d_TMF_TriedronPers and Graphic3d_TMF_2d modes.

    ◆ IsTrihedronOr2d() [2/2]

    bool Graphic3d_TransformPers::IsTrihedronOr2d ( Graphic3d_TransModeFlags theMode)
    inlinestatic

    Return true if specified mode is 2d/trihedron transformation persistence.

    ◆ IsZoomOrRotate() [1/2]

    bool Graphic3d_TransformPers::IsZoomOrRotate ( ) const
    inline

    Return true for Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers modes.

    ◆ IsZoomOrRotate() [2/2]

    bool Graphic3d_TransformPers::IsZoomOrRotate ( Graphic3d_TransModeFlags theMode)
    inlinestatic

    Return true if specified mode is zoom/rotate transformation persistence.

    ◆ Mode()

    Graphic3d_TransModeFlags Graphic3d_TransformPers::Mode ( ) const
    inline

    Transformation persistence mode flags.

    ◆ Offset2d()

    NCollection_Vec2< int > Graphic3d_TransformPers::Offset2d ( ) const
    inline

    Return the offset from the corner for 2d/trihedron transformation persistence.

    ◆ persistentRotationMatrix()

    virtual NCollection_Mat3< double > Graphic3d_TransformPers::persistentRotationMatrix ( const occ::handle< Graphic3d_Camera > & theCamera,
    const int theViewportWidth,
    const int theViewportHeight ) const
    inlinevirtual

    Create orientation matrix based on camera and view dimensions. Default implementation locks rotation by nullifying rotation component. Camera and view dimensions are not used, by default.

    Parameters
    [in]theCameracamera definition
    [in]theViewportWidththe width of viewport
    [in]theViewportHeightthe height of viewport

    ◆ persistentScale()

    virtual double Graphic3d_TransformPers::persistentScale ( const occ::handle< Graphic3d_Camera > & theCamera,
    const int theViewportWidth,
    const int theViewportHeight ) const
    inlinevirtual

    Find scale value based on the camera position and view dimensions.

    Parameters
    [in]theCameracamera definition
    [in]theViewportWidththe width of viewport.
    [in]theViewportHeightthe height of viewport.

    Reimplemented in Graphic3d_TransformPersScaledAbove.

    ◆ SetAnchorPoint()

    void Graphic3d_TransformPers::SetAnchorPoint ( const gp_Pnt & thePnt)
    inline

    Set the anchor point for zoom/rotate transformation persistence.

    ◆ SetCorner2d()

    void Graphic3d_TransformPers::SetCorner2d ( const Aspect_TypeOfTriedronPosition thePos)
    inline

    Set the corner for 2d/trihedron transformation persistence.

    ◆ SetOffset2d()

    void Graphic3d_TransformPers::SetOffset2d ( const NCollection_Vec2< int > & theOffset)
    inline

    Set the offset from the corner for 2d/trihedron transformation persistence.

    ◆ SetPersistence() [1/2]

    void Graphic3d_TransformPers::SetPersistence ( const Graphic3d_TransModeFlags theMode,
    const Aspect_TypeOfTriedronPosition theCorner,
    const NCollection_Vec2< int > & theOffset )
    inline

    Set 2d/trihedron transformation persistence with a corner and 2D offset. Throws an exception if persistence mode is not Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d.

    ◆ SetPersistence() [2/2]

    void Graphic3d_TransformPers::SetPersistence ( const Graphic3d_TransModeFlags theMode,
    const gp_Pnt & thePnt )
    inline

    Set Zoom/Rotate transformation persistence with an anchor 3D point. Throws an exception if persistence mode is not Graphic3d_TMF_ZoomPers, Graphic3d_TMF_ZoomRotatePers or Graphic3d_TMF_RotatePers.

    Field Documentation

    ◆ Params2d

    PersParams2d Graphic3d_TransformPers::Params2d

    ◆ Params3d

    PersParams3d Graphic3d_TransformPers::Params3d

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