Creating deformed sphere

In metal sphere is created with this code
let sphereMesh = MDLMesh(
sphereWithExtent: [0.4, 0.4, 0.4],
segments: [10, 10],
inwardNormals: false,
geometryType: .triangles,
allocator: allocator)

How do I create a sphere that radius is different various location?


@hcrogman Thanks very much for your question.

I am not sure I understand what you’re asking. Do you want to create a sphere whose radius changes depending on the location? Could you please elaborate?

Normal sphere is base H=A J^2 where J^2= (Jx^2+Jy^2+Jz^2)
Jx=J cos(phi) sin(theta), Jy=J sin(phi)*sin(theta), Jx=J cos(theta)

However H= A(Jx)^2+ B(Jy)^2+ c(Jz)^2. This is a sphere only when A=B=C

This topic was automatically closed after 166 days. New replies are no longer allowed.