import{_ as s,c as i,o as a,a4 as t}from"./chunks/framework.DpC1ZpOZ.js";const y=JSON.parse('{"title":"mbcp.presets.model","description":"","frontmatter":{"title":"mbcp.presets.model","lastUpdated":false,"collapsed":true},"headers":[],"relativePath":"api/presets/model/index.md","filePath":"zh/api/presets/model/index.md"}'),h={name:"api/presets/model/index.md"},n=t(`

模块 mbcp.presets.model

几何模型点集

class GeometricModels


@staticmethod

method sphere(radius: float, density: float)

说明: 生成球体上的点集。

参数:

返回: List[Point3]: 球体上的点集。

源代码在GitHub上查看
python
@staticmethod
def sphere(radius: float, density: float):
    area = 4 * np.pi * radius ** 2
    num = int(area * density)
    phi_list = np.arccos([clamp(-1 + (2.0 * _ - 1.0) / num, -1, 1) for _ in range(num)])
    theta_list = np.sqrt(num * np.pi) * phi_list
    x_array = radius * np.sin(phi_list) * np.cos(theta_list)
    y_array = radius * np.sin(phi_list) * np.sin(theta_list)
    z_array = radius * np.cos(phi_list)
    return [Point3(x_array[i], y_array[i], z_array[i]) for i in range(num)]
`,11),l=[n];function e(p,k,r,d,E,o){return a(),i("div",null,l)}const c=s(h,[["render",e]]);export{y as __pageData,c as default};