/*========================================================= Superficie parametrica Metodi e Modelli Matematici Gian Marco Todesco, dicembre 2007 http://archinet.uniroma3.it/mate/metodi/2007 =========================================================*/ #include "colors.inc" #include "textures.inc" camera { location 0.5*<1,3,-4> right x*image_width/image_height look_at <0,0.0,0> angle 50 rotate -30*y } light_source { <1,4,-2> color 1 } light_source { <-1,2,-6> color 0.5 shadowless} light_source { < 1,2,-6> color 0.5 shadowless} plane { y,-0.01 pigment { checker White Orange scale 4 } } #declare Pa = <-1,0,-1>; #declare Pb = <-1,0, 1>; #declare Pc = < 1,0,-1>; #declare Pd = < 1,0, 1>; #declare R = 0.05; /* sphere {Pa, R pigment {Red}} sphere {Pb, R pigment {Green}} sphere {Pc, R pigment {Blue}} sphere {Pd, R pigment {Magenta}} union { #local R = 0.03; cylinder {Pa,Pb,R} cylinder {Pc,Pd,R} texture {Silver_Metal} } */ //cone {-x,0.04,2*x,0 pigment {Red}} //cone {-y,0.04,2*y,0 pigment {Green}} //cone {-z,0.04,2*z,0 pigment {Blue}} // // definisco la funzione Superficie : [0,1]x[0,1] -> // #macro Superficie(U,V) #local Phi = U*2*pi; #local Q0 = ; #local Q1 = <0.25*cos(Phi)+0.5,0,0.25*sin(Phi)>; #local D = vlength(Q1-Q0); #local P = (1-V)*Q0 + V*Q1 + 2*D*V*(1-V)*y; P #end #declare N = 61; #declare M = 61; #declare Vertici = array[N][M]; #declare Normali = array[N][M]; // calcolo le posizioni dei vertici della griglia #declare I = 0; #while(I