private ApplyTransform ( Matrix4x4 matrix ) : |
||
matrix | Matrix4x4 | |
리턴 |
public TriangleWithNormals ApplyTransform(Matrix4x4 matrix) { return(new TriangleWithNormals( A.ApplyTransform(matrix), B.ApplyTransform(matrix), C.ApplyTransform(matrix) )); }
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(); }
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); }
public void IntersectingShouldBeMatched(Matrix4x4 transform, Triangle triangle) { var plane = new PointDirection3(Vector3.Zero, Vector3.UnitX); var ttriangle = triangle.ApplyTransform(transform); var pplane = plane.ApplyTransform(transform); var intersectionO = ttriangle.IntersectPlane(pplane); intersectionO.IsSome.Should().Be(true); }