- This wiki is out of date, use the continuation of this wiki instead
Cos
From FenixWiki
(Difference between revisions)
Revision as of 14:25, 1 March 2008 (edit) Sandman (Talk | contribs) m ← Previous diff |
Revision as of 14:49, 1 March 2008 (edit) (undo) Sandman (Talk | contribs) m Next diff → |
||
Line 60: | Line 60: | ||
This will result in something like:<br /> | This will result in something like:<br /> | ||
- | + | {{Image | |
+ | | image = Cos.png | ||
+ | | caption = Cosine | ||
+ | }} | ||
{{Funcbox | {{Funcbox | ||
| category = Math | | category = Math | ||
}} | }} |
Revision as of 14:49, 1 March 2008
Contents |
Definition
FLOAT cos ( <FLOAT angle> )
Returns the cosine of the specified angle.
This function performs a cosine calculation on a certain angle and returns a value between -1 and 1.
Parameters
FLOAT angle | - Angle, in thousandths of degrees. i.e. 75000 = 75º |
Returns
FLOAT : The cosine result of the specified angle.
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.
Example
Program example_cos; Global float value; Begin // Modes set_title("Cosine Graph"); set_mode(825,480); // X axis for(x=50;x<=800;x+=50) write(0,x,479,6,itoa(x*360/800)); end draw_line(1,470,824,470); // Y axis write(0,1,20,3,"1"); write(0,1,240,3,"0"); write(0,1,460,3,"-1"); draw_line(15,1,15,479); // Draw cosine for(angle=0;angle<360;angle++) value=cos(angle*1000)*220; put_pixel(angle*800/360,240+value,rgb(255,255,255)); end Repeat frame; Until(key(_ESC)) End
Used in example: set_title(), set_mode(), write(), draw_line(), cos(), 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() • |