Input States

public void updateobj()
{

//respond to the user input

if (isTouched && !wasTouched )
{
//first touch
//change the color
fColor = color(255,0,0);
//remember the velocity 
lastXVel = xVel;
lastYVel = yVel;

//stop the velocity
xVel = 0;
yVel = 0;

println("first touch");
}
else if ( isTouched && wasTouched )
{
//start dragging or something
//change the color
fColor = color(255,0,0);
xVel = 0;
yVel = 0;
println("continue to touch");

}
else if (!isTouched && wasTouched )
{
//change the color to green
fColor = color(0,255,0);

//apply normal velocity
xVel = lastXVel;
yVel = lastYVel;

println("first not touch after a touch");
}
else
{
//i haven't been interacted with in some time
//im bored, let me do something else

if(++ticks>tickThreshold)
{ //on some interval, change direction
ticks = 0;
randomVelocity();
}

println("not touched && wasnt touched");
}

//respond to the environment
 //bounce off the edge
//collide with something else

//update position based on velocity
xLoc += xVel;
yLoc += yVel;

}

Hinged Walls…

Similar to the project Professor Kearns and his partners have done with the movable hinged wall, I found another idea like this called the Storefront for Art and Architecture in  New York City which is an art gallery. It has a series of hinged walls which are movable and I am assuming could be made using an arduino like device along with code as illustrated in class. If you want to know more than read the article.

http://inhabitat.com/postopolis-is-coming-to-nyc/

Where Architecture is heading…

I wanted to bring up a point to something which was said in class by Professor Kearns. The idea that 3d modeling will be used to check that a building is to code. This is not unrealistic  by any means and I believe it is coming. The question I have is what is an architect at this point? Architects will seem to become more computer programmers and just as good if not better as a designer. Below is an article on how competitive the field is becoming and how employment/opportunities are decreasing tremendously. One thing is for sure the role of an architect will change and what we are being trained to do now may not matter much in twenty-five years.

http://www.arch-times.com/2011/03/09/what-will-the-architecture-profession-look-like-in-2025/

example code from class

stage.frameRate = 31;

//values to clamp to
var smallRadius:Number = 10;
var largeRadius:Number = 100;

//startup radius
var sphereRadius:Number = 50;

//base container
var container:Sprite = new Sprite();
container.x = stage.stageWidth/2;
container.y = stage.stageHeight/2;

//graphic container
this.addChild(container);
var sphere:Shape = new Shape();
container.addChild(sphere);

//create x fps loop
this.addEventListener(Event.ENTER_FRAME, mainLoop);

//function called on every frame
function mainLoop(event:Event):void {

//get the distance of the mouse to the object
var distToMouseX:Number = clamp(container.mouseX,smallRadius,largeRadius);

//compute the radius
sphereRadius = largeRadius + smallRadius – distToMouseX;

//draw the circle
sphere.graphics.clear();
sphere.graphics.beginFill(255);
sphere.graphics.drawCircle(0,0,sphereRadius);

}

//utility function to clamp “val” to a particular range
function clamp(val:Number, min:Number, max:Number){
return Math.max(min, Math.min(max, val))
}