Difference between revisions of "Trigonometry Functions"

284 bytes added ,  21:19, 25 April 2010
no edit summary
imported>DragoonWraith
(commenting comments again, directing to quest variables, and making things fit on the page)
imported>DragoonWraith
 
(9 intermediate revisions by 4 users not shown)
Line 39: Line 39:
== Galsiah Version ==
== Galsiah Version ==


Galsiah says that this version of sine/cosine approximation is faster and more accurate than the Taylor series.
Galsiah says that this version of sine/cosine approximation is faster and more accurate than the Taylor series. (For source, see [http://www.convertit.com/Go/EducationPlanet/Reference/AMS55.ASP?Res=150&Page=76 Handbook of Mathematical Functions].)


This [[:Category:Stage Functions|function]] requires the following variables to be declared in your [[Global Script]]:
This [[:Category:Stage Functions|function]] requires the following variables to be declared in your [[Global Script]]:
Line 68: Line 68:


set Wiki.t2 to (Wiki.ang * Wiki.ang)
set Wiki.t2 to (Wiki.ang * Wiki.ang)
set Wiki.sin to (Wiki.ang*(1 - (Wiki.t2*(0.16605 - (0.00761*Wiki.t2)))))
set Wiki.sin to Wiki.n*(Wiki.ang*(1 - Wiki.t2*0.16605 + 0.00761*Wiki.t2*Wiki.t2))
set Wiki.sin to (Wiki.sin*Wiki.n)
set Wiki.cos to Wiki.n*(1 - Wiki.t2*0.4967 + 0.03705*Wiki.t2*Wiki.t2)
 
set Wiki.tan to (Wiki.sin/Wiki.cos)</pre>
set Wiki.cos to (1 - (Wiki.t2*(0.4967 - (0.3705*Wiki.t2))))
set Wiki.cos to (Wiki.cos*Wiki.n)


set Wiki.tan to (Wiki.sin/Wiki.cos)</pre>
For working example (with somewhat simpler code), see [[Summon Object]].


== Taylor Series Variant 1 ==
== Taylor Series Variant 1 ==
Line 233: Line 231:
  float z5 ;(used internally)
  float z5 ;(used internally)
  float z7 ;(used internally)
  float z7 ;(used internally)
  float arcsinz ;(the arctangent, that is, the measure of the angle)
  float arctanz ;(the arctangent, that is, the measure of the angle)
These can be renamed, but must also be changed in the code.
These can be renamed, but must also be changed in the code.
  ;modified from arcsine script supplied by DragoonWraith
  ;modified from arcsine script supplied by DragoonWraith
Line 249: Line 247:


[http://www.elderscrolls.com/forums/index.php?showtopic=410923 Elder Scrolls Forums - Is there an actor for the target you are attacking currently?]
[http://www.elderscrolls.com/forums/index.php?showtopic=410923 Elder Scrolls Forums - Is there an actor for the target you are attacking currently?]
[[Ingame Functions|Ingame Functions (example uses simple (3-line) sin/cos script functions: example for player x-hair)]]


[[Category: Stage Functions]]
[[Category: Stage Functions]]
[[Category: Extra_Math_Functions]]
[[Category: Math Functions (CS 1.0)]]