POV-Ray : Newsgroups : povray.general : Buggy trig? Server Time
9 Aug 2024 23:21:59 EDT (-0400)
  Buggy trig? (Message 4 to 13 of 23)  
<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Xplo Eristotle
Subject: Re: Buggy trig?
Date: 4 Jun 2000 05:16:30
Message: <393A1E81.CFDE63AD@unforgettable.com>
Chris Colefax wrote:
> 
> Or, it seems the sin function is returning the correct values, based on the
> fact that it accepts the input angle in radians rather than degrees.  Try
> changing your statement to:
> 
>    rotate <0,-20*sin(clock*2*pi),0>
> 
> and things should work as you expect.

Radians? Gah! >_<

That explains a lot. Thanks.

-- 
Xplo Eristotle
http://start.at/xplosion/

"And then one day you find ten years have got behind you
No one told you when to run, you missed the starting gun"
    -Pink Floyd


Post a reply to this message

From: Peter J  Holzer
Subject: Re: Buggy trig?
Date: 4 Jun 2000 12:00:49
Message: <slrn8jkt7v.d52.hjp-usenet@teal.h.hjp.at>
On Sun, 04 Jun 2000 02:43:37 +0100, Thorsten Froehlich wrote:
>The trigonometric functions use radians which is clearly stated in the
>documentation. 

A short history question: Was there a reason for using degrees with
rotate and radians with the trigonometric functions, or did just happen
that way?

	hp

-- 
   _  | Peter J. Holzer    | Nicht an Tueren mangelt es,
|_|_) | Sysadmin WSR       | sondern an der Einrichtung (aka Content).
| |   | hjp### [at] wsracat      |    -- Ale### [at] univieacat
__/   | http://www.hjp.at/ |       zum Thema Portale in at.linux


Post a reply to this message

From: Simen Kvaal
Subject: Re: Buggy trig?
Date: 4 Jun 2000 14:45:19
Message: <393aa3bf@news.povray.org>
>A short history question: Was there a reason for using degrees with
>rotate and radians with the trigonometric functions, or did just happen
>that way?


I'd say it's quite natural that the _functions_ take radians as parameters,
because in mathematics, you rarely use degrees to express angles and/or to
perform trigonometric oerations, to put it that way.

As for the rotations, the degrees is for many a more natural and intuitive
approach to orientation in space. You don't say "turn around pi", but "turn
around 180 degrees." Maybe it would be natural to have alternate
rotate-definitions, accepting radians?

If we started to use degrees instead of radians in the trigonometric
functions, people would be confused, as AFAIK every programming language use
radians. Also, it would be cumbersome to have triginometric functions that
behave differently than the usual. For example, the limit:

limit  sin (x) / x
x->0

is different for the two functions. Functions as arcsin, arctan and so forth
gets trickier to use.

Regards,
Simen Kvaal.


Post a reply to this message

From: Xplo Eristotle
Subject: Re: Buggy trig?
Date: 4 Jun 2000 15:43:16
Message: <393AB164.8B62BCF9@unforgettable.com>
Simen Kvaal wrote:
> 
> >A short history question: Was there a reason for using degrees with
> >rotate and radians with the trigonometric functions, or did just happen
> >that way?
> 
> I'd say it's quite natural that the _functions_ take radians as parameters,
> because in mathematics, you rarely use degrees to express angles and/or to
> perform trigonometric oerations, to put it that way.
> 
> As for the rotations, the degrees is for many a more natural and intuitive
> approach to orientation in space. You don't say "turn around pi", but "turn
> around 180 degrees." Maybe it would be natural to have alternate
> rotate-definitions, accepting radians?

It would be more natural, IMO, to have trig that accepts degrees. When I
was taking trig, we did plenty of work with degrees.. and in fact, since
we specify angles in degrees pretty much everywhere BUT in a classroom -
even my scientific calculator uses degrees by default - I don't see the
point of using radians, which almost no one is familiar with.

I don't WANT to rotate an object by 1/6th pi. I don't *NEED* to rotate
an object by 1/6th pi. But it would be nice to ask for sin(30) and get
.5 back.

(In the spirit of offering a solution, how about a "trig_units" keyword
in the global_settings, where a user could specify "degrees" or "radians"?)

-- 
Xplo Eristotle
http://start.at/xplosion/

"And then one day you find ten years have got behind you
No one told you when to run, you missed the starting gun"
    -Pink Floyd


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Buggy trig?
Date: 4 Jun 2000 18:38:35
Message: <393ada6b@news.povray.org>
In article <slr### [at] tealhhjpat> , 
hjp### [at] SiKituwsracat (Peter J. Holzer) wrote:
> On Sun, 04 Jun 2000 02:43:37 +0100, Thorsten Froehlich wrote:
>>The trigonometric functions use radians which is clearly stated in the
>>documentation.
>
> A short history question: Was there a reason for using degrees with
> rotate and radians with the trigonometric functions, or did just happen
> that way?

In article <393aa3bf@news.povray.org> , "Simen Kvaal"
<sim### [at] studentmatnatuiono> wrote:
> I'd say it's quite natural that the _functions_ take radians as parameters,
> because in mathematics, you rarely use degrees to express angles and/or to
> perform trigonometric oerations, to put it that way.
>
> As for the rotations, the degrees is for many a more natural and intuitive
> approach to orientation in space.

I think this is a good explanation and reasoning.


      Thorsten


Post a reply to this message

From: Rune
Subject: Re: Buggy trig?
Date: 4 Jun 2000 18:43:23
Message: <393adb8b@news.povray.org>
"Xplo Eristotle" wrote:
> It would be more natural, IMO, to have trig that accepts degrees.

I don't see the reason to change how it works or to make new keywords for
it. You can anywhere and anytime use degrees(X) to convert X from radians to
degrees and radians(X) to convert degrees to radians. It's very simple.

> I don't WANT to rotate an object by 1/6th pi. I don't *NEED* to
> rotate an object by 1/6th pi. But it would be nice to ask for
> sin(30) and get .5 back.

Ask for sin(radians(30)) and you get back .5

> (In the spirit of offering a solution, how about a "trig_units"
> keyword in the global_settings, where a user could specify
> "degrees" or "radians"?)

I think it will cause only more trouble. If your scene uses degrees and you
want to use an include file that uses radians you would have to change the
global_settings several times.

And when we in these groups want to help others with trig related problems
we would always have to ask things like, "Did you remember to set trig_units
to 'degrees'?".

I think it is fine as it is.

Greetings,

Rune

---
Updated April 25: http://rsj.mobilixnet.dk
Containing 3D images, stereograms, tutorials,
The POV Desktop Theme, 350+ raytracing jokes,
miscellaneous other things, and a lot of fun!


Post a reply to this message

From: John VanSickle
Subject: Re: Buggy trig?
Date: 4 Jun 2000 19:06:08
Message: <393AE07D.DE80EE@erols.com>
Xplo Eristotle wrote:
> 
> I don't WANT to rotate an object by 1/6th pi. I don't *NEED* to rotate
> an object by 1/6th pi.

Me neither.  I always do it this way:

  matrix <1,0,0, 0,sqrt(.75),.5, 0,-.5,sqrt(.75), 0,0,0>

-- 
ICQ: 46085459


Post a reply to this message

From: Peter J  Holzer
Subject: Re: Buggy trig?
Date: 4 Jun 2000 22:04:08
Message: <slrn8jlo50.h9n.hjp-usenet@teal.h.hjp.at>
On Sun, 04 Jun 2000 12:46:20 -0700, Xplo Eristotle wrote:
>Simen Kvaal wrote:
>> 
>> >A short history question: Was there a reason for using degrees with
>> >rotate and radians with the trigonometric functions, or did just
>> >happen that way?
>>
>> I'd say it's quite natural that the _functions_ take radians as
>> parameters, because in mathematics, you rarely use degrees to express
>> angles and/or to perform trigonometric oerations, to put it that way.

Actually, in school, we used degrees almost exclusively. Radians are
a lot more logical way to express an angle (there is a good reason that
a full circle has 2 pi radians, but there isn't any good reason it has
360 degrees) and it makes a lot of formulas simpler, but in geometry
people don't think in radians, but in degrees.

>> As for the rotations, the degrees is for many a more natural and
>> intuitive approach to orientation in space. You don't say "turn
>> around pi", but "turn around 180 degrees." Maybe it would be natural
>> to have alternate rotate-definitions, accepting radians?
>
>It would be more natural, IMO, to have trig that accepts degrees. When
>I was taking trig, we did plenty of work with degrees.. and in fact,
>since we specify angles in degrees pretty much everywhere BUT in a
>classroom - even my scientific calculator uses degrees by default - I
>don't see the point of using radians, which almost no one is familiar
>with.
>
>I don't WANT to rotate an object by 1/6th pi. I don't *NEED* to rotate
>an object by 1/6th pi. But it would be nice to ask for sin(30) and get
>.5 back.

I agree. Well, actually, I don't care much whether angles are specified
in degrees, radians, hours, or whatever, but I would like to have the
same unit everywhere.


>(In the spirit of offering a solution, how about a "trig_units" keyword
>in the global_settings, where a user could specify "degrees" or
>"radians"?)

Not good. That would break existing include files. A pragma which
affects only the source file it is in, but not any included files might
be safer, but I'm not too sure about that. The only way I can see which
wouldn't break compatibility would be a second set of functions (e.g.,
dsin, dcos, ...) which uses degrees instead of radians. 

Oh well, might as well leave it as it is, it's a minor nuisance. 

	hp


-- 
   _  | Peter J. Holzer    | Nicht an Tueren mangelt es,
|_|_) | Sysadmin WSR       | sondern an der Einrichtung (aka Content).
| |   | hjp### [at] wsracat      |    -- Ale### [at] univieacat
__/   | http://www.hjp.at/ |       zum Thema Portale in at.linux


Post a reply to this message

From: Simen Kvaal
Subject: Re: Buggy trig?
Date: 5 Jun 2000 02:28:42
Message: <393b489a$1@news.povray.org>
>
>Actually, in school, we used degrees almost exclusively.

=:O You had a BAD teacher!!

>Radians are
>a lot more logical way to express an angle (there is a good reason that
>a full circle has 2 pi radians, but there isn't any good reason it has
>360 degrees) and it makes a lot of formulas simpler, but in geometry
>people don't think in radians, but in degrees.
>

Hm. Yes and no. When using sin() functions, for example in physics
(modelling mechanical waves is an example), I really don't bother with the
degrees option. But I also say "the sum of the angles in a triangle is 180";
not pi...

Simen.


Post a reply to this message

From: Warp
Subject: Re: Buggy trig?
Date: 5 Jun 2000 05:53:14
Message: <393b7889@news.povray.org>
Xplo Eristotle <inq### [at] unforgettablecom> wrote:
: It would be more natural, IMO, to have trig that accepts degrees.

  I would not mind if the rotate command would be changed to take radians
instead of degress. I would seriously mind if the trigonometric functions
would be changed to take degrees instead of radians.
  Mathematical functions are exactly that: Mathematical functions. There is
a very good reason to use radians for the trigonometric functions in
mathematics. For example the integral of 1/(1+x^2) is atan(x). You can
easily imagine why it would not not work with degrees.
  Changing the rotate command to take radians would make povray consistent.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

<<< Previous 3 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.