1.0.0 • Published 5 years ago
jonlo-threejs-utils v1.0.0
jonlo-threejs-utils
Contains utils to work with threejs.
- Transform
- Scene
- Cartesian coordinate
Installation
npm install jonlo-threejs-utils
Functions
Classes
Functions
SceneUtils
Scene utils
Kind: global class
center()
centers the camera over all the scene3d objects
Kind: global function Example
SceneUtils.center(scene, camera, controls, 0, 1, 1);
Classes
Functions
TransformUtils
Transform utils
Kind: global class
rotateObject3dOnAxis(Object3d, Vector3, Number)
Rotates a Ojbect3d over a given axis
Kind: global function
Param | Description |
---|---|
Object3d | object3d |
Vector3 | axis |
Number | radians |
Example
TransformUtils.rotateObject3dOnAxis(object3d, new Vector3(1, 0, 0), Math.degToRad(90))
rotateObject3dAroundPivotOnAxis(Object3d, Matrix4, Vector3, Number)
Rotates a Ojbect3d around a pivot matrix over a given axis
Kind: global function
Param | Description |
---|---|
Object3d | object3d |
Matrix4 | pivotMatrix |
Vector3 | axis |
Number | radians |
Example
TransformUtils.rotateObject3dAroundPivotOnAxis(object3d, pivotMatrix, new Vector3(1, 0, 0), Math.degToRad(90))
createPivotMatrix(Vector3, Quaternion, Vector3)
Creates a pivot matrix
Kind: global function
Param | Description |
---|---|
Vector3 | position |
Quaternion | rotation |
Vector3 | scale |
Example
TransformUtils.createPivotMatrix(position, rotation, scale)
Classes
Functions
CartesianCoordinatesUtils
Cartesian coordinates utils
Kind: global class
getPointInBetweenByPerc(Vector3, Vector3, Number)
Get the point between two points given a percentage distance
Kind: global function
Param | Description |
---|---|
Vector3 | startPoint |
Vector3 | endPoint |
Number | percentage |
Example
CartesianCoordinatesUtils.getPointInBetweenByPerc(new Vector3(1,0,0),new Vector3(2,0,0),50)
getDirBetweenPoints(Vector3, Vector3)
Get the direction vector b etween two points
Kind: global function
Param | Description |
---|---|
Vector3 | startPoint |
Vector3 | endPoint |
Example
CartesianCoordinatesUtils.getDirBetweenPoints(new Vector3(1,0,0),new Vector3(2,0,0))
angleBetweenVectors(Vector3, Vector3)
Get the angle between two vectors
Kind: global function
Param | Description |
---|---|
Vector3 | v2 |
Vector3 | v1 |
Example
CartesianCoordinatesUtils.angleBetweenVectors(new Vector3(1,0,0),new Vector3(2,0,0))
1.0.0
5 years ago