You are here: AGGeom » JavaView » CreatingGeometries


In this tutorial we will create several geometries and use transformations to design a little street scene.

Building a house.

So first we must create a new element set via File-->New-->Geometry-->Surfaces-->Element Set

Then perform the following steps:

  1. Open the display panel with "CTRL-d".
  2. Select the Empty Element Set in the Active Geometry list box.
  3. Open the info panel with "CTRL-i".
  4. Create nine vertices by entering "9" in the Number of Vertices text field.
  5. Enter the coordinates for each vertex as shown in the table below.
  6. Create nine elements by entering "9" in the Number of Elemenents text field.
  7. Enter the vertex indices for each element according to the table below.

Table for the vertex coordinates:
Index 0 1 2 3 4 5 6 7 8
X 0.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 0.5
Y 0.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.5
Z 0.0 1.0 0.0 0.0 1.0 1.0 0.0 1.0 1.5

Table for the vertex indices for each element:
0 0 1 4 2
1 4 7 6 2
2 7 5 3 6
3 3 5 1 0
4 1 8 4  
5 4 8 7  
6 7 8 5  
7 5 8 1  
8 0 2 6 3

What happens in detail is this: Since an Element Set has already been created, we now need to edit the vertices. In order to do that, make sure that the element set is the currently active geometry. You can check what the active geometry is in the display panel. In the main menu, you can open it via Inspector --> Display or by clicking CTRL-d. At the bottom of that panel in the "Geometries" section, you can select the active geometry by marking it in the left list box. Now open the info panel through the main menu via Inspector --> Geometry --> Info or by pressing CTRL-i. This is where vertices and elements can be edited. First we need to enter the number of vertices, that we want as corners of the faces. Since we are going to build a square house with a roof, we need a total of 9 vertices. Then you need to enter every coordinate of each vertex. When entering the numbers from the box above, press Enter after each input.

Next we need to construct the faces. Since we are building a house, we need four walls, a floor and four roof elements. So enter 9 in the text field named Number of Elements in the info panel. For each element you now need to enter the indices of those vertices, that shall be the corners of the face.

It is important, to enter the indices in the order in which they are connected by the border of the face; otherwise, the face will look degenerated. To help getting the vertices in right order, you can label all vertices by their index. In order to do that you need to open the material panel by either opening it in the main menu under Inspector --> Geometry --> Material or pressing CTRL-m. Then simply enable the All Labels checkbox at the top of the panel.

The pictures show an element each, consisting of four vertices, in correct and incorrect order:
correctly_ordered_vertices.jpg incorrectly_ordered_vertices.jpg

Building a Street

Perform the following steps:

  1. In the main menu, go to File --> New --> Geometry
  2. Select category Surfaces and item Empty Element Set
  3. Make sure the radio box Add is selected and add a new Empty Element Set by clicking the OK button.
  4. Open the info panel by pressing CTRL-i
  5. Create 4 vertices like before, using the coordinates from the table below.
  6. Create one face like before with vertices 0, 1, 3, 2 in that order.
  7. To change color, open material panel with CTRL-m and change the face color by clicking on the current color and selecting a new or by directly entering the RGB values in the text fields.

Index 0. 1. 2. 3.
X -2.5 3.5 -2.5 3.5
Y 0.0 0.0 -1.0 -1.0
Z 0.0 0.0 0.0 0.0

What happens in detail is this: We are now going add a small street to our little scene. We simply do that by adding another Element Set and contructing one face. First we need to create a new empty Element Set. In order to do that open the main menu and go to File --> New --> Geometry and in the opened dialog, select Surfaces in the category list and Empty Element Set in the item list. Then add the element set by making sure that the Add radio box is selected and clicking the OK button. Now we have created a new geometry. Open the info panel of that geometry with CTRL-i or via the main menu, make sure it is selected as the active geometry, by default an newly created geometry is active. Now set up 4 vertices and 1 face. For convenience you can use the values in the box above.

To differentiate the street from the house, the street should have a different color. We can assign colors to faces, vertices and other elements in the material panel, which you can reach in the main menu via Inspector --> Geometry --> Material or by pressing CTRL-m. To change the face color, click on the current color to open the color selection dialog or enter a color directly by RGB values into the appropriate text fields.

Building a City

Perform the following steps:
  1. To duplicate the house, open the display panel by pressing CTRL-d.
  2. Click the Duplicate Geometry button and select the house geometry.
  3. Open the Transform dialog in the main menu through Method --> Modelling --> Transform Geometry.
  4. Use the transformations to move the house into a new position.

What happens in detail is this: Finally we can add more houses to our street. But instead of adding an new element set, we are duplicating the already built house and move the duplicate by transformation into another location. To duplicate the house geometry, open the display panel either in the main menu via Inspector --> Display or by pressing CTRL-d. Then click the Duplicate Geom button and select the geometry, that represents our house. You will see a new item in the list thats prefixed by the word "Clone", this is the duplicat. At the moment you cannot see a new geometry, because the duplicate is at the very same spot as the original. To move a geometry, we are going to use transformations. Open the Transform dialog in the main menu through Method --> Modelling --> Transform Geometry. In this dialog, you have the possibilty to use the three basic transformation scale, translate and rotate. For each transformation type there are three sliders. Each slider represents one axis. You can now move the duplicate house to a new location or scale it to get a larger house or maybe a small doghouse. Below is a finished sample street scene.

  • Using the steps from this tutorial you should be able to build a city similar to this one:


This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback