From 729340031da61ee5e4a07e809e1a18d2dfb5b381 Mon Sep 17 00:00:00 2001 From: kazu Date: Sat, 1 Oct 2016 10:22:14 +0200 Subject: [PATCH] new helper methods particle traps --- geo/BBox2.h | 5 +++++ grid/walk/v2/GridWalker.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/geo/BBox2.h b/geo/BBox2.h index e3d2a39..c4833c3 100644 --- a/geo/BBox2.h +++ b/geo/BBox2.h @@ -36,6 +36,11 @@ public: } + /** returns true if the bbox is not yet configured */ + const bool isInvalid() const { + return p1.x == MAX || p1.y == MAX || p2.x == MIN || p2.y == MIN; + } + /** get the bbox's minimum */ const Point2& getMin() const {return p1;} diff --git a/grid/walk/v2/GridWalker.h b/grid/walk/v2/GridWalker.h index d266433..f25bc68 100644 --- a/grid/walk/v2/GridWalker.h +++ b/grid/walk/v2/GridWalker.h @@ -91,7 +91,7 @@ public: } //if (cnt != 0) {probability /= cnt;} else {probability = 1.0;} - probability = curNode->getWalkImportance() < 0.4f ? (1e-5) : (1.0); // "kill" particles that walk near walls (most probably trapped ones) + probability *= curNode->getWalkImportance() < 0.4f ? (1e-5) : (1.0); // "kill" particles that walk near walls (most probably trapped ones) // update after updateAfter(currentState, *startNode, *curNode);