和所有的几何库一样,Revit 支持好几种类型的线。圆弧、螺旋线、椭圆线,赫尔米特曲线、直线、Nurbs曲线。
为每一个种类型的线,Revit 都提供了创建的方法,例如 Arc
,有三种创建的方式,非常直观:
public static Arc Create(XYZ end0, XYZ end1, XYZ pointOnArc);
public static Arc Create(Plane plane, double radius, double startAngle, double endAngle);
public static Arc Create(XYZ center, double radius, double startAngle, double endAngle, XYZ xAxis, XYZ yAxis);
其它类型的线也有创建的接口,就不再赘述了。
任何类型的线都会有一些共同的特性:
长度相关:
//是否有限长度
public bool IsBound {
get; }
//曲线的大略长度
public double ApproximateLength {
get; }
//精确长度
public double Length {
get; }
//是否形成环
public bool IsCyclic {
get; }
//如果是环,那么转过多少角度范围。
public double Period {
get; }
得到线上的一点:
public XYZ Evaluate(double parameter, bool normalized);
线上一点的坐标系:
public Transform ComputeDerivatives(double parameter, bool normalized);
public XYZ Evaluate(double parameter, bool normalized);
线的端点相关:
public double GetEndParameter(int index);
public XYZ GetEndPoint(int index);
public Reference GetEndPointReference(int index);
正则化与raw 参数的互换:
public double ComputeNormalizedParameter(double rawParameter);
public double ComputeRawParameter(double normalizedParameter);
Offset、反转、位移:
public Curve CreateOffset(double offsetDist, XYZ referenceVector);
public Curve CreateReversed();
public Curve CreateTransformed(Transform transform);
设定有限长度或者无限长度:
public void MakeBound(double startParameter, double endParameter);
public void MakeUnbound();
线与点的距离:
public double Distance(XYZ point);
点在线上的投影:
public IntersectionResult Project(XYZ point);
求两条线之间的最近的点:
public void ComputeClosestPoints(Curve otherCurve, bool withinThisCurveBounds, bool withinOtherCurveBounds, bool returnAllCriticalPnts, out IList<ClosestPointsPairBetweenTwoCurves> resultList);
线与线求交:
public SetComparisonResult Intersect(Curve curve, out IntersectionResultArray resultArray);
public SetComparisonResult Intersect(Curve curve);
略。