File: subdivide.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 (695 lines) | stat: -rw-r--r-- 19,221 bytes parent folder | download | duplicates (11)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
/*
 *	subdivide.c
 *
 *	This file contains the function
 *
 *		Triangulation *subdivide(Triangulation *manifold, char *new_name);
 *
 *	which accepts a Triangulation *manifold, copies it, and
 *	subdivides the copy as described below into a Triangulation
 *	with finite as well as ideal vertices.  The original
 *	triangulation is not changed.
 *
 *	Triangulations produced by subdivide() differ from
 *	ordinary triangulations in that they have finite vertices
 *	as well as ideal vertices.
 *
 *	At present, only the function fill_cusps() calls subdivide(),
 *	but other kernel functions could use it too, if the need arises.
 *
 *	Note:  subdivide() has a subtle dependence on the implementation
 *	of orient().  The first Tetrahedron on the new Triangulation's
 *	tet list has the correct orientation, and orient() must propogate
 *	that orientation to all the other Tetrahedra.
 *
 *	The function subdivide() subdivides each Tetrahedron of a
 *	Triangulation as follows.  First, a regular neighborhood of
 *	each ideal vertex is sliced off, to form its own new
 *	Tetrahedron.  Each such new Tetrahedron will have three finite
 *	vertices as well as the original ideal vertex.  The ideal
 *	vertex keeps the same VertexIndex as the original, while
 *	each of the three finite vertices inherits the VertexIndex
 *	of the nearest (other) ideal vertex of the original Tetrahedron.
 *	I wish I could provide a good illustration, but it's hard to
 *	embed 3-D graphics in ASCII files;  here's a 2-D illustration
 *	which shows the general idea:
 *
 *	                             original
 *	                              vertex
 *	                                #0
 *
 *	                              0 /\
 *	                               /  \
 *	                              /    \
 *	                             /      \
 *	                            /        \
 *	                         1 /__________\ 2
 *	                          /            \
 *	                         /              \
 *	                        /                \
 *	                       /                  \
 *	                      /                    \
 *	                     /                      \
 *	                  0 /\                      /\ 0
 *	                   /  \                    /  \
 *	                  /    \                  /    \
 *	                 /      \                /      \
 *	                /        \              /        \
 *	     original  /__________\____________/__________\  original
 *      vertex #1   1          2          1          2   vertex #2
 *
 *	After removing the four Tetrahedra just described, you are
 *	left with a solid which has four hexagonal faces and four
 *	triangular faces.  Please make yourself a sketch of a
 *	truncated tetrahedron to illustrate this.  Each hexagonal
 *	face is subdivided into six triangles by coning to the
 *	center:
 *
 *	                             original
 *	                              vertex
 *	                                #0
 *
 *	                                ..
 *	                               .  .
 *	                              .    .
 *	                             .      .
 *	                            .        .
 *	                         1 ____________ 2
 *	                          /\          /\
 *	                         /  \        /  \
 *	                        /    \      /    \
 *	                       /      \    /      \
 *	                      /        \  /        \
 *	                   0 /_________3\/__________\ 0
 *	                    .\          /\          /.
 *	                   .  \        /  \        /  .
 *	                  .    \      /    \      /    .
 *	                 .      \    /      \    /      .
 *	                .        \  /        \  /        .
 *	     original  . . . . . .\/__________\/. . . . . .  original
 *      vertex #1              2          1              vertex #2
 *
 *	The center vertex on each face gets the VertexIndex of the
 *	opposite vertex of the original Tetrahedron (which equals the
 *	FaceIndex of the face being subdivided).
 *	Finally, the truncated tetrahedron is subdivided by coning
 *	to the center.  This creates 28 Tetrahedron (6 for each of
 *	the four hexagonal faces, plus 1 for each of the four triangular
 *	faces).  The vertex at the center of the truncated tetrahedron
 *	cannot be given a canonical VertexIndex common to all incident
 *	Tetrahedra.  Instead, each incident Tetrahedron assigns it
 *	the unique index not yet used by that Tetrahedron.
 *
 *	This canonical scheme for numbering the vertices makes the
 *	calculation of the gluing Permutations very easy.  "Internal"
 *	gluings (i.e. between two new Tetrahedra belonging to same old
 *	Tetrahedron) may be readily deduced from the above definitions.
 *	Because the numbering scheme is canonical, all "external" gluings
 *	(i.e. between two new Tetrahedra belonging to different old
 *	Tetrahedra) will be the same as the corresponding gluing of the
 *	original Tetrahedron.  (Yes, I realize that the above definitions
 *	of "internal" and "external" aren't quite right in the case of
 *	an original Tetrahedron glued to itself, but I hope you understood
 *	what I said anyhow.)
 */

#include "kernel.h"

/*
 *	If you are not familiar with SnapPea's "Extra" field in
 *	the Tetrahedron data structure, please see the explanation
 *	preceding the Extra typedef in kernel_typedefs.h.
 *
 *	Subdivide() uses an Extra field in each Tetrahedron of the
 *	old_triangulation to keep track of the 32 corresponding
 *	Tetrahedra in the new_triangulation.  Please see the
 *	documentation above for an explanation of the subdivision
 *	algorithm.  If you drew a sketch illustrating the subdivision,
 *	it will be helpful in understanding the fields of the Extra struct.
 */

struct extra
{
	/*
	 *	The first four Tetrahedra lopped off in the above
	 *	algorithm will be called "outer vertex Tetrahedra".
	 *	outer_vertex_tet[i] is a pointer to the outer vertex
	 *	Tetrahedron at vertex i of the old Tetrahedron.
	 */

	Tetrahedron	*outer_vertex_tet[4];

	/*
	 *	The "inner vertex Tetrahedra" are the remaining
	 *	Tetrahedra which are naturally associated to the
	 *	ideal vertices of the old Tetrahedron.
	 *	inner_vertex_tet[i] is a pointer to the new Tetrahedron
	 *	which meets outer_vertex_tet[i] along it's i-th face.
	 */

	Tetrahedron *inner_vertex_tet[4];

	/*
	 *	The "edge Tetrahedra" are the 12 Tetrahedra which have
	 *	precisely one edge contained within an edge of the
	 *	old Tetrahedron.  edge_tet[i][j] is the Tetrahedron
	 *	which has a face contained in face i of the old
	 *	Tetrahedron, on the side (of face i) opposite vertex j.
	 *	edge_tet[i][j] is defined iff i != j.
	 */

	Tetrahedron *edge_tet[4][4];

	/*
	 *	The "face Tetrahedra" are the 12 remaining Tetrahedra.
	 *	face_tet[i][j] has a face contained in face i of the
	 *	old Tetrahedron, on the side near vertex j (of the old
	 *	Tetrahedron).  face_tet[i][j] is defined iff i != j.
	 */

	Tetrahedron *face_tet[4][4];

};

static void	attach_extra(Triangulation *manifold);
static void	free_extra(Triangulation *manifold);
static void	create_new_tetrahedra(Triangulation *new_triangulation, Triangulation *old_triangulation);
static void	allocate_new_tetrahedra(Triangulation *new_triangulation, Triangulation *old_triangulation);
static void	set_outer_vertex_tets(Tetrahedron *old_tet);
static void	set_inner_vertex_tets(Tetrahedron *old_tet);
static void	set_edge_tets(Tetrahedron *old_tet);
static void	set_face_tets(Tetrahedron *old_tet);
static void	create_new_cusps(Triangulation *new_triangulation, Triangulation *old_triangulation);
static void	create_real_cusps(Triangulation *new_triangulation, Triangulation *old_triangulation);


Triangulation *subdivide(
	Triangulation	*old_triangulation,
	char			*new_name)
{
	Triangulation	*new_triangulation;

	/*
	 *	Allocate storage for the new_triangulation
	 *	and initialize it.
	 *
	 *	(In spite of what I wrote at the top of this file,
	 *	we don't explicitly make a copy of *old_triangulation,
	 *	but instead we create *new_triangulation from scratch.)
	 */

	new_triangulation = NEW_STRUCT(Triangulation);
	initialize_triangulation(new_triangulation);
	new_triangulation->name = NEW_ARRAY(strlen(new_name) + 1, char);
	strcpy(new_triangulation->name, new_name);
	new_triangulation->num_tetrahedra	= 32 * old_triangulation->num_tetrahedra;
	new_triangulation->num_cusps		= old_triangulation->num_cusps;
	new_triangulation->num_or_cusps		= old_triangulation->num_or_cusps;
	new_triangulation->num_nonor_cusps	= old_triangulation->num_nonor_cusps;

	/*
	 *	Attach an Extra field to each Tetrahedron in the
	 *	old_triangulation, to keep track of the corresponding
	 *	32 Tetrahedra in the new_triangulation.
	 */

	attach_extra(old_triangulation);

	/*
	 *	Create the new Tetrahedra.
	 *	Set fields such as tet->neighbor and tet->gluing,
	 *	which can be determined immediately.
	 *	Postpone determination of fields such as tet->cusp
	 *	and tet->edge_class.
	 */

	create_new_tetrahedra(new_triangulation, old_triangulation);

	/*
	 *	Copy the Cusps from the old_triangulation to
	 *	the new_triangulation.  (Technical note:  functions
	 *	called by create_new_cusps() rely on the fact that
	 *	create_new_tetrahedra() initializes all tet->cusp
	 *	fields to NULL.)
	 */

	create_new_cusps(new_triangulation, old_triangulation);

	/*
	 *	We're done with the Extra fields, so free them.
	 */

	free_extra(old_triangulation);

	/*
	 *	Add the bells and whistles.
	 */

	create_edge_classes(new_triangulation);
	orient_edge_classes(new_triangulation);
	orient(new_triangulation);

	/*
	 *	Return the new_triangulation.
	 */

	return new_triangulation;
}


static void attach_extra(
	Triangulation	*manifold)
{
	Tetrahedron	*tet;

	for (tet = manifold->tet_list_begin.next;
		 tet != &manifold->tet_list_end;
		 tet = tet->next)
	{
		/*
		 *	Make sure no other routine is using the "extra"
		 *	field in the Tetrahedron data structure.
		 */
		if (tet->extra != NULL)
			uFatalError("attach_extra", "filling");

		/*
		 *	Attach the locally defined struct extra.
		 */
		tet->extra = NEW_STRUCT(Extra);
	}
}


static void free_extra(
	Triangulation	*manifold)
{
	Tetrahedron	*tet;

	for (tet = manifold->tet_list_begin.next;
		 tet != &manifold->tet_list_end;
		 tet = tet->next)
	{
		/*
		 *	Free the struct extra.
		 */
		my_free(tet->extra);

		/*
		 *	Set the extra pointer to NULL to let other
		 *	modules know we're done with it.
		 */
		tet->extra = NULL;
	}
}


static void	create_new_tetrahedra(
	Triangulation	*new_triangulation,
	Triangulation	*old_triangulation)
{
	Tetrahedron	*old_tet;

	/*
	 *	Allocate the memory for all the new Tetrahedra.
	 *	We do this before setting any of the fields, so
	 *	that the tet->neighbor fields will all have something
	 *	to point to.
	 */

	allocate_new_tetrahedra(new_triangulation, old_triangulation);

	/*
	 *	For each Tetrahedron in the old_triangulation, we want
	 *	to set the various fields of the 32 corresponding Tetrahedra
	 *	in the new triangulation.  The new Tetrahedra are accessed
	 *	through the Extra fields of the old Tetrahedra.
	 */

	for (old_tet = old_triangulation->tet_list_begin.next;
		 old_tet != &old_triangulation->tet_list_end;
		 old_tet = old_tet->next)
	{
		set_outer_vertex_tets(old_tet);
		set_inner_vertex_tets(old_tet);
		set_edge_tets(old_tet);
		set_face_tets(old_tet);
	}
}


static void	allocate_new_tetrahedra(
	Triangulation	*new_triangulation,
	Triangulation	*old_triangulation)
{
	int			i,
				j;
	Tetrahedron	*old_tet,
				*new_tet;

	/*
	 *	For each Tetrahedron in the old_triangulation, we want
	 *	to allocate and initialize the 32 corresponding Tetrahedra
	 *	in the new_triangulation.
	 */

	/*
	 *	IMPORTANT:  It's crucial that one of the outer vertex tetrahedra
	 *	appears first on new_triangulation's tet list, so that orient()
	 *	will preserve the manifold's original orientation.
	 */

	for (old_tet = old_triangulation->tet_list_begin.next;
		 old_tet != &old_triangulation->tet_list_end;
		 old_tet = old_tet->next)
	{
		for (i = 0; i < 4; i++)
		{
			new_tet = NEW_STRUCT(Tetrahedron);
			initialize_tetrahedron(new_tet);
			old_tet->extra->outer_vertex_tet[i] = new_tet;
			INSERT_BEFORE(new_tet, &new_triangulation->tet_list_end);
		}

		for (i = 0; i < 4; i++)
		{
			new_tet = NEW_STRUCT(Tetrahedron);
			initialize_tetrahedron(new_tet);
			old_tet->extra->inner_vertex_tet[i] = new_tet;
			INSERT_BEFORE(new_tet, &new_triangulation->tet_list_end);
		}

		for (i = 0; i < 4; i++)
			for (j = 0; j < 4; j++)
			{
				if (i == j)
				{
					old_tet->extra->edge_tet[i][j] = NULL;
					continue;
				}

				new_tet = NEW_STRUCT(Tetrahedron);
				initialize_tetrahedron(new_tet);
				old_tet->extra->edge_tet[i][j] = new_tet;
				INSERT_BEFORE(new_tet, &new_triangulation->tet_list_end);
			}

		for (i = 0; i < 4; i++)
			for (j = 0; j < 4; j++)
			{
				if (i == j)
				{
					old_tet->extra->face_tet[i][j] = NULL;
					continue;
				}

				new_tet = NEW_STRUCT(Tetrahedron);
				initialize_tetrahedron(new_tet);
				old_tet->extra->face_tet[i][j] = new_tet;
				INSERT_BEFORE(new_tet, &new_triangulation->tet_list_end);
			}

	}
}


static void set_outer_vertex_tets(
	Tetrahedron *old_tet)
{
	int			i,
				j,
				k,
				l;
	Tetrahedron	*new_tet;

	/*
	 *	Set the fields for each of the four outer_vertex_tets.
	 */

	for (i = 0; i < 4; i++)
	{
		/*
		 *	For notational clarity, let new_tet be a pointer
		 *	to the outer_vertex_tet under consideration.
		 */

		new_tet = old_tet->extra->outer_vertex_tet[i];

		/*
		 *	Set the new_tet's four neighbor fields.
		 */

		for (j = 0; j < 4; j++)
			new_tet->neighbor[j] =
				(i == j) ?
				old_tet->extra->inner_vertex_tet[i] :
				old_tet->neighbor[j]->extra->outer_vertex_tet[EVALUATE(old_tet->gluing[j], i)];

		/*
		 *	Set the new_tet's four gluing fields.
		 */

		for (j = 0; j < 4; j++)
			new_tet->gluing[j] =
				(i == j) ?
				IDENTITY_PERMUTATION :
				old_tet->gluing[j];

		/*
		 *	Copy the peripheral curves from the old_tet to the ideal
		 *	vertex of the new_tet.  The peripheral curves of
		 *	finite vertices have already been set to zero.
		 */

		for (j = 0; j < 2; j++)
			for (k = 0; k < 2; k++)
				for (l = 0; l < 4; l++)
					new_tet->curve[j][k][i][l] = old_tet->curve[j][k][i][l];

	}
}


static void set_inner_vertex_tets(
	Tetrahedron *old_tet)
{
	int			i,
				j;
	Tetrahedron	*new_tet;

	/*
	 *	Set the fields for each of the four inner_vertex_tets.
	 */

	for (i = 0; i < 4; i++)
	{
		/*
		 *	For notational clarity, let new_tet be a pointer
		 *	to the inner_vertex_tet under consideration.
		 */

		new_tet = old_tet->extra->inner_vertex_tet[i];

		/*
		 *	Set the new_tet's four neighbor fields.
		 */

		for (j = 0; j < 4; j++)
			new_tet->neighbor[j] =
				(i == j) ?
				old_tet->extra->outer_vertex_tet[i] :
				old_tet->extra->face_tet[j][i];

		/*
		 *	Set the new_tet's four gluing fields.
		 */

		for (j = 0; j < 4; j++)
			new_tet->gluing[j] = IDENTITY_PERMUTATION;

	}
}


static void set_edge_tets(
	Tetrahedron *old_tet)
{
	int			i,
				j,
				k,
				l;
	Tetrahedron	*new_tet;

	/*
	 *	Set the fields for each of the twelve edge_tets.
	 */

	for (i = 0; i < 4; i++)
		for (j = 0; j < 4; j++)
		{
			/*
			 *	Only the case i != j is meaningful.
			 */

			if (i == j)
				continue;

			/*
			 *	For notational clarity, let new_tet be a pointer
			 *	to the edge_tet under consideration.
			 */

			new_tet = old_tet->extra->edge_tet[i][j];

			/*
			 *	Let i, j, k and l be the VertexIndices of
			 *	new_tet.  i and j are already defined as
			 *	loop variables.  We define k and l here.
			 */

			k = remaining_face[i][j];
			l = remaining_face[j][i];

			/*
			 *	Set the new_tet's four neighbor fields.
			 */

			new_tet->neighbor[i] = old_tet->extra->edge_tet[j][i];
			new_tet->neighbor[j] = old_tet->neighbor[i]->extra->edge_tet[EVALUATE(old_tet->gluing[i], i)][EVALUATE(old_tet->gluing[i], j)];
			new_tet->neighbor[k] = old_tet->extra->face_tet[i][k];
			new_tet->neighbor[l] = old_tet->extra->face_tet[i][l];

			/*
			 *	Set the new_tet's four gluing fields.
			 */

			new_tet->gluing[i] = CREATE_PERMUTATION(i,j,j,i,k,k,l,l);
			new_tet->gluing[j] = old_tet->gluing[i];
			new_tet->gluing[k] = CREATE_PERMUTATION(i,i,j,k,k,j,l,l);
			new_tet->gluing[l] = CREATE_PERMUTATION(i,i,j,l,k,k,l,j);

		}
}


static void set_face_tets(
	Tetrahedron *old_tet)
{
	int			i,
				j,
				k,
				l;
	Tetrahedron	*new_tet;

	/*
	 *	Set the fields for each of the twelve face_tets.
	 */

	for (i = 0; i < 4; i++)
		for (j = 0; j < 4; j++)
		{
			/*
			 *	Only the case i != j is meaningful.
			 */

			if (i == j)
				continue;

			/*
			 *	For notational clarity, let new_tet be a pointer
			 *	to the face_tet under consideration.
			 */

			new_tet = old_tet->extra->face_tet[i][j];

			/*
			 *	Let i, j, k and l be the VertexIndices of
			 *	new_tet.  i and j are already defined as
			 *	loop variables.  We define k and l here.
			 */

			k = remaining_face[i][j];
			l = remaining_face[j][i];

			/*
			 *	Set the new_tet's four neighbor fields.
			 */

			new_tet->neighbor[i] = old_tet->extra->inner_vertex_tet[j];
			new_tet->neighbor[j] = old_tet->neighbor[i]->extra->face_tet[EVALUATE(old_tet->gluing[i], i)][EVALUATE(old_tet->gluing[i], j)];
			new_tet->neighbor[k] = old_tet->extra->edge_tet[i][k];
			new_tet->neighbor[l] = old_tet->extra->edge_tet[i][l];

			/*
			 *	Set the new_tet's four gluing fields.
			 */

			new_tet->gluing[i] = IDENTITY_PERMUTATION;
			new_tet->gluing[j] = old_tet->gluing[i];
			new_tet->gluing[k] = CREATE_PERMUTATION(i,i,j,k,k,j,l,l);
			new_tet->gluing[l] = CREATE_PERMUTATION(i,i,j,l,k,k,l,j);

		}
}


static void	create_new_cusps(
	Triangulation	*new_triangulation,
	Triangulation	*old_triangulation)
{
	/*
	 *	The Cusp data structures for the real cusps are
	 *	handled separately from the Cusp data structures
	 *	for the finite vertices.
	 */

	create_real_cusps(new_triangulation, old_triangulation);
	create_fake_cusps(new_triangulation);
}


static void	create_real_cusps(
	Triangulation	*new_triangulation,
	Triangulation	*old_triangulation)
{
	Cusp		*old_cusp,
				*new_cusp;
	Tetrahedron	*old_tet;
	int			i;

	/*
	 *	The Cusp data structures for the ideal vertices
	 *	in the new_triangulation are essentially just
	 *	copied from those in the old_triangulation.
	 */

	/*
	 *	Allocate memory for the new Cusps, copy in the
	 *	values from the old cusps, and put them on the
	 *	queue.
	 */

	for (old_cusp = old_triangulation->cusp_list_begin.next;
		 old_cusp != &old_triangulation->cusp_list_end;
		 old_cusp = old_cusp->next)
	{
		new_cusp = NEW_STRUCT(Cusp);
		*new_cusp = *old_cusp;
		new_cusp->is_finite = FALSE;
		INSERT_BEFORE(new_cusp, &new_triangulation->cusp_list_end);
		old_cusp->matching_cusp = new_cusp;
	}

	/*
	 *	Set the cusp field for ideal vertices in
	 *	the new_triangulation.
	 */

	for (old_tet = old_triangulation->tet_list_begin.next;
		 old_tet != &old_triangulation->tet_list_end;
		 old_tet = old_tet->next)

		for (i = 0; i < 4; i++)

			old_tet->extra->outer_vertex_tet[i]->cusp[i] = old_tet->cusp[i]->matching_cusp; 
}