code: static Point2d[] reorderCoords(Point2d[] coords, int[] order) {
          Point2d[] neworder = new Point2d[coords.length];
          for (int i = 0; i < order.length; i++)
              neworder[order[i]] = coords[i];
          return neworder;
      }
docs: Reorder coordinates.
  
  @param coords coordinates
  @param order permutation
  @return reordered coordinates