Skip to content

Commit

Permalink
export Shape.S
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegt committed May 20, 2022
1 parent 67bd34f commit 7ac5dc5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Shape struct {
func (in Shape) Translate(x, y, z float64) (out Shape) {
out = Shape{}
t := sdf.Translate3d(sdf.V3{X: x, Y: y, Z: z})
out.s = sdf.Transform3D(in.s, t)
out.S = sdf.Transform3D(in.S, t)
return
}

Expand All @@ -21,48 +21,48 @@ func (in Shape) Rotate(x, y, z float64) (out Shape) {
xr := sdf.RotateX(sdf.DtoR(x))
yr := sdf.RotateY(sdf.DtoR(y))
zr := sdf.RotateZ(sdf.DtoR(z))
out.s = sdf.Transform3D(in.s, xr)
out.s = sdf.Transform3D(out.s, yr)
out.s = sdf.Transform3D(out.s, zr)
out.S = sdf.Transform3D(in.S, xr)
out.S = sdf.Transform3D(out.S, yr)
out.S = sdf.Transform3D(out.S, zr)
return
}

func (pos Shape) Sub(neg Shape) (out Shape) {
out = Shape{}
out.s = sdf.Difference3D(pos.s, neg.s)
out.S = sdf.Difference3D(pos.S, neg.S)
return
}

func Union(ins ...Shape) (out Shape) {
out = Shape{}
var ss []sdf.SDF3
for _, in := range ins {
ss = append(ss, in.s)
ss = append(ss, in.S)
}
out.s = sdf.Union3D(ss...)
out.S = sdf.Union3D(ss...)
return
}

func Box(x, y, z, round float64) (out Shape) {
out = Shape{}
var err error
out.s, err = sdf.Box3D(sdf.V3{X: x, Y: y, Z: z}, round)
out.S, err = sdf.Box3D(sdf.V3{X: x, Y: y, Z: z}, round)
Ck(err)
return
}

func Cylinder(height, radius, round float64) (out Shape) {
out = Shape{}
var err error
out.s, err = sdf.Cylinder3D(height, radius, round)
out.S, err = sdf.Cylinder3D(height, radius, round)
Ck(err)
return
}

func Cone(height, r0, r1, round float64) (out Shape) {
out = Shape{}
var err error
out.s, err = sdf.Cone3D(height, r0, r1, round)
out.S, err = sdf.Cone3D(height, r0, r1, round)
Ck(err)
return
}

0 comments on commit 7ac5dc5

Please sign in to comment.