Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Wednesday, 17 December 2008

Putting a new tilt on it

Right from the start I wanted my Saucer shape to be fully capable In order to do rotations I have translated the vertices's of my saucer from Cartesian coordinates to polar coordinates (you can use a spreadsheet to to this, what you need is the atan2 function which takes x and y values separately (this gives you the both positive and negative radian values (-π to +π, however processing uses 0 to 2π so you need to adjust your angles accordingly). To calculate the radius just use Pythagoras's theorem radius = √(x2 + y2)
To see my lovely tilting Saucers:
checkout my chunk 68 blog

Update 6 January, I recently came across a PVector class which I think is a relatively recent addition to the processing language? The PVector class can be used to store both 2D and 3D vectors, but also has some interesting functions. There's a static method that takes two vectors and returns the angle between them, you can also manipulate the PVectors in other interesting ways which should be useful in animation (probably worthy of inclusion in the book, I don't think Greenberg mentions it).
However decided my next move on the animation front would be tilt my saucer in the direction of travel according to its velocity in the x direction see refactored processing applet. The trick is to store the position of the previous saucer instance, the difference between that and current position gives you the velocity (for effect and convenience I only worry about velocity in the x dimension).

Thursday, 11 December 2008

Incorporating Images

I am getting a bit more positive about the processing environment. However it took some experimentation in the netbeans environment before I realized that I could also ship the bulk of the logic into the Saucer class in the processing mode. Aesthetically things are also improving a bit now I've incorporated an image into my applet (something I composed using gimp the gnu/linux answer to adobes photoshop (links to my animation at my website).

Code now available at website...

Friday, 5 December 2008

Anomalous Results With 3D

Ben aka 'Lazydog' has produced a fine opengl example, that will run on my Ubuntu 8.10 linux box, but not on my gentoo box (same pc multiple boot yes I know I'm mad!!!). Anyway further experimentation with library examples of opengl has produced the following interesting results, when I experimented with substituting P3D for OPENGL on said gentoo linux box.








ExampleOPENGLP3D
LightsGLBlack ScreenIt Works
YellowTailBlack ScreenIt Works
ExtrusionGLWhite ScreenIt Works
EsferaBlack ScreenIt Works
SpaceJunkBlack ScreenIt Works
TexturedSphereBlack ScreenIt Works
Complex3DBlack ScreenIt Works

P3D is software emulated whereas OPENGL requires access to hardware, I'm still stumped as to why examples don't work on gentoo (glxgears runs and glxinfo looks the same on both Ubuntu and gentoo).
Well the result is I've tried pretty hard to get jogl to work on gentoo linux but to no avail, so what I've done is ditch the gcj implementation on Ubuntu and install their java sun version (you have to manually install the Firefox plugin but apart from that it was a pretty painless conversion. Now I'm happy I thought I might have to use Windows-XP for 3D stuff, now the only reason to use Windows is for the DRM stuff like BBC IPlayer or to use ITunes. The IPlayer always crashes for me after a download which needs a reboot to watch the program. The funny thing is that unless you want to get 3D to work on java, pretty much everything else has been sorted on linux, so why aren't more people choosing linux? Also why do so many windows installs insist on a reboot the only reason to reboot on linux is to change the kernel.

Update June 2009 Gentoo have now deprecated their java-config files so I've unmerged them and lo and behold OPENGL works fine and and dandy on gentoo to (probably a bit quicker than on ubuntu thanks to optimisation from custom compile.

Monday, 1 December 2008

Processing Applets can be Implemented using Javascript

Yes you don't even need a jvm to get your applet to run in a web browser, see my example here. To find out all about it, click on the processing.js heading... That takes you to the 'processing.js' authors (John Resig) website.
You can get the required enabling javascript code here http://github.com/jeresig/processing-js/tree/master the code comes bundled with many examples from the processing website.

A requirement for this script to work is support for the once controversial html element <canvas>, which is proprietary to Apple who have agreed to release it, should it become a web standard (this is scheduled for html 5). It is probably also controversial as in some ways it could be seen as replacement for SVG, and lacks namespace. I have now modified my web page to alert non-canvas enable browsers, I have just checked in Google Chrome it displays both image and my alert, IE8 just displays the alert...(revision as of 23 December 2008). However only firefox 3.0+ can display the text, haven't tried safari or opera (w3m correctly displays alt information).

Conclusion best viewed in Firefox 3 (works on earlier versions eg Firefox 2.0.0.18 except for text display).
Update 23 Feb 2009 just found this interesting link to a talk given by John Resig http://www.slideshare.net/jeresig/building-a-visualization-language-presentation

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2