From d60aa042e5a1788f162a7d50ec152337d551ea3f Mon Sep 17 00:00:00 2001 From: Octopus Octopus Date: Sun, 12 Jun 2022 11:10:29 -0500 Subject: [PATCH] create planes.go --- fightstick/planes.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 fightstick/planes.go diff --git a/fightstick/planes.go b/fightstick/planes.go new file mode 100644 index 0000000..2c4236f --- /dev/null +++ b/fightstick/planes.go @@ -0,0 +1,28 @@ +package main + +import ( + "github.com/deadsy/sdfx/sdf" + v2 "github.com/deadsy/sdfx/vec/v2" +) + +type planes map[string]sdf.SDF2 + +func (p planes) add(p2 planes) { + for k, v := range p2 { + p[k] = v + } +} + +func splitPlane(name string, plane sdf.SDF2) map[string]sdf.SDF2 { + planes := make(map[string]sdf.SDF2) + /* original := topPlane() + x, y := original.BoundingBox().Max.X*2, original.BoundingBox().Max.Y*2 + cutout := sdf.Box2D(sdf.V2{X: x, Y: y}, 0) + cOLeft := sdf.Transform2D(cutout, sdf.Translate2d(sdf.V2{X: x / 2, Y: 0})) + cORight := sdf.Transform2D(cutout, sdf.Translate2d(sdf.V2{X: -x / 2, Y: 0})) + planes["left"] = sdf.Difference2D(original, cOLeft) + planes["right"] = sdf.Difference2D(original, cORight)*/ + planes[name+" "+"right"] = sdf.Cut2D(plane, v2.Vec{X: 0, Y: 0}, v2.Vec{X: 0, Y: 1}) + planes[name+" "+"left"] = sdf.Transform2D(sdf.Cut2D(sdf.Transform2D(plane, sdf.MirrorY()), v2.Vec{X: 0, Y: 0}, v2.Vec{X: 0, Y: 1}), sdf.MirrorY()) + return planes +}