segmentsIntersectionRatio (bbox1, bbox2, alignment = null) {
    if (bbox1 === bbox2) { return 1 }

    const rectBbox1 = Helpers.rectifyBBox(JSON.parse(JSON.stringify(bbox1)))
    const rectBbox2 = Helpers.rectifyBBox(JSON.parse(JSON.stringify(bbox2)))

    if (JSON.stringify(rectBbox1) === JSON.stringify(rectBbox2)) {
      return 1
    }

    if (alignment === Constants.HORIZONTAL_SEGMENTS) {
      return horizontalIntersectionRatio (rectBbox1, rectBbox2)
    }

    if (alignment === Constants.VERTICAL_SEGMENTS) {
      return verticalIntersectionRatio (rectBbox1, rectBbox2)
    }

    if (!alignment) {
      return intersectionRatio (rectBbox1, rectBbox2)
    }
  }
/**
   * detect ratio of intersection of two bbox segments.
   *
   * @param {Array} bbox1 contains pairs of x,y vertices
   * @param {Array} bbox2 contains pairs of x,y vertices
   * @param {String} alignment null, HORIZONTAL_SEGMENTS, VERTICAL_SEGMENTS
   */
detect ratio of intersection of two bbox segments.
@param {Array} bbox1 contains pairs of x,y vertices
@param {Array} bbox2 contains pairs of x,y vertices
@param {String} alignment null, HORIZONTAL_SEGMENTS, VERTICAL_SEGMENTS
detect ratio of intersection of two bbox segments . @param { Array } bbox1 contains pairs of x y vertices @param { Array } bbox2 contains pairs of x y vertices @param { String } alignment null HORIZONTAL_SEGMENTS VERTICAL_SEGMENTS
segmentsIntersectionRatio (bbox1, bbox2, alignment = null) {
    if (bbox1 === bbox2) { return 1 }
    const rectBbox1 = Helpers.rectifyBBox(JSON.parse(JSON.stringify(bbox1)))
    const rectBbox2 = Helpers.rectifyBBox(JSON.parse(JSON.stringify(bbox2)))
    if (JSON.stringify(rectBbox1) === JSON.stringify(rectBbox2)) {
      return 1
    }
    if (alignment === Constants.HORIZONTAL_SEGMENTS) {
      return horizontalIntersectionRatio (rectBbox1, rectBbox2)
    }
    if (alignment === Constants.VERTICAL_SEGMENTS) {
      return verticalIntersectionRatio (rectBbox1, rectBbox2)
    }
    if (!alignment) {
      return intersectionRatio (rectBbox1, rectBbox2)
    }
  }
segmentsIntersectionRatio ( bbox1 , bbox2 , alignment = null ) { if ( bbox1 === bbox2 ) { return 1 } const rectBbox1 = Helpers . rectifyBBox ( JSON . parse ( JSON . stringify ( bbox1 ) ) ) const rectBbox2 = Helpers . rectifyBBox ( JSON . parse ( JSON . stringify ( bbox2 ) ) ) if ( JSON . stringify ( rectBbox1 ) === JSON . stringify ( rectBbox2 ) ) { return 1 } if ( alignment === Constants . HORIZONTAL_SEGMENTS ) { return horizontalIntersectionRatio ( rectBbox1 , rectBbox2 ) } if ( alignment === Constants . VERTICAL_SEGMENTS ) { return verticalIntersectionRatio ( rectBbox1 , rectBbox2 ) } if ( ! alignment ) { return intersectionRatio ( rectBbox1 , rectBbox2 ) } }
detect ratio of intersection of two bbox segments.
detect ratio of intersection of two bbox segments .