TouchVG framework
|
曲线计算函数 更多...
#include <mgcurv.h>
Public 类型 | |
enum | SplineFlags { cubicTan1 = 1, cubicArm1 = 2, cubicTan2 = 4, cubicArm2 = 8, cubicLoop = 16 } |
typedef Point2d(* | PtCallback) (void *data, int i) |
typedef void(* | FitCubicCallback) (void *data, const Point2d curve[4]) |
静态 Public 成员函数 | |
static void | fitBezier (const Point2d *pts, float t, Point2d &fitpt) |
计算三次贝塞尔曲线段的参数点 更多... | |
static void | bezierTanget (const Point2d *pts, float t, Point2d &outpt) |
计算三次贝塞尔曲线段的切线点 更多... | |
static void | splitBezier (const Point2d *pts, float t, Point2d *pts1, Point2d *pts2) |
分割一个三次贝塞尔曲线段 更多... | |
static bool | bezierIsStraight (const Point2d *pts) |
返回一个三次贝塞尔曲线段是否为直线段 更多... | |
static float | lengthOfBezier (const Point2d *pts) |
返回一个三次贝塞尔曲线段的长度 更多... | |
static float | bezierPointLengthFromStart (const Point2d *pts, float len) |
返回三次贝塞尔曲线段从起点开始的指定弧长处的点参数,范围为[0,1] 更多... | |
static bool | bezierPointDistantFromPoint (const Point2d *pts, float dist, const Point2d &pt, Point2d &result, float &tRes) |
计算曲线起点附近的外部点到三次贝塞尔曲线段相距指定距离的曲线点和参数 更多... | |
static bool | bezierIntersectionWithLine (const Point2d *pts, const Point2d &a, const Point2d &b, float &tIntersect) |
计算曲线段与给定的直线段ab相交处的参数 更多... | |
static void | bezier4P (const Point2d &pt1, const Point2d &pt2, const Point2d &pt3, const Point2d &pt4, Point2d &ctrpt1, Point2d &ctrpt2) |
用线上四点构成三次贝塞尔曲线段 更多... | |
static int | fitCurve (int knotCount, Point2d *knots, Vector2d *knotvs, int count, const Point2d *pts, float tol) |
对数据点光滑拟合为三次贝塞尔曲线 更多... | |
static int | fitCurve2 (int knotCount, Point2d *knots, int count, PtCallback pts, void *data, float tol) |
static void | fitCurve3 (FitCubicCallback fc, void *data, const Point2d *pts, int n, float tol) |
static void | fitCurve4 (FitCubicCallback fc, void *data, PtCallback pts, void *data2, int n, float tol) |
static void | quadBezierToCubic (const Point2d quad[3], Point2d cubic[4]) |
二次贝塞尔曲线段转为三次贝塞尔曲线段 更多... | |
static void | ellipse90ToBezier (const Point2d &frompt, const Point2d &topt, Point2d &ctrpt1, Point2d &ctrpt2) |
用给定的起点和终点构造90度椭圆弧,并转换为一个三次贝塞尔曲线段 更多... | |
static void | ellipseToBezier (Point2d points[13], const Point2d ¢er, float rx, float ry) |
将一个椭圆转换为4段三次贝塞尔曲线 更多... | |
static void | roundRectToBeziers (Point2d points[16], const Box2d &rect, float rx, float ry) |
将一个圆角矩形转换为4段三次贝塞尔曲线 更多... | |
static int | arcToBezier (Point2d points[16], const Point2d ¢er, float rx, float ry, float startAngle, float sweepAngle) |
将一个椭圆弧转换为多段三次贝塞尔曲线 更多... | |
static bool | arc3P (const Point2d &start, const Point2d &point, const Point2d &end, Point2d ¢er, float &radius, float *startAngle=(float *) 0, float *sweepAngle=(float *) 0) |
给定起点、弧上一点和终点,计算圆弧参数 更多... | |
static bool | arcTan (const Point2d &start, const Point2d &end, const Vector2d &startTan, Point2d ¢er, float &radius, float *startAngle=(float *) 0, float *sweepAngle=(float *) 0) |
给定起点、终点和起点切向,计算圆弧参数 更多... | |
static bool | arcBulge (const Point2d &start, const Point2d &end, float bulge, Point2d ¢er, float &radius, float *startAngle=(float *) 0, float *sweepAngle=(float *) 0) |
给定弦和拱高计算圆弧参数 更多... | |
static int | crossTwoCircles (Point2d &pt1, Point2d &pt2, const Point2d &c1, float r1, const Point2d &c2, float r2) |
计算两圆的交点 更多... | |
static int | crossLineCircle (Point2d &pt1, Point2d &pt2, const Point2d &a, const Point2d &b, const Point2d &c, float r, bool ray=false) |
计算无穷直线(ab)与圆(cr)的交点,返回交点数 更多... | |
static bool | triEquations (int n, float *a, float *b, float *c, Vector2d *vs) |
求解三对角线方程组 更多... | |
static bool | gaussJordan (int n, float *mat, Vector2d *vs) |
Gauss-Jordan法求解线性方程组 更多... | |
static bool | cubicSplines (int n, const Point2d *knots, Vector2d *knotvs, int flag=0, float tension=1) |
计算三次参数样条曲线(Hermite)的型值点的切矢量 更多... | |
static void | fitCubicSpline (int n, const Point2d *knots, const Vector2d *knotvs, int i, float t, Point2d &fitpt) |
在三次样条曲线(Hermite)的一条弦上插值得到拟和点坐标 更多... | |
static void | cubicSplineToBezier (int n, const Point2d *knots, const Vector2d *knotvs, int i, Point2d points[4], bool hermite=true) |
得到三次样条曲线的分段贝塞尔曲线段控制点 更多... | |
static int | bsplinesToBeziers (Point2d points[], int n, const Point2d *ctlpts, bool closed) |
得到三次B样条曲线的分段贝塞尔曲线段控制点 更多... | |
曲线计算函数