Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Pipo DeClown

something with sin

This topic is 5554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 .

Share this post


Link to post
Share on other sites
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 degrees


ret = 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]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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..)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites

const double Pi2 = 6.28318530717958647692528676655901;

for(double t = 0; t < Pi2; t += Pi2/10)
{
double x = sin(t)*radius, y = cos(t)*radius;

...
}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!