Ad
  • Custom User Avatar

    I wonder if using floats as inputs and outputs does not make things unnecessarily complicated, because now you have to add tolerance to all kinds of checks like equality of points, collinearity, etc., and document it. However, this kind of linear calculations can be done completely in rational numbers (i.e. fractions). If you made input points always placed on integer lattice, or possibly in locations with fractional coordinates, then all intersection points could be represented with fractions, and compared for strict equality. There would be no need for tolerance checks, there would be no potential ambiguities like should the points common for input and output be returned identical, or will they be also compared with tolerance, etc.