// Ring of sample particles around origin // Last edited on 2012-09-29 05:40:18 by stolfilocal #include "arrow.inc" #macro sample_ring(crv,A,B,C,D, Rc,rc,txt, np,rp,txpr,txpc, ra,ma,txar,txac, rel,Rf) // {crv,A,B,C,D} Flow parameters. // {Rc} Major radius of sample circle. // {rc} Minor radius of sample circle. // {txc} Texture of sample circle. // {np} Number of particles in ring. // {rp} Radius of particle. // {txpr} Texture of particles in ring. // {txpc} Texture of central particle. // {ra} Radius of arrow shaft. // {ma} Length magnification factor. // {txar} Texture for ring particle arrows. // {txac} Texture for central particle arrow. // {rel} True for relative velocities, false for absolute ones // {Rf} Half-width, half-height of figure. #local ptic = sphere{ <0,0,0>,rp } #local dt = 360/np; union{ #local po = < 0,0,0 >; // Reference particle at origin. #local vo = flow_velocity(crv,A,B,C,D, 0,0); // Velocity of reference particle. object{ ptic texture{ txpc } translate po } #if (! rel) object{ arrow(ma*vo,ra) texture{ txac } translate po } #end torus{ Rc,rc rotate 90*x texture{ txc } translate po } #local tshift = 1/3; #local i = 0; #while (i < np) #local tp = (i + tshift)*dt; // Angle of particle rel origin (degrees). #local pp = vrotate(, tp*z); // Coords of particle of particle. #local vp = flow_velocity(crv,A,B,C,D, pp.x,pp.y); #if (rel) #local vp = (vp - vo)/Rc; #end object{ ptic texture{ txpr } translate pp } object{ arrow(ma*vp,ra) texture{ txar } translate pp } #local i = i + 1; #end } #end