// ----------------------------------------------------------------------------- // 2024-12-05, lb // ----------------------------------------------------------------------------- // MathMod : Vase_3 by Abderrahman Taha 31/10/2019 // --- Const #declare Th1 = 1/5; #declare Th2 = 6/5; #declare A = 17/10; #declare B = 5/12; // Squared rise #declare Sq = function(x) { x*x } // "CarvinCondition=abs((z-1) -(8/10)*cos(18*atan2(x,y)/pi))<(13/10)|abs((z+3) -(3/10)*cos(18*atan2(x,y)/pi+pi/4))<(1/2)", #declare CarvinCondition= function (x,y,z,m) { ( (abs((z-1)-(8/10)*cos(18*atan2(x,y)/pi)) < (13/10)) | (abs((z+3)-(3/10)*cos(18*atan2(x,y)/pi+pi/4)) < (1/2) ) ) } // "Torus=(sqrt(x*x+y*y)-3)^2+z*z-1", #declare Torus = function { Sq(sqrt(x*x+y*y)-3) + Sq(z) - 1 } // "Bottom=(x*x+y*y+z*z-1)" #declare Bottom = function { Sq(x) + Sq(y) + Sq(z) - 1 } // "ThickIsoExterior=(x*x/3+y*y/3-abs((15/10)*sin(2*z/pi+(3/10))+(18/10)))*(x*x/3+y*y/3-abs((15/10)*sin(2*z/pi+(3/10))+(18/10)))-(1/20)", #declare ThickIsoExterior = function (x,y,z,m) { Sq( Sq(x)/3+Sq(y)/3-abs((15/10)*sin(2*z/pi+(3/10))+(18/10)) ) - (1/20) } // "Iso=cos(x)*sin(y)+cos(y)*sin(z)+cos(z)*sin(x)", #declare Iso = function (x,y,z,m){ cos(x)*sin(y) + cos(y)*sin(z) + cos(z)*sin(x) } // "Rap=t*x/sqrt(x*x+y*y+z*z)", #declare Rap = function (x,y,z,m) { m*x/sqrt(x*x+y*y+z*z) } // "Iso4 = Iso ( // x + Th1*Rap ( (-sin(x)*sin(y) + cos(z)*cos(x) ), (-sin(y)*sin(z) + cos(x)*cos(y) ), ( -sin(z)*sin(x) + cos(y)*cos(z) ), t ), // y + Th1*Rap ( (-sin(y)*sin(z) + cos(x)*cos(y) ), (-sin(z)*sin(x) + cos(y)*cos(z) ), ( -sin(x)*sin(y) + cos(z)*cos(x) ), t ), // z + Th1*Rap ( (-sin(z)*sin(x) + cos(y)*cos(z) ), (-sin(x)*sin(y) + cos(z)*cos(x) ), ( -sin(y)*sin(z) + cos(x)*cos(y) ), t ), // t ), #declare Iso4 = function (x,y,z,m) { Iso ( x + Th1*Rap((-sin(x)*sin(y)+cos(z)*cos(x)),(-sin(y)*sin(z)+cos(x)*cos(y)),(-sin(z)*sin(x)+cos(y)*cos(z)), m), y + Th1*Rap((-sin(y)*sin(z)+cos(x)*cos(y)),(-sin(z)*sin(x)+cos(y)*cos(z)),(-sin(x)*sin(y)+cos(z)*cos(x)), m), z + Th1*Rap((-sin(z)*sin(x)+cos(y)*cos(z)),(-sin(x)*sin(y)+cos(z)*cos(x)),(-sin(y)*sin(z)+cos(x)*cos(y)), m), m ) } // "Iso6 = Iso( // x+Th2*Rap((-sin(x)*sin(y)+cos(z)*cos(x)),(-sin(y)*sin(z)+cos(x)*cos(y)),(-sin(z)*sin(x)+cos(y)*cos(z)),t), // y+Th2*Rap((-sin(y)*sin(z)+cos(x)*cos(y)),(-sin(z)*sin(x)+cos(y)*cos(z)),(-sin(x)*sin(y)+cos(z)*cos(x)),t), // z+Th2*Rap((-sin(z)*sin(x)+cos(y)*cos(z)),(-sin(x)*sin(y)+cos(z)*cos(x)),(-sin(y)*sin(z)+cos(x)*cos(y)),t) // ,t // ), #declare Iso6 = function (x,y,z,m) { Iso ( x + Th2*Rap((-sin(x)*sin(y)+cos(z)*cos(x)), (-sin(y)*sin(z)+cos(x)*cos(y)), (-sin(z)*sin(x)+cos(y)*cos(z)), m), y + Th2*Rap((-sin(y)*sin(z)+cos(x)*cos(y)), (-sin(z)*sin(x)+cos(y)*cos(z)), (-sin(x)*sin(y)+cos(z)*cos(x)), m), z + Th2*Rap((-sin(z)*sin(x)+cos(y)*cos(z)), (-sin(x)*sin(y)+cos(z)*cos(x)), (-sin(y)*sin(z)+cos(x)*cos(y)), m), m ) } // "ThickIso2=(Iso4(x,y,z,-1)*Iso4(x,y,z,1))", #declare ThickIso2 = function (x,y,z,m) { Iso4(x,y,z,-1)*Iso4(x,y,z,1) } // "isoTransform_2 = // if (CarvinCondition(x,y,z,t) = (0), // ThickIsoExterior(x,y,z,t), // 1 // ), #declare isoTransform_2 = function (x,y,z,m) { select ( CarvinCondition(x,y,z,m), 1, ThickIsoExterior(x,y,z,1), 1 ) } // "isoTransform_6 = // if (CarvinCondition(x,y,z,t) & ThickIsoExterior(x,y,z,t) < (0), // -ThickIso2((6*x),(6*y),(6*z),t)*Iso6((x*6),(y*6),(z*6),-1)*(Iso6((x*6),(y*6),(z*6),1)), // 1 // ), #declare isoTransform_6 = function (x,y,z,m) { select ( ThickIsoExterior(x,y,z,m), select ( CarvinCondition(x,y,z,m), - ThickIso2 ( (6*x), (6*y), (6*z), m ) * Iso6 ( (x*6), (y*6), (z*6), -1 ) * Iso6 ( (x*6), (y*6), (z*6), +1 ), 1, - ThickIso2 ( (6*x), (6*y), (6*z), m ) * Iso6 ( (x*6), (y*6), (z*6), -1 ) * Iso6 ( (x*6), (y*6), (z*6), +1 ) ), 1 ) } // Fxyz #declare fnMiddle = function { isoTransform_2(x,y,-z,0) * isoTransform_6(x,y,-z,0) } #declare fnTop = function { Torus(A*x, A*y, (11/5)*(z+cos(pi/4*sqrt(x*x+y*y)))-(54/5)) } #declare fnBottom = function { Bottom (x*B, y*B, 2*(z+(51/10))) }