cross {
set %x11 $1
set %y11 $2
set %x12 $3
set %y12 $4
set %x21 $5
set %y21 $6
set %x22 $7
set %y22 $8
if (( %x11 == %x12 ) || ( %x21 == %x22 )) { return }
set %k1 $calc( ( %y12 - %y11 ) / ( %x12 - %x11 ) )
set %k2 $calc( ( %y22 - %y21 ) / ( %x22 - %x21 ) )
if ( %k1 == %k2 ) { return }
set %x $calc( ( - %k1 * %x11 + %y11 - %y21 + %k2 * %x21 ) / ( %k2 - %k1 ) )
set %y $calc( %k1 * ( %x - %x11 ) + %y11 )
return %x %y
}