something with sin

Started by
9 comments, last by Pipo DeClown 20 years, 8 months ago
(float)sin(1*180) * Radius = -1 Should it not be 0? .lick
Advertisement
quote:Original post by Pipo DeClown
(float)sin(1*180) * Radius = -1

Should it not be 0?

.lick


It takes radians, not degrees....

sinf(Degree*3.1415/180)*Radius

If you''re using floats, use sinf, cosf, tanf, etc rather than sin,cos,tan that way you don''t need the cast to get rid of the warning, sinf, cosf, etc return floats and not doubles .
The parameter is in radians.
Thanks both of you, what are these called again?

.lick
quote:Original post by Pipo DeClown
Thanks both of you, what are these called again?


What are what called? Radians? Or the sin/cos functions?


--- Edit ---
Here is an easy inlined function to help you out:

__forceinline float fsin(float Degree){ return sinf(Degree*3.1415/180.0f);}//Now you can just call using degreesret = fsin(1*180);


However, I do recommend just using degrees while working with stuff instead of converting back and forth.

[edited by - Ready4Dis on August 7, 2003 7:05:40 AM]
...metry

[edit]D3DXToRadian() works for me


.lick


[edited by - Pipo DeClown on August 7, 2003 7:09:23 AM]
Why use the function when all you have to do is multiply the number by 0.017453292519943295769236907684886? (Although you may want more accuracy in that number which is found by pi/180 if you didnt know..)
The last thing I''d ever want to see in the sin(theta) function call would be a conversion factor of that gibberish you just posted. Talk about making things unnecessarily more complicated.
I''m trying to make a loop where the number of times it loops can vary, and the objects I render are in a circle.
That''s my business though.

.lick
const double Pi2 = 6.28318530717958647692528676655901;for(double t = 0; t < Pi2; t += Pi2/10) {  double x = sin(t)*radius, y = cos(t)*radius;  ... }
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.

This topic is closed to new replies.

Advertisement