I was fighting this a bit with while using Tiled and figured I'd throw up what I landed on here. In Tiled it's just a width/height with the ellipse flag toggled so this works for that.
static std::vector<std::pair<float, float>> ellipsePoints(const float ¢erX, const float ¢erY,
const float &horizontalRadius, const float &verticalRadius) {
// Box2d only lets us have a max of 8.
static constexpr size_t MAX_SEGMENTS = 8;
std::vector<std::pair<float, float>> points;
for (size_t i = 0; i < MAX_SEGMENTS; i++) {
float theta = 2.0f * M_PI * i / MAX_SEGMENTS;
float x = centerX + horizontalRadius * cosf(theta);
float y = centerY + verticalRadius * sinf(theta);
points.emplace_back(x, y);
}
return points;
};