Java Area Intersect intersection(Area a1, Area a2)

Here you can find the source of intersection(Area a1, Area a2)

Description

Check whether the two provided areas intersect one another.

License

Open Source License

Parameter

Parameter Description
a1 some area
a2 some other area

Return

true if there is a non-empty intersection

Declaration

public static boolean intersection(Area a1, Area a2) 

Method Source Code

//package com.java2s;
//  GNU Affero General Public License as published by the Free Software Foundation, either version

import java.awt.geom.Area;

public class Main {
    /**//  ww  w  . j a va  2  s .  co  m
     * Check whether the two provided areas intersect one another.
     *
     * @param a1 some area
     * @param a2 some other area
     * @return true if there is a non-empty intersection
     */
    public static boolean intersection(Area a1, Area a2) {
        Area copy = new Area(a1);
        copy.intersect(a2);

        return !copy.isEmpty();
    }
}

Related

  1. intersects(Area a, Area b)
  2. intersects(Area lhs, Area rhs)