-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5413a99
commit 84d284d
Showing
2 changed files
with
69 additions
and
3 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
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,52 @@ | ||
namespace Nine.Geometry.Test | ||
{ | ||
using System.Numerics; | ||
using Xunit; | ||
|
||
public class PlaneExtensionsTest | ||
{ | ||
[Fact] | ||
public void IsValid() | ||
{ | ||
var plane = Plane.CreateFromVertices( | ||
new Vector3(0, 0, 0), | ||
new Vector3(0, 1, 0), | ||
new Vector3(1, 1, 0) | ||
); | ||
|
||
var valid = plane.IsValid(); | ||
|
||
Assert.True(valid); | ||
} | ||
|
||
[Fact] | ||
public void IsValid_False() | ||
{ | ||
var plane = Plane.CreateFromVertices( | ||
new Vector3(0, 0, 0), | ||
new Vector3(0, 0, 0), | ||
new Vector3(0, 0, 0) | ||
); | ||
|
||
var valid = plane.IsValid(); | ||
|
||
Assert.False(valid); | ||
} | ||
|
||
[Fact] | ||
public void Flip() | ||
{ | ||
var plane = Plane.CreateFromVertices( | ||
new Vector3(0, 0, 0), | ||
new Vector3(0, 1, 0), | ||
new Vector3(1, 1, 0) | ||
); | ||
|
||
var org_normal = plane.Normal; | ||
var new_normal = plane.Flip().Normal; | ||
|
||
Assert.Equal(new Vector3(0, 0, -1), org_normal); | ||
Assert.Equal(new Vector3(0, 0, 1), new_normal); | ||
} | ||
} | ||
} |