当前位置: 首页>>代码示例>>C#>>正文


C# Plane.SignedDistanceTo方法代码示例

本文整理汇总了C#中Plane.SignedDistanceTo方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.SignedDistanceTo方法的具体用法?C# Plane.SignedDistanceTo怎么用?C# Plane.SignedDistanceTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plane的用法示例。


在下文中一共展示了Plane.SignedDistanceTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IntersectionWith

 /// <summary>
 /// Find intersection between Line3D and Plane
 /// http://geomalgorithms.com/a05-_intersect-1.html
 /// </summary>
 /// <param name="line"></param>
 /// <param name="tolerance"></param>
 /// <returns>Intersection Point or null</returns>
 public static Point3D IntersectionWith(Plane plane, Line3D line, double tolerance = float.Epsilon)
 {
     if (line.Direction.IsPerpendicularTo(plane.Normal)) { //either parallel or lies in the plane
         Point3D projectedPoint = plane.Project(line.StartPoint, line.Direction);
         if (projectedPoint == line.StartPoint) { //Line lies in the plane
             throw new InvalidOperationException("Line lies in the plane"); //Not sure what should be done here
         } else { // Line and plane are parallel
             throw new InvalidOperationException("NULLLLLLL");
         }
     }
     var d = plane.SignedDistanceTo(line.StartPoint);
     var u = line.StartPoint.VectorTo(line.EndPoint);
     var t = -1 * d / u.DotProduct(plane.Normal);
     if (t > 1 || t < 0) { // They are not intersected
         throw new InvalidOperationException("NULLLLLLL");
     }
     return line.StartPoint + (t * u);
 }
开发者ID:leo-labs,项目名称:VisualTraclus,代码行数:25,代码来源:RepresentativeTrajectoryGenerator.cs

示例2: SignedDistanceToPoint

 public void SignedDistanceToPoint(string prps, string pns, string ps, double expected)
 {
     var plane = new Plane(UnitVector3D.Parse(pns), Point3D.Parse(prps));
     var p = Point3D.Parse(ps);
     Assert.AreEqual(expected, plane.SignedDistanceTo(p), 1E-6);
 }
开发者ID:djowatts,项目名称:mathnet-spatial,代码行数:6,代码来源:PlaneTest.cs

示例3: SignedDistanceToRay

 public void SignedDistanceToRay(string prps, string pns, string rayThroughPointString, string rayDirectionString, double expectedValue)
 {
     var plane = new Plane(UnitVector3D.Parse(pns), Point3D.Parse(prps));
     var otherPlane = new Ray3D(Point3D.Parse(rayThroughPointString), UnitVector3D.Parse(rayDirectionString));
     Assert.AreEqual(expectedValue, plane.SignedDistanceTo(otherPlane), 1E-6);
 }
开发者ID:djowatts,项目名称:mathnet-spatial,代码行数:6,代码来源:PlaneTest.cs

示例4: SignedDistanceToOtherPlane

 public void SignedDistanceToOtherPlane(string prps, string pns, string otherPlaneRootPointString, string otherPlaneNormalString, double expectedValue)
 {
     var plane = new Plane(UnitVector3D.Parse(pns), Point3D.Parse(prps));
     var otherPlane = new Plane(UnitVector3D.Parse(otherPlaneNormalString), Point3D.Parse(otherPlaneRootPointString));
     Assert.AreEqual(expectedValue, plane.SignedDistanceTo(otherPlane), 1E-6);
 }
开发者ID:djowatts,项目名称:mathnet-spatial,代码行数:6,代码来源:PlaneTest.cs


注:本文中的Plane.SignedDistanceTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。