Reputation: 187
I didn't find any method on java api to do this... there is one like : line.contains(point).. but it says that line2d doesn't have any area so it will return always false.. Any idea ?
Upvotes: 2
Views: 784
Reputation: 57
Compare point by point and see if the cursor matches it.
You can do the search using the for each loop described here.
Upvotes: 2
Reputation: 1223
You should compute the distance from the point to the line, and if it is sufficiently small, then consider the point being on the line.
Google "distance point to line" or "distance point to segment".
Upvotes: 1