File: tidy_peripheral_curves.c

package info (click to toggle)
snappea 3.0d3-20.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,896 kB
  • ctags: 3,582
  • sloc: ansic: 33,469; sh: 8,293; python: 7,623; makefile: 240
file content (109 lines) | stat: -rw-r--r-- 2,922 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 *	tidy_peripheral_curves.c
 *
 *
 *	This file provides the function
 *
 *		void tidy_peripheral_curves(Triangulation *manifold);
 *
 *	which is used within the kernel to clean up a set of peripheral
 *	curves.
 *
 *	Functions which alter triangulations maintain a set of peripheral
 *	curves which is technically correct, but suffers two faults.
 *	A minor fault is that the peripheral curves wind around a lot,
 *	and therefore create unnecessarily complicated cusp equations.
 *	The more serious fault is that the curves may evolve trivial loops;
 *	that is, a single meridian or longitude will have several components,
 *	one of which is the correct curve while the others are homotopically
 *	trivial loops.  Such trivial loops introduce erroneous multiples
 *	of 2pi into the computed holonomies, and thereby foul up the
 *	computation of hyperbolic structures.
 *
 *	The function tidy_peripheral_curves()
 *
 *	(1)	makes a copy of the existing peripheral curves,
 *	(2)	calls peripheral_curves() to create a nice set of
 *		peripheral curves, and
 *	(3)	expresses the original curves as linear combinations
 *		of the nice curves.
 *
 *	The result is an "efficient" set of curves, with no trivial
 *	loops.
 */

#include "kernel.h"


/*
 *	scratch_curves[0] will store the original peripheral curves.
 *	scratch_curves[1] will store the   nice   peripheral curves.
 */

#define original_curves	0
#define nice_curves		1


static void	compute_new_curves(Triangulation *manifold);


void tidy_peripheral_curves(
	Triangulation	*manifold)
{
	/*
	 *	Copy the original peripheral curves to the
	 *	scratch_curve[original_curves] fields of the Tetrahedra.
	 */
	copy_curves_to_scratch(manifold, original_curves, TRUE);

	/*
	 *	Compute a nice set of peripheral curves.
	 */
	peripheral_curves(manifold);

	/*
	 *	Copy the nice peripheral curves to the
	 *	scratch_curve[nice_curves] fields of the Tetrahedra.
	 */
	copy_curves_to_scratch(manifold, nice_curves, FALSE);

	/*
	 *	Compute the intersection numbers of the original curves
	 *	with the nice curves.
	 */
	compute_intersection_numbers(manifold);

	/*
	 *	Compute the new curves as linear combinations of the
	 *	nice curves.
	 */
	compute_new_curves(manifold);
}


static void compute_new_curves(
	Triangulation	*manifold)
{
	Tetrahedron	*tet;
	int			h,
				i,
				j,
				k;

	for (tet = manifold->tet_list_begin.next;
		 tet != &manifold->tet_list_end;
		 tet = tet->next)

		for (h = 0; h < 2; h++)				/*	which curve					*/
			for (i = 0; i < 2; i++)			/*	which sheet					*/
				for (j = 0; j < 4; j++)		/*	which vertex				*/
					for (k = 0; k < 4; k++)	/*	which side of that vertex	*/

						tet->curve[h][i][j][k] =
							(j == k) ?
							0 :
							- tet->cusp[j]->intersection_number[h][L]
								* tet->scratch_curve[nice_curves][M][i][j][k]
							+ tet->cusp[j]->intersection_number[h][M]
								* tet->scratch_curve[nice_curves][L][i][j][k];
}