Skip to content

Commit

Permalink
More stuff from bricksmith, and better debug code in band.c
Browse files Browse the repository at this point in the history
  • Loading branch information
deeice committed Apr 17, 2018
1 parent b00a4f8 commit 9000c24
Show file tree
Hide file tree
Showing 2 changed files with 1,369 additions and 1,348 deletions.
32 changes: 25 additions & 7 deletions lsynth/lsynth/band.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,17 +987,14 @@ showconstraints(
int n_constraints,
int color)
{
#if 1
int i,j;

j = color;
fprintf(output, "0 Start %d ShowConstraints %d.\n", n_constraints, j);
for (i = 0; i < n_constraints; i++) {
part_t *cp = &constraints[i].part;
if (i+1 == n_constraints){ // Toggle transparency for last constraint.
if (color < 32) color += 32;
else color -= 32;
}
if (i+1 == n_constraints) // Toggle transparency for last constraint.
color ^= 32;
output_line(
output,
0,
Expand All @@ -1010,9 +1007,29 @@ showconstraints(
cp->type);
}
fprintf(output, "0 End %d ShowConstraints %d.\n", n_constraints, j);
fflush(output);
}

void
showconstraintaxis(
FILE *output,
LSL_band_constraint *constraints,
int n_constraints,
int color)
{
int i,j;

j = color;
fprintf(output, "0 Start %d ShowConstraintAxis %d.\n", n_constraints, j);
for (i = 0; i < n_constraints; i++) {
part_t *cp = &constraints[i].part;
if (i+1 == n_constraints) // Toggle transparency for last constraint.
color ^= 32;
fprintf(output, "2 %d %1.4f %1.4f %1.4f %1.4f %1.4f %1.4f\n", color,
cp->offset[0], cp->offset[1], -100.0f, cp->offset[0], cp->offset[1], 100.0f);
}
fprintf(output, "0 End %d ShowConstraintAxis %d.\n", n_constraints, j);
fflush(output);
#endif
}

static void
Expand Down Expand Up @@ -1271,7 +1288,8 @@ synth_band(
}
#endif
#ifdef SHOW_XY_PLANE_FOR_DEBUG
showconstraints(output,constraints,n_constraints,3);
// Show rotation axis for the constraints to make sure offsets worked above.
showconstraintaxis(output,constraints,n_constraints,4);
#endif

/* figure out the tangents' intersections with circles */
Expand Down
Loading

0 comments on commit 9000c24

Please sign in to comment.