We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm interested in coding a bubble, like the kind you blow from soap. Thought of applying some physics to a sphere. It might help if I knew how to code sphere().
Answers
Yeah. I think this is it:
https://github.com/processing/processing/blob/c6d50c0d11df396c430269b88ebb3453f95b72ff/core/src/processing/core/PGraphics.java#L3101
@howhuman --
As the code that @TfGuy44 linked mentions:
Note that this is implemented as two end caps and a bunch of separate rings using TRIANGLE_STRIP. This may or may not be a good model for your soap bubble if you want a mesh defined out of a cloud of points any of which can be equally distorted.
If you are trying to understand how
sphere()
works I recently wrote a test sketch that shows it being constructed from simple to complex resolutions -- it was to test a bug that has since been fixed, but the sketch is still interesting:If you are considering modeling a cloud of points in a sphere-like shape, building a mesh out of them, and them moving them about like a soap bubble, you might also be interested in this recent discussion of different approaches to building spheres out of points: