Easy3D 2.5.3
transform_decompose.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY_RENDERER_TRANSFORM_DECOMPOSE_H
28#define EASY_RENDERER_TRANSFORM_DECOMPOSE_H
29
30
31#include <easy3d/core/types.h>
32
33
34// Defines functions that decompose a transformation matrix into its original components.
35
36// If you want to work with real cameras, see "Extrinsic/Intrinsic Decomposition"
37// The Perspective Camera - An Interactive Tour:
38// http://ksimek.github.io/2012/08/13/introduction/
39// Dissecting the Camera Matrix, Part 1: Extrinsic/Intrinsic Decomposition:
40// http://ksimek.github.io/2012/08/14/decompose/
41// Dissecting the Camera Matrix, Part 2: The Extrinsic Matrix:
42// http://ksimek.github.io/2012/08/22/extrinsic/
43// Calibrated Cameras in OpenGL without glFrustum:
44// http://ksimek.github.io/2013/06/03/calibrated_cameras_in_opengl/
45// Calibrated Cameras and gluPerspective:
46// http://ksimek.github.io/2013/06/18/calibrated-cameras-and-gluperspective/
47// Dissecting the Camera Matrix, Part 3: The Intrinsic Matrix:
48// http://ksimek.github.io/2013/08/13/intrinsic/
49//
50// Some related articles:
51// https://sightations.wordpress.com/2010/08/03/simulating-calibrated-cameras-in-opengl/
52
53namespace easy3d {
54
55 namespace transform {
56
69 void decompose(const mat4& M, vec3& scaling, mat3& rotation, vec3& translation);
70 void decompose(const mat4& M, vec3& scaling, quat& rotation, vec3& translation);
71
81 void decompose_no_scaling(const mat4& M, mat3& rotation, vec3& translation);
82 void decompose_no_scaling(const mat4& M, quat& rotation, vec3& translation);
83
89 bool decompose(const mat4& M, vec3& scaling, quat& rotation, vec3& translation, vec3& skew, vec4& persp);
90
91 }
92
93}
94
95
96
97#endif // EASY_RENDERER_TRANSFORM_DECOMPOSE_H
void decompose(const mat4 &M, vec3 &scaling, mat3 &rotation, vec3 &translation)
Decomposes a transformation matrix (M = translation * rotation * scaling) into its original component...
Definition: transform_decompose.cpp:37
void decompose_no_scaling(const mat4 &M, mat3 &rotation, vec3 &translation)
Decomposes a transformation matrix without scaling (M = translation * rotation) into its original com...
Definition: transform_decompose.cpp:93
Definition: collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition: types.h:45
Quat< float > quat
A quaternion of float type.
Definition: types.h:86
Mat4< float > mat4
A 4 by 4 matrix of float type.
Definition: types.h:68
Mat3< float > mat3
A 3 by 3 matrix of float type.
Definition: types.h:66
Vec< 4, float > vec4
A 4D point/vector of float type.
Definition: types.h:47