Help for this page

Select Code to Download


  1. or download this
    use Math::Trig qw(pi);
    $angle = atan2($v2->{y}, $v2->{x}) - atan2($v1->{y}, $v1->{x});
    # and normalize the angle to be in the range [-pi, pi]
    my $rounds = floor(($angle + pi) / (2 * pi));
    $angle -= 2 * pi * $rounds;
    
  2. or download this
    
    my %polygon = map { $_ => 1 } @polygon, @polygon_holes;
    @edges = grep { !$polygon{$_} } @edges