|
Boost : |
From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-07-11 08:37:47
----- Original Message -----
From: Michael Stevens <michael_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, July 10, 2001 9:39 PM
Subject: [boost] Angular arithmetic
>Is there any interest in adding an angular arithmatic class template for
>inclusion in Boost?
>
>RATIONAL
>When working with numerical algorithms, arithmetic with angles is always
>a nasty issue. Normalising is essential. The class angle provides an
>efficient EXPLICIT normalisation of angles in the -Pi..Pi (inclusive)
>range.
>[SNIP]
This is not a comment against the library, but I will point out some
potential problem with this design.
The problem is that since normalization takes place during conversion, it
will happen than in some expressions, normalization of intermediate results
will occur even though they are unnecessary.
In practice, you need to normalize only when it is ACTUALLY required, which
in my experience is a lot less than usual.
For instance, most angular computations end up as arguments to trigonometric
functions were normalization is not required.
I used to have a class just like yours some years ago, but eventually
decided that a free-function angular arithmetic library instead of a class
template was a better solution, because it allows me to control more
efficiently when, and even how to normalize angular magnitudes. I couldn't
find any class design that offers the same flexibility and efficiency as a
separate function library.
But this is just my experience...
Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk