我正在尝试使用以下代码模拟一个汽水罐,其末端变成圆锥形,而不是简单的汽缸,
#include "colors.inc"
#include "stones.inc"
camera {
location <8, 8, -23>
look_at <8, 8, 3>
}
light_source { <2, 4, -3> color White}
#macro tube(P1, P2, r1, r2)
#local _P3 = P1 - 0.01*(P2-P1); // V1 - 0.1*V2
#local _P4 = P1 + 1.01*(P2-P1); // V1 + 1.1*V2
// the inner cylinder is a little bit larger to ensure that it
// cuts through the outer cylinder caps
// a texture enforces a cap
difference {
cylinder {P1,P2,r1}
cylinder {_P3,_P4,r2}
}
#end
#macro funnel(P1, P2, r1, r2, r3, r4)
#local _P3 = P1 - 0.001*(P2-P1); // V1 - 0.1*V2
#local _P4 = P1 + 1.001*(P2-P1); // V1 + 1.1*V2
difference {
cone {P1, r1
P2, r3}
cone {_P3, r2
_P4, r4}
}
#end
#macro can(base, top, base_funnelheight, top_funnelheight, baseR, midR, topR, thickn)
// get the main tube
// set the inner tube dims
#local _innerB = (base + <0,0,base_funnelheight>) ;
#local _innerT = (top - <0,0,top_funnelheight>) ;
#local _innerR = (midR - thickn);
// get the top funnel
// get the inner cone
#local _innerConeB_TFunnel = _innerT;
#local _innerConeT_TFunnel = top;
#local _innerConeB_Radius_TFunnel = _innerR;
#local _innerConeT_Radius_TFunnel = topR - thickn;
// get the outer cone
#local _outerConeB_TFunnel = _innerT;
#local _outerConeT_TFunnel = top;
#local _outerConeB_Radius_TFunnel = midR;
#local _outerConeT_Radius_TFunnel = topR;
// get the bottom funnel
// get the inner cone
#local _innerConeB_BFunnel = base;
#local _innerConeT_BFunnel = _innerB;
#local _innerConeB_Radius_BFunnel = baseR - thickn;
#local _innerConeT_Radius_BFunnel = _innerR;
// get the outer cone
#local _outerConeB_BFunnel = base;
#local _outerConeT_BFunnel = _innerB;
#local _outerConeB_Radius_BFunnel = baseR;
#local _outerConeT_Radius_BFunnel = midR;
// make the Can
union{
// make the tube
tube(_innerB, _innerT, midR, _innerR)
//tube(_innerB, _innerT, midR, _innerR)
// make the top funnel
funnel(_innerT, top, _outerConeB_Radius_TFunnel, _outerConeT_Radius_TFunnel, _innerConeB_Radius_TFunnel, _innerConeT_Radius_TFunnel)
// make the bottom funnel
funnel(_innerB, base, _outerConeT_Radius_BFunnel, _outerConeB_Radius_BFunnel, _innerConeT_Radius_BFunnel, _innerConeB_Radius_BFunnel)
// funnel(_innerB, base, _outerConeT_Radius_BFunnel, _outerConeB_Radius_BFunnel, _innerConeT_Radius_BFunnel, _innerConeB_Radius_BFunnel)
}
#end
object{
can(<8,8,2.5>, <8,8,12>, 1.25, 0.98, 5.9, 6.3, 6.2, 0.2)
// funnel(<8,8,2.5>, <8,8,3.75>, 6.3, 5.9, 6.1, 5.7)
texture{ pigment{ color rgbf<0.2,0.7,0.5,0.14>}
finish { phong 0.2 }}
rotate <-90, 0, 0>
translate < 0, 0, 3>
// scale <0.5, 0.5, 0.5>
}
问题是,虽然顶部漏斗的厚度与中间部分相同,但底部漏斗厚得多。
我能做些什么来解决它?