open-index/open-npm huggingface dataset:
npm package: @gov.nasa.jpl.honeycomb/frame-transformer
Description: Utility for transforming between 3d frames using three.js.
Latest version: 0.0.6

# frame-transformer

Helper functions for transforming matrices, vectors, and quaternions between frames.

<!--{package-dependencies ./package.json}-->

# Use

```js
import { Matrix4, Vector3 } from 'three';
import { FrameTransformer } from '@gov.nasa.jpl.honeycomb/frame-transformer';

const
    point = new Vector3(),
    frameA = new Matrix4(),
    frameB = new Matrix4();

// ...

// Transform a positon from frame A to frame B and write the result
// back into the point vector
FrameTransformer.transformPoint(frameA, frameB, point, point);
```

# API

<!-- START_AUTOGENERATED_DOCS -->
## FrameTransformer

Class with static methods for transforming between frames

### transformFrame<a name="FrameTransformer.transformFrame"></a>

```js
static transformFrame(
	fromFrame : Matrix4, 
	toFrame : Matrix4, 
	mat : Matrix4, 
	outputMat : Matrix4
) : void
```

Transforms the provided input matrix from being relative to the `fromFrame` to being
relative to the `toFrame`. The result is written to the `output` matrix. The input and
output matrices can be the same object.

### transformPoint<a name="FrameTransformer.transformPoint"></a>

```js
static transformPoint(
	fromFrame : Matrix4, 
	toFrame : Matrix4, 
	pos : Vector3, 
	outputVec : Vector3
) : void
```

Same as `transformFrame` but for points.

### transformDirection<a name="FrameTransformer.transformDirection"></a>

```js
static transformDirection(
	fromFrame : Matrix4, 
	toFrame : Matrix4, 
	dir : Vector3, 
	outputVec : Vector3
) : void
```

Same as `transformFrame` but for directions.

### transformQuaternion<a name="FrameTransformer.transformQuaternion"></a>

```js
static transformQuaternion(
	fromFrame : Matrix4, 
	toFrame : Matrix4, 
	quat : Quaternion, 
	outputQuat : Quaternion
) : void
```

Same as `transformFrame` but for quaternions.

### constructor

```js
constructor( fromFrame : Matrix4, toFrame : Matrix4 ) : void
```

The `FrameTransformer` can be instantiated such that it will only transform between a fixed set
of frames. The instance retains the same static methods but they only take the `input` and the
`output` parameters.

Note that a reference to the passed matrices are saved so updates to them will effect results.

### transformMatrix<a name="FrameTransformer#transformMatrix"></a>

```js
transformMatrix( mat : Matrix4, output : Matrix4 ) : void
```

### transformPoint<a name="FrameTransformer#transformPoint"></a>

```js
transformPoint( pos : Vector3, output : Vector3 ) : void
```

### transformDirection<a name="FrameTransformer#transformDirection"></a>

```js
transformDirection( dir : Vector3, output : Vector3 ) : void
```

### transformQuaternion<a name="FrameTransformer#transformQuaternion"></a>

```js
transformQuaternion( quat : Quaternion, output : Quaternion ) : void
```


<!-- END_AUTOGENERATED_DOCS -->
npm package: @gov.nasa.jpl.honeycomb/geometry-optimization-utils
Description: Utilities for optimizing three.js geometry memory.
Latest version: 0.0.6

# Geometry Optimization Utilities

<!--{package-dependencies ./package.json}-->

# Use

```js
import { SphereBufferGeometry } from 'three';
import { optimizeGeometry } from '@gov.nasa.jpl.honeycomb/optimize-geometry-utils';

// modifies the attributes in place!
const geometry = new SphereBufferGeometry();
optimizeGeometry(geometry);

// smaller memory footprint!
```

# API

<!-- START_AUTOGENERATED_DOCS -->
## Functions
### optimizeGeometry<a name="optimizeGeometry"></a>

```js
optimizeGeometry( geometry : BufferGeometry ) : void
```

Takes a buffer geometry and optimizes the memory of the uv, uv2, normal, and index attributes
in place to normalized attributes. Note that UVs outside the range of [0, 1] will not normalize
correcrly.

!> Note that the `BufferAttributes` are modified in place instead of creating new ones.

!> Note that InterleavedBufferAttributes are not supported.

### toNormalizedByteArray<a name="toNormalizedByteArray"></a>

```js
toNormalizedByteArray(
	array : TypedArray, 
	signed : Boolean = true, 
	bytes : Number = 1
) : TypedArray
```

Takes a given typed array and converts it into an array that can store data with
the given sign flag and byte precision. Float arrays are converted such that [0, 1.0]
(or [-1.0, 1.0] if signed) is normalized to the whole byte precision. Int or Uint types
are normal mapped to the new byte range.

If the given array is already of the target type it is returned unchanged immediately.

### toFloatArray<a name="toFloatArray"></a>

```js
toFloatArray( array : TypedArray, bytes : Number = 4 ) : TypedArray
```

Takes a given typed array and converts it into a float array of the given byte length with
normalized data.


<!-- END_AUTOGENERATED_DOCS -->
npm package: @gov.nasa.jpl.honeycomb/mars-sky
Description: Sky shader for mars in three.js.
Latest version: 0.0.6

# mars-sky

Shader and three.js object for rendering a physically based version of the Martian sky. Based on the paper 2013 paper [Physically Based Rendering of the Martian Atmosphere](http://elib.dlr.de/86477/1/Collienne_GI_VRAR_2013.pdf).

Originally implemented by Ryan Kinnett.

<!--{example mars-sky.js}-->
<!--{package-dependencies ./package.json}-->

# Use
```js
import { MarsSky } from '@gov.nasa.jpl.honeycomb/mars-sky';

const directionalLight, ambientLight, scene;
const sky = new MarsSky();

scene.add(sky);
sky.scale.setScalar(450000);

marsSky.sunPosition.set( 1, 1, 1 ).normalize();
marsSky.getColor( ambientLight.color );
ambientLight.intensity = marsSky.getAmbientIntensity();
directionalLight.intensity = marsSky.getDirectionalIntensity();
```

# API

<!-- START_AUTOGENERATED_DOCS -->
## MarsSky

Initializes itself with a sphere and sky shader material.

_extends Mesh_

### sunPosition<a name="MarsSky#sunPosition"></a>

```js
sunPosition : null
```



### getColor<a name="MarsSky#getColor"></a>

```js
getColor( target : Color ) : Color
```

Sets the target color object to the color of the ambient light
given the current sun angle.

### getDirectionalIntensity<a name="MarsSky#getDirectionalIntensity"></a>

```js
getDirectionalIntensity(  ) : Number
```

Returns the intensity of the directional light given the current
sun position.

### getAmbientIntensity<a name="MarsSky#getAmbientIntensity"></a>

```js
getAmbientIntensity(  ) : Number
```

Returns the intensity of the ambient light given the current sun position.

## MarsSkyShader

### uniforms<a name="MarsSkyShader#uniforms"></a>

```js
uniforms : Object
```

```js
{
    luminance = 1.0 : Number,

    turbidity = 0.8 : Number,

    rayleigh = 0.005 : Number,

    mieCoefficient = 0.005 : Number,

    mieDirectionalG = 0.8 : Number,

    // The position of the sun in world space. This is relative to the
    // skys coordinate frame.
    sunPosition = 0, 0, 0 : Vector3
}
```



<!-- END_AUTOGENERATED_DOCS -->
npm package: @gov.nasa.jpl.honeycomb/object-cache
Description: Copies and caches Javascript objects for quick read and writes from disk if available.
Latest version: 0.0.6

# object-cache

A cache implementation that looks like a Javascript Map object but writes and reads to and from disk if running in a Node context. Otherwise a `Map` is used. When serializing an object with TypedArray instances, numeric arrays of length > 1e4, and strings of length > 1e4 to disk they are serialized and written to separately to retain JSON processing speed.

!> Note that as an optimization it is assumed that arrays are consistently typed. So if the first element is a number then all values in the array must be numbers otherwise there will be data loss when retrieving from the cache.

!> The object cache is not guaranteed to return a copy or new object when retrieving previously cached data. It may return the originally cached object.

!> The IndexedDBCache is untested because the test shim causes our docker tests to fail.

<!--{package-dependencies ./package.json}-->

# Use

```js
import { ObjectCache } from '@gov.nasa.jpl.honeycomb/object-cache';

const cache = new ObjectCache();
cache.set( 'key', { data: 1 } );

console.log( cache.get( 'key' ) );
// { data: 1 }

cache.delete( 'key' );
```

# API

## ObjectCache

The API mirrors the [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) API for `has`, `set`, `get`, `delete`, and `clear` and the constructor takes no arguments.
npm package: @gov.nasa.jpl.honeycomb/pgm-loader
Description: Loader and parser for the PGM image format for three.js.
Latest version: 0.0.6

# PGM Loader

A class in the same form as the three.js loaders for loading and parsing [PGM images](http://netpbm.sourceforge.net/doc/pgm.html).

<!--{example pgm-loader.js}-->

<!--{package-dependencies ./package.json}-->

# Use

```js
import { PGMLoader } from '@gov.nasa.jpl.honeycomb/pgm-loader';

const loader = new PGMLoader();
loader.load('path/to/file.pgm', array => {

    // ... loaded data ...

});
```

# API

<!-- START_AUTOGENERATED_DOCS -->
## PGMResult

### data<a name="PGMResult#data"></a>

```js
data : Uint16Array | Uint8Array
```


The PGM laid out in an array in row major order where each row has a stride of `width`.


### width<a name="PGMResult#width"></a>

```js
width : Number
```


The width of the pgm file in pixels.


### height<a name="PGMResult#height"></a>

```js
height : Number
```


The height of the pgm file in pixels.


### maxValue<a name="PGMResult#maxValue"></a>

```js
maxValue : Number
```


The maximum gray value in the file.


## PGMLoaderBase

Class for loading and parsing PGM image files

### fetchOptions<a name="PGMLoaderBase#fetchOptions"></a>

```js
fetchOptions : Object = { credentials: 'same-origin' }
```


Fetch options for loading the file.


### load<a name="PGMLoaderBase#load"></a>

```js
load( url : String ) : Promise<PGMResult>
```

Loads and parses the PGM file. The promise resolves with the returned
data from the [parse](#PGMLoader#parse) function.

### parse<a name="PGMLoaderBase#parse"></a>

```js
parse( buffer : ArrayBuffer ) : PGMResult
```

Parses the contents of the given PGM and returns an object describing
the telemetry.

## PGMLoader

Three.js implementation of PGMLoaderBase.

_extends PGMLoaderBase_

### manager<a name="PGMLoader#manager"></a>

```js
manager : LoadingManager = DefaultLoadingManager
```



### constructor

```js
constructor( manager : LoadingManager = DefaultLoadingManager ) : void
```

### load<a name="PGMLoader#load"></a>

```js
load( url : String, texture : DataTexture = new DataTexture() ) : DataTexture
```

Loads and parses the PGM file and returns a DataTexture. If a DataTexture is passed into
the function the data is applied to it.

### parse<a name="PGMLoader#parse"></a>

```js
parse( buffer : Uint8Array | ArrayBuffer, texture : DataTexture = new DataTexture() ) : DataTexture
```

Parses the contents of the given PGM file and returns a texture with the
contents.


<!-- END_AUTOGENERATED_DOCS -->
npm package: @gov.nasa.jpl.honeycomb/ros-message-converter
Description: Utility for converting cbor-raw ROSLibJS message contents to the content.
Latest version: 0.0.6

# ROS Message Converter

Utility for loading and tracking message types and definitions from RosLibJs or Ros Bags and converting binary-form messages to js objects.

<!--{package-dependencies ./package.json}-->

# Use

Converting messages manually.

```js
const ros = new ROSLIB.ROS( { ... } );
const converter = new RosMsgConverter();
await converter.initFromRos( ros );

const topic = new ROSLIB.Topic( {
    ros: ros,
    name: '/tf',
    type: converter.getTopicType( '/tf' ),
    compression: 'cbor-raw',
} );
topic.subscribe( function( raw ) {

    const msg = converter.convertFromTopic( this.name, raw.data );
    // data!

} );
```

Or using a "SmartTopic" that infers the message type, uses cbor-raw compression, and autoconverts the content.

```js
const topic = new SmartTopic( {
    ros: ros,
    converter: converter,
    name: '/tf'
} );
topic.subscribe( msg => {

    // data!

} );
```

<!-- START_AUTOGENERATED_DOCS -->
## RosMsgConverter

Class for tracking ROS Topic, types, and definitions and converting binary "cbor-raw"
representations to javascript objects.

### ready<a name="RosMsgConverter#ready"></a>

```js
ready : Boolean
```


Boolean indicating whether or not the instance has been
initialized and ready to use.


### types<a name="RosMsgConverter#types"></a>

```js
types : Object
```


A map of topic name to the name of the type.


### initFromRos<a name="RosMsgConverter#initFromRos"></a>

```js
initFromRos( handle : ROSLIB.ROS ) : void
```

Initialializes the types asynchronously using a ROSLIB.ROS instance by fetching the
topics and raw message definitions message.

### initFromBags<a name="RosMsgConverter#initFromBags"></a>

```js
initFromBags( handles : ...Bag ) : void
```

Takes a list of initialized rosbag package "Bag" instances to initializes the class with.

### hasType<a name="RosMsgConverter#hasType"></a>

```js
hasType( type : string ) : Boolean
```

Returns whether the converter can handle the given type.

### convertFromType<a name="RosMsgConverter#convertFromType"></a>

```js
convertFromType( type : string, data : ArrayBuffer ) : Object
```

Converts the binary data to a javascript object using the reader of the given type.

### convertFromTopic<a name="RosMsgConverter#convertFromTopic"></a>

```js
convertFromTopic( topic : string, data : ArrayBuffer ) : Object
```

Converts the binary data to a javascript object using the reader of the type of the given topic.

### getTopicType<a name="RosMsgConverter#getTopicType"></a>

```js
getTopicType( topic : string ) : string
```

Returns the type associated with the given topic.

## SmartTopic

An extension of the ROSLIB.Topic that takes a [RosMsgConverter](#RosMsgConverter) in the options
(as the "converter" option), uses "cbor-raw" compression by default, converts the result using
the provided converter, and infers the topic type based on the topic name.

_extends Topic_

### options<a name="SmartTopic#options"></a>

```js
options : null
```




<!-- END_AUTOGENERATED_DOCS -->