Sphere
[!caution]ai 生成,可能叙事逻辑和表述并不是很好,仅供参考。
球体便捷构造,定义于 ranim_items::mesh。
let sphere = new // 半径,默认分辨率 (101, 51)
.with_resolution
.with_fill_color;
let mesh = from; // Sphere → Surface → MeshItem
let placed = mesh.transformed;
Sphere 是 canonical local primitive:球心固定在 local 原点,半径定义其 local 尺寸。需要场景 placement 时,应像上面的示例一样使用外层Transformed,而不是给 Sphere 增加中心字段。球面按 u ∈ [0, 2π]、v ∈ [0, π] 参数化。From<Sphere> for Surface 默认 flat shading;需要平滑效果时先转 Surface再 with_smooth_normals():
let mesh = from;