Plane Intersect Method Delta Engine Documentation

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

public Nullable<Vector3D> Intersect(
	Ray ray
)

Return Value

Type: Nullable Vector3D 
Remarks

Tests: DeltaEngine.Tests.Datatypes.PlaneTests
Examples

3 unit tests call DeltaEngine.Datatypes.Plane.Intersect(DeltaEngine.Datatypes.Ray)
[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