flatten-vertex-data

WebJar for flatten-vertex-data

License

License

MIT
Categories

Categories

JavaScript Languages Data
GroupId

GroupId

org.webjars.bowergithub.glo-js
ArtifactId

ArtifactId

flatten-vertex-data
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

flatten-vertex-data
WebJar for flatten-vertex-data
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/glo-js/flatten-vertex-data

Download flatten-vertex-data

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.glo-js/flatten-vertex-data/ -->
<dependency>
    <groupId>org.webjars.bowergithub.glo-js</groupId>
    <artifactId>flatten-vertex-data</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.glo-js/flatten-vertex-data/
implementation 'org.webjars.bowergithub.glo-js:flatten-vertex-data:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.glo-js/flatten-vertex-data/
implementation ("org.webjars.bowergithub.glo-js:flatten-vertex-data:1.0.2")
'org.webjars.bowergithub.glo-js:flatten-vertex-data:jar:1.0.2'
<dependency org="org.webjars.bowergithub.glo-js" name="flatten-vertex-data" rev="1.0.2">
  <artifact name="flatten-vertex-data" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.glo-js', module='flatten-vertex-data', version='1.0.2')
)
libraryDependencies += "org.webjars.bowergithub.glo-js" % "flatten-vertex-data" % "1.0.2"
[org.webjars.bowergithub.glo-js/flatten-vertex-data "1.0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bowergithub.shama : dtype jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

flatten-vertex-data

stable

Copies flat or nested array data into the specified typed array, or a new typed array. Intended to be used for WebGL buffers. If the input is nested array data, this guesses the dimensionality based on the length of the first sub-array.

Install

npm install flatten-vertex-data --save

Example

Accepts a dtype string (creating a new array) or an output typed array to re-use. Defaults to creating a new Float32Array.

var flatten = require('flatten-vertex-data')

var positions = [ [x1, y1], [x2, y2], [x3, y3] ]

flatten(positions)
//=> new Float32Array([ x1, y1, x2, y2, x3, y3 ])

flatten(positions, 'uint16')
//=> new Uint16Array([ x1, y1, x2, y2, x3, y3 ])

// flatten & copy positions into output
var output = new Uint16Array(positions.length * 2)
flatten(positions, output)

Usage

NPM

output = flatten(data, [output|type], [offset])

Copies flat or nested arrays into a typed array, where data can be:

  • a nested array like [ [ x, y ], [ x, y ] ]
  • a flat array like [ x, y, z, x, y, z ]
  • a typed array like new Float32Array([ x, y ])

The second parameter can be a type string for dtype, which creates a new array. Or, it can be an existing typed array to re-use as the output destination. It defaults to 'float32' (a new Float32Array).

Returns the output typed array.

The third parameter, offset, can be a number (default 0), the index in the destination array at which to start copying the data. If a new array is being created, its capacity will be expanded to fit dataLength + offset (i.e. it will have leading zeros).

License

MIT, see LICENSE.md for details.

org.webjars.bowergithub.glo-js

glo

Versions

Version
1.0.2