@ Pure public double distanceToEnd ( Point2D < ? , ? > point , double width ) { final Point2d firstPoint = getPointAt ( 0 ) ; final Point2d lastPoint = getPointAt ( - 1 ) ; double d1 = firstPoint . getDistance ( point ) ; double d2 = lastPoint . getDistance ( point ) ; d1 -= width ; if ( d1 < 0 ) { d1 = 0 ; } d2 -= width ; if ( d2 < 0 ) { d2 = 0 ; } return d1 < d2 ? d1 : d2 ; }
Replies the distance between the nearest end of this MapElement and the point .