I'm trying to bounce a polygon that has both velocity and angular velocity off a (immovable) wall when one of the vertices collides with it. I can detect the collision, and I've worked out how to calculate the inputs and know what outputs I need, but haven't been able to find or work out an implementation for the response. Any help would be greatly appreciated.

	function collisionResponse(
		c, // object center of mass position
		v, // velocity of object
		a, // the angular velocity of the object
		p, // point of contact with line
		n  // normalized normal of line
	) {
		// magic happens..

		result.v = ?? // resulting object velocity
		result.a = ?? // resulting object angular velocity
		return result;
	}