Thread: Simple answer for 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
    Chappell Hill, Texas
    Posts
    2,332
    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
    Mainframe assembler programmer by trade. C coder when I can.

  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
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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
    Chappell Hill, Texas
    Posts
    2,332
    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
    Mainframe assembler programmer by trade. C coder when I can.

  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, 08:42 AM
  3. Is there a simple answer?
    By Jamazon in forum C++ Programming
    Replies: 2
    Last Post: 12-08-2001, 04:03 PM
  4. Replies: 22
    Last Post: 11-08-2001, 11:01 PM
  5. A Simple Question
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 10-26-2001, 05:23 PM