DATAKIT API  V2025.1
Dtk_Camera Class Reference

This is the Camera class.
This class lets you define elements to create frustum.
Please use the Dtk_CameraPtr class to handle it... More...

+ Inheritance diagram for Dtk_Camera:

Public Types

enum  ProjectionTypeEnum { ProjectionTypeUnknown = 0, ProjectionTypeParallel, ProjectionTypePerspective }
 
enum  ZoomFitModeEnum { NoZoomFit = 0, ZoomFitAllScene }
 

Public Member Functions

virtual Dtk_ErrorStatus _Store (void *)
 
Dtk_Double64 Angle () const
 
Dtk_Int32 DtkDynamicType (const Dtk_Int32 &inId)
 Retrieves the dynamic entity type. More...
 
int DtkDynamicType (const int &inId)
 
virtual void dump (FILE *file=stdout)
 
Dtk_Double64 Focus () const
 
Dtk_InfoPtr get_info () const
 
type_detk get_type_detk () const
 
void GetClippingDistance (Dtk_Double64 &outFrontDistance, Dtk_Double64 &outBackDistance) const
 get the Front Clipping Distance et Back Clipping Distance More...
 
Dtk_Double64 GetFocusDistance () const
 Processes the Focus Distance ie the Distance between the Origin and the Target points - read only -. More...
 
const Dtk_IDGetID () const
 Get Internal UniqueID. More...
 
Dtk_Double64 GetSemiHeight () const
 Retrieves the Camera Base Semi Height - read only -. More...
 
Dtk_Double64 GetSemiWidth () const
 Retrieves the Camera Base Semi Width - read only -. More...
 
virtual Dtk_Size_t GetSize () const
 
const Dtk_Camera::ZoomFitModeEnumGetZoomFitMode () const
 Retrieves the zoom fit mode - read only -. More...
 
Dtk_InfoPtrinfo ()
 
Dtk_bool IsValid () const
 Checks if the Dtk_Camera is valid. For this: More...
 
const Dtk_pntOriginPoint () const
 Retrieves the origin point - read only -. More...
 
virtual void PrepareTransfo ()
 
Dtk_Double64 ProcessXSemiAngle () const
 Processes the X - along width - Semi Angle - read only -. More...
 
Dtk_Double64 ProcessXZoomFactor () const
 Processes the X - along width - zoom factor - read only -. More...
 
Dtk_Double64 ProcessYSemiAngle () const
 Processes the Y - along height - Semi Angle - read only -. More...
 
Dtk_Double64 ProcessYZoomFactor () const
 Processes the Y - along height - zoom factor - read only -. More...
 
const Dtk_Camera::ProjectionTypeEnumProjectionType () const
 Retrieves the projection type - read only -. More...
 
void SetClippingDistance (const Dtk_Double64 &inFrontDistance, const Dtk_Double64 &inBackDistance) const
 set the Front Clipping Distance et Back Clipping Distance More...
 
const Dtk_pntTargetPoint () const
 Retrieves the target point - read only -. More...
 
Dtk_dir TargetVector () const
 Retrieves the target vector - read only -. More...
 
Dtk_ErrorStatus Transform (const Dtk_transfo &inTransfo)
 Applies a transformation matrix to the entity. //! More...
 
const Dtk_dirUpVector () const
 Retrieves the up vector - read only -. More...
 
Dtk_Double64 ZoomFactor () const
 Processes the X - width - zoom factor - read only -. More...
 

Static Public Member Functions

static Dtk_CameraPtr Create ()
 Base constructor. More...
 
static Dtk_CameraPtr Create (const Dtk_pnt &inOriginPoint, const Dtk_pnt &inTarget, const Dtk_dir &inUpVector, const double &inAngle, const double &inFocus, const double &inZoomFactor=1.0, const ProjectionTypeEnum inProjectionType=ProjectionTypeParallel, const ZoomFitModeEnum inZoomFitMode=NoZoomFit)
 Full featured constructor. More...
 
static Dtk_CameraPtr Create (const Dtk_pnt &inOriginPoint, const Dtk_pnt &inTarget, const Dtk_Double64 inSemiWidth, const Dtk_Double64 inSemiHeight, const Dtk_dir &inUpVector, const ProjectionTypeEnum inProjectionType=ProjectionTypeParallel, const ZoomFitModeEnum inZoomFitMode=NoZoomFit)
 Full featured constructor. More...
 
static Dtk_CameraDtkDynamicCast (Dtk_Object *s)
 Performs a dynamic cast - doesn't need RTTI -. More...
 

Protected Types

enum  { _typeID = DTK_TYPE_OBJECT }
 
enum  { _typeID = DTK_TYPE_ENTITY }
 
enum  { _typeID = DTK_TYPE_CAMERA }
 

Protected Member Functions

void _copy (const Dtk_Entity &s)
 
void _copy (const Dtk_Object &s)
 
void _init ()
 
void _reset ()
 
virtual Dtk_ObjectClone ()
 
 Dtk_Camera ()
 
 Dtk_Camera (const Dtk_Camera &s)
 
 ~Dtk_Camera ()
 Destructor. More...
 

Protected Attributes

Dtk_Handle * _Private
 
unsigned long count_
 

Friends

class Dtk_SmartPtr< Dtk_Camera >
 

Detailed Description

This is the Camera class.
This class lets you define elements to create frustum.
Please use the Dtk_CameraPtr class to handle it...

The camera can be parallel:

...or perspective:

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
_typeID 

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
_typeID 

◆ anonymous enum

anonymous enum
protected
Enumerator
_typeID 
7879 { _typeID = DTK_TYPE_CAMERA };

◆ ProjectionTypeEnum

Enumerator
ProjectionTypeUnknown 
ProjectionTypeParallel 
ProjectionTypePerspective 
7866  {
7870  };

◆ ZoomFitModeEnum

Enumerator
NoZoomFit 
ZoomFitAllScene 
7872  {
7873  NoZoomFit = 0, //The camera doesn't need to be zoom fitted.
7874  ZoomFitAllScene, //The camera needs to be zoom fitted to the entire scene.
7875  };

Constructor & Destructor Documentation

◆ Dtk_Camera() [1/2]

Dtk_Camera::Dtk_Camera ( )
protected
See also
Create()

◆ Dtk_Camera() [2/2]

Dtk_Camera::Dtk_Camera ( const Dtk_Camera s)
protected
See also
Create(const Dtk_Camera&)

◆ ~Dtk_Camera()

Dtk_Camera::~Dtk_Camera ( )
protected

Destructor.

Member Function Documentation

◆ _copy() [1/2]

void Dtk_Entity::_copy ( const Dtk_Entity s)
protectedinherited

◆ _copy() [2/2]

void Dtk_Object::_copy ( const Dtk_Object s)
protectedinherited

◆ _init()

void Dtk_Entity::_init ( )
protectedinherited

◆ _reset()

void Dtk_Entity::_reset ( )
protectedinherited

◆ _Store()

◆ Angle()

Dtk_Double64 Dtk_Camera::Angle ( ) const
Deprecated:
Use ProcessXSemiAngle() const or ProcessYSemiAngle() const methods instead.
See also
ProcessXSemiAngle() const
Returns
The X Semi angle in Degrees, 0.0 if Dtk_Camera is not valid.
The angle
8024 { return ProcessXSemiAngle() * 180. / DTK_PI; }

◆ Clone()

virtual Dtk_Object* Dtk_Camera::Clone ( )
protectedvirtual

Implements Dtk_Entity.

7885 { return new Dtk_Camera(*this); }

◆ Create() [1/3]

static Dtk_CameraPtr Dtk_Camera::Create ( )
static

Base constructor.

◆ Create() [2/3]

static Dtk_CameraPtr Dtk_Camera::Create ( const Dtk_pnt inOriginPoint,
const Dtk_pnt inTarget,
const Dtk_dir inUpVector,
const double &  inAngle,
const double &  inFocus,
const double &  inZoomFactor = 1.0,
const ProjectionTypeEnum  inProjectionType = ProjectionTypeParallel,
const ZoomFitModeEnum  inZoomFitMode = NoZoomFit 
)
static

Full featured constructor.

Deprecated:
Use Create( const Dtk_pnt& inOriginPoint, const Dtk_pnt& inTarget, const Dtk_dir& inUpVector, const Dtk_Double64 inSemiWidth, const Dtk_Double64 inSemiHeight, const ProjectionTypeEnum& inProjectionType, const ZoomFitModeEnum inZoomFitMode) method instead.
Parameters
inOriginPointThe Dtk_Camera location point
inTargetThe Target vector
inUpVectorThe Up vector
inAngleThe angle - in Degrees - - will be used to process Semi-Width/Semi-Height -
inFocusThe focus - This value will be ignored -
inZoomFactorThe zoom factor - 1.0 by default - - This value will be ignored -
inProjectionTypeThe projection type - ProjectionTypeParallel by default -
inZoomFitModeThe Zoom Fit Mode - NoZoomFit by default -
Returns
The created Dtk_CameraPtr

◆ Create() [3/3]

static Dtk_CameraPtr Dtk_Camera::Create ( const Dtk_pnt inOriginPoint,
const Dtk_pnt inTarget,
const Dtk_Double64  inSemiWidth,
const Dtk_Double64  inSemiHeight,
const Dtk_dir inUpVector,
const ProjectionTypeEnum  inProjectionType = ProjectionTypeParallel,
const ZoomFitModeEnum  inZoomFitMode = NoZoomFit 
)
static

Full featured constructor.

Parameters
inOriginPointThe Dtk_Camera location point
inTargetThe Target vector
inSemiWidthSemi-Width of the Pyramid/Block Camera Frustum - in mm -
inSemiHeightSemi-Height of the Pyramid/Block Camera Frustum - in mm -
inUpVectorThe Up vector
inProjectionTypeThe projection type - ProjectionTypeParallel by default -
inZoomFitModeThe Zoom Fit Mode - NoZoomFit by default -
Returns
The created Dtk_CameraPtr

◆ DtkDynamicCast()

static Dtk_Camera* Dtk_Camera::DtkDynamicCast ( Dtk_Object s)
static

Performs a dynamic cast - doesn't need RTTI -.

◆ DtkDynamicType() [1/2]

Dtk_Int32 Dtk_Camera::DtkDynamicType ( const Dtk_Int32 inId)

Retrieves the dynamic entity type.

◆ DtkDynamicType() [2/2]

◆ dump()

virtual void Dtk_Object::dump ( FILE *  file = stdout)
virtualinherited

◆ Focus()

Dtk_Double64 Dtk_Camera::Focus ( ) const
Deprecated:
This method has been superseed by GetFocusDistance() const method.
See also
GetFocusDistance() const
8034 { return GetFocusDistance(); }

◆ get_info()

Dtk_InfoPtr Dtk_Entity::get_info ( ) const
inherited

◆ get_type_detk()

type_detk Dtk_Camera::get_type_detk ( ) const
virtual
Returns
The type of the entity type - DTK_TYPE_CAMERA -

Implements Dtk_Entity.

7903 { return DTK_TYPE_CAMERA; }

◆ GetClippingDistance()

void Dtk_Camera::GetClippingDistance ( Dtk_Double64 outFrontDistance,
Dtk_Double64 outBackDistance 
) const

get the Front Clipping Distance et Back Clipping Distance

◆ GetFocusDistance()

Dtk_Double64 Dtk_Camera::GetFocusDistance ( ) const

Processes the Focus Distance ie the Distance between the Origin and the Target points - read only -.

Returns
The Focus Distance in mm.

◆ GetID()

const Dtk_ID& Dtk_Entity::GetID ( ) const
inherited

Get Internal UniqueID.

Returns
InternalID

◆ GetSemiHeight()

Dtk_Double64 Dtk_Camera::GetSemiHeight ( ) const

Retrieves the Camera Base Semi Height - read only -.

Returns
The Base Height in mm.

◆ GetSemiWidth()

Dtk_Double64 Dtk_Camera::GetSemiWidth ( ) const

Retrieves the Camera Base Semi Width - read only -.

Returns
The Base Width in mm.

◆ GetSize()

◆ GetZoomFitMode()

const Dtk_Camera::ZoomFitModeEnum& Dtk_Camera::GetZoomFitMode ( ) const

Retrieves the zoom fit mode - read only -.

Returns
The zoom fit mode

◆ info()

Dtk_InfoPtr& Dtk_Entity::info ( )
inherited

◆ IsValid()

Dtk_bool Dtk_Camera::IsValid ( ) const

Checks if the Dtk_Camera is valid. For this:

  • The Focus Distance must be >= DTK_TOLERANCE.
  • The Semi-Width must be >= DTK_TOLERANCE.
  • The Semi-Height must be >= DTK_TOLERANCE.
    Returns
    DTK_TRUE if the Dtk_Camera is valid, DTK_FALSE otherwise.
8042  {
8043  if( GetFocusDistance() < DTK_TOLERANCE ||
8046  {
8047  return DTK_FALSE;
8048  }
8049  else
8050  {
8051  return DTK_TRUE;
8052  }
8053  }

◆ OriginPoint()

const Dtk_pnt& Dtk_Camera::OriginPoint ( ) const

Retrieves the origin point - read only -.

Returns
The origin point

◆ PrepareTransfo()

virtual void Dtk_Entity::PrepareTransfo ( )
virtualinherited

Reimplemented in Dtk_OffsetSurface.

◆ ProcessXSemiAngle()

Dtk_Double64 Dtk_Camera::ProcessXSemiAngle ( ) const

Processes the X - along width - Semi Angle - read only -.

Returns
The X Semi-Angle in Radians, 0.0 if Dtk_Camera is not valid.
Remarks
The X Semi-Angle is equal to atan( GetSemiWidth() / GetFocusDistance() )
The X Semi-Angle is relevant for Perspective Camera.
8006 { return IsValid() ? ( atan( GetSemiWidth() / GetFocusDistance() ) ) : 0.; }

◆ ProcessXZoomFactor()

Dtk_Double64 Dtk_Camera::ProcessXZoomFactor ( ) const

Processes the X - along width - zoom factor - read only -.

Returns
The X zoom factor, 0.0 if Dtk_Camera is not valid.
Remarks
The X Zoom Factor is equal to 1. / GetSemiWidth()
The X Zoom Factor is relevant for Parallel Camera.
7993 { return IsValid() ? ( 1. / GetSemiWidth() ) : 0.; }

◆ ProcessYSemiAngle()

Dtk_Double64 Dtk_Camera::ProcessYSemiAngle ( ) const

Processes the Y - along height - Semi Angle - read only -.

Returns
The Y Semi-Angle in Radians, 0.0 if Dtk_Camera is not valid.
Remarks
The Y Semi-Angle is equal to atan( GetSemiHeight() / GetFocusDistance() )
The Y Semi-Angle is relevant for Perspective Camera.
8013 { return IsValid() ? ( atan( GetSemiHeight() / GetFocusDistance() ) ) : 0.; }

◆ ProcessYZoomFactor()

Dtk_Double64 Dtk_Camera::ProcessYZoomFactor ( ) const

Processes the Y - along height - zoom factor - read only -.

Returns
The Y zoom factor, 0.0 if Dtk_Camera is not valid.
Remarks
The Y Zoom Factor is equal to 1. / GetSemiHeight()
The Y Zoom Factor is relevant for Parallel Camera.
7999 { return IsValid() ? ( 1. / GetSemiHeight() ) : 0.; }

◆ ProjectionType()

const Dtk_Camera::ProjectionTypeEnum& Dtk_Camera::ProjectionType ( ) const

Retrieves the projection type - read only -.

Returns
The projection type

◆ SetClippingDistance()

void Dtk_Camera::SetClippingDistance ( const Dtk_Double64 inFrontDistance,
const Dtk_Double64 inBackDistance 
) const

set the Front Clipping Distance et Back Clipping Distance

◆ TargetPoint()

const Dtk_pnt& Dtk_Camera::TargetPoint ( ) const

Retrieves the target point - read only -.

Returns
The target point

◆ TargetVector()

Dtk_dir Dtk_Camera::TargetVector ( ) const

Retrieves the target vector - read only -.

Deprecated:
Use TargetPoint() const method instead.
Returns
The target vector

◆ Transform()

Dtk_ErrorStatus Dtk_Camera::Transform ( const Dtk_transfo inTransfo)
virtual

Applies a transformation matrix to the entity. //!

Parameters
inTransfoThe transformation matrix to apply.
Returns
dtkErrorUnspecified if the resulting Dtk_Camera is not valid, DtkNoError otherwise.

Implements Dtk_Entity.

◆ UpVector()

const Dtk_dir& Dtk_Camera::UpVector ( ) const

Retrieves the up vector - read only -.

Returns
The up vector

◆ ZoomFactor()

Dtk_Double64 Dtk_Camera::ZoomFactor ( ) const

Processes the X - width - zoom factor - read only -.

Deprecated:
Use ProcessXZoomFactor() const or ProcessYZoomFactor() const methods instead.
See also
ProcessXZoomFactor() const, 0.0 if Dtk_Camera is not valid.
Returns
The X zoom factor
8030 { return ProcessXZoomFactor(); }

Friends And Related Function Documentation

◆ Dtk_SmartPtr< Dtk_Camera >

friend class Dtk_SmartPtr< Dtk_Camera >
friend

Field Documentation

◆ _Private

Dtk_Handle* Dtk_Camera::_Private
protected

◆ count_

unsigned long Dtk_Object::count_
protectedinherited
Dtk_Camera::IsValid
Dtk_bool IsValid() const
Checks if the Dtk_Camera is valid. For this:
Definition: util_draw_dtk.hpp:8041
DTK_TOLERANCE
#define DTK_TOLERANCE
Definition: str_def.h:7
DTK_TYPE_ENTITY
@ DTK_TYPE_ENTITY
Definition: define.h:466
Dtk_Camera::ZoomFitAllScene
@ ZoomFitAllScene
Definition: util_draw_dtk.hpp:7874
Dtk_Camera::GetSemiHeight
Dtk_Double64 GetSemiHeight() const
Retrieves the Camera Base Semi Height - read only -.
DTK_TRUE
#define DTK_TRUE
Definition: define.h:727
DTK_TYPE_CAMERA
@ DTK_TYPE_CAMERA
Definition: define.h:478
DTK_TYPE_OBJECT
@ DTK_TYPE_OBJECT
Definition: define.h:464
DTK_FALSE
#define DTK_FALSE
Definition: define.h:728
Dtk_Camera::ProcessXSemiAngle
Dtk_Double64 ProcessXSemiAngle() const
Processes the X - along width - Semi Angle - read only -.
Definition: util_draw_dtk.hpp:8006
Dtk_Camera::ProjectionTypePerspective
@ ProjectionTypePerspective
Definition: util_draw_dtk.hpp:7869
Dtk_Camera::_typeID
@ _typeID
Definition: util_draw_dtk.hpp:7879
Dtk_Camera::ProjectionTypeParallel
@ ProjectionTypeParallel
Definition: util_draw_dtk.hpp:7868
Dtk_Entity::_typeID
@ _typeID
Definition: util_ent_dtk.hpp:333
Dtk_Camera::NoZoomFit
@ NoZoomFit
Definition: util_draw_dtk.hpp:7873
Dtk_Object::_typeID
@ _typeID
Definition: dtk_object.hpp:13
Dtk_Camera::Dtk_Camera
Dtk_Camera()
Dtk_Camera::GetFocusDistance
Dtk_Double64 GetFocusDistance() const
Processes the Focus Distance ie the Distance between the Origin and the Target points - read only -.
Dtk_Camera::ProcessXZoomFactor
Dtk_Double64 ProcessXZoomFactor() const
Processes the X - along width - zoom factor - read only -.
Definition: util_draw_dtk.hpp:7993
Dtk_Camera::GetSemiWidth
Dtk_Double64 GetSemiWidth() const
Retrieves the Camera Base Semi Width - read only -.
DTK_PI
#define DTK_PI
Definition: str_def.h:8
Dtk_Camera::ProjectionTypeUnknown
@ ProjectionTypeUnknown
Definition: util_draw_dtk.hpp:7867