本文介绍了锥形图像细化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 试图制作一个与平面相交的圆锥体的三维立体图形,我选择Mathematica中已有方法(即S.Mangano和S.Wagon的书籍)的轻微重排。下面的代码假定显示所谓的丹德林结构:内部和外部球体在内部与锥体相切,也与锥体相交的平面相切。 区块[{r1,r2,m, h1,h2,C1,C2,M,MC1,MC2,T1,T2,锥体,斜面,平面}, {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 - >假] [[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},盒装 - >假,轴 - >假] [[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 - >假,照明 - > 中性, ViewPoint - > {-1.8,-2.5,1.5},ImageSize-> 950]] 以下是图形: 问题在于切点附近两个球体周围的白色斑点。将上面的代码放到 Manipulate [... GrayLevel [z] ... {z,0,1}] 我们可以很容易地移除这些点,因为z倾向于1. 任何人都可以看到不同的方法去除白点吗?我更喜欢 GrayLevel [z] ,其中z 我一直对图形上较低和较高球体上的斑点略有不同的模式感兴趣。你有什么想法可以解释这个问题吗? 为什么有没有人建议只使用内置的 Cone [] 原始语言? cone [m_,h_]:= {EdgeForm [],Cone [{{0,0,h},{0,0,0}},h / m]}; 这里工作正常(没有白点)。此外,这不是一个黑客或解决方法。空的 EdgeForm [] 的目的是去除锥形底座的黑色轮廓。 我刚刚意识到, code> Cone [] 有一个坚实的基础,在包含的图片上也非常明显。所以这与原来的 RevolutionPlot 版本并非完全相同。 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 ? 解决方案 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.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. 这篇关于锥形图像细化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-22 19:43