本文整理汇总了C#中Rhino.Geometry.Curve.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# Curve.Reverse方法的具体用法?C# Curve.Reverse怎么用?C# Curve.Reverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Geometry.Curve
的用法示例。
在下文中一共展示了Curve.Reverse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例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;
}
示例3: PerformSweep
/// <example>
/// <code source='examples\vbnet\ex_sweep1.vb' lang='vbnet'/>
/// <code source='examples\cs\ex_sweep1.cs' lang='cs'/>
/// <code source='examples\py\ex_sweep1.py' lang='py'/>
/// </example>
public Brep[] PerformSweep(Curve rail, IEnumerable<Curve> crossSections)
{
List<double> rail_params = new List<double>();
Interval domain = rail.Domain;
foreach (Curve c in crossSections)
{
Point3d point_at_start = c.PointAtStart;
double t;
rail.ClosestPoint(point_at_start, out t);
if (t == domain.Max)
t = domain.Max - RhinoMath.SqrtEpsilon;
rail_params.Add(t);
}
if (rail_params.Count == 1 && Math.Abs(rail_params[0]-rail.Domain.Max)<=RhinoMath.SqrtEpsilon )
{
// 27 May 2011 - S. Baer
// I had to dig through source for quite a while to figure out what is going on, but
// if there is only one cross section and we are NOT using start/end points, then a
// rail_param at rail.Domain.Max is appended which completely messes things up when the
// only shape curve is already at the max domain of the rail.
rail.Reverse();
rail_params[0] = rail.Domain.Min;
}
return PerformSweep(rail, crossSections, rail_params);
}