Computationnal geometry: vector, basis, point and coordinate system?

152 Views Asked by At

I am trying to build a small geometrical library in C++, that is mathematically consistent (not so false). The goal here is to construct two concepts: vectors and points. I am not sure that the following formulation is consistent (and if not, how to modify it).

First, the vectors. To construct a vector, one need two elements:

  • a vector space vector_space<class Field, unsigned int Dimension> is defined by:

    • a field (e.g. $\mathbb{R}$)
    • a dimension (e.g. $3$)
  • a basis of N vectors if the vector space has N dimensions

Having that, when one calls my_vector[0], or my_vector[1], the returned number corresponds to the components of the vector according to the given basis.

Now points (and here I am not sure of what I am saying) (you can add vectors, add a vector to a point, but not add two points). As for vector, one need two elements:

  • an affine space affine_space<class VectorSpace> that can be defined from:

    • a vector space
  • a coordinate system

Having that, when one call my_point[0], or my_point[1], the returned number corresponds to the coordinate of the point in the provided coordinate system.

Here are my questions:

  1. Does it make sense (mathematically speaking) ?
  2. Is there a better approach (mathematically speaking) ?
  3. Is it correct to say that a coordinate system is for a point, what a basis is for a vector?