Task 057: Construction of 3D Surface Scenes

The task is to construct an interesting shape from a triangle mesh, via an implementation of a corner table. The preferred construction would be algorithmic, i.e. that both the position of the vertices, as well as the connectivity between them, are determined by an algorithm (and not simply read from a file). The result has to be a model in memory, which can be written to disk in OBJ format.

Great_dodecahedron

Basics

The project 057scene from the repository grcis serves as the basis for this exercise. This is a working application that can retrieve a 3D object from a file (Wavefront OBJ format) or to generate it via an algorithm (this will be your code). The scene will then be displayed as a simple drawing with no visibility ("wireframe"). This image (bitmap) and the 3D object can be saved to disk (PNG or Wavefront OBJ format).
For the construction of your object, you modify the existing class Construction, located in the source file Construction.cs. The constructor you have to work on is the method Construction.AddMesh(). Do not forget that for smooth surfaces, you have to set the normal vectors at the vertices of the network! Work with the transformation matrix m: you have to transform all vertices and their normals!

Alternative Project (OpenGL)

For your solution, you can also use project 038 Trackball, which is implemented via OpenTK rendering (OpenGL), and offers rotating of an interactive 3D scene, are where you can create multiple instances of your object. If you want to use this framework instead, you can easily do so: the file Construction.cs is interchangeable between the two projects.

Results

Possible result objects are platonic solids (their walls have to consist only of triangles, though, so you would need to triangulate them), or a graph of the function of two variables, etc.
You can find inspiration in the nice book Atlas of geometry, for instance in sections 3.8 to 3.10, 6.

Technical Details

Within the application, there following resources exist: a 3D object SceneBrep to which you can add your vertices and triangles, a transformation matrix Matrix4, and a text parameter that can contain construction parameters that are specific to your chosen algorithm.
Remember that your method Construction.AddMesh() can be invoked repeatedly. Never return an empty object, and always return a new instance of the solid you are creating (with the given transformation matrix applied).

To allow users to manipulate pre-existing parameters that are specific to your solution (i.e. to save them typing work), you can specify the initial value of the text parameter param via the function InitParams().

After creating instances of your object, the method CheckCornerTable() runs, which checks the topology of the created model. You should check the text console ("Output" in Visual Studio) to see whether inconsistencies were found.

Methods Available for Mesh Construction

  • Vertices can be added via SceneBrep.AddVertex(). Don't forget to transform the points, if needed! (e.g. Vector3.TransformPosition())
  • Normal vectors can be set via SceneBrep.SetNormal(). Again, transform them first, if this is needed! (e.g. Vector3.TransformVector() - note the different method from the previous example: vectors and points transform differently!)
  • Triangles can be defined via SceneBrep.AddTriangle(i,j,k). For this, you have to use the vertex indices you defined earlier: the return value of SceneBrep.AddVertex() is the index of the vertex you just created.

Deadline

Hand in until: 14. 1. 2018

Points

Basis: 6 points (if a simple shape is successfully generated).
Bonus: up to 8 additional points for interesting content resp. interesting shapes

Project

Visual Studio projects: 038trackball or 057scene
The modified source file can be used interchangeably for both applications!

Source file

Modify and hand in the source file: Construction.cs
As a comment in the first line, please include your name!


Copyright (C) 2015 J. Pelikán & A. Wilkie, last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)