Encyclopedia > Image:Pythagoras.png

  Article Content

Image:Pythagoras.png

Diagram illustrating Pythagoras theorem proof.

Produced by user Trainspotter using a program he wrote in the IDL language.

Program is listed below in case a modified version needs to be produced. (Program below is public domain, but IDL package itself is payware.)


 a=100. ; side A
 b=70.  ; side B
 m=3.   ; margin around plot
 s=2*m+a+b ; length of side of image
 r=(a+b)/2 ; offset (in each of x,y) from centre of 
           ;     image to corner of triangle
 c=m+(a+b)/2 ; position (in each of x,y) of centre of image
 set_plot,'z'
 device,set_res=[s,s]
 tek_color
 erase,1 ; white bg
 c1=15. ; distance to offset characters to centre
 c2=5.  ; extra y-offset for characters
 d=[[0,0,a,0],[0,b,0,0]]  ; vectors to triangle vertices
 d1=[[a,c1,a],[c1,b,b+1.5*c1]]/2  ; vectors to text labels
 lab=['a','b','c']
 cols=[0,2,4,8] ; predefined indices in tek_color
 rot=[[0,-1],[1,0]] ; 90deg rotation matrix
 ori=[[1,0],[0,1]]  ; current rotation matrix
 for i=0,3 do begin ; loop over triangles
     pos=[c,c]+ori##[-r,-r]  ; corner of triangle (use as plot offset)
     draw=ori##d     ; relative vectors allowing for rotation
     label=ori##d1   ; (likewise)
     plots,pos[0]+draw[*,0],pos[1]+draw[*,1],/device,col=cols[i]
     xyouts,pos[0]+label[*,0],pos[1]+label[*,1]-c2,/device,col=cols[i],lab, $
       align=0.5,charsize=1.2   
     ori=rot##ori
 endfor
 image=tvrd()
 tvlct,rr,gg,bb,/get
 write_png,'pythagoras.png',image,rr,gg,bb
 end

Image links

There are no pages that link to this image.



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
242

... century Decades: 190s 200s 210s 220s 230s - 240s - 250s 260s 270s 280s 290s Years: 237 238 239 240 241 - 242 - 243 244 245 246 247 Events Patriarch Titus[?] ...

 
 
 
This page was created in 25.1 ms