Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to convert from device coordinates into physical coordinates

how to convert from device coordinates into physical coordinates

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestioncomalgorithmstutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pathi
    wrote on last edited by
    #1

    Hi I drew a few line .Now I want to select a particular line by clicking on that line.I implemented a funtion which will take the mouse point and end points of line as parameters and returns true if the point is on the line by using Bresehalm's algorithm.for that I need to find the slope of line.the window has default mapping mode MM_TEXT.How can I convert the device coordinates into physical coordinates as if I place the mouse over the line the function should return true?how to solve this problem?please help me.for the lines with negative slopes I am getting errors. Thanks Regards Pathi bhikshapathi_g@semanticspace.com

    A T 2 Replies Last reply
    0
    • P pathi

      Hi I drew a few line .Now I want to select a particular line by clicking on that line.I implemented a funtion which will take the mouse point and end points of line as parameters and returns true if the point is on the line by using Bresehalm's algorithm.for that I need to find the slope of line.the window has default mapping mode MM_TEXT.How can I convert the device coordinates into physical coordinates as if I place the mouse over the line the function should return true?how to solve this problem?please help me.for the lines with negative slopes I am getting errors. Thanks Regards Pathi bhikshapathi_g@semanticspace.com

      A Offline
      A Offline
      Anders Molin
      wrote on last edited by
      #2

      is ScreenToClient() what you are looking for? Else search for "Coordinate Space and Transformation Functions" in MSDN... - Anders Money talks, but all mine ever says is "Goodbye!"

      1 Reply Last reply
      0
      • P pathi

        Hi I drew a few line .Now I want to select a particular line by clicking on that line.I implemented a funtion which will take the mouse point and end points of line as parameters and returns true if the point is on the line by using Bresehalm's algorithm.for that I need to find the slope of line.the window has default mapping mode MM_TEXT.How can I convert the device coordinates into physical coordinates as if I place the mouse over the line the function should return true?how to solve this problem?please help me.for the lines with negative slopes I am getting errors. Thanks Regards Pathi bhikshapathi_g@semanticspace.com

        T Offline
        T Offline
        Tomasz Sowinski
        wrote on last edited by
        #3

        How can I convert the device coordinates into physical coordinates There's no such thing as 'physical coordinates' in GDI. You can convert between device and logical coordinates using LPtoDP and DPtoLP, but I don't think this is going to solve your problem. Check http://www.faqs.org/faqs/graphics/algorithms-faq/, item 1.02 - "How do I find the distance from a point to a line?". If distance is small, you can assume than mouse is over the line. The definition of 'small' depends on your application - you can use some tolerance in testing, for example if user clicks two pixels from the line, it may be close enough. Tomasz Sowinski -- http://www.shooltz.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups