コード例 #1
0
        public static Bounds EncapsulateInTargetSpace(this Bounds local, Matrix4x4 localToTargetMat)
        {
            var absMat = localToTargetMat.Absolute();
            var center = localToTargetMat.MultiplyPoint3x4(local.center);
            var extent = absMat.MultiplyVector(local.extents);

            return(new Bounds(center, 2f * extent));
        }
コード例 #2
0
        public static Rect EncapsulateInTargetSpace(this Rect local, Matrix4x4 localToTargetMat)
        {
            var absMat = localToTargetMat.Absolute();
            var center = localToTargetMat.MultiplyPoint3x4(local.center);
            var size   = absMat.MultiplyVector(local.size);
            var min    = center - 0.5f * size;

            return(new Rect(min, size));
        }