Parametric Surface

$$ r(u,v)=2 \cos{u} ~{\rm i} +v ~{\rm j} +2\sin{u} ~{\rm k}$$

이때, $$ v=1$$ 일 때와 $$ u=1$$일 때의 곡선을 같이 그리면 다음과 같다.


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

u_range=np.linspace(0,math.pi*2,60)
v_range=np.linspace(-3,3,60)

U,V =np.meshgrid(u_range,v_range)

fig=plt.figure()
ax=fig.gca(projection='3d')
X=2*np.cos(U)
Y=V
Z=2*np.sin(U)

x1=2*np.cos(u_range)
y1=0*v_range+1
z1=2*np.sin(u_range)

x2=2*np.cos(u_range*0+1)
y2=v_range
z2=2*np.sin(u_range*0+1)

ax.plot_surface(X,Y,Z,rstride=1, cstride=1,cmap=cm.Blues)
ax.plot(x1,y1,z1,color="red")
ax.plot(x2,y2,z2,color="yellow")
# ax.set_zlim3d(0,1)

plt.show()

Leave a Comment