Simple answer for intersecting lines?

This is a discussion on Simple answer for intersecting lines? within the C++ Programming forums, part of the General Programming Boards category; I am scratching my head trying to figure out how to display a XY pixel value for 2 intersecting lines. ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    16

    Simple answer for intersecting lines?

    I am scratching my head trying to figure out how to display a XY pixel value for 2 intersecting lines.

    I am working on a 2d graphical application that deals with lines or slopes.

    > Both lines always intersect

    > I have line "CD" which pixel values are known for both C and D

    > I know the pixel location of A

    > the application is dynamic in that I can grab point B and move it vertically (assuming that CD is somewhat horizontal)

    > I am attempting to display the pixel values in which AB and CD intersect

    Can anybody lead me in the right direction? I appreciate your help!

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    This post is very vague.

    Do you need help with the formula to find the intersection point of two lines?
    Or, do you need help with the code to display a pixel?
    And, what platform and what GUI?
    And the really big question is... why does you head itch?

    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!

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Searching on this brings up this
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    Usually to see if two lines are intersecting you would set them equal to one another and solve.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    16
    Quote Originally Posted by Todd Burch View Post
    This post is very vague.

    Do you need help with the formula to find the intersection point of two lines?
    Or, do you need help with the code to display a pixel?
    And, what platform and what GUI?
    And the really big question is... why does you head itch?

    Todd
    Just need help with the equation. - My head itches b/c I have no idea what I am doing :>)

  6. #6
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    See here for a good explanation:

    http://id.mind.net/~zona/mmts/inters...TwoLines1.html

    And here for sample source code:

    http://local.wasp.uwa.edu.au/~pbourk...ry/lineline2d/

    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!

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    16
    Thanks Todd and everyone else!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 10-07-2008, 06:19 PM
  2. Simple Socialising Chat Bots
    By bengreenwood in forum C++ Programming
    Replies: 10
    Last Post: 11-28-2007, 07:42 AM
  3. Is there a simple answer?
    By Jamazon in forum C++ Programming
    Replies: 2
    Last Post: 12-08-2001, 03:03 PM
  4. Replies: 22
    Last Post: 11-08-2001, 10:01 PM
  5. A Simple Question
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 10-26-2001, 05:23 PM

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