DATAKIT SDK  V2026.4
Dtk_Camera Class Reference

This is the Camera class.
This class lets you define elements to create frustum.
. 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_ID & GetID () 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::ZoomFitModeEnum & GetZoomFitMode () const
 Retrieves the zoom fit mode - read only -. More...
 
Dtk_InfoPtr & info ()
 
Dtk_bool IsValid () const
 Checks if the Dtk_Camera is valid. For this: More...
 
const Dtk_pnt & OriginPoint () 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::ProjectionTypeEnum & ProjectionType () 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_pnt & TargetPoint () 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_dir & UpVector () 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 ()
 Calls default constructor to allocate a new object. 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)
 Calls full featured constructor to allocate a new object. 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)
 Calls full featured constructor to allocate a new object. More...
 
static Dtk_CameraPtr Create (Dtk_Camera const &in)
 Copy constructor. More...
 
static Dtk_Camera * DtkDynamicCast (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

virtual Dtk_Object * Clone ()
 
 Dtk_Camera ()
 
 Dtk_Camera (const Dtk_Camera &s)
 
 Dtk_Camera (Dtk_Camera &&in) DTK_NOEXCEPT
 
 ~Dtk_Camera ()
 

Protected Attributes

std::unique_ptr< Dtk_Handle > _Private
 
unsigned long count_
 

Detailed Description

This is the Camera class.
This class lets you define elements to create frustum.
.

See also
Use 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 
6952 { _typeID = DTK_TYPE_CAMERA };

◆ ProjectionTypeEnum

Enumerator
ProjectionTypeUnknown 
ProjectionTypeParallel 
ProjectionTypePerspective 
6939  {
6943  };

◆ ZoomFitModeEnum

Enumerator
NoZoomFit 
ZoomFitAllScene 
6945  {
6946  NoZoomFit = 0, //The camera doesn't need to be zoom fitted.
6947  ZoomFitAllScene, //The camera needs to be zoom fitted to the entire scene.
6948  };

Constructor & Destructor Documentation

◆ Dtk_Camera() [1/3]

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

◆ Dtk_Camera() [2/3]

Dtk_Camera::Dtk_Camera ( const Dtk_Camera &  s)
protected

◆ Dtk_Camera() [3/3]

Dtk_Camera::Dtk_Camera ( Dtk_Camera &&  in)
protected

◆ ~Dtk_Camera()

Dtk_Camera::~Dtk_Camera ( )
protected

Member Function Documentation

◆ _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
7094 { return ProcessXSemiAngle() * 180. / DTK_PI; }

◆ Clone()

virtual Dtk_Object* Dtk_Camera::Clone ( )
protectedvirtual

Implements Dtk_Entity.

6958 { return new Dtk_Camera(*this); }

◆ Create() [1/4]

static Dtk_CameraPtr Dtk_Camera::Create ( )
static

Calls default constructor to allocate a new object.

◆ Create() [2/4]

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

Calls full featured constructor to allocate a new object.

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/4]

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

Calls full featured constructor to allocate a new object.

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

◆ Create() [4/4]

static Dtk_CameraPtr Dtk_Camera::Create ( Dtk_Camera const &  in)
static

Copy constructor.

Parameters
inObject to copy from.

◆ 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
7104 { 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.

6971 { 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.
7112  {
7113  if( GetFocusDistance() < DTK_TOLERANCE ||
7116  {
7117  return DTK_FALSE;
7118  }
7119  else
7120  {
7121  return DTK_TRUE;
7122  }
7123  }

◆ 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.
7076 { 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.
7063 { 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.
7083 { 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.
7069 { 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
7100 { return ProcessXZoomFactor(); }

Field Documentation

◆ _Private

std::unique_ptr<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:7111
DTK_TOLERANCE
#define DTK_TOLERANCE
Definition: str_def.h:7
DTK_TYPE_ENTITY
@ DTK_TYPE_ENTITY
Definition: define.h:457
Dtk_Camera::ZoomFitAllScene
@ ZoomFitAllScene
Definition: util_draw_dtk.hpp:6947
Dtk_Camera::GetSemiHeight
Dtk_Double64 GetSemiHeight() const
Retrieves the Camera Base Semi Height - read only -.
DTK_TRUE
#define DTK_TRUE
Definition: define.h:726
DTK_TYPE_CAMERA
@ DTK_TYPE_CAMERA
Definition: define.h:469
DTK_TYPE_OBJECT
@ DTK_TYPE_OBJECT
Definition: define.h:455
DTK_FALSE
#define DTK_FALSE
Definition: define.h:727
Dtk_Camera::ProcessXSemiAngle
Dtk_Double64 ProcessXSemiAngle() const
Processes the X - along width - Semi Angle - read only -.
Definition: util_draw_dtk.hpp:7076
Dtk_Camera::ProjectionTypePerspective
@ ProjectionTypePerspective
Definition: util_draw_dtk.hpp:6942
Dtk_Camera::_typeID
@ _typeID
Definition: util_draw_dtk.hpp:6952
Dtk_Camera::ProjectionTypeParallel
@ ProjectionTypeParallel
Definition: util_draw_dtk.hpp:6941
Dtk_Entity::_typeID
@ _typeID
Definition: util_ent_dtk.hpp:371
Dtk_Camera::NoZoomFit
@ NoZoomFit
Definition: util_draw_dtk.hpp:6946
Dtk_Object::_typeID
@ _typeID
Definition: dtk_object.hpp:10
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:7063
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:6940