// will only auto-redraw under certain conditions
  private void moveEndPts() {
    startBorderPts = startState.getBorderPts();
    endBorderPts = endState.getBorderPts();
    sPage = startState.getPage();
    ePage = endState.getPage();

    if (sPage != ePage && !stub) {

      int sOffset = drawArea.getOffset(sPage, startState, this, "start");
      int eOffset = drawArea.getOffset(ePage, endState, this, "end");

      int sBorderOffset = sOffset / 20;
      if (sBorderOffset < 0) sBorderOffset += 36;
      if (sBorderOffset > 35) sBorderOffset -= 36;

      int eBorderOffset = -eOffset / 20;
      if (eBorderOffset < -18) eBorderOffset += 36;
      if (eBorderOffset > 17) eBorderOffset -= 36;
      startPt = startBorderPts.get(0 + sBorderOffset);
      startCtrlPt = new Point((int) startPt.getX() + 20, (int) startPt.getY());
      endPt = endBorderPts.get(18 + eBorderOffset);
      endCtrlPt = new Point((int) endPt.getX() - 20, (int) endPt.getY());

      pageS = new Point(drawArea.getMaxW() - 50, (int) startPt.getY() + sOffset);
      pageSC = new Point(drawArea.getMaxW() - 70, (int) startPt.getY() + sOffset);
      pageE = new Point(50, (int) endPt.getY() + eOffset);
      pageEC = new Point(70, (int) endPt.getY() + eOffset);
    } else if (stub) {
      // TODO
      // System.out.println("in stub loop, moveendpts");
      startPt = startBorderPts.get(startStateIndex);
      pageS.setLocation(
          new Point(
              (int) (startPt.getX() + len * Math.cos(angle)),
              (int) (startPt.getY() - len * Math.sin(angle))));
    } else {

      // or if multiple states selected, dont need to recalculate
      if ((!recalcCheck() && !drawArea.getRedraw())
          || (startState.getSelectStatus() != SelectOptions.NONE
              && endState.getSelectStatus() != SelectOptions.NONE)) {
        startStateIndex = tempStartIndex;
        endStateIndex = tempEndIndex;
        startPt = startBorderPts.get(startStateIndex);
        endPt = endBorderPts.get(endStateIndex);
        // if movement hasnt left the start quadrant, don't recalulate all
        // points
        startCtrlPt = new Point((int) startPt.getX() + sdx, (int) startPt.getY() + sdy);
        endCtrlPt = new Point((int) endPt.getX() + edx, (int) endPt.getY() + edy);
      } else setEndPts();
    }
  }
  public void setEndPts() {
    startBorderPts = startState.getBorderPts();
    endBorderPts = endState.getBorderPts();
    sPage = startState.getPage();
    ePage = endState.getPage();
    // TODO page connector stacking
    if (sPage != ePage && !stub) {

      int sOffset = drawArea.getOffset(sPage, startState, this, "start");
      int eOffset = drawArea.getOffset(ePage, endState, this, "end");
      int sBorderOffset = sOffset / 20;
      if (sBorderOffset < 0) sBorderOffset += 36;
      if (sBorderOffset > 35) sBorderOffset -= 36;

      int eBorderOffset = -eOffset / 20;
      if (eBorderOffset < -18) eBorderOffset += 36;
      if (eBorderOffset > 17) eBorderOffset -= 36;

      startPt = startBorderPts.get(0 + sBorderOffset);
      startCtrlPt = new Point((int) startPt.getX() + 20, (int) startPt.getY());
      endPt = endBorderPts.get(18 + eBorderOffset);
      endCtrlPt = new Point((int) endPt.getX() - 20, (int) endPt.getY());

      pageS = new Point(drawArea.getMaxW() - 50, (int) startPt.getY() + sOffset);
      pageSC = new Point(drawArea.getMaxW() - 70, (int) startPt.getY() + sOffset);
      pageE = new Point(50, (int) endPt.getY() + eOffset);
      pageEC = new Point(70, (int) endPt.getY() + eOffset);
      curve = new CubicCurve2D.Double();
    } else if (stub) {
      // TODO
      // System.out.println("in stub loop, setendpts");
      startPt = startBorderPts.get(0);
      startStateIndex = 0;
      pageS = new Point((int) startPt.getX() + 60, (int) startPt.getY());
      len = 60;
      angle = 0;
    } else {
      Point startCoords = startState.getRealCenter(myPage);
      Point endCoords = endState.getRealCenter(myPage);
      double temp;
      double max = 1000000;
      for (int i = 0; i < 36; i++) {
        temp = startCoords.distanceSq(endBorderPts.get(i));
        if (temp < max) {
          endStateIndex = i;
          max = temp;
        }
      }
      max = 1000000;
      for (int i = 0; i < 36; i++) {
        temp = endCoords.distanceSq(startBorderPts.get(i));
        if (temp < max) {
          startStateIndex = i;
          max = temp;
        }
      }
      // try to prevent overlapping
      if (startCoords.getX() < endCoords.getX()) {
        if (startCoords.getY() < endCoords.getY()) {

        } else {

        }
      } else {
        if (startCoords.getY() < endCoords.getY()) {

        } else {

        }
      }
      startStateIndex -= 1;
      if (startStateIndex == -1) startStateIndex = 35;
      endStateIndex += 1;
      if (endStateIndex == 36) endStateIndex = 0;

      startPt = startBorderPts.get(startStateIndex);
      endPt = endBorderPts.get(endStateIndex);

      // SELECTION OF CONTROL POINTS

      // distances between states
      int dx =
          (int) startState.getRealCenter(myPage).getX()
              - (int) endState.getRealCenter(myPage).getX();
      int dy =
          (int) startState.getRealCenter(myPage).getY()
              - (int) endState.getRealCenter(myPage).getY();

      // scaling for distance of control point from start or end point
      int dxs = (int) (endPt.getX() - startPt.getX()) / 3;
      int dys = (int) (endPt.getY() - startPt.getY()) / 3;
      if (dxs < 0) dxs = -dxs;
      if (dys < 0) dys = -dys;

      // find angle between states
      double theta = 0;
      if (dx == 0) {
        if (dy <= 0) theta = Math.PI / 2;
        else theta = 3 * Math.PI / 2;
      } else if (dx > 0 && dy > 0) theta = 2 * Math.PI - Math.atan((double) dy / dx);
      else if (dx > 0 && dy <= 0) {
        if (dy == 0) theta = 0;
        else theta = -Math.atan((double) dy / (dx));
      } else if (dx < 0) theta = Math.PI - Math.atan((double) dy / dx);

      // determine angle away from start point for start control point
      double adj = Math.PI / 6;
      double angleStart = 0;
      if (dx >= 0 && dy >= 0) angleStart = -Math.PI + theta + adj; // +
      else if (dx >= 0 && dy < 0) angleStart = Math.PI + theta + adj; // +
      else if (dx < 0 && dy >= 0) angleStart = -Math.PI + theta + adj;
      else if (dx < 0 && dy < 0) angleStart = Math.PI + theta + adj;

      // determine angle away from end point for end control point
      double angleEnd = 0;
      if (dx >= 0) angleEnd = theta - adj;
      else if (dx < 0) angleEnd = theta - adj;

      // create control point
      startCtrlPt =
          new Point(
              (int) (startPt.getX() + (Math.cos(angleStart) * dxs)),
              (int) (startPt.getY() - (Math.sin(angleStart) * dys)));
      endCtrlPt =
          new Point(
              (int) (endPt.getX() + (Math.cos(angleEnd) * dxs)),
              (int) (endPt.getY() - (Math.sin(angleEnd) * dys)));

      curve =
          new CubicCurve2D.Double(
              startPt.getX(),
              startPt.getY(),
              startCtrlPt.getX(),
              startCtrlPt.getY(),
              endCtrlPt.getX(),
              endCtrlPt.getY(),
              endPt.getX(),
              endPt.getY());
    }
  }