CGI-Imagemap

 view release on metacpan or  search on metacpan

lib/CGI/Imagemap.pm  view on Meta::CPAN

    $x1 = $px[$i  ]; $y1 = $py[$i  ];
    $x2 = $px[$i+1]; $y2 = $py[$i+1];

    # Line is completely to the right of the Y axis
    next if( ($x1>0) && ($x2>0) );

    # Line doesn't intersect the X axis at all
    next if( (($y1<=>0)==($y2<=>0)) && (($y1!=0)&&($y2!=0)) );

    # Special case.. if the Y on the bottom=0, we ignore this intersection
    # (otherwise a line endpoint counts as 2 hits instead of 1)
    if( $y2>$y1 ){
      next if $y2==0;
    }
    elsif( $y1>$y2 ){
      next if $y1==0;
    }
    else {
      # Horizontal span overlaying the X axis.  Consider it an intersection 
      # iff. it extends into the left side of the X axis
      $intersections++ if ( ($x1 < 0) || ($x2 < 0) );



( run in 0.253 second using v1.01-cache-2.11-cpan-b61123c0432 )