Skip to content

jingwood/js-graphics-math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm

js-graphics-math

Math library for JavaScript 2D/3D graphics rendering.

Classes

The following classes available under src folder.

Functions

Functions below available at src/functions.js.

Base math functions

  • clamp (1D/2D/3D)
  • smoothstep
  • angleToArc

Distance measuring

  • distancePointToPoint (2D/3D)
  • distancePointToLine (2D)
  • distancePointToLineSegment (2D)
  • distancePointToRect (2D)
  • distancePointToPolygon (2D)
  • findNearestPointToLineSegement (2D)
  • findNearestPointToPolygon (2D)

Intersecting test

  • lineIntersectsLine (2D)
  • lineIntersectsRect (2D)
  • lineIntersectsPolygon (2D)
  • rectIntersectsRect (2D)
  • rectIntersectsPolygon (2D)
  • checkLineParallel

Containing test

  • rectContainsPoint (2D)
  • triangleContainsPoint (2D)
  • polygonContainsPoint (2D)
  • polygonContainsRect (2D)
  • calcPolygonArea (2D)

Ray test

  • rayIntersectsPlane (3D)
  • rayIntersectsTriangle (3D)
  • rayIntersectsSphere (3D)
  • rayIntersectsBox (3D)

Vertex interpolation

  • calcVertexInterpolation (3D) Calculate the interpolated vertex coordinate on a specified point of a 3D triangle with vertex coordinates.

Software uses this library

Related Libraries

License

Released under MIT License.

Copyright (C) Jingwood & unvell.com, all rights reserved.