logo

Creating Geometries

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

Subsection: Building a house

In the applet below an empty set of faces has already been constructed. The first thing we need to do is to construct the vertices.

User Activity
  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:
    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
  6. Create nine elements by entering 9 in the Number of Elements text field
  7. Enter the vertex indices for each element
    Index        
    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.

Face with correctly ordered vertices
Correctly ordered vertices
Face with wrong ordered vertices
Incorrectly ordered vertices

Summary
Select active geometry Open the display panel through the main menu, Inspector --> Display or CTRL-d and select the geometry in the Active Geometry list box.
Create vertices In the main menu, Inspector --> Geometry --> Info or CTRL-i then increase the number of vertices by increasing the number in the corresponding text field and then edit the vertex coordinates in the text fields below.
Create faces In the main menu, Inspector --> Geometry --> Info or CTRL-i, then increase the number of elements by increasing the number in the corresponding text field and then edit the indices in the text fields below, indices must be valid vertices in the above list.

Building a Street

User Activity
  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:
    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
  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.

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.

Summary
Add new geometry In the main menu, File --> New --> Geometry, select the desired geometry type, make sure the Add radio box is selected and click OK.
Change colors In the main menu, Inspector --> Geometry --> Material or CTRL-m, then edit the RGB values or click on the currently selected color to open the color chooser dialog

Building a City

User Activity
  1. To duplicate the house, open the display panel by pressing CTRL-d
  2. Click the Duplicate Geom 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

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.

Summary
Duplicate geometry In the main menu, Inspector --> Display, click the Duplicate Geom button and select the geometry to be dupliated
Transform geometry In the main menu, Method --> Modelling --> Transform Geometry, then use the sliders for each axis of each transformation type to apply scaling, translation or rotation to the geometry
© 1996-2015 Last modified: 07.05.2013 --- www.javaview.de --- The JavaView Project