devNotes 10-16-2016 Platonic Generator – VidCap Narrative

 


        public static MeshDraft CubeOctahedron(float radius)
        {
            MeshDraft draft;
            var v = new List<Vector3>(12);
            float r = (1 / Mathf.Sqrt(2))*radius;

            v.Add(new Vector3(r, r, 0));
            v.Add(new Vector3(0, r, r));
            v.Add(new Vector3(0, r, -r));
            v.Add(new Vector3(-r, r, 0));

            v.Add(new Vector3(r, 0, -r));
            v.Add(new Vector3(r, 0, r));
            v.Add(new Vector3(-r, 0, -r));
            v.Add(new Vector3(-r, 0, r));

            v.Add(new Vector3(r, -r, 0));
            v.Add(new Vector3(0, -r, r));
            v.Add(new Vector3(0, -r, -r));
            v.Add(new Vector3(-r, -r, 0));


            draft = Triangle(v[0], v[2], v[1]);
            draft.Add(Triangle(v[3], v[1], v[2]));

            draft.Add(Triangle(v[0], v[5], v[4]));
            draft.Add(Triangle(v[0], v[1], v[5]));
            draft.Add(Triangle(v[1], v[7], v[5]));
            draft.Add(Triangle(v[7], v[1], v[3]));

            draft.Add(Triangle(v[7], v[3], v[6]));
            draft.Add(Triangle(v[3], v[2], v[6]));
            draft.Add(Triangle(v[6], v[2], v[4]));
            draft.Add(Triangle(v[2], v[0], v[4]));


            draft.Add(Triangle(v[5], v[8], v[4]));
            draft.Add(Triangle(v[5], v[9], v[8]));
            draft.Add(Triangle(v[5], v[7], v[9]));
            draft.Add(Triangle(v[9], v[7], v[11]));

            draft.Add(Triangle(v[11], v[7], v[6]));
            draft.Add(Triangle(v[6], v[10], v[11]));
            draft.Add(Triangle(v[6], v[4], v[10]));
            draft.Add(Triangle(v[10], v[4], v[8]));

            draft.Add(Triangle(v[8], v[9], v[10]));
            draft.Add(Triangle(v[10], v[9], v[11]));

            draft.name = "CubeOctahedron";
            return draft;
        }

 

dsbfbf