|
Boost Users : |
Subject: Re: [Boost-users] Using atan2 in boost::units
From: Matthias Schabel (boost_at_[hidden])
Date: 2010-01-04 14:09:17
>>
>>> The problem is that the library tries to determine the return type
>>> from the system. In this case, the system doesn't include a unit of
>>> angle, so the call fails.
>>>
>>
>> Thank you. So how should I use it then when the two variables are lengths,
>> not angles?
>>
>
> Something like this should work:
>
> typedef boost::units::unit<
> boost::units::length_dimension,
> boost::units::make_system<
> boost::units::angle::radian_base_unit,
> boost::units::astronomical::light_second_base_unit
> >::type
> > light_second_unit;
>
Steven,
I think we should probably have functions that return angles default to radians if not otherwise specified in the system. To my mind, that is consistent with the principle of least surprise and is consistent with existing library functionality... While the above solution should work and is consistent, it requires more understanding of Boost.Units than should be necessary for simple use of inverse trigonometric functions.
Matthias
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net