[Haskell-cafe] Working around floating-point inaccuracies
Olaf Klinke
olf at aatal-apotheke.de
Sun Aug 5 20:18:37 UTC 2018
Michail,
Each plane in 3d space is determined by a single linear equation with 3 unknowns. Essentially the equation is what pointOnPlane evaluates. Two planes are equal if the system of linear equations consisting of both equations has rank 1. This is a standard concept of linear algebra, hence the answer to your problem (and code for a good implementation) should be found in the literature on that subject - numerical linear algebra. Google "numerical rank of a matrix". The concepts you are looking for is the "condition number" or "operator norm". You could try to enforce an invariant that the representation is always as nice as possible, numerically.
If you are okay with a vector space over the rational numbers, you could represent your planes by an equation with integer coefficients, which makes equality testing independent of floating point issues.
Olaf
More information about the Haskell-Cafe
mailing list