Orienting points counter clockwise

This is a discussion on Orienting points counter clockwise within the C++ Programming forums, part of the General Programming Boards category; I've hit a snag in my program. I need to take any three given coordinates and orient them in a ...

  1. #1
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391

    Orienting points counter clockwise

    I've hit a snag in my program. I need to take any three given coordinates and orient them in a counter-clockwise fashion.

    Any point can be chosen as the first (in my case, I've chosen the coordinate with the least y-value and if another coordinate shares that y-value, I go with the coordinate with the least x-value)

    In other words, the first coordinate is the bottom-most-left-most point.

    Great.

    I can get the other points in counter-clockwise orientation using a lot of if-else conditional statements, but I'm looking for a more elegant solution.

    Any ideas?

    (BTW, I'm not looking for code, just help with the algorithm)
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

  2. #2
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391
    nevermid, i think i got my solution. find the coordinate's angle w/respect to the origin.
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

  3. #3
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Sounds like a rotation transformation. Does this shed any light for you? http://en.wikipedia.org/wiki/Transformation_matrix

    Todd
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Promblem with code
    By watchdogger in forum C Programming
    Replies: 18
    Last Post: 01-31-2009, 06:36 PM
  2. Help it won't compile!!!!!
    By esbo in forum C Programming
    Replies: 58
    Last Post: 01-04-2009, 03:22 PM
  3. Replies: 8
    Last Post: 11-03-2008, 09:48 PM
  4. Yahtzee C++ programme help
    By kenneth_888 in forum C++ Programming
    Replies: 13
    Last Post: 09-05-2007, 03:14 PM
  5. CProg Fantasy Football version pi
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 155
    Last Post: 12-26-2006, 04:30 PM

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