Code example for Matrix

Methods: invertsetRotate

     * @param bound rectangle to rotate 
     * @param rot angle of rotation about rectangle center 
     * @return true if point is within rotated rectangle 
    public static boolean pointInRotatedRect(float[] point, RectF bound, float rot) {
        Matrix m = new Matrix();
        float[] p = Arrays.copyOf(point, 2);
        m.setRotate(rot, bound.centerX(), bound.centerY());
        Matrix m0 = new Matrix();
        if (!m.invert(m0))
            return false; 
        return inclusiveContains(bound, p[0], p[1]);
     * Checks if a given point is within a rotated rectangle. 
     * @param point 2D point to check 
     * @param rotatedRect corners of a rotated rectangle