# three-mesh-bvh: Constants

## Constants

### CENTER: number

Option for splitting each BVH node down the center of the longest axis of the bounds.

This is the fastest construction option and will yield a good, performant bounds.

### AVERAGE: number

Option for splitting each BVH node at the average point along the longest axis for
all triangle centroids in the bounds.

This strategy may be better than `CENTER` with some geometry.

### SAH: number

Option to use a Surface Area Heuristic to split the bounds more optimally. This SAH
implementation tests 32 discrete splits in each node along each axis to determine
which split is the lowest cost.

This is the slowest construction option but will yield the best bounds of the three
options and use the least memory.

### NOT_INTERSECTED: number

Indicates the shape did not intersect the given bounding box.

### INTERSECTED: number

Indicates the shape did intersect the given bounding box.

### CONTAINED: number

Indicate the shape entirely contains the given bounding box.

## Shader and Texture Packing API

### bvh_distance_functions: string

Set of shader functions used for interacting with the packed BVH in a shader and sampling
VertexAttributeTextures. Provides distance query functions. See
[src/webgl/glsl](https://github.com/gkjohnson/three-mesh-bvh/tree/master/src/webgl/glsl)
for full implementations and declarations.

Accessed as `BVHShaderGLSL.bvh_distance_functions`.

### bvh_ray_functions: string

Set of shader functions used for interacting with the packed BVH in a shader and sampling
VertexAttributeTextures. Provides ray intersection functions. See
[src/webgl/glsl](https://github.com/gkjohnson/three-mesh-bvh/tree/master/src/webgl/glsl)
for full implementations and declarations.

Accessed as `BVHShaderGLSL.bvh_ray_functions`.

### bvh_struct_definitions: string

Set of shader structs and defined constants used for interacting with the packed BVH in a
shader. See [src/webgl/glsl/bvh_struct_definitions.glsl.js](https://github.com/gkjohnson/three-mesh-bvh/blob/master/src/webgl/glsl/bvh_struct_definitions.glsl.js)
for full implementations and declarations.

Accessed as `BVHShaderGLSL.bvh_struct_definitions`.

### common_functions: string

Set of shader functions used for interacting with the packed BVH in a shader and sampling
VertexAttributeTextures. Provides common utility functions including `texelFetch1D`. See
[src/webgl/glsl](https://github.com/gkjohnson/three-mesh-bvh/tree/master/src/webgl/glsl)
for full implementations and declarations.

Accessed as `BVHShaderGLSL.common_functions`.
