remove hardcoded extrude length

This commit is contained in:
Kurt Hutten IrevDev
2023-01-05 15:03:27 +11:00
parent 6ab93e85fe
commit f9e2f163a4
2 changed files with 7 additions and 5 deletions

View File

@ -96,9 +96,11 @@ export interface extrudeWallGeo {
export function extrudeGeo({ export function extrudeGeo({
from, from,
to, to,
length,
}: { }: {
from: [number, number, number] from: [number, number, number]
to: [number, number, number] to: [number, number, number]
length: number
}): BufferGeometry { }): BufferGeometry {
const { const {
// centre, // centre,
@ -108,9 +110,9 @@ export function extrudeGeo({
sign, sign,
} = trigCalcs({ from, to }) } = trigCalcs({ from, to })
const face = new PlaneGeometry(Hypotenuse3d, 4, 2, 2) const face = new PlaneGeometry(Hypotenuse3d, length, 2, 2)
face.rotateX(Math.PI / 2) face.rotateX(Math.PI * 0.5)
face.translate(Hypotenuse3d / 2, 0, -2 * sign) face.translate(Hypotenuse3d * 0.5, 0, -length * 0.5 * sign)
face.rotateY(ry) face.rotateY(ry)
face.rotateZ(rz) face.rotateZ(rz)

View File

@ -221,8 +221,7 @@ export const sketchFns = {
programMemory: ProgramMemory, programMemory: ProgramMemory,
name: string = '', name: string = '',
sourceRange: SourceRange, sourceRange: SourceRange,
length: any, length: number,
// sketchVal: any
sketchVal: SketchGeo | Transform sketchVal: SketchGeo | Transform
): ExtrudeGeo | Transform => { ): ExtrudeGeo | Transform => {
const getSketchGeo = (sketchVal: SketchGeo | Transform): SketchGeo => { const getSketchGeo = (sketchVal: SketchGeo | Transform): SketchGeo => {
@ -253,6 +252,7 @@ export const sketchFns = {
const geo = extrudeGeo({ const geo = extrudeGeo({
from: [from[0], from[1], 0], from: [from[0], from[1], 0],
to: [to[0], to[1], 0], to: [to[0], to[1], 0],
length,
}) })
extrudeFaces.push({ extrudeFaces.push({
type: 'extrudeFace', type: 'extrudeFace',