Esempio n. 1
0
FuncResult change_peripheral_curves(
	      Triangulation	*manifold,
	CONST MatrixInt22	change_matrices[])
{
	int			i,
				v,
				f,
				old_m,
				old_l;
	double		old_m_coef,	/* changed from int to double, JRW 2000/01/18 */
				old_l_coef;
	Tetrahedron	*tet;
	Cusp		*cusp;
	Complex		old_Hm,
				old_Hl;

	/*
	 *	First make sure all the change_matrices have determinant +1.
	 */

	for (i = 0; i < manifold->num_cusps; i++)
		if (DET2(change_matrices[i]) != +1)
			return func_bad_input;

	/*
	 *	The change_matrices for Klein bottle cusps must have zeros in the
	 *	off-diagonal entries.  (Nothing else makes sense topologically.)
	 */

	for (cusp = manifold->cusp_list_begin.next;
		 cusp != &manifold->cusp_list_end;
		 cusp = cusp->next)

		if (cusp->topology == Klein_cusp)

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

				if (change_matrices[cusp->index][i][!i] != 0)

					uFatalError("change_peripheral_curves", "change_peripheral_curves");

	/*
	 *	Change the peripheral curves according to the change_matrices.
	 *	As stated at the top of this file, the transformation rule is
	 *
	 *		| new m |   |                    | | old m |
	 *		|       | = | change_matrices[i] | |       |
	 *		| new l |   |                    | | old l |
	 */

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

		for (i = 0; i < 2; i++)				/*	which orientation	*/

			for (v = 0; v < 4; v++)			/*	which vertex		*/

				for (f = 0; f < 4; f++)		/*	which side			*/
				{
					old_m = tet->curve[M][i][v][f];
					old_l = tet->curve[L][i][v][f];

					tet->curve[M][i][v][f]
						= change_matrices[tet->cusp[v]->index][0][0] * old_m
						+ change_matrices[tet->cusp[v]->index][0][1] * old_l;
					tet->curve[L][i][v][f]
						= change_matrices[tet->cusp[v]->index][1][0] * old_m
						+ change_matrices[tet->cusp[v]->index][1][1] * old_l;
				}

	/*
	 *	Change the Dehn filling coefficients to reflect the new
	 *	peripheral curves.  That is, we want the Dehn filling curves
	 *	to be topologically the same as before, even though the
	 *	coefficients will be different because we changed the basis.
	 *
	 *	To keep our thinking straight, let's imagine all peripheral
	 *	curves -- old and new -- in terms of some arbitrary but
	 *	fixed basis for pi_1(T^2) = Z + Z.  We never actually compute
	 *	such a basis, but it helps keep our thinking straight.
	 *	Relative to this fixed basis, we have
	 *
	 *				old m = (old m [0],  old m [1])
	 *				old l = (old l [0],  old l [1])
	 *				new m = (new m [0],  new m [1])
	 *				new l = (new l [0],  new l [1])
	 *
	 *	Note that these m's and l's are curves, not coefficients!
	 *	They are elements of pi_1(T^2) = Z + Z.
	 *
	 *	We can then rewrite the above transformation rule, with
	 *	each peripheral curve (old m, old l, new m and new l)
	 *	appearing as a row in a 2 x 2 matrix:
	 *
	 *		| <--new m--> |   |                    | | <--old m--> |
	 *		|             | = | change_matrices[i] | |             |
	 *		| <--new l--> |   |                    | | <--old l--> |
	 *
	 *	We can invert the change_matrix to solve for the old curves
	 *	in terms of the new ones:
	 *												-1
	 *		| <--old m--> |   |                    |   | <--new m--> |
	 *		|             | = | change_matrices[i] |   |             |
	 *		| <--old l--> |   |                    |   | <--new l--> |
	 *
	 *	The Dehn filling curve is
	 *
	 *		old_m_coef * old_m  +  old_l_coef * old_l
	 *
	 *		= old_m_coef * [  change_matrices[i][1][1] * new_m
	 *						- change_matrices[i][0][1] * new_l]
	 *		+ old_l_coef * [- change_matrices[i][1][0] * new_m
	 *						+ change_matrices[i][0][0] * new_l]
	 *
	 *		= new_m * [  old_m_coef * change_matrices[i][1][1]
	 *				   - old_l_coef * change_matrices[i][1][0] ]
	 *		+ new_l * [- old_m_coef * change_matrices[i][0][1]
	 *				   + old_l_coef * change_matrices[i][0][0] ]
	 *
	 *	Therefore
	 *
	 *		new_m_coef =   old_m_coef * change_matrices[i][1][1]
	 *					 - old_l_coef * change_matrices[i][1][0]
	 *		new_l_coef = - old_m_coef * change_matrices[i][0][1]
	 *					 + old_l_coef * change_matrices[i][0][0]
	 */

	for (cusp = manifold->cusp_list_begin.next;
		 cusp != &manifold->cusp_list_end;
		 cusp = cusp->next)

		if (cusp->is_complete == FALSE)
		{
			old_m_coef = cusp->m;
			old_l_coef = cusp->l;

			cusp->m =   old_m_coef * change_matrices[cusp->index][1][1]
					  - old_l_coef * change_matrices[cusp->index][1][0];
			cusp->l = - old_m_coef * change_matrices[cusp->index][0][1]
					  + old_l_coef * change_matrices[cusp->index][0][0];
		}

	/*
	 *	Update the holonomies according to the rule
	 *
	 *		| new H(m) |   |                    | | old H(m) |
	 *		|          | = | change_matrices[i] | |          |
	 *		| new H(l) |   |                    | | old H(l) |
	 *
	 *	(These are actually logs of holonomies, so it's correct to
	 *	add -- not multiply -- them.)
	 *
	 *	For complete Cusps the holonomies should be zero, but that's OK.
	 */

	for (cusp = manifold->cusp_list_begin.next;
		 cusp != &manifold->cusp_list_end;
		 cusp = cusp->next)
 	if ( cusp->topology == torus_cusp || cusp->topology == Klein_cusp ) /* DJH */
		for (i = 0; i < 2; i++)		/* i = ultimate, penultimate */
		{
			old_Hm = cusp->holonomy[i][M];
			old_Hl = cusp->holonomy[i][L];

			cusp->holonomy[i][M] = complex_plus(
				complex_real_mult(
					change_matrices[cusp->index][0][0],
					old_Hm
				),
				complex_real_mult(
					change_matrices[cusp->index][0][1],
					old_Hl
				)
			);

			cusp->holonomy[i][L] = complex_plus(
				complex_real_mult(
					change_matrices[cusp->index][1][0],
					old_Hm
				),
				complex_real_mult(
					change_matrices[cusp->index][1][1],
					old_Hl
				)
			);
		}

	/*
	 *	Update the cusp_shapes.
	 */

	for (cusp = manifold->cusp_list_begin.next;
		 cusp != &manifold->cusp_list_end;
		 cusp = cusp->next)
 	if ( cusp->topology == torus_cusp || cusp->topology == Klein_cusp ) /* DJH */
	{
		cusp->cusp_shape[initial] = transformed_cusp_shape(
									cusp->cusp_shape[initial],
									change_matrices[cusp->index]);

		if (cusp->is_complete == TRUE)
			cusp->cusp_shape[current] = transformed_cusp_shape(
									cusp->cusp_shape[current],
									change_matrices[cusp->index]);
		/*
		 *	else cusp->cusp_shape[current] == Zero, and needn't be changed.
		 */
	}

	return func_OK;
}
Esempio n. 2
0
static void compute_derivative(
	Triangulation	*manifold)
{
	Tetrahedron	*tet;
	Complex		z[3],
				d[3],
				*eqn_coef = NULL,
				dz[2];
	EdgeIndex	e;
	VertexIndex	v;
	FaceIndex	initial_side,
				terminal_side;
	int			init[2][2],
				term[2][2];
	double		m,
				l,
				a,
				b,
				*eqn_coef_00 = NULL,
				*eqn_coef_01 = NULL,
				*eqn_coef_10 = NULL,
				*eqn_coef_11 = NULL;
	int			i,
				j;

	for (tet = manifold->tet_list_begin.next;
		 tet != &manifold->tet_list_end;
		 tet = tet->next)
	{
		/*
		 *	Note the three edge parameters.
		 */

		for (i = 0; i < 3; i++)
			z[i] = tet->shape[filled]->cwl[ultimate][i].rect;

		/*
		 *	Set the derivatives of log(z0), log(z1) and log(z2)
		 *	with respect to the given coordinate system, as
		 *	indicated by the above table.
		 */

		switch (tet->coordinate_system)
		{
			case 0:
				d[0] = One;
				d[1] = complex_div(MinusOne, z[2]);
				d[2] = complex_minus(Zero, z[1]);
				break;

			case 1:
				d[0] = complex_minus(Zero, z[2]);
				d[1] = One;
				d[2] = complex_div(MinusOne, z[0]);
				break;

			case 2:
				d[0] = complex_div(MinusOne, z[1]);
				d[1] = complex_minus(Zero, z[0]);
				d[2] = One;
				break;
		}


		/*
		 *	Record this tetrahedron's contribution to the edge equations.
		 */

		for (e = 0; e < 6; e++)		/* Look at each of the six edges. */
		{
			/*
			 *	Find the matrix entry(ies) corresponding to the
			 *	derivative of the edge equation with respect to this
			 *	tetrahedron.  If the manifold is oriented it will be
			 *	a single entry in the complex matrix.  If the manifold
			 *	is unoriented it will be a 2 x 2 block in the real matrix.
			 */

			if (manifold->orientability == oriented_manifold || manifold->orientability == oriented_orbifold ) /* DJH */
				eqn_coef	= &tet->edge_class[e]->complex_edge_equation[tet->index];
			else
			{
				eqn_coef_00	= &tet->edge_class[e]->real_edge_equation_re[2 * tet->index];
				eqn_coef_01	= &tet->edge_class[e]->real_edge_equation_re[2 * tet->index + 1];
				eqn_coef_10	= &tet->edge_class[e]->real_edge_equation_im[2 * tet->index];
				eqn_coef_11	= &tet->edge_class[e]->real_edge_equation_im[2 * tet->index + 1];
			}

			/*
			 *	Add in the derivative of the log of the edge parameter
			 *	with respect to the chosen coordinate system.  Please
			 *	see the comment preceding this function for details.
			 */

			if (manifold->orientability == oriented_manifold || manifold->orientability == oriented_orbifold ) /* DJH */

				*eqn_coef = complex_plus(*eqn_coef, d[edge3[e]]);

			else
			{
				/*
				 *	These are the same a and b as in the comment
				 *	preceding this function.
				 */

				a = d[edge3[e]].real;
				b = d[edge3[e]].imag;

				if (tet->edge_orientation[e] == right_handed)
				{
					*eqn_coef_00 += a;
					*eqn_coef_01 -= b;
					*eqn_coef_10 += b;
					*eqn_coef_11 += a;
				}
				else
				{
					*eqn_coef_00 -= a;
					*eqn_coef_01 += b;
					*eqn_coef_10 += b;
					*eqn_coef_11 += a;
				}
			}
		}


		/*
		 *	Record this tetrahedron's contribution to the cusp equations.
		 */

		for (v = 0; v < 4; v++)		/* Look at each ideal vertex. */
		{
			/*
			 *	Note the Dehn filling coefficients on this cusp.
			 *	If the cusp is complete, use m = 1.0 and l = 0.0.
			 */

			if (tet->cusp[v]->is_complete) /* DJH : not sure ? */
			{
				m = 1.0;
				l = 0.0;
			}
			else
			{
				m = tet->cusp[v]->m;
				l = tet->cusp[v]->l;
			}

			/*
			 *	Find the matrix entry(ies) corresponding to the
			 *	derivative of the cusp equation with respect to this
			 *	tetrahedron.  If the manifold is oriented it will be
			 *	a single entry in the complex matrix.  If the manifold
			 *	is unoriented it will be a 2 x 2 block in the real matrix.
			 */
													/* DJH */
			if ( (manifold->orientability == oriented_manifold || manifold->orientability == oriented_orbifold ) && (
 				tet->cusp[v]->topology == torus_cusp || tet->cusp[v]->topology == Klein_cusp ) ) 
				eqn_coef = &tet->cusp[v]->complex_cusp_equation[tet->index];
			else
			{
				eqn_coef_00 = &tet->cusp[v]->real_cusp_equation_re[2 * tet->index];
				eqn_coef_01 = &tet->cusp[v]->real_cusp_equation_re[2 * tet->index + 1];
				eqn_coef_10 = &tet->cusp[v]->real_cusp_equation_im[2 * tet->index];
				eqn_coef_11 = &tet->cusp[v]->real_cusp_equation_im[2 * tet->index + 1];
			}

			/*
			 *	Each ideal vertex contains two triangular cross sections,
			 *	one right_handed and the other left_handed.  We want to
			 *	compute the contribution of each angle of each triangle
			 *	to the holonomy.  We begin by considering the right_handed
			 *	triangle, looking at each of its three angles.  A directed
			 *	angle is specified by its initial and terminal sides.
			 *	We find the number of strands of the Dehn filling curve
			 *	passing from the initial side to the terminal side;
			 *	it is  m * (number of strands of meridian)
			 *	+ l * (number of strands of longitude), where (m,l) are
			 *	the Dehn filling coefficients (in practice, m and l need
			 *	not be integers, but it's simpler to imagine them to be
			 *	integers as you try to understand the following code).
			 *	The number of strands of the Dehn filling curves passing
			 *	from the initial to the terminal side is multiplied by
			 *	the derivative of the log of the complex angle, to yield
			 *	the contribution to the derivative matrix.  If the manifold
			 *	is oriented, that complex number is added directly to
			 *	the relevant matrix entry.  If the manifold is unoriented,
			 *	we convert the complex number to a 2 x 2 real matrix
			 *	(cf. the comments preceding this function) and add it to
			 *	the appropriate 2 x 2 block of the real derivative matrix.
			 *	The 2 x 2 matrix for the left_handed triangle is modified
			 *	to account for the fact that although the real part of the
			 *	derivative of the log (i.e. the compression/expansion
			 *	factor) is the same, the imaginary part (i.e. the rotation)
			 *	is negated.  [Note that in computing the edge equations
			 *	the real part was negated, while for the cusp equations
			 *	the imaginary part is negated.  I will leave an explanation
			 *	of the difference as an exercise for the reader.]
			 *
			 *	Note that we cannot possibly handle curves on the
			 *	left_handed sheet of the orientation double cover of
			 *	a cusp of an oriented manifold.  The reason is that the
			 *	log of the holonomy of the Dehn filling curve is not
			 *	a complex analytic function of the shape of the tetrahedron
			 *	(it's the complex conjugate of such a function).  I.e.
			 *	it doesn't have a derivative in the complex sense.  This
			 *	is why we make the convention that all peripheral curves
			 *	in oriented manifolds lie on the right_handed sheet of
			 *	the double cover.
			 */

			for (initial_side = 0; initial_side < 4; initial_side++)
			{
				if (initial_side == v)
					continue;

				terminal_side = remaining_face[v][initial_side];

				/*
				 *	Note the intersection numbers of the meridian and
				 *	longitude with the initial and terminal sides.
				 */

				for (i = 0; i < 2; i++)	{		/* which curve */
					for (j = 0; j < 2; j++)	{	/* which sheet */
						init[i][j] = tet->curve[i][j][v][initial_side];
						term[i][j] = tet->curve[i][j][v][terminal_side];
					}
				}

				/*
				 *	For each triangle (right_handed and left_handed),
				 *	multiply the number of strands of the Dehn filling
				 *	curve running from initial_side to terminal_side
				 *	by the derivative of the log of the edge parameter.
				 */

				for (i = 0; i < 2; i++)	/* which sheet */
					dz[i] = complex_real_mult(
						m * FLOW(init[M][i],term[M][i]) +	l * FLOW(init[L][i],term[L][i]),
						d[ edge3_between_faces[initial_side][terminal_side] ]
					);

				/*
				 *	If the manifold is oriented, the Dehn filling curve
				 *	must lie of the right_handed sheet of the orientation
				 *	double cover (cf. above).  Add its contributation to
				 *	the cusp equation.
				 */
													/* DJH */
				if (manifold->orientability == oriented_manifold || manifold->orientability == oriented_orbifold )

					*eqn_coef = complex_plus(*eqn_coef, dz[right_handed]);

				/* "else" follows below */

				/*
				 *	If the manifold is unoriented, treat the right_ and
				 *	left_handed sheets separately.  Add in the contribution
				 *	of the right_handed sheet normally.  For the left_handed
				 *	sheet, we must account for the fact that even though
				 *	the modulus of the derivative (i.e. the expansion/
				 *	contraction factor) is correct, its argument (i.e. the
				 *	angle of rotation) is the negative of what it should be.
				 */

				else
				{
					a = dz[right_handed].real;
					b = dz[right_handed].imag;
					*eqn_coef_00 += a;
					*eqn_coef_01 -= b;
					*eqn_coef_10 += b;
					*eqn_coef_11 += a;

					a = dz[left_handed].real;
					b = dz[left_handed].imag;
					*eqn_coef_00 += a;
					*eqn_coef_01 -= b;
					*eqn_coef_10 -= b;
					*eqn_coef_11 -= a;
				}

			}
		}
	}
}
Esempio n. 3
0
static void compute_rhs(
	Triangulation	*manifold)
{
	EdgeClass	*edge;
	Cusp		*cusp;
	Complex		desired_holonomy,
				current_holonomy,
				rhs;

	/*
	 *	The right hand side of each equation will be the desired value
	 *	of the edge angle sum or the holonomy (depending on whether it's
	 *	an edge equation or a cusp equation) minus the current value.
	 *	Thus, when the equations are solved and the Shapes of the
	 *	Tetrahedra are updated, the edge angle sums and the holonomies
	 *	will take on their desired values, to the accuracy of the
	 *	linear approximation.
	 */

	/*
	 *	Set the right hand side (rhs) of each edge equation.
	 */

	for (	edge = manifold->edge_list_begin.next;
			edge != &manifold->edge_list_end;
			edge = edge->next)
	{
		/*
		 *	The desired value of the sum of the logs of the complex
		 *	edge parameters is 2 pi i.  The current value is
		 *	edge->edge_angle_sum.
		 */

		rhs = complex_minus(TwoPiI_on[ (int) edge->singular_order], edge->edge_angle_sum); /* DJH */

		if (manifold->orientability == oriented_manifold || manifold->orientability == oriented_orbifold )
			edge->complex_edge_equation[manifold->num_tetrahedra] = rhs;
		else
		{
			edge->real_edge_equation_re[2 * manifold->num_tetrahedra] = rhs.real;
			edge->real_edge_equation_im[2 * manifold->num_tetrahedra] = rhs.imag;
		}
	}



	/*
	 *	Set the right hand side (rhs) of each cusp equation.
	 */

	for (cusp = manifold->cusp_list_begin.next;
		 cusp != &manifold->cusp_list_end;
		 cusp = cusp->next)					/* DJH */
 	if ( cusp->topology == torus_cusp || cusp->topology == Klein_cusp )
	{
		/*
		 *	For complete cusps we want the log of the holonomy of the
		 *	meridian to be zero.  For Dehn filled cusps we want the
		 *	log of the holonomy of the Dehn filling curve to be 2 pi i.
		 */

		if (cusp->is_complete)
		{
			desired_holonomy	= Zero;
			current_holonomy	= cusp->holonomy[ultimate][M];
		}
		else
		{
			desired_holonomy	= TwoPiI;
			current_holonomy	= complex_plus(
				complex_real_mult(cusp->m, cusp->holonomy[ultimate][M]),
				complex_real_mult(cusp->l, cusp->holonomy[ultimate][L])
			);
		}

		rhs = complex_minus(desired_holonomy, current_holonomy);

		if (manifold->orientability == oriented_manifold || manifold->orientability == oriented_orbifold ) /* DJH */
			cusp->complex_cusp_equation[manifold->num_tetrahedra] = rhs;
		else
		{
			cusp->real_cusp_equation_re[2 * manifold->num_tetrahedra] = rhs.real;
			cusp->real_cusp_equation_im[2 * manifold->num_tetrahedra] = rhs.imag;
		}

	}
}
Esempio n. 4
0
void compute_core_geodesic(
    Cusp    *cusp,
    int     *singularity_index,
    Complex length[2])
{
    int         i;
    long int    positive_d,
                negative_c;
    Real      pi_over_n;

    /*
     *  If the Cusp is unfilled or the Dehn filling coefficients aren't
     *  integers, then just write in some zeros (as explained at the top
     *  of this file) and return.
     */

    if (cusp->is_complete == TRUE
     || Dehn_coefficients_are_integers(cusp) == FALSE)
    {
        *singularity_index  = 0;
        length[ultimate]    = Zero;
        length[penultimate] = Zero;

        return;
    }

    /*
     *  The euclidean_algorithm() will give the singularity index
     *  directly (as the g.c.d.), and the coefficients lead to the
     *  complex length (cf. the explanation at the top of this file).
     */

    *singularity_index = euclidean_algorithm(
                            (long int) cusp->m,
                            (long int) cusp->l,
                            &positive_d,
                            &negative_c);

    for (i = 0; i < 2; i++)     /* i = ultimate, penultimate */
    {
        /*
         *  length[i] = c H(m) + d H(l)
         *
         *  (The holonomies are already in logarithmic form.)
         */
        length[i] = complex_plus(
                complex_real_mult(
		    (Real) (double)(- negative_c),
                    cusp->holonomy[i][M]
                ),
                complex_real_mult(
		    (Real) (double) positive_d,
                    cusp->holonomy[i][L]
                )
            );

        /*
         *  Make sure the length is positive.
         */
        if (length[i].real < 0.0)
            length[i] = complex_negate(length[i]);

        /*
         *  We want to normalize the torsion to the range
         *  [-pi/n + epsilon, pi/n + epsilon], where n is
         *  the order of the singular locus.
         */

        pi_over_n = PI / *singularity_index;

        while (length[i].imag < - pi_over_n + TORSION_EPSILON)
            length[i].imag += 2.0 * pi_over_n;

        while (length[i].imag >   pi_over_n + TORSION_EPSILON)
            length[i].imag -= 2.0 * pi_over_n;

        /*
         *  In the case of a Klein bottle cusp, H(m) will be purely
         *  rotational and H(l) will be purely translational
         *  (cf. the documentation at the top of holonomy.c).
         *  But the longitude used in practice is actually the
         *  double cover of the true longitude, so we have to
         *  divide the core_length by two to compensate.
         */
        if (cusp->topology == Klein_cusp)
            length[i].real /= 2.0;

    }
}