mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
don't use inverse
This commit is contained in:
parent
bc06f703ac
commit
0b6a4a1588
@ -1,4 +1,4 @@
|
|||||||
import { divide, distanceTo } from './VectorUtils.js';
|
import { scale, distanceTo } from './VectorUtils.js';
|
||||||
import { PRECISION, VERSION } from '../../constants.js';
|
import { PRECISION, VERSION } from '../../constants.js';
|
||||||
|
|
||||||
export const MOVE = 'G';
|
export const MOVE = 'G';
|
||||||
@ -10,8 +10,6 @@ export const POSITION_X = 'X';
|
|||||||
export const POSITION_Y = 'Y';
|
export const POSITION_Y = 'Y';
|
||||||
export const POSITION_Z = 'Z';
|
export const POSITION_Z = 'Z';
|
||||||
|
|
||||||
const PRECISION_INVERSE = 1 / PRECISION;
|
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
constructor(layerHeight) {
|
constructor(layerHeight) {
|
||||||
this._nozzleToFilamentRatio = 1;
|
this._nozzleToFilamentRatio = 1;
|
||||||
@ -54,7 +52,7 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moveTo(x, y, z, { speed }) {
|
moveTo(x, y, z, { speed }) {
|
||||||
const newNozzlePosition = divide({ x, y }, PRECISION_INVERSE);
|
const newNozzlePosition = scale({ x, y }, PRECISION);
|
||||||
const lineLength = distanceTo(this._nozzlePosition, newNozzlePosition);
|
const lineLength = distanceTo(this._nozzlePosition, newNozzlePosition);
|
||||||
|
|
||||||
this._duration += lineLength / speed;
|
this._duration += lineLength / speed;
|
||||||
@ -73,7 +71,7 @@ export default class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lineTo(x, y, z, { speed, flowRate }) {
|
lineTo(x, y, z, { speed, flowRate }) {
|
||||||
const newNozzlePosition = divide({ x, y }, PRECISION_INVERSE);
|
const newNozzlePosition = scale({ x, y }, PRECISION);
|
||||||
const lineLength = distanceTo(this._nozzlePosition, newNozzlePosition);
|
const lineLength = distanceTo(this._nozzlePosition, newNozzlePosition);
|
||||||
|
|
||||||
this._extruder += this._nozzleToFilamentRatio * lineLength * flowRate;
|
this._extruder += this._nozzleToFilamentRatio * lineLength * flowRate;
|
||||||
|
Loading…
Reference in New Issue
Block a user