
Boost : 
From: Ben FrantzDale (benfrantzdale_at_[hidden])
Date: 20070312 14:04:21
Anyone interested in this should read up on affine spaces. Absolute
temperature is an affine point; difference between affine points are
vectors.The same goes for positions in space or time.
Note that Boost already touches on these ideas in Boost.Date_Time (
http://www.boost.org/doc/html/date_time.html).
A Time is an affine point, a Time Duration is a vector. (I believe a Time
Period could be called a "bound vector".)
See also
http://en.wikipedia.org/wiki/Affine_space
http://benfrantzdale.livejournal.com/206467.html – what I wrote about this
when first heard about affine spaces.
—Ben
On 3/9/07, Matthias Schabel <boost_at_[hidden]> wrote:
>
> > representation (i.e. a dimension). I just couldn't think of any
> > other meaningful operation.
>
> I believe that vector operator(point,point) is sensible...
>
> > space. You can add Kelvin to Kelvin and Celsius to Celsius, but
> > you can't mix them. The corresponding results are either in
>
> In this case, since the metric is degenerate, they can be implicitly
> converted to one another if you're talking about temperature
> differences.
>
> > 293.15 Kelvin represent the same temperature as 20 degrees
> > Celsius, but doubling both will lead to very different results.
>
> If you mean 293.15K in absolute temperature, you're right. However,
> doubling a temperature difference makes perfect sense in either
> unit system.
>
> > something entirely different. So I'd stick to offer a
> > transformation between absolute temperatures.
>
> But in most ways differences behave more like what we expect
> when we use units. That is a length, for example, is really a
> difference between the two endpoints of an object, etc...
>
> Since people are likely to expect reasonable handling of both
> absolute temperatures and temperature differences, we may
> end up adding the absolute<> wrapper to the units library to
> allow that intent to be indicated and caught. Relative values
> are basically degenerate with bare value type and probably
> don't need a special wrapper. Then the operations that need
> to be supported are :
>
> absolute<T> operator+(absolute<T>,T)
> absolute<T> operator+(T,absolute<T>)
> absolute<T> operator(absolute<T>,T)
> absolute<T> operator(T,absolute<T>)
> T operator(absolute<T>,absolute<T>)
>
> I think that's about it. You can't multiply absolute values by
> scalars or add them to themselves, obviously. Of course,
> this functionality certainly has relevance beyond the dimensional
> analysis/units domain, but I don't know if it's possible to find
> a sufficiently generic solution that meets every reasonable
> need and is implementable...
>
> Matthias
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk