From dd9ab94fa1f860fd19c5bcbd4311326a4e612e65 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sun, 6 Mar 2016 17:51:28 -0800 Subject: [PATCH] + Renamed Bounds max/min away from underscore in name + Moved Bounds.cs to Public/Spatial --- .../Booleans/UnionTests.cs | 12 +++++----- .../Transforms/MirrorTests.cs | 2 +- .../Transforms/ScaleTests.cs | 12 +++++----- .../Scripting/MultiStatementObject.cs | 24 +++++++++---------- .../Internal/Transforms/ResizedObject.cs | 6 ++--- OSCADSharp/OSCADSharp/OSCADSharp.csproj | 2 +- .../{Internal => Public}/Spatial/Bounds.cs | 18 +++++++------- 7 files changed, 38 insertions(+), 38 deletions(-) rename OSCADSharp/OSCADSharp/{Internal => Public}/Spatial/Bounds.cs (75%) diff --git a/OSCADSharp/OSCADSharp.UnitTests/Booleans/UnionTests.cs b/OSCADSharp/OSCADSharp.UnitTests/Booleans/UnionTests.cs index 1cad3da..1232fdd 100644 --- a/OSCADSharp/OSCADSharp.UnitTests/Booleans/UnionTests.cs +++ b/OSCADSharp/OSCADSharp.UnitTests/Booleans/UnionTests.cs @@ -75,13 +75,13 @@ namespace OSCADSharp.UnitTests var bounds = obj.Bounds(); - Assert.AreEqual(20, bounds.Z_Max); - Assert.AreEqual(10, bounds.Y_Max); - Assert.AreEqual(5, bounds.X_Max); + Assert.AreEqual(20, bounds.ZMax); + Assert.AreEqual(10, bounds.YMax); + Assert.AreEqual(5, bounds.XMax); - Assert.AreEqual(-5, bounds.Z_Min); - Assert.AreEqual(0, bounds.Y_Min); - Assert.AreEqual(-15, bounds.X_Min); + Assert.AreEqual(-5, bounds.ZMin); + Assert.AreEqual(0, bounds.YMin); + Assert.AreEqual(-15, bounds.XMin); } } } diff --git a/OSCADSharp/OSCADSharp.UnitTests/Transforms/MirrorTests.cs b/OSCADSharp/OSCADSharp.UnitTests/Transforms/MirrorTests.cs index d00f72f..ed7b113 100644 --- a/OSCADSharp/OSCADSharp.UnitTests/Transforms/MirrorTests.cs +++ b/OSCADSharp/OSCADSharp.UnitTests/Transforms/MirrorTests.cs @@ -48,7 +48,7 @@ namespace OSCADSharp.UnitTests var boundsBefore = cube.Bounds(); cube = cube.Mirror(0, 1, 0); - Assert.AreEqual(cube.Bounds().Y_Max, boundsBefore.Y_Min); + Assert.AreEqual(cube.Bounds().YMax, boundsBefore.YMin); } [TestMethod] diff --git a/OSCADSharp/OSCADSharp.UnitTests/Transforms/ScaleTests.cs b/OSCADSharp/OSCADSharp.UnitTests/Transforms/ScaleTests.cs index d510eaa..3129615 100644 --- a/OSCADSharp/OSCADSharp.UnitTests/Transforms/ScaleTests.cs +++ b/OSCADSharp/OSCADSharp.UnitTests/Transforms/ScaleTests.cs @@ -26,13 +26,13 @@ namespace OSCADSharp.UnitTests.Transforms var obj = new Cube(5, 5, 5).Scale(2, 2, 3); var bounds = obj.Bounds(); - Assert.AreEqual(bounds.X_Max, 10); - Assert.AreEqual(bounds.Y_Max, 10); - Assert.AreEqual(bounds.Z_Max, 15); + Assert.AreEqual(bounds.XMax, 10); + Assert.AreEqual(bounds.YMax, 10); + Assert.AreEqual(bounds.ZMax, 15); - Assert.AreEqual(bounds.X_Min, 0); - Assert.AreEqual(bounds.Y_Min, 0); - Assert.AreEqual(bounds.Z_Min, 0); + Assert.AreEqual(bounds.XMin, 0); + Assert.AreEqual(bounds.YMin, 0); + Assert.AreEqual(bounds.ZMin, 0); } [TestMethod] diff --git a/OSCADSharp/OSCADSharp/Internal/Scripting/MultiStatementObject.cs b/OSCADSharp/OSCADSharp/Internal/Scripting/MultiStatementObject.cs index dc45de2..7f88f23 100644 --- a/OSCADSharp/OSCADSharp/Internal/Scripting/MultiStatementObject.cs +++ b/OSCADSharp/OSCADSharp/Internal/Scripting/MultiStatementObject.cs @@ -66,30 +66,30 @@ namespace OSCADSharp.Scripting foreach (var child in this.children) { var bounds = child.Bounds(); - if (bounds.X_Min < newBottomLeft.X) + if (bounds.XMin < newBottomLeft.X) { - newBottomLeft.X = bounds.X_Min; + newBottomLeft.X = bounds.XMin; } - if (bounds.Y_Min < newBottomLeft.Y) + if (bounds.YMin < newBottomLeft.Y) { - newBottomLeft.Y = bounds.Y_Min; + newBottomLeft.Y = bounds.YMin; } - if (bounds.Z_Min < newBottomLeft.Z) + if (bounds.ZMin < newBottomLeft.Z) { - newBottomLeft.Z = bounds.Z_Min; + newBottomLeft.Z = bounds.ZMin; } - if (bounds.X_Max > newTopRight.X) + if (bounds.XMax > newTopRight.X) { - newTopRight.X = bounds.X_Max; + newTopRight.X = bounds.XMax; } - if (bounds.Y_Max> newTopRight.Y) + if (bounds.YMax> newTopRight.Y) { - newTopRight.Y = bounds.Y_Max; + newTopRight.Y = bounds.YMax; } - if (bounds.Z_Max > newTopRight.Z) + if (bounds.ZMax > newTopRight.Z) { - newTopRight.Z = bounds.Z_Max; + newTopRight.Z = bounds.ZMax; } } diff --git a/OSCADSharp/OSCADSharp/Internal/Transforms/ResizedObject.cs b/OSCADSharp/OSCADSharp/Internal/Transforms/ResizedObject.cs index 1d41775..2b78c57 100644 --- a/OSCADSharp/OSCADSharp/Internal/Transforms/ResizedObject.cs +++ b/OSCADSharp/OSCADSharp/Internal/Transforms/ResizedObject.cs @@ -78,9 +78,9 @@ namespace OSCADSharp.Transforms { var oldBounds = obj.Bounds(); - double xScaleFactor = this.Size.X > 0 ? this.Size.X / Math.Abs(oldBounds.X_Max - oldBounds.X_Min) : 1; - double yScaleFactor = this.Size.Y > 0 ? this.Size.Y / Math.Abs(oldBounds.Y_Max - oldBounds.Y_Min) : 1; - double zScaleFactor = this.Size.Z > 0 ? this.Size.Z / Math.Abs(oldBounds.Z_Max - oldBounds.Z_Min) : 1; + double xScaleFactor = this.Size.X > 0 ? this.Size.X / Math.Abs(oldBounds.XMax - oldBounds.XMin) : 1; + double yScaleFactor = this.Size.Y > 0 ? this.Size.Y / Math.Abs(oldBounds.YMax - oldBounds.YMin) : 1; + double zScaleFactor = this.Size.Z > 0 ? this.Size.Z / Math.Abs(oldBounds.ZMax - oldBounds.ZMin) : 1; Vector3 scaleMultiplier = new Vector3(xScaleFactor, yScaleFactor, zScaleFactor); return new Bounds(oldBounds.BottomLeft * scaleMultiplier, oldBounds.TopRight * scaleMultiplier); diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj index 005f204..3f956e0 100644 --- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj +++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj @@ -60,7 +60,7 @@ - + diff --git a/OSCADSharp/OSCADSharp/Internal/Spatial/Bounds.cs b/OSCADSharp/OSCADSharp/Public/Spatial/Bounds.cs similarity index 75% rename from OSCADSharp/OSCADSharp/Internal/Spatial/Bounds.cs rename to OSCADSharp/OSCADSharp/Public/Spatial/Bounds.cs index 3fe54e6..18c4b0a 100644 --- a/OSCADSharp/OSCADSharp/Internal/Spatial/Bounds.cs +++ b/OSCADSharp/OSCADSharp/Public/Spatial/Bounds.cs @@ -37,47 +37,47 @@ namespace OSCADSharp /// /// X position with the greatest value /// - public double X_Max { get { return TopRight.X > BottomLeft.X ? TopRight.X : BottomLeft.X; } } + public double XMax { get { return TopRight.X > BottomLeft.X ? TopRight.X : BottomLeft.X; } } /// /// X position with the smallest value /// - public double X_Min { get { return TopRight.X < BottomLeft.X ? TopRight.X : BottomLeft.X; } } + public double XMin { get { return TopRight.X < BottomLeft.X ? TopRight.X : BottomLeft.X; } } /// /// Y position with the greatest value /// - public double Y_Max { get { return TopRight.Y > BottomLeft.Y ? TopRight.Y : BottomLeft.Y; } } + public double YMax { get { return TopRight.Y > BottomLeft.Y ? TopRight.Y : BottomLeft.Y; } } /// /// Y position with the smallest value /// - public double Y_Min { get { return TopRight.Y < BottomLeft.Y ? TopRight.Y : BottomLeft.Y; } } + public double YMin { get { return TopRight.Y < BottomLeft.Y ? TopRight.Y : BottomLeft.Y; } } /// /// Z position with the greatest value /// - public double Z_Max { get { return TopRight.Z > BottomLeft.Z ? TopRight.Z : BottomLeft.Z; } } + public double ZMax { get { return TopRight.Z > BottomLeft.Z ? TopRight.Z : BottomLeft.Z; } } /// /// Z position with the smallest value /// - public double Z_Min { get { return TopRight.Z < BottomLeft.Z ? TopRight.Z : BottomLeft.Z; } } + public double ZMin { get { return TopRight.Z < BottomLeft.Z ? TopRight.Z : BottomLeft.Z; } } /// /// Size on the X axis /// - public double Length { get { return this.X_Max - this.X_Min; } } + public double Length { get { return this.XMax - this.XMin; } } /// /// Size on the Y axis /// - public double Width { get { return this.Y_Max - this.Y_Min; } } + public double Width { get { return this.YMax - this.YMin; } } /// /// Size on the Z axis /// - public double Height { get { return this.Z_Max - this.Z_Min; } } + public double Height { get { return this.ZMax - this.ZMin; } } #endregion #region Overrides