 # Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-10-13 13:13:44

"Matt Calabrese" wrote
> On 10/13/05, Deane Yang wrote:
>>
>> Mathematically, I think Andy is entirely correct in what he says above.
>> Once you take the ratio of two measurements of the same dimension (or
>> quantity), you end up with a pure number that really can't be
>> distinguished from other ratios or pure numbers.
>
>
> I tend to disagree here. A ratio of two lengths, for example, is in fact a

As an example take two people. Person1 has a height of 1 m . Person2 has a
height of 2 m.
Person 1 is 1/2 as high as person 2. That 1/2 is certainly not measured in
radians. it is just a number.

[cut]

> Take this situation, for example, if one were to choose to make the result
> of length / length simply a raw value. What happens if you have:
>
> arc_length / radius + quantity< degrees >( 90 );
>
> If you choose to have the result of the first operation be a raw value as
> opposed to a radian value, then what do we do here? Andy states that the
> operation shouldn't be allowed, however, I believe it should, since
> arc_length / radius is in fact an angle.

(Not sure what I am meant to have stated )
Actually this calc is entirely possible in pqs (See examples/angles.cpp).
pqs uses angles as value_types. A sample calculation might look like this:

// the angle value_type of arc_length signifies an arc length

// the implicit double value_type of radius signifies a straight length

std::cout << arc_length / radius + of_angle::deg(90) << '\n';

Outputs

However

// meant to be an arc length
length::m arc_len1( pi/2);
// the implied double value_type signifies a straight length
length::m len2(1);
std::cout << arc_len1 / len2 + of_angle::deg(90) << '\n'; // no operator +
for (double, degrees).

It does work (You can also use degrees etc as the value_type) but the implicit
conversion from radians to/from numeric is also available if user wishes to work
in a simpler way.

cheers
Andy Little

[note1] To get the implicit conversion behaviour in pqs-2-00-02 you need to
define
PQS_IMPLICIT_RADIANS_STRAIGHTENING. It was an experimental behaviour but as it
seems to work ok I guess it should be the default.
However implicit conversion of degrees(minutes,seconds etc) to a numeric type
was found to be unsatisfactory.

[note 2] I really should change l 'of_angle, to just 'angle;' It would make much
more sense ;-)