  #compact
  %filename "t.exe"
 'uses RTL64
  % Title "Intersection Demo"
 '% Animated
 '% ScaleUp
 '% PlaceCentral
 '% AnchorCentral
  uses consoleG
  uses GLO2\GeoPlanar

  sub drawintersections()
  =======================

  string tab="    "
  line   d1,d2
  point  p
  sys    a

  'shading
  'flat 'default

  'VERTICAL CROSS
  d1={-1,0.25,1,0.25}
  d2={0.50,-1,0.50,1}
  a=intersected d1,d2,p
  '
  color 0,1,1
  printl "CROSS" tab a tab p.x tab p.y
  move 2,-2
  color 0,1,0
  drawline @d1
  drawline @d2
  color 1,1,0
  pointsize 5
  drawpoint @p
  move -2,-2


  'DIAGONAL CROSS
  d1={-1,-1,1,1}
  d2={-1,4,1,-3}
  a=intersected d1,d2,p
  '
  color 0,1,1
  printl "DIAG" tab a tab str(p.x,2) tab str(p.y,2)
  move 2,-2
  color 0,1,0
  drawline @d1
  drawline @d2
  color 1,1,0
  pointsize 5
  drawpoint @p
  move -2,-2

  'TEE
  d1={-1,1,1,1}
  d2={0.50,-1,0.50,1}
  a=intersected d1,d2,p
  '
  color 0,1,1
  printl "TEE" tab a tab p.x tab p.y
  move 2,-2
  color 0,1,0
  drawline @d1
  drawline @d2
  color 1,1,0
  pointsize 5
  drawpoint @p
  move -2,-2

  'EL
  d1={-1,1,1,1}
  d2={-1,-1,-1,1}
  a=intersected d1,d2,p
  '
  color 0,1,1
  printl "EL" tab a tab p.x tab p.y
  move 2,-2
  color 0,1,0
  drawline @d1
  drawline @d2
  color 1,1,0
  pointsize 5
  drawpoint @p
  move -2,-2

  end sub

  sub main()
  ==========
  string s
  cls 0,0,0
  pushstate
  scale 2.,1.25
  'typeface=1
  printl "Intersection Points"
  popstate
  '
  move 0,-2
  '
  PushState
  move 1,-1
  DrawIntersections
  PopState
  '
  
  end sub

  EndScript
