I have been trying to design a library to do some simple geometric computations in an Euclidean space regardless of its dimension. While it is easy to represent points, vectors, hyperspheres and hyperplanes in a generic fashion, I am still unable to find a generic way to represent a (infinite) line, even though lines share properties across dimensions.
My best guess is that I could store some of the parameters of its parametric equation since it is easy to extend a parametric equation to a line in a space of any dimension:
x = x0 + at
y = y0 + bt
z = z0 + ct
// can be extended to any dimension
But even with this equation, I can't find what should be stored and what should not be in order to compare lines. With an ideal solution, two objects of type Line
:
- would be programmatically equal (with
operator==
), - would have equal representations in the memory.
What should I store in order to achieve that?
operator==
as you can calculate all the rest of it from those points. However, it does fail the "equal representations in memory" part.