private void UpdateBoundsItem()
        {
            if (Children.Count == 2)
            {
                var transformAabb = ItemWithTransform.GetAxisAlignedBoundingBox();
                var fitAabb       = FitBounds.GetAxisAlignedBoundingBox();
                var fitSize       = fitAabb.Size;
                if (boundsSize.X != 0 && boundsSize.Y != 0 && boundsSize.Z != 0 &&
                    (fitSize != boundsSize ||
                     fitAabb.Center != transformAabb.Center))
                {
                    FitBounds.Matrix *= Matrix4X4.CreateScale(
                        boundsSize.X / fitSize.X,
                        boundsSize.Y / fitSize.Y,
                        boundsSize.Z / fitSize.Z);
                    FitBounds.Matrix *= Matrix4X4.CreateTranslation(
                        transformAabb.Center - FitBounds.GetAxisAlignedBoundingBox().Center);
                }

                if (AlternateCentering)
                {
                    var test = GetCenteringTransformVisualCenter(UntransformedChildren, Diameter / 2);
                }
                else
                {
                    var test = GetCenteringTransformExpandedToRadius(UntransformedChildren, Diameter / 2);
                }
            }
        }
예제 #2
0
 private void UpdateBoundsItem()
 {
     if (Children.Count == 2)
     {
         var transformAabb = ItemWithTransform.GetAxisAlignedBoundingBox();
         var fitAabb       = FitBounds.GetAxisAlignedBoundingBox();
         if (Diameter != 0 &&
             SizeZ != 0)
         {
             FitBounds.Matrix *= Matrix4X4.CreateScale(
                 Diameter / fitAabb.XSize,
                 Diameter / fitAabb.YSize,
                 SizeZ / fitAabb.ZSize);
             FitBounds.Matrix *= Matrix4X4.CreateTranslation(
                 transformAabb.Center - FitBounds.GetAxisAlignedBoundingBox().Center);
         }
     }
 }
예제 #3
0
 private void UpdateBoundsItem()
 {
     if (Children.Count == 2)
     {
         var transformAabb = ItemWithTransform.GetAxisAlignedBoundingBox();
         var fitAabb       = FitBounds.GetAxisAlignedBoundingBox();
         var fitSize       = fitAabb.Size;
         var width         = Width.Value(this);
         var depth         = Depth.Value(this);
         var height        = Height.Value(this);
         var boundsSize    = new Vector3(width, depth, height);
         if (boundsSize.X != 0 && boundsSize.Y != 0 && boundsSize.Z != 0 &&
             (fitSize != boundsSize ||
              fitAabb.Center != transformAabb.Center))
         {
             FitBounds.Matrix *= Matrix4X4.CreateScale(
                 boundsSize.X / fitSize.X,
                 boundsSize.Y / fitSize.Y,
                 boundsSize.Z / fitSize.Z);
             FitBounds.Matrix *= Matrix4X4.CreateTranslation(
                 transformAabb.Center - FitBounds.GetAxisAlignedBoundingBox().Center);
         }
     }
 }