fix ball taper render in indexed mode

This commit is contained in:
Stewart Allen 2025-12-12 22:26:58 -05:00
commit d5cda790c0
8 changed files with 38 additions and 31 deletions

View file

@ -288,15 +288,15 @@ function toolUpdate(toolid, send) {
.add(sphere(frad, 20).translate(0, 0, -(tlen - frad * 2) / 2))
.add(cylinder(slen, srad, srad, 20, true).translate(0, 0, flen / 2));
} else if (tool.isTaperBall()) {
const trad = Math.max(tool.tipDiameter() / 2, 0.001);
const brad = trad; // ball radius equals tip radius
const taperLen = flen - brad; // taper length excludes ball
const { b, r } = tool.getBallTaperParams();
// taper length excludes most of ball
const taperLen = flen - b;
// shaft at top
mesh = cylinder(slen, srad, srad, 20, true).translate(0, 0, slen / 2)
// taper cone in middle
.add(cylinder(taperLen, trad, frad, 20, true).translate(0, 0, -taperLen / 2))
// ball at bottom
.add(sphere(brad, 20).translate(0, 0, -(taperLen + brad)));
.add(cylinder(taperLen, b, frad, 20, true).translate(0, 0, -taperLen / 2))
// exposed ball at bottom
.add(sphere(r, 20).translate(0, 0, -taperLen));
} else if (tool.isTaperMill()) {
const trad = Math.max(tool.tipDiameter() / 2, 0.001);
mesh = cylinder(slen, srad, srad, 20, true).translate(0, 0, slen / 2)