testing rotation / offset compensation

This commit is contained in:
Stewart Allen 2022-11-02 13:31:14 -04:00
commit 8c3997d16d
2 changed files with 8 additions and 3 deletions

View file

@ -47,9 +47,10 @@ class Slice {
let layers = this.layers = new kiri.Layers();
if (tracked) {
let { track } = tracked;
let { indexed, indexRad, delta } = track;
let { indexed, indexRad, delta, tzoff } = track;
if (indexed) {
layers.setRotation(indexRad);
// layers.setPosition(0, -delta.y, delta.z + tzoff);
}
}
return layers;

View file

@ -651,12 +651,16 @@ class Widget {
// if indexed, return points rotated about X and then offset
let track = this.track;
if (translate && track.indexed) {
// console.log(1, new THREE.Box3().setFromBufferAttribute(pos), track.box);
let delta = track.delta;
pos = pos.clone().applyMatrix4(
new THREE.Matrix4().makeTranslation(0, 0, -track.box.d/2)
).applyMatrix4(
new THREE.Matrix4().makeRotationX(-track.indexRad)
// ).applyMatrix4(
// new THREE.Matrix4().makeTranslation(0, -delta.y, -delta.z + track.tzoff)
).applyMatrix4(
new THREE.Matrix4().makeTranslation(0, 0, track.box.d/2)
);
// console.log(2, new THREE.Box3().setFromBufferAttribute(pos));
}
pos = pos.array;
if (geo.index && unroll !== false) {