Skylicht Engine
Loading...
Searching...
No Matches
CVector.h
1/*
2!@
3MIT License
4
5Copyright (c) 2024 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25namespace Skylicht
26{
31 class SKYLICHT_API CVector
32 {
33 public:
34
42 static core::vector3df lerp(const core::vector3df& a, const core::vector3df& b, float t);
43
51 static core::vector3df slerp(const core::vector3df& a, const core::vector3df& b, float t);
52
59 static core::vector3df reflect(const core::vector3df& inDirection, const core::vector3df& normal);
60
67 static float angle(const core::vector3df& a, const core::vector3df& b);
68
75 static core::vector3df project(const core::vector3df& vector, const core::vector3df& onNormal);
76
83 static core::vector3df projectOnPlane(const core::vector3df& vector, const core::vector3df& planeNormal);
84
91 static bool isParallel(const core::vector3df& a, const core::vector3df& b);
92
98 static core::vector3df quaternionToEuler(const core::quaternion& q);
99
107 static core::quaternion getQuaternionFromAxes(const core::vector3df& xAxis, const core::vector3df& yAxis, const core::vector3df& zAxis);
108 };
109}
Common vector and quaternion math helpers.
Definition CVector.h:32
static core::vector3df reflect(const core::vector3df &inDirection, const core::vector3df &normal)
Reflect a direction vector around a normal.
static float angle(const core::vector3df &a, const core::vector3df &b)
Calculate the angle between two vectors in radians.
static core::vector3df project(const core::vector3df &vector, const core::vector3df &onNormal)
Project a vector onto another vector.
static core::quaternion getQuaternionFromAxes(const core::vector3df &xAxis, const core::vector3df &yAxis, const core::vector3df &zAxis)
Build a quaternion from three orthogonal basis axes.
static core::vector3df slerp(const core::vector3df &a, const core::vector3df &b, float t)
Spherically interpolate between two direction vectors.
static core::vector3df lerp(const core::vector3df &a, const core::vector3df &b, float t)
Linearly interpolate between two vectors.
static core::vector3df projectOnPlane(const core::vector3df &vector, const core::vector3df &planeNormal)
Project a vector onto a plane.
static bool isParallel(const core::vector3df &a, const core::vector3df &b)
Test whether two vectors are parallel or anti-parallel.
static core::vector3df quaternionToEuler(const core::quaternion &q)
Convert a quaternion to Euler angles.
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29