|
Boost : |
From: Matthias Schabel (boost_at_[hidden])
Date: 2003-12-09 21:07:45
> I click on http://groups.yahoo.com/group/boost/files/YANL.zip
> and I get a yahoo groups page saying,
>
> "The requested file or directory is not found on the server."
Hmmm...it's working for me. Anyone else having problems?
> I got sources I wrote years ago for angle types and trig functions.
> My primary intent was speed, rather than portability, and most
> functions are implemented in MMX/3DNow! inline assembly :), but they
> work, and you might find useful stuff in them. I defined also a type
> of fixed.point arithmetic, mod 2pi angle type (that can accumulate
> angle differentials ad-infinitum without losing precision) and that
> re-computes and caches sine and cosine values, for use with angles
> that seldom change, but often need trig values taken from.
As it stands, the library is capable of wrapping any well-behaved
arithmetic type, so as long as those classes support the basic
operations necessary, it should be no problem to add the
zero-runtime-overhead unit checking to them. See in particular the
implementation in measurement.hpp and its use in test_units.cpp for an
example.
> My question about angles was a bit philosophical, though: They use
> units (cycles, quarter-cycles, radians, degrees) but they are
> dimension-less. Are there any other such animals, besides angles?
I guess there is sort of a dichotomy of definitions. Formally, for
physical measurables, the seven basic quantities are length, mass,
time, quantity, temperature, current, and luminous intensity (or any
linear combination thereof). However, as you note, in practical
situations you may want to keep track of other things - the library
allows dimensional manipulations of arbitrary tag types for precisely
this reason. Angles are really a ratio of two lengths - the distance
travelled along a circular perimeter relative to the total perimeter of
the circle, as contrasted with, for example, solid angle which is the
ratio of two areas. In fact, if the universe was spherical, length and
angle would be interchangeable. Of course, you may also want to keep
track of things like quantity_apples/quantity_oranges - important if
you're a grocer even though they're technically not dimensionally
distinct...
Matthias
------------------------------------------------------------------------
---------------------------
Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
801-587-9413 (work)
801-585-3592 (fax)
801-706-5760 (cell)
801-484-0811 (home)
mschabel at ucair med utah edu
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk