public bool Equals(Equation3 other) { return( Mathx.IsEqual(this.x, other.x) && Mathx.IsEqual(this.y, other.y) && Mathx.IsEqual(this.z, other.z) && Mathx.IsEqual(this.w, other.w) ); }
public static QuadraticEquation FromPoints(Vector2 A, Vector2 B, Vector2 C) { var Ea = new Equation3(A.x * A.x, A.x, 1.0f, A.y); var Eb = new Equation3(B.x * B.x, B.x, 1.0f, B.y); var Ec = new Equation3(C.x * C.x, C.x, 1.0f, C.y); var Eba = (Ea - Eb).WithZeroC(); var Ecb = (Eb - Ec).WithZeroC(); if (!Eba.IsValid() || !Ecb.IsValid()) { return(invalid); } var nEba = Eba.WithNormalizedB(); var a = Ecb.EvaluateA(nEba); var b = Ecb.EvaluateB(a); var c = Ec.EvaluateC(a, b); return(new QuadraticEquation(a, b, c)); }