ApplyTransform() public method

public ApplyTransform ( Matrix4x4 transform ) : Edge3
transform Matrix4x4
return Edge3
コード例 #1
0
        public void NonIntersectingLinesShouldReturnNone_v2(Vector3 position, Vector3 forward, Vector3 up)
        {
            var line = new Edge3(new Vector3(-1, -2, -3) * 0.001, new Vector3(-1, -2, -3));
            var plane = new PointDirection3(Vector3.Zero, Vector3.UnitX);

           var transform = Matrix4x4.CreateWorld(position, forward, up);

           var tline = line.ApplyTransform(transform);
           var tplane = plane.ApplyTransform(transform);

           tline.IntersectPlane(tplane).IsSome.Should().BeFalse();
        }
コード例 #2
0
        public void IntersectingLineWithPlaneShouldReturnIntersectionPoint(Vector3 position, Vector3 forward, Vector3 up)
        {
            var line = new Edge3(new Vector3(1,2,3), new Vector3(-1,-2,-3));
            var plane = new PointDirection3(Vector3.Zero, Vector3.UnitX);

            var transform = Matrix4x4.CreateWorld(position, forward, up);

            var tline = line.ApplyTransform(transform);
            var tplane = plane.ApplyTransform(transform);

            var intersectPlane = tline.IntersectPlane(tplane).__Value__();
            var intersectPlaneExpectedValue = Vector3.Transform(Vector3.Zero, transform);
            intersectPlane.Should().BeApproximately(intersectPlaneExpectedValue, 1e-6);
        }