Math Problem

This is a discussion on Math Problem within the C++ Programming forums, part of the General Programming Boards category; Hi all, I have a little problem. Say I have a image at x=100 y=100. When I press 't' the ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    2

    Math Problem

    Hi all,

    I have a little problem.

    Say I have a image at x=100 y=100.
    When I press 't' the image moves around in a circle with radius 20 (the circle is invisible)

    So this image moves around the circumference of the circle in a clockwise direction.
    When I click T again it stops and move back in a anticlockwise direction.

    Any help with the maths behind this would be much appreciated.

    Thanks

  2. #2
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    read about the sin and cos functions. They are able to plot points given their radius on a unit circle. With some simple multiplication you can plot it at any multiple of that unit circle.

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    2
    ahh yes that seems to be the way forward. Much appreciated

  4. #4
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    you also need to convert the degrees to radians

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    That's only if you actually want to use the sin() and cos() functions in the C standard math library. If you just want to understand the concept of how the images rotates in a circle, you don't need to.

    And if you use sin() and cos(), you'd likely need to go the other way as well.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Help!!c problem in math
    By feelsunny in forum Tech Board
    Replies: 2
    Last Post: 10-06-2007, 03:35 AM
  3. Math Problem....
    By NANO in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 11-11-2002, 03:37 AM
  4. math problem
    By unixOZ in forum Linux Programming
    Replies: 4
    Last Post: 10-19-2002, 12:17 AM
  5. Little math problem
    By Thantos in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-27-2001, 07:44 PM

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