📄 geutilities.h
字号:
* Purpose:
* verify if point is equal to the start point of curve.
* Argument:
* pnt [in], point positon.
* curve [in], curve.
* tol [in], tolerance.
* Return:
* true if point equal to the start point of curve, otherwise false.
*/
extern DLLIMPEXP Adesk::Boolean
isCurveStartPoint(const AcGePoint2d& pnt, const AcGeCurve2d& curve,const double& tol=1.e-10);
/*
* Purpose:
* verify if point is equal to the end point of curve.
* Argument:
* pnt [in], point positon.
* curve [in], curve.
* tol [in], tolerance.
* Return:
* true if point equal to the start point of curve, otherwise false.
*/
extern DLLIMPEXP Adesk::Boolean
isCurveEndPoint(const AcGePoint2d& pnt, const AcGeCurve2d& curve,const double& tol=1.e-10);
/*
* Purpose:
* verify the postion of point compare to exterior loop,
* whose direction is counter clockwise.
* Argument:
* pnt [in], point position.
* loop [in], loop, who include 2d curves.
* tol [in], tolerance.
* Return:
* 0 if point in the interior loop
* (i+1) if point is equal to the ith curve's start point, i is the index of curve in loop
* NUM+(i+1) if point is on the ith curve, NUM is the num of curve in loop
* -1 if point is out of the exterior loop
*/
extern DLLIMPEXP int
pointPosToExLoop(const AcGePoint2d& point,const ChGeLoop2d& loop,const double& tol);
/*
* Purpose:
* verify the postion of point compare to interior loop,
* whose direction is clockwise.
* Argument:
* pnt [in], point position.
* loop [in], loop, who include 2d curves.
* tol [in], tolerance.
* Return:
* 0 if point in the interior loop
* (i+1) if point is equal to the ith curve's start point, i is the index of curve in loop
* NUM+(i+1) if point is on the ith curve, NUM is the num of curve in loop
* -1 if point is out of the interior loop
*/
extern DLLIMPEXP int
pointPosToInLoop(const AcGePoint2d& point,const ChGeLoop2d& loop,const double& tol=1.e-10);
/*
* Purpose:
* get the feature point array from nurbcurve.
* 当param=param2=0时,表示全部段.
* 当param<param2时,得到的点数组方向与曲线同,否则相反,
* 注意param==param2但不等于0时返回错误
* Argument:
* curve [in], spline curve.
* intNum [in], 两特征点中插值点数 default=0.
* param [in], start param default=0.0f
* param2 [in], end param default=0.0f
* bExt [in], 是否使用扩展参数,即给出的参数范围
* 不在原曲线interval中也可以default=false.
* pnts [out], the feature points of spline.
* Return:
* true success, false failure.
*/
extern DLLIMPEXP bool
getPntsFromSpline(const AcGeNurbCurve3d& curve,AcGePoint3dArray& pnts, const int& intNum=0,const double& param=0.0f,const double& param2=0.0f,const bool& bExt=false);
/*
* Purpose:
* get the feature point array from nurbcurve.
* 当param=param2=0时,表示全部段.
* 当param<param2时,得到的点数组方向与曲线同,否则相反,
* 注意param==param2但不等于0时返回错误
* Argument:
* curve [in], spline curve.
* intNum [in], 两特征点中插值点数 default=0.
* param [in], start param default=0.0f
* param2 [in], end param default=0.0f
* bExt [in], 是否使用扩展参数,即给出的参数范围
* 不在原曲线interval中也可以default=false.
* pnts [out], the feature points of spline.
* Return:
* true success, false failure.
*/
extern DLLIMPEXP bool
getPntsFromSpline(const AcGeNurbCurve2d& curve,AcGePoint2dArray& pnts, const int& intNum=0,const double& param=0.0f,const double& param2=0.0f,const bool& bExt=false);
/*
* Purpose:
* get the feature point array from nurbcurve.
* 当param=param2=0时,表示全部段.
* 当param<param2时,得到的点数组方向与曲线同,否则相反,
* 注意param==param2但不等于0时返回错误
* 插值点是自动计算,当原曲线段上特征点数不小于CURVE_FEATUREPOINT_NUM则不加入插值点
* 否则,当只有两个特征点时插入两个插值点,其他情况分别在头和尾与相邻特征点间插入一个插值点
* Argument:
* curve [in], spline curve.
* param [in], start param default=0.0f
* param2 [in], end param default=0.0f
* bExt [in], 是否使用扩展参数,即给出的参数范围
* 不在原曲线interval中也可以default=false.
* pnts [out], the feature points of spline.
* Return:
* true success, false failure.
*/
extern DLLIMPEXP bool
getPntsFromSpline(AcGePoint2dArray& pnts,const AcGeNurbCurve2d& curve,const double& param=0.0f,const double& param2=0.0f,const bool& bExt=false);
/*
* Purpose:
* get the feature point array from nurbcurve.
* 当param=param2=0时,表示全部段.
* 当param<param2时,得到的点数组方向与曲线同,否则相反,
* 注意param==param2但不等于0时返回错误
* 插值点是自动计算,当原曲线段上特征点数不小于CURVE_FEATUREPOINT_NUM则不加入插值点
* 否则,当只有两个特征点时插入两个插值点,其他情况分别在头和尾与相邻特征点间插入一个插值点
* Argument:
* curve [in], spline curve.
* param [in], start param default=0.0f
* param2 [in], end param default=0.0f
* bExt [in], 是否使用扩展参数,即给出的参数范围
* 不在原曲线interval中也可以default=false.
* pnts [out], the feature points of spline.
* Return:
* true success, false failure.
*/
extern DLLIMPEXP bool
getPntsFromSpline(AcGePoint3dArray& pnts,const AcGeNurbCurve3d& curve,const double& param=0.0f,const double& param2=0.0f,const bool& bExt=false);
/*
* Purpose:
* verify if crv1 is part of crv2.
* Argument:
* crv1 [in], spline curve1's points.
* crv2 [in], spline curve2's points.
* gtol [in], the tolerance
* Return:
* true if it is.
*/
extern DLLIMPEXP bool
isPartOfCurve(const AcGePoint2dArray& crv1,const AcGePoint2dArray& crv2, const double& tol=AcGeContext::gTol.equalPoint());
/*
* Purpose:
* verify if crv1 is part of crv2.
* Argument:
* crv1 [in], spline curve1's points.
* crv2 [in], spline curve2.
* gtol [in], the tolerance
* Return:
* true if it is.
*/
extern DLLIMPEXP bool
isPartOfCurve(const AcGePoint2dArray& crv1,const AcGeCurve2d& crv2, const double& tol=AcGeContext::gTol.equalPoint());
/*
* Purpose:
* verify if crv1 is part of crv2.
* Argument:
* crv1 [in], spline curve1.
* crv2 [in], spline curve2.
* gtol [in], the tolerance
* Return:
* true if it is.
*/
extern DLLIMPEXP bool
isPartOfCurve(const AcGeNurbCurve2d& crv1,const AcGeCurve2d& crv2, const double& tol=AcGeContext::gTol.equalPoint());
/*
* Purpose:
* verify if crv1 is part of crv2.
* Argument:
* crv1 [in], spline curve1's points.
* crv2 [in], spline curve2's points.
* gtol [in], the tolerance
* Return:
* true if it is.
*/
extern DLLIMPEXP bool
isPartOfCurve(const AcGePoint3dArray& crv1,const AcGePoint3dArray& crv2, const double& tol=AcGeContext::gTol.equalPoint());
/*
* Purpose:
* verify if crv1 is part of crv2.
* Argument:
* crv1 [in], spline curve1's points.
* crv2 [in], spline curve2.
* gtol [in], the tolerance
* Return:
* true if it is.
*/
extern DLLIMPEXP bool
isPartOfCurve(const AcGePoint3dArray& crv1,const AcGeCurve3d& crv2, const double& tol=AcGeContext::gTol.equalPoint());
/*
* Purpose:
* verify if crv1 is part of crv2.
* Argument:
* crv1 [in], spline curve1.
* crv2 [in], spline curve2.
* gtol [in], the tolerance
* Return:
* true if it is.
*/
extern DLLIMPEXP bool
isPartOfCurve(const AcGeNurbCurve3d& crv1,const AcGeCurve3d& crv2, const double& tol=AcGeContext::gTol.equalPoint());
/*
* Purpose:
* 在节点数组中添加节点参数,形成新的节点数组,从小到大的顺序,
* 返回其在新节点数组中的位置.
* Argument:
* knots [in][out], knots array.
* val [in], knot value.
* Return:
* the index of val in new knots array.
*/
extern DLLIMPEXP int
insertKnot(AcGeDoubleArray& knots,const double& val);
/*
* Purpose:
* 从曲线点数组得到一条joined曲线.
* Argument:
* curves [in], curves end-joined-with-end
* curve [out], return curve.
*/
extern DLLIMPEXP void
getJoinedCurveFromPntsArray(const ChGeCurve2dPntsArray& curves, AcGeNurbCurve2d& curve);
/*
* Purpose:
* 从曲线点数组得到一条joined曲线.
* Argument:
* curves [in], curves end-joined-with-end
* curve [out], return curve.
*/
extern DLLIMPEXP void
getJoinedCurveFromPntsArray(const ChGeCurve3dPntsArray& curves, AcGeNurbCurve3d& curve);
/*
* Purpose:
* 从曲线点数组得到一条Polyline2d曲线.
* Argument:
* curves [in], curves end-joined-with-end
* curve [out], return curve.
*/
extern DLLIMPEXP void
getPolylineFromPntsArray(const ChGeCurve2dPntsArray& curves, AcGePolyline2d& curve);
/*
* Purpose:
* 从曲线点数组得到一条Polyline3d曲线.
* Argument:
* curves [in], curves end-joined-with-end
* curve [out], return curve.
*/
extern DLLIMPEXP void
getPolylineFromPntsArray(const ChGeCurve3dPntsArray& curves, AcGePolyline3d& curve);
/*
* Purpose:
* 从joined曲线得到曲线点数组的数组.
* 当param=param2=0时,表示全部段.
* 当param<param2时,得到的点数组方向与曲线同,否则相反,
* 注意param==param2但不等于0时返回错误
* Argument:
* curve [in], curves end-joined-with-end.
* intNum [in], 两特征点中插值点数 default=0.
* param [in], start param default=0.0f.
* param2 [in], end param default=0.0f.
* bExt [in], 是否使用扩展参数,即给出的参数范围不在原曲线
* interval中也可以default=false
* curves [out], points array.
* Return:
* true if success, false otherwise.
*/
extern DLLIMPEXP bool
getPntsArrayFromJoinedCurve(const AcGeNurbCurve2d& curve, ChGeCurve2dPntsArray& curves, const int& intNum=0,const double& param=0.0f,const double& param2=0.0f,const bool& bExt=false);
/*
* Purpose:
* 从joined曲线得到曲线点数组的数组.
* 当param=param2=0时,表示全部段.
* 当param<param2时,得到的点数组方向与曲线同,否则相反,
* 注意param==param2但不等于0时返回错误
* 与上区别在于插值点是自动计算,当原曲线段上特征点数不小于
* CURVE_FEATUREPOINT_NUM则不加入插值点, 否则,当只有两个
* 特征点时插入两个插值点,其他情况分别在头和尾与相邻特征点间
* 插入一个插值点.
* Argument:
* curve [in], curves end-joined-with-end.
* param [in], start param default=0.0f.
* param2 [in], end param default=0.0f.
* bExt [in], 是否使用扩展参数,即给出的参数范围不在原曲线
* interval中也可以default=false
* curves [out], points array.
* Return:
* true if success, false otherwise.
*/
extern DLLIMPEXP bool
getPntsArrayFromJoinedCurve(ChGeCurve2dPntsArray& curves, const AcGeNurbCurve2d& curve, const double& param=0.0f,const double& param2=0.0f,const bool& bExt=false);
/*
* Purpose:
* 从joined曲线得到曲线点数组的数组.
* 当param=param2=0时,表示全部段.
* 当param<param2时,得到的点数组方向与曲线同,否则相反,
* 注意param==param2但不等于0时返回错误
* 与上区别在于插值点是自动计算,当原曲线段上特征点数不小于
* CURVE_FEATUREPOINT_NUM则不加入插值点, 否则,当只有两个
* 特征点时插入两个插值点,其他情况分别在头和尾与相邻特征点间
* 插入一个插值点.
* Argument:
* curve [in], curves end-joined-with-end.
* param [in], start param default=0.0f.
* param2 [in], end param default=0.0f.
* bExt [in], 是否使用扩展参数,即给出的参数范围不在原曲线
* interval中也可以default=false
* curves [out], points array.
* Return:
* true if success, false otherwise.
*/
extern DLLIMPEXP bool
getPntsArrayFromJoinedCurve(ChGeCurve3dPntsArray& curves, const AcGeNurbCurve3d& curve, const double& param=0.0f,const double& param2=0.0f,const bool& bExt=false);
/*
* Purpose:
* 转换3d点数组为2d点数组.
* Argument:
* pnts3d [in], 3d points array.
* pnts2d [out], 2d points array.
*/
extern DLLIMPEXP void
points3dTo2d(const AcGePoint3dArray& pnts3d,AcGePoint2dArray& pnts2d);
/*
* Purpose:
* 转换2d点数组为3d点数组.
* Argument:
* pnts2d [in], 2d points array.
* z [in], 3d z-axis coordinate default=0.0f.
* pnts3d [out], 3d points array.
*/
extern DLLIMPEXP void
points2dTo3d(const AcGePoint2dArray& pnts2d,AcGePoint3dArray& pnts3d,const double& z=0.0f);
/*
* Purpose:
* 转换Loop2d为Loop3d.
* Argument:
* loop2d [in], loop2d.
* z [in], 3d z-axis coordinate default=0.0f.
* loop3d [out], loop3d.
* Return:
* true if success, false otherwise.
*/
extern DLLIMPEXP void
Loop2dTo3d(const ChGeLoop2d& loop2d, ChGeLoop3d& loop3d, double z=0);
/*
* Purpose:
* 转换Loop3d为Loop2d.
* Argument:
* loop3d [in], loop3d.
* loop2d [out], loop2d.
*/
extern DLLIMPEXP void
Loop3dTo2d(const ChGeLoop3d& loop3d, ChGeLoop2d& loop2d);
/*
* Purpose:
* 转换Loops2d为Loops3d.
* Argument:
* loops2d [in], loops2d.
* z [in], 3d z-axis coordinate default=0.0f.
* loops3d [out], loops3d.
*/
extern DLLIMPEXP void
Loops2dTo3d(const ChGeLoop2dArray& loops2d,
ChGeLoop3dArray& loops3d, double z=0);
/*
* Purpose:
* 转换Loops3d为Loops2d.
* Argument:
* loops3d [in], loops3d.
* loops2d [out], loops2d.
*/
extern DLLIMPEXP void
Loops3dTo2d(const ChGeLoop3dArray& loops3d, ChGeLoop2dArray& loops2d);
/*
* Purpose:
* 从region对象获取其Loops,该对象必须存在于数据库中,可以没有owner.
* Argument:
* pRg [in], region对象指针.
* loops [out], 返回的loops.
* Return:
* Acad::eok, 成功
* 其他,失败, loops长度为0
*/
extern DLLIMPEXP Acad::ErrorStatus
getLoopsFromRegion(AcDbRegion *pRg, ChGeLoop3dArray& loops);
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -