[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] API draft for vector type



On, Tue Apr 28, 2009, Jake b wrote:

> On Tue, Apr 28, 2009 at 2:48 PM, Marcus von Appen <mva@xxxxxxxxxxxx> wrote:
> 
> > On, Tue Apr 28, 2009, Lorenz Quack wrote:
> > > > Casey Duncan <casey@xxxxxxxxxxx>:>
> > > > Degrees, I'd say. The api should be easy to use and letting users
> > > > calculate the rad values before is not that intuitive.
> > >
> > > I just checked: unfortunately pygame seems to be inconsistent:
> > transform.rotate
> > > use degrees and draw.arc uses radians.
> >
> > Which is a problem to get solved. Thus we should stick to degrees.
> 
> 
> I thought the standard was to use radians since trig. functions use radians.
> ( And opengl? )

OpenGL uses degrees - which brings me (personally) to use degrees,
too. Additionally it's easier to read and debug, if you work with
degrees, in my opinion, bceause you do not have to fire up your
calculator and convert the angular values the whole time.

What do you find easier to understand for angles? 1.5707963267948966 or
~90.0? ;-)
 
> I'm Curious: if pygame uses degrees, does it end up being faster than if
> pygame used radians, and the user has to manually convert to degrees? Or is
> the difference insignificant?

It is mostly insignificant, though the user would save one call to a
python function (and python's math module). Converting degrees to
radians is described as

    rad = degrees * pi / 180.0

So it's a single multiplication and division. You can narrow that down
to a single multiplication, which python does and we can do as well. The
only difference thus would be the user's math.radians() call overhead.

Regards
Marcus

Attachment: pgpIGiKWq7Mhb.pgp
Description: PGP signature