예제 #1
0
파일: Box.cs 프로젝트: willnode/Qu3e-Sharp
        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;
        }
예제 #2
0
 //--------------------------------------------------------------------------------------------------
 public static Vec3 Mul(Transform tx, Vec3 scale, Vec3 v)
 {
     return(tx.rotation * Vec3.Mul(scale, v) + tx.position);
 }