public GodotVector3 GetEuler() { GodotBasis basis = Orthonormalized(); GodotVector3 vector3; vector3.z = 0.0f; float num = basis.y[2]; if (num < 1.0) { if (num > -1.0) { vector3.x = GodotMathf.Asin(-num); vector3.y = GodotMathf.Atan2(basis.x[2], basis.z[2]); vector3.z = GodotMathf.Atan2(basis.y[0], basis.y[1]); } else { vector3.x = 1.570796f; vector3.y = -GodotMathf.Atan2(-basis.x[1], basis.x[0]); } } else { vector3.x = -1.570796f; vector3.y = -GodotMathf.Atan2(basis.x[1], basis.x[0]); } return(vector3); }
public GodotQuat Quat() { float num1 = x[0] + y[1] + z[2]; if (num1 > 0.0) { float num2 = GodotMathf.Sqrt(num1 + 1f) * 2f; float num3 = 1f / num2; return(new GodotQuat((z[1] - y[2]) * num3, (x[2] - z[0]) * num3, (y[0] - x[1]) * num3, num2 * 0.25f)); } if (x[0] > y[1] && x[0] > z[2]) { float num2 = GodotMathf.Sqrt((float)(x[0] - y[1] - z[2] + 1.0)) * 2f; float num3 = 1f / num2; return(new GodotQuat(num2 * 0.25f, (x[1] + y[0]) * num3, (x[2] + z[0]) * num3, (z[1] - y[2]) * num3)); } if (y[1] > z[2]) { float num2 = GodotMathf.Sqrt((float)(-x[0] + y[1] - z[2] + 1.0)) * 2f; float num3 = 1f / num2; return(new GodotQuat((x[1] + y[0]) * num3, num2 * 0.25f, (y[2] + z[1]) * num3, (x[2] - z[0]) * num3)); } float num4 = GodotMathf.Sqrt((float)(-x[0] - y[1] + z[2] + 1.0)) * 2f; float num5 = 1f / num4; return(new GodotQuat((x[2] + z[0]) * num5, (y[2] + z[1]) * num5, num4 * 0.25f, (y[0] - x[1]) * num5)); }
public float Length() { double num1 = x * (double)x; float num2 = y * y; float num3 = z * z; double num4 = num2; return(GodotMathf.Sqrt((float)(num1 + num4) + num3)); }
public GodotVector3 Intersect3(GodotPlane b, GodotPlane c) { float s = normal.Cross(b.normal).Dot(c.normal); if (GodotMathf.Abs(s) <= 9.99999997475243E-07) { return(new GodotVector3()); } return(((b.normal.Cross(c.normal) * d) + (c.normal.Cross(normal) * b.d) + (normal.Cross(b.normal) * c.d)) / s); }
public GodotBasis(GodotVector3 axis, float phi) { GodotVector3 vector3 = new GodotVector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z); float num1 = GodotMathf.Cos(phi); float num2 = GodotMathf.Sin(phi); x = new GodotVector3(vector3.x + (num1 * (1f - vector3.x)), (float)((axis.x * axis.y * (1.0 - num1)) - (axis.z * num2)), (float)((axis.z * axis.x * (1.0 - num1)) + (axis.y * num2))); y = new GodotVector3((float)((axis.x * axis.y * (1.0 - num1)) + (axis.z * num2)), vector3.y + (num1 * (1f - vector3.y)), (float)((axis.y * axis.z * (1.0 - num1)) - (axis.x * num2))); z = new GodotVector3((float)((axis.z * axis.x * (1.0 - num1)) - (axis.y * num2)), (float)((axis.y * axis.z * (1.0 - num1)) + (axis.x * num2)), vector3.z + (num1 * (1f - vector3.z))); }
internal void Normalize() { float s = ((x * x) + (y * y)); if (s == 0.0) { return; } float num = GodotMathf.Sqrt(s); x /= num; y /= num; }
public GodotQuat Slerpni(GodotQuat b, float t) { float s1 = Dot(b); if (GodotMathf.Abs(s1) > 0.999899983406067) { return(this); } float s2 = GodotMathf.Acos(s1); float num1 = 1f / GodotMathf.Sin(s2); float num2 = GodotMathf.Sin(t * s2) * num1; float num3 = GodotMathf.Sin((1f - t) * s2) * num1; return(new GodotQuat((num3 * x) + (num2 * b.x), (num3 * y) + (num2 * b.y), (num3 * z) + (num2 * b.z), (num3 * w) + (num2 * b.w))); }
public GodotVector3 IntersectRay(GodotVector3 from, GodotVector3 dir) { float s = normal.Dot(dir); if (GodotMathf.Abs(s) <= 9.99999997475243E-07) { return(new GodotVector3()); } float num = (normal.Dot(from) - d) / s; if (num > 9.99999997475243E-07) { return(new GodotVector3()); } return(from + (dir * -num)); }
public GodotVector3 IntersectSegment(GodotVector3 begin, GodotVector3 end) { GodotVector3 b = begin - end; float s = normal.Dot(b); if (GodotMathf.Abs(s) <= 9.99999997475243E-07) { return(new GodotVector3()); } float num = (normal.Dot(begin) - d) / s; if (num < -9.99999997475243E-07 || num > 1.00000095367432) { return(new GodotVector3()); } return(begin + (b * -num)); }
public GodotQuat(GodotVector3 axis, float angle) { float num1 = axis.Length(); if (num1 == 0.0) { x = 0.0f; y = 0.0f; z = 0.0f; w = 0.0f; } else { float num2 = GodotMathf.Sin(angle * 0.5f) / num1; x = axis.x * num2; y = axis.y * num2; z = axis.z * num2; w = GodotMathf.Cos(angle * 0.5f); } }
public GodotQuat Slerp(GodotQuat b, float t) { float s1 = ((x * b.x) + (y * b.y) + (z * b.z) + (w * b.w)); float[] numArray = new float[4]; if (s1 < 0.0) { s1 = -s1; numArray[0] = -b.x; numArray[1] = -b.y; numArray[2] = -b.z; numArray[3] = -b.w; } else { numArray[0] = b.x; numArray[1] = b.y; numArray[2] = b.z; numArray[3] = b.w; } float num1; float num2; if (1.0 - s1 > 9.99999997475243E-07) { float s2 = GodotMathf.Acos(s1); float num3 = GodotMathf.Sin(s2); num1 = GodotMathf.Sin((1f - t) * s2) / num3; num2 = GodotMathf.Sin(t * s2) / num3; } else { num1 = 1f - t; num2 = t; } return(new GodotQuat((num1 * x) + (num2 * numArray[0]), (num1 * y) + (num2 * numArray[1]), (num1 * z) + (num2 * numArray[2]), (num1 * w) + (num2 * numArray[3]))); }
public GodotVector3 Ceil() { return(new GodotVector3(GodotMathf.Ceil(x), GodotMathf.Ceil(y), GodotMathf.Ceil(z))); }
public GodotVector2 Floor() { return(new GodotVector2(GodotMathf.Floor(x), GodotMathf.Floor(y))); }
public GodotVector3 Abs() { return(new GodotVector3(GodotMathf.Abs(x), GodotMathf.Abs(y), GodotMathf.Abs(z))); }
public float AngleTo(GodotVector3 to) { return(GodotMathf.Atan2(Cross(to).Length(), Dot(to))); }
public float Length() { return(GodotMathf.Sqrt((x * x) + (y * y))); }
public GodotVector3 Snapped(GodotVector3 by) { return(new GodotVector3(GodotMathf.Stepify(x, by.x), GodotMathf.Stepify(y, by.y), GodotMathf.Stepify(z, by.z))); }
public GodotVector3 Floor() { return(new GodotVector3(GodotMathf.Floor(x), GodotMathf.Floor(y), GodotMathf.Floor(z))); }
public float AngleTo(GodotVector2 to) { return(GodotMathf.Atan2(Cross(to), Dot(to))); }
public GodotVector2 Rotated(float phi) { float s = Angle() + phi; return(new GodotVector2(GodotMathf.Cos(s), GodotMathf.Sin(s)) * Length()); }
public float Length() { return(GodotMathf.Sqrt(LengthSquared())); }
public GodotVector2 Snapped(GodotVector2 by) { return(new GodotVector2(GodotMathf.Stepify(x, by.x), GodotMathf.Stepify(y, by.y))); }
public GodotVector2 Abs() { return(new GodotVector2(GodotMathf.Abs(x), GodotMathf.Abs(y))); }
public float AngleToPoint(GodotVector2 to) { return(GodotMathf.Atan2(x - to.x, y - to.y)); }
public float DistanceTo(GodotVector2 to) { return(GodotMathf.Sqrt(((x - to.x) * (x - to.x)) + ((y - to.y) * (y - to.y)))); }
public bool IsNormalized() { return(GodotMathf.Abs(LengthSquared() - 1f) < 9.99999997475243E-07); }
public bool HasPoint(GodotVector3 point, float epsilon = 1E-06f) { return(GodotMathf.Abs(normal.Dot(point) - d) <= (double)epsilon); }
public float Angle() { return(GodotMathf.Atan2(y, x)); }