public static bool isLineIntersectRectangle(float linePointX1,
float linePointY1,
float linePointX2,
float linePointY2,
float rectangleLeftTopX,
float rectangleLeftTopY,
float rectangleRightBottomX,
float rectangleRightBottomY)
{
float lineHeight = linePointY1 - linePointY2;
float lineWidth = linePointX2 - linePointX1; // 计算叉乘
float c = linePointX1 * linePointY2 - linePointX2 * linePointY1;
if ((lineHeight * rectangleLeftTopX + lineWidth * rectangleLeftTopY + c >= 0 && lineHeight * rectangleRightBottomX + lineWidth * rectangleRightBottomY + c <= 0)
|| (lineHeight * rectangleLeftTopX + lineWidth * rectangleLeftTopY + c <= 0 && lineHeight * rectangleRightBottomX + lineWidth * rectangleRightBottomY + c >= 0)
|| (lineHeight * rectangleLeftTopX + lineWidth * rectangleRightBottomY + c >= 0 && lineHeight * rectangleRightBottomX + lineWidth * rectangleLeftTopY + c <= 0)
|| (lineHeight * rectangleLeftTopX + lineWidth * rectangleRightBottomY + c <= 0 && lineHeight * rectangleRightBottomX + lineWidth * rectangleLeftTopY + c >= 0))
{
if (rectangleLeftTopX > rectangleRightBottomX)
{
float temp = rectangleLeftTopX;
rectangleLeftTopX = rectangleRightBottomX;
rectangleRightBottomX = temp;
}
if (rectangleLeftTopY < rectangleRightBottomY)
{
float temp1 = rectangleLeftTopY;
rectangleLeftTopY = rectangleRightBottomY;
rectangleRightBottomY = temp1;
}
if ((linePointX1 < rectangleLeftTopX && linePointX2 < rectangleLeftTopX)
|| (linePointX1 > rectangleRightBottomX && linePointX2 > rectangleRightBottomX)
|| (linePointY1 > rectangleLeftTopY && linePointY2 > rectangleLeftTopY)
|| (linePointY1 < rectangleRightBottomY && linePointY2 < rectangleRightBottomY))
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}
C++ 判断线段和矩形是否相交
详细解析竞业限制
竞业限制是指用人单位在劳动合同或者保密协议或者竞业限制协议中,与掌握本单位商业秘密和与知识产权相关的保密事项的劳动者约定,在劳动合同解除或者终止后的一定期限内,不得到与本单位生产或者经营同类产品、从事同类业务的有竞争关系的其他用人单位任职,也不得自己开业生产或者经营同类产品、从事同类业务。
浏览器 STATUS_INVALID_IMAGE_HASH 错误状态码解决办法
解决方法:
- 打开注册表
- 进入\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome(Policies没有Google和Chrome就新建项)
- 然后新建DWORD(32位),将名称改为RendererCodeIntegrityEnabled,值为0
重启浏览器问题解决。