Results 1 to 10 of 10

Thread: how do u find the angle of these points?

  1. #1

    Thread Starter
    Hyperactive Member voidflux's Avatar
    Join Date
    Jun 2003
    Location
    Brockway, PA
    Posts
    290

    how do u find the angle of these points?

    Hello everyone, I was reading next semesters programming book and I can't even figure out how to do this problem on paper, so It doesn't look like i'll be programming it anytime soon. Here's my question, They say, design and implement a class called circle_location to keep track of the postion of a single point that travels around a circle. An object of this clas records the position of the point as an angle, measured in a clockwise direction from the top of the circle. Programming this isn't my problem, but I'm confused on how i'm suppose to figure out the angle of the point. So say I have a point at (0,0) and (3,3) this would make a line then I could draw a vertical line down to make a right angle, but how would I find the angle of that? with just given 2 points? Or am i misunderstanding what they really want me to do?
    Thanks!
    C¤ry Sanchez
    Computer Science/Engineering
    @ Penn State
    IBM.zSeries Intern
    Mandriva 2007

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    google on trigonometry
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    You can use tan-1 (abs(y1 - y2))/(abs(x1 - x2))

    With the originating point being (x2, y2) and the other being (x1, y1). Now, you'll have to use whether (y1 - y2) and (x1 - x2) or positive or negative to tell you which quadrant it's in.

    - , + = quadrant 4
    - , - = quadrant 3
    + , - = quadrant 2
    + , + = quadrant 1

    I'm sure there are other ways (like somehow using the parametric representation of a circle and solving for T), but that *should* work with some fiddling around.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  4. #4

    Thread Starter
    Hyperactive Member voidflux's Avatar
    Join Date
    Jun 2003
    Location
    Brockway, PA
    Posts
    290

    Thumbs up

    Thanks jemidiah, That will work great!
    C¤ry Sanchez
    Computer Science/Engineering
    @ Penn State
    IBM.zSeries Intern
    Mandriva 2007

  5. #5
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    One thing I remembered: when x1 - x2 = 0, you'd get a divide by zero error (duh), so the angle'll be 90
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  6. #6
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    yeh its infinity and tan 90 is infinity
    Regards

  7. #7
    Lively Member
    Join Date
    Oct 2003
    Location
    Guildford, UK
    Posts
    91
    I haven't nit-picked for a while, so here goes:

    tan90o is infinite not infinity, they are different.

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I thought tan 90° was not defined, likewise cot 0° csc 0° and sec 90°
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    They're all divide by zero errors, so you could debate about anything you want (search the forums if you really want to see war )
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    yeah but i dont like war.. or nit picking for that matter I just thought some general info on how to use trigonometry would do good.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width