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


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


  type linex
    float x1,y1 'first point
    float x2,y2 'second point
    float le    'length
    int dl      'deletion flag
    int p1,p2   'point indexes
  end type

   % q=31

  string tab="    "
  point  p
  int    a
  float le

  seed=0x12379823

  static MoveableObject pn[100]
  static linex dn[10000]
  float r[16]
  indexbase 0


 int i,j,k
  '
  '
  'POLYGONS

  point qn[q]

  if opening
    qn[0]={0,0}
    CreatePolypoints qn[1],0,0,15,1,1,0
    CreatePolypoints qn[16],0.03,0.04,15,0.7,0.75,12.5

    MoveableObject *mp
    for i=0 to q-1
      @mp=@pn[i]
      mp.id=500+i*100
      mp.mode=0x111
      mp.x=10*qn[i].x
      mp.y=10*qn[i].y
      mp.s.x=1.0
      mp.s.y=1.0
      mp.s.z=1.0
      mp.sa.x=1.0
      mp.sa.y=1.0
      mp.sa.z=1.0
    next
  endif 'opening

  k=0
  float x,y
  int qh=(q-1)/2
  int mi,mj
  j=0
  'CLEAR HUB LINE REFS
  for i=0 to q-1
    pn[i].n=0
  next
  '

  shading
  'flat
  move 10,-10
  color 1,1,0
  for i=0 to q-1
    pushstate
      pn[i].act
      scale 4
      'scale 1,1,2
      scale 2,2,3
      'color i/q,1,1-i/q
      'color i/q,1,1-i/q
      color arnd,arnd,.8*arnd
      go sphere
    popstate
  next
  picklabel 0
  end sub


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

  EndScript
