public async Task PinchChangesMesh()
        {
            SetupEvnironment();

            var root = new Object3D();

            // now add a pinch
            var pinch1 = new PinchObject3D_3();

            pinch1.Children.Add(new CubeObject3D());
            await pinch1.Rebuild();

            root.Children.Add(pinch1);
            Assert.AreEqual(3, root.Descendants().Count());
        }
        private async void RunTest()
        {
            StaticData.RootPath = TestContext.CurrentContext.ResolveProjectPath(4, "StaticData");
            MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));

            var root = new Object3D();

            // now add a pinch
            var pinch1 = new PinchObject3D_3();

            pinch1.Children.Add(new CubeObject3D());
            await pinch1.Rebuild();

            root.Children.Add(pinch1);
            Assert.AreEqual(3, root.Descendants().Count());
        }
        public async Task AabbCalculatedCorrectlyForPinchedFitObjects()
        {
            StartupMC();

            // build without pinch
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                root.Children.Add(cube);
                Assert.IsTrue(root.GetAxisAlignedBoundingBox().Equals(new AxisAlignedBoundingBox(new Vector3(-10, -10, -10), new Vector3(10, 10, 10)), .001));
                root.Children.Remove(cube);
                var fit = await FitToBoundsObject3D_3.Create(cube);

                fit.Width  = 50;
                fit.Depth  = 20;
                fit.Height = 20;
                fit.Invalidate(InvalidateType.Properties);
                root.Children.Add(fit);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-25, -10, -10), new Vector3(25, 10, 10)), .001));
            }

            // build with pinch
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var fit = await FitToBoundsObject3D_3.Create(cube);

                fit.Width  = 50;
                fit.Depth  = 20;
                fit.Height = 20;

                var pinch = new PinchObject3D_3();
                pinch.Children.Add(fit);
                await pinch.Rebuild();

                root.Children.Add(pinch);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-10, -10, -10), new Vector3(10, 10, 10)), .001));
            }

            // build with translate
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var translate = new TranslateObject3D(cube, 11, 0, 0);

                root.Children.Add(translate);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
            }

            // build with pinch and translate
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var translate = new TranslateObject3D(cube, 11, 0, 0);

                var pinch = new PinchObject3D_3();
                pinch.Children.Add(translate);
                root.Children.Add(pinch);
                await pinch.Rebuild();

                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
            }

            // build with pinch and translate
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var fit = await FitToBoundsObject3D_3.Create(cube);

                fit.Width  = 50;
                fit.Depth  = 20;
                fit.Height = 20;

                var translate = new TranslateObject3D(fit, 11, 0, 0);

                var pinch = new PinchObject3D_3();
                pinch.Children.Add(translate);
                await pinch.Rebuild();

                root.Children.Add(pinch);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
            }
        }
        public async Task AabbCalculatedCorrectlyForPinchedFitObjects()
        {
            StaticData.RootPath = TestContext.CurrentContext.ResolveProjectPath(4, "StaticData");
            MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4));

            // Automation runner must do as much as program.cs to spin up platform
            string platformFeaturesProvider = "MatterHackers.MatterControl.WindowsPlatformsFeatures, MatterControl.Winforms";

            AppContext.Platform = AggContext.CreateInstanceFrom <INativePlatformFeatures>(platformFeaturesProvider);
            AppContext.Platform.InitPluginFinder();
            AppContext.Platform.ProcessCommandline();

            // build without pinch
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                root.Children.Add(cube);
                Assert.IsTrue(root.GetAxisAlignedBoundingBox().Equals(new AxisAlignedBoundingBox(new Vector3(-10, -10, -10), new Vector3(10, 10, 10)), .001));
                root.Children.Remove(cube);
                var fit = await FitToBoundsObject3D_3.Create(cube);

                fit.Width  = 50;
                fit.Depth  = 20;
                fit.Height = 20;
                root.Children.Add(fit);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-25, -10, -10), new Vector3(25, 10, 10)), .001));
            }

            // build with pinch
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var fit = await FitToBoundsObject3D_3.Create(cube);

                fit.Width  = 50;
                fit.Depth  = 20;
                fit.Height = 20;

                var pinch = new PinchObject3D_3();
                pinch.Children.Add(fit);
                await pinch.Rebuild();

                root.Children.Add(pinch);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-10, -10, -10), new Vector3(10, 10, 10)), .001));
            }

            // build with translate
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var translate = new TranslateObject3D(cube, 11, 0, 0);

                root.Children.Add(translate);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
            }

            // build with pinch and translate
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var translate = new TranslateObject3D(cube, 11, 0, 0);

                var pinch = new PinchObject3D_3();
                pinch.Children.Add(translate);
                root.Children.Add(pinch);
                await pinch.Rebuild();

                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
            }

            // build with pinch and translate
            {
                var root = new Object3D();
                var cube = await CubeObject3D.Create(20, 20, 20);

                var fit = await FitToBoundsObject3D_3.Create(cube);

                fit.Width  = 50;
                fit.Depth  = 20;
                fit.Height = 20;

                var translate = new TranslateObject3D(fit, 11, 0, 0);

                var pinch = new PinchObject3D_3();
                pinch.Children.Add(translate);
                await pinch.Rebuild();

                root.Children.Add(pinch);
                var rootAabb = root.GetAxisAlignedBoundingBox();
                Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(1, -10, -10), new Vector3(21, 10, 10)), .001));
            }
        }