Exemplo n.º 1
0
        internal float SAHofPair(SSAABB boxa, SSAABB boxb)
        {
            SSAABB pairbox = boxa;

            pairbox.ExpandToFit(boxb);
            return(SAH(ref pairbox));
        }
Exemplo n.º 2
0
        internal float SAHofPair(ssBVHNode <GO> nodea, ssBVHNode <GO> nodeb)
        {
            SSAABB box = nodea.box;

            box.ExpandToFit(nodeb.box);
            return(SAH(ref box));
        }
Exemplo n.º 3
0
        internal SSAABB AABBofPair(ssBVHNode <GO> nodea, ssBVHNode <GO> nodeb)
        {
            SSAABB box = nodea.box;

            box.ExpandToFit(nodeb.box);
            return(box);
        }
        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);
            }
        }
Exemplo n.º 5
0
        public static SSAABB GetBoundingBox(this LoadResult obj)
        {
            var bbox = new SSAABB();

            foreach (var g in obj.Groups)
            {
                foreach (var f in g.Faces)
                {
                    if (f.Count != 3)
                    {
                        throw new NotImplementedException("Non triangular face found in obj");
                    }

                    var v0 = obj.Vertices[f[0].VertexIndex - 1].ToVector3();
                    var v1 = obj.Vertices[f[1].VertexIndex - 1].ToVector3();
                    var v2 = obj.Vertices[f[2].VertexIndex - 1].ToVector3();

                    var t = new Triangle(v0, v1, v2, null);
                    bbox.ExpandToFit(t.BoundingBox);
                }
            }
            return(bbox);
        }