How can I change radius in CircleGeometry

I have draw a lot of circle ,but I can not set a new radius to change it

let id= primitive.geometryInstances[j].id;
let attributes=primitive.getGeometryInstanceAttributes(id);
attributes.boundingSphere.radius=newRadius;

but it didn’t work

Hi @Mirror-Yu,

Modifying the boundingSphere is probably not what you want to do. The bounding sphere only identifies where the shape is located, but does not control the shape itself.

A CircleGeometry is an EllipseGeometry under the hood, so it’s possible you might have to modify the semiMinorAxis and semiMajorAxis. Here is a Sandcastle example demonstrating how to change the radius after the circle is already constructed.

My example was constructing the circles using the Entity API. How are you constructing your circles? Can you share a working code example as a Sandcastle link?

Hi @jjhembd,

Thank you for your reply.
I have draw a lot of circle,and when I click the button I want to set a new radius to change it, but it didn’t work.

Here is a Sandcastle example.

Hi @Mirror-Yu, can you explain why you want to change the radius? Then I might be able to suggest a better solution.

Your example is using the Primitive API, which is fast but harder to work with. If you want the circles to change dynamically, the Entity API would be easier. See my Sandcastle example.

Have you already tried using Entities?

Hi, @jjhembd ,

Thank you for your reply.

I get the data and use the circle to render it on the map.Then I can modify it radius with a slider.The data maybe have about 1,000 circles,so I used Primitive API.

I have tried using Entities and it worked,But when I set a new radius to change it, the browser gets stuck.

Thanks again for your reply.

Thanks for the clarification @Mirror-Yu!

Have you considered PointPrimitives? These render as circles, and you can quickly change the pixelSize property on the fly.

I tried rendering 2,000 circles as a PointPrimitiveCollection. On my computer, the slider for the circle radius responds quickly. See this Sandcastle link.

Hi @jjhembd ,

Thank you very much for your reply.
I have tried using PointPrimitives and it worked,But one problem is that it can’t be measured in meters.Because my slider is in meters.

Can you give me some advice.