mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-22 02:38:28 +00:00
+ Renamed Bounds max/min away from underscore in name
+ Moved Bounds.cs to Public/Spatial
This commit is contained in:
parent
2ca5c42094
commit
dd9ab94fa1
@ -75,13 +75,13 @@ namespace OSCADSharp.UnitTests
|
|||||||
|
|
||||||
var bounds = obj.Bounds();
|
var bounds = obj.Bounds();
|
||||||
|
|
||||||
Assert.AreEqual(20, bounds.Z_Max);
|
Assert.AreEqual(20, bounds.ZMax);
|
||||||
Assert.AreEqual(10, bounds.Y_Max);
|
Assert.AreEqual(10, bounds.YMax);
|
||||||
Assert.AreEqual(5, bounds.X_Max);
|
Assert.AreEqual(5, bounds.XMax);
|
||||||
|
|
||||||
Assert.AreEqual(-5, bounds.Z_Min);
|
Assert.AreEqual(-5, bounds.ZMin);
|
||||||
Assert.AreEqual(0, bounds.Y_Min);
|
Assert.AreEqual(0, bounds.YMin);
|
||||||
Assert.AreEqual(-15, bounds.X_Min);
|
Assert.AreEqual(-15, bounds.XMin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ namespace OSCADSharp.UnitTests
|
|||||||
var boundsBefore = cube.Bounds();
|
var boundsBefore = cube.Bounds();
|
||||||
cube = cube.Mirror(0, 1, 0);
|
cube = cube.Mirror(0, 1, 0);
|
||||||
|
|
||||||
Assert.AreEqual(cube.Bounds().Y_Max, boundsBefore.Y_Min);
|
Assert.AreEqual(cube.Bounds().YMax, boundsBefore.YMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
@ -26,13 +26,13 @@ namespace OSCADSharp.UnitTests.Transforms
|
|||||||
var obj = new Cube(5, 5, 5).Scale(2, 2, 3);
|
var obj = new Cube(5, 5, 5).Scale(2, 2, 3);
|
||||||
|
|
||||||
var bounds = obj.Bounds();
|
var bounds = obj.Bounds();
|
||||||
Assert.AreEqual(bounds.X_Max, 10);
|
Assert.AreEqual(bounds.XMax, 10);
|
||||||
Assert.AreEqual(bounds.Y_Max, 10);
|
Assert.AreEqual(bounds.YMax, 10);
|
||||||
Assert.AreEqual(bounds.Z_Max, 15);
|
Assert.AreEqual(bounds.ZMax, 15);
|
||||||
|
|
||||||
Assert.AreEqual(bounds.X_Min, 0);
|
Assert.AreEqual(bounds.XMin, 0);
|
||||||
Assert.AreEqual(bounds.Y_Min, 0);
|
Assert.AreEqual(bounds.YMin, 0);
|
||||||
Assert.AreEqual(bounds.Z_Min, 0);
|
Assert.AreEqual(bounds.ZMin, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
@ -66,30 +66,30 @@ namespace OSCADSharp.Scripting
|
|||||||
foreach (var child in this.children)
|
foreach (var child in this.children)
|
||||||
{
|
{
|
||||||
var bounds = child.Bounds();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -78,9 +78,9 @@ namespace OSCADSharp.Transforms
|
|||||||
{
|
{
|
||||||
var oldBounds = obj.Bounds();
|
var oldBounds = obj.Bounds();
|
||||||
|
|
||||||
double xScaleFactor = this.Size.X > 0 ? this.Size.X / Math.Abs(oldBounds.X_Max - oldBounds.X_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.Y_Max - oldBounds.Y_Min) : 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.Z_Max - oldBounds.Z_Min) : 1;
|
double zScaleFactor = this.Size.Z > 0 ? this.Size.Z / Math.Abs(oldBounds.ZMax - oldBounds.ZMin) : 1;
|
||||||
Vector3 scaleMultiplier = new Vector3(xScaleFactor, yScaleFactor, zScaleFactor);
|
Vector3 scaleMultiplier = new Vector3(xScaleFactor, yScaleFactor, zScaleFactor);
|
||||||
|
|
||||||
return new Bounds(oldBounds.BottomLeft * scaleMultiplier, oldBounds.TopRight * scaleMultiplier);
|
return new Bounds(oldBounds.BottomLeft * scaleMultiplier, oldBounds.TopRight * scaleMultiplier);
|
||||||
|
|||||||
@ -60,7 +60,7 @@
|
|||||||
<Compile Include="Public\Settings\Settings.cs" />
|
<Compile Include="Public\Settings\Settings.cs" />
|
||||||
<Compile Include="Public\Inches.cs" />
|
<Compile Include="Public\Inches.cs" />
|
||||||
<Compile Include="Internal\Bindings\BindableVector.cs" />
|
<Compile Include="Internal\Bindings\BindableVector.cs" />
|
||||||
<Compile Include="Internal\Spatial\Bounds.cs" />
|
<Compile Include="Public\Spatial\Bounds.cs" />
|
||||||
<Compile Include="Internal\Spatial\Matrix.cs" />
|
<Compile Include="Internal\Spatial\Matrix.cs" />
|
||||||
<Compile Include="Internal\Transforms\HulledObject.cs" />
|
<Compile Include="Internal\Transforms\HulledObject.cs" />
|
||||||
<Compile Include="Internal\Transforms\LinearExtrudedObject.cs" />
|
<Compile Include="Internal\Transforms\LinearExtrudedObject.cs" />
|
||||||
|
|||||||
@ -37,47 +37,47 @@ namespace OSCADSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// X position with the greatest value
|
/// X position with the greatest value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// X position with the smallest value
|
/// X position with the smallest value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Y position with the greatest value
|
/// Y position with the greatest value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Y position with the smallest value
|
/// Y position with the smallest value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Z position with the greatest value
|
/// Z position with the greatest value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Z position with the smallest value
|
/// Z position with the smallest value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Size on the X axis
|
/// Size on the X axis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Length { get { return this.X_Max - this.X_Min; } }
|
public double Length { get { return this.XMax - this.XMin; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Size on the Y axis
|
/// Size on the Y axis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Width { get { return this.Y_Max - this.Y_Min; } }
|
public double Width { get { return this.YMax - this.YMin; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Size on the Z axis
|
/// Size on the Z axis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Height { get { return this.Z_Max - this.Z_Min; } }
|
public double Height { get { return this.ZMax - this.ZMin; } }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Overrides
|
#region Overrides
|
||||||
Loading…
x
Reference in New Issue
Block a user