private void expandVolume(SSBVHNodeAdaptor <GO> nAda, SSAABB targetBox)
        {
            var boxCopy = box;

            box.ExpandToFit(targetBox);

            var expanded = !boxCopy.Equals(box);

            if (expanded && parent != null)
            {
                parent.childExpanded(nAda, this);
            }
        }
Ejemplo n.º 2
0
        private void expandVolume(SSBVHNodeAdaptor <GO> nAda, Vector3 objectpos, float radius)
        {
            bool expanded = false;

            // test min X and max X against the current bounding volume
            if ((objectpos.X - radius) < box.Min.X)
            {
                box.Min.X = (objectpos.X - radius); expanded = true;
            }
            if ((objectpos.X + radius) > box.Max.X)
            {
                box.Max.X = (objectpos.X + radius); expanded = true;
            }
            // test min Y and max Y against the current bounding volume
            if ((objectpos.Y - radius) < box.Min.Y)
            {
                box.Min.Y = (objectpos.Y - radius); expanded = true;
            }
            if ((objectpos.Y + radius) > box.Max.Y)
            {
                box.Max.Y = (objectpos.Y + radius); expanded = true;
            }
            // test min Z and max Z against the current bounding volume
            if ((objectpos.Z - radius) < box.Min.Z)
            {
                box.Min.Z = (objectpos.Z - radius); expanded = true;
            }
            if ((objectpos.Z + radius) > box.Max.Z)
            {
                box.Max.Z = (objectpos.Z + radius); expanded = true;
            }

            if (expanded && parent != null)
            {
                parent.childExpanded(nAda, this);
            }
        }