xxxxxxxxxx
84
////////////////////////////////////////////////////
//
// 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, -100,0], //tip
[-100, 100, 0],
[-50, 120, 100],
[-80, 90, 80],
[-40, 150, 120],
[-80,0,0],
[-50, 80, 100 ],
[-30,0,80],
[50,120,100],
[40,150,120],
[30,0,80],
[50,80,100],
[80,90,80],
[80,0,0],
[100,100,0],
[0, 0,-100], //back support
[-25,150,-50],//bottom support
[25,150,-50], //bottom support
//
];
// 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();
}