Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Bindings for the Boost Geometry library
C++ Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/Boost/Geometry
src
t
xsp
.gitignore
Build.PL
MANIFEST.SKIP
README.pod
dist.ini

README.pod

NAME

Boost::Geometry::Utils - Bindings for the Boost Geometry library

VERSION

version 0.04

SYNOPSIS

    use Boost::Geometry::Utils qw(polygon linestring polygon_linestring_intersection);
    
    my $square = [  # ccw
        [10, 10],
        [20, 10],
        [20, 20],
        [10, 20],
    ];
    my $hole_in_square = [  # cw
        [14, 14],
        [14, 16],
        [16, 16],
        [16, 14],
    ];
    my $polygon = polygon($square, $hole_in_square);
    my $linestring = linestring([ [5, 15], [30, 15] ]);
    
    my $intersection = polygon_linestring_intersection($polygon, $linestring);
    
    # $intersection is:
    # [
    #     [ [10, 15], [14, 15] ],
    #     [ [16, 15], [20, 15] ],
    # ]

ABSTRACT

This module provides bindings to perform some geometric operations using the Boost Geometry library. It does not aim at providing full bindings for such library, and that's why I left the Boost::Geometry namespace free. I'm unsure about the optimal architectural for providing full bindings, but I'm interested in such a project -- so, if you have ideas please get in touch with me.

Warning: the API could change in the future.

METHODS

polygon

Converts one or more arrayref(s) of points to a Boost Geometry polygon structure. Note that a Boost Geometry polygon is actually a polygon with holes.

linestring

Converts an arrayref of points to a Boost Geometry linestring.

polygon_linestring_intersection

Performs an intersection between the supplied polygon and linestring, and returns an arrayref of linestrings (represented as arrayrefs of points). Note that such an intersection is also called clipping.

polygon_to_wkt

Converts one or more arrayref(s) of points to a WKT representation of a polygon (with holes).

linestring_to_wkt

Converts an arrayref of points to a WKT representation of a multilinestring.

wkt_to_multilinestring

Parses a MULTILINESTRING back to a Perl data structure.

ACKNOWLEDGEMENTS

Thanks to mauke and mst (Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>) for their valuable help in getting this to compile under Windows (MinGW) too.

AUTHOR

Alessandro Ranellucci <aar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Alessandro Ranellucci.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Something went wrong with that request. Please try again.