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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gov.nasa.jpl.honeycomb/three-extensions

v0.0.6

Published

Set of three.js math extensions and utilities.

Downloads

5

Readme

Three.js Math Extensions

Set of three.js math extensions and utilities.

Use

TODO

API

CircleArc

Mathematical description of an arc on the edge of a circle.

startPoint

startPoint : Vector2 = (0,0)

The start point along the arc.

endPoint

endPoint : Vector2 = (0,0)

The end point along the arc.

deltaHeading

deltaHeading : Number = 0

The change in heading along the arc.

startHeading

startHeading : Number = 0

The initial heading of the arc. This is only used for cases where the initial heading cannot be inferred, such as when the arc length are 0.

toShortestArc

toShortestArc(  ) : void

Converts this arc to the shortest variant to get to the same point. If the arc sweeps larger than PI / 2 then we invert the delta heading.

getCircleCenter

getCircleCenter( target : Vector2 ) : Vector2

Gets the center of the circle that this arc is on.

getCircleRadius

getCircleRadius(  ) : Number

Gets the radius of the circle that this arc is on.

getChordLength

getChordLength(  ) : Number

Get the chord length from the start point to the end point of the arc.

getArcLength

getArcLength(  ) : Number

Get the length of the arc.

closestPointToPoint

closestPointToPoint( point : Vector2, target : Vector2 ) : Vector2

Sets target to the point on the arc that is closest to the given point. Returns the target vector.

at

at( t : Number, target : Vector2 ) : Vector2

Sets the target vector to the point t along the arc where t is between 0 and 1. Returns the target vector.

forEachPoint

forEachPoint(
	steps : Number, 
	cb : ( point : Vector2, tangent : Vector2, index : Number ) => void
) : void

Fires the callback for every steps + 1 points along the arc. Callback takes the point, the tangent, and the step index.

generatePoints

generatePoints( steps : Number, target : Array ) : Array

Generate an array of x, y, z points along the the arc with z at 0.

copy

copy( source : CircleArc ) : void

Sets this CircleArc to have the same properties as source.

clone

clone(  ) : CircleArc

Creates a clone of this object.

OptimizedPlaneBufferGeometry

A copy of three.js' PlaneBufferGeometry modified to immediately write to 32 bit buffers and excludes uv and normal attributes to save build and run time memory.

extends BufferGeometry

constructor

constructor(
	width : Number = 1, 
	height : Number = 1, 
	widthSegments : Number = 1, 
	heightSegments : Number = 1
) : void

Specifies the spatial width and height as well as the number of grid segments in the plane on the x and y axis.

InfiniteGrid

Mesh to render an infinite grid in size with grid lines every 10m and 1m by default and thicker lines at 0.

extends Mesh

constructor

constructor(
	size1 : Number = 1, 
	size2 : Number = 10, 
	color : Color = 0xffffff, 
	distance : Number = 2000
) : void

Parameters for setting the grid line stride, color, and distance the grid will fade out at.

DisposableEventListeners

Class for registering and tracking events on an EventListener so they can be easily disposed of and removed.

addEventListener

addEventListener( target : EventDispatcher, name : String, callback : Function ) : void

Add an event listener on target for event name

dispose

dispose(  ) : void

Remove all event listeners that have been registered with this instance.

ObjectPool

Class for dynamically growing and shrinking a pool of objects based on a dataset and addin them to a three.js object.

disposeImmediately

disposeImmediately : Boolean = false

Whether the created pool objects should be deleted immediately when shrinking the pool or if they should just be removed and disposed when calling dispose.

constructor

constructor( parent : Object3D ) : void

Takes the Object3D to add all created pool objects to.

updateData

updateData( data : Array ) : void

Update the pool of objects based on the given data.

dispose

dispose(  ) : void

Disposes of all objects created in the pool.

createObject

createObject(  ) : Object3D

Called to create a new instance of the object to display when growing the pool.

Must be implemented.

updateObject

updateObject( object : Object3D, data : any ) : void

Called to update object object based on the given data from the data array.

Must be implemented.

disposeObject

disposeObject( object : Object3D ) : void

Fully dispose of the object that was created for the pool.

Must be implemented.

ExtMathUtils

Set of extended math utility functions.

fitPlaneFromPoints

static fitPlaneFromPoints(
	points : Array<Vector3>, 
	targetPos : Vector3, 
	targetDir : Vector3
) : void

Takes a set of points and derives a best fit plane from them. Puts the plane origin in targetPos and the direction in targetDir.

FlyOrbitControls

An extension of three.js' OrbitControls that allow for flying with the WASD keys.

WASD are used to move the camera forward, back, left, and right. QE are used to move the camera up and down. And shift can be used to fly the camera faster.

extends OrbitControls

enableFlight

enableFlight : Boolean = true

Whether to enable flight controls.

baseSpeed

baseSpeed : Number = 0.1

The base speed to fly at when shift is not held. Specified in units per second.

fastSpeed

fastSpeed : Number = 0.1

The fast speed to fly at when shift is held. Specified in units per second.

constructor

constructor( camera : Camera, domElement : Element ) : void

Takes the camera and renderer.domElement that would normally be passed to OrbitControls.

MaterialReducer

Utility class for sharing equivelant textures and materials between objects in a hierarchy of objects.

ignoreKeys

ignoreKeys : Set = ['uuid']

A set of keys to ignore when comparing materials and textures. Defaults to just include "uuid".

shareTextures

shareTextures : Boolean = true

Whether to share texture instances between the final materials.

process

process( object : Object3D ) : Number

Process the given hierarchy of objects to reduce the number of materials and textures. Returns the number of materials removed. Materials and textures are shared over subsequent runs of the function.

GPUTimeSampler

Class for easily measuring the amount of time the GPU is taking to do work.

extends EventDispatcher

Events

query-complete

Fired whenever new GPU timing data is available. Provides the latest time and average/ time over the max number of sample frames.

isSupported

isSupported : Boolean

Whether the required extension to use the class is supported.

constructor

constructor( context : WebGL2RenderingContext ) : void

startQuery

startQuery(  ) : void

Should be called at the beginning of the rendering work to be measured.

endQuery

endQuery(  ) : void

Should be called at the end of the rendering work to be measured. Once the query finishes the query-complete event will fire.