Check for cross with Diagonal line-segment defined from the top-L to bottom-R corner of square. If it crosses, perform actions with Cross()
| 224 | //Check for cross with Diagonal line-segment defined from the top-L to bottom-R corner of square. |
| 225 | //If it crosses, perform actions with Cross() |
| 226 | bool MakeStackIcon::checkForCross(Vec3 currPoint, Vec3 prevPoint) |
| 227 | { |
| 228 | Vec3 target[4]; |
| 229 | |
| 230 | if (enabled) |
| 231 | { |
| 232 | // Create a bounding box where the StackIcon resides |
| 233 | for (uint i = 0; i < 4; i++) |
| 234 | { |
| 235 | target[i] = WorldToClient(getCorner(i + 1)); |
| 236 | target[i].z = 0.0f; |
| 237 | |
| 238 | // Corner Index: |
| 239 | // 1 2 |
| 240 | // +--------+ |
| 241 | // | | |
| 242 | // | ICON | |
| 243 | // | | |
| 244 | // +--------+ |
| 245 | // 3 0 |
| 246 | } |
| 247 | |
| 248 | // Crossing target is defined as -size/2 to size/2 on the z-axis, centered at 'position' |
| 249 | if (currPoint.x >= target[3].x && currPoint.x <= target[0].x && |
| 250 | currPoint.y <= target[3].y && currPoint.y >= target[1].y) |
| 251 | { |
| 252 | // ensure that we're not hitting a straight line |
| 253 | if (lassoMenu->getCurvatureRatio() > 1.2f) |
| 254 | { |
| 255 | return lassoMenu->isTailVectorPointingToStackIcon(20.0f); |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | return false; |
| 261 | } |
| 262 | |
| 263 | void MakeStackIcon::onMouseMove(Vec2 &pt) |
| 264 | { |
nothing calls this directly
no test coverage detected