my $xdelta = $x1-$x2; my $ydelta = $y1-$y2; my $distance_squared = $xdelta*$xdelta + $ydelta*$ydelta;