make it a class
This commit is contained in:
parent
e45284f53b
commit
27d5de1f5e
@ -12,13 +12,17 @@ def guess(inp):
|
|||||||
|
|
||||||
Point = namedtuple('Point', ['acadx', 'acady'])
|
Point = namedtuple('Point', ['acadx', 'acady'])
|
||||||
|
|
||||||
class Vertex(namedtuple('Vertex',
|
class Vertex:
|
||||||
['point', 'len', 'ang', 'dirang', 'coords'],
|
def __init__(self, point, length, angle):
|
||||||
defaults=(0,Point(0, 0)))):
|
self.point = point
|
||||||
"""Point Angle Length DirectionAngle"""
|
self.len = length
|
||||||
|
self.ang = angle
|
||||||
|
self.dirang = Dec()
|
||||||
|
self.coords = Point(Dec(), Dec())
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%2d: ang:%8.4f len:%7.3f dirang:%8.4f acoords:(%.3f,%.3f)" % \
|
return "%2d: ang:%8.4f len:%7.3f dirang:%8.4f acoords:(%.3f,%.3f)" % \
|
||||||
(self.point, self.ang, self.len, self.dirang, self.coords.acadx, self.coords.acady)
|
(self.point, self.ang, self.len,
|
||||||
|
self.dirang, self.coords.acadx, self.coords.acady)
|
||||||
|
|
||||||
A= Dec('6.094')
|
A= Dec('6.094')
|
||||||
B= Dec('-2.923')
|
B= Dec('-2.923')
|
||||||
@ -62,9 +66,10 @@ for v in vertices:
|
|||||||
angle_sum += v.ang
|
angle_sum += v.ang
|
||||||
theoretical_angle_sum = Dec(int((len(vertices)-2)*180))
|
theoretical_angle_sum = Dec(int((len(vertices)-2)*180))
|
||||||
|
|
||||||
|
dirang = A11_2
|
||||||
for v in vertices:
|
for v in vertices:
|
||||||
print(v)
|
v.dirang = dirang + 180 - v.ang
|
||||||
|
dirang = v.dirang
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("""
|
print("""
|
||||||
|
Loading…
Reference in New Issue
Block a user