锥体图像细化
为了制作一个漂亮的与平面相交的圆锥体三维图形,我选择对 Mathematica 中的现有方法(即 S.Mangano 和 S.Wagon 的书籍)进行轻微的重新排列。下面的代码假定显示所谓的丹德林结构:内球体和外球体与圆锥体以及与圆锥体相交的平面内部相切。同时球体与平面的切点是椭圆的焦点。
Block[{r1, r2, m, h1, h2, C1, C2, M, MC1, MC2, T1, T2, cone, slope, plane},
{r1, r2} = {1.4, 3.4};
m = Tan[70.*Degree];
h1 := r1*Sqrt[1 + m^2];
h2 := r2*Sqrt[1 + m^2];
C1 := {0, 0, h1};
C2 := {0, 0, h2};
M = {0, MC1 + h1};
MC2 = MC1*(r2/r1);
MC1 = (r1*(h2 - h1))/(r1 + r2);
T1 = C1 + r1*{-Sqrt[1 - r1^2/MC1^2], 0, r1/MC1};
T2 = C2 + r2*{Sqrt[1 - r2^2/MC2^2], 0, -(r2/MC2)};
cone[m_, h_] := RevolutionPlot3D[{t, m*t}, {t, 0, h/m}, Mesh -> False][[1]];
slope = (T2[[3]] - T1[[3]])/(T2[[1]] - T1[[1]]);
plane = ParametricPlot3D[{t, u, slope*t + M[[2]]}, {t, -2*m, 12/m}, {u, -3, 3},
Boxed -> False, Axes -> False][[1]];
Graphics3D[{{Gray, Opacity[0.39], cone[m, 1.2*(h2 + r2)]},
{Opacity[0.5], Sphere[C1, r1], Sphere[C2, r2]},
{LightBlue, Opacity[0.6], plane},
PointSize[0.0175], Point[T1], Point[T2]},
Boxed -> False, Lighting -> "Neutral",
ViewPoint -> {-1.8, -2.5, 1.5}, ImageSize -> 950]]
这是图形:
问题在于两个球体周围靠近切点的白点。将上述代码放入 Manipulate[...GrayLevel[z]...{z,0,1} ]
中,我们可以轻松“删除”z 趋于 1 时的斑点。
可以有人看到消除白斑的不同方法吗?我更喜欢
GrayLevel[z]
且 z < 0.5.我对图形上下球体和上球体上略有不同的斑点图案很感兴趣。您知道如何解释这一点吗?
Trying to make a nice three-dimensional graphics of cone intersected by a plane I choose a slight rearrangement of an existing approach in Mathematica (i.e. books by S.Mangano and S.Wagon). The code beneath is assumed to show so-called Dandelin construction : the inner and outer spheres tangent internally to a cone and also to a plane intersecting the cone. Tangency points of spheres to the plane at the same time are foci of the ellipse.
Block[{r1, r2, m, h1, h2, C1, C2, M, MC1, MC2, T1, T2, cone, slope, plane},
{r1, r2} = {1.4, 3.4};
m = Tan[70.*Degree];
h1 := r1*Sqrt[1 + m^2];
h2 := r2*Sqrt[1 + m^2];
C1 := {0, 0, h1};
C2 := {0, 0, h2};
M = {0, MC1 + h1};
MC2 = MC1*(r2/r1);
MC1 = (r1*(h2 - h1))/(r1 + r2);
T1 = C1 + r1*{-Sqrt[1 - r1^2/MC1^2], 0, r1/MC1};
T2 = C2 + r2*{Sqrt[1 - r2^2/MC2^2], 0, -(r2/MC2)};
cone[m_, h_] := RevolutionPlot3D[{t, m*t}, {t, 0, h/m}, Mesh -> False][[1]];
slope = (T2[[3]] - T1[[3]])/(T2[[1]] - T1[[1]]);
plane = ParametricPlot3D[{t, u, slope*t + M[[2]]}, {t, -2*m, 12/m}, {u, -3, 3},
Boxed -> False, Axes -> False][[1]];
Graphics3D[{{Gray, Opacity[0.39], cone[m, 1.2*(h2 + r2)]},
{Opacity[0.5], Sphere[C1, r1], Sphere[C2, r2]},
{LightBlue, Opacity[0.6], plane},
PointSize[0.0175], Point[T1], Point[T2]},
Boxed -> False, Lighting -> "Neutral",
ViewPoint -> {-1.8, -2.5, 1.5}, ImageSize -> 950]]
Here is the graphics :
The problem is with the white spots around the both spheres near tangency points. Putting the above code to Manipulate[...GrayLevel[z]...{z,0,1} ]
we can easliy "remove" the spots as z tends to 1.
Can anyone see a different approach to removing the white spots ? I prefer
GrayLevel[z]
with z < 0.5.I have been intrigued with a slightly different pattern of the spots on the lower and upper spheres on the graphics . Have you got any ideas how this could be explained ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用具有不同半径的
Tube
构造圆锥体:You could construct the cone using a
Tube
with varying radii:您可能想让球体稍微小一点:
这是一个技巧,但它避免了相交问题。
或者,您可以增加锥体上的绘图点:
但这会使渲染速度变慢。
编辑:或者将这些组合起来以帮助提高速度和质量。
You might want to make the spheres a tiny bit smaller:
It's a hack, but it avoids the intersection problem.
Alternatively, you can up the PlotPoints on the cone:
but that will make the rendering slower.
Edit: Or a combination of these to help with speed and quality.
为什么没有人建议只使用内置的
Cone[]
原语?这在这里效果很好(没有白点)。此外,这不是黑客或解决方法。空的
EdgeForm[]
的目的是去除圆锥体底部的黑色轮廓。我刚刚意识到
Cone[]
拥有坚实的基础,在所包含的图像上也非常明显。因此,这与原始RevolutionPlot
版本完全不一样。Why has no one suggested to just use the built-in
Cone[]
primitive?This works fine here (no white spots). Also, it's not a hack or workaround. The purpose of the empty
EdgeForm[]
is to remove the black outline of the cone base.I just realized that
Cone[]
has a solid base, also very visible on the included image. So this is not exactly the same as the originalRevolutionPlot
version.