Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In this case the slope method is better and simpler than the cross product method.

    def slope(p):
      return (p.y-oldMouse.y)/(p.x-oldMouse.x)

    isInRange = slope(menuBottom) <= slope(newMouse) <= slope(menuTop)


My thought too. What are the supposed advantages of using linear algebra for this problem?

Edit: my guess is divide-by-zero conditions.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: