POV-Ray : Newsgroups : povray.binaries.images : Stupid math error Server Time
1 Nov 2024 09:22:43 EDT (-0400)
  Stupid math error (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: Xplo Eristotle
Subject: Stupid math error
Date: 1 Apr 2002 22:49:51
Message: <3CA92AB5.8DAC1279@unforgettable.com>
Okay, this is driving me nuts. I have a bunch of 4 x .5 x 1 boxes which
are stacked corner to corner in a stair pattern. Given their layout, I
thought/assumed that they make a 30 degree angle with the ground (a
plane), but when I added another box on the side and rotated it up 30
degrees, it didn't line up with the blocks!

I'm stumped. Barring some kind of bug, I can't imagine why I'm having
this problem; the math isn't particularly complicated here. Can anyone
help me with this? Code and example image follow:

#declare stair_row = union
	{
	#declare stair_row_members = 1;
	#declare stair_row_count = 0;
	#while (stair_row_count < stair_row_members)
		box { <0, 0, 0> <4, .5, 1> }
		#declare stair_row_count = stair_row_count + 1;
	#end
	}
	
#declare stair_block = union
	{
	#declare stair_rows = 10;
	#declare stair_row_count = 0;
	#while (stair_row_count < stair_rows)
		object { stair_row translate <0, stair_row_count/2, stair_row_count> }
		#declare stair_row_count = stair_row_count + 1;
	#end
	}
	
#declare stair_rail = union
	{
	box { <0, -in, 0> <in*1, 0, 15> rotate <-30, 0, 0> }
	}

I'm using MacMegaPOV 0.7 (I don't care for the present interface of the
official beta) on Mac OS 8.6, if anyone cares.

-Xplo


Post a reply to this message


Attachments:
Download 'mnah2-a.jpg' (13 KB)

Preview of image 'mnah2-a.jpg'
mnah2-a.jpg


 

From: Slime
Subject: Re: Stupid math error
Date: 1 Apr 2002 23:11:19
Message: <3ca92f67$1@news.povray.org>
The angle between the horizontal and the diagonal of a box with width 1 and
height .5 is

arctan(.5/1) = 26.56505117

The *sine* of 30 is 1/2. Not the tangent. If the *diagonal* had a length of
1, and the box had a height of .5, then the angle would be 30 degrees.

- Slime
[ http://www.slimeland.com/ ]
[ http://www.slimeland.com/images/ ]


Post a reply to this message

From: GrimDude
Subject: Re: Stupid math error
Date: 1 Apr 2002 23:13:01
Message: <3ca92fcd@news.povray.org>
Instead of .5 use the tangent of your desired angle (30) for your y value. Since, your
z value is equal to (1) this will work
(unless I just got a giant case of stupid going).

.5773503

Grim


Post a reply to this message

From: GrimDude
Subject: Re: Stupid math error
Date: 1 Apr 2002 23:25:16
Message: <3ca932ac@news.povray.org>
Oops, you'll have to change your translation of the steps in the y-direction by that
same value times your stair_row_count, in order
for this to work out.

Grim


Post a reply to this message

From: Xplo Eristotle
Subject: Re: Stupid math error
Date: 1 Apr 2002 23:32:22
Message: <3CA934B1.FC270467@unforgettable.com>
Slime wrote:
> 
> The angle between the horizontal and the diagonal of a box with width 1 and
> height .5 is
> 
> arctan(.5/1) = 26.56505117
> 
> The *sine* of 30 is 1/2. Not the tangent. If the *diagonal* had a length of
> 1, and the box had a height of .5, then the angle would be 30 degrees.

Doh!! Stupid trig functions, I always get them mixed up.. could have
sworn it was sine I wanted.

Thanks a lot.

-Xplo


Post a reply to this message

From: Robert Chaffe
Subject: Re: Stupid math error
Date: 1 Apr 2002 23:59:34
Message: <3ca93ab6$1@news.povray.org>
"Xplo Eristotle" <inq### [at] unforgettablecom> wrote in message
news:3CA92AB5.8DAC1279@unforgettable.com...
> Okay, this is driving me nuts. I have a bunch of 4 x .5 x 1 boxes which
> are stacked corner to corner in a stair pattern. Given their layout, I
> thought/assumed that they make a 30 degree angle with the ground (a
> plane), but when I added another box on the side and rotated it up 30
> degrees, it didn't line up with the blocks!
>
> I'm stumped. Barring some kind of bug, I can't imagine why I'm having
> this problem; the math isn't particularly complicated here. Can anyone
> help me with this? Code and example image follow:
>
> #declare stair_row = union
> {
> #declare stair_row_members = 1;
> #declare stair_row_count = 0;
> #while (stair_row_count < stair_row_members)
> box { <0, 0, 0> <4, .5, 1> }
> #declare stair_row_count = stair_row_count + 1;
> #end
> }
>
> #declare stair_block = union
> {
> #declare stair_rows = 10;
> #declare stair_row_count = 0;
> #while (stair_row_count < stair_rows)
> object { stair_row translate <0, stair_row_count/2, stair_row_count> }
> #declare stair_row_count = stair_row_count + 1;
> #end
> }
>
> #declare stair_rail = union
> {
> box { <0, -in, 0> <in*1, 0, 15> rotate <-30, 0, 0> }
> }
>
> I'm using MacMegaPOV 0.7 (I don't care for the present interface of the
> official beta) on Mac OS 8.6, if anyone cares.
>
> -Xplo

Perhaps because the tangent of 30 degrees is about 0.577350269, not 0.5 ?

Robert Chaffe
http://www.donovansweb.com/~chaffe/


Post a reply to this message

From: Robert Chaffe
Subject: Re: Stupid math error
Date: 2 Apr 2002 00:02:28
Message: <3ca93b64@news.povray.org>
D'oh !  Figures someone else would get the answer to you before I did.  Oh, well.

Robert Chaffe
http://www.donovansweb.com/~chaffe/


Post a reply to this message

From: GrimDude
Subject: Re: Stupid math error
Date: 2 Apr 2002 13:00:14
Message: <3ca9f1ae@news.povray.org>
There's a pretty good way to remember this. It worked for me, and has for two decades.

sine = opposite/hypotenuse (oh)
cosine = adjacent/hypotenuse (ah)
tangent = opposite/adjacent (oa)

Grim


Post a reply to this message

From: 25ct
Subject: Re: Stupid math error
Date: 2 Apr 2002 13:19:06
Message: <3ca9f61a@news.povray.org>
"GrimDude" <vos### [at] gulfnet> wrote in message news:3ca9f1ae@news.povray.org...
> There's a pretty good way to remember this. It worked for me, and has for two
decades.
>
> sine = opposite/hypotenuse (oh)
> cosine = adjacent/hypotenuse (ah)
> tangent = opposite/adjacent (oa)

     You mean "SOHCAHTOA"?  I learnt that at school. I used to be good at trig. with a
tables book... (still got it),  wish I kept
it up...

     I used to play the trumpet fairly good too, but time winds on.

       <sniff>

       ~Steve~  ;)



>
> Grim
>
>


Post a reply to this message

From: Timothy R  Cook
Subject: Re: Stupid math error
Date: 2 Apr 2002 15:36:18
Message: <3CAA1645.34E2D335@scifi-fantasy.com>
25ct wrote:
> You mean "SOHCAHTOA"?  I learnt that at school. I used to be good
> at trig. with a tables book... (still got it),  wish I kept it up...

I still find it easier to picture, at least, using vectorised versions.
e.g.
x = r*COS(t)
y = r*SIN(t)
t = TAN-1(x/y)
r = SQRT((x^2)+(y^2))

-- 
Tim Cook
http://empyrean.scifi-fantasy.com

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U 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------


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

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