Difference between revisions of "ESM Math Library"
Jump to navigation
Jump to search
added stage 17 (SinCosTan 3)
imported>JustTim (YALU - Yet Another Layout Update) |
imported>JustTim (added stage 17 (SinCosTan 3)) |
||
Line 53: | Line 53: | ||
float t5 | float t5 | ||
float t6 | float t6 | ||
;S17 FUNCTION SinCosTan 3 | |||
;float ang | |||
;float sin | |||
;float cos | |||
;float t2 | |||
;S20 FUNCTION Arcsine 1 | ;S20 FUNCTION Arcsine 1 | ||
Line 240: | Line 246: | ||
set myResultCos to f.fout2 | set myResultCos to f.fout2 | ||
set myResultTan to f.fout3</pre> | set myResultTan to f.fout3</pre> | ||
=== Stage 17: Sin Cos Tan 3 === | |||
Based on a posting by Galsiah in [http://www.elderscrolls.com/forums/index.php?showtopic=428015 THIS THREAD] | |||
Code to include in FunctionQuestScript: | |||
<pre>;S17 FUNCTION SinCosTan 3 | |||
float ang | |||
float sin | |||
float cos | |||
float t2</pre> | |||
Code for the Stage Result Script: | |||
<pre>;FUNCTION float,float,float SinCosTan(float Angle) | |||
;script by Galsiah | |||
set f.ang to f.fin1 | |||
if f.ang < 0 | |||
set f.ang to (f.ang + 360) | |||
elseif f.ang >= 360 | |||
set f.ang to (f.ang - 360) | |||
endif | |||
set f.ang to (f.ang/f.rad) | |||
set f.n to 1 | |||
if (f.ang > 4.7123) | |||
Set f.ang to (f.ang - 6.2832) | |||
elseif ( f.ang > 1.5708 ) | |||
Set f.ang to (f.ang - 3.1416) | |||
Set f.n to -1 | |||
endif | |||
set f.t2 to (f.ang * f.ang) | |||
set f.sin to (f.ang*(1 - (f.t2*(0.16605 - (0.00761*f.t2))))) | |||
set f.sin to (f.sin*f.n) | |||
set f.cos to (1 - (f.t2*(0.4967 - (0.3705*f.t2)))) | |||
set f.cos to (f.cos*f.n) | |||
set f.fout to f.sin | |||
set f.fout2 to f.cos | |||
set f.fout3 to f.sin/f.cos ;tan</pre> | |||
Usage in another script: | |||
<pre>;CALL float,float,float SinCosTan(float Angle) | |||
set f.fin1 to myVarForAngle | |||
setStage f 17 | |||
set myResultSin to f.fout | |||
set myResultCos to f.fout2 | |||
set myResultTan to f.fout3</pre> | |||
=== Stage 20: Arcsine === | === Stage 20: Arcsine === |