POV-Ray : Newsgroups : povray.general : Mathematics question : Re: Mathematics question Server Time
19 Nov 2024 18:06:49 EST (-0500)
  Re: Mathematics question  
From: Tor Olav Kristensen
Date: 24 Jan 2002 02:05:48
Message: <3C4FB1CA.EE743332@hotmail.com>
Dan Byers wrote:
> 
> It's been about 20 years since I had geometry, so I'm way rusty.  Anyway,
> this should be an easy one for our mathematically-gifted viewers out
> there...
> 
> As you can see by the lovely model, I have a triangle with a single right
> angle (iscoseles(sp) triangle? I'm guessing at this point...).  The base of
> the triangle is 5 units wide, and the height is 4 units.  Given we know the
> base/height angle is 90 degress and the length of the base and width, I'd
> like to know:
> 
> 1)  The length of the hypotenuse (I think that's what it's called).
> 2)  The degree measurement of the other two angles.
> 
> I _know_ there's a formula for determining that, but I can't remember for
> the life of me.  If I could get that formula, that would make my life a lot
> easier (I need it for a macro I'm writing).
> 
> Any help would be greatly appreciated... thanks in advance :)  If this is
> being posted to the wrong forum, please accept my sincere apologies...

Here are some relevant equations:

Hypotenuse^2 = Base^2 + Height^2

cos(Angle1) = Base/Hypotenuse
sin(Angle1) = Height/Hypotenuse
tan(Angle1) = Height/Base

cos(Angle2) = Height/Hypotenuse
sin(Angle2) = Base/Hypotenuse
tan(Angle2) = Base/Height

Angle1 + Angle2 + Angle3 = pi


And below are some ways to solve your problem with POV-script.


Tor Olav


#declare Base = 5;
#declare Height = 4;

#declare Hypotenuse = vlength(<Base, Height>); // = 6.403124...
//#declare Hypotenuse = sqrt(Base^2 + Height^2); // = 6.403124...
//Maybe you'll have to write it like this in POV-Ray v3.1:
//#declare Hypotenuse = sqrt(pow(Base, 2) + pow(Height, 2));

#declare Angle1 = atan2(Height, Base); // = 0.674741... radians
//#declare Angle1 = atan(Height/Base); // = 0.674741... radians
//#declare Angle1 = acos(Base/Hypotenuse); // = 0.674741... radians
//#declare Angle1 = asin(Height/Hypotenuse); // = 0.674741... radians

#declare Angle2 = pi/2 - Angle1; // = 0.896055... radians
//#declare Angle2 = atan2(Base, Height); // = 0.896055... radians
//#declare Angle2 = atan(Base/Height); // = 0.896055... radians
//#declare Angle2 = acos(Height/Hypotenuse); // = 0.896055... radians 
//#declare Angle2 = asin(Base/Hypotenuse); // = 0.896055... radians 

#debug "\n"
#debug str(Hypotenuse, 0, -1)
#debug "\n\n"

#debug str(Angle1, 0, -1)
#debug "\n"
#debug str(degrees(Angle1), 0, -1)
#debug "\n\n"

#debug str(Angle2, 0, -1)
#debug "\n"
#debug str(degrees(Angle2), 0, -1)
#debug "\n\n"


Post a reply to this message

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