public void Plane_IntersectLineOnPlane() { Plane testPlane = new Plane(Direction.Out); Line lineOnPlane = new Line(Point.MakePointWithInches(2, 1, 0)); testPlane.IntersectWithLine(lineOnPlane).Should().Be(Point.Origin); }
public void Plane_IntersectLine_PrecisionCheck() { Point point1 = Point.MakePointWithInches(-2.5, 73, 3.5); Point point2 = Point.MakePointWithInches(1, 1, 2); Point point3 = Point.MakePointWithInches(0, 0, 2); Plane testPlane = new Plane(Direction.Out, point3); Line line = new Line(point1, point2); Point actualIntersection = testPlane.IntersectWithLine(line); Point expectedIntersection = point2; (actualIntersection == expectedIntersection).Should().BeTrue(); }
public void Plane_IntersectLine() { Plane testPlane1 = new Plane(new Direction(2, -1, 1), Point.MakePointWithInches(2, -1, 1)); Plane testPlane2 = new Plane(new Direction(1, 2, -1), Point.MakePointWithInches(2, -1, 1)); Line perpendicular1 = new Line(Point.MakePointWithInches(2, -1, 1)); Line perpendicular2 = new Line(Point.MakePointWithInches(3, 1, -3), Point.MakePointWithInches(4, 3, -4)); //1, 2, -1 Point intersection11 = testPlane1.IntersectWithLine(perpendicular1); Point intersection12 = testPlane1.IntersectWithLine(perpendicular2); Point intersection21 = testPlane2.IntersectWithLine(perpendicular1); Point intersection22 = testPlane2.IntersectWithLine(perpendicular2); intersection11.Should().Be(Point.MakePointWithInches(2, -1, 1)); intersection21.Should().Be(Point.MakePointWithInches(2, -1, 1)); intersection12.Should().Be(Point.MakePointWithInches(-1, -7, 1)); intersection22.Should().Be(Point.MakePointWithInches(1.5, -2, -1.5)); }