繁体   English   中英

如何绘制类似于卫生纸的圆柱体。旋转阿基米德螺旋形成圆柱体

[英]How do I plot a cylinder which is similar to toilet paper .Rotating archimedeian spiral forming a cylinder

我知道如何获得圆柱体,但我想描绘一些类似卫生纸卷的图形,该图形在圆柱体表面上绘制了阿基米德螺旋线。

如何参数化圆柱体?

但是我需要的是卫生纸卷,就像情节一样。

我想出了这背后的数学原理,有人可以帮助我使用python,我需要针对以下方程式以3D形式绘制它:在实践中,公式

我想用L作为参数,我的方程就变成了

h是金属厚度,r是轧辊的内半径。 该公式使用螺旋辊的圆近似值。 我也知道长度L = 50有人可以用matplotlib代码帮助我

这正是我所需要的http://pgfplots.net/tikz/examples/cylinder-spiral/请查看此链接

有人可以帮我把它放在Matplotlib中 圆柱螺旋

气缸螺旋 以下是解决方案我以某种方式弄清楚如果有人帮助我改进我的解决方案,我会很高兴

L = 50
h= 0.5
r= 5.0[![plot][1]][1]
R = np.sqrt((L*h)/(np.pi)+r**r)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
xpoints=[]
ypoints=[]

for theta in np.linspace(0,20,R):
        xpoints.append(1.1*theta*cos(theta))
        ypoints.append(1.1*theta*sin(theta))
        z = np.linspace(0,R)
        theta, z = np.meshgrid(t, z)
ax.plot_surface(xpoints,ypoints,z)
plt.show()

以原点和半径r为中心的圆的参数方程是, x = r \\times sin(\\theta) y = r \\times cos(\\theta)其中\\theta \\in [0,2\\pi]

对于螺旋,半径随\\ $ \\ theta \\ $增加。 假设\\ $ r \\ $依赖于\\theta作为r = (a+b\\theta)它可以是, x = (a+b\\theta) sin(\\theta) y = (a+b\\theta) cos(\\theta)

为了使其成为具有垂直轴的3D图形,可以在linspace(0, L)中添加z ,其中L是圆柱体的长度。

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import math
import numpy as np

L = 50
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
xpoints=[]
ypoints=[]
a = 0.1
b = 0.1

for theta in np.linspace(0, 2*math.pi, 20):
    xpoints.append((a+b*theta)*math.cos(theta))
    ypoints.append((a+b*theta)*theta*math.sin(theta))
    z = np.linspace(0,L)
    theta, z = np.meshgrid(theta, z)
ax.plot_surface(xpoints,ypoints,z)
plt.show()

由于您有一个工作代码,您可以将其发布在代码审查堆栈交换中,我可以使用排版数学进行解释。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM