.PS                            # Pic input begins with .PS
# cct_init Version 7.7.1: PSTricks m4 macro settings.
  
  # gen_init Version 7.7.1: PSTricks m4 macro settings.
  

  define rpoint__ {
    rp_wid = last line.end.x-last line.start.x
    rp_ht = last line.end.y-last line.start.y
    rp_len = sqrt((rp_wid)^2+(rp_ht)^2); move to last line.start
        rp_ang = atan2(rp_ht,rp_wid) }

  rp_ang = 0;  right
  rtod_ = 57.295779513082323
  dtor_ = 0.017453292519943295
  twopi_ = 6.2831853071795862
  pi_ = (twopi_/2)

  linethick = 0.8
  arrowwid = 0.05*scale; arrowht = 0.1*scale
  command "\psset{linewidth=0.8pt}%";
  command "\psset{noCurrentPoint}%"
  
    # gen_init end

  \psset{arrowsize=1.1pt 4,arrowlength=1.64,arrowinset=0}%


# cct_init end
                       # Read in macro definitions and set defaults

elen = 0.75                    # Variables are allowed; default units are inches
Origin: Here                   # Position names are capitalized
   line invis  up elen
  rpoint__
  
   
  { line to Here+((rp_len/2-(0.25*linewid))*(cos(rp_ang)),(rp_len/2-(0.25*linewid))*(sin(rp_ang)))
    move to Here+(((0.25*linewid))*(cos(rp_ang)),((0.25*linewid))*(sin(rp_ang)))
  { circle rad (0.25*linewid)  at Here }
    
  line from Here+(((0.25*linewid))*(cos(rp_ang)),((0.25*linewid))*(sin(rp_ang))) \
          to Here+((rp_len/2)*(cos(rp_ang)),(rp_len/2)*(sin(rp_ang)))} 
  { [box invis wid (0.25*linewid)*2 ht (0.25*linewid)*2] at Here+((rp_len/2)*(cos(rp_ang)),(rp_len/2)*(sin(rp_ang))) }
  line to Here+((rp_len)*(cos(rp_ang)),(rp_len)*(sin(rp_ang))) invis ;  {"$ -$" \
     at last [].s rjust below }; {"$ v_s$" \
     at last [].w rjust }; {"$ +$" \
     at last [].n rjust above }; 
      line invis  right elen
  rpoint__
  
   
          if linewid/6/4*6*2 > rp_len then { line invis to Here+((linewid/6/4*6*2)*(cos(rp_ang)),(linewid/6/4*6*2)*(sin(rp_ang)))
  rpoint__
  
    }
    M4_xyO: last line.c
    { line from last line.start to M4_xyO+(((linewid/6/4)*(-6))*(cos(rp_ang)),((linewid/6/4)*(-6))*(sin(rp_ang)))\
       then to M4_xyO+(((linewid/6/4)*(-5))*(cos(rp_ang))+((linewid/6/4)*((2)))*((-sin(rp_ang))),((linewid/6/4)*(-5))*(sin(rp_ang))+((linewid/6/4)*((2)))*(cos(rp_ang))) \
         then to M4_xyO+(((linewid/6/4)*(-3))*(cos(rp_ang))+((linewid/6/4)*((-2)))*((-sin(rp_ang))),((linewid/6/4)*(-3))*(sin(rp_ang))+((linewid/6/4)*((-2)))*(cos(rp_ang))) \
   then to M4_xyO+((-(linewid/6/4))*(cos(rp_ang))+((linewid/6/4)*((2)))*((-sin(rp_ang))),(-(linewid/6/4))*(sin(rp_ang))+((linewid/6/4)*((2)))*(cos(rp_ang))) \
         then to M4_xyO+((linewid/6/4)*(cos(rp_ang))+((linewid/6/4)*((-2)))*((-sin(rp_ang))),(linewid/6/4)*(sin(rp_ang))+((linewid/6/4)*((-2)))*(cos(rp_ang))) \
   then to M4_xyO+(((linewid/6/4)*(3))*(cos(rp_ang))+((linewid/6/4)*((2)))*((-sin(rp_ang))),((linewid/6/4)*(3))*(sin(rp_ang))+((linewid/6/4)*((2)))*(cos(rp_ang))) \
         then to M4_xyO+(((linewid/6/4)*(5))*(cos(rp_ang))+((linewid/6/4)*((-2)))*((-sin(rp_ang))),((linewid/6/4)*(5))*(sin(rp_ang))+((linewid/6/4)*((-2)))*(cos(rp_ang))) \
           then to M4_xyO+(((linewid/6/4)*(6))*(cos(rp_ang)),((linewid/6/4)*(6))*(sin(rp_ang))) \
         then to last line.end
      [box invis ht linewid/6/4*2*2 wid linewid/6/4*6*2] at 2nd last line.c
      }
  
  
  line invis from 2nd last line.start to 2nd last line.end ;    {"$ R$" \
     at last [].s below };  
   [  circle rad (0.04*linewid)  fill 0 
  ] with .c at Here
  move to last [].c
   {                           # Save the current position and direction
      line invis  down to (Here,Origin)
  rpoint__
  
   
      {           line to Here+((rp_len/2-linewid/3*0.3/2)*(cos(rp_ang)),(rp_len/2-linewid/3*0.3/2)*(sin(rp_ang)))
      {line from Here+((-linewid/3/2)*((-sin(rp_ang))),(-linewid/3/2)*(cos(rp_ang))) \
          to Here+((linewid/3/2)*((-sin(rp_ang))),(linewid/3/2)*(cos(rp_ang)))}
      move to Here+((linewid/3*0.3)*(cos(rp_ang)),(linewid/3*0.3)*(sin(rp_ang)))
      {line from Here+((-linewid/3/2)*((-sin(rp_ang))),(-linewid/3/2)*(cos(rp_ang))) \
          to Here+((linewid/3/2)*((-sin(rp_ang))),(linewid/3/2)*(cos(rp_ang)))}
      line to Here+((rp_len/2-linewid/3*0.3/2)*(cos(rp_ang)),(rp_len/2-linewid/3*0.3/2)*(sin(rp_ang)))  }
  
  {[box invis wid linewid/3 ht linewid/3*0.3 ] at Here+((rp_len/2)*(cos(rp_ang)),(rp_len/2)*(sin(rp_ang)))}
  line to Here+((rp_len)*(cos(rp_ang)),(rp_len)*(sin(rp_ang))) invis      #(Here,Origin) = (Here.x,Origin.y)
       {"$ +$" \
     at last [].n rjust above }; {"$ v$" \
     at last [].l rjust }; {"$ -$" \
     at last [].s rjust below }; ;   {"$ C$" \
     at last [].e ljust };  
      [  circle rad (0.04*linewid)  fill 0 
  ] with .c at Here
  move to last [].c
      }                        # Restore position and direction
   line  right elen*2/3
   line invis  down Here.y-Origin.y
  rpoint__
  
   
      { line to Here+(((rp_len-4*linewid/16*2)/2)*(cos(rp_ang)),((rp_len-4*linewid/16*2)/2)*(sin(rp_ang)))
   {line to Here+((-linethick/2 *(scale/72))*((-sin(rp_ang))),(-linethick/2 *(scale/72))*(cos(rp_ang)))};
   for m4i=1 to 4 do {
     arc cw from Here to Here+((linewid/16*2)*(cos(rp_ang)),(linewid/16*2)*(sin(rp_ang))) with .c at Here+((linewid/16)*(cos(rp_ang)),(linewid/16)*(sin(rp_ang)))
     {line to Here+((-linethick/2 *(scale/72))*((-sin(rp_ang))),(-linethick/2 *(scale/72))*(cos(rp_ang)))} }
   line to Here+(((rp_len-4*linewid/16*2)/2)*(cos(rp_ang)),((rp_len-4*linewid/16*2)/2)*(sin(rp_ang)))} 
 
 {[box invis wid linewid/16+0+0 ht 4*linewid/16*2] \
   at Here+((rp_len/2)*(cos(rp_ang))+((linewid/16+0-0)/2)*((-sin(rp_ang))),(rp_len/2)*(sin(rp_ang))+((linewid/16+0-0)/2)*(cos(rp_ang)))}
 line to Here+((rp_len)*(cos(rp_ang)),(rp_len)*(sin(rp_ang))) invis ;   {"$ L$" \
     at last [].l rjust };  ;     
  { move to last line.start+((((rp_len-last [].ht)/2*2/3+arrowht/3))*(cos(rp_ang)),(((rp_len-last [].ht)/2*2/3+arrowht/3))*(sin(rp_ang)))
    arrow <- to Here+((-arrowht)*(cos(rp_ang)),(-arrowht)*(sin(rp_ang))) "$ i$" \
     ljust}
   line to Origin
.PE                            # Pic input ends
