# Conversion of Cesium.Shapes.computeCircleBoundary to b29 methodology help

I am unable to migrate a call to Cesium.Shapes.computeCircleBoundary to get boundary points on a circle using the CircleOutlineGeometry (b29).

Objective: To get N distinct points R radians/D Degrees offset from each other, e.g 4 points on a circle boundary 90 degrees offset from each other. The same applies for points on an ellipse only the points might be at the semi-minor/major/ellipse boundaries.

Previously I would call;

Cesium.Shapes.computeCircleBoundary(Cesium.Ellipsoid.WGS84, circleCenterCartesian3.toString(), 250000.0, Math.PI / 2); to get points on the boundary of the circle.

like the following; (first 4 are relevant)
(-936293.5084711357, -3593004.369638257, 5174692.046762386),
(258063.45731426653, -4909440.063214418, 4049020.280361031),
(-1426866.9084858585, -5475568.28141778, 2923348.513959676),
(-2621223.874271261, -4159132.587841621, 4049020.280361031),
(-936293.5084711361, -3593004.369638257, 5174692.046762386),
(-936293.5084711357, -3593004.369638257, 5174692.046762386)

Using the suggestion in the b29 Changes.md; I think I need to use CircleOutlineGeometry. However, doing that I am unable to get a 'nice' set of x,y,z positions as in the above example. In fact I don't really get useable positions at all as they seem to be duplicates of each other

So far I have;
var circle = new Cesium.CircleOutlineGeometry({
center : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
granularity : Math.PI / 2
});
var geometry = Cesium.CircleOutlineGeometry.createGeometry(circle);

var float64ArrayPositions = geometry.attributes.position.values;
var positions = .slice.call(float64ArrayPositions);

1119258.861737524,-4760551.0964473635,4080785.815404867,
1312965.665401136,-4710807.606232919,4080785.8154048678

If I use Math.PI / 3 and so on, I just seem to get more useless points.

Also, as I flattening the positions values using slice, I no longer have an array of 3d positions which I can then use in say Polyline.positions or something but am unsure how to get those from a float64 array.

Any help would be appreciated.
Thanks.

Hi,

Looks like using a 90 degree granularity produces an incorrect circle. I submitted #1823. In the meantime, changing to Math.PI / 4 produces usable points (see the screenshot in the issue).

As for interoping with Polyline and PolylineCollection, I suggest instead using the generic Primitive. See the Sandcastle examples with the Geometries label.

Patrick

Hi,

I closed the issue that Patrick submitted. The granularity used in Shapes.computeCircleBoundary was used to increment the angle of the ellipse. When it was redone, the granularity was the arc length of the ellipse which is consistent with the other geometries and it is also used for the distance between the interior points. So setting the granularity to 90 degrees is 90 degrees on the surface of the earth, which is too large for an ellipse with that radius.

Dan