Centers vertices around a point.
npm install geo-centervar dragon = require('stanford-dragon/3')
var center = require('geo-center')
dragon.positions = center(dragon.positions, {
center: [0,0,0]
})var center = require('geo-center')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:
centeris the point you want your mesh centered upon. Defaults to[0,0,0].