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
	) {
		//  Make a vector from center mass to contact point
		cp = p - c;

		//  Total velocity at contact point (add angular effect)
		pv.x = v.x - cp.y * a;
		pv.y = v.y + cp.x * a;

		//  Reflect point of contact velocity off the line (wall)
		rv = reflect( pv, n );

		// magic happens..

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