top of page

Recursive Graphics: 

Inspiration from Islamic Geometry

& Malaysian Sonket

The main objective of this project was to utilize a recursive function in Java to create "art". The recursive function would draw a simple pattern repeatedly, with each step drawing a additional pattern. I can barely use my fingers to sketch, but since I think I'm a little more proficient with my fingers on a keyboard, I decided to try to dig a little deeper.

Memories From Home

Whilst I was in high school (Victoria Inst. KL), I frequented a mosque almost every day on the way home from class. This was Al-Bukhary Mosque on Jalan Hang Tuah, KL. I recall in the long hours on Fridays whilst listening to sermons (of which I hope improved over time, a topic for another time!)  I would stare into the abyss of the complex geometry that made up the mosque. One repeating pattern I constantly noticed through my frequent visits was the 8-pointed star.

Masjid Shah Alam.jpg

Tiles showcasing an 8-pointed star on the bottom floor of a mosque in Shah Alam. Source.

A photo taken by Osmon M. from Foursquare at Al-Bukhary Mosque


8 pointed stars on the floormats at Al-Bukhary Mosque. Taken by Abu Ahmad. from Foursquare 


Screen Shot 2019-03-16 at 4.52.29 PM.png


Screen Shot 2019-03-16 at 4.52.38 PM.png


Screen Shot 2019-03-16 at 4.52.59 PM.png


Screen Shot 2019-03-16 at 4.53.40 PM.png


Screen Shot 2019-03-16 at 4.53.24 PM.png


Screen Shot 2019-03-16 at 4.53.11 PM.png


Screen Shot 2019-03-16 at 4.54.13 PM.png


Screen Shot 2019-03-16 at 7.03.21 PM.png



I created a simple 8 pointed star function, with an outline and an underlying box which I coded in Yellow (255, 153, 51). The purpose of the yellow underlying boxes was to create a larger center focus in iterations 7 and 8, with hints of yellow peering through the patterns. 

The iterations would spawn on all four sides of the squares of the previous iteration, and would be 1.75 smaller than previous (this number enabled the entire pattern to be contained in the square canvas).


Green was a very calming color, favored in Islam that I wanted to incorporate into the design. I wanted the colors to converge to a darker green. Since the RGB scale only allowed colors up to 255 in RGB, I programed a exponential function with G from the RGB spectrum. Colors began at a (165, 205, 155) combination.

With every itteration, I added a step 45 to an exponential function I created for each RGB spectrum, with a higher emphisis placed on the Green specturm as shown below.

Screen Shot 2019-03-16 at 7.14.28 PM.png

With ever iteration, the G-component of the RGB spectrum moved closer to 0. It decreased exponentially as x grew, but never touched 0 due to RGB's color spectrum limits at 255 and 0. I repeated the same with the other colors, but with less intensity until the gradual green I desired was present.

Sonket Motif

I must admit, this was not an intended consqeunce, but after 8 repititions, the resulting pattern was reminicent of the sonket sampin used in traditional dresses in Malaysia as shown below. The exact pattern might not match, but it's usage of repeating geometry and similar color was emulated in the sampin's style. Somehow, a road from one home led me back to another!​ Hope you enjoyed! Cheers!​


A Malaysian Sampin from the Sonket Fabric, a commonly used textile in Malaysia known for it's complex designs. Source.

bottom of page