!! dtermination de la face du segment 
 faceseg = !listintersect $(face$cept1) and $(face$cept2)
!!debug $faceseg $(face$cept1) $(face$cept2) $cept1 $cept2
  !if $faceseg=
    error = pasmemeface
  !else

!! dtermination de la pente du segment
     den =!eval ($(pt$cept1[1])) - ($(pt$cept2[1]))
     num =!eval ($(pt$cept1[2])) - ($(pt$cept2[2]))
!! dtermination de tous les points  tester
     lstpts=
     !for jj=1 to 4
        lstpts = !append item $(sommet$faceseg[$jj]) to $lstpts
     !next
     !for jj=1 to 4
        pt=$(milieu$faceseg[$jj])
        lstpts = !append item $pt to $lstpts
        !for kk=1 to 6
            lstpts = !append item $pt$kk to $lstpts
        !next
     !next
!! test de tous ces points pour bonne pente
     trouvept=0
     pttrouve=
!!debug $pt, points:$lstpts
     n1=!itemcnt $lstpts
     !for ii=1 to $n1
        den2=!eval ($(pt$cept1[1])) - ($(pt$(lstpts[$ii])[1]))
        num2 =!eval ($(pt$cept1[2])) - ($(pt$(lstpts[$ii])[2]))
        colin=!eval $den2 * $num - $den * $num2
        !if $colin<0.001 and $colin>-0.001
          pttrouve=!append item $(lstpts[$ii]) to $pttrouve
          !advance trouvept
          !if $trouvept=2
            !break
          !endif
        !endif
      !!if $ii=12
        !!debug $(lstpts[$ii]) $den2 $num2 colin=$colin pt:$pttrouve
      !!endif
     !next
!!debug $trouvept, $pttrouve,  $num/$den et $num2/$den2 
     diffx=!eval ($(pt$cept1[1])) - ($(pt$cept2[1])
     !if $diffx>0
        pt4=$cept1
        pt1=$cept2
     !else
        pt1=$cept1
        pt4=$cept2
     !endif
     diffx=!eval ($(pt$(pttrouve[1])[1])) - ($(pt$(pttrouve[2])[1]))
     !if $diffx>0
        cept2=$(pttrouve[1])
        cept1=$(pttrouve[2])
     !else
        cept1=$(pttrouve[1])
        cept2=$(pttrouve[2])
     !endif
       ptsplan = !replace item $pt1 by $cept1 in $ptsplan
       ptsplan = !replace item $pt4 by $cept2 in $ptsplan
       ptsplan = !sort item $ptsplan
       color$cept1=red
       color$cept2=red

     linesubst=linewidth 1\
     dline $(pt$pt1),$(pt$cept1),green\
     dline $(pt$cept2),$(pt$pt4),green\
     linewidth 3
     subst=1
