mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Add method to the Vector3 type to obtain a rotated version of the point.
This commit is contained in:
parent
4a2b9d5400
commit
ef2bc41fbc
@ -589,6 +589,13 @@ Vector3 Vector3::Interpolated(const Vector3 & vec, Value d) const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
Vector3 Vector3::Rotated(const Vector3 & axis, Value angle) const
|
||||||
|
{
|
||||||
|
const Vector3 o(axis * axis.DotProduct(*this));
|
||||||
|
return (o + ((*this - o) * std::cos(angle)) + (axis.CrossProduct(*this) * std::sin(angle)));
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
const Vector3 & Vector3::Get(CSStr str)
|
const Vector3 & Vector3::Get(CSStr str)
|
||||||
{
|
{
|
||||||
@ -714,6 +721,7 @@ void Register_Vector3(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("IsBetweenPoints"), &Vector3::IsBetweenPoints)
|
.Func(_SC("IsBetweenPoints"), &Vector3::IsBetweenPoints)
|
||||||
.Func(_SC("Interpolate"), &Vector3::Interpolate)
|
.Func(_SC("Interpolate"), &Vector3::Interpolate)
|
||||||
.Func(_SC("Interpolated"), &Vector3::Interpolated)
|
.Func(_SC("Interpolated"), &Vector3::Interpolated)
|
||||||
|
.Func(_SC("Rotated"), &Vector3::Rotated)
|
||||||
// Member Overloads
|
// Member Overloads
|
||||||
.Overload< void (Vector3::*)(void) >(_SC("Generate"), &Vector3::Generate)
|
.Overload< void (Vector3::*)(void) >(_SC("Generate"), &Vector3::Generate)
|
||||||
.Overload< void (Vector3::*)(Val, Val) >(_SC("Generate"), &Vector3::Generate)
|
.Overload< void (Vector3::*)(Val, Val) >(_SC("Generate"), &Vector3::Generate)
|
||||||
|
@ -419,6 +419,11 @@ struct Vector3
|
|||||||
*/
|
*/
|
||||||
Vector3 Interpolated(const Vector3 & vec, Value d) const;
|
Vector3 Interpolated(const Vector3 & vec, Value d) const;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Rotates the vector by a specified number of degrees around the Y axis and the specified center.
|
||||||
|
*/
|
||||||
|
Vector3 Rotated(const Vector3 & axis, Value angle) const;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Extract the values for components of the Vector3 type from a string.
|
* Extract the values for components of the Vector3 type from a string.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user