Easily Dealing with Any-Dimensional Planes
4 months ago
- #programming
- #mathematics
- #geometry
- A plane is an n-1 dimensional sub-space of an n-dimensional space that is flat.
- A plane can be fully specified using a normal vector (`n`) and any point within the plane (`o`).
- The condition for a point `p` to lie on the plane is `dot(p - o, n) = 0`.
- The plane can be represented using the normal vector and the scalar value `dot(o, n)`, which is the distance from the origin to the plane along the normal.
- A hyperplane representation is suggested using a template `hyperplane = vec<ScalarT, N+1>`.
- Operations like finding the distance from a point to the plane or checking if two planes are parallel are simplified with this representation.
- The logic generalizes to higher dimensions as well as to lower dimensions, such as lines in 2D space.