 Create a floor |
week 2
|
|
-
In-class Exercise
The follow exercise should be completed during the class lab period. Email a scree-capture (Use the print-screen button and paste into Photoshop) and a copy of the script to cory@arch.columbia.edu.
Create a script that will make repetitive floor slabs and generate a 'skyscraper' of varying heights. Suggested variables are:
$number_or_floors
$size
 Create a floor
1. Create a script that will make one floor slab. This can be done by making a cube and scaling it.
//make a cube
polyCube;
//scale it wider and thinner
scale 20 .5 20;
 Create a loop to make multiple floors
2. Make a loop that will generate 10 floors, evenly spaced by repeating the cube creation commands from the last step - but using variables.
//start a counter at 0
$i = 0;
//loop while $i is less than 10
while($i < 10){
//make a cube
polyCube;
//scale it wider and thinner
scale 20 .5 20;
//move it
move 0 $i 0;
//do not forget to increase the counter or it will get stuck!
$i++;
}
3. Run the script to see what happens. Delete the results.
 Make the number of floors variable
4. Alter the script so you can have a variable number of floors, instead of always being 10.
//make the number of floors variable. Change this to make more or less floors
$number_of_floors = 20;
//start a counter at 0
$i = 0;
//loop while $i is less than number of floors
while($i < $number_of_floors){
//make a cube
polyCube;
//scale it wider and thinner
scale 20 .5 20;
//move it
move 0 $i 0;
//do not forget to increase the counter or it will get stuck!
$i++;
}
5. Run the script. Try changing the $number_of_floors variable and running it again.
6. Change the script to the spacing between the floors is variable.
//make the number of floors variable. Change this to make more or less floors
$number_of_floors = 20;
//make the height variable
$size = 4;
//start a counter at 0
$i = 0;
//loop while $i is less than number of floors
while($i < $number_of_floors){
//make a cube
polyCube;
//scale it wider and thinner
scale 20 .5 20;
//move it
$height = $i * $size;
move 0 $height 0;
//do not forget to increase the counter or it will get stuck!
$i++;
}
 Try playing with other variables and transformations
7. Try running the script with various sizes and floor numbers.
8. Try adding other functions, like rotate, into the loop. Try making the width and thickness variable.
9. Submit one wire-frame GIF or JPEG image and a copy of the script at the end of class. Email the image and text to cory@arch.columbia.edu
|
week 2
|