Saturday, August 16, 2008

augusst 13 notes

August 13 notes


Think of loading data as columns (with headers) into objects. Put those object names into classes. function has set of inputs with set of outputs. Object describes a broad range of attributes and then function inside the class (called a method) that uses the attributes to do something.

sometimes first row has names for the columns. You can start at row 2 to use the data without the column heads. Attributes would be the column heads. Jason could have called his class Player because it is the thing that draws the players.

splitToken takes a string chops up into pieces based on a character. Jason’s table has both tab separated and tab separated columns. How did he solve that? splitToken can separate by more than one data type. WHITESPACE in his code made any number of spacebar spaces as space.

His object “Player” creates a lot of variables. His array fills the objects with data. The dot in the


Class Dog }
int length;
int color;
String breed;
}

Dog fido = new Dog(13, 0x00ff00, “terrier”);
int myLenght = fido.length //the dot is important because it pulls up the attributes.

records[totalRebounds].TR ...


Jason used variable int startingEntry = 0;
It increments each time you press the mouse. Use variable instead of number because it’s hard to understand without a name or because it has to …

Jason’s code is literal. Doesn’t look at minimum and maximum. Can not iterate through a set of data and adjust through …

With delicate variables audio signal or particle need to calibrate the data can use library from noisepages.com that has onscreen sliders for calibrating data ranges to calibrate the ranges to get number feed back and use those numbers in the code.

Look for prototyping article on Peter’s site. There is article for prototyping application to work out what to do with lighting based on the sound. Crosses and numbers in video are only used in the calibration but turned off for the performance.

For centering the text need to find the length of the string and then center that.
Processinghacks.com for good cheats and tricks for processing




Fonts are lame in processing and everybody knows it. There are workarounds but none of them really work very well.

Vertext by Michael Chang was a library for creating type as shapes in processing but it is now gone from the link on the processing site.

Now use NextText library

Geomerative also does font importing. Look at examples. They interpreted the geometry data embedded in the font file. Has its own set of classes dealing with shapes


Scott mapped his itunes library into 3d space with dots.

ProXML undocumented but he used it to import his data. Now he can design the space and can creates all disks and each time it draws it moves them toward the x y coordinates that they are going to. Used easing to get it to move naturally.


x += (destx - x) * easing;
y += (destx - y) * easing;
z += (destx - z) * easing;


to make sphere use photoshop sprite and use pointSprite in openGL (extention maybe 2.0) image command in processing creates a rectangle and pasts an image on that rectangle. Point spirtes make the rectangle a point and positions the sprite to that. Only works with high end processors.

Could brute force figure where the camera is and always face the disk toward the camera.

Can use a spacing algorithm for layout to position things on the screen.



Array out of bounds error will always be [] index number. To troubleshoot look for the place where the problem is and work backward to find the broken part.

For array with 4 elements. Programming counts from 0. if you do length array.lenght
Object.attribute

Array has 4 items in it but it counts them.

To turn into index number need to do something.
In this case it is array.length-1

Set of classes exist
Arrays in processing work because of how they work in java. Packages called java.util in java has set of utility classes including data structures. It changes. Processing can use up to / including java 5. java numbers don’t go sequentially. Java 1, 1.1 1.2, 1.3, 1.4 (same as 2), 5, 6, 7se, openTDK. Is backwards compatible language. Processing targeted 1.3 and 1.4 as targer language. Any mac guaranteed to have 1.4. good compatible version.

.0143 supports jave 5 but not after those. Not stable yet. But can use 1.4 and 5 syntax and most libraries are built on version 1.4, which is java 2.1.4 does most of the things that people need. Almost nothing you need in 5, 6, or 7.
Code from java books should easily drop into processing and work. Processing compiles the language.

Java compiles code for the processor for the virtual machine that can run anywhere. Has to be compiled but processing does it.

Processing goes through an interpreter then compiler. It interprets all the drawing commands into java code then compiles.

How to get xml files online

proXML
simpleML

swivel.com is good for data

check the.echonest.com for music visualization api’s.

here is a video made by a mad hacker that is 4k in size.

How to do:
Peter showed particle animation using gradient fills. Not designed to always face front. How to do it?

Need open gl import to do this thing. Need to be able to talk to openGL so make a n obkect PGraphicsOpenGL


Here are the things you need to get to make openGL work for

import javax.media.opengl.*
import processing.opengl.*;

PGraphicsOpenGL pg1;
GL gl;

void setup() {
size (1024,768,OPENGL);
}

void draw()
{
pgl = (PGraphicsOpenGL) g;
gl = pgl.begin();


//makes blending based on alpha values
gl.glDisable(GL.GL_DEPTH_TEST); // don't know why works - disables depth test fixes glitch
gl.glEnable(GL.GL_BLEND); //makes the blend
gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE); //chooses blend mode
}



Look for this book
openGL red book and orange book – massive. Some are documented on openGL.org. look for openGL and not directX ot HLSL do this on the 3d card for efficiency in processing.

Navigating knowledge – pick out what is important and let people do those. Otherwise it is overwhelming.



Chap 17 is brush up of what we already did

Read chap 18 – data input with examples and rss, yahoo libraries. Has rollover function.

Look in chapter 19 for syncing ML, client server stuff, and stuff like that.

No comments: