fix newSlopeFromAngle in cnc/slice
This commit is contained in:
parent
b8ea098a11
commit
0b0f24fb16
1 changed files with 3 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ import { base, util } from '../../../geo/base.js';
|
||||||
import { newLine } from '../../../geo/line.js';
|
import { newLine } from '../../../geo/line.js';
|
||||||
import { newPoint } from '../../../geo/point.js';
|
import { newPoint } from '../../../geo/point.js';
|
||||||
import { newPolygon } from '../../../geo/polygon.js';
|
import { newPolygon } from '../../../geo/polygon.js';
|
||||||
|
import { newSlopeFromAngle } from '../../../geo/slope.js';
|
||||||
import { polygons as POLY } from '../../../geo/polygons.js';
|
import { polygons as POLY } from '../../../geo/polygons.js';
|
||||||
import { setSliceTracker } from '../../core/slice.js';
|
import { setSliceTracker } from '../../core/slice.js';
|
||||||
import { ops as OPS } from './ops.js';
|
import { ops as OPS } from './ops.js';
|
||||||
|
|
@ -383,11 +384,11 @@ export function addDogbones(poly, dist, reverse) {
|
||||||
let bdiff = ((adiff < 0 ? (180 - adiff) : (180 + adiff)) / 2) + 180;
|
let bdiff = ((adiff < 0 ? (180 - adiff) : (180 + adiff)) / 2) + 180;
|
||||||
if (!open || (i > 1 && i < length)) {
|
if (!open || (i > 1 && i < length)) {
|
||||||
if (isCW && adiff > 45) {
|
if (isCW && adiff > 45) {
|
||||||
let newa = base.newSlopeFromAngle(lastsl.angle + bdiff);
|
let newa = newSlopeFromAngle(lastsl.angle + bdiff);
|
||||||
newpts.push(lastpt.projectOnSlope(newa, dist));
|
newpts.push(lastpt.projectOnSlope(newa, dist));
|
||||||
newpts.push(lastpt.clone());
|
newpts.push(lastpt.clone());
|
||||||
} else if (!isCW && adiff < -45) {
|
} else if (!isCW && adiff < -45) {
|
||||||
let newa = base.newSlopeFromAngle(lastsl.angle - bdiff);
|
let newa = newSlopeFromAngle(lastsl.angle - bdiff);
|
||||||
newpts.push(lastpt.projectOnSlope(newa, dist));
|
newpts.push(lastpt.projectOnSlope(newa, dist));
|
||||||
newpts.push(lastpt.clone());
|
newpts.push(lastpt.clone());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue