public void LineProjectionToPlaneTest() { Point3d p1 = new Point3d(1, -5, -1); Vector3d v1 = new Vector3d(-2, 3, 4); Line3d l1 = new Line3d(p1, v1); Plane3d s1 = new Plane3d(-2, 2, 3, -29); Point3d p2 = (Point3d)l1.IntersectionWith(s1); Line3d l2 = (Line3d)l1.ProjectionTo(s1); Assert.IsTrue(p2.BelongsTo(l2)); }
public void LineConvertProjectionToPlaneTest2() { Coord3d coord1 = Coord3d.GlobalCS.Copy(); Coord3d coord2 = Coord3d.GlobalCS.Copy(); coord2.RotateDeg(new Vector3d(1, 1, 1), 120); Point3d p1 = new Point3d(1, 2, 3, coord1); Vector3d v1 = new Vector3d(0, 2, 1); Line3d l1 = new Line3d(p1, v1); l1.Point = l1.Point.ConvertTo(coord2); Plane3d s1 = coord2.XZ_plane; s1.Point = s1.Point.ConvertTo(coord1); Assert.IsTrue((Line3d)l1.ProjectionTo(s1) == new Line3d(new Point3d(1, 2, 0), new Vector3d(0, 1, 0))); }