CAD-Calc

 view release on metacpan or  search on metacpan

lib/CAD/Calc.pm  view on Meta::CPAN


  my @rec = line_to_rectangle(\@line, $offset, \%options);

The direction of the returned points will be counter-clockwise around
the original line, with the first point at the 'lower-left' (e.g. if
your line points up, $rec[0] will be below and to the left of
$line[0].)  

Available options

  ends => 1|0,   # extend endpoints by $offset (default = 1)

=cut
sub line_to_rectangle {
	my ($ln, $offset, $opts) = @_;
	my %options = (ends => 1);
	(ref($opts) eq "HASH") && (%options = %$opts);
	my @line = @$ln;
	($offset > 0) or
		croak "offset ($offset) must be positive non-zero\n";
	my $a = NewVec(@{$line[0]});

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.004 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )