随机生成一个圆柱体
import os
import random
import numpy as np
import matplotlib.pyplot as plt
def plot_cylinder(center, radius, height, num_points=100):
# 生成圆柱体的侧面点坐标
theta = np.linspace(0, 2*np.pi, num_points)
intervalZ = height/num_points
indx2 = [ix for ix in range(num_points)]
random_int2 = random.sample(indx2, 100)
xx = []
yy = []
zz = []
nx = []
ny = []
nz = []
print(random_int2)
for j in random_int2:
indx = [i for i in range(num_points)]
random_int = random.sample(indx, 50)
theta2 = theta[random_int]
print(random_int)
x = center[0] + radius * np.cos(theta2)
y = center[1] + radius