///
///
///
///
///
/**
*
* @param {circle} pCircle
* @param {line2} pLine
*/
function lineCircleCollision2(pCircle, pLine) {
return distanceFromPoint2ToLine2(pCircle.position, pLine) <= pCircle.radius;
}
function getLineCircleCollison2Data(pCircle, pLine) {
const lCollisionNormal = pLine.normal,
lCollisionPoint = addVec2(pCircle.position, scaleVec2(negate2(lCollisionNormal), pCircle.radius));
return {
relativeVelocity: subVec2(pCircle.velocity, pLine.velocity),
collisionNormal: lCollisionNormal,
firstPointOfApplication: subVec2(lCollisionPoint, pCircle.position),
secondPointOfApplication: subVec2(lCollisionPoint, pLine.start)
}
}