Socket
Book a DemoInstallSign in
Socket

geo-center

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geo-center

Centers vertices around a point.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

geo-center

Centers vertices around a point.

Demo

Install

npm install geo-center

Example

var dragon = require('stanford-dragon/3')
var center = require('geo-center')

dragon.positions = center(dragon.positions, {
  center: [0,0,0]
})

API

var center = require('geo-center')

var centeredPositions = center(positions, opts)

Returns a copy of positions centered around opts.center.

positions is the vertex array for your mesh. It can be any of:

  • Flat array [1,2,3,4,5,6]
  • Array of arrays [[1,2,3], [4,5,6]]
  • TypedArray new Float32Array([1,2,3,4,5,6])
  • Array of TypedArrays [new Float32Array([1,2,3]), new Float32Array([4,5,6])]
  • ndarray ndarray(new Float32Array([1,2,3,4,5,6]))

opts is an object that can have the following properties:

  • center is the point you want your mesh centered upon. Defaults to [0,0,0].

Keywords

stackgl

FAQs

Package last updated on 31 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts