//A building triangular in profile, optional cable between antennas at the top. SIZE = 1.0; FLOORS = 50; //should be a multiple of 5 CABLE = false;//true for cable, false for no cable TriangleMesh triangle(double xsize, double ysize, double zsize, double top) { //a triangular with the top chopped off, width of the top cut is top double x = xsize/2; double y = ysize; double z = zsize/2; double x2 = top/2; vertices = new Vec3[8]; // 8 vertices + 6 faces vertices[0] = new Vec3(-x, 0.0, -z); vertices[1] = new Vec3(x, 0.0, -z);// vertices[2] = new Vec3(x2, y, -z);// vertices[3] = new Vec3(-x2, y, -z); vertices[4] = new Vec3(-x, 0.0, z); vertices[5] = new Vec3(x, 0.0, z);// vertices[6] = new Vec3(x2, y, z);// vertices[7] = new Vec3(-x2, y, z); //triangular faces int[][] faces = {{ 0, 3, 2}, { 0, 2, 1}, { 0, 1, 5}, { 0, 5, 4}, { 0, 4, 7}, {0, 7, 3}, { 6, 5, 1}, { 6, 1, 2}, { 6, 2, 3}, { 6, 3, 7}, { 6, 7, 4}, {6, 4, 5}}; mesh = new TriangleMesh(vertices, faces); mesh.setSmoothingMethod(0); return(mesh); } //textures window = new UniformTexture(); window.diffuseColor.setRGB(0.6,0.6,0.6); window.specularity = 0.5f; window.shininess = 1.0f; conc = new UniformTexture(); conc.diffuseColor.setRGB(0.6,0.6,0.4); red = new UniformTexture(); red.diffuseColor.setHSV(5,0.8f,0.6f); dark = new UniformTexture(); dark.diffuseColor.setRGB(0.2,0.2,0.2); WIDTH = 3*FLOORS/5; box = triangle(WIDTH*SIZE,FLOORS*SIZE,10*SIZE,(FLOORS/5)*SIZE); box.setTexture(window, window.getDefaultMapping(box)); pos = new Vec3(); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); mesh = triangle((WIDTH+0.2)*SIZE,FLOORS*SIZE,0.1*SIZE,(FLOORS/5+0.2)*SIZE); mesh.setTexture(conc, conc.getDefaultMapping(mesh)); for (i=-9;i<10;i++) { pos = new Vec3(0,0,i*SIZE/2); script.addObject(mesh, new CoordinateSystem(pos, 0,0,0)); } //horizontal int i; for (i=0;i<=FLOORS;i++) { dfloor = (double) FLOORS; kk = WIDTH*(FLOORS-i)/dfloor + (FLOORS/5)*i/dfloor; box = new Cube((kk+0.3)*SIZE,0.3*SIZE,10.3*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); pos = new Vec3(0,i*SIZE,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); //vertical if (i%2==0) { box = new Cube(0.1*SIZE,i*SIZE,10.3*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); pos = new Vec3(kk*SIZE/2,i*SIZE/2,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(-kk*SIZE/2,i*SIZE/2,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); } } for (i=FLOORS/10;i