touches (point) {
    if (!touchesBbox(this.bbox(), point)) return false
    // if the points have been linked already, performance boost use that
    if (point === this.leftSE.point || point === this.rightSE.point) return true
    // avoid doing vector math on tiny vectors
    if (touchPoints(this.leftSE.point, point)) return true
    if (touchPoints(this.rightSE.point, point)) return true
    const cPt1 = closestPoint(this.leftSE.point, this.rightSE.point, point)
    const avgPt1 = { x: (cPt1.x + point.x) / 2, y: (cPt1.y + point.y) / 2 }
    return touchPoints(avgPt1, cPt1) || touchPoints(avgPt1, point)
  }
/* Does the point in question touch the given segment?
   * Greedy - essentially a 2 * Number.EPSILON comparison.
   * If it's not possible to add an independent point between the
   * point and the segment, we say the point 'touches' the segment. */
Does the point in question touch the given segment.
Greedy - essentially a 2 * Number.EPSILON comparison.
If it's not possible to add an independent point between the
point and the segment, we say the point 'touches' the segment.
Does the point in question touch the given segment . Greedy - essentially a 2 * Number . EPSILON comparison . If it ' s not possible to add an independent point between the point and the segment we say the point ' touches ' the segment .
touches (point) {
    if (!touchesBbox(this.bbox(), point)) return false
    if (point === this.leftSE.point || point === this.rightSE.point) return true
    if (touchPoints(this.leftSE.point, point)) return true
    if (touchPoints(this.rightSE.point, point)) return true
    const cPt1 = closestPoint(this.leftSE.point, this.rightSE.point, point)
    const avgPt1 = { x: (cPt1.x + point.x) / 2, y: (cPt1.y + point.y) / 2 }
    return touchPoints(avgPt1, cPt1) || touchPoints(avgPt1, point)
  }
touches ( point ) { if ( ! touchesBbox ( this . bbox ( ) , point ) ) return false if ( point === this . leftSE . point || point === this . rightSE . point ) return true if ( touchPoints ( this . leftSE . point , point ) ) return true if ( touchPoints ( this . rightSE . point , point ) ) return true const cPt1 = closestPoint ( this . leftSE . point , this . rightSE . point , point ) const avgPt1 = { x : ( cPt1 . x + point . x ) / 2 , y : ( cPt1 . y + point . y ) / 2 } return touchPoints ( avgPt1 , cPt1 ) || touchPoints ( avgPt1 , point ) }
Does the point in question touch the given segment?
Does the point in question touch the given segment?
// if the points have been linked already, performance boost use that // avoid doing vector math on tiny vectors