// Last edited on 2020-11-15 11:24:36 by jstolfi // Checking 2D image invariants #macro coeffpath(A,B,C, clr) // Traces the path of the point {(A'+C',B',A'-C')} where {A',B',C'} // are the coefficients of the quadratic {A x^2 + B xy + C y^2} // rotated by varying angles around the origin. #local tx_ball = texture{ pigment{ color rgb clr } finish{ diffuse 0.8 ambient 0.2 } } #local tx_stick = texture{ pigment{ color rgb < 0.800, 0.800, 0.800 > } finish{ diffuse 0.8 ambient 0.2 } } #local rad_ball = 0.05 * vlength( < A, B, C > ); #local rad_stick = 0.1 * rad_ball; union{ #local N = 360; #local k = 0; #while (k < N) #local tg = k*360/N; // Rotation angle in degrees. #local tr = radians(tg); #local cc = cos(tr); #local ss = sin(tr); #local Ar = A*cc*cc + B*cc*ss + C*ss*ss; #local Br = -2*A*cc*ss + B*(cc*cc - ss*ss) + 2*C*cc*ss; #local Cr = A*ss*ss - B*cc*ss + C*cc*cc; #local P = < Ar+Cr, Br, Ar-Cr >; sphere{ P, rad_ball texture{ tx_ball } } #if (mod(k, 10) = 0) cylinder{ < 0, 0, 0 >, P, rad_stick texture{ tx_stick } } #end #local k = k +1; #end sphere{ < 0, 0, 0 >, rad_stick texture{ tx_stick } } } #end #include "eixos.inc" object{ eixos(1.5, 0.01) } object{ coeffpath( 1.0, 0.0, -1.0, < 1.000, 0.200, 0.000 >) } object{ coeffpath( 1.0, 0.0, -2.0, < 0.200, 0.800, 0.000 >) } object{ coeffpath( 1.0, -2.0, 0.0, < 0.000, 0.200, 0.800 >) } #include "camlight.inc" #declare centro_cena = < 0, 0, 0 >; #declare raio_cena = 5.0; #declare dir_camera = < 14.00, 00.00, 00.00 >; //#declare dir_camera = < 00.00, 14.00, 00.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera, z, intens_luz)