本文整理汇总了C#中Polyline.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Polyline.Add方法的具体用法?C# Polyline.Add怎么用?C# Polyline.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyline
的用法示例。
在下文中一共展示了Polyline.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: display
public Polyline display()
{
Polyline pl = new Polyline();
pl.Add(p2.Origin);
pl.Add(p1.Origin);
pl.Add(p3.Origin);
return pl;
}
示例2: CrateEdges
public void CrateEdges(List<Vertice> vs)
{
if (this.refer.Count == 3)
{
Point3d p1 = vs[this.refer[0]].pos; Vector3d v1 = p1 - this.pos; v1.Unitize();
Point3d p2 = vs[this.refer[1]].pos; Vector3d v2 = p2 - this.pos; v2.Unitize();
Point3d p3 = vs[this.refer[2]].pos; Vector3d v3 = p3 - this.pos; v3.Unitize();
Plane p = new Plane(p1, p2, p3);
Vector3d n = p.Normal; n.Unitize();
Point3d N1 = this.pos + n * energe;
Point3d N2 = this.pos - n * energe;
Vector3d v0 = v1 + v2; v0.Unitize(); v0 *= this.energe;
Point3d p12 = this.pos + v0;
v0 = v2 + v3; v0.Unitize(); v0 *= this.energe;
Point3d p23 = this.pos + v0;
v0 = v3 + v1; v0.Unitize(); v0 *= this.energe;
Point3d p31 = this.pos + v0;
Polyline pl1 = new Polyline(); pl1.Add(N1); pl1.Add(p12); pl1.Add(N2); pl1.Add(p31);
Polyline pl2 = new Polyline(); pl2.Add(N1); pl2.Add(p23); pl2.Add(N2); pl2.Add(p12);
Polyline pl3 = new Polyline(); pl3.Add(N1); pl3.Add(p23); pl3.Add(N2); pl3.Add(p31);
edges.Add(pl1); edges.Add(pl2); edges.Add(pl3);
}
}
示例3: 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<Point3d> x, double y, bool z, double u, ref object A, ref object B, ref object C, ref object D, ref object E, ref object F)
{
try
{
List<Line> ls = new List<Line>();//frofile
List<Polyline> pls = new List<Polyline>();//frofile
//////
List<Polyline> pls01 = new List<Polyline>();//frame1
List<Polyline> pls02 = new List<Polyline>();//frame2
////////
pls.Add(box(new Line(x[0], x[1])));
pls.Add(box(new Line(x[1], x[2])));
Polyline pl = new Polyline();
pl = box(new Line((x[0] + x[1]) / 2, (x[2] + x[1]) / 2));
pl.Transform(Transform.Translation(0, 0, -y));
pls.Add(pl);
////////
ls.Add(new Line(pls[2][0], pls[0][0]));
ls.Add(new Line(pls[2][1], pls[0][1]));
ls.Add(new Line(pls[2][2], pls[0][2]));
ls.Add(new Line(pls[2][3], pls[0][3]));
ls.Add(new Line(pls[2][0], pls[1][0]));
ls.Add(new Line(pls[2][1], pls[1][1]));
ls.Add(new Line(pls[2][2], pls[1][2]));
ls.Add(new Line(pls[2][3], pls[1][3]));
////////
for (double i = -y; i <= 0.4; i += 0.4)
{
Plane p = Plane.WorldXY;
p.Transform(Transform.Translation(0, 0, i));
double t = 0;
Polyline pl0 = new Polyline();
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[0], p, out t);
pl0.Add(ls[0].PointAt(t));
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[1], p, out t);
pl0.Add(ls[1].PointAt(t));
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[2], p, out t);
pl0.Add(ls[2].PointAt(t));
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[3], p, out t);
pl0.Add(ls[3].PointAt(t)); pl0.Add(pl0[0]);
pls01.Add(pl0);
pl0 = new Polyline();
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[4], p, out t);
pl0.Add(ls[4].PointAt(t));
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[5], p, out t);
pl0.Add(ls[5].PointAt(t));
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[6], p, out t);
pl0.Add(ls[6].PointAt(t));
Rhino.Geometry.Intersect.Intersection.LinePlane(ls[7], p, out t);
pl0.Add(ls[7].PointAt(t)); pl0.Add(pl0[0]);
pls02.Add(pl0);
}
///////////////////////////////////////
Mesh mesh1 = new Mesh();//frame
Mesh mesh2 = new Mesh();//screw
Mesh mesh3 = new Mesh();//Joint
List<Line> output1 = new List<Line>();//screw M6*40
List<Polyline> output2 = new List<Polyline>();//frame1&frame2
List<Line> output3 = new List<Line>();//screw M4*40
for (int i = 0; i < pls01.Count; i++)
{
Polyline pll = offset(pls01[i], 0.1);
pll.Transform(Transform.Translation(0, 0, 0.1));
pls01[i] = pll;
mesh1.Append(desk(pll, 0.2, 0.2));
if (i > 0)
{
output1.AddRange(Intersect(pls01[i], pls01[i - 1]));
}
}
pls02.RemoveAt(0);
for (int i = 0; i < pls02.Count; i++)
{
Polyline pll = offset(pls02[i], 0.1);
pll.Transform(Transform.Translation(0, 0, -0.1));
pls02[i] = pll;
mesh1.Append(desk(pll, 0.2, 0.2));
if (i > 0)
{
output1.AddRange(Intersect(pls02[i], pls02[i - 1]));
}
}
////////////////////////////////////////////////////////
for (int i = 1; i < pls01.Count; i++)
{
mesh3.Append(Joint(pls01[i - 1], pls01[i], 0.2, 0.2, 0.5));
}
for (int i = 1; i < pls02.Count; i++)
{
Polyline PL01 = new Polyline();
PL01.Add(pls02[i - 1][2]); PL01.Add(pls02[i - 1][3]); PL01.Add(pls02[i - 1][0]); PL01.Add(pls02[i - 1][1]);
Polyline PL02 = new Polyline();
PL02.Add(pls02[i][2]); PL02.Add(pls02[i][3]); PL02.Add(pls02[i][0]); PL02.Add(pls02[i][1]);
mesh3.Append(Joint(PL01, PL02, 0.2, 0.2, 0.5));
}
//.........这里部分代码省略.........
示例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;
}
示例5: CrateEdges
public void CrateEdges(List<Vertice1> vs,double t)
{
if (this.refer.Count == 3)
{
Point3d p1 = vs[this.refer[0]].pos; Vector3d v1 = p1 - this.pos; v1.Unitize();
Point3d p2 = vs[this.refer[1]].pos; Vector3d v2 = p2 - this.pos; v2.Unitize();
Point3d p3 = vs[this.refer[2]].pos; Vector3d v3 = p3 - this.pos; v3.Unitize();
p1 = this.pos + v1 * t; p2 = this.pos + v1 * t; p3 = this.pos + v1 * t;
Polyline pl1 = new Polyline(); pl1.Add(p1); pl1.Add(this.pos); pl1.Add(p3); pl1.Add(p1);
Polyline pl2 = new Polyline(); pl2.Add(p3); pl2.Add(this.pos); pl2.Add(p2); pl2.Add(p3);
Polyline pl3 = new Polyline(); pl3.Add(p2); pl3.Add(this.pos); pl3.Add(p1); pl3.Add(p2);
edges.Add(pl1); edges.Add(pl2); edges.Add(pl3);
}
}