Boost logo

Boost :

From: Anatoli Tubman (anatoli_at_[hidden])
Date: 2001-08-12 02:20:56


On Saturday 11 August 2001 08:05, Michael Kenniston wrote:

> 4) In between "units" and "dimensionality" there is a third distinct
> concept of "quantity-type". For example "radian", "mil_angle", and
> "degree_angle" are different units but have the same quantity type
> (plane angle) and are thus freely convertible. However "pure number"
> and "plane angle" are different types, even though they have the same
> dimensionality, and so should not be freely convertible. My intuition
> is that this concept would be very useful, but at this time I have no
> clear idea how to implement it (or even define it) correctly, so I'd
> rather concentrate on just getting dimension-checking right to start
> with.

Why not implement this concept by allocating to angles their own
dimension slots (one for plane angles, another for spatial angles)?

And while we're at it, why not allow user-defined dimensions?
SI framework is nice and useful, but a good library can (and
IMHO should) go beyond and above it. Adding two masses together
always has *some* physical sense, but it may not have sense in
context of a particular application (kilogram of apples plus
kilogram of oranges = ?).

I fully understand that providing for user-defined dimensions is not
trivial, but it *is* doable. A SI units library could be then implemented
on top of an arbitrary-dimension library.

Last but not least, a good library *must* allow for rational
powers, not just integer ones.

[Once upon a time I've implemented such a library, for my own amusement.
Complete with rational powers and arbitrary number of user-defined
dimensions. The developmend didn't go much beyond proof-of-concept stage. If
you're interested, feel free to contact me.]

-- 
anatoli at ptc dot com -- opinions are mine

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk