Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vberthiaume committed Jan 16, 2025
1 parent 5c4b21a commit 0e1b723
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 1 addition & 2 deletions include/puara/descriptors/brushRub.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace puara_gestures
class ValueIntegrator
{
public:
//TODO VB: we need at least this default constructor because of the non-default constructor for the tied value
ValueIntegrator() = default;
ValueIntegrator(const ValueIntegrator&) noexcept = default;
ValueIntegrator(ValueIntegrator&&) noexcept = default;
Expand Down Expand Up @@ -44,7 +43,7 @@ class ValueIntegrator
{
const auto delta = newValue - prevValue;
prevValue = newValue;
//TODO VB: floating point comparison

// No delta since the last update -> potentially reset the value
if(delta == 0.0)
{
Expand Down
17 changes: 15 additions & 2 deletions include/puara/descriptors/touchArrayGestureDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ namespace puara_gestures

// touchSizeEdge: number of stripes for top and bottom portions (arbitrary)
//maxNumBlobs: maximum number of "blobs" that the blob detector can detect at once on the touch array

/**
* @class TouchArrayGestureDetector
* @brief A class to detect gestures on a touch-array device.
*
* This class is designed to detect various gestures on a touch-array device by analyzing touch data.
* It detects blobs (contiguous touched stripes in the touch array), and for each blob, it calculates
* the amount of "brushing" and "rubbing" gestures using a BrushRubDetector.
*
* @tparam maxNumBlobs The maximum number of blobs that the blob detector can detect at once on the touch array.
* @tparam touchSizeEdge The number of stripes for the top and bottom portions of the touch array.
*/
template <int maxNumBlobs, int touchSizeEdge>
class TouchArrayGestureDetector
{
Expand Down Expand Up @@ -44,14 +56,15 @@ class TouchArrayGestureDetector
for(int i = 0; i < maxNumBlobs; ++i)
brushRubDetector[i].update(blobDetector.blobStartPos[i]);

updateBrushAndRub();
//and finally update the total brush and rub values
updateTotalBrushAndRub();
}

private:
BlobDetector<maxNumBlobs> blobDetector;
BrushRubDetector brushRubDetector[maxNumBlobs];

void updateBrushAndRub()
void updateTotalBrushAndRub()
{
// Calculate total brush and rub values
double brushes[maxNumBlobs];
Expand Down
3 changes: 2 additions & 1 deletion include/puara/utils/blobDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ namespace puara_gestures
* - The size in terms of consecutive `1`s (`blobSize`)
* - The center index (`blobCenter`)
*
* @tparam maxNumBlobs The maximum number of blobs that the blob detector can detect at once.
*
* @warning Most of these values are reset when a detection function, e.g., detect1D(), is called,
* and calculated during the detection funtion calls -- so their value is only really valid right
* after such a call. There is no locking mechanism on any of these values so it is on the client
* to ensure there is no race conditions.
*
* @note
* - The number of blobs processed is set by the template parameter `maxNumBlobs`.
* - If the input contains more blobs than `maxNumBlobs`, the additional blobs are ignored.
*/
template <int maxNumBlobs>
Expand Down

0 comments on commit 0e1b723

Please sign in to comment.