How to select a line

后端 未结 4 1216
一个人的身影
一个人的身影 2020-12-07 04:40

So I\'m trying to figure out how to implement a method of selecting lines or edges in a drawing area but my math is a bit lacking. This is what I got so far:

  • A
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 05:24

    Sorry, mathematics are still required... This is from java.awt.geom.Line2D:

    public boolean contains(double x, double y)

    Tests if a specified coordinate is inside the boundary of this Line2D. This method is required to implement the Shape interface, but in the case of Line2D objects it always returns false since a line contains no area.

    Specified by: contains in interface Shape

    Parameters: x - the X coordinate of the specified point to be tested y - the Y coordinate of the specified point to be tested

    Returns: false because a Line2D contains no area.

    Since: 1.2

    I recommend Tojis answer

提交回复
热议问题