Computational Geometry

Programming Project

Drawing Brick Walls In VRML

Eric Paulsen

 

Interlocking Brick Wall Segment

Stagger Offset 50% Of Brick Length

BrickWall2.wrl

The goal of this project was to write a program in C that would write graphical representations of brick walls to vrml files for viewing in vrweb.

This entailed first defining all the variables that define a brick wall:

  • The physical dimensions of the wall and bricks
  • The distance that the next row is offset
  • Whether the wall will be connected to another wall.
  • The second part was writing functions that sequentially broke the task down into managable tasks: DrawBrickWall(draws a brick wall) -> DrawBrickRow (draws a row of bricks) -> DrawBrick (draws a brick).

  • The first function- DrawBrickWall -simply calls DrawBrickRow until all the rows are drawn.
  • The second function- DrawBrickRow -calls DrawBrick until the row is drawn.
  • The third function- DrawBrick -writes a cube primitive into a vrml file.
  • I used a random number generator to randomly color the bricks so that the individual bricks could be seen. Otherwise they would have appeared as one object when shaded, and been revealed when manipulated in wire-frame.

    I encountered a number of problems throughout this project.

  • There were relatively few compile errors.
  • The first major problem was a discrepency between my conceptual drawing origin and
  • the vrweb drawing origin. I visualized the bricks being drawn from the corner, whereas vrweb draws cubes from the center. I compensated for this by translating the drawing origin to the center of the brick, then everything lined up properly.

  • A series of problems with the algorith in DrawBrickRow caused the most
  • difficulties. These took some time to solve and require analysis of the algorith to determine what it should be doing and how I could make it do that.

    I initially intended to make this program interactive. Consequently I planned a two stage program development project:

  • First Stage:
  • Write a program to draw a brick wall using hardwired variables.

    Test and debug the program by changing variables.

  • Second Stage:
  • Modify program to run interactively by calling function that queries the user for the variable values for various dimensions and options such as:

  • Wall and brick dimensions
  • Number of walls to draw
  • Location and direction of each wall
  • Leaving space for interlocking bricks at ends of wall
  • I was not able to start the second part due to time constraints, but I consider the first to be successful and the code to be fairly robust.

    DrawBrickWallp1.c

    Pictures Of Brick Walls From Various Stages of Program Development

     
     
     
    BrickWall5.wrl
     
    BrickWall1.wrl
     
    BrickWall7.wrl
     
    BrickWall6.wrl
    Eric Emil Paulsen