@Override public ShapeTile[] split_to_convex(){
  if (precalculated_convex_pieces != null)   return precalculated_convex_pieces;
  random_generator.setSeed(seed);
  Collection<ShapePolygon> convex_pieces=split_to_convex_recu();
  if (convex_pieces == null) {
    return null;
  }
  precalculated_convex_pieces=new ShapeTile[convex_pieces.size()];
  Iterator<ShapePolygon> it=convex_pieces.iterator();
  for (int i=0; i < precalculated_convex_pieces.length; ++i) {
    ShapePolygon curr_piece=it.next();
    precalculated_convex_pieces[i]=ShapeTile.get_instance(curr_piece.corners);
  }
  return precalculated_convex_pieces;
}

@ Override public ShapeTile [ ] split_to_convex ( ) { if ( precalculated_convex_pieces != null ) return precalculated_convex_pieces ; random_generator . setSeed ( seed ) ; Collection < ShapePolygon > convex_pieces = split_to_convex_recu ( ) ; if ( convex_pieces == null ) { return null ; } precalculated_convex_pieces = new ShapeTile [ convex_pieces . size ( ) ] ; Iterator < ShapePolygon > it = convex_pieces . iterator ( ) ; for ( int i = 0 ; i < precalculated_convex_pieces . length ; ++ i ) { ShapePolygon curr_piece = it . next ( ) ; precalculated_convex_pieces [ i ] = ShapeTile . get_instance ( curr_piece . corners ) ; } return precalculated_convex_pieces ; }
splits this polygon shape into convex pieces . the result is not exact , because rounded intersections of lines are used in the result pieces . it can be made exact , if polylines are returned instead of polygons , so that no intersection points are needed in the result .
