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


C# Curve.DivideByCount方法代码示例

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


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

示例1: MeshLoft

 public Mesh MeshLoft(Curve c1, Curve c2, int u, int v)
 {
     double[] uList1 = c1.DivideByCount(u, true);
     double[] uList2 = c2.DivideByCount(u, true);
     List<Polyline> input1 = new List<Polyline>();
     for (int i = 0; i < uList1.Length; i++)
     {
         Point3d p1 = c1.PointAt(uList1[i]);
         Point3d p2 = c2.PointAt(uList2[i]);
         Vector3d V = p2 - p1;
         V /= v;
         Polyline pl = new Polyline();
         for (int k = 0; k < v + 1; k++)
         {
             pl.Add(p1 + (V * k));
         }
         input1.Add(pl);
     }
     return MeshLoft(input1, false, false);
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:20,代码来源:MeshCreation.cs

示例2: TriangleMeshLoft2

 public Mesh TriangleMeshLoft2(Curve c1, Curve c2, int t1, int t2)
 {
     Vector3d v1 = c1.PointAtEnd - c1.PointAtStart;
     Vector3d v2 = c2.PointAtEnd - c2.PointAtStart;
     if (Vector3d.VectorAngle(v1, v2) > Math.PI / 2) { c2.Reverse(); }
     Mesh mesh = new Mesh();
     List<Point3d> ps = new List<Point3d>();
     int Count = t1 - t2;
     double[] t01 = c1.DivideByCount(Count, true);
     double[] t02 = c2.DivideByCount(Count, true);
     for (int i = t2; i <= t1; i++)
     {
         Point3d p1 = c1.PointAt(t01[i - t2]);
         Point3d p2 = c2.PointAt(t02[i - t2]);
         Vector3d v = p2 - p1;
         for (int k = 0; k < i; k++)
         {
             double t3 = 0;
             if (i > 1) { t3 = ((double)k / (double)(i - 1)); }
             ps.Add(p1 + v * t3);
         }
     }
     if (t2 > 1)
     {
         return TriangleMeshFromPoints(ps, t2, t1);
     }
     if (t2 == 1) { return TriangleMeshFromPoints(ps); }
     else return mesh;
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:29,代码来源:MeshCreation.cs

示例3: TriangleMeshLoft

        public Mesh TriangleMeshLoft(Curve c1, Curve c2, int t1, int t2)
        {
            //t2>t1;
            Vector3d v1 = c1.PointAtEnd - c1.PointAtStart;
            Vector3d v2 = c2.PointAtEnd - c2.PointAtStart;
            if (Vector3d.VectorAngle(v1, v2) > Math.PI / 2) { c2.Reverse(); }

            List<Point3d> ps = new List<Point3d>();
            double[] t0 = c2.DivideByCount(t2 - 1, true);
            for (int i = 0; i < t0.Length; i++)
            { ps.Add(c2.PointAt(t0[i])); }

            for (int i = t2; i < t1; i++)
            {
                t0 = c2.DivideByCount(i, true);
                double[] t01 = c1.DivideByCount(i, true);
                for (int k = 0; k < t01.Length; k++)
                {
                    Vector3d v = c1.PointAt(t01[k]) - c2.PointAt(t0[k]);
                    v *= (double)((i - t2 + 1)) / (double)(t1 - t2);
                    ps.Add(c2.PointAt(t0[k]) + v);
                }
            }
            return TriangleMeshFromPoints(ps, t2, t1);
        }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:25,代码来源:MeshCreation.cs

示例4: MeshSweep1

 public Mesh MeshSweep1(Curve l, Curve l2, int Count, int Count2)
 {
     Polyline ls = new Polyline();
     double[] div = l2.DivideByCount(Count2, true);
     for (int i = 0; i < div.Length; i++)
     {
         ls.Add(l2.PointAt(div[i]));
     }
     return MeshSweep1(l, ls, Count);
 }
开发者ID:panhao4812,项目名称:MeshClassLibrary,代码行数:10,代码来源:MeshCreation.cs


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