MCPcopy Create free account
hub / github.com/bumptop/BumpTop / checkForCross

Method checkForCross

trunk/win/Source/BT_StackIcon.cpp:226–261  ·  view source on GitHub ↗

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()

Source from the content-addressed store, hash-verified

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()
226bool 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
263void MakeStackIcon::onMouseMove(Vec2 &pt)
264{

Callers

nothing calls this directly

Calls 3

WorldToClientFunction · 0.85
getCurvatureRatioMethod · 0.80

Tested by

no test coverage detected