File: Moebius_transformations.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 (56 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (8)
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
/*
 *	Moebius_transformations.c
 */

#include "kernel.h"

CONST MoebiusTransformation	Moebius_identity =
							{
								{
									{{1.0, 0.0}, {0.0, 0.0}},
									{{0.0, 0.0}, {1.0, 0.0}}
								},
								orientation_preserving
							};

void Moebius_copy(
	MoebiusTransformation	*dest,
	MoebiusTransformation	*source)
{
	sl2c_copy(dest->matrix, source->matrix);
	dest->parity = source->parity;
}


void Moebius_invert(
	MoebiusTransformation	*mt,
	MoebiusTransformation	*mt_inverse)
{
	sl2c_invert(mt->matrix, mt_inverse->matrix);
	if (mt->parity == orientation_reversing)
		sl2c_complex_conjugate(mt_inverse->matrix, mt_inverse->matrix);

	mt_inverse->parity = mt->parity;
}


void Moebius_product(
	MoebiusTransformation	*a,
	MoebiusTransformation	*b,
	MoebiusTransformation	*product)
{
	SL2CMatrix	factor1,
				factor2;

	sl2c_copy(factor1, a->matrix);
	sl2c_copy(factor2, b->matrix);

	if (a->parity == orientation_reversing)
		sl2c_complex_conjugate(factor2, factor2);

	sl2c_product(factor1, factor2, product->matrix);

	product->parity = (a->parity == b->parity) ?
					  orientation_preserving:
					  orientation_reversing;
}