Get pixel size of an ellipse

I am trying to get the pixel size of an Ellipse entity. I want this information so I can draw a Point entity (which takes pixels for its size) with the same on-screen size in pixels of the Ellipse.

For my usecase, my ellipses are circles, so the major and minor axis are the same.

Well this was way more difficult then I thought. Took inspiration from this post:!msg/cesium-dev/qt7yeItj0cg/GokrqRd5DwAJ

This code creates a point with same screen pixel size as myEllipseEntity:

//compute positions
var ellipsePositions = Cesium.EllipseGeometryLibrary.computeEllipsePositions({
  semiMinorAxis: myEllipseEntity.ellipse.semiMinorAxis.getValue(),
  semiMajorAxis: myEllipseEntity.ellipse.semiMajorAxis.getValue(),
  rotation: 0,
  center: myEllipseEntity.position.getValue(),
  granularity: Cesium.Math.RADIANS_PER_DEGREE
}, false, true);

var positionsArray = Cesium.Cartesian3.unpackArray(ellipsePositions.outerPositions);

//compute bounding sphere
var boundingSphere = Cesium.BoundingSphere.fromPoints(positionsArray);

//compute size of each pixel in meters
var pixelSize =, viewer.scene.drawingBufferWidth, viewer.scene.drawingBufferHeight);

//compute number of pixels that original ellipse appears to be
var sizeInPixels = (2 * boundingSphere.radius) / pixelSize;

var newPoint = t._viewer.entities.add({
point: {
  pixelSize: sizeInPixels,
  color: Cesium.Color.GREEN,
  heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
}); //I set the position later

Thanks for posting your solution here! I think what makes it complicated is just that the bounding sphere is not exposed on the Entity API. This is a private class, but this is how the Viewer accesses bounding spheres for entities: