public SubdivideLinear ( bool barycentric = false ) : void | ||
barycentric | bool |
/// Barycentric(?) if set to |
Результат | void |
/// <summary> /// Gets a unit sphere from the cache. /// </summary> /// <param name="subdivisions"> /// The number of subdivisions. /// </param> /// <returns> /// A unit sphere mesh. /// </returns> private static MeshGeometry3D GetUnitSphere(int subdivisions) { if (UnitSphereCache.Value.ContainsKey(subdivisions)) { return UnitSphereCache.Value[subdivisions]; } var mb = new MeshBuilder(false, false); mb.AddRegularIcosahedron(new Point3D(), 1, false); for (int i = 0; i < subdivisions; i++) { mb.SubdivideLinear(); } for (int i = 0; i < mb.positions.Count; i++) { var v = mb.Positions[i].ToVector3D(); v.Normalize(); mb.Positions[i] = v.ToPoint3D(); } var mesh = mb.ToMesh(); UnitSphereCache.Value[subdivisions] = mesh; return mesh; }