private void findRightmostEdgeAtVertex() {
   /**
    * The rightmost point is an interior vertex, so it has a segment on either side of it. If these
    * segments are both above or below the rightmost point, we need to determine their relative
    * orientation to decide which is rightmost.
    */
   Coordinate[] pts = minDe.getEdge().getCoordinates();
   Assert.isTrue(
       minIndex > 0 && minIndex < pts.length,
       "rightmost point expected to be interior vertex of edge");
   Coordinate pPrev = pts[minIndex - 1];
   Coordinate pNext = pts[minIndex + 1];
   int orientation = CGAlgorithms.computeOrientation(minCoord, pNext, pPrev);
   boolean usePrev = false;
   // both segments are below min point
   if (pPrev.y < minCoord.y
       && pNext.y < minCoord.y
       && orientation == CGAlgorithms.COUNTERCLOCKWISE) {
     usePrev = true;
   } else if (pPrev.y > minCoord.y
       && pNext.y > minCoord.y
       && orientation == CGAlgorithms.CLOCKWISE) {
     usePrev = true;
   }
   // if both segments are on the same side, do nothing - either is safe
   // to select as a rightmost segment
   if (usePrev) {
     minIndex = minIndex - 1;
   }
 }
  private void addBufferCoordinates() {
    if (m_segment0 == null || m_segment1 == null || m_buffer0 == null || m_buffer1 == null) return;

    final int orientation =
        CGAlgorithms.computeOrientation(m_segment0.p0, m_segment0.p1, m_segment1.p1);
    final boolean outsideTurn =
        (orientation == CGAlgorithms.CLOCKWISE && m_side == Position.LEFT)
            || (orientation == CGAlgorithms.COUNTERCLOCKWISE && m_side == Position.RIGHT);

    // REMARK: we add only points at the current buffer vertex (i.e. the common point of the two
    // segments);
    // the very first and very last vertex must be added separately
    // last crd of last segment is added separately

    final boolean addStartPoint = true;

    if (orientation == 0) {
      addCollinear(addStartPoint);
    } else if (outsideTurn) {
      addOutsideTurn(orientation, addStartPoint);
    } else {
      addInsideTurn();
    }
  }