通过使用路径可以求出贝兹曲线(PolyBezier)与直线的交点(point[x,y])
type
TPointsArray = array[0..0] of TPoint;
TTypesArray = array[0..0] of Byte;
var
CurvePts: array[0..3] of TPoint;
Points: ^TPointsArray;
Types: ^TTypesArray;
PtCount: Integer;
iCount: Integer;
FormDC: HDC;
BEGIN
BeginPath(FormDC);
PolyBezier(FormDC, CurvePts, 4);////画曲线/////////////
EndPath(FormDC);
FlattenPath(FormDC);
PtCount := GetPath(FormDC, Points^, Types^, 0);//得到路径点的个数
GetMem(Points, SizeOf(TPoint)*PtCount);
GetMem(Types, PtCount);
GetPath(FormDC, Points^, Types^, PtCount); //得到路径点数组
for iCount := 0 to PtCount-1 do
begin
//判断数组中相邻两点与线是否相交,即两线段是否相交
end;
StrokePath(FormDC);
FreeMem(Points);
FreeMem(Types);