本文整理汇总了C#中Rhino.Geometry.Curve.IsArc方法的典型用法代码示例。如果您正苦于以下问题:C# Curve.IsArc方法的具体用法?C# Curve.IsArc怎么用?C# Curve.IsArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Geometry.Curve
的用法示例。
在下文中一共展示了Curve.IsArc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLBCurve
private LyrebirdCurve GetLBCurve(Curve crv)
{
LyrebirdCurve lbc = null;
List<LyrebirdPoint> points = new List<LyrebirdPoint>();
if (crv.IsLinear())
{
// standard linear element
points.Add(new LyrebirdPoint(crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z));
points.Add(new LyrebirdPoint(crv.PointAtEnd.X, crv.PointAtEnd.Y, crv.PointAtEnd.Z));
lbc = new LyrebirdCurve(points, "Line");
}
else if (crv.IsCircle())
{
crv.Domain = new Interval(0, 1);
points.Add(new LyrebirdPoint(crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z));
points.Add(new LyrebirdPoint(crv.PointAt(0.25).X, crv.PointAt(0.25).Y, crv.PointAt(0.25).Z));
points.Add(new LyrebirdPoint(crv.PointAt(0.5).X, crv.PointAt(0.5).Y, crv.PointAt(0.5).Z));
points.Add(new LyrebirdPoint(crv.PointAt(0.75).X, crv.PointAt(0.75).Y, crv.PointAt(0.75).Z));
points.Add(new LyrebirdPoint(crv.PointAtEnd.X, crv.PointAtEnd.Y, crv.PointAtEnd.Z));
lbc = new LyrebirdCurve(points, "Circle");
}
else if (crv.IsArc())
{
crv.Domain = new Interval(0, 1);
// standard arc element
points.Add(new LyrebirdPoint(crv.PointAtStart.X, crv.PointAtStart.Y, crv.PointAtStart.Z));
points.Add(new LyrebirdPoint(crv.PointAt(0.5).X, crv.PointAt(0.5).Y, crv.PointAt(0.5).Z));
points.Add(new LyrebirdPoint(crv.PointAtEnd.X, crv.PointAtEnd.Y, crv.PointAtEnd.Z));
lbc = new LyrebirdCurve(points, "Arc");
}
else
{
// Spline
// Old line: if (crv.Degree >= 3)
if (crv.Degree == 3)
{
NurbsCurve nc = crv as NurbsCurve;
if (nc != null)
{
List<LyrebirdPoint> lbPoints = new List<LyrebirdPoint>();
List<double> weights = new List<double>();
List<double> knots = new List<double>();
foreach (ControlPoint cp in nc.Points)
{
LyrebirdPoint pt = new LyrebirdPoint(cp.Location.X, cp.Location.Y, cp.Location.Z);
double weight = cp.Weight;
lbPoints.Add(pt);
weights.Add(weight);
}
for (int k = 0; k < nc.Knots.Count; k++)
{
double knot = nc.Knots[k];
// Add a duplicate knot for the first and last knot in the Rhino curve.
// Revit needs 2 more knots than Rhino to define a spline.
if (k == 0 || k == nc.Knots.Count - 1)
{
knots.Add(knot);
}
knots.Add(knot);
}
lbc = new LyrebirdCurve(lbPoints, weights, knots, nc.Degree, nc.IsPeriodic) { CurveType = "Spline" };
}
}
else
{
const double incr = 1.0 / 100;
List<LyrebirdPoint> pts = new List<LyrebirdPoint>();
List<double> weights = new List<double>();
for (int i = 0; i <= 100; i++)
{
Point3d pt = crv.PointAtNormalizedLength(i * incr);
LyrebirdPoint lbp = new LyrebirdPoint(pt.X, pt.Y, pt.Z);
weights.Add(1.0);
pts.Add(lbp);
}
lbc = new LyrebirdCurve(pts, "Spline") { Weights = weights, Degree = crv.Degree };
}
}
return lbc;
}