bool FlatEllipse::Intersect(const FlatLine &line, FlatPoint &i1, FlatPoint &i2) const { const fixed er = ab(); const fixed ier = ba(); FlatLine s_line = line; s_line.sub(p); s_line.rotate(theta.Reciprocal()); s_line.mul_y(er); if (s_line.intersect_czero(a, i1, i2)) { i1.MultiplyY(ier); i1.Rotate(theta); i1.Add(p); i2.MultiplyY(ier); i2.Rotate(theta); i2.Add(p); return true; } return false; }
bool FlatEllipse::Intersect(const FlatLine &line, FlatPoint &i1, FlatPoint &i2) const { const double er = ab(); const double ier = ba(); FlatLine s_line = line - p; s_line.Rotate(theta.Reciprocal()); s_line.MultiplyY(er); if (s_line.IntersectOriginCircle(a, i1, i2)) { i1.MultiplyY(ier); i1.Rotate(theta); i1 += p; i2.MultiplyY(ier); i2.Rotate(theta); i2 += p; return true; } return false; }