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


C# Curve.GetNextDiscontinuity方法代码示例

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


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

示例1: DivByAngle

    /**
     * divideCrvsByDeltaTan : Curve[] * double -> LinkedList<Plane>
     * REQUIRES: theta > 0
     * ENSURES: divideCrvsByDeltaTan(crvs, theta) returns a linked list of planes
     *          along the curves s.t. there is a plane at every point along
     *          the curve where the change in the tangent vector between
     *          two points is greater than theta.
    **/
    private IEnumerable<Point3d> DivByAngle(Curve crv, double angle)
    {

      //initialize parameters
      double theta = angle;
      Interval dom = crv.Domain;
      double stepSize = Math.Abs(dom.Length) * Constants.AbsoluteTolerance * Constants.AbsoluteTolerance;

      //initialize list
      List<Point3d> pts = new List<Point3d>();

      Continuity c = Continuity.C1_continuous;
      //initialize data
      
      double rover = dom.Min; //steps along the curve by stepSize

      //Add plane at start point of curve to list
      Point3d pt = crv.PointAt(rover);
      pts.Add(pt);

      //Increment
      Vector3d prevTan = crv.TangentAt(rover);
      double oldRover = rover; //stores the previous rover for comparison
      rover += stepSize;

      while (rover < dom.Max)
      {
        Vector3d currTan = crv.TangentAt(rover);
        //If there is a discontinuity between the oldRover and rover
        //then place a point at the discontinuity and update prevTan.
        double discontinuity;
        bool isDisc = crv.GetNextDiscontinuity(c, oldRover, rover,
          out discontinuity);
        if (isDisc)
        {
          pt = crv.PointAt(discontinuity);
          pts.Add(pt);
          prevTan = crv.TangentAt(discontinuity);
        }

        //If the change in tangent vector is greater than theta,
        //then drop a target at the rover and update prevTan.
        double delta = RhinoMath.ToDegrees(Math.Abs(Vector3d.VectorAngle(prevTan, currTan)));
        if (delta > theta)
        {
          pt = crv.PointAt(rover);
          pts.Add(pt);
          prevTan = currTan;
        }
        //Increment
        oldRover = rover;
        rover += stepSize;
      }

      //Add target at end point of curve
      pt = crv.PointAt(dom.Max);
      pts.Add(pt);
      return pts;
    }
开发者ID:lxfschr,项目名称:Quelea,代码行数:67,代码来源:PolysurfaceEnvironmentType.cs


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