Sorry to revive this old thread,
First I would like to know if there had been any progress in this front.
Second, I would like to pick the attention of Boost.Geometry again in order to suggest them use boost.units as a way to make the Boost.Geometry library very general.
Third, after some thinking I have some thoughts about the original question in this post
What I'm struggling with is how to provide a units-aware Vector/Point system
for physical computation.
Currently, I'm favoring using units::quantity<U, Vector<double>> rather than
Vector<units::quantity<U>>.
I think none of the two options makes general sense. The only point at which units make sense is at the "metric" of the space. Since in Boost.geometry library coordinate system an metric are tied together, we need a special type of coordinates system. For example one suggestion could be to extend the coordinate systems of Boost.Geometry to include the units and dimension of space. For example one way to specify points in space could be by means of a type like this
model::point<double, 3, cs::unit::cartesian<si::length> >
and then specialize all the template functions that use cartesian as coordinate system, for example distance. This makes sense because the only point at which units are useful is when we take distances, modulus or projections between vectors in that "space" with unit/dimension.
I expected to use boost::geometry, but that didn't seem to provide much
benefit.
Regardless of whether we see benefit or not at this point I think this is a real problem that we should face. This is a conceptual problem that must be solved sooner or later.
Now that I'm not using boost::geometry to implement Vector/Point, it might
be much easier to support Vector<units::quantity<U>> as well.
My example was an intermediate stage. The example file that I failed to
post looked like this, along with the sample output.
It is interesting that (somehow) the Point/Vector quantities figured
themselves out.
Its interesting because:
Vector = Point - Point
Point = Point + Vector
Vector = Vector + Vector
but _not_ Point = Point + Point
and the dot product
Scalar = Vector * Vector
#include "BasicVector.h"
can you please post what is your current implementation of BasicVector.h?
cout << disp1 << endl;
cout << abs(disp1) << endl;
cout << abs_squared(disp1) << endl;
p1 += disp1;
cout << p1 << endl;
Time dt = Time(0.1 * s);
Velocity v = (p3 - p2) / dt;
cout << v << endl;
return EXIT_SUCCESS;
} // main
Output:
<3 3 3> m
(4 5 6) m
<-10 40 -20> m s^-1
this is the sort of things that from a dimensional point of view don't make sense. In the previous "m" or "m s^-1" is just a tag for the vector but it is not a real unit of the vector.
This is more ovbius when vectors are represented in spherical coordinates.
Any thoughts?
Thank you,
Alfredo