The task is to construct a 3D representation of a generalized
Lissajous curve.
The curve is represented by simple equations given in the parametric form.
Your task is to "wrap" the curve into a triangle mesh.
You will be given an environment with implemented
**boundary model of the scene** (that is, a triangle mesh) enriched by the
**"Corner-table"**.
Your result should be a correct representation of the 3D geometry in memory,
which the application can render on the screen or save to a file.

You will build on the project ** 086shaders** from the
grcis repository (make sure to

To construct your geometry, you will modify the prepared class

You will have to respect the given transformation matrix

You will have to "wrap" the curve by a triangle mesh so that its shape is nicely visible.
An ideal solution is to use a cylindrical tube with a circular or similar cross-section - that's up to you.
(If you want to be creative, the cross-section could gradually change along the curve.)
A smooth appearance of the tube can be improved by shading, for which you will have to set
per-vertex normals (which the GPU will interpolate across the triangles).

The Lissajous curve is defined in a parametric form using goniometric functions.
For this reason, its tangent vector can be easily calculated by taking the first derivative of the
defining equaltions.
Having the tangent vector, one can find a plane perpendicular to the tangent (and therefore
also to the curve at a given point).
In this plane you may calculate several vertices "wrapping" the curve.
The respective vertices of the neigboring cross-sections should then be connected
to create a smooth mesh approximating the tube.

The Wikipedia page on Lissajous curve.
A 3D generalization is simple, you simply add another coordinate **Z**, see
Lissajous knot.
We recommend to reorganize the formulas so that they only contain the cosine function
(with an appropriate phase shift, just like on the Lissajous knot
page).

Another possible extension would be adding another term (another cosine with
a different frequency and phase shift) into all the equations, such as for the
Rose curve.

Calculation of the **domain**: Lissajous (and "Rose") curve
is cyclic (i.e. periodic), that is, the parameter **t** should run from
zero to a multiple of **PI**. It is not entirely trivial to find
out this interval, but your task is to try. Hint: work with
frequency coefficient as rational numbers.

You will be given a 3D object ** SceneBrep**, into which you will
add the created geometry. You will be given a transformation matrix
of the instance

For simpler debugging, you may enter an initial value of the text parameter ** param**
- use the function

After you have created 1 to 8 instances of your geometry, the procedure `CheckCornerTable()`
will be run, which will check the consistency of the topology (i.e. mesh connectivity) of your geometry.
If you see a non-zero number of errors, you should open the "Output" window in Visual Studio an check
the detected inconsistencies.

- geometry vertices are added using the method
. Remember to first transform the vertices thorough a given transformation matrix (using e.g.`SceneBrep.AddVertex()`).`Vector3.TransformPosition()` - normal vectors are set using the method
. Remember to first transform the vertices thorough a given transformation matrix (using e.g.`SceneBrep.SetNormal()`).`Vector3.TransformVector()` - triangles are initialized using the method
. Use indices of three previously added vertices (the vertex index is the return value of`SceneBrep.AddTriangle(i,j,k)`).`SceneBrep.AddVertex()`

The due date is: **30. 12. 2018**

Base: **6 pts** - implementation of a generalized Lissajous curve wrapped in at least some trivial way by triangles.

Bonus **up to 4 pts** for a nice wrapping by a "tube" and for setting colors (Hhow about using that cyclic mandala palette you once created...)

Bonus **up to 2 pts** for an automatic calculation of the domain of the curve.

Bonus **up to 3 pts** for generation of normal vectors (will be seen when shading is on and after importing the geometry in 3ds Max).

Bonus **up to 3 pts** for further extensions (e.g. the "Rose" curve).

Bonus **up to 5 pts**: for a "beauty" render of your geometry in 3ds Max / Corona rendrer. The actual number of points will depend on the complexity of your setup and the aesthetic quality of the output.

Visual Studio project: `086shader`

Make sure to **always SVN update** just before you start working on a new project.

Modify and hand in the file: ** Construction.cs**
Remember to put your name in the function

Should you decide to implement the optional 3ds Max beauty render, please include up to three different, high-resolution (around 2K) rendered images. Image framing / aspect ratio is entirely up to you.

Copyright (C) 2010-2018 J.Pelikán and J.Krivánek, last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)