锥体图像细化

发布于 2024-12-17 22:01:21 字数 1611 浏览 4 评论 0原文

为了制作一个漂亮的与平面相交的圆锥体三维图形,我选择对 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]]

这是图形: Dandelin Construction

问题在于两个球体周围靠近切点的白点。将上述代码放入 Manipulate[...GrayLevel[z]...{z,0,1} ] 中,我们可以轻松“删除”z 趋于 1 时的斑点。

  1. 可以有人看到消除白斑的不同方法吗?我更喜欢 GrayLevel[z] 且 z < 0.5.

  2. 我对图形上下球体和上球体上略有不同的斑点图案很感兴趣。您知道如何解释这一点吗?

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 :
Dandelin construction

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.

  1. Can anyone see a different approach to removing the white spots ? I prefer GrayLevel[z] with z < 0.5.

  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

天邊彩虹 2024-12-24 22:01:21

您可以使用具有不同半径的Tube 构造圆锥体:

cone[m_, h_] := {CapForm[None], Tube[{{0, 0, 0}, {0, 0, h}}, {0, h/m}]};

You could construct the cone using a Tube with varying radii:

cone[m_, h_] := {CapForm[None], Tube[{{0, 0, 0}, {0, 0, h}}, {0, h/m}]};
硬不硬你别怂 2024-12-24 22:01:21

您可能想让球体稍微小一点:

Sphere[C1, .98 r1], Sphere[C2, .98 r2]

这是一个技巧,但它避免了相交问题。

或者,您可以增加锥体上的绘图点:

PlotPoints -> 100

但这会使渲染速度变慢。

编辑:或者将这些组合起来以帮助提高速度和质量。

You might want to make the spheres a tiny bit smaller:

Sphere[C1, .98 r1], Sphere[C2, .98 r2]

It's a hack, but it avoids the intersection problem.

Alternatively, you can up the PlotPoints on the cone:

PlotPoints -> 100

but that will make the rendering slower.

Edit: Or a combination of these to help with speed and quality.

英雄似剑 2024-12-24 22:01:21

为什么没有人建议只使用内置的 Cone[] 原语?

cone[m_, h_] := {EdgeForm[], Cone[{{0, 0, h}, {0, 0, 0}}, h/m]};

这在这里效果很好(没有白点)。此外,这不是黑客或解决方法。空的EdgeForm[]的目的是去除圆锥体底部的黑色轮廓。

在此处输入图像描述

我刚刚意识到 Cone[] 拥有坚实的基础,在所包含的图像上也非常明显。因此,这与原始 RevolutionPlot 版本完全不一样。

Why has no one suggested to just use the built-in Cone[] primitive?

cone[m_, h_] := {EdgeForm[], Cone[{{0, 0, h}, {0, 0, 0}}, h/m]};

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.

enter image description here

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 original RevolutionPlot version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文