Skip to content

Commit

Permalink
The motivation of the shaky_cam is to detect cross-frame overlap,
Browse files Browse the repository at this point in the history
... not an interpretive barcode dance.

Less snarkily, I'm trying to find the right balance between "decoder can
discard bad frames" and "user gets a headache looking at the barcode".
  • Loading branch information
sz3 committed Mar 3, 2021
1 parent a49fe7f commit c15ac29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/lib/gui/gl_2d_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,15 @@ class gl_2d_display
{0, -1, -1, 0} // right 270
}};

static std::array<std::pair<GLfloat, GLfloat>, 8> computeShakePos(float dim)
static std::array<std::pair<GLfloat, GLfloat>, 4> computeShakePos(float dim)
{
float shake = 8.0f / dim; // 1080
float zero = 0.0f;
return {{
{zero, zero},
{zero-shake, zero-shake},
{zero, zero},
{zero+shake, zero+shake},
{zero, zero},
{zero-shake, zero+shake},
{zero, zero},
{zero+shake, zero-shake}
{zero+shake, zero+shake}
}};
}

Expand Down Expand Up @@ -176,7 +172,7 @@ class gl_2d_display
unsigned _i = 0;
float _dimension;

std::array<std::pair<GLfloat, GLfloat>, 8> _shakePos;
std::array<std::pair<GLfloat, GLfloat>, 4> _shakePos;
loop_iterator<decltype(_shakePos)> _shake;
loop_iterator<decltype(ROTATIONS)> _rotation;
};
Expand Down
4 changes: 2 additions & 2 deletions src/lib/gui/shaky_cam.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace cimbar {
class shaky_cam
{
public:
static constexpr std::array<std::pair<int, int>, 8> SHAKE_POS = {{
{0, 0}, {-8, -8}, {0, 0}, {8, 8}, {0, 0}, {-8, 8}, {0, 0}, {8, -8}
static constexpr std::array<std::pair<int, int>, 4> SHAKE_POS = {{
{0, 0}, {-8, -8}, {0, 0}, {8, 8}
}};

public:
Expand Down

0 comments on commit c15ac29

Please sign in to comment.