CAD-Drawing
view release on metacpan or search on metacpan
lib/CAD/Drawing.pm view on Meta::CPAN
Options are the same as for addpolygon but closed is forced to false.
=cut
sub add_fake_ray {
my $self = shift;
my ($points, $opt) = @_;
my %opts;
(ref($opt) eq "HASH") && (%opts = %$opt);
# maybe we should allow three, since we actually use three?
(scalar(@$points) == 2) or croak("cannot draw ray without 2 points");
# use a percentage of length, with a 15deg rotation ccw from
# reversed direction (later, add options.)
my $portion = 0.05;
my $rotate = $pi / 12;
my $rev = NewVec(line_vec(@$points)->ScalarMult($portion * -1));
my $length = $rev->Length();
my $ang = $rev->Ang() + $rotate;
my $vec = unit_angle($ang);
$vec = NewVec($vec->ScalarMult($length));
my @end = $vec->Plus($points->[1]);
$opts{closed} = 0;
( run in 0.387 second using v1.01-cache-2.11-cpan-709fd43a63f )