On 01/12/2026 20:29, bartc wrote:
> On 01/12/2026 18:22, Bonita Montero wrote:
>> Am 01.12.2026 um 18:48 schrieb bartc:
>>
>>> I had the option to use either ° or 'deg':
>>>
>>> 15 deg
>>
>> How about that ?
>>
>> #include <iostream>
>> #include <complex>
>> #include <cmath>
>>
>> using namespace std;
>>
>> struct degree {};
>>
>> complex<double> operator *( double angle, degree )
>> {
>> return complex<double>( sin( angle ), cos( angle ) );
>> }
>>
>> int main()
>> {
>> constexpr double Pi4 = 3.1415926535897932384626433832795 / 4.0;
>> complex<double> dPi4 = Pi4 * degree();
>> cout << abs( dPi4 ) << endl;
>> }
>>
>
> I don't what you're trying to do here or what the purpose of 'complex' is.
>
Bonita is representing a 2D position as a complex number - thus a rotation about the origin by an angle x is the same as multiplying by the complex number e ^ i.x, or cos(x) + i.sin(x). It's a common and useful representation, but it does not fit with either the original 3D vectors, or your "rotatematrix" function.
> Convert radians to degrees? Then this is an easier way to do it:
>
> #define todegrees 57.2968
>
> printf("%f\n", 3.14159 * todegrees); # display ~ 180
>
> But my example went the other way: converting numeric literals representing degrees, into radians. So it would be done like this:
>
> #define deg 0.01745329...
>
> printf("%f\n", 180 * deg); # display pi
>
>