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


C# Polyline.Simplify方法代码示例

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


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

示例1: getIsoline

        private Polyline getIsoline(List<Triangle> triangles, double z)
        {
            Polyline result = new Polyline();

            for (int i = 0; i < triangles.Count; i++)
            {
                Triangle t = triangles[i];

                Coordinate3D v1 = ((Coordinate3D)t.Cell1.DataPoint);
                Coordinate3D v2 = ((Coordinate3D)t.Cell2.DataPoint);
                Coordinate3D v3 = ((Coordinate3D)t.Cell3.DataPoint);

                List<double> tz = new List<double>();
                tz.Add(v1.Z);
                tz.Add(v2.Z);
                tz.Add(v3.Z);

                tz.Sort();

                // triangle is below the plane
                if (z > tz[2]) continue;

                // triangle lies in the plane
                if (z == tz[0] && z == tz[1] && z == tz[2])
                    continue;

                // Triangle is above the plane. 
                // This means that all the remaining triangles are also above the plane.
                // Stop processing.
                if (z <= tz[0]) break;

                List<ICoordinate> coords = new List<ICoordinate>();
                // one edge of triangle lies in the plane
                if ((z == tz[0] && z == tz[1]) ||
                    (z == tz[1] && z == tz[2]))
                {
                    if (z == v1.Z) coords.Add(v1);
                    if (z == v2.Z) coords.Add(v2);
                    if (z == v3.Z) coords.Add(v3);

                    result.Paths.Add(new LinePath(coords));
                    continue;
                }

                // triangle intersects the plane
                if (liesBetween(z, v1.Z, v2.Z))
                    coords.Add(getPlaneSegmentIntersection(v1, v2, z));

                if (liesBetween(z, v2.Z, v3.Z))
                    coords.Add(getPlaneSegmentIntersection(v2, v3, z));

                if (liesBetween(z, v3.Z, v1.Z))
                    coords.Add(getPlaneSegmentIntersection(v3, v1, z));

                result.Paths.Add(new LinePath(coords));
            }
            result.Simplify();

            return result;
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:60,代码来源:IsolineBuilder.cs


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