summaryrefslogtreecommitdiff
path: root/src/Graphic2d/Graphic2d_Primitive.pxx
blob: bdb0793d18947c2706be9f483a3564c0b4828f5f (plain)
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

#ifndef PRIMITIVE_PXX_INCLUDED
#define PRIMITIVE_PXX_INCLUDED

#define NEW_ANGLE(a)  { \
	int quot = (int) (a/(2.*Standard_PI)); \
	if (Abs(quot) >= 1) a = a - 2.*Standard_PI*quot; \
}

#define REALEPSILON()  (0.0001)

#define VALUE_OF_ANGLE(x,y,z)  { \
double a; \
		if (x > 0.) \
			if (x <= REALEPSILON ()) x = 0.; \
		if (x < 0.) \
			if (-x <= REALEPSILON ()) x = 0.; \
		if (y > 0.) \
			if (y <= REALEPSILON ()) y = 0.; \
		if (y < 0.) \
			if (-y <= REALEPSILON ()) y = 0.; \
		if (x == 0.) { \
			if (y > 0.) z = Standard_PI/2.; \
			else z = - Standard_PI/2.; \
		} \
		if (y == 0.) { \
			if (x > 0.) z = 0.; \
			else z = Standard_PI; \
		} \
		if ((x < 0.) && (y > 0.)) { \
			a = acos (x); \
			if ((a >= Standard_PI/2.-REALEPSILON ()) && \
			    (a <= Standard_PI+REALEPSILON ())) \
				z = a; \
			else \
				z = - a; \
		} \
		if ((x >= 0.) && (y > 0.)) { \
			a = acos (x); \
			if ((a >= 0.) && \
			    (a <= Standard_PI/2.+REALEPSILON ())) \
				z = a; \
			else \
				z = - a; \
		} \
		if ((x < 0.) && (y < 0.)) { \
			a = acos (x); \
			z = - a; \
		} \
		if ((x > 0.) && (y < 0.)) { \
			a = acos (x); \
			if ((a >= 0.) && \
			    (a <= Standard_PI/2.+REALEPSILON ())) \
				z = - a; \
			else \
				z = a; \
		} \
}

#define XROTATE(x,y) ((x)*cosa - (y)*sina)
#define YROTATE(x,y) ((y)*cosa + (x)*sina)

#endif