#チャーチのコリジョン調整用
$Range = 3;

while (<>) {
	SWITCH: {
		if (($ax, $ay, $bx, $by) = /^##through_wall\s+([\-\d\.]+)\s+([\-\d\.]+)\s+([\-\d\.]+)\s+([\-\d\.]+)/) {
			$len = &get_length($ax, $ay);
			$scale = ($len - $Range) / $len;
			$ax *= $scale; $ay *= $scale;
			
			$len = &get_length($bx, $by);
			$scale = ($len - $Range) / $len;
			$bx *= $scale; $by *= $scale;
			printf "through_wall  %f %f  %f %f\n", $ax, $ay, $bx, $by;
			last SWITCH;
		}
		
		if (($ax, $ay, $bx, $by) = /^##wall\s+([\-\d\.]+)\s+([\-\d\.]+)\s+([\-\d\.]+)\s+([\-\d\.]+)/) {
			$len = &get_length($ax, $ay);
			$scale = ($len - $Range) / $len;
			$ax *= $scale; $ay *= $scale;
			
			$len = &get_length($bx, $by);
			$scale = ($len - $Range) / $len;
			$bx *= $scale; $by *= $scale;
			printf "wall  %f %f  %f %f\n", $ax, $ay, $bx, $by;
			last SWITCH;
		}
		
		if (($ax, $ay, $bx, $by, $cx, $cy) = /^##floor\s+([\-\d\.]+)\s+\d+\s+([\-\d\.]+)\s+([\-\d\.]+)\s+\d+\s+([\-\d\.]+)\s+([\-\d\.]+)\s+\d+\s+([\-\d\.]+)/) {
			$len = &get_length($ax, $ay);
			$scale = ($len - $Range) / $len;
			$ax *= $scale; $ay *= $scale;
			
			$len = &get_length($bx, $by);
			$scale = ($len - $Range) / $len;
			$bx *= $scale; $by *= $scale;
			
			$len = &get_length($cx, $cy);
			$scale = ($len - $Range) / $len;
			$cx *= $scale; $cy *= $scale;
			printf "floor  %f 0 %f  %f 0 %f  %f 0 %f\n", $ax, $ay, $bx, $by, $cx, $cy;
			last SWITCH;
		}
		print;
	}
}

sub get_length
{
	my ($x, $y) = @_;
	
	return sqrt($x * $x + $y * $y);
}

