2.0.2 • Published 8 years ago

geo-3d-box v2.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

3d Box Geometry

Generate a 3d box, with optional segments, centered on the origin.

Spinning Box

var box = require('geo-3d-box')({
	size: [5,5,5],
	segments: [2,2,2]
})

or

var box = require('geo-3d-box')({
	size: 5,
	segments: 2
})

The returned object is in the format of a simplicial complex with positions and cell indices (faces). In addition uvs and normals are generated.

box = {
	positions: [ [x,y,z], [x,y,z], ... ],
	cells: [ [0,1,4], [4,3,0], ... ],
	uvs: [ [u,v], [u,v], ... ],
	normals: [ [x,y,z], [x,y,z], ... ],
}

Size (Array or Number)

Either an array or a single number. Sets the width, height, and depth of the box. Defaults to 1,1,1.

Segments (Array or Number)

Subdivide the cube.

Migrating from v1.x.x

The data is now all chunked in tuples like [ [x,y,z], [x,y,z], ... ] instead of [ x,y,z,x,y,z,... ] to be more in-line with stack.gl's ecosystem. In addition normals are now provided by default.

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago