2022 武汉外小游园记

我是在6月12日提交游园申请截止的当天,晚上十点多才想起来要去写小作文的。 主要是那个星期自驾带孩子出去旅游了,玩嗨了,周日回来洗完澡才记起来

C++ 判断线段和矩形是否相交

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 <=