本文整理汇总了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;
}