public async Task AabbCalculatedCorrectlyForCurvedFitObjects() { StartupMC(); 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; fit.Invalidate(InvalidateType.Properties); Assert.IsTrue(fit.GetAxisAlignedBoundingBox().Equals(new AxisAlignedBoundingBox(new Vector3(-25, -10, -10), new Vector3(25, 10, 10)), 1.0)); var curve = new CurveObject3D_3() { BendType = CurveObject3D_3.BendTypes.Diameter, Diameter = 50 }; curve.Children.Add(fit); await curve.Rebuild(); var curveAabb = curve.GetAxisAlignedBoundingBox(); root.Children.Add(curve); var rootAabb = root.GetAxisAlignedBoundingBox(); Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-17.5, -9.9, -10), new Vector3(17.5, 11.97, 10)), 1.0)); }
public async Task AabbCalculatedCorrectlyForCurvedFitObjects() { 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.ProcessCommandline(); 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; Assert.IsTrue(fit.GetAxisAlignedBoundingBox().Equals(new AxisAlignedBoundingBox(new Vector3(-25, -10, -10), new Vector3(25, 10, 10)), 1.0)); var curve = new CurveObject3D_3() { BendType = CurveObject3D_3.BendTypes.Diameter, Diameter = 50 }; curve.Children.Add(fit); await curve.Rebuild(); var curveAabb = curve.GetAxisAlignedBoundingBox(); root.Children.Add(curve); var rootAabb = root.GetAxisAlignedBoundingBox(); Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-17.5, -9.9, -10), new Vector3(17.5, 11.97, 10)), 1.0)); }