-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathorbit.php
84 lines (80 loc) · 1.33 KB
/
orbit.php
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
<?php
class Orbit
{
private $N;
private $i;
private $w;
private $M;
private $L;
private $e;
private $a;
private $x;
private $y;
private $r;
private $v;
private $E;
private $xeclip;
private $yeclip;
private $zeclip;
private $longitude;
private $is_radian = false;
public function __get($key)
{
return $this->{$key};
}
public function __set($key, $value)
{
$this->{$key} = $value;
}
public function mod2pi($var = null)
{
if(is_null($var))
{
foreach($this as $key => $value)
{
$this->{$key} = $this->_mod2pi($value);
}
}
else $this->{$var} = $this->_mod2pi($this->{$var});
}
public function getLongitude()
{
return rad2deg($this->longitude);
}
public function setRadian($var = null)
{
if(!$this->is_radian)
{
foreach($this as $key => $value)
{
switch ($key)
{
case 'e':
case 'a':
case 'is_radian':
case 'x':
case 'y':
case 'r':
case 'E':
break;
default:
$this->{$key} = deg2rad($value);
}
}
$this->is_radian = true;
}
}
private function absFloor($val)
{
if ($val >= 0.0) return floor($val);
else return ceil($val);
}
private function _mod2pi($angle)
{
$b = $angle/360.0;
$a = 360.0*($b - $this->absFloor($b));
if ($a < 0) $a = 360.0 + $a;
return $a;
}
}
?>