File: basis.d

package info (click to toggle)
projectl 1.001.dfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,720 kB
  • ctags: 5
  • sloc: xml: 57; makefile: 32
file content (36 lines) | stat: -rw-r--r-- 766 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
module util.basis;
import std.math;

public double deglimit(double deg0){
	double deg = deg0;
	while(deg < -180)deg += 360;
	while(180 < deg)deg -= 360;
	return deg;
}
public double daimmark(double deg,double deg0){
	deg=deglimit(deg);
	deg0=deglimit(deg0);
	if(deg>deg0)
		if(deg-deg0<180)return -1.0;
		else return 1.0;
	else 
		if(deg0-deg<180)return 1.0;
		else return -1.0;
}
public double radlimit(double rad0){
	double rad = rad0;
	while(rad < -PI)rad += 2.0 * PI;
	while(PI <rad)rad -= 2.0 * PI;
	return rad;
}

public double raimmark(double rad ,double rad0){
	rad=radlimit(rad);
	rad0=radlimit(rad0);
	if(rad>rad0)
		if(rad-rad0<PI)return -1.0;
		else return 1.0;
	else 
		if(rad0-rad<PI)return 1.0;
		else return -1.0;
}