-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from DomCR/boundingbox-isIn
Boundingbox is in
- Loading branch information
Showing
7 changed files
with
88 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Xunit; | ||
|
||
namespace CSMath.Tests | ||
{ | ||
public class BoundingBoxTests | ||
{ | ||
[Theory] | ||
[InlineData(0, 0, 0, true)] | ||
[InlineData(11, 0, 0, false)] | ||
[InlineData(11, 0, -11, false)] | ||
[InlineData(5, 0, 5, true)] | ||
[InlineData(10, 10, 10, true)] | ||
public void IsInPointTest(double x, double y, double z, bool isIn) | ||
{ | ||
BoundingBox box = new BoundingBox(-10, -10, -10, 10, 10, 10); | ||
|
||
XYZ xyz = new XYZ(x, y, z); | ||
Assert.Equal(isIn, box.IsIn(xyz)); | ||
} | ||
|
||
[Theory] | ||
[InlineData(-10, -10, -10, 10, 10, 10, true, true)] | ||
[InlineData(-5, -5, -5, 5, 5, 5, true, true)] | ||
[InlineData(-5, -5, -5, 5, 50, 50, false, true)] | ||
[InlineData(-50, -60, -50, -11, -11, -11, false, false)] | ||
public void IsInBoxTest(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, bool isIn, bool partialInside) | ||
{ | ||
BoundingBox box = new BoundingBox(-10, -10, -10, 10, 10, 10); | ||
|
||
BoundingBox test = new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ); | ||
Assert.Equal(isIn, box.IsIn(test, out bool partialyIn)); | ||
Assert.Equal(partialInside, partialyIn); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters