Exemple #1
0
        //--------------------------------------------------------------------------------------------------
        public static AABB Combine(AABB a, AABB b)
        {
            AABB c;

            c.min = Vec3.Min(a.min, b.min);
            c.max = Vec3.Max(a.max, b.max);

            return(c);
        }
Exemple #2
0
        public void ComputeAABB(Transform tx, out AABB aabb)
        {
            Transform world = Transform.Mul(tx, local);

            Vec3 min = new Vec3(double.MaxValue, double.MaxValue, double.MaxValue);
            Vec3 max = new Vec3(-double.MaxValue, -double.MaxValue, -double.MaxValue);

            for (int i = 0; i < 8; ++i)
            {
                var v = Transform.Mul(world, Vec3.Mul(kBoxVertices[i], e));
                min = Vec3.Min(min, v);
                max = Vec3.Max(max, v);
            }

            aabb.min = min;
            aabb.max = max;
        }