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
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue