简体   繁体   English

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

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

I know how to get a cylinder but I want to depict something like toilet paper roll plotting archimedian spiral at the surface with the cylinder. 我知道如何获得圆柱体,但我想描绘一些类似卫生纸卷的图形,该图形在圆柱体表面上绘制了阿基米德螺旋线。

How to parameterize a curved cylinder? 如何参数化圆柱体?

But what I need is Toilet paper roll like the plot. 但是我需要的是卫生纸卷,就像情节一样。

I figured out the math behind this can someone help me with python I need to plot it in 3D for the following equation In practice the formula 我想出了这背后的数学原理,有人可以帮助我使用python,我需要针对以下方程式以3D形式绘制它:在实践中,公式

I want to use L as parameter and my equation becomes 我想用L作为参数,我的方程就变成了

Here h is metal thickness, r is inner radius of the roll. h是金属厚度,r是轧辊的内半径。 This formula is using circular approximation of the spiral roll. 该公式使用螺旋辊的圆近似值。 I also know length L =50 Can someone help me with matplotlib code 我也知道长度L = 50有人可以用matplotlib代码帮助我

This is exactly what I need http://pgfplots.net/tikz/examples/cylinder-spiral/ please look at this link 这正是我所需要的http://pgfplots.net/tikz/examples/cylinder-spiral/请查看此链接

Can someone help me to put it in Matplotlib 有人可以帮我把它放在Matplotlib中 圆柱螺旋

气缸螺旋 Below is the solution I somehow figured it out I would be happy if someone help me to better my solution 以下是解决方案我以某种方式弄清楚如果有人帮助我改进我的解决方案,我会很高兴

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()

The parametric equation for a circle centered on the origin and radius r is, x = r \\times sin(\\theta) y = r \\times cos(\\theta) where \\theta \\in [0,2\\pi] . 以原点和半径r为中心的圆的参数方程是, x = r \\times sin(\\theta) y = r \\times cos(\\theta)其中\\theta \\in [0,2\\pi]

For a spiral, the radius increases with \\$\\theta\\$. 对于螺旋,半径随\\ $ \\ theta \\ $增加。 Assuming that \\$r\\$ relies on \\theta as r = (a+b\\theta) it can be, x = (a+b\\theta) sin(\\theta) y = (a+b\\theta) cos(\\theta) 假设\\ $ r \\ $依赖于\\theta作为r = (a+b\\theta)它可以是, x = (a+b\\theta) sin(\\theta) y = (a+b\\theta) cos(\\theta)

For it to be a 3D figure with a vertical axis, you can add z in linspace(0, L) where L is the length of the cylinder. 为了使其成为具有垂直轴的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()

Since you have a working code, you can post it in Code review Stack Exchange where I can explain with typeset math. 由于您有一个工作代码,您可以将其发布在代码审查堆栈交换中,我可以使用排版数学进行解释。

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

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