NB. Indra's perl NB. include first require 'plot trig numeric gl2 png ' coinsert 'jgl2' NB. object gl2 load '~addons/graphics/fvj4/dwin.ijs' NB. ----------------------- hpath=: '~temp/graphics/hokusai/hokusai_j8/dwin/' NB. define yourself NB. require hpath,'/hokusai_tool_improve2.ijs' NB. require hpath,'/hokusai_tool_bezier.ijs' NB. ************************************** NB. homogeneous Coordinates NB. elongation(scaling) rotate transpose elongm=: 3 : '(y,1)* =i.3' NB. elongm 2 3 rotm=: (cos, sin,0:),(-@sin,cos,0:),: 0: ,0:,1: NB. rotm 1r4p1 transm=: 3 : '(=i.2), y,1' NB. transm 2 3 mp=: +/ . * NB. inner products NB. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WIN_WH=: 640 640 NB. @@@@@@@@@@@@@@@@@@@@@@@@@ NB. tiny utils mk_complex=: ({. j. {:)"1 NB. 2line matrix--> complex mk_polygon=: 3 : ' ({.y),~y' NB. connect for polygon NB. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ dline1=: 3 : 0"1 2 0 0 0 dline y : Y=.x:^:_1 SC 2{."1 y wd 'psel ',WIN_nam glrgb x glbrush '' glpen 1 1 gllines <.0.5+,Y ' '[glpaint '' ) NB. ----------------------- NB. example NB. horizontal DATH=: (0 1,: 1 1);(0 0.8,: 1 0.8);(0 0.6,: 1 0.6) DATH=: DATH,(0 0.4,: 1 0.4);(0 0.2 ,: 1 0.2);(0 0 ,: 1 0) NB. vertical DATV=: (0 1,: 0 0);(0.2 1,: 0.2 0);( 0.4 1,: 0.4 0) DATV=: DATV,(0.6 1,: 0.6 0);(0.8 1 ,: 0.8 0);(1 1 ,: 1 0) euler=: 3 : ' > L:1+.@ r.@ ({. j. {:)L:0 { L:0 y' NB. -----------circle------------------- NB. plot r. steps _1p1 1p1 100 NB. Usage: plot archi 1 24p1 1000 NB. Archimedes spiral archi=: 3 : 't r. t=. steps y' NB. Bernulle Spiral NB. plot (^t*0.1) r. t=.steps 0 36 360 bernulle=: 3 : '(^0.07*t) r. t=. steps y' NB. popup dwin automatically minmax0=: <./,>./ find_minmax=: 3 : 0 minmax0&minmax0 > minmax0&minmax0 L:0 y ) open_dwin=: 3 : 0 NB. Usage: open_dwin S10// L:0 DATH tmp0=.>. 2 # _2 1 + find_minmax y NB. tmp0=.>. 2 # find_minmax y tmp0 dwin '' ) spiral_dline=: 4 : 0 NB. OK NB. y is complx NB. (bernulle 0 2p1 36) spiral_dline SC1 tmp0=. +. L:0 y * L:0 {@> x tmp1=. find_minmax tmp0 (>. 2 # _2 0 + tmp1) dwin '' 60 60 120 dline L:0 tmp0 )