PlaneTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Tests.Datatypes PlaneTests

Namespace: DeltaEngine.Tests.Datatypes
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class PlaneTests

The PlaneTests type exposes the following members.

Constructors

  NameDescription
Public methodPlaneTests
Initializes a new instance of the PlaneTests class
Top
Methods

  NameDescription
Public methodCreatePlaneFromDistance
Public methodCreatePlaneFromPointOnPlane
Public methodEqualityOfPlanes
Public methodRayParallelToPlaneDoesntIntersect
Public methodRayPlaneIntersect
Public methodRayPointingAwayFromPlaneDoesntIntersect
Top
Examples

[Test]
public void EqualityOfPlanes()
{
    const float Distance = 4.0f;
    Assert.AreEqual(new Plane(Vector3D.UnitZ, Distance), new Plane(Vector3D.UnitZ, Distance));
    Assert.AreNotEqual(new Plane(Vector3D.UnitZ, Distance), new Plane(Vector3D.UnitZ, 1));
    Assert.AreNotEqual(new Plane(Vector3D.UnitZ, Distance), new Plane(Vector3D.UnitX, Distance));
}
[Test]
public void CreatePlaneFromDistance()
{
    var plane = new Plane(Vector3D.UnitY, 1.0f);
    Assert.AreEqual(Vector3D.UnitY, plane.Normal);
    Assert.AreEqual(1.0f, plane.Distance);
}
[Test]
public void CreatePlaneFromPointOnPlane()
{
    var plane = new Plane(Vector3D.UnitY, new Vector3D(0, 1, 0));
    Assert.AreEqual(Vector3D.UnitY, plane.Normal);
    Assert.AreEqual(-1.0f, plane.Distance);
}
[Test]
public void RayPlaneIntersect()
{
    VerifyIntersectPoint(new Ray(Vector3D.UnitZ, -Vector3D.UnitZ), new Plane(Vector3D.UnitZ, 3.0f),
        -Vector3D.UnitZ * 3.0f);
    VerifyIntersectPoint(new Ray(3 * Vector3D.One, -Vector3D.One),
        new Plane(Vector3D.UnitY, Vector3D.One), Vector3D.One);
}
[Test]
public void RayPointingAwayFromPlaneDoesntIntersect()
{
    var ray = new Ray(3 * Vector3D.One, Vector3D.One);
    var plane = new Plane(Vector3D.UnitY, Vector3D.One);
    Assert.IsNull(plane.Intersect(ray));
}
[Test]
public void RayParallelToPlaneDoesntIntersect()
{
    var ray = new Ray(Vector3D.One, Vector3D.UnitZ);
    var plane = new Plane(Vector3D.UnitY, Vector3D.Zero);
    Assert.IsNull(plane.Intersect(ray));
}
See Also