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.
npm install @share-code/collide-fns
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