Math::Geometry::Construction::Line - line through two points
Math::Geometry::Construction::Line
Version 0.024
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);
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.
Math::Geometry::Construction
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.
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].
x
[x, x]
[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.
Returns the unnormalized difference vector between the two support points as a Math::Vector::Real. Issues a warning and returns undef if one of the support points has an undefined position. If the support points have identical positions the 0 vector is returned without warning.
undef
0
Returns a Math::Vector::Real of length 1 that is parallel to the line. Issues a warning and returns undef if one of the support points has an undefined position or if the two positions are identical.
1
Returns a Math::Vector::Real of length 1 that is orthogonal to the line. Issues a warning and returns undef if one of the support points has an undefined position or if the two positions are identical.
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.
Construction
Class method returning $ID_TEMPLATE, which defaults to 'L%09d'.
$ID_TEMPLATE
'L%09d'
Lutz Gehlen, <perl at lutzgehlen.de>
<perl at lutzgehlen.de>
Copyright 2011-2013 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.
To install Math::Geometry::Construction, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Geometry::Construction
CPAN shell
perl -MCPAN -e shell install Math::Geometry::Construction
For more information on module installation, please visit the detailed CPAN module installation guide.