23#ifndef VCL_ALGORITHMS_CORE_MATRIX_CAMERA_H
24#define VCL_ALGORITHMS_CORE_MATRIX_CAMERA_H
26#include <vclib/space/core.h>
46template<Po
int3Concept Po
intType>
50 const PointType& center,
72template<MatrixConcept Matrix44, Po
int3Concept Po
intType>
75 const PointType& center,
99template<Po
int3Concept Po
intType>
102 const PointType& eye,
103 const PointType& center,
123template<MatrixConcept Matrix44, Po
int3Concept Po
intType>
125 const PointType& eye,
126 const PointType& center,
134template<
typename Scalar>
135void projectionMatrix(
142 Handedness handedness = RIGHT_HAND)
144 detail::projectionMatrix(
145 res, fov, aspect, nearPlane, farPlane, homogeneousNDC, handedness);
148template<MatrixConcept Matrix44,
typename Scalar>
149Matrix44 projectionMatrix(
155 Handedness handedness = RIGHT_HAND)
169template<
typename Scalar>
170void projectionMatrixLeftHanded(
178 Scalar h = 1.0 / std::tan(
vcl::toRad(fov) * 0.5);
179 Scalar w = h * 1.0 / aspect;
181 res, fov, aspect, nearPlane, farPlane, homogeneousNDC, LEFT_HAND);
184template<MatrixConcept Matrix44,
typename Scalar>
185Matrix44 projectionMatrixLeftHanded(
204template<
typename Scalar>
205void orthoProjectionMatrix(
214 Handedness handedness = RIGHT_HAND)
216 detail::orthoProjectionMatrix(
228template<MatrixConcept Matrix44,
typename Scalar>
229Matrix44 orthoProjectionMatrix(
237 Handedness handedness = RIGHT_HAND)
240 orthoProjectionMatrix(
270template<MatrixConcept Matrix44, Po
int3Concept Po
intType>
277 using Scalar = Matrix44::Scalar;
286 throw std::runtime_error(
"unproject: division by zero");
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:41
void lookAtMatrixLeftHanded(auto *res, const PointType &eye, const PointType ¢er, const PointType &up)
Creates a left handed look at matrix.
Definition matrix_camera.h:100
PointType unprojectScreenPosition(const PointType &screenPos, const Matrix44 &modelViewProjection, const Point4< typename Matrix44::Scalar > &viewport, bool homogeneousNDC)
Unprojects a screen position to a 3D point.
Definition matrix_camera.h:271
void lookAtMatrix(auto *res, const PointType &eye, const PointType ¢er, const PointType &up, Handedness handedness=RIGHT_HAND)
Creates a look at matrix.
Definition matrix_camera.h:47
Scalar toRad(const Scalar °)
Converts an angle in degrees to radians.
Definition math.h:81