Skip to content

jonlo/threejs-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jonlo-threejs-utils

Contains utils to work with threejs.

  • Transform
  • Scene
  • Cartesian coordinate

Installation

npm install jonlo-threejs-utils

Functions

Classes

SceneUtils

Scene utils

Functions

center()

centers the camera over all the scene3d objects

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

TransformUtils

Transform utils

Functions

rotateObject3dOnAxis(Object3d, Vector3, Number)

Rotates a Ojbect3d over a given axis

rotateObject3dAroundPivotOnAxis(Object3d, Matrix4, Vector3, Number)

Rotates a Ojbect3d around a pivot matrix over a given axis

createPivotMatrix(Vector3, Quaternion, Vector3)

Creates a pivot matrix

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

CartesianCoordinatesUtils

Cartesian coordinates utils

Functions

getPointInBetweenByPerc(Vector3, Vector3, Number)

Get the point between two points given a percentage distance

getDirBetweenPoints(Vector3, Vector3)

Get the direction vector b etween two points

angleBetweenVectors(Vector3, Vector3)

Get the angle between two vectors

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))

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published