File: positioned_tet.c

package info (click to toggle)
regina-normal 4.93-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 28,576 kB
  • sloc: cpp: 86,815; ansic: 13,030; xml: 9,089; perl: 951; sh: 380; python: 273; makefile: 103
file content (106 lines) | stat: -rw-r--r-- 2,864 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
/*
 *	positioned_tet.c
 *
 *	This file provides the following functions for working with PositionedTets:
 *
 *		void		veer_left(PositionedTet *ptet);
 *		void		veer_right(PositionedTet *ptet);
 *		void		veer_backwards(PositionedTet *ptet);
 *		Boolean		same_positioned_tet(PositionedTet *ptet0, PositionedTet *ptet1);
 *		void		set_left_edge(EdgeClass *edge, PositionedTet *ptet);
 *
 *	Their use is described in kernel_prototypes.h.
 */

#include "kernel.h"


void veer_left(
	PositionedTet	*ptet)
{
	Permutation	left_gluing;
	FaceIndex	temp;

	left_gluing = ptet->tet->gluing[ptet->left_face];

	ptet->tet = ptet->tet->neighbor[ptet->left_face];

	temp				= ptet->near_face;
	ptet->near_face		= EVALUATE(left_gluing, ptet->left_face);
	ptet->left_face		= EVALUATE(left_gluing, temp);
	ptet->right_face	= EVALUATE(left_gluing, ptet->right_face);
	ptet->bottom_face	= EVALUATE(left_gluing, ptet->bottom_face);

	if (parity[left_gluing] == orientation_reversing)
		ptet->orientation = ! ptet->orientation;
}


void veer_right(
	PositionedTet	*ptet)
{
	Permutation	right_gluing;
	FaceIndex	temp;

	right_gluing = ptet->tet->gluing[ptet->right_face];

	ptet->tet = ptet->tet->neighbor[ptet->right_face];

	temp				= ptet->near_face;
	ptet->near_face		= EVALUATE(right_gluing, ptet->right_face);
	ptet->right_face	= EVALUATE(right_gluing, temp);
	ptet->left_face		= EVALUATE(right_gluing, ptet->left_face);
	ptet->bottom_face	= EVALUATE(right_gluing, ptet->bottom_face);

	if (parity[right_gluing] == orientation_reversing)
		ptet->orientation = ! ptet->orientation;
}


void veer_backwards(
	PositionedTet	*ptet)
{
	Permutation	near_gluing;
	FaceIndex	temp;

	near_gluing = ptet->tet->gluing[ptet->near_face];

	ptet->tet = ptet->tet->neighbor[ptet->near_face];

	temp				= ptet->left_face;
	ptet->left_face		= EVALUATE(near_gluing, ptet->right_face);
	ptet->right_face	= EVALUATE(near_gluing, temp);
	ptet->near_face		= EVALUATE(near_gluing, ptet->near_face);
	ptet->bottom_face	= EVALUATE(near_gluing, ptet->bottom_face);

	if (parity[near_gluing] == orientation_reversing)
		ptet->orientation = ! ptet->orientation;
}


Boolean same_positioned_tet(
	PositionedTet	*ptet0,
	PositionedTet	*ptet1)
{
	return (
		ptet0->tet			== ptet1->tet
	 && ptet0->near_face	== ptet1->near_face
	 && ptet0->left_face	== ptet1->left_face
	 && ptet0->right_face	== ptet1->right_face);
	/*
	 *	If three faces match, so must the fourth, and so must the orientation.
	 */
}


void set_left_edge(
	EdgeClass		*edge,
	PositionedTet	*ptet)
{
	ptet->tet			= edge->incident_tet;
	ptet->near_face		=   one_face_at_edge[edge->incident_edge_index];
	ptet->left_face		= other_face_at_edge[edge->incident_edge_index];
	ptet->right_face	= remaining_face[ptet->left_face][ptet->near_face];
	ptet->bottom_face	= remaining_face[ptet->near_face][ptet->left_face];
	ptet->orientation	= right_handed;
}