NAME

Geo::Geos::LineSegment - Represents a line segment defined by two Coordinates.

SYNOPSIS

use Geo::Geos::Coordinate;
use Geo::Geos::LineSegment;
use Geo::Geos::Algorithm qw/TYPE_ORIENT_RIGHT TYPE_ORIENT_LEFT TYPE_ORIENT_STRAIGHT/;


Geo::Geos::LineSegment->new;     # => isa 'Geo::Geos::LineSegment'

my $c1 = Geo::Geos::Coordinate->new(1, 1);
my $c2 = Geo::Geos::Coordinate->new(5, 1);
my $ls = Geo::Geos::LineSegment->new($c1, $c2);  # => isa 'Geo::Geos::LineSegment'

$ls->getLength;     # => 4
$ls->isHorizontal;  # => success
$ls->isVertical;    # => ''

my $c3 = Geo::Geos::Coordinate->new(1, 0);
my $c4 = Geo::Geos::Coordinate->new(5, 0);
$ls->setCoordinates($c3, $c4);
$ls->p0;    # => Geo::Geos::Coordinate->new(1, 0);
$ls->p1;    # => Geo::Geos::Coordinate->new(5, 0);

$ls->orientationIndex($c2); # => TYPE_ORIENT_STRAIGHT
$ls->orientationIndex($ls); # => TYPE_ORIENT_LEFT

SEE ALSO (C++ classes docs)

GEOS C++ Library

geos::geom::LineSegment

SEE ALSO

Geo::Geos

Geo::Geos::Algorithm

Geo::Geos::Index::MonotoneChain

AUTHOR

Ivan Baidakou <i.baydakov@crazypanda.ru>, Crazy Panda, CP Decision LTD

LICENSE

You may distribute this code under the same terms as Perl itself.