本文整理汇总了C#中Polyline.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# Polyline.Reverse方法的具体用法?C# Polyline.Reverse怎么用?C# Polyline.Reverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyline
的用法示例。
在下文中一共展示了Polyline.Reverse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PolylineAroundClosedCurve
public static Polyline PolylineAroundClosedCurve(ICurve curve) {
Polyline poly = new Polyline();
foreach (Point point in PointsOnAroundPolyline(curve))
poly.AddPoint(point);
if (Point.GetTriangleOrientation(poly.StartPoint.Point, poly.StartPoint.Next.Point, poly.StartPoint.Next.Next.Point) == TriangleOrientation.Counterclockwise)
poly = (Polyline)poly.Reverse();
poly.Closed = true;
return poly;
}
示例2: RunScript
/// <summary>
/// This procedure contains the user code. Input parameters are provided as regular arguments,
/// Output parameters as ref arguments. You don't have to assign output parameters,
/// they will have a default value.
/// </summary>
private void RunScript(List<Line> x, List<Point3d> y, ref object A, ref object B, ref object C)
{
try
{
List<IndexPair> id; List<Vertice> vs;
Vertice.CreateCollection(x, out id, out vs);
for (int i = 0; i < vs.Count; i++)
{
for (int j = 0; j < y.Count; j++)
{
if (vs[i].equalTo(y[j])) { vs[i].energe = 0.8; break; }
}
}
for (int i = 0; i < 10; i++)
{
vs.ForEach(delegate(Vertice v) { v.transferEnerge(0.70, ref vs); });
}
for (int i = 0; i < vs.Count; i++)
{
vs[i].CrateEdges(vs);
//Print(vs[i].edges.Count.ToString());
}
////////////////
Mesh mesh = new Mesh();
for (int i = 0; i < id.Count; i++)
{
Polyline pl1 = new Polyline(); Polyline pl2 = new Polyline();
if (vs[id[i].J].refer.Count == 3)
{
for (int j = 0; j < 3; j++)
{
if (vs[id[i].J].refer[j] == id[i].I)
{
pl1 = vs[id[i].J].edges[j]; break;
}
}
}
if (vs[id[i].I].refer.Count == 3)
{
for (int j = 0; j < 3; j++)
{
if (vs[id[i].I].refer[j] == id[i].J)
{
pl2 = vs[id[i].I].edges[j]; break;
}
}
}
//Print(pl1.Count.ToString());
if (pl1.Count == 4 && pl2.Count == 0)
{
Plane p = new Plane(vs[id[i].I].pos, vs[vs[id[i].I].refer[0]].pos - vs[id[i].I].pos);
pl2.AddRange(pl1);
pl2.Transform(Transform.PlanarProjection(p));
}
if (pl1.Count == 0 && pl2.Count == 4)
{
Plane p = new Plane(vs[id[i].J].pos, vs[vs[id[i].J].refer[0]].pos - vs[id[i].J].pos);
pl1.AddRange(pl2);
pl1.Transform(Transform.PlanarProjection(p));
}
if (pl1.Count == 4 && pl2.Count == 4)
{
Plane p1 = new Plane(pl1[0], pl1[1], pl1[2]);
Plane p2 = new Plane(pl2[0], pl2[1], pl2[2]);
if (Vector3d.VectorAngle(p1.Normal, p2.Normal) > Math.PI / 2) pl2.Reverse();
mesh.Append(mc.ClosedBridge(pl1, pl2));
}
}
A = mesh;
}
catch (Exception ex) { Print(ex.ToString()); }
}
示例3: PolylineAroundClosedCurve
/// <summary>
///
/// </summary>
/// <param name="curve"></param>
/// <returns></returns>
public static Polyline PolylineAroundClosedCurve(ICurve curve) {
Polyline ret;
var ellipse = curve as Ellipse;
if (ellipse != null)
ret = RefineEllipse(ellipse);
else {
var poly = curve as Polyline;
if (poly != null)
return poly;
var c = curve as Curve;
if (c != null && AllSegsAreLines(c)) {
ret = new Polyline();
foreach (LineSegment ls in c.Segments)
ret.AddPoint(ls.Start);
ret.Closed = true;
if (!ret.IsClockwise())
ret = (Polyline) ret.Reverse();
}
else
ret = StandardRectBoundary(curve);
}
return ret;
}
示例4: box
Polyline box(Line l)
{
Polyline pl = new Polyline();
Line l2 = new Line(l.From, l.To);
l2.Transform(Transform.Rotation(Math.PI / 2, (l.From + l.To) / 2));
pl.Add(l.From);
pl.Add(l2.From);
pl.Add(l.To);
pl.Add(l2.To);
Plane p = new Plane(pl[0], pl[1], pl[2]);
if (Vector3d.VectorAngle(p.Normal, Vector3d.ZAxis) > Math.PI / 2) pl.Reverse();
pl.Add(pl[0]);
return pl;
}