Will Price Posts About

Learning Processing: Chapter 1


I've picked up another book to delve into, I've always wanted to learn to program, 'Processing' seemed the logical choice Arduino (the programming language) is based on processing so I shall get a better understanding of syntax and how programs are written including the logic behind how they are structured (I've always been fascinated by this), thus giving me a step up when I go back to microcontrollers (after finishing this & Make: Electronics).

The book is called "Learning Processing" by Daniel Shiffman

A few things drew me to this book, I like how it really takes you from not knowing a thing about programming, to a decent foundation. I think it is very important to learn the theory so when it comes to learning different languages you still have a thorough understanding of the paradigm but you only have to pick up the new aspects of the language.

Processing is a language based on visual interaction vs text-based interaction. A program is written with text, displayed using visual then can be interacted with via mouse clicks (amongst other devices). Text-based languages operate by being written in text, producing text and then being interacted with by more text. Enough rambling, onto the first chapter...

CHAPTER 1: Pixels
This chapter focuses on 'Pixels', it describes how to draw some basic euclidean shapes (e.g. lines, circles and triangles etc), colour theory (grayscale, RGB, transparency) - that's about it. The book introduces different exercises to have a bash at to make sure you understand and can implement the theory - I personally find this the strong point on the book so far (Yes, I am only on chapter 2 at the moment!)

I've learnt that the grid the computer draws is different to the "Cartesian coordinate system" (The one you use in mathematics at school). The x-axis is drawn from left to right (lower -> higher value. This is the same as in the 'normal' graph system) however the y-axis is drawn from top to bottom, as you go down the y-value increases (not negatively).
I also have learnt how to draw - Rectangles, ellipses, triangles, lines and points, I know how to change line thickness, set the outline to be a different colour, set the inside to be a different colour etc. I don't quite understand how the colour mixing RGB system works yet, the mixing works like mixing lights; I've never really understood how that works thus I will check out a few tuts later on this week on the subject.

At the end of the chapter you have to draw your own 'character' in processing, mine is fairly appalling compared to Shiffman's but it is original and I feel proud to have accomplished something.

I tried to upload the code to openprocessing but it isn't displaying - not too sure why..
Here is the code.