 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Xplo Eristotle" <inq### [at] unforgettable com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"GrimDude" <vos### [at] gulf net> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Timothy R. Cook" <tim### [at] scifi-fantasy com> wrote in message
news: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, sorry, I'm now lost with this... I recognise it though. I think our teacher
showed us the same?
I could do with someone taking me through the basics again... Are you game? I'd
appreciate it.
If it's ok, mail me or take me through it here, either way, no probs. I used to
enjoy doing trig. when I was younger.
~Steve~
>
> --
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
25ct wrote:
> "Timothy R. Cook" <tim### [at] scifi-fantasy com> wrote:
> > 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, sorry, I'm now lost with this... I recognise it though. I think
> our teacher showed us the same?
> I could do with someone taking me through the basics again... Are
> you game? I'd appreciate it.
No problemmo. I actually found vectors to be enjoyable. Probably
the only part of math in high school I ever did like. (Actually, I
originally was taught vectors in Physics, but...)
(Side note: I use the right-hand rule, so Y is north, X is east)
+Y
| . endpoint (distance r from origin)
| /
| /., angle (theta)
|/ `,
+-------- +X
If you think about the vector in terms of x & y, you realise that
it's the hypoteneuse of a right triangle whose base and perpendicular
side are the axes. So. You get a right triangle:
.
/|
/ |
r / | y
/ |
/ _|
/? | |
o------+
x
Something about r: it's a radius of a circle with centre at o.
(Which is why I use 'r'. The only reason I point this our is
'cuz when you rotate an object around a point, the other end
is going in a circle, and the angle is how far it's turned.)
Anyways. If you know the angle and radius (as with velocity
vectors), the length of x is equal to the radius times the
cosine of the angle. The length of y is equal to the radius
times the sine of the angle. If you know x and y and want
to find the radius, use the Pythagorean theorem: a^2 + b^2 = c^2
(or, radius equals square root of x squared plus y squared).
The angle is the arctangent of x divided by y.
Vector addition simply strings together several vectors and
figures out the vector between start/end points.
This is helpful for making a CSG of a box of arbitrary size.
If I have a box at 0,0,0 and it has a scale of 1,2,0.5 and
I want to cut it in half diagonally along the xz surface,
how big do I need to make the differencing box, and how much
does it need to be rotated? I know X and Y. So. It needs
to be SQRT((1^2)+(0.5^2)) along its x axis, or 1.11803399.
It needs to be rotated TAN-1(1/0.5), or 63.4349488 degrees.
--
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I was taught a simple rhyme a very long time ago and it stuck.
Silly Old Harry (S=O/H)
Caught A Herring (C=A/H)
Trawling Off America (T=O/H)
Daft, but it works for me.
Dave
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Timothy R. Cook" <tim### [at] scifi-fantasy com> wrote in message
news:3CAA384B.F4BF1CB8@scifi-fantasy.com...
<cut and pasted into notepad>
Thanks 'very' much Tim, I'm working through this.
BR,
~Steve~
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Except that Trawling off American would be (T-O/A)
:)
Grim
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi Dave Brickell, you recently wrote in povray.binaries.images:
> I was taught a simple rhyme a very long time ago and it stuck.
The rhyme I was taught only listed the ratios since we could rememeber
the order sin, cos, tan. It went like this:
Old Henry
And His
Old Aunt
I still use it everytime I need to figure an angle out :-)
- Lutz
email : lut### [at] stmuc com
Web : http://www.stmuc.com/moray
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Yeah I spotted my error as soon as I posted it yet I did not spot it when I
read it through twice before posting it. I am sure this is some kind of
phenomenon as it has happed to me before.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 3 Apr 2002 00:22:47 -0800, Dave Brickell wrote...
> I was taught a simple rhyme a very long time ago and it stuck.
>
> Silly Old Harry (S=O/H)
> Caught A Herring (C=A/H)
> Trawling Off America (T=O/H)
>
> Daft, but it works for me.
The Cat Sat
On An Oven
And Howled Horribly
TCS Tan = Opposite/Adjacent
OAO = Cos = Adjacent/Hypotenuse
AHH Sin = Opposite/Hypotenuse
Is how I remember it.
Jamie.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |