public Point2D?CalculateIntersection(SlopeInterceptEquation otherEquation) { if (Slope.IsApproximately(otherEquation.Slope)) { return(null); } var slopeDifference = Slope - otherEquation.Slope; var yIntersectionDifference = otherEquation.YIntercept - YIntercept; var x = yIntersectionDifference / slopeDifference; var y = CalculateY(x); return(new Point2D(x, y)); }
public bool Equals(SlopeInterceptEquation other) => Slope.IsApproximately(other.Slope) && YIntercept.IsApproximately(other.YIntercept);