fieldkit
Version:
Basic building blocks for computational design projects. Written in CoffeeScript for browser and server environments.
26 lines (18 loc) • 448 B
text/coffeescript
Vec3 = require("./vector").Vec3
class Box
x1: 0
y1: 0
z1: 0
x2: 0
y2: 0
z2: 0
constructor: (=0, =0, =0, =0, =0, =0) ->
center: ->
x = Math.min(, ) + () * 0.5
y = Math.min(, ) + () * 0.5
z = Math.min(, ) + () * 0.5
new Vec3(x, y, z)
width: -> Math.abs( - )
height: -> Math.abs( - )
depth: -> Math.abs( - )
module.exports.Box = Box