// Last edited on 2023-10-23 17:05:42 by stolfilocal // Debugging Bézier arcs. #declare tx_bezpoly0 = texture{ pigment{ color rgb < 1.000, 0.400, 0.100 > } finish{ diffuse 0.5 ambient 0.5 } } #declare tx_bezpoly1 = texture{ pigment{ color rgb < 0.200, 0.500, 1.000 > } finish{ diffuse 0.5 ambient 0.5 } } #declare tx_bezpoly = texture{ tx_bezpoly0 } #macro bezpoly(p0, p1, p2, p3, rad) union{ sphere{ p0, rad } sphere{ p1, rad } sphere{ p2, rad } sphere{ p3, rad } #if (vlength(p1-p0) > 1.0e-8) cylinder{ p0, p1, 0.5*rad } #end #if (vlength(p2-p1) > 1.0e-8) cylinder{ p1, p2, 0.5*rad } #end #if (vlength(p3-p2) > 1.0e-8) cylinder{ p2, p3, 0.5*rad } #end texture{ tx_bezpoly } } #end #macro bezpoly_multi(n, pini, p1, p2, pfin, rad) union{ #local p0k = pini; #local k = 0; #while (k < n) #local p1k = p1[k]; #local p2k = p2[k]; #if (k = n-1) #local p3k = pfin; #else #local p3k = (p2[k] + p1[k+1])/2; #end #if (mod(k,2) = 0) #declare tx_bezpoly = texture{ tx_bezpoly0 } #else #declare tx_bezpoly = texture{ tx_bezpoly1 } #end bezpoly(p0k, p1k, p2k, p3k, rad) #local p0k = p3k; #local k = k+1; #end } #end #macro bspline_poly(n, pts, rad) union{ #local p0 = pts[0]; sphere{ p0, rad } #local k = 1; #while (k < n) #local p1 = pts[k]; cylinder{ p0, p1, 0.5*rad } sphere{ p1, rad } #local p0 = p1; #local k = k+1; #end texture{ tx_bezpoly0 } } #end