how to convert from device coordinates into physical coordinates
-
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
-
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
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!"
-
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
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