Math::Vector::Real::Polyline - Algorithms related to polylines.
use Math::Vector::Real::Polyline; my $poly1 = Math::Vector::Polyline->new(@vectors1); my $poly2 = Math::Vector::Polyline->new(@vectors2); my $d = $poly1->dist_to_polyline(@poly2); printf "The distance between %s and %s is %f", $poly1, $poly2, $d;
This module implements several algorithms related to polygonal chains or polylines.
Note that the module can handle polylines in spaces of any dimension (not just 2D).
- $p = Math::Vector::Polyline->new(@vectors)
Creates a new polyline object.
- $d2 = $p->dist2_to_point($v)
Returns the square of the distance from the polyline to the given point.
- $d2 = $p->dist2_to_segment($a, $b)
Returns the square of the distance from the polyline to the segment with the given vertices.
- $d2 = $p->dist2_to_polyline($p1)
Returns the square of the distance between both polylines.
Copyright (C) 2017 by Salvador Fandiño <email@example.com>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.