helical bugfixes
This commit is contained in:
parent
65c2978f43
commit
7277eed111
1 changed files with 20 additions and 14 deletions
|
|
@ -138,14 +138,17 @@ export class OpHelical extends CamOp {
|
||||||
);
|
);
|
||||||
// console.log({down,toBottom,ofFull,ofCircle,startAngle,finalAngle,finalEnd});
|
// console.log({down,toBottom,ofFull,ofCircle,startAngle,finalAngle,finalEnd});
|
||||||
|
|
||||||
//circle down to final point
|
//if not already very close to final point
|
||||||
poly.addPoints(
|
if( ofCircle >= 0.001 ){
|
||||||
arcToPath(startPoint.setZ(currentZ), finalEnd, numSegs , {
|
//circle down to final point
|
||||||
clockwise,
|
poly.addPoints(
|
||||||
radius,
|
arcToPath(startPoint.setZ(currentZ), finalEnd, numSegs , {
|
||||||
center,
|
clockwise,
|
||||||
})
|
radius,
|
||||||
);
|
center,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//if starting at the bottom, reverse poly
|
//if starting at the bottom, reverse poly
|
||||||
if ( reverse ){
|
if ( reverse ){
|
||||||
|
|
@ -169,9 +172,9 @@ export class OpHelical extends CamOp {
|
||||||
let lineOut = radius - entryOffset;
|
let lineOut = radius - entryOffset;
|
||||||
let centerOffset = (entryOffset**2 + 2*entryOffset*lineOut) / (2*(entryOffset + lineOut));
|
let centerOffset = (entryOffset**2 + 2*entryOffset*lineOut) / (2*(entryOffset + lineOut));
|
||||||
//add entry points
|
//add entry points
|
||||||
entry.push(...
|
entry.push(
|
||||||
newPoint(0,-lineOut,0),
|
newPoint(0,-lineOut,0),
|
||||||
arcToPath(
|
...arcToPath(
|
||||||
newPoint(0,-lineOut,0),
|
newPoint(0,-lineOut,0),
|
||||||
newPoint(radius,0,0),
|
newPoint(radius,0,0),
|
||||||
128,
|
128,
|
||||||
|
|
@ -186,12 +189,15 @@ export class OpHelical extends CamOp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//for each point
|
//for each point
|
||||||
|
//rotate by start angle
|
||||||
|
// add to hole center
|
||||||
|
let invert = ((clockwise && !reverse ) || (!clockwise && reverse) ) ? -1 : 1
|
||||||
|
let entryAngle = reverse ? finalAngle : startAngle
|
||||||
entry = entry.map(p => {
|
entry = entry.map(p => {
|
||||||
//rotate by start angle
|
|
||||||
// add to hole center
|
|
||||||
// TODO: there's totally a way to do this with a matrix
|
// TODO: there's totally a way to do this with a matrix
|
||||||
p.y *= clockwise ? 1 : -1
|
// logical XOR
|
||||||
p.rotate(startAngle)
|
p.y *= invert
|
||||||
|
p.rotate(entryAngle)
|
||||||
return p.add(entryCenter)
|
return p.add(entryCenter)
|
||||||
})
|
})
|
||||||
//append to start of poly
|
//append to start of poly
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue