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


C# Plane.Project方法代码示例

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


在下文中一共展示了Plane.Project方法的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: ProjectVectorOnTest

 public void ProjectVectorOnTest()
 {
     var unitVector = UnitVector3D.ZAxis;
     var rootPoint = new Point3D(0, 0, 1);
     var plane = new Plane(unitVector, rootPoint);
     var vector = new Vector3D(1, 0, 0);
     var projectOn = plane.Project(vector);
     AssertGeometry.AreEqual(new Vector3D(1, 0, 0), projectOn.Direction, float.Epsilon);
     AssertGeometry.AreEqual(new Point3D(0, 0, 1), projectOn.ThroughPoint, float.Epsilon);
 }
开发者ID:djowatts,项目名称:mathnet-spatial,代码行数:10,代码来源:PlaneTest.cs

示例3: ProjectPoint

 private void ProjectPoint(Point3D pointToProject, Point3D planeRootPoint, UnitVector3D planeNormal, Point3D projectedresult)
 {
     var plane = new Plane(planeNormal, planeRootPoint);
     var projectOn = plane.Project(pointToProject);
     AssertGeometry.AreEqual(projectedresult, projectOn, float.Epsilon);
 }
开发者ID:djowatts,项目名称:mathnet-spatial,代码行数:6,代码来源:PlaneTest.cs

示例4: ProjectLineOnTest

        public void ProjectLineOnTest()
        {
            var unitVector = UnitVector3D.ZAxis;
            var rootPoint = new Point3D(0, 0, 1);
            var plane = new Plane(unitVector, rootPoint);

            var line = new Line3D(new Point3D(0, 0, 0), new Point3D(1, 0, 0));
            var projectOn = plane.Project(line);
            AssertGeometry.AreEqual(new Line3D(new Point3D(0, 0, 1), new Point3D(1, 0, 1)), projectOn, float.Epsilon);
        }
开发者ID:djowatts,项目名称:mathnet-spatial,代码行数:10,代码来源:PlaneTest.cs


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