public static int PointOnWhichSideOfLineSegment(FixedVector3 fromPos, FixedVector3 toPos, FixedVector3 point)
{
FixedVector3 rhs = toPos - fromPos;
FixedVector3 lhs = point - fromPos
if (FixedVector3.Dot(lhs, rhs) <= FixedNumber.Zero)
{
return 1;
}
if (rhs.sqrMagnitudeLong <= lhs.sqrMagnitudeLong)
{
return 0;
}
return 2;
}
返回:0终点外;1起点后;2在线上
参数:
| 起点 | 终点 | 检测点 |
|---|---|---|
| FixedVector3[1] | FixedVector3[1] | FixedVector3[1] |
| fromPos | toPos | point |











网友评论