Geometry

BoxGeometry

BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided with the 'width', 'height', and 'depth' constructor arguments.

Example

var geometry = new v3d.BoxGeometry(1, 1, 1); var material = new v3d.MeshBasicMaterial({color: 0x00ff00}); var cube = new v3d.Mesh(geometry, material); scene.add(cube);

Constructor

BoxGeometry(width : Float, height : Float, depth : Float, widthSegments : Integer, heightSegments : Integer, depthSegments : Integer)

width — Width of the sides on the X axis. Default is 1.
height — Height of the sides on the Y axis. Default is 1.
depth — Depth of the sides on the Z axis. Default is 1.
widthSegments — Optional. Number of segmented faces along the width of the sides. Default is 1.
heightSegments — Optional. Number of segmented faces along the height of the sides. Default is 1.
depthSegments — Optional. Number of segmented faces along the depth of the sides. Default is 1.

Properties

.parameters : Object

An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.

Using the above example code above as our basis: geometry.parameters; // outputs an object {width: 1, height: 1, depth: 1, widthSegments: undefined, heightSegments: undefined} cube.geometry.parameters; // as above cube.geometry.parameters.width; // === 1 cube.geometry.parameters.widthSegments // === undefined.

Source

For more info on how to obtain the source code of this module see this page.