Salvador Fandiño García


Math::Geometry::IntersectionArea - Calculate area of geometric shapes intersection


  use Math::Geometry::IntersectionArea qw(intersection_area_circle_rectangle);

  my $area = intersection_area_circle_rectangle([1,4], 2, [0, 1], [5, 5]);


This module provides functions to calculate the area of the intersection of several combinations of geometric shapes.

Geometric coordinates are defined with bidimensional vectors from the class Math::Vector::Real. Alternatively, for convenience, all the subroutines accept also raw array references (e.g. [1,3]).

Well, currently only intersections between circles and polygons are supported. If you need to calculate the intersection between other combinations of geometric shapes these are your options:

1) Convince me to extend the module with the functionality you need.

2) Extend it yourself and send me a patch for inclusion (though, it would be highly advisable to discuss the matter first).

In any case, don't hesitate to get in touch with me. I love geometrical problems :-)


intersection_area_circle_polygon($o, $r, @p)

Returns the area of the intersection between the circle of radius $r centered in $o and the polygon delimited by the list of points in @p.

intersection_area_rectangle($o, $r, $v0, $v1)

Return the area of the intersection between the circle of radius $r with center in $o and the axis-aligned rectangle defined by its two corners $v0 and $v1.


Math::Vector::Real, Math::Vector::Real::XS.


Copyright (C) 2014 by Salvador Fandiño <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 215:

Non-ASCII character seen before =encoding in 'Fandiño'. Assuming UTF-8