code: public Shape[] union(Shape target, Shape other) {
  		target = target.transform(new Transform());
  		other = other.transform(new Transform());
  		
  		if (!target.intersects(other)) {
  			return new Shape[] {target, other};
  		}
  		
  		// handle the case where intersects is true but really we're talking
  		// about edge points
  		boolean touches = false;
  		int buttCount = 0;
  		for (int i=0;i<target.getPointCount();i++) {
  			if (other.contains(target.getPoint(i)[0], target.getPoint(i)[1])) {
  				if (!other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) {
  					touches = true;
  					break;
  				}
  			}
  			if (other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) {
  				buttCount++;
  			} 
  		}
  		for (int i=0;i<other.getPointCount();i++) {
  			if (target.contains(other.getPoint(i)[0], other.getPoint(i)[1])) {
  				if (!target.hasVertex(other.getPoint(i)[0], other.getPoint(i)[1])) {
  					touches = true;
  					break;
  				}
  			}
  		}
  		
  		if ((!touches) && (buttCount < 2)) {
  			return new Shape[] {target, other};
  		}
  		
  		// so they are definitely touching, consider the union
  		return combine(target, other, false);
  	}
docs: Join to shapes together. Note that the shapes must be touching
  for this method to work.
  
  @param target The target shape to union with
  @param other The additional shape to union
  @return The newly created shapes