function testPolygonEllipse(a, polyA, b, ellipseB, response) {
	// Get the position of the circle relative to the polygon.
	const circlePos = T_VECTORS.pop()
		.copy(b.pos)
		.add(b.ancestor.getAbsolutePosition())
		.add(ellipseB.pos)
		.sub(a.pos)
		.add(a.ancestor.getAbsolutePosition())
		.sub(polyA.pos);
	const radius = ellipseB.radius;
	const radius2 = radius * radius;
	const points = polyA.points;
	const edges = polyA.edges;
	const len = edges.length;
	const edge = T_VECTORS.pop();
	const normal = T_VECTORS.pop();
	const point = T_VECTORS.pop();
	let dist = 0;

	// For each edge in the polygon:
	for (let i = 0; i < len; i++) {
		const next = i === len - 1 ? 0 : i + 1;
		const prev = i === 0 ? len - 1 : i - 1;
		let overlap = 0;
		let overlapN = null;

		// Get the edge.
		edge.copy(edges[i]);
		// Calculate the center of the circle relative to the starting point of the edge.
		point.copy(circlePos).sub(points[i]);

		// If the distance between the center of the circle and the point
		// is bigger than the radius, the polygon is definitely not fully in
		// the circle.
		if (response && point.length2() > radius2) {
			response.aInB = false;
		}

		// Calculate which Vornoi region the center of the circle is in.
		let region = vornoiRegion(edge, point);
		let inRegion = true;
		// If it's the left region:
		if (region === LEFT_VORNOI_REGION) {
			let point2 = null;
			if (len > 1) {
				// We need to make sure we're in the RIGHT_VORNOI_REGION of the previous edge.
				edge.copy(edges[prev]);
				// Calculate the center of the circle relative the starting point of the previous edge
				point2 = T_VECTORS.pop().copy(circlePos).sub(points[prev]);
				region = vornoiRegion(edge, point2);
				if (region !== RIGHT_VORNOI_REGION) {
					inRegion = false;
				}
			}

			if (inRegion) {
				// It's in the region we want.  Check if the circle intersects the point.
				dist = point.length();
				if (dist > radius) {
					// No intersection
					T_VECTORS.push(circlePos);
					T_VECTORS.push(edge);
					T_VECTORS.push(normal);
					T_VECTORS.push(point);
					if (point2) {
						T_VECTORS.push(point2);
					}
					return false;
				} else if (response) {
					// It intersects, calculate the overlap.
					response.bInA = false;
					overlapN = point.normalize();
					overlap = radius - dist;
				}
			}

			if (point2) {
				T_VECTORS.push(point2);
			}
			// If it's the right region:
		} else if (region === RIGHT_VORNOI_REGION) {
			if (len > 1) {
				// We need to make sure we're in the left region on the next edge
				edge.copy(edges[next]);
				// Calculate the center of the circle relative to the starting point of the next edge.
				point.copy(circlePos).sub(points[next]);
				region = vornoiRegion(edge, point);
				if (region !== LEFT_VORNOI_REGION) {
					inRegion = false;
				}
			}

			if (inRegion) {
				// It's in the region we want.  Check if the circle intersects the point.
				dist = point.length();
				if (dist > radius) {
					// No intersection
					T_VECTORS.push(circlePos);
					T_VECTORS.push(edge);
					T_VECTORS.push(normal);
					T_VECTORS.push(point);
					return false;
				} else if (response) {
					// It intersects, calculate the overlap.
					response.bInA = false;
					overlapN = point.normalize();
					overlap = radius - dist;
				}
			}
			// Otherwise, it's the middle region:
		} else {
			// Need to check if the circle is intersecting the edge,
			// Get the normal.
			normal.copy(polyA.normals[i]);
			// Find the perpendicular distance between the center of the
			// circle and the edge.
			dist = point.dot(normal);
			const distAbs = Math.abs(dist);
			// If the circle is on the outside of the edge, there is no intersection.
			if ((len === 1 || dist > 0) && distAbs > radius) {
				// No intersection
				T_VECTORS.push(circlePos);
				T_VECTORS.push(edge);
				T_VECTORS.push(normal);
				T_VECTORS.push(point);
				return false;
			} else if (response) {
				// It intersects, calculate the overlap.
				overlapN = normal;
				overlap = radius - dist;
				// If the center of the circle is on the outside of the edge, or part of the
				// circle is on the outside, the circle is not fully inside the polygon.
				if (dist >= 0 || overlap < 2 * radius) {
					response.bInA = false;
				}
			}
		}

		// If this is the smallest overlap we've seen, keep it.
		// (overlapN may be null if the circle was in the wrong Vornoi region).
		if (
			overlapN &&
			response &&
			Math.abs(overlap) < Math.abs(response.overlap)
		) {
			response.overlap = overlap;
			response.overlapN.copy(overlapN);
		}
	}

	// Calculate the final overlap vector - based on the smallest overlap.
	if (response) {
		response.a = a;
		response.b = b;
		response.overlapV.copy(response.overlapN).scale(response.overlap);
	}
	T_VECTORS.push(circlePos);
	T_VECTORS.push(edge);
	T_VECTORS.push(normal);
	T_VECTORS.push(point);
	return true;
}
Check if a polygon and an ellipse collide.
@ignore
@param {Renderable|Container|Entity|Sprite|NineSliceSprite} a - a reference to the object A.
@param {Polygon} polyA - a reference to the object A Polygon to be tested
@param {Renderable|Container|Entity|Sprite|NineSliceSprite} b - a reference to the object B.
@param {Ellipse} ellipseB - a reference to the object B Ellipse to be tested
@param {Response=} response - Response object (optional) that will be populated if they intersect.
@returns {boolean} true if they intersect, false if they don't.