Open CASCADE Technology  6.5.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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.

#include <Select3D_Projector.hxx>

Inheritance diagram for Select3D_Projector:
Inheritance graph
[legend]

Public Member Functions

 Select3D_Projector (const Handle< V3d_View > &aView)
 Constructs the 3D projector object defined by the 3D view aView.

 Select3D_Projector ()
 Select3D_Projector (const gp_Ax2 &CS)
 Creates an axonometric projector. <CS> represents viewing coordinate
system and could be constructed from x direction, view plane normal direction,
and view point location in world-coordinate space.

 Select3D_Projector (const gp_Ax2 &CS, const Standard_Real Focus)
 Creates a perspective projector. <CS> represents viewing
coordinate system and could be constructed from x direction,
view plane normal direction, and focal point location in world-coordinate
space. <Focus> should represent distance of an eye from view plane
in world-coordinate space (focal distance).

 Select3D_Projector (const gp_Trsf &T, const Standard_Boolean Persp, const Standard_Real Focus)
 build a Projector from the given transformation.
In case, when <T> 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-coordiante
system. <T> 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 <Focus> is the focale
distance of an eye from view plane in world-space coordiantes.
Note, that in that case amount of perspective distortion (perspective
angle) should be defined through focal distance.

 Select3D_Projector (const gp_GTrsf &GT, const Standard_Boolean Persp, const Standard_Real Focus)
 build a Projector from the given transformation.
In case, when <GT> 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 <Focus> 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 <GT> 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.

void Set (const gp_Trsf &T, const Standard_Boolean Persp, const Standard_Real Focus)
void SetView (const Handle< V3d_View > &V)
 Sets the 3D view V used at the time of construction.

const Handle_V3d_View & View () const
 Returns the 3D view used at the time of construction.

virtual void Scaled (const Standard_Boolean On=Standard_False)
 to compute with the given scale and translation.

virtual Standard_Boolean Perspective () const
 Returns True if there is a perspective transformation.

virtual const gp_GTrsfTransformation () const
 Returns the active transformation.

virtual const gp_GTrsfInvertedTransformation () const
 Returns the active inverted transformation.

virtual const gp_TrsfFullTransformation () const
 Returns the original transformation.

virtual Standard_Real Focus () const
 Returns the focal length.

virtual void Transform (gp_Vec &D) const
virtual void Transform (gp_Pnt &Pnt) const
virtual void Project (const gp_Pnt &P, gp_Pnt2d &Pout) const
 Transform and apply perspective if needed.

void Project (const gp_Pnt &P, Standard_Real &X, Standard_Real &Y, Standard_Real &Z) const
 Transform and apply perspective if needed.

virtual void Project (const gp_Pnt &P, const gp_Vec &D1, gp_Pnt2d &Pout, gp_Vec2d &D1out) const
 Transform and apply perspective if needed.

virtual gp_Lin Shoot (const Standard_Real X, const Standard_Real Y) const
 return a line going through the eye towards the
2d point <X,Y>.

Standard_Real DepthMin () const
 Returns the minimum depth value (if clipping plane defined).
Should be used when call ::Shoot() to compute eyeline.

Standard_Real DepthMax () const
 Returns the maximum depth value (if clipping plane defined).
Should be used when call ::Shoot() to compute eyeline.

void DepthMinMax (const Standard_Real theDepthMin, const Standard_Real theDepthMax)
 Setup the min/max depth values (doesn't affect
projection functionality itself).
Should be used when call ::Shoot() to compute eyeline.

virtual void Transform (gp_Pnt &P, const gp_GTrsf &T) const
virtual void Transform (gp_Lin &D, const gp_GTrsf &T) const

Protected Attributes

Standard_Boolean myPersp
Standard_Real myFocus
gp_Trsf myScaledTrsf
gp_GTrsf myGTrsf
gp_GTrsf myInvTrsf

Constructor & Destructor Documentation


Member Function Documentation

virtual Standard_Real Select3D_Projector::Focus ( ) const [virtual]
virtual void Select3D_Projector::Project ( const gp_Pnt P,
gp_Pnt2d Pout 
) const [virtual]
virtual void Select3D_Projector::Project ( const gp_Pnt P,
const gp_Vec D1,
gp_Pnt2d Pout,
gp_Vec2d D1out 
) const [virtual]
virtual gp_Lin Select3D_Projector::Shoot ( const Standard_Real  X,
const Standard_Real  Y 
) const [virtual]
virtual void Select3D_Projector::Transform ( gp_Vec D) const [virtual]
virtual void Select3D_Projector::Transform ( gp_Pnt Pnt) const [virtual]
virtual void Select3D_Projector::Transform ( gp_Pnt P,
const gp_GTrsf T 
) const [virtual]
virtual void Select3D_Projector::Transform ( gp_Lin D,
const gp_GTrsf T 
) const [virtual]
virtual const gp_GTrsf& Select3D_Projector::Transformation ( ) const [virtual]
const Handle_V3d_View& Select3D_Projector::View ( ) const

Field Documentation


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