[units] newbie : plane_angle

Hi, I just discover boost::units and I want to know how it works in this case : quantitysi::plane_angle angle(45 * degree); When the constructor is called, is the argument converted in radian or not ? Moreover, it is possible to have : quantity?::plane_angle> angle(45 * degree); angle += pi / 4 * radian; cout << angle << endl; cout << quantitydegree::plane_angle(angle) << endl; cout << quantityradian::plane_angle(angle) << endl; cout << angle.value<degree>() << endl; cout << angle.value<radian>() << endl; output : 45 deg + pi / 4 rad 90 deg pi / 2 rad 90 1.57079632679 Thanks. -- Damien R

AMDG Damien R wrote:
I just discover boost::units and I want to know how it works in this case : quantitysi::plane_angle angle(45 * degree);
When the constructor is called, is the argument converted in radian or not ?
The value is converted into radians.
Moreover, it is possible to have : quantity?::plane_angle> angle(45 * degree); angle += pi / 4 * radian; cout << angle << endl; cout << quantitydegree::plane_angle(angle) << endl; cout << quantityradian::plane_angle(angle) << endl; cout << angle.value<degree>() << endl; cout << angle.value<radian>() << endl;
output : 45 deg + pi / 4 rad
This is not possible.
90 deg pi / 2 rad
You would get 1.57..., not pi/2
90 1.57079632679
This can be done with quantitydegree::plane_angle(angle).value() e.g.. In Christ, Steven Watanabe
participants (2)
-
Damien R
-
Steven Watanabe