Merge pull request #18974 from KellyThomas/c-sharp-feature-parity-basis
Mono: Basis constructor for euler parameter
This commit is contained in:
commit
228b09bafb
|
@ -446,6 +446,26 @@ namespace Godot
|
||||||
_z = new Vector3(xz - wy, yz + wx, 1.0f - (xx + yy));
|
_z = new Vector3(xz - wy, yz + wx, 1.0f - (xx + yy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Basis(Vector3 euler)
|
||||||
|
{
|
||||||
|
real_t c;
|
||||||
|
real_t s;
|
||||||
|
|
||||||
|
c = Mathf.Cos(euler.x);
|
||||||
|
s = Mathf.Sin(euler.x);
|
||||||
|
var xmat = new Basis((real_t)1.0, (real_t)0.0, (real_t)0.0, (real_t)0.0, c, -s, (real_t)0.0, s, c);
|
||||||
|
|
||||||
|
c = Mathf.Cos(euler.y);
|
||||||
|
s = Mathf.Sin(euler.y);
|
||||||
|
var ymat = new Basis(c, (real_t)0.0, s, (real_t)0.0, (real_t)1.0, (real_t)0.0, -s, (real_t)0.0, c);
|
||||||
|
|
||||||
|
c = Mathf.Cos(euler.z);
|
||||||
|
s = Mathf.Sin(euler.z);
|
||||||
|
var zmat = new Basis(c, -s, (real_t)0.0, s, c, (real_t)0.0, (real_t)0.0, (real_t)0.0, (real_t)1.0);
|
||||||
|
|
||||||
|
this = ymat * xmat * zmat;
|
||||||
|
}
|
||||||
|
|
||||||
public Basis(Vector3 axis, real_t phi)
|
public Basis(Vector3 axis, real_t phi)
|
||||||
{
|
{
|
||||||
var axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
|
var axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
|
||||||
|
|
Loading…
Reference in New Issue