fix paint on support for translated widgets, apply belt transforms to manual paint points at slice time
This commit is contained in:
parent
dce90fab07
commit
d581db53c0
5 changed files with 28 additions and 6 deletions
|
|
@ -877,6 +877,7 @@ class Point {
|
|||
const { x, y } = this;
|
||||
this.x = x * Math.cos(angle) - y * Math.sin(angle);
|
||||
this.y = y * Math.cos(angle) + x * Math.sin(angle);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -200,11 +200,12 @@ export const client = {
|
|||
let vertices = widget.getGeoVertices();
|
||||
send("sync", {
|
||||
id: widget.id,
|
||||
meta: widget.meta,
|
||||
anno: widget.annotations(),
|
||||
group: widget.group.id,
|
||||
meta: widget.meta,
|
||||
position: widget.mesh.position,
|
||||
track: widget.track,
|
||||
vertices,
|
||||
position: widget.mesh.position,
|
||||
}, done => {
|
||||
widget.modified = false;
|
||||
});
|
||||
|
|
@ -236,7 +237,6 @@ export const client = {
|
|||
slice(settings, widget, callback) {
|
||||
send("slice", {
|
||||
id: widget.id,
|
||||
anno: widget.annotations(),
|
||||
settings: settings
|
||||
}, reply => {
|
||||
callback(reply);
|
||||
|
|
|
|||
|
|
@ -302,8 +302,14 @@ function supportStart({ remove } = { remove: false }) {
|
|||
|
||||
function supportUpdate(point, widget, remove) {
|
||||
let { x, y, z } = point;
|
||||
let pos = widget.track.pos;
|
||||
// translate from three coordinates to widget coordinates
|
||||
let rec = {
|
||||
point: { x, y:-z, z:y },
|
||||
point: {
|
||||
x: x - pos.x,
|
||||
y: -z - pos.y,
|
||||
z: y - pos.z
|
||||
},
|
||||
radius: 2
|
||||
};
|
||||
// return console.log({ on, widget, point });
|
||||
|
|
|
|||
|
|
@ -477,8 +477,22 @@ export function sliceOne(settings, widget, onupdate, ondone) {
|
|||
stack.sort((a,b) => a.z - b.z);
|
||||
|
||||
// process manual supports if they exist
|
||||
// convert paint points to circles on matching slices
|
||||
let { paint } = widget.anno;
|
||||
let { belt } = widget;
|
||||
// apply belt transformations, if needed
|
||||
if (belt && paint) {
|
||||
let { dy, angle } = belt;
|
||||
// make a copy we can modify
|
||||
paint = structuredClone(paint);
|
||||
for (let rec of paint) {
|
||||
let { point } = rec;
|
||||
// convert yz plane to xy plane to re-use point utility function
|
||||
let np = newPoint(point.y + dy, point.z, 0).rotate(angle * (Math.PI/180));
|
||||
point.y = np.x;
|
||||
point.z = np.y;
|
||||
}
|
||||
}
|
||||
// convert paint points to circles on matching slices
|
||||
if (manual && paint?.length) {
|
||||
let hpi = Math.PI/2;
|
||||
for (let slice of stack) {
|
||||
|
|
|
|||
|
|
@ -349,6 +349,8 @@ const dispatch = {
|
|||
widget.vertices = vertices;
|
||||
// restore meta
|
||||
widget.meta = data.meta;
|
||||
// restore annotations
|
||||
widget.anno = data.anno;
|
||||
// restore tracking object
|
||||
widget.track = data.track;
|
||||
send.done(data.id);
|
||||
|
|
@ -449,7 +451,6 @@ const dispatch = {
|
|||
setPrint(null);
|
||||
current.mode = settings.mode.toUpperCase();
|
||||
|
||||
widget.anno = data.anno || widget.anno;
|
||||
widget.settings = settings;
|
||||
widget.clearSlices();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue