-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoints.py
More file actions
39 lines (33 loc) · 826 Bytes
/
points.py
File metadata and controls
39 lines (33 loc) · 826 Bytes
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
import math
def decrad (dms):
deg = float(dms[0])
min = float(dms[1])
sec = float(dms[2])
if deg < 0:
return math.radians(-(abs(deg) + (min / 60) + (sec / 3600)))
else:
return math.radians(deg + (min / 60) + (sec / 3600))
class Point (object):
name = ''
lattitude = []
longitude = []
height = None
phi = None
lambda_ = None
y = None
x = None
z = None
def __init__ (self, name = None, phi = None, lambda_ = None, lattitude = None, longitude = None, height = None, x=None, y=None, z=None):
if lattitude:
self.phi = decrad(lattitude)
if longitude:
self.lambda_ = decrad(longitude)
if phi or phi == 0:
self.phi = phi
if lambda_ or lambda_ == 0:
self.lambda_ = lambda_
self.height = float(height)
self.x = x
self.y = y
self.z = z
self.name = name