// Start is called before the first frame update void Start() { MeshFilter mf = GetComponent <MeshFilter>(); m = mf.mesh; sierp = new STetrahedron(); var mesh = sierp.CreateBaseMesh(); meshes.Add(mesh); UpdateMesh(mesh); level = 0; }
public STetrahedron Subdivide() { var result = new STetrahedron(); float s = result.Size = Size * 0.5f; if (centers.Count == 0) { centers.Add(Vector3.zero); } foreach (var c in centers) { result.centers.Add(c + new Vector3(0, s, 0)); result.centers.Add(c + new Vector3(-s2_3 * s, -f1_3 * s, -s2_9 * s)); result.centers.Add(c + new Vector3(s2_3 * s, -f1_3 * s, -s2_9 * s)); result.centers.Add(c + new Vector3(0, -f1_3 * s, s8_9 * s)); } return(result); }