Skip to content

Commit

Permalink
fix debug draw lines with dots origin
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamPorcineFudgepuppy committed Aug 4, 2024
1 parent 413599e commit 59a99cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ComputerscareDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,14 @@ struct DebugViz : TransparentWidget {
DrawHelper draw = DrawHelper(args.vg);


nvgTranslate(args.vg, box.size.x / 2, box.size.y / 3 + 5);
nvgTranslate(args.vg, box.size.x / 2, box.size.y / 3 -15.f);

int numPoints = std::ceil((float)numChannelsToDraw/2);

for(int i = 0; i < numPoints; i++) {
float scale = 2;
float x = clamp(5*xx[i],-30.f,30.f);
float y = clamp(12*yy[i]-20.f,-135.f,95.f);
float y = clamp(12*yy[i],-135.f,95.f);
pts.addPoint(x,y);
}

Expand All @@ -451,7 +451,8 @@ struct DebugViz : TransparentWidget {

std::vector<Vec> pointsVec = pts.get();
Points allOrigin = Points();
allOrigin.linear(numPoints,Vec(0,0),Vec(0,0));
//allOrigin.linear(numPoints,Vec(0,0),Vec(0,0));
allOrigin.samePoint(numPoints,Vec(0,0));

for (int i = 0; i < 16; i++) {
colors.push_back(draw.sincolor(-colorsToDraw[i]/3, {1, 1, 2}));
Expand Down
6 changes: 6 additions & 0 deletions src/pointFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ struct Points {
points[i] = Vec(offset.x + slope.x * i / num, offset.y + slope.y * i / num);
}
}
void samePoint(int num, Vec point) {
points.resize(num);
for (int i = 0; i < num; i++) {
points[i] = point;
}
}
void grid(int numx, int numy, Vec size) {
int N = numx * numy;
points.resize(N);
Expand Down

0 comments on commit 59a99cf

Please sign in to comment.