示例#1
0
  /*
   *  Draw the CSAC hallway
   *  This is done using the data collected on March 7
   */
  public static void DrawHallway(Graphics g) {

    double[][] ActiveTransform = new double[4][4];
    Assembly[] EMPTY = new Assembly[0];
    Assembly[] ceilingAssembly = new Assembly[0];

    // origin
    Point3D[] floorPoints = new Point3D[9];
    floorPoints[0] = new Point3D(-70.75, 0, 0);
    floorPoints[1] = new Point3D(70.75, 0, 0);
    floorPoints[2] = new Point3D(70.75, 0, -727.125);
    floorPoints[3] = new Point3D(-70.75, 0, -727.125);
    floorPoints[4] = new Point3D(-70.75, 0, -232.5);
    floorPoints[5] = new Point3D(-156.5, 0, -232.5);
    floorPoints[6] = new Point3D(-156.5, 0, -151.5);
    floorPoints[7] = new Point3D(-70.75, 0, -151.5);
    floorPoints[8] = new Point3D(-70.75, 0, 0);

    Object floor = new Object(floorPoints, IDENTITY, "Floor");
    floor.DrawObject(g, IDENTITY);
    ConnectWalls(g, floor, 132);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_TRANS, 132);
    Assembly ceiling = new Assembly(EMPTY, ActiveTransform, floor, "Ceiling");

    ceiling.Assemble(g, IDENTITY);

    Point3D[] hallwayCeilingPoints = new Point3D[4];
    // 81x104.75
    hallwayCeilingPoints[0] = new Point3D(0, 0, 0);
    hallwayCeilingPoints[1] = new Point3D(85.75, 0, 0);
    hallwayCeilingPoints[2] = new Point3D(85.75, 0, -81);
    hallwayCeilingPoints[3] = new Point3D(0, 0, -81);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_TRANS, 103);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -151.5);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -156.5);
    Object hallwayCeiling = new Object(hallwayCeilingPoints, ActiveTransform, "Hallway ceiling");
    hallwayCeiling.DrawObject(g, IDENTITY);

    hallwayCeilingPoints[0].SetCoords(0, 0, 0);
    hallwayCeilingPoints[1].SetCoords(0, 29, 0);
    hallwayCeilingPoints[2].SetCoords(0, 29, -81);
    hallwayCeilingPoints[3].SetCoords(0, 0, -81);
    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_TRANS, 103);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -151.5);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -70.75);
    Object hallwayWall = new Object(hallwayCeilingPoints, ActiveTransform, "Hallway wall");
    hallwayWall.DrawObject(g, IDENTITY);

    Point3D[] pillarPoints = new Point3D[4];
    pillarPoints[0] = new Point3D(-70.75, 0, -182.5);
    pillarPoints[1] = new Point3D(-70.75, 0, -201.5);
    pillarPoints[2] = new Point3D(-88.75, 0, -201.5);
    pillarPoints[3] = new Point3D(-88.75, 0, -182.5);

    Object pillar = new Object(pillarPoints, IDENTITY, "Pillar");
    pillar.DrawObject(g, IDENTITY);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_TRANS, 103);
    Assembly pillarAssembly = new Assembly(EMPTY, ActiveTransform, pillar, "Top of Pillar");
    pillarAssembly.Assemble(g, IDENTITY);
    ConnectWalls(g, pillar, 103);

    /*
     *   BEGIN DOOR ASSEMBLY
     */

    Point3D[] doorPoints = new Point3D[4];
    doorPoints[0] = new Point3D(0, 0, 0);
    doorPoints[1] = new Point3D(35.75, 0, 0);
    doorPoints[2] = new Point3D(35.75, 87, 0);
    doorPoints[3] = new Point3D(0, 87, 0);

    Assembly[] doorAssembly = new Assembly[0];

    // all the doors are magenta
    g.setColor(Color.magenta);
    Object door = new Object(doorPoints, IDENTITY, "Door");

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -53.75);
    Assembly door1 = new Assembly(EMPTY, ActiveTransform, door, "Alves Foss");
    doorAssembly = AppendToArray(doorAssembly, door1);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -251.375);
    Assembly door2 = new Assembly(EMPTY, ActiveTransform, door, "Terrence Soule");
    doorAssembly = AppendToArray(doorAssembly, door2);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -369.375);
    Assembly door3 = new Assembly(EMPTY, ActiveTransform, door, "Daniel Conte De Leon");
    doorAssembly = AppendToArray(doorAssembly, door3);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -568.125);
    Assembly door4 = new Assembly(EMPTY, ActiveTransform, door, "Greg Donahoe");
    doorAssembly = AppendToArray(doorAssembly, door4);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -644.875);
    Assembly door5 = new Assembly(EMPTY, ActiveTransform, door, "Robert Rinker");
    doorAssembly = AppendToArray(doorAssembly, door5);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -180);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 62.25);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -727.125);
    Assembly door6 = new Assembly(EMPTY, ActiveTransform, door, "East Office Door");
    doorAssembly = AppendToArray(doorAssembly, door6);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, 90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -691.375);
    Assembly door7 = new Assembly(EMPTY, ActiveTransform, door, "North Entrance");
    doorAssembly = AppendToArray(doorAssembly, door7);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, 90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -655.625);
    Assembly door8 = new Assembly(EMPTY, ActiveTransform, door, "North Entrance");
    doorAssembly = AppendToArray(doorAssembly, door8);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, 90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -474.875);
    Assembly door9 = new Assembly(EMPTY, ActiveTransform, door, "CS Office");
    doorAssembly = AppendToArray(doorAssembly, door9);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, 90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -156.5);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -151.5);
    Assembly door10 = new Assembly(EMPTY, ActiveTransform, door, "Clinton Jeffery");
    doorAssembly = AppendToArray(doorAssembly, door10);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.X_TRANS, -123.5);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -151.5);
    Assembly door11 = new Assembly(EMPTY, ActiveTransform, door, "Clinton Jeffery Side Entrance");
    doorAssembly = AppendToArray(doorAssembly, door11);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, 90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -156.5);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -196.75);
    Assembly door12 = new Assembly(EMPTY, ActiveTransform, door, "Bruce Bolden");
    doorAssembly = AppendToArray(doorAssembly, door12);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -180);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -87.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -232.5);
    Assembly door13 = new Assembly(EMPTY, ActiveTransform, door, "Bruce Bolden Side Entrance");
    doorAssembly = AppendToArray(doorAssembly, door13);

    Assembly buildDoors = new Assembly(doorAssembly, IDENTITY, null, "Door Assembly");
    buildDoors.Assemble(g, IDENTITY);

    /*
     *   END DOOR ASSEMBLY
     */

    g.setColor(Color.black);

    Point3D[] windowPoints = new Point3D[4];
    windowPoints[0] = new Point3D(-51.75, 38, -727.125);
    windowPoints[1] = new Point3D(16.25, 38, -727.125);
    windowPoints[2] = new Point3D(16.25, 86, -727.125);
    windowPoints[3] = new Point3D(-51.75, 86, -727.125);
    Object window = new Object(windowPoints, IDENTITY, "Window");

    window.DrawObject(g, IDENTITY);

    /*
     *   BEGIN BOARD ASSEMBLY
     */

    Assembly[] board_array = new Assembly[0];
    // boards on the wall
    Point3D[] boardPoints = new Point3D[4];
    boardPoints[0] = new Point3D(0, 0, 0);
    boardPoints[1] = new Point3D(36, 0, 0);
    boardPoints[2] = new Point3D(36, 24, 0);
    boardPoints[3] = new Point3D(0, 24, 0);
    g.setColor(Color.blue);

    Object board = new Object(boardPoints, IDENTITY, "Board");

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 48);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -107.75);
    Assembly board1 = new Assembly(EMPTY, ActiveTransform, board, "Alves Foss Board");
    board_array = AppendToArray(board_array, board1);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 48);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -300.625);
    Assembly board2 = new Assembly(EMPTY, ActiveTransform, board, "Terrence Soule Board");
    board_array = AppendToArray(board_array, board2);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 48);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -430.375);
    Assembly board3 = new Assembly(EMPTY, ActiveTransform, board, "Daniel Conte De Leon Board");
    board_array = AppendToArray(board_array, board3);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 48);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -513.375);
    Assembly board4 = new Assembly(EMPTY, ActiveTransform, board, "Greg Donahoe Board");
    board_array = AppendToArray(board_array, board4);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, 70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 48);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -699.875);
    Assembly board5 = new Assembly(EMPTY, ActiveTransform, board, "Robert Rinker Board");
    board_array = AppendToArray(board_array, board5);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -180);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_ROT, -90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -152.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 48);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -232.5);
    Assembly board6 = new Assembly(EMPTY, ActiveTransform, board, "Bruce Bolden Board");
    board_array = AppendToArray(board_array, board6);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Z_ROT, 90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -130.5);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 48);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -151.5);
    Assembly board7 = new Assembly(EMPTY, ActiveTransform, board, "Clint Jeffery Board");
    board_array = AppendToArray(board_array, board7);

    Assembly boardAssembly = new Assembly(board_array, IDENTITY, null, "Board Assembly");
    boardAssembly.Assemble(g, IDENTITY);

    /*
     *   END BOARD ASSEMBLY
     */

    // bulletin board and trophy case
    boardPoints[0].SetCoords(0, 0, 0);
    boardPoints[1].SetCoords(96, 0, 0);
    boardPoints[2].SetCoords(96, 53, 0);
    boardPoints[3].SetCoords(0, 53, 0);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, 90);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.X_TRANS, -70.75);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Y_TRANS, 33);
    ActiveTransform = BuildElementaryTransform(ActiveTransform, TRANSFORM_CODE.Z_TRANS, -30);

    Object bulletBoard = new Object(boardPoints, ActiveTransform, "Bulletin Board");
    bulletBoard.DrawObject(g, IDENTITY);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Z_TRANS, -262.5);
    Assembly trophyCase = new Assembly(EMPTY, ActiveTransform, bulletBoard, "Trophy Case");

    trophyCase.Assemble(g, IDENTITY);

    Branding(g, "Hallway Model");
  }
示例#2
0
  /*
   *  Procedurally draws the rubik's cube
   *  The spacing between the cubes is passed in
   */
  public static void DrawRubiksCube(Graphics g, double space) {
    double spacing = 2.0 + space; // size of cube + the space we want
    // draw a square
    Point3D[] tmpPoints = new Point3D[4];
    tmpPoints[0] = new Point3D(-1, -1, 1);
    tmpPoints[1] = new Point3D(-1, 1, 1);
    tmpPoints[2] = new Point3D(1, 1, 1);
    tmpPoints[3] = new Point3D(1, -1, 1);

    double[][] ActiveTransform = new double[4][4];

    Object square = new Object(tmpPoints, IDENTITY, "Square");
    Assembly[] EMPTY = new Assembly[0];
    Assembly[] cube_array = new Assembly[0];
    Assembly[] row_array = new Assembly[0];
    Assembly[] side_array = new Assembly[0];
    Assembly[] rubik_array = new Assembly[0];

    /*
     *   START CUBE ARRAY ASSEMBLY
     */
    Assembly front = new Assembly(EMPTY, IDENTITY, square, "Front");
    cube_array = AppendToArray(cube_array, front);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.X_ROT, 90);
    Assembly bot = new Assembly(EMPTY, ActiveTransform, square, "Bottom");
    cube_array = AppendToArray(cube_array, bot);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.X_ROT, 180);
    Assembly back = new Assembly(EMPTY, ActiveTransform, square, "Back");
    cube_array = AppendToArray(cube_array, back);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.X_ROT, -90);
    Assembly top = new Assembly(EMPTY, ActiveTransform, square, "Top");
    cube_array = AppendToArray(cube_array, top);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, 90);
    Assembly left = new Assembly(EMPTY, ActiveTransform, square, "Left");
    cube_array = AppendToArray(cube_array, left);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_ROT, -90);
    Assembly right = new Assembly(EMPTY, ActiveTransform, square, "Right");
    cube_array = AppendToArray(cube_array, right);

    /*
     *   END CUBE ASSEMBLY
     */

    /*
     *   BEGIN ROW ARRAY ASSEMBLY
     */
    Assembly cube = new Assembly(cube_array, IDENTITY, null, "Cube 1");
    row_array = AppendToArray(row_array, cube);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Z_TRANS, spacing);
    Assembly cube2 = new Assembly(cube_array, ActiveTransform, null, "Cube 2");
    row_array = AppendToArray(row_array, cube2);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Z_TRANS, -spacing);
    Assembly cube3 = new Assembly(cube_array, ActiveTransform, null, "Cube 3");
    row_array = AppendToArray(row_array, cube3);
    /*
     *   END ROW ASSEMBLY
     */

    /*
     *   BEGIN SIDE ARRAY ASSEMBLY
     */
    Assembly row1 = new Assembly(row_array, IDENTITY, null, "Row 1");
    side_array = AppendToArray(side_array, row1);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_TRANS, spacing);
    Assembly row2 = new Assembly(row_array, ActiveTransform, null, "Row 2");
    side_array = AppendToArray(side_array, row2);

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.Y_TRANS, -spacing);
    Assembly row3 = new Assembly(row_array, ActiveTransform, null, "Row 3");
    side_array = AppendToArray(side_array, row3);

    /*
     *   END SIDE ASSEMBLY
     */

    Assembly side1 = new Assembly(side_array, IDENTITY, null, "Side 1");

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.X_TRANS, spacing);
    Assembly side2 = new Assembly(side_array, ActiveTransform, null, "Side 2");

    ActiveTransform = BuildElementaryTransform(IDENTITY, TRANSFORM_CODE.X_TRANS, -spacing);
    Assembly side3 = new Assembly(side_array, ActiveTransform, null, "Side 3");

    // Color requirements meant this had to be done separately
    g.setColor(Color.red);
    side1.Assemble(g, IDENTITY);
    g.setColor(Color.blue);
    side2.Assemble(g, IDENTITY);
    g.setColor(Color.green);
    side3.Assemble(g, IDENTITY);
  }