$n=<>; for(1..$n){ ($t,$p,$w,$v,$gx,$gy)=glob<>; $v+=1; $r=sqrt($v*$v+$w*$w); $z=0; for(1..$t){ $z+=$r**(2*($t-$_)); } $a=atan2($w,$v); { $c=cos($a*$t); $s=sin($a*$t); $dx=($gx-$c*$r**$t)/$z; $dy=($gy-$s*$r**$t)/$z; } for(1..$t){ $c=cos($a*($_-$t)); $s=sin($a*($_-$t)); $x=($dx*$c-$dy*$s)*$r**($t-$_); $y=($dx*$s+$dy*$c)*$r**($t-$_); print $x," ",$y,"\n"; } }