my @slope = (($ne[1]-$nw[1])/($ne[0]-$nw[0]), ($se[1]-$sw[1])/($se[0]-$sw[0]), ($se[0]-$ne[0])/($se[1]-$ne[1]), ($sw[0]-$nw[0])/($sw[1]-$nw[1])); my @start = ($ne[1]-$ne[0]*$slope[0], $se[1]-$se[0]*$slope[1], $nw[0]-$nw[1]*$slope[2], $ne[0]-$ne[1]*$slope[3]); my $in_quad = $find[0]*$slope[0]+$start[0]>=$find[1] and $find[0]*$slope[1]+$start[1]<=$find[1] and $find[1]*$slope[2]+$start[2]>=$find[0] and $find[1]*$slope[3]+$start[3]<=$find[0]; #### $find[0]*$slopetop[0]+$start[0]>=$find[1]*$slopebot[0] #### $ne[1]*$slopebot[0]-$ne[0]*$slopetop[0]