[CODE]public static boolean cricleVsRect(PCircle c, PRectangle p){

if(p.containsPoint(PVector.add(c.getLocation(), new PVector(0, c.getRadius())))

|| p.containsPoint(PVector.add(c.getLocation(), new PVector(0, -c.getRadius())))

|| p.containsPoint(PVector.add(c.getLocation(), new PVector(c.getRadius(),0)))

|| p.containsPoint(PVector.add(c.getLocation(), new PVector(-c.getRadius(),0)))){

return true;

}

if(c.containsPoint(p.getLocation())

|| c.containsPoint(PVector.add(p.getLocation(), new PVector(p.getWidth(), 0)))

|| c.containsPoint(PVector.add(p.getLocation(), new PVector(0, p.getHeight())))

|| c.containsPoint(PVector.add(p.getLocation(), new PVector(p.getWidth(), p.getHeight())))

)

return true;

return false;

}

[/CODE]

"[rectangle].getLocation()" returns the upper left corner of the rectangle.

"[circle].getLocation()" returns the middle of the circle.

If it's possible to solve it faster, feel free to critizise

best regards