thin wall, add protrosions for screws, remove function row,

This commit is contained in:
Octopus Octopus 2022-06-17 00:38:43 -05:00
parent a87ea2761f
commit 48786d7de6
1 changed files with 12 additions and 29 deletions

View File

@ -7,10 +7,10 @@ import (
const (
BODY_SIZE_X = 300
BODY_SIZE_Y = 220
BODY_SIZE_Y = 215
BODY_SIZE_Z = 2 + 0 + 0 //Top + Walls + Base
BODY_CURVE = 10
WALL_THICKNESS = 15
WALL_THICKNESS = 6.9
)
// topPlane produces a 2D top-down image of the fightstick's top panel.
@ -26,10 +26,10 @@ func topPlane() sdf.SDF2 {
buttons = loggedMovement(buttons, v2.Vec{X: top.BoundingBox().Max.X / 2, Y: top.BoundingBox().Max.Y / 4}, "button cluster")
top = sdf.Difference2D(top, buttons)
auxillaryButtons := functionRow()
// auxillaryButtons := functionRow()
// this is a bit ugly
auxillaryButtons = loggedMovement(auxillaryButtons, v2.Vec{X: -top.BoundingBox().Max.X / 2.4, Y: 4 * (top.BoundingBox().Max.Y / 5)}, "function cluster")
top = sdf.Difference2D(top, auxillaryButtons)
// auxillaryButtons = loggedMovement(auxillaryButtons, v2.Vec{X: -top.BoundingBox().Max.X / 2.4, Y: 4 * (top.BoundingBox().Max.Y / 5)}, "function cluster")
// top = sdf.Difference2D(top, auxillaryButtons)
return top
}
@ -38,32 +38,15 @@ func topPlane() sdf.SDF2 {
func wallsPlane() sdf.SDF2 {
walls := sdf.Box2D(v2.Vec{X: BODY_SIZE_X, Y: BODY_SIZE_Y}, BODY_CURVE)
body := sdf.Box2D(v2.Vec{X: BODY_SIZE_X - WALL_THICKNESS, Y: BODY_SIZE_Y - WALL_THICKNESS}, BODY_CURVE)
walls = sdf.Difference2D(walls, body)
// left and right side
lrCutout := trapezoid(v2.Vec{X: (BODY_SIZE_Y - 20) / 2, Y: WALL_THICKNESS / 4}, -30)
ltCutout := sdf.Transform2D(lrCutout, sdf.Rotate2d(sdf.DtoR(270)))
ltCutout = sdf.Transform2D(ltCutout, sdf.Translate2d(v2.Vec{X: -((BODY_SIZE_X / 2) - ltCutout.BoundingBox().Max.X), Y: BODY_SIZE_Y / 4}))
lbCutout := sdf.Transform2D(ltCutout, sdf.MirrorX())
rtCutout := sdf.Transform2D(ltCutout, sdf.MirrorY())
rbCutout := sdf.Transform2D(lbCutout, sdf.MirrorY())
walls = sdf.Difference2D(walls, ltCutout)
walls = sdf.Difference2D(walls, lbCutout)
walls = sdf.Difference2D(walls, rtCutout)
walls = sdf.Difference2D(walls, rbCutout)
// top and bottom sides
// TODO: This is producing holes in the render :(
tbCutout := trapezoid(v2.Vec{X: (BODY_SIZE_X - 20) / 2, Y: WALL_THICKNESS / 4}, -40)
blCutout := sdf.Transform2D(tbCutout, sdf.Translate2d(v2.Vec{X: -(BODY_SIZE_X / 4), Y: -((BODY_SIZE_Y / 2) - tbCutout.BoundingBox().Max.Y)}))
brCutout := sdf.Transform2D(blCutout, sdf.MirrorY())
tlCutout := sdf.Transform2D(blCutout, sdf.MirrorX())
trCutout := sdf.Transform2D(tlCutout, sdf.MirrorY())
walls = sdf.Difference2D(walls, blCutout)
walls = sdf.Difference2D(walls, brCutout)
walls = sdf.Difference2D(walls, tlCutout)
walls = sdf.Difference2D(walls, trCutout)
screwProtrosion := sdf.Box2D(v2.Vec{X: WALL_THICKNESS / 3, Y: 12}, 0)
rProt := loggedMovement(screwProtrosion, v2.Vec{X: (BODY_SIZE_X / 2) - (WALL_THICKNESS / 1.6), Y: 0}, "right screw protrosion")
lProt := loggedMovement(screwProtrosion, v2.Vec{X: -(BODY_SIZE_X / 2) - -(WALL_THICKNESS / 1.6), Y: 0}, "left screw protrosion")
tProt := sdf.Transform2D(screwProtrosion, sdf.Rotate2d(sdf.DtoR(90)))
bProt := loggedMovement(tProt, v2.Vec{X: 0, Y: -(BODY_SIZE_Y / 2) - -(WALL_THICKNESS / 1.6)}, "bottom screw protrosion")
tProt = loggedMovement(tProt, v2.Vec{X: 0, Y: (BODY_SIZE_Y / 2) - (WALL_THICKNESS / 1.6)}, "top screw protrosion")
walls = sdf.Union2D(walls, rProt, lProt, tProt, bProt)
return walls
}