# origin
def O (0,0,0)
def s1 [fillcolor=red]
def s2 [linewidth=.2pt,linestyle=dotted]

def sweeptorus {
  def N 80
  put { translate([1,0,0]) } { 
    sweep[s1,s2]{N, rotate(360/N, (-1,0,0), [0,1,0]) } { 
      line(0,-1,0)(1,-1,0)(1,1,0)(0,1,0)(0,-1,0) 
    }
  }
}

def tori {
    put { translate([-2.2,0,0]) } {sweeptorus}
    put { rotate(-30, (O), [0,0,1]) then translate([2.2,.5,0]) } {sweeptorus}
}

def sceneProjection {

  put { rotate(20, (O), [0,0,1]) then 
        rotate(30, (O), [1,0,0]) then 
        translate([0,0,-10]) then 
        perspective(7) } {tori}
}

{sceneProjection}

global {
  set [linewidth=.1pt]
  picturebox (-2,-2)(2,2)
  frame
}
