fix rendering and animation of A-axis only movements in indexed mode

This commit is contained in:
Stewart Allen 2025-02-16 17:09:22 -05:00
commit fc4003e81a
5 changed files with 43 additions and 14 deletions

View file

@ -44,7 +44,7 @@ class Print {
addOutput(array, point, emit, speed, tool, type) {
let { lastPoint, lastEmit, lastOut } = this;
// drop duplicates (usually intruced by FDM bisections)
if (lastPoint && point) {
if (lastPoint && point && type !== 'lerp') {
// nested due to uglify confusing browser
const { x, y, z } = lastPoint;
if (point.x == x && point.y == y && point.z == z && lastEmit == emit) {

View file

@ -159,10 +159,12 @@ async function path(levels, update, opts = {}) {
let outPoint = out.point;
// rotate 4th axis indexed points
// todo -- add spark lines
if (outPoint && outPoint.a) {
if (outPoint && outPoint.a !== undefined) {
let { point } = out;
// calculate rotated point
let p2 = new THREE.Vector3(point.x, point.y, point.z)
.applyAxisAngle(XAXIS, point.a * DEG2RAD);
// reconstruct point point for display without A axis
outPoint = base.newPoint(p2.x, p2.y, p2.z);
// let sp = base.newPoint(outPoint.x * 1.1, outPoint.y * 1.1, outPoint.z * 1.1);
// sparks.push(outPoint, sp);