Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Point on line

This topic is 5559 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I''m using this formula to detect whenever the mouse icon is over a line (writing a map editor in directx) : Y - Y1 = m ( X - X1) where m = (Y2 - Y1)/(X2 - X1) and the code: BOOL CGeometry:ointOnLine(int x, int y, CLine* pLine) { int slope = (pLine->m_y2 - y1) / (pLine->m_x2 - x1); int yf = y - y1; int xf = slope * (x - x1); return yf = yf == xf; } The more slope on the line, the worse the detection is ? Any ideas ? Kind regards, Steve

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!