LuciadCPillar 2023.1.04
luciad::PerspectiveCamera::Builder Class Referencefinal

Factory object that can create new PerspectiveCamera instances. More...

#include <luciad/cameras/PerspectiveCamera.h>

Public Member Functions

 Builder (Builder &&other) noexcept
 
 Builder (const Builder &other)
 
 ~Builder ()
 
std::shared_ptr< PerspectiveCamerabuild () const
 Returns a new perspective camera. More...
 
Buildereye (Coordinate eye)
 Sets the eye the position of the new camera. More...
 
BuilderfovY (Angle fovY)
 Sets the vertical field of view. More...
 
Builderlook (const Look &look)
 Sets the position and orientation of the new camera. More...
 
BuilderlookAt (const LookAt &lookAt)
 Sets the description of what the camera is looking at and the orientation of the camera. More...
 
BuilderlookFrom (const LookFrom &lookFrom)
 Sets the description of the position and orientation of the new camera. More...
 
Builderoperator= (Builder other) noexcept
 
Builderorientation (Coordinate forward, Coordinate up)
 Sets the forward the viewing direction of the new camera and the camera's up direction. More...
 

Detailed Description

Factory object that can create new PerspectiveCamera instances.

Constructor & Destructor Documentation

◆ Builder() [1/2]

luciad::PerspectiveCamera::Builder::Builder ( const Builder other)

◆ Builder() [2/2]

luciad::PerspectiveCamera::Builder::Builder ( Builder &&  other)
noexcept

◆ ~Builder()

luciad::PerspectiveCamera::Builder::~Builder ( )

Member Function Documentation

◆ build()

std::shared_ptr< PerspectiveCamera > luciad::PerspectiveCamera::Builder::build ( ) const

Returns a new perspective camera.

Returns
a new perspective camera.

◆ eye()

Builder & luciad::PerspectiveCamera::Builder::eye ( Coordinate  eye)

Sets the eye the position of the new camera.

Parameters
eyethe position of the new camera.
Returns
this builder

◆ fovY()

Builder & luciad::PerspectiveCamera::Builder::fovY ( Angle  fovY)

Sets the vertical field of view.

Note
The horizontal field of view will be derived from vertical field of view based on the aspect ratio. You can convert between horizontal and vertical field-of-view angles using the following formulae:
// Vertical -> horizontal field-of-view
double aspectRatio = static_cast<double>(camera->getWidth()) / camera->getHeight();
Angle cameraFovX = Angle::fromRadians(2.0 * std::atan(std::tan(camera->getFovY().getRadians() / 2.0) * aspectRatio));
// Horizontal -> vertical field-of-view
Angle newFovX = 60.0;
Angle newFovY = Angle::fromRadians(2 * std::atan(std::tan(newFovX.getRadians() / 2.0) / aspectRatio));
An angle on a mathematical circle: degrees, counter-clockwise from right/X-axis.
Definition: Angle.h:14
double getRadians() const
Returns the value in radians constrained between [0, 2*PI]
static Angle fromRadians(double radians)
Creates an Angle from an angle value in radians.
Parameters
fovYthe new vertical field of view.
Returns
this builder

◆ look()

Builder & luciad::PerspectiveCamera::Builder::look ( const Look look)

Sets the position and orientation of the new camera.

Parameters
lookthe position and orientation of the new camera.
Returns
this builder

◆ lookAt()

Builder & luciad::PerspectiveCamera::Builder::lookAt ( const LookAt lookAt)

Sets the description of what the camera is looking at and the orientation of the camera.

Parameters
lookAtthe description of what the camera is looking at and the orientation of the camera.
Returns
this builder

◆ lookFrom()

Builder & luciad::PerspectiveCamera::Builder::lookFrom ( const LookFrom lookFrom)

Sets the description of the position and orientation of the new camera.

Parameters
lookFromthe description of the position and orientation of the new camera.
Returns
this builder

◆ operator=()

Builder & luciad::PerspectiveCamera::Builder::operator= ( Builder  other)
noexcept

◆ orientation()

Builder & luciad::PerspectiveCamera::Builder::orientation ( Coordinate  forward,
Coordinate  up 
)

Sets the forward the viewing direction of the new camera and the camera's up direction.

Parameters
forwardthe viewing direction of the new camera
upthe camera's up direction
Returns
this builder