#!/usr/bin/perl

open(OLD1, $ARGV[0]);
$n=0;
while(<OLD1>)
{
    @data=split(/\s+/);
    push(@x,$data[0]);
    push(@y,$data[1]);
    push(@z,$data[2]);
    push(@t,$data[3]);
    $n++;
}

#print "$ARGV[0]\n";

$file=$ARGV[0].".inter";
open(OUT,">$file");

for($nn=0; $nn<($n-1); $nn++)
{
    if(($x[$nn]<4.5) && ($x[$nn]>-4)){
	if($y[$nn]<3 && $y[$nn]>-10){

    print OUT "$x[$nn] $y[$nn] $z[$nn] 0\n";
    
    $xmid=($x[$nn]+$x[$nn+1])/2;
    $ymid=($y[$nn]+$y[$nn+1])/2;
    $zmid=($z[$nn]+$z[$nn+1])/2;
    
    print OUT "$xmid $ymid $zmid 0\n";

	}}
}
   

