xxxxxxxxxx
67
////////////////////////////////////////////////////
//
// Computation in Design 2
// Making
//
// From Code to Thing
//
// The Polygon Hull Tool
// create a polygon from a set of points that
// can then be exported in a 3D format.
//
//
// READ FIRST
// in the comments below look for
// !!! Make-changes-here
// to make changes and to customise your polygon.
// Ask for help if unsure or stuck.
//
// any function that starts with app can
// be found inside file app.js. Open the
// Sketch Files to the left to find it.
//
////////////////////////////////////////////////////
function preload() {
appPreload();
}
function setup() {
renderer = createCanvas(windowWidth, windowHeight, WEBGL);
// !!! Make-changes-here
// these are the coordinates for the custom
// 3D object each coordinate consists of
// 3 numbers (x,y,z axis) one coordinate with
// its 3 numbers is stored in an array e.g. [100,100,-100],
// all coordinates in turn are stored in a main array
// which you can modify below.
// things that you can change:
// - numbers
// - add new coordinates
custom = [
[0,60,0], //top
[-50, 0, 0], [50,0,0], [30,0,50], [-30,0,50],[30,0,-50], [-30,0,-50 ], //layer 1
[-30,-50,0], [30,-50,0], [-15,-50,25],[15,-50,25], [-15,-50,-25],[15,-50,-25], //layer 2
];
// notes
// i need 3 contact points in order for it to stand at the bottom
// after the custom coordinates have been
// set, start the app.
appSetup();
}
function draw() {
// lets clear and draw the background first
background(40);
// assign lighting to the scene.
appLighting();
// Now lets display our 3D object
appRender();
// and finally, update the app
appUpdate();
}