| |||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||
We will be modifying this program later to allow more complicated motions than fixed linear motion, so keep this in mind.
You should run your code on examples on the web site at http://www.cs.unc.edu/~snoeyink/c/c205/DynTri/examples3.htm. These examples are ascii files with the first line being the number of points n, and the subsequent lines being the point and motion vector coordinates separated by spaces, px py vx vy, for the points p1 through pn.
For these three examples, you should produce ascii output with your name, the list of points/vectors, the list of edges for the initial triangulation, and the list of swap events/times in order. I'll make a Java applet available that will parse such a file and display the moving triangulation so that you can check.
In more detail: Any line starting with ``%'' will be considered a comment. The first line should be a comment with your name, and which exercise is being solved: A, B, or C or one you've made up.
Then list the points/vectors in the same form as the input: One line with n followed by the coordinates separated by spaces, px py vx vy, for p1 through pn in the order that you will refer to them.
Then list the number edges of the initial triangulation, and the edges as pairs of point indices. Order will not be considered important; you can separate these one per line or by spaces.
Finally, list the times and vertex indices involved in swaps, one per line. If at time t you swap ij for kl, the line would read: t i j k l. When swapping an edge of the convex hull, you can have an index of zero to denote a swap with a point at infinity (as in the example below).
%Jack Snoeyink, small example
%points
4
0 0 0 0
4 0 0 0
2 4 0 -3
2 2 2 2
%initial triangle edges
6
1 2
2 3
1 3
1 4
2 4
3 4
%swaps
0.241694 2 3 4 00 %point added to hull
0.666667 1 4 2 3 %normal swap
0.666667 3 00 4 1 %optional, to restore convex hull.
You may paste text like this into the applet at http://www.cs.unc.edu/~snoeyink/c/c205/DynTri/ to see the points, edges, and swaps.
There are some hints available on the web pages. Check out the open problem in the dynamic triangulation puzzle, too.
|
|
The intersection is the set of all points that satisfy both equations. We'd like to be able to trace this curve as a parametric vector-valued function f(t) = ( x(t), y(t), z(t)). Here is a table with values of the three coordinate functions if we parameterize with t Î [0,1].
| t | x(t) | y(t) | z(t) |
| 0 | 1 | 0 | 1/2 |
| 1/8 | Ö3/2 | Ö3/2 | 0 |
| 1/4 | 0 | 1 | -1/2 |
| 3/8 | -Ö3/2 | Ö3/2 | 0 |
| 1/2 | -1 | 0 | 1/2 |
| 5/8 | -Ö3/2 | -Ö3/2 | 0 |
| 3/4 | 0 | -1 | -1/2 |
| 7/8 | Ö3/2 | -Ö3/2 | 0 |
| 1 | 1 | 0 | 1/2 |
Interpolate functions for x(t), y(t), z(t). The interpolation methods you should use are: