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

Steve Baker sjbaker1 at airmail.net
Thu Mar 18 08:02:14 MST 2004


Nguyen Binh wrote:
> Hi William,
> 
>    How's about both? :)

Ack!  There you go with the **BAD** idea of having options again.

Options don't help *anyone*.  They will make for a poor file format
and not very robust applications code.

Let me explain this one more time (everyone except Nguyen can feel
free to skip this if you've read my other three rants about this!!)

The file writer can trivially multiply all the angles by some number
to shift them into whatever single standard the file format requires.
That takes almost no time - and consumes at most just one line of code
- and it happens in a place where we don't care so much about either
time or lines of code.

However, if you make it optional then now you complicate the file
reader because it has to parse out a 'degrees or radians' flag in
the file - then it has to conditionally do the conversion.  All of
this takes MUCH more time and MANY more lines of code than doing it
in the writer - *AND* as I've pointed out before, there are more
versions of the reader likely to be created - and more chance that
reading files will be more time critical than writing them.

You also run into the situation where somebody creates a reader
to read the files that come from a particular physics modelling
package that (say) always uses radians.   The author of the reader
doesn't notice the thing in the XODE manual that says they could
possibly be in radians - and thinks that his program is working.
Then someone uses a different physics modeller to feed it data
and suddenly it sees angles in radians for the first time and
does something horribly wrong.

Even if the author of the reader implements the degrees-or-radians
switch, he may have no way to test it - having never seens a file
with radians in it.

For this single, narrow issue of degrees versus radians, you may
think I'm going over the top - but multiply that by the number
of other options you might come up with - and you'll have a
file format that is flakey as hell in typical usage.

This is NOT the way to build a solid, portable, and reasonably
efficient file format.

We must choose one of the other and stick by it consistently
no matter what.  IMHO, we should use degrees because human-readability
is a strong reason for using XML and most humans prefer degrees to
radians - but I don't have a strong opinion about that.

This argument applies to ALL optional features...there shouldn't
be any representational choices in the file format what so ever!!

---------------------------- Steve Baker -------------------------
HomeEmail: <sjbaker1 at airmail.net>    WorkEmail: <sjbaker at link.com>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net    http://tuxaqfh.sf.net
            http://tuxkart.sf.net http://prettypoly.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----




More information about the ODE mailing list