Difference between revisions of "Trigonometry Functions"
Jump to navigation
Jump to search
no edit summary
imported>DragoonWraith |
imported>DragoonWraith |
||
Line 1: | Line 1: | ||
This is a repository of functions used in trigonometry - namely Sine, Cosine, Tangent, Arcsine, Arccosine, and Arctangent. | This is a repository of functions used in trigonometry - namely Sine, Cosine, Tangent, Arcsine, Arccosine, and Arctangent. | ||
There are | There are many methods of obtaining any or all of these, and each has its own benefits and drawbacks in terms of length, efficiency, and speed. This page is a work in progress - please add any scripts you have for approximating these functions. Please remember to comment them thoroughly and to use generic variable names. | ||
= Sine, Cosine, and Tangent = | |||
ScriptName SineCosineTangent | ScriptName SineCosineTangent | ||
Line 56: | Line 59: | ||
This script is more accurate than it needs to be. Galerion suggests that only the first seven steps are necessary. | This script is more accurate than it needs to be. Galerion suggests that only the first seven steps are necessary. | ||
= Arcsine, Arccosine, and Arctangent = | |||
According to [http://www.wikipedia.org Wikipedia], arcsine can be found with this series: | |||
[[Image:Arcsine.png]] | |||
This can be approximated by Oblivion using the following script: | |||
scriptname Arcsine | |||
;script originally supplied by DragoonWraith | |||
float z | |||
float z3 | |||
float z5 | |||
float z7 | |||
float arcsinz | |||
Begin {appropriate blocktype} | |||
;z can be set depending on implementation | |||
;here it is set to the number of places discovered by the player | |||
;(a completely bizarre thing to find the arcsine of) | |||
set z to GetPCMiscStat 7 | |||
set z3 to ( z * z * z ) | |||
set z5 to ( z3 * z * z ) | |||
set z7 to ( z5 * z * z ) | |||
set arcsinz to ( z + (1/2)*(z3/3) + (3/8)*(z5/5) + (15/48)*(z7/7) ) | |||
End | |||
More terms will increase accuracy. Remember than sin=opp/hyp - the only way you are actually going to need this is if you know the opposite side of the triangle and the hypotenuse. | |||
== See Also == | |||
[http://www.elderscrolls.com/forums/index.php?showtopic=374963 Elder Scrolls Forums - Trigonometry Function Workarounds?] | |||
[[Category: Extra_Math_Functions]] | [[Category: Extra_Math_Functions]] | ||
[[Category: Useful_Code]] | [[Category: Useful_Code]] |