Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get results in DEGREES when using cos, etc 1

Status
Not open for further replies.

biot023

Programmer
Joined
Nov 8, 2001
Messages
403
Location
GB
Hallo.
I'm just learning affine tranformations, and am successfully rotating shapes, which is nice.
However, when I call cos or sin or tan, I only get results in radians. Does anybody know a simple method of changing this or converting the results?

Any help gratefully received.

Douglas JL If it don't make you laugh, it ain't true.
 
Hello:

The transformation you need to do is simple:
The value of the angle in degrees is equal to the angle in radians multiplied by 180 and divided by PI.

Deg=rad*180.0/PI()

Maybe you can define a constant 180.0/PI() and just do the operation when you need the angle in degrees.
The way you can get the value of PI() depends on the C++ you use. In Borland C++ 4.0 it is PI() as I wrote and in the vertion for DOS it used to be M_PI.
As far as I know this is the the way to do what you want
Good luck
Bussotao
 
Thanks alot, man - you just saved me a whole bunch of headaches!

Douglas If it don't make you laugh, it ain't true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top