Showing posts with label ICM. Show all posts
Showing posts with label ICM. Show all posts

Wednesday, November 12, 2008

ICM final

I want to finish a drawing I started over the summer with processing.


















I want to analyze this drawing of hair and then have processing draw similar forms pouring out into the white space of the master drawing.


































I would also like to have the eyes to look in different positions.

Tuesday, October 21, 2008

Inverse Kinematics and Processing



Basic inverse kinematics code rewritten for processing from Keith Peters of bit-101. The idea is to replicate the motion of your shoulder, upper arm, elbow, lower arm, and hand in two dimensions. The angular value of the "shoulder" and "elbow" will be written to corresponding servo motors that are being controlled by Arduino.

Here is the code:

int sx,sy,ex,ey,hx,hy;
int armLength,ua,la;
float uad, lad;
void setup(){
size(500,500);
background(255, 224, 150);
sx = width/2;
sy = height/2;
armLength = int(width/5);
}

void draw(){
fill(255);
rect(0,0,width,height);
upperArm();
}

void upperArm(){
int dx = mouseX - sx;
int dy = mouseY - sy;
float distance = sqrt(dx*dx+dy*dy);

int a = armLength;
int b = armLength;
float c = min(distance, a + b);

float B = acos((b*b-a*a-c*c)/(-2*a*c));
float C = acos((c*c-a*a-b*b)/(-2*a*b));

float D = atan2(dy,dx);
float E = D + B + PI + C;

ex = int((cos(E) * a)) + sx;
ey = int((sin(E) * a)) + sy;
print("UpperArm Angle= "+degrees(E)+" ");

hx = int((cos(D+B) * b)) + ex;
hy = int((sin(D+B) * b)) + ey;
println("LowerArm Angle= "+degrees((D+B)));

stroke(255,0,0,100);
fill(240,0,0,200);
ellipse(sx,sy,10,10);
ellipse(ex,ey,8,8);
ellipse(hx,hy,6,6);
stroke(0);
line(sx,sy,ex,ey);
line(ex,ey,hx,hy);
}

Monday, September 22, 2008

ICM Homework Week 3

This week I was supposed to create classes and instantiate objects. Last week I tinkered with a random line drawing program. The way it works is simple:
1. pick a starting point
2. pick a point on an invisible circle
3. draw a line between points
3. the second point becomes the new starting point
4. repeat

I tried to limit the points on the circle so it was more like picking a point on the crust of a slice of pizza. I was attempting to make the movement smoother. What I got looked like a long tent pole that was unhinged and thrown onto the screen.

This was because I was using the random() function to pick a value. I switched to the noise() function and the result was much more fluid and ultimately cooler looking.

Clicking on the window resets the points to the mouse location.

Sunday, September 14, 2008

ICM Week 2 Homework part 2


My roommate, Jim Lamiell, had an assignment to create 4 squares representing the 4 quadrants of the stage. When the cursor is over a quadrant, that quadrant is black. When a cursor is not over a quadrant, it is gradually turning whiter, unless it is already white, in which case it remains white.

I wanted to recreate his project, but be able to change the total amount of squares and have it figure out all of the details. So I did. I used nested arrays and nested for loops to get it all to work. Not to mention the help of Jeremy and Thomas. Thanks guys :)

The example that I show has 256 squares. I am very excited for this little exercise because it has created a way to program matrices of LEDs for projects that I will be doing in the future.

Wednesday, September 10, 2008

ICM Week 2 Homework


This week, for ICM, I am supposed to create a drawing using variables! I was so excited that I did it a week ago :P I had actually worked on this before my self portrait.

I wanted to make concentric triangles, so I figured the easiest way would be to create a triangle based on its center point and radius. I created a class that figures out the 6 coordinate points by using trigonometry and then simply inputs them into the standard triangle() command.

Right now the triangles rotate based on the x position of your mouse. I am still playing with this, so I will be posting again soon.

Sunday, September 7, 2008

ICM Week 1 Homework


For my first Processing assignment I created a stunning self portrait. I am excited to learn more about this language.