Up

曲線の3D描画

 

曲線の3D描画を試みた。

曲線は、do Carmo (2016)p.26の問10にある曲線

 

 

を対象とした。

曲線(1)の描画スクリプトを、リスト1のように用意した。

 

 

リスト1 曲線(1)の描画

 

import matplotlib.pyplot as plt

import numpy as np

 

ax = plt.figure().add_subplot(projection='3d')

 

theta_p = np.linspace(0.001, 1, 100)

theta_n = np.linspace(-1, -0.001, 100)

theta = np.concatenate((theta_n, [0], theta_p))

x = np.concatenate((theta_n, [0], theta_p))

y = np.concatenate((np.exp(-1/theta_n**2), [0], [0]*100))

z = np.concatenate(([0]*100, [0], np.exp(-1/theta_p**2)))

 

ax.plot(x, y, z, label='curve')

plt.xlabel('x')

plt.ylabel('y')

ax.legend()

plt.show()

 

 

リスト1を実行すると、図1のような図が表示された。

 

図1

 

D描画であるので、グラフの上をマウスでドラッグすると図が回転する(図2)。

 

図2

 

 

式(1)の曲線は、平面上にない(not a plane curve)が、torsionは0である(do Carmo, 2016, p.26)。

 

 

参考書

do Carmo, M. P. (2016). Differential geometry of curves & surfaces, revised & updated second edition. Dover publications. 

 

 

Home