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


C# Curve.IsPolyline方法代码示例

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


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

示例1: GetBorderWalls

    private Brep[] GetBorderWalls(Curve borderCrv, IEnumerable<Point3d> pts, IEnumerable<Vector3d> nrmls, double dist)
    {
      List<Point3d> ptsOut = new List<Point3d>();
      List<Point3d> ptsIn = new List<Point3d>();
      IEnumerator ptEnum = pts.GetEnumerator();
      IEnumerator nrmlEnum = nrmls.GetEnumerator();
      while ((ptEnum.MoveNext()) && (nrmlEnum.MoveNext()))
      {
        Point3d pt = (Point3d)ptEnum.Current;
        Vector3d nrml = (Vector3d)nrmlEnum.Current;
        Transform mvOut = Transform.Translation(nrml * dist);
        Transform mvIn = Transform.Translation(nrml * -dist);
        Point3d ptOut = new Point3d(pt);
        Point3d ptIn = new Point3d(pt);
        ptOut.Transform(mvOut);
        ptIn.Transform(mvIn);
        ptsOut.Add(ptOut);
        ptsIn.Add(ptIn);
      }

      Curve crvOut;
      Curve crvIn;

      if (borderCrv.IsPolyline())
      {
        crvOut = new PolylineCurve(ptsOut);
        crvIn = new PolylineCurve(ptsIn);
      }
      else
      {
        crvOut = Curve.CreateInterpolatedCurve(ptsOut, 3);
        crvIn = Curve.CreateInterpolatedCurve(ptsIn, 3);
      }
      List<Curve> crvs = new List<Curve>();
      crvs.Add(crvOut);
      crvs.Add(crvIn);
      Brep[] lofts = Brep.CreateFromLoft(crvs, Point3d.Unset, Point3d.Unset, LoftType.Normal, false);

      
      Interval interval = new Interval(0, 1);
      double u, v;
      u = v = 0.05;
      BrepFace loftFace = lofts[0].Faces[0];
      loftFace.SetDomain(0, interval);
      loftFace.SetDomain(1, interval);
      while (u < 1 && v < 1)
      {
        if (loftFace.IsPointOnFace(u, v).Equals(PointFaceRelation.Interior))
        {
          break;
        }
        u += .05;
        v += .05;
      }
      Point3d loftPt = loftFace.PointAt(u, v);
      Vector3d loftNrml = loftFace.NormalAt(u, v);

      Point3d loftPtOut = loftPt;
      Point3d loftPtIn = loftPt;
      loftPtOut.Transform(Transform.Translation(loftNrml));
      loftNrml.Reverse();
      loftPtIn.Transform(Transform.Translation(loftNrml));

      Point3d envPtOut = environment.ClosestPoint(loftPtOut);
      Point3d envPtIn = environment.ClosestPoint(loftPtIn);

      if (loftPtOut.DistanceTo(envPtOut) < loftPtIn.DistanceTo(envPtIn))
      {
        foreach (Brep brep in lofts)
        {
          brep.Flip();
        }
      }

      return lofts;
    }
开发者ID:lxfschr,项目名称:Quelea,代码行数:76,代码来源:PolysurfaceEnvironmentType.cs


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