public void dfsChains(GameObject component)
        {
            List <Transform> properChildren       = this.getProperChildren(component);
            bool             previousSpheresExist = (properChildren.Count != component.transform.childCount);

            // Generate crossing for parent sphere
            Vector3[] parentCorners;
            // Cross a section through the middle of the sphere if it is a normal node.
            // If it's a leaf, cross a tiny section through its top side, so that the total mesh ends
            // with a corner.
            if (properChildren.Count == 0)
            {
                parentCorners = MeshGenerationUtils.generateQuadSection(this.container, component, MeshGenerationUtils.sphereRadius, .5f);
            }
            else if (component.Equals(this.parentSphere))
            {
                parentCorners = MeshGenerationUtils.generateQuadSection(this.container, component, -MeshGenerationUtils.sphereRadius, .5f);
            }
            else
            {
                parentCorners = MeshGenerationUtils.generateQuadSection(this.container, component);
            }
            this.sphereCrosses.Add(component.GetInstanceID(), parentCorners);

            foreach (Transform child in properChildren)
            {
                dfsChains(child.gameObject);
            }

            if (properChildren.Count == 1)
            {
                // Populate linear path between parent sphere and child sphere with spheres
                if (!previousSpheresExist)
                {
                    MeshGenerationUtils.generateParentChildSpheres(component, properChildren[0].gameObject);
                }

                // Get all child spheres, before adding other things to the hierarchy of the Transform.
                List <Transform> sphereChildren = getSphereChildren(component);

                // Place a quad in each of the spheres on the way from parent to child
                // In order to get the 4 points that the sphere contributes to creating the mesh.
                List <Vector3[]> meshPoints = generateQuadSections(component, sphereChildren);
                //Vector3[] parentPoints =

                List <Vector3> points = new List <Vector3> ();
                foreach (Vector3[] meshPoint in meshPoints)
                {
                    points.AddRange(meshPoint);
                }
                Mesh       m         = MeshGenerationUtils.createConvexHullMesh(points);
                GameObject selection = MeshGenerationUtils.createGOFromMesh(MeshGenerationUtils.PARTIAL_MESH_NAME, this.container, m);
                meshes.Add(selection);

                // Create a mesh out of the corner points obtained in generateQuadSections
                //GameObject mesh = generateMesh (parentSphere, meshPoints);
                //meshes.Add (mesh);
            }
        }
        public static Vector3[] generateQuadSection(GameObject container, GameObject sphere)
        {
            List <Vector3> quads = new List <Vector3> ();

            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 0));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 10));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 20));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 30));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 40));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 50));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 60));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 70));
            quads.AddRange(MeshGenerationUtils.generateQuadSection(container, sphere, 0, 1, 80));
            return(quads.ToArray());
        }
        private List <Vector3[]> generateQuadSections(GameObject parentSphere, List <Transform> sphereChildren)
        {
            List <Vector3[]> allChildrenCorners = new List <Vector3[]>();

            //TODO (cmocan): Defensive coding. Check dictionary first, and generate if it's not there.
            Vector3[] parentCorners = this.sphereCrosses[parentSphere.gameObject.GetInstanceID()];
            allChildrenCorners.Add(parentCorners);

            foreach (Transform child in sphereChildren)
            {
                Vector3[] currChildCorners;
                if (this.sphereCrosses.ContainsKey(child.gameObject.GetInstanceID()))
                {
                    currChildCorners = this.sphereCrosses [child.gameObject.GetInstanceID()];
                }
                else
                {
                    currChildCorners = MeshGenerationUtils.generateQuadSection(this.container, child.gameObject);
                }
                allChildrenCorners.Add(currChildCorners);
            }

            return(allChildrenCorners);
        }