Jump to content
  • Advertisement
Sign in to follow this  
socialdev

Math.Cos2 from Math.cos?

This topic is 2590 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

I have a little problem here... The language I am using does not have Math.cos2() function, it only has a Math.cos() function. How do I solve this?

I was looking at the wikipedia article on cosigns and am stumped...
http://en.wikipedia.org/wiki/Law_of_cosines

If it's not included in the language it must be something simple like Math.pow(Math.cos(x),2)? (Cos the the power of two.) Dunno...

Share this post


Link to post
Share on other sites
Advertisement
It's just a little bit confusing way (but fully fine, standard and common) how to write a square of cosinus.
In fact this:
cos[sup]2[/sup]a
simply means:
(cos(a))[sup]2[/sup]

Which really is Math.pow(Math.cos(x),2)

Share this post


Link to post
Share on other sites
Just to add. One of the reasons we write it like that is so that it's clear we are taking the square of the result of the cos, and not squaring the angle within the cos. Plus I get to be lazy and not write parenthesis.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!