1.0.0 • Published 3 years ago

@share-code/collide-fns v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

npm.io npm.io npm.io npm.io npm.io

collide-fns

to check collision detection, I chose to use SAT (Separating Axis Theorem)

according to wikipedia, the SAT (separating axis theorem) can be applied for fast collision detection between polygon meshes. Each face's normal or other feature direction is used as a separating axis. Note that this yields possible separating axes, not separating lines/planes.

Install

npm install @share-code/collide-fns

Functions

isCollide

check the two objects are collided. it's pretty obvious but each vertexes should have more than 3 vertex.

interface Vertex {
  x: number
  y: number
}

isCollide = (aVertexes: Vertex[], bVertexes: Vertex[]) => boolean

License

MIT