public bool AproxEqualsBox(FVec3 vector, Fix64 tolerance) { return ((Fix64.Abs(this.x - vector.x) <= tolerance) && (Fix64.Abs(this.y - vector.y) <= tolerance) && (Fix64.Abs(this.z - vector.z) <= tolerance)); }
public static FVec3 OrthoNormalVector(FVec3 v) { FVec3 res = new FVec3(); if (Fix64.Abs(v.z) > OVER_SQRT2) { Fix64 a = v.y * v.y + v.z * v.z; Fix64 k = Fix64.One / Fix64.Sqrt(a); res.x = Fix64.Zero; res.y = -v.z * k; res.z = v.y * k; } else { Fix64 a = v.x * v.x + v.y * v.y; Fix64 k = Fix64.One / Fix64.Sqrt(a); res.x = -v.y * k; res.y = v.x * k; res.z = Fix64.Zero; } return(res); }
public static FVec4 Abs(FVec4 v) { return(new FVec4(Fix64.Abs(v.x), Fix64.Abs(v.y), Fix64.Abs(v.z), Fix64.Abs(v.w))); }