|
Boost : |
Subject: Re: [boost] [geometry][units] Vector Class
From: barend (barend_at_[hidden])
Date: 2010-05-19 16:40:10
Hi Terry,
Op 19-5-2010 14:29, Terry Golubiewski schreef:
> I imagine that using geometry/unit together will be common.
> I just posted these files on boost-user too, but I wanted the
> geometry/units developers to see what I've done.
> I think it was too difficult to make a Vector<quantity<U,T>> class.
Agreed.
> However, it could be done, so that is very good!
The bad news is: the cartesian_distance class will go away. One of the
reasons is the one you showed in your attachment -- you actually have to
reimplement the whole strategy including return type. The good news is
that it will be simpler to implement, and actually the distance will
have the same measure as the coordinate system, so meters -> coordinate
system: meters -> distance: meters, no T*T vs sqrt(T) (or handled
internally).
>
> The problem is that the geometry library assumes that the types of T*T
> and sqrt(T) is the same as T.
Sure. During BoostCon I presented this "convertible to double" approach
(which is cartesian_distance) and Eric remarked that it might give
problems, using the return type in meta-programming, and indeed it does.
Thanks for your efforts and sorry about the change needed in the near
future, but I hope it will be simpler indeed. I'm still not sure about
it anyway, the review report tells us to show how units can be
integrated and I envisioned it being in the coordinate system, not in
the point type. So I'll look more close into your implementation. Note
also that a "vector" is actually not part of Boost.Geometry but we hope
that it can live apart from it, e.g. as Emil's vector/matrix library,
and work together (though there is currently some vector arithmetic
present).
Regards, Barend
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk