Coding, Java, Murderous Maths, Simon's Own Code

Simon’s changes to Daniel Shiffman’s Spherical Geometry Coding Challenge

Simon talks about his changes to Daniel Shiffman’s Spherical Geometry Coding Challenge: He has rewritten the code in an object oriented manner. Later he also turned the sphere into an ellipsoid using three radii.

Object oriented (Simon’s idea):

Adding colour (Daniel’s feature):

Turning the sphere into ellipsoid (Simon’s idea):

Simon would also like to try this with a cylinder:

DSC_0638

Simon wanted to share his code in a readme in GitHub but he didn’t manage to create one within the specific (Sphere Geometry) project. Here is a screenshot of him sharing the code in Slack chat (for Coding Train fans):

Spherical Geometry sharing in Slack 29 Jun 2017

Coding, Geometry Joys, JavaScript, Murderous Maths, Simon makes gamez

Polar to Cartesian converter (Simon’s own code)

Simon built a Polar to Cartesian converter (Simon’s own code). You can enter the radius in pixels and the angle in degrees, click “convert” and you get the coordinates in x and y and a circle appears n that spot.

You are welcome to play with Simon’s converter online in CodePen at: https://codepen.io/simontiger/pen/MmdodP

Simon is also planning to make a similar converter for Spherical to Cartesian (where you would enter radius, latitude and longitude and convert those into x,y,z).

 

 

Here Simon explains the formulas to convert between Polar and Cartesian coordinates:

 

Coding, JavaScript

Polar Roses in JavaScript

Simon created an engine that uses trigonometrical (polar coordinates) formulas to produce beautiful roses. He reproduced the code originally created by Daniel Shiffman from memory and searched for the formulas on Wikipedia.

You can play with this project here (click on the play button to run): https://alpha.editor.p5js.org/simontiger/sketches/HkU9i2h1b

Coding, Geometry Joys, Java, Murderous Maths

3D Earthquake Data Visualization Coding Challenge

The earthquake data visualization coding challenge by Daniel Shiffman went further than just a 2D map – it went 3D! Simon managed to complete the challenge, except for the very last bit where he was supposed to correct the skewed GPS positions of the earthquake locations on his own (this part was not included in the challenge).

 

 

 

 

 

Coding, Geometry Joys, Milestones, Murderous Maths, Physics

Spherical Geometry Coding Challenge

Simon completed the Spherical Geometry Coding Challenge by Daniel Shiffman! In this challenge, he created a sphere in Processing (Java) using spherical coordinates and triangle strips. Simon had already tried doing this challenge before but back then he got stuck with the triangle strips.

He had to work with converting Polar coordinates to Cartesian, which basically means converting from radius r and angle θ to the x and y, which Java can understand. Simon intervenes to type this:

x = r * cos(θ)

y = r * sin(θ)

Here is Simon explaining Polar to Cartesian conversion to Dad last night:

SOHCAHTOA 14 Mar 2017

The screenshot above come from another video by Daniel Shiffman, explaining Polar to Cartesian conversion.

Here is how Simon built his sphere step by step:

Biology, Coding, Geometry Joys, JavaScript, Milestones, Murderous Maths

Where Botany meets Math and What is Cartesian vs Polar?

Simon did another coding challenge by Daniel Shiffman today, this time a short one called Phyllotaxis. You might be thinking, what in heaven’s name is Phyllotaxis? As it turned out, it’s the place where botany meets math! Phyllotaxis basically describes the arrangement of leaves in a plant, a repeating spiral that can be represented by a fraction describing the angle of windings leaf per leaf.

The numerator and denominator normally consist of a Fibonacci number and its second successor. The most famous example is the sunflower head. This phyllotactic pattern creates an optical effect of criss-crossing spirals. In the botanical literature, these designs are described by the number of counter-clockwise spirals and the number of clockwise spirals. These also turn out to be Fibonacci numbers. In some cases, the numbers appear to be multiples of Fibonacci numbers because the spirals consist of whorls. Phyllotactic patters are also closely related to the golden section in geometry.

The challenge Simon tried out today involved building an animation of a growing phyllotactic pattern.

After we shot the second video Simon corrected himself – he meant converting from Cartesian to Polar and not vice versa as he had said in the video. But what is Cartesian and Polar? And how exactly do you convert between them? We found a graphic explanation on Mathsisfun.com :

cartesian-and-polar-coordinates-1cartesian-and-polar-coordinates-2