[ODE] XODE - should angles be in degrees or radians?

Chris Ledwith cledwith at d-a-s.com
Fri Mar 19 18:03:57 MST 2004


> On Fri, 19 Mar 2004, Adam D. Moss wrote:
>
>> The common angles of 90 degrees, 180 degrees, 120 degrees etc look
>> like hell in a text form as radians, and are also doomed to lose
>> accuracy as they're dumped/undumped from a textual decimal
>> representation.
>>
>> Just food for thought...
>
> Even though "90" would look precise in the XML, it would still need to be
> converted to the binary representation of 1.570796blahblahblah, which
> isn't quite equal to pi/2.  I don't think there's any escaping some
> degree of inaccuracy (pardon the pun).
>

Although degrees are defined in terms of an irrational number (1 degree =
1/180th of PI), they are at least easier to read and adjust in a
human-readable format such as XML. When they are brought in and converted
to radians in code, use ODE's definition of PI:

#define M_PI REAL(3.1415926535897932384626433832795029)

This definition is not an irrational number. It's the approximation of PI
that ODE uses. By using this #define, it is quite clear what is meant by
PI as far as ODE is concerned.

So of course degree-to-radian conversion would be

#define ODE_DEG_2_RAD REAL(M_PI/180.0)

-Chris (who can't believe how long this thread is! :)


> My guess is (read: feel free to correct me) that a radians can be
> expressed in base-10 in XML with the same precision as radians expressed
> in base-2 in memory.  I further speculate that the conversion between them
> won't cost any accuracy, it will just trade one inaccuracy for another.
>
> Comment?
>
>
> Nate Waddoups
> Redmond WA USA
> http://www.natew.com/
> http://www.featherforum.com/
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>



More information about the ODE mailing list