public static void SelfTest(ITestToolkit tk) { Triangle t = new Triangle(Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ); Ray r = new Ray(new Vector3(0.1f, 0.1f, 3), new Vector3(0, 0, -1)); IntersectionResult result = t.Intersect(r); tk.Assert(result.DoesIntersect); t = new Triangle(Vector3.Zero, Vector3.UnitX, Vector3.UnitY); r = new Ray(new Vector3(0.1f, 0.1f, 3), -Vector3.UnitZ); result = t.Intersect(r); tk.AssertEqual(3, result.Param); r = new Ray(new Vector3(-1, 0, 3), -Vector3.UnitZ); result = t.Intersect(r); tk.Assert(!result.DoesIntersect); }
public static void SelfTest(ITestToolkit tk) { Ray r = new Ray(Vector3.UnitX, Vector3.UnitX); Vector3 origin = r.Origin; Vector3 dir = r.Direction; }