public static List<Point2D> intersection(final Shape s1,final Shape s2){
  List<Point2D> intersections=new ArrayList<Point2D>(2);
  Line2D[] lines1=shapeToLines(s1,false);
  Line2D[] lines2=shapeToLines(s2,false);
  for (  Line2D l1 : lines1) {
    for (    Line2D l2 : lines2) {
      Point2D intersection=intersection(l1,l2);
      if (intersection != null) {
        intersections.add(intersection);
      }
    }
  }
  return intersections;
}

public static List < Point2D > intersection ( final Shape s1 , final Shape s2 ) { List < Point2D > intersections = new ArrayList < Point2D > ( 2 ) ; Line2D [ ] lines1 = shapeToLines ( s1 , false ) ; Line2D [ ] lines2 = shapeToLines ( s2 , false ) ; for ( Line2D l1 : lines1 ) { for ( Line2D l2 : lines2 ) { Point2D intersection = intersection ( l1 , l2 ) ; if ( intersection != null ) { intersections . add ( intersection ) ; } } } return intersections ; }
returns all intersection points of two shapes .
