|
◆ linesHit()
float mgnear::linesHit |
( |
int |
n, |
|
|
const Point2d * |
points, |
|
|
bool |
closed, |
|
|
const Point2d & |
pt, |
|
|
float |
tol, |
|
|
Point2d & |
nearpt, |
|
|
int & |
segment, |
|
|
bool * |
inside = (bool*)0 , |
|
|
int * |
hitType = (int*)0 , |
|
|
int |
flags = -1 , |
|
|
int |
ignoreVertex = -1 |
|
) |
| |
|
static |
计算点到折线或多边形的最近距离
- 参数
-
[in] | n | 顶点数 |
[in] | points | 顶点坐标数组,元素个数为n |
[in] | closed | 是否为多边形 |
[in] | pt | 图形外给定的点 |
[in] | tol | 距离公差,正数,超出则不计算最近点 |
[out] | nearpt | 图形上的最近点 |
[out] | segment | 最近点所在线段的序号,[0,n-2],闭合时为[0,n-1],负数表示失败 |
[out] | inside | 是否点中多边形内部 |
[out] | hitType | 点击类型,见 MgPtInAreaRet |
[in] | flags | 允许检测的位,{1<<PtInAreaRet} |
[in] | ignoreVertex | 不捕捉的顶点序号 |
- 返回
- 给定的点到最近点的距离,失败时为极大数
|