npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gl-aabb3

v1.0.1

Published

gl-matrix style functions for 3D axis-aligned bounding boxes

Downloads

26

Readme

gl-aabb3

unstable

Introduction

This module implements gl-matrix style functions for axis-aligned bounding boxes defined by the 6-tuple (xmin, ymin, zmin, xmax, ymax, zmax).

Usage

NPM

aabb3 = require('gl-aabb3')

Will load all of the module's functionality and expose it on a single object. Note that any of the methods may also be required directly from their files.

For example, the following are equivalent:

var scale = require('gl-aabb3').scale;
var scale = require('gl-aabb3/scale');

API

center(out:vec3, a:aabb3)

Compute the vec3 center of an aabb3.

clone(a:aabb3)

Create a new aabb3 initialized with values from an existing bounding box.

copy(out:aabb3, a:aabb3)

Copy the values from one bounding box to another.

create()

Create a new, empty aabb3.

diagonal(out:vec3, a:aabb3)

Compute the diagonal as a vec3.

diagonalLength(a:aabb3)

Compute the length of a diagonal.

difference(out:aabb3, a:aabb3, b:aabb3)

Compute the bounding box which bounds the boolean subtraction of two bounding boxes. Note that this does not represent the shape of the boolean operation but only the box which bounds it.

equals(a:aabb3, b:aabb3)

Returns whether or not the bounding boxes have approximately the same elements in the same position.

exactEquals(a:aabb3, b:aabb3)

Returns whether or not the bounding boxes exactly have the same elements in the same position (when compared with ===)

expand(out:aabb3, a:aabb3, distance:vec3)

Expand a bounding box with respect to its center by a fixed per-axis distance.

expandRelative(out:aabb3, a:aabb3, scale:vec3)

Expand a bounding box with respect to its center by a relative per-axis scale factor.

fromValues(xmin:Number, ymin:Number, zmin:Number, xmax:Number, ymax:Number, zmax:Number)

Creates a new aabb3 initialized with the given values.

hasNonNegativeExtent(a:aabb3)

Returns true if the the bounding box has non-negative extent in every dimension.

hasPositiveExtent(a:aabb3)

Returns true if the the bounding box has positive extent in every dimension.

intersection(out:aabb3, a:aabb3, b:aabb3)

Compute the box which bounds the intersection of a and b

intersectsPlane(a:aabb3, origin:vec3, normal:vec3)

Returns true if aabb3 intersects a plane defined by an origin and normal.

intersectsRay(a:aabb3, origin:aabb3, direction:aabb3)

Returns true if a given ray intersects the bounding box.

normalize(out:aabb3, a:aabb3)

Enforce non-negative extent in each dimension. If the extent in a dimension is negative, the bounds in that dimension will be moved to the center.

radius(a:aabb3)

Compute the length of a half-diagonal.

scale(out:aabb3, a:aabb3, scale:vec3)

Scale a bounding box by a vec3 in each respective dimension

set(out:aabb3, xmin:Number, ymin:Number, zmin:Number, xmax:Number, ymax:Number, zmax:Number)

Set the components of a aabb3 to the given values.

shape(out:vec3, a:aabb3)

Return the shape of the box as a vec3.

squaredDiagonalLength(a:aabb3)

Compute the square of the length of a diagonal.

squaredRadius(a:aabb3)

Compute the squared length of a half-diagonal.

surfaceArea(a:aabb3)

Compute the surface area of a bounding box.

transformMat3(out:aabb3, a:aabb3, m:mat3)

Transforms the aabb3 with a mat3. Note that the result will be large enough to fully bound the transformed input.

transformMat4(out:aabb3, a:aabb3, m:mat4)

Transforms the aabb3 with a mat4. 4th vector component is implicitly '1'. Note that the result will be large enough to fully bound the transformed input.

transformQuat(out:aabb3, a:aabb3, q:quat)

Transforms the aabb3 with a quat. Note that the result will be large enough to fully bound the transformed input.

translate(out:aabb3, a:aabb3, b:vec3)

Translate a bounding box by a vec3.

union(out:aabb3, a:aabb3, b:aabb3)

Compute the bounding box which bounds the union of two bounding boxes.

volume(a:aabb3)

Compute the volume of a bounding box.

License

© 2018 Ricky Reusser. MIT License.