Coding Challenge #25: Spherical Geometry
In this coding challenge, I create a sphere in Processing using spherical coordinates and triangle strips. This is the 3rd part of a multi-part series on superformulas, superellipses and supershapes. Code: https://thecodingtrain.com/challenges/25-spherical-geometry
πΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/qVs1hxtc
π₯ Previous video: https://youtu.be/BjoM9oKOAKY?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Next video: https://youtu.be/akM4wMZIBWg?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
π Supershapes (Superformula): http://paulbourke.net/geometry/supershape/
π₯ 3D Supershapes: http://www.syedrezaali.com/3d-supershapes/
π Spherical Coordinates System on Wikipedia: https://en.wikipedia.org/wiki/Spherical_coordinate_system
π₯ Peasycam: http://mrfeinberg.com/peasycam/
Videos:
π₯ My Video on Polar Coordinates: https://youtu.be/O5wjXoFrau4
π₯ Supershape track: https://thecodingtrain.com/tracks/supershapes
π΄ Livestream Archive: https://youtu.be/m8WhMeW8jj0
Related Coding Challenges:
π #19 Superellipse: https://youtu.be/z86cx2A4_3E
π #23 2D Supershapes: https://youtu.be/ksRoh-10lak
π #26 3D Supershapes: https://youtu.be/akM4wMZIBWg
π #112 3D Rendering with Rotation and Projection: https://youtu.be/p4Iz0XJY-Qk
Timestamps:
0:00 Introduction to the Coding Challenge
0:43 The 3D Processing primitive sphere()
1:48 Triangle strips
2:55 Latitude and longitude
4:11 Angle of rotation
5:53 The resolution of the sphere
7:20 Map the latitude and longitude to the points on the sphere
11:33 Add a PeasyCam object
13:28 Meshing the sphere
14:53 Add a 2D array to store the vertices
17:28 Add triangle strips
19:57 Adjust code to fix the gaps
21:00 Alternate colors to add strips
22:19 Add HSB mode to add rainbow colors
23:37 Add some randomness to animate a "jiggling" sphere
24:55 Bonus addendum: updated rainbow bands
26:30 Thanks for watching!
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
π Website: http://thecodingtrain.com/
πΎ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
π© Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
π‘ GitHub: https://github.com/CodingTrain
π¬ Discord: https://discord.gg/hPuGy2g
π Membership: http://youtube.com/thecodingtrain/join
π Store: https://standard.tv/codingtrain
ποΈ Twitter: https://twitter.com/thecodingtrain
πΈ Instagram: https://www.instagram.com/the.coding.train/
π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π p5.js: https://p5js.org
π p5.js Web Editor: https://editor.p5js.org/
π Processing: https://processing.org
π Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new
#3dsupershape #sphericalgeometry #polarcoordinates #trianglestrips #3d #processing