Update box brush calculations to use face and vertex IDs

This commit is contained in:
2026-04-05 02:23:08 +02:00
parent ce5e18641b
commit b23cb0dd32
2 changed files with 17 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
import { Euler, MathUtils, Vector3 } from "three";
import type { Vec3 } from "../core/vector";
import { type BoxBrush } from "../document/brushes";
import { BOX_VERTEX_IDS, type BoxBrush } from "../document/brushes";
import { getBoxBrushLocalVertexPosition } from "./box-brush-mesh";
export interface BoxBrushBounds {
@@ -45,17 +45,8 @@ export function getBoxBrushCornerPositions(brush: BoxBrush): Vec3[] {
MathUtils.degToRad(brush.rotationDegrees.z),
"XYZ"
);
const offsets = [
"negX_negY_negZ",
"posX_negY_negZ",
"negX_posY_negZ",
"posX_posY_negZ",
"negX_negY_posZ",
"posX_negY_posZ",
"negX_posY_posZ",
"posX_posY_posZ"
].map((vertexId) => {
const localVertex = getBoxBrushLocalVertexPosition(brush, vertexId as keyof BoxBrush["geometry"]["vertices"] & never);
const offsets = BOX_VERTEX_IDS.map((vertexId) => {
const localVertex = getBoxBrushLocalVertexPosition(brush, vertexId);
return new Vector3(localVertex.x, localVertex.y, localVertex.z);
});