Thread: Orienting points counter clockwise

  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
    Chappell Hill, Texas
    Posts
    2,332
    Sounds like a rotation transformation. Does this shed any light for you? http://en.wikipedia.org/wiki/Transformation_matrix

    Todd
    Mainframe assembler programmer by trade. C coder when I can.

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, 02: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