Thursday, 15 March 2012

javascript - Check if several points are in path - JS Canvas -


I am working on a project and I have to check that several points on the canvas, XY coordinates, are defined paths . Actually I want to use something like .isPointInPath (x, y) , but check out what I am trying to do with several pixels 20, 30 - 26, 30 .

  • Is this an existing method to complete?
  • If not, does that mean that I have to check every individual point? Using the bus, you must check each point in the built-in function.

    You can only check the end, but the half-way-shaped path (unsuccessful) will fail.

    Things are a little bit better if you apply the Segment-Enterresects-Path algorithm (or line-intercept-path ) if you Remove the points that are not on the segment you want).

    Then you examine path intersections between (20, 30) and (26, 30) . If they are in two point paths and there are zero line / segment intersections along the path, then you are in the (20, 30) to (26, 30) in the path.

No comments:

Post a Comment