code: public int addPoint(double x, double y, int groupIndex) {
  		final int groupCount = getGroupCount();
  
  		if (groupIndex < 0) {
  			throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$
  		}
  		if (groupIndex >= groupCount) {
  			throw new IndexOutOfBoundsException(groupIndex + ">=" + groupCount); //$NON-NLS-1$
  		}
  
  		int pointIndex;
  
  		if (this.pointCoordinates == null) {
  			this.pointCoordinates = new double[] {x, y};
  			this.partIndexes = null;
  			pointIndex = 0;
  		} else {
  			pointIndex = lastInGroup(groupIndex);
  			double[] pts = new double[this.pointCoordinates.length + 2];
  
  			pointIndex += 2;
  
  			System.arraycopy(this.pointCoordinates, 0, pts, 0, pointIndex);
  			System.arraycopy(this.pointCoordinates, pointIndex, pts, pointIndex + 2, this.pointCoordinates.length - pointIndex);
  			pts[pointIndex] = x;
  			pts[pointIndex + 1] = y;
  			this.pointCoordinates = pts;
  			pts = null;
  
  			//Shift the following groups's indexes
  			if (this.partIndexes != null) {
  				for (int idx = groupIndex; idx < this.partIndexes.length; ++idx) {
  					this.partIndexes[idx] += 2;
  				}
  			}
  
  			pointIndex /= 2.;
  		}
  
  		fireShapeChanged();
  		fireElementChanged();
  
  		return pointIndex;
  	}
docs: Add the specified point at the end of the specified group.
  
  @param x x coordinate
  @param y y coordinate
  @param groupIndex the index of the group.
  @return the index of the point in the element.
  @throws IndexOutOfBoundsException in case of error.