本文整理汇总了C#中Plane.DistanceToPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.DistanceToPoint方法的具体用法?C# Plane.DistanceToPoint怎么用?C# Plane.DistanceToPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane.DistanceToPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsIntersectionPlane
public bool IsIntersectionPlane(Plane plane )
{
// check if the ray lies on the plane first
var distToPoint = plane.DistanceToPoint(origin );
if ( distToPoint == 0 ) return true;
var denominator = plane.Normal.Dot(direction );
if ( denominator * distToPoint < 0 ) return true;
return false; // ray origin is behind the plane (and is pointing behind it)
}
示例2: DistanceToPlane
public float? DistanceToPlane(Plane plane )
{
var denominator = plane.Normal.Dot(direction );
if ( denominator == 0 )
{
// line is coplanar, return origin
if ( plane.DistanceToPoint(origin ) == 0 ) return 0;
// Null is preferable to undefined since undefined means.... it is undefined
return null;
}
var t = - (origin.Dot( plane.Normal ) + plane.Constant ) / denominator;
if(t >= 0) return t;
return null; // Return if the ray never intersects the plane
}
示例3: distance
private int[] distance(Plane p, double t)
{
for (int i = 0; i < points.Length; i++)
d2[i] = p.DistanceToPoint(points[i]);
return Matrix.Find(d2, z => z < t);
}