Difference between revisions of "Trigonometry Functions"

Jump to navigation Jump to search
1,080 bytes added ,  16:44, 6 May 2006
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 a number of methods for obtaining these, some more accurate and others faster. Here is one for Sine, Cosine, and Tangent.
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.


'''Note''': this is a work in progress. As stated, there are a number of methods for these. Please add any if you have them. Please make them well-commented and use generically named variables.
= 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]]

Navigation menu