sin and cos

This is a discussion on sin and cos within the C++ Programming forums, part of the General Programming Boards category; Hi. This is a very simple question; I'm was making some rotation functions when I realized that sin() and cos() ...

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    5

    sin and cos

    Hi. This is a very simple question;
    I'm was making some rotation functions when I realized that sin() and cos() worked with Radians. Is there anyway to get it to work with degrees? I'm much more used to it.
    If there isn't a way, can anyone give me the convertion formula from Rad to Deg?

    Thanks.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,765
    180 degress == PI radians

    so
    radians = degrees / 180 * PI
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    712
    It would be good to write your own convert functions torad and todeg in which you can use formula:

    rad=deg/180*PI
    (deg=rad*180/PI)

    and call for example

    sin(torad(90));
    where 90 is angle in Deg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with cos, sin fuctions
    By xxxhunter in forum C Programming
    Replies: 7
    Last Post: 11-16-2007, 03:33 AM
  2. Help with cos, sin and tan^-1 (arctan);
    By xIcyx in forum C Programming
    Replies: 15
    Last Post: 04-23-2007, 10:14 AM
  3. Help creating function of sin cos and tan
    By Niz in forum C Programming
    Replies: 12
    Last Post: 01-09-2007, 05:55 PM
  4. sin() and cos() that use degrees
    By dwks in forum C Programming
    Replies: 3
    Last Post: 05-14-2005, 05:29 PM
  5. integral of 1/x
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 43
    Last Post: 03-19-2004, 07:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21