NAME
Math::Geometry::Construction::Line
- line through two points
VERSION
Version 0.020
SYNOPSIS
my $p1 = $construction->add_point('x' => 100, 'y' => 90);
my $p2 = $construction->add_point('x' => 120, 'y' => 150);
my $l1 = $construction->add_line(support => [$p1, $p2]);
my $p3 = $construction->add_point('x' => 200, 'y' => 50);
my $p4 = $construction->add_point('x' => 250, 'y' => 50);
my $l2 = $construction->add_line(support => [$p3, $p4],
extend => 10,
label => 'g',
label_offset_y => 13);
DESCRIPTION
An instance of this class represents a line defined by two points. The points can be either points defined directly by the user (Math::Geometry::Construction::Point objects) or so-called derived points (Math::Geometry::Construction::DerivedPoint objects), e.g. intersection points. This class is not supposed to be instantiated directly. Use the add_line method of Math::Geometry::Construction
instead.
INTERFACE
Public Attributes
support
Holds an array reference of the two points that define the line. Must be given to the constructor and should not be touched afterwards (the points can change their positions, of course). Must hold exactly two points.
extend
Often it looks nicer if the visual representation of a line extends somewhat beyond its end points. The length of this extent is set here. Internally, this is an array reference with two entries containing the exent in backward in forward direction. If a single value x
is provided it is turned into [x, x]
. Defaults to [0, 0]
.
Take care if you are reading this attribute. You get the internal array reference, so manipulating it will affect the values stored in the object.
Methods
normal
Returns a Math::Vector::Real of length 1
that is orthogonal to the line.
draw
Called by the Construction
object during output generation. Draws a line between the most extreme points on this line (including both support points and points derived from this line). The line is extended by length of extend beyond these points.
id_template
Class method returning $ID_TEMPLATE
, which defaults to 'L%09d'
.
AUTHOR
Lutz Gehlen, <perl at lutzgehlen.de>
LICENSE AND COPYRIGHT
Copyright 2011-2012 Lutz Gehlen.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.