Open CASCADE Technology  6.8.0
Public Member Functions | Protected Attributes
Select3D_Projector Class Reference

A framework to define 3D projectors. Projector provides services for projecting points from world-coordinates to a viewing plane. Projection could be defined by corresponding transformation, or coordinate system. The transformation could be constructed for a view with transposed view transformation matrix ( that represents view-orientation ), including, for perspective view, focal distance ( distance from an eye to the view plane ) and translational part that represents translation of focal point in view-coordinate space. The Select3D_Projector class recognizes the predefined set of popular projections: axonometric, top view, front view and uses more efficient algorithm for projection computations. User-defined transformation could be also defined in constructor. Perspective projection consists of two separate parts, that are composed together during computation: transformation component and focale distance. More...

#include <Select3D_Projector.hxx>

Inheritance diagram for Select3D_Projector:
Inheritance graph
[legend]

Public Member Functions

 Select3D_Projector (const Handle< V3d_View > &theView)
 Constructs the 3D projector object from the passed view. The projector captures current model-view and projection transformation of the passed view. More...
 
 Select3D_Projector ()
 Constructs identity projector. More...
 
 Select3D_Projector (const gp_Ax2 &theCS)
 Builds the Projector from the model-view transformation specified by the passed viewing coordinate system <theCS>. The Projector has identity projection transformation, is orthogonal. The viewing coordinate system could be constructed from x direction, view plane normal direction, and view point location in world-coordinate space. More...
 
 Select3D_Projector (const gp_Ax2 &theCS, const Standard_Real theFocus)
 Builds the Projector from the model-view transformation specified by the passed view coordinate system <theCS> and simplified perspective projection transformation defined by <theFocus> parameter. The viewing coordinate system could be constructed from x direction, view plane normal direction, and focal point location in world-coordinate space. <theFocus> should represent distance of an eye from view plane in world-coordinate space (focal distance). More...
 
 Select3D_Projector (const gp_Trsf &theViewTrsf, const Standard_Boolean theIsPersp, const Standard_Real theFocus)
 Build the Projector from the model-view transformation passed as <theViewTrsf> and simplified perspective projection transformation parameters passed as <theIsPersp> and <theFocus>. In case, when <theViewTrsf> transformation should represent custom view projection, it could be constructed from two separate components: transposed view orientation matrix and translation of focal point in view-coordinate system. <theViewTrsf> could be built up from x direction, up direction, view plane normal direction vectors and translation with SetValues(...) method, where first row arguments (a11, a12, a13, a14) are x, y, z component of x direction vector, and x value of reversed translation vector. Second row arguments, are x y z for up direction and y value of reversed translation, and the third row defined in the same manner. This also suits for simple perspective view, where <theFocus> is the focale distance of an eye from view plane in world-space coordinates. Note, that in that case amount of perspective distortion (perspective angle) should be defined through focal distance. More...
 
 Select3D_Projector (const gp_GTrsf &theViewTrsf, const Standard_Boolean theIsPersp, const Standard_Real theFocus)
 Builds the Projector from the model-view transformation passed as <theViewTrsf> and projection transformation for <theIsPersp> and <theFocus> parameters. In case, when <theViewTrsf> transformation should represent custom view projection, it could be constructed from two separate components: transposed view orientation matrix and translation of a focal point in view-coordinate system. This also suits for perspective view, with <theFocus> that could be equal to distance from an eye to a view plane in world-coordinates (focal distance). The 3x3 transformation matrix is built up from three vectors: x direction, up direction and view plane normal vectors, where each vector is a matrix row. Then <theViewTrsf> is constructed from matrix and reversed translation with methods SetTranslationPart(..) and SetVectorialPart(..). Note, that in that case amount of perspective distortion (perspective angle) should be defined through focal distance. More...
 
 Select3D_Projector (const Graphic3d_Mat4d &theViewTrsf, const Graphic3d_Mat4d &theProjTrsf)
 Builds the Projector from the passed model-view <theViewTrsf> and projection <theProjTrsf> transformation matrices. More...
 
void Set (const gp_Trsf &theViewTrsf, const Standard_Boolean theIsPersp, const Standard_Real theFocus)
 Sets new parameters for the Projector. More...
 
void Set (const Graphic3d_Mat4d &theViewTrsf, const Graphic3d_Mat4d &theProjTrsf)
 Sets new parameters for the Projector. More...
 
void SetView (const Handle< V3d_View > &theView)
 Sets new parameters for the Projector captured from the passed view. More...
 
virtual void Scaled (const Standard_Boolean theToCheckOptimized=Standard_False)
 Pre-compute inverse transformation and ensure whether it is possible to use optimized transformation for the common view-orientation type or not if <theToCheckOptimized> is TRUE. More...
 
virtual Standard_Boolean Perspective () const
 Returns True if there is simplified perspective projection approach is used. Distortion defined by Focus. More...
 
virtual Standard_Real Focus () const
 Returns the focal length of simplified perspective projection approach. Raises program error exception if the the projection transformation is not specified as simplified Perspective (for example, custom projection transformation is defined or the orthogonal Projector is defined). More...
 
const Graphic3d_Mat4dProjection () const
 Returns projection transformation. Please note that for simplified perspective projection approach, defined by Focus, the returned transformation is identity. More...
 
virtual const gp_GTrsfTransformation () const
 Returns the view transformation. More...
 
virtual const gp_GTrsfInvertedTransformation () const
 Returns the inverted view transformation. More...
 
virtual const gp_TrsfFullTransformation () const
 Returns the uniform-scaled view transformation. More...
 
virtual void Transform (gp_Vec &theD) const
 Transforms the vector into view-coordinate space. More...
 
virtual void Transform (gp_Pnt &thePnt) const
 Transforms the point into view-coordinate space. More...
 
virtual void Project (const gp_Pnt &theP, gp_Pnt2d &thePout) const
 Transforms the point into view-coordinate space and applies projection transformation. More...
 
void Project (const gp_Pnt &theP, Standard_Real &theX, Standard_Real &theY, Standard_Real &theZ) const
 Transforms the point into view-coordinate space and applies projection transformation. More...
 
virtual void Project (const gp_Pnt &theP, const gp_Vec &theD1, gp_Pnt2d &thePout, gp_Vec2d &theD1out) const
 Transforms the point and vector passed from its location into view-coordinate space and applies projection transformation. More...
 
virtual gp_Lin Shoot (const Standard_Real theX, const Standard_Real theY) const
 Return projection line going through the 2d point <theX, theY> More...
 
virtual void Transform (gp_Pnt &thePnt, const gp_GTrsf &theTrsf) const
 
virtual void Transform (gp_Lin &theLin, const gp_GTrsf &theTrsf) const
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object. More...
 
Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const 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. More...
 
Standard_Boolean IsKind (const Standard_CString 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. More...
 
virtual Handle_Standard_Transient This () const
 Returns a Handle which references this object. Must never be called to objects created in stack. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 

Protected Attributes

Standard_Boolean myPersp
 
Standard_Real myFocus
 
gp_GTrsf myGTrsf
 
gp_GTrsf myInvTrsf
 
gp_Trsf myScaledTrsf
 
Graphic3d_Mat4d myProjTrsf
 

Detailed Description

A framework to define 3D projectors. Projector provides services for projecting points from world-coordinates to a viewing plane. Projection could be defined by corresponding transformation, or coordinate system. The transformation could be constructed for a view with transposed view transformation matrix ( that represents view-orientation ), including, for perspective view, focal distance ( distance from an eye to the view plane ) and translational part that represents translation of focal point in view-coordinate space. The Select3D_Projector class recognizes the predefined set of popular projections: axonometric, top view, front view and uses more efficient algorithm for projection computations. User-defined transformation could be also defined in constructor. Perspective projection consists of two separate parts, that are composed together during computation: transformation component and focale distance.

Constructor & Destructor Documentation

Select3D_Projector::Select3D_Projector ( const Handle< V3d_View > &  theView)

Constructs the 3D projector object from the passed view. The projector captures current model-view and projection transformation of the passed view.

Select3D_Projector::Select3D_Projector ( )

Constructs identity projector.

Select3D_Projector::Select3D_Projector ( const gp_Ax2 theCS)

Builds the Projector from the model-view transformation specified by the passed viewing coordinate system <theCS>. The Projector has identity projection transformation, is orthogonal. The viewing coordinate system could be constructed from x direction, view plane normal direction, and view point location in world-coordinate space.

Select3D_Projector::Select3D_Projector ( const gp_Ax2 theCS,
const Standard_Real  theFocus 
)

Builds the Projector from the model-view transformation specified by the passed view coordinate system <theCS> and simplified perspective projection transformation defined by <theFocus> parameter. The viewing coordinate system could be constructed from x direction, view plane normal direction, and focal point location in world-coordinate space. <theFocus> should represent distance of an eye from view plane in world-coordinate space (focal distance).

Select3D_Projector::Select3D_Projector ( const gp_Trsf theViewTrsf,
const Standard_Boolean  theIsPersp,
const Standard_Real  theFocus 
)

Build the Projector from the model-view transformation passed as <theViewTrsf> and simplified perspective projection transformation parameters passed as <theIsPersp> and <theFocus>. In case, when <theViewTrsf> transformation should represent custom view projection, it could be constructed from two separate components: transposed view orientation matrix and translation of focal point in view-coordinate system. <theViewTrsf> could be built up from x direction, up direction, view plane normal direction vectors and translation with SetValues(...) method, where first row arguments (a11, a12, a13, a14) are x, y, z component of x direction vector, and x value of reversed translation vector. Second row arguments, are x y z for up direction and y value of reversed translation, and the third row defined in the same manner. This also suits for simple perspective view, where <theFocus> is the focale distance of an eye from view plane in world-space coordinates. Note, that in that case amount of perspective distortion (perspective angle) should be defined through focal distance.

Select3D_Projector::Select3D_Projector ( const gp_GTrsf theViewTrsf,
const Standard_Boolean  theIsPersp,
const Standard_Real  theFocus 
)

Builds the Projector from the model-view transformation passed as <theViewTrsf> and projection transformation for <theIsPersp> and <theFocus> parameters. In case, when <theViewTrsf> transformation should represent custom view projection, it could be constructed from two separate components: transposed view orientation matrix and translation of a focal point in view-coordinate system. This also suits for perspective view, with <theFocus> that could be equal to distance from an eye to a view plane in world-coordinates (focal distance). The 3x3 transformation matrix is built up from three vectors: x direction, up direction and view plane normal vectors, where each vector is a matrix row. Then <theViewTrsf> is constructed from matrix and reversed translation with methods SetTranslationPart(..) and SetVectorialPart(..). Note, that in that case amount of perspective distortion (perspective angle) should be defined through focal distance.

Select3D_Projector::Select3D_Projector ( const Graphic3d_Mat4d theViewTrsf,
const Graphic3d_Mat4d theProjTrsf 
)

Builds the Projector from the passed model-view <theViewTrsf> and projection <theProjTrsf> transformation matrices.

Member Function Documentation

virtual Standard_Real Select3D_Projector::Focus ( ) const
virtual

Returns the focal length of simplified perspective projection approach. Raises program error exception if the the projection transformation is not specified as simplified Perspective (for example, custom projection transformation is defined or the orthogonal Projector is defined).

virtual const gp_Trsf& Select3D_Projector::FullTransformation ( ) const
virtual

Returns the uniform-scaled view transformation.

virtual const gp_GTrsf& Select3D_Projector::InvertedTransformation ( ) const
virtual

Returns the inverted view transformation.

virtual Standard_Boolean Select3D_Projector::Perspective ( ) const
virtual

Returns True if there is simplified perspective projection approach is used. Distortion defined by Focus.

virtual void Select3D_Projector::Project ( const gp_Pnt theP,
gp_Pnt2d thePout 
) const
virtual

Transforms the point into view-coordinate space and applies projection transformation.

void Select3D_Projector::Project ( const gp_Pnt theP,
Standard_Real theX,
Standard_Real theY,
Standard_Real theZ 
) const

Transforms the point into view-coordinate space and applies projection transformation.

virtual void Select3D_Projector::Project ( const gp_Pnt theP,
const gp_Vec theD1,
gp_Pnt2d thePout,
gp_Vec2d theD1out 
) const
virtual

Transforms the point and vector passed from its location into view-coordinate space and applies projection transformation.

const Graphic3d_Mat4d& Select3D_Projector::Projection ( ) const

Returns projection transformation. Please note that for simplified perspective projection approach, defined by Focus, the returned transformation is identity.

virtual void Select3D_Projector::Scaled ( const Standard_Boolean  theToCheckOptimized = Standard_False)
virtual

Pre-compute inverse transformation and ensure whether it is possible to use optimized transformation for the common view-orientation type or not if <theToCheckOptimized> is TRUE.

void Select3D_Projector::Set ( const gp_Trsf theViewTrsf,
const Standard_Boolean  theIsPersp,
const Standard_Real  theFocus 
)

Sets new parameters for the Projector.

void Select3D_Projector::Set ( const Graphic3d_Mat4d theViewTrsf,
const Graphic3d_Mat4d theProjTrsf 
)

Sets new parameters for the Projector.

void Select3D_Projector::SetView ( const Handle< V3d_View > &  theView)

Sets new parameters for the Projector captured from the passed view.

virtual gp_Lin Select3D_Projector::Shoot ( const Standard_Real  theX,
const Standard_Real  theY 
) const
virtual

Return projection line going through the 2d point <theX, theY>

virtual void Select3D_Projector::Transform ( gp_Vec theD) const
virtual

Transforms the vector into view-coordinate space.

virtual void Select3D_Projector::Transform ( gp_Pnt thePnt) const
virtual

Transforms the point into view-coordinate space.

virtual void Select3D_Projector::Transform ( gp_Pnt thePnt,
const gp_GTrsf theTrsf 
) const
virtual
virtual void Select3D_Projector::Transform ( gp_Lin theLin,
const gp_GTrsf theTrsf 
) const
virtual
virtual const gp_GTrsf& Select3D_Projector::Transformation ( ) const
virtual

Returns the view transformation.

Field Documentation

Standard_Real Select3D_Projector::myFocus
protected
gp_GTrsf Select3D_Projector::myGTrsf
protected
gp_GTrsf Select3D_Projector::myInvTrsf
protected
Standard_Boolean Select3D_Projector::myPersp
protected
Graphic3d_Mat4d Select3D_Projector::myProjTrsf
protected
gp_Trsf Select3D_Projector::myScaledTrsf
protected

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