Talk:Trigonometry Functions
Creating a Trig Category
I'd love someone forever if they switched this article to a category and made a separate article for each of these. Not too much work, but I'm conversioned out right now...--DragoonWraith 21:58, 9 May 2006 (EDT)
Removed Sections
I see no reason for three versions of the Taylor series, and this one is, to me, the most difficult to read. If it has merit, re-add it to the main article, though it must be formatted for being a Stage Function.--DragoonWraith 20:35, 9 May 2006 (EDT)
Taylor Series Variant 3
The idea here is to approximate sin(z) and cos(z) with taylor. Since taylor works best with values close to 0, I think it's a good idea to use sin and cos periodicity as many times as possible. then I used taylor to approximate the functions. (Scripts by bifmadeinsabbioni)
ScriptName Sin(Z) set Angolo to AngleZ ; Angolo is the angle of which we want to calculate the sin set Sign to 1 ; it's the sign adjustment of the result if (Angolo < 0) ; sin(-z) = -sin(z) set Angolo to Angolo * (-1) set Sign to Sign * (-1) endif if (Angolo > 180)&& (Angolo <=360) ; if 180<=z<=360 sin(z) = -sin(z-180) set Sign to Sign * (-1) set Angolo to (Angolo - 180) endif if (Angolo > 90)&&(Angolo <=180) ; if 90<=z<=180 sin (z) = sin (180-z) set Angolo to (180 - angolo) endif if (Angolo >45)&&(Angolo <=90) ; if 45<z<90 sin(z) = cos(90-z) set Angle to (90 - Angolo) set Angle to (3.14159265 * Angle / 180) ;now in radiants set X2 to Angle * Angle set X4 to X2 * X2 set X6 to X4 * X2 set X8 to X4 * X4 set SinZ to (1 - X2 / 2 + X4 / 24 - X6 / 720 + X8 / 40320) set SinZ to SinZ*Sign endif if (Angolo>=0)&&(Angolo<=45) set Angle to Angolo set Angle to (3.14159265 * Angle / 180) ;now in radiants set X to Angle set X3 to X*X*X set X5 to X3*X*X set X7 to X3*X3*X set X9 to X3*X3*X3 set SinZ to (X - X3 / 6 + X5 / 120 - X7 / 5040 + X9 / 362880) set SinZ to SinZ*Sign endif
ScriptName Cos(Z) set Angolo to AngleZ ; Angolo is the angle of which we want to calculate the cos set Sign to 1 ; it's the sign adjustment of the result if (Angolo < 0) ; cos(-z) = cos(z) set Angolo to Angolo * (-1) endif if (Angolo > 180)&& (Angolo <=360) ; if 180<=z<=360 cos(z) = -cos(z-180) set Sign to Sign * (-1) set Angolo to (Angolo - 180) endif if (Angolo > 90)&&(Angolo <=180) ; if 90<=z<=180 cos (z) = -cos(180-z) set Angolo to (180 - Angolo) set Sign to Sign * (-1) endif if (Angolo >45)&&(Angolo <=90) if 45<z<90 cos(z) = sin(90-z) set Angle to (90 - Angolo) set Angle to (3.14159265 * Angle / 180) ;now in radiants set X to Angle set X3 to X*X*X set X5 to X3*X*X set X7 to X3*X3*X set X9 to X3*X3*X3 set CosZ to (X - X3 / 6 + X5 / 120 - X7 / 5040 + X9 / 362880) set CosZ to CosZ * Sign endif if (Angolo>=0)&&(Angolo<=45) set Angle to Angolo set Angle to (3.14159265 * Angle / 180) ;now in radiants set X2 to Angle * Angle set X4 to X2 * X2 set X6 to X4 * X2 set X8 to X4 * X4 set CosZ to (1 - X2 / 2 + X4 / 24 - X6 / 720 + X8 / 40320) set CosZ to CosZ * Sign endif
Arcsine, Arccosine, and Arctangent
Sin=Opp/Hyp - The arcsine is the angle between two points, when the distance is the hypotenuse of the triangle and the opposing side is either the x- or the y-difference (whatever is shorter). To get the z-angle (left/right) between two objects in Oblivion you can use the function GetHeadingAngle. But when you need the x-angle (up/down) you still have to calculate the arcsin.