本文整理汇总了C#中Plane.ToLocal方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.ToLocal方法的具体用法?C# Plane.ToLocal怎么用?C# Plane.ToLocal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane.ToLocal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToLocal
public void ToLocal()
{
Vector3F point0 = new Vector3F(1, 0.5f, 0.5f);
Vector3F point1 = new Vector3F(0.5f, 1, 0.5f);
Vector3F point2 = new Vector3F(0.5f, 0.5f, 1);
Plane plane = new Plane(point0, point1, point2);
Vector3F pointAbove = plane.Normal * plane.DistanceFromOrigin * 2;
Vector3F pointBelow = plane.Normal * plane.DistanceFromOrigin * 0.5f;
Assert.IsTrue(Vector3F.Dot(plane.Normal, pointAbove) > plane.DistanceFromOrigin);
Assert.IsTrue(Vector3F.Dot(plane.Normal, pointBelow) < plane.DistanceFromOrigin);
Pose pose = new Pose(new Vector3F(-5, 100, -20), Matrix33F.CreateRotation(new Vector3F(1, 2, 3), 0.123f));
point0 = pose.ToLocalPosition(point0);
point1 = pose.ToLocalPosition(point1);
point2 = pose.ToLocalPosition(point2);
pointAbove = pose.ToLocalPosition(pointAbove);
pointBelow = pose.ToLocalPosition(pointBelow);
plane.ToLocal(ref pose);
Assert.IsTrue(plane.Normal.IsNumericallyNormalized);
Vector3F dummy;
Assert.IsTrue(GeometryHelper.GetClosestPoint(plane, point0, out dummy));
Assert.IsTrue(GeometryHelper.GetClosestPoint(plane, point1, out dummy));
Assert.IsTrue(GeometryHelper.GetClosestPoint(plane, point2, out dummy));
Assert.IsTrue(Vector3F.Dot(plane.Normal, pointAbove) > plane.DistanceFromOrigin);
Assert.IsTrue(Vector3F.Dot(plane.Normal, pointBelow) < plane.DistanceFromOrigin);
}