File: link_projection.h

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 (151 lines) | stat: -rw-r--r-- 3,848 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
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
/*
 *	link_projection.h
 *
 *	This file provides the data format in which the UI passes
 *	link projections to the kernel.  All typedefs begin with
 *	"KLP" ("Kernel Link Projection") to avoid name conflicts
 *	with the UI's private link projection data structure.
 */

#ifndef _link_projection_
#define _link_projection_

typedef struct KLPCrossing		KLPCrossing;
typedef struct KLPProjection	KLPProjection;

/*
 *	The KLPStrandType and KLPDirectionType enums are used to index
 *	array entires, so their values must be 0 and 1.  (But the code
 *	does not rely on which has value 0 and which has value 1.)
 *
 *	JRW 2000/11/12   Use fake "typedef enums" instead of real ones,
 *	for the reasons explained at the top of kernel_typedefs.h.
 */

/*
 *	If you view a crossing (from above) so that the strands go in the
 *	direction of the postive x- and y-axes, then the strand going in
 *	the x-direction is the KLPStrandX, and the strand going in the
 *	y-direction is the KLPStrandY.  Note that this definition does not
 *	depend on which is the overstrand and which is the understrand.
 *
 *						       KLPStrandY
 *						           ^
 *						           |
 *						       ----+---> KLPStrandX
 *						           |
 *						           |
 */
typedef int KLPStrandType;
enum
{
	KLPStrandX = 0,
	KLPStrandY,
	KLPStrandUnknown
};

/*
 *	The backward and forward directions are what you would expect.
 *
 *				KLPBackward   --------->   KLPForward
 */
typedef int KLPDirectionType;
enum
{
	KLPBackward = 0,
	KLPForward,
	KLPDirectionUnknown
};

/*
 *	A crossing is either a clockwise (CL) or counterclockwise (CCL)
 *	half twist.
 *
 *		          _   _                       _   _
 *		         |\   /|                     |\   /|
 *		           \ /                         \ /
 *		            /                           \
 *		           / \                         / \
 *		          /   \                       /   \
 *		      KLPHalfTwistCL              KLPHalfTwistCCL
 */
typedef int KLPCrossingType;
enum
{
	KLPHalfTwistCL,
	KLPHalfTwistCCL,
	KLPCrossingTypeUnknown
};


/*
 *	A link projection is essentially an array of crossings.
 */
struct KLPProjection
{
	/*
	 *	How many crossings are there?
	 */
	int			num_crossings;

	/*
	 *	How many free loops (i.e. link components with no crossings) are
	 *	there?  For a hyperbolic link, the number of free loops must be 0.
	 */
	int			num_free_loops;

	/*
	 *	How many link components (including the free loops) are there?
	 */
	int			num_components;

	/*
	 *	Here's a pointer to the array of crossings.
	 */
	KLPCrossing	*crossings;
};

/*
 *	Each crossing has pointers to its four neighbors,
 *	along with information about its own handedness.
 */
struct KLPCrossing
{
	/*
	 *	The four neighbors are
	 *
	 *		neighbor[KLPStrandX][KLPBackward]
	 *		neighbor[KLPStrandX][KLPForward ]
	 *		neighbor[KLPStrandY][KLPBackward]
	 *		neighbor[KLPStrandY][KLPForward ]
	 *
	 *	For example, if you follow the x-strand in the backward direction,
	 *	you'll arrive at neighbor[KLPStrandX][KLPBackward].
	 */
	KLPCrossing		*neighbor[2][2];

	/*
	 *	When you arrive at a neighbor, you could arrive at either the
	 *	x-strand or the y-strand.  The strand[][] field says which it is.
	 *
	 *	For example, if you follow the x-strand in the backward direction,
	 *	you'll arrive at strand[KLPStrandX][KLPBackward].
	 */
	KLPStrandType	strand[2][2];

	/*
	 *	The crossing is either a clockwise or counterclockwise half twist.
	 */
	KLPCrossingType	handedness;

	/*
	 *	To which component of the link does each strand belong?  A link
	 *	component is given by an integer from 0 to (#components - 1).
	 *	For example, if component[KLPStrandX] == 0 and
	 *	component[KLPStrandY] == 2, then the x-strand is part of component
	 *	number 0 and the y-strand is part of component number 2.
	 */
	int				component[2];
};

#endif