Transitioning to Java

My programming is coming along slowly, but steadily.  I’m probably going to have to break out of Processing and go to full scale Java at some point.  Mostly it’s been a recalibration of my thoughts.  No overloaded operators, everything has taken a step back and focuses on pointers rather than having to asterisk your way out to it.  My main source of frustration has been vector mathematics.

For the sake of this example let’s take two vectors v1 and v2. In C,  you could write operators such as += or + to either increment one by the other,  or return a combination of the two. but in Processing – with the PVector class,, calling v1.add(v2) is equivalent to the C-style v1 += v2, rather than v1+v2 as I was expecting.  There’s no difference in my mind between the symbol ‘+’ and the words “add”, “plus”,  “sum”, etc. To get it to return a vector, you have to call PVector.add(v1,v2) – when you’re a little rusty to begin with, the weird blend of prefix and infix notation is a little screwy.

Hopefully my improved understanding of the syntax will let me finish rewriting some collision detection code.

Advertisements
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Obvious Grog
Archives
%d bloggers like this: