2 * DOUBLE BLACK DIAMOND DOUBLE BLACK DIAMOND
5 * ///\\\ ///\\\ ///\\\ ///\\\
6 * \\\/// \\\/// \\\/// \\\///
9 * EXPERTS ONLY!! EXPERTS ONLY!!
11 * This file implements the mapping functions needed to lay out the physical
12 * cubes and the output ports on the panda board. It should only be modified
13 * when physical changes or tuning is being done to the structure.
17 final int MaxCubeHeight = 6;
18 final int NumBackTowers = 16;
20 public Model buildModel() {
22 // Shorthand helpers for specifying wiring more quickly
23 final Cube.Wiring WFL = Cube.Wiring.FRONT_LEFT;
24 final Cube.Wiring WFR = Cube.Wiring.FRONT_RIGHT;
25 final Cube.Wiring WRL = Cube.Wiring.REAR_LEFT;
26 final Cube.Wiring WRR = Cube.Wiring.REAR_RIGHT;
28 // Utility value if you need the height of a cube shorthand
29 final float CH = Cube.EDGE_HEIGHT;
30 final float CW = Cube.EDGE_WIDTH ;
32 // Positions for the bass box
33 final float BBY = BassBox.EDGE_HEIGHT + BoothFloor.PLEXI_WIDTH;
37 // The model is represented as an array of towers. The cubes in the tower
38 // are represenented relatively. Each tower has an x, y, z reference position,
39 // which is typically the base cube's bottom left corner.
41 // Following that is an array of floats. A 2-d array contains an x-offset
42 // and a z-offset from the previous reference position. Typically the first cube
43 // will just be {0, 0}. Each successive cube uses the position of the previous
44 // cube as its reference.
46 // A 3-d array contains an x-offset, a z-offset, and a rotation about the
49 // The cubes automatically increment their y-position by Cube.EDGE_HEIGHT.
51 // To-Do: (Mark Slee, Alex Green, or Ben Morrow): The Cube # is determined by the order in this list.
52 // "raw object index" is serialized by running through towermapping and then individual cube mapping below.
53 // We can do better than this. The raw object index should be obvious from the code-- looking through the
54 // rendered simulation and counting through cubes in mapping mode is grossly inefficient.
56 TowerMapping[] towerCubes = new TowerMapping[] {};
58 // Single cubes can be constructed directly here if you need them
59 Cube[] singleCubes = new Cube[] {
60 // new Cube(15, int( Cube.EDGE_HEIGHT), 39, 0, 10, 0, WRL), // Back left channel behind speaker
61 //new Cube(x, y, z, rx, ry, rz, wiring),
62 //new Cube(0,0,0,0,225,0, WRR),
66 // BassBox bassBox = BassBox.unlitBassBox(BBX, 0, BBZ); // frame exists, no lights
67 BassBox bassBox = BassBox.noBassBox(); // no bass box at all
68 // BassBox bassBox = new BassBox(BBX, 0, BBZ); // bass box with lights
71 List<Speaker> speakers = Arrays.asList(new Speaker[] {
72 // Each speaker parameter is x, y, z, rotation, the left speaker comes first
73 // new Speaker(TRAILER_WIDTH - Speaker.EDGE_WIDTH + 8, 6, 3, -15)
77 ////////////////////////////////////////////////////////////////////////
78 // dan's proposed lattice
79 ArrayList<StaggeredTower> scubes = new ArrayList<StaggeredTower>();
80 //if (NumBackTowers != 25) exit();
81 for (int i=0; i<NumBackTowers/2; i++) scubes.add(new StaggeredTower(
83 (i % 2 == 0) ? 0 : CH * 2./3. , // y
84 - ((i % 2 == 0) ? 11 : 0) + 80 , // z
85 -45, (i % 2 == 0) ? MaxCubeHeight : MaxCubeHeight) ); // num cubes
87 for (int i=0; i<NumBackTowers/2; i++) scubes.add(new StaggeredTower(
89 (i % 2 == 0) ? 0 : CH * 2./3. , // y
90 - ((i % 2 == 0) ? 0 : 11) + 80 - pow(CH*CH + CW*CW, .5), // z
91 225, (i % 2 == 0) ? MaxCubeHeight : MaxCubeHeight-1) );
93 // for (int i=0; i<2 ; i++) scubes.add(new StaggeredTower(
96 // - 0 + 97 - 2*pow(CH*CH + CW*CW, .5), // z
97 // 225, MaxCubeHeight ) );
99 ArrayList<Cube> dcubes = new ArrayList<Cube>();
100 // for (int i=1; i<6; i++) {
101 // if (i>1) dcubes.add(new Cube(-6+CW*4/3*i , 0, 0, 0, 0, 0, WRR));
102 // dcubes.add(new Cube(-6+CW*4/3*i+CW*2/3., CH*.5, 0, 0, 0, 0, WRR));
105 float current_x_position = 0;
106 // scubes.add(new StaggeredTower(//tower 1
107 // current_x_position, // x
110 // 45, 6, new Cube.Wiring[] { WFL, WRR, WFL, WRR, WFL, WRR}) );
111 // current_x_position += 25.25;
112 // scubes.add(new StaggeredTower(// tower 2
113 // current_x_position, // x
116 // 45, 6, new Cube.Wiring[] { WFR, WFL, WRR, WRR, WFL, WRR}) );
117 // current_x_position += 25.25;
118 // scubes.add(new StaggeredTower(//tower 3
119 // current_x_position, // x
122 // 45, 6, new Cube.Wiring[] { WRR, WFL, WRR, WRR, WFL, WRR}) );
123 // current_x_position += 25.25;
124 // scubes.add(new StaggeredTower(//tower 4
125 // current_x_position, // x
128 // 45, 6, new Cube.Wiring[] { WFL, WRR, WFL, WRR, WFL, WRR}) );
129 // current_x_position += 28;
130 // scubes.add(new StaggeredTower(//tower 5
131 // current_x_position, // x
134 // 45, 6, new Cube.Wiring[] { WRR, WFL, WRR, WFL, WRR, WFL}) );
135 // current_x_position += 28;
136 // scubes.add(new StaggeredTower(//tower 6
137 // current_x_position, // x
140 // 45, 6, new Cube.Wiring[] { WFL, WRR, WFL, WRR, WFL, WRR}) );
141 // current_x_position += 25.25;
142 // scubes.add(new StaggeredTower(// tower 7
143 // current_x_position, // x
146 // 45, 6, new Cube.Wiring[] { WRR, WFL, WRR, WFL, WRR, WFL}) );
147 // current_x_position += 25.25;
148 // scubes.add(new StaggeredTower(//tower 8
149 // current_x_position, // x
152 // 45, 6, new Cube.Wiring[] { WFL, WRR, WFL, WRR, WFL, WRR}) );
153 // current_x_position += 25.25;
154 // scubes.add(new StaggeredTower(//tower 9
155 // current_x_position, // x
158 // 45, 6, new Cube.Wiring[] { WFL, WRR, WFL, WRR, WFL, WRR}) );
159 // current_x_position += 25.25;
161 // //TOWERS ON DANCE FLOOR
162 // scubes.add(new StaggeredTower(//tower 10
163 // 83.75+39+43-124.5, // x
166 // 45, 4, new Cube.Wiring[]{ WRR, WFL, WFL, WRR}) );
167 // scubes.add(new StaggeredTower(//tower 11
171 // 45, 4, new Cube.Wiring[]{ WFL, WRR, WRR, WFL}) );
172 // scubes.add(new StaggeredTower(//tower 12
176 // 45, 4, new Cube.Wiring[]{ WRR, WFL, WFL, WRR}) );
177 // scubes.add(new StaggeredTower(//tower 13
181 // 45, 4, new Cube.Wiring[]{ WFL, WRR, WFL, WRR}) );
183 // scubes.add(new StaggeredTower(// Single cube on top of tower 4
187 // -10, 1, new Cube.Wiring[]{ WRL}) );
195 //////////////////////////////////////////////////////////////////////
196 // BENEATH HERE SHOULD NOT REQUIRE ANY MODIFICATION!!!! //
197 //////////////////////////////////////////////////////////////////////
199 // These guts just convert the shorthand mappings into usable objects
200 ArrayList<Tower> towerList = new ArrayList<Tower>();
201 ArrayList<Cube> tower;
202 Cube[] cubes = new Cube[200];
205 for (TowerMapping tm : towerCubes) {
209 tower = new ArrayList<Cube>();
210 for (CubeMapping cm : tm.cubeMappings) {
211 tower.add(cubes[cubeIndex++] = new Cube(px = px + cm.dx, ny, pz = pz + cm.dz, 0, cm.ry, 0, cm.wiring));
212 ny += Cube.EDGE_HEIGHT;
214 towerList.add(new Tower(tower));
218 for (Cube cube : singleCubes) {
219 cubes[cubeIndex++] = cube;
221 for (Cube cube : dcubes) {
222 cubes[cubeIndex++] = cube;
224 for (StaggeredTower st : scubes) {
225 tower = new ArrayList<Cube>();
226 for (int i=0; i < st.n; i++) {
227 Cube.Wiring w = (i < st.wiring.length) ? st.wiring[i] : WRR;
228 tower.add(cubes[cubeIndex++] = new Cube(st.x, st.y + CH* 4/3.*i, st.z, 0, st.r, 0, w));
230 towerList.add(new Tower(tower));
233 return new Model(towerList, cubes, bassBox, speakers);
236 static final float SPACING = 27;
237 static final float RISER = 13.5;
238 static final float FLOOR = 0;
239 >>>>>>> 21dffb1b77608cacc57382f3eb6eac3ed16054c3
242 * Definitions of tower positions. This is all that should need
243 * to be modified. Distances are measured from the left-most cube.
244 * The first value is the offset moving NE (towards back-right).
245 * The second value is the offset moving NW (negative comes forward-right).
247 static final float[][] TOWER_CONFIG = new float[][] {
248 new float[] { 0, 0, RISER, 4 },
249 new float[] { 25, -10, RISER, 4 },
250 new float[] { 50, -22.5, FLOOR, 5 },
251 new float[] { 17.25, -35.5, FLOOR, 6 },
252 new float[] { 43.25, -51.5, RISER, 6 },
253 new float[] { 69.25, -56, FLOOR, 6 },
254 new float[] { 12.75, -62.5, RISER, 4 },
255 new float[] { 38.75, -78.5, FLOOR, 5 },
256 new float[] { 65.75, -83, RISER, 5 },
260 public Model buildModel() {
262 List<Tower> towers = new ArrayList<Tower>();
263 Cube[] cubes = new Cube[200];
267 float x, y, z, xd, zd, num;
268 for (float[] tc : TOWER_CONFIG) {
280 List<Cube> tower = new ArrayList<Cube>();
281 for (int n = 0; n < num; ++n) {
282 Cube cube = new Cube(xd + 24, y, zd + 84, 0, -45, 0);
284 cubes[cubeIndex++] = cube;
287 towers.add(new Tower(tower));
290 return new Model(towers, cubes);