- This wiki is out of date, use the continuation of this wiki instead
Tan
From FenixWiki
(Difference between revisions)
Revision as of 15:02, 1 March 2008 (edit) Sandman (Talk | contribs) ← Previous diff |
Current revision (16:06, 1 March 2008) (edit) (undo) Sandman (Talk | contribs) m (→Definition) |
||
(One intermediate revision not shown.) | |||
Line 7: | Line 7: | ||
Returns the tangent of a certain [[angle]]. | Returns the tangent of a certain [[angle]]. | ||
- | This [[function]] performs a tangent calculation on a certain angle and returns a value | + | This [[function]] performs a tangent calculation on a certain angle and returns a value. |
== Parameters == | == Parameters == | ||
Line 38: | Line 38: | ||
// Modes | // Modes | ||
- | set_title(" | + | set_title("Tangent Graph"); |
set_mode(screen_width,screen_height); | set_mode(screen_width,screen_height); | ||
Current revision
Contents |
[edit] Definition
FLOAT tan ( <FLOAT angle> )
Returns the tangent of a certain angle.
This function performs a tangent calculation on a certain angle and returns a value.
[edit] Parameters
FLOAT angle | - Angle, in thousandths of degrees. i.e. 75000 = 75º |
[edit] Returns
FLOAT : The tangent result of the specified angle.
[edit] Notes
The angle value used in this function should be in thousandths of degrees, as most angles within Fenix are.
To read about all aspects of trigonometry, you can visit Wikipedia's Trigonometric function page.
[edit] Example
Const screen_width = 320; screen_height = 200; screen_border = 15; End Global float value; End Process Main() Begin // Modes set_title("Tangent Graph"); set_mode(screen_width,screen_height); // X axis for(x=1;x<=8;x++) write( 0, screen_border+x*(screen_width-screen_border)/8+3, screen_height-1, 8, itoa(x*360/8 )+"^" ); end draw_line(1,screen_height-screen_border,screen_width,screen_height-screen_border); // Y axis write(0,screen_border-1,20,5,"1"); write(0,screen_border-1,screen_height/2,5,"0"); write(0,screen_border-1,screen_height-20,5,"-1"); draw_line(screen_border,1,screen_border,screen_height-1); // Draw tangent for(angle=0;angle<360;angle++) value=tan(angle*1000)*(screen_height/2-20); put_pixel( screen_border+angle*(screen_width-screen_border)/360, screen_height/2-value, rgb(255,255,255) ); // screen_height/2-value because the screen's origin (0,0) is topleft instead of downleft. end Repeat frame; Until(key(_ESC)) End
Used in example: set_title(), set_mode(), write(), draw_line(), tan(), put_pixel(), key()
This will result in something like:
|
Math Functions | |
• Abs() • Acos() • Asin() • Atan() • Cos() • Fget_angle() • Fget_dist() • Get_distx() • Get_disty() • Pow() • Rand() • Rand_seed() • Sin() • Sqrt() • Tan() • |