unsuccessful polygon

This commit is contained in:
Motiejus Jakštys 2019-11-29 16:53:41 +02:00
parent 829b93317c
commit 03d5b2d19d
2 changed files with 13 additions and 4 deletions

View File

@ -19,7 +19,6 @@ CONTINUOUS = (1,0)
DASHDOTX2 = (10,3,2,3)
DASHED = (100,20)
keliai = [
kelias(
id='A-08',
@ -86,8 +85,7 @@ point_annotations = {
17: N, 18: E, 19: N, 20: S,
21: N, 22: S, 23: E, 24: N,
}
road_annotations = { 'A-08': W, 'A-05': N, 'A-03': N, 'G-11': E }
road_annotations = {'A-08':W, 'A-05':N, 'A-03':N, 'G-11':E}
# implementacija
fig, ax = plt.subplots()
@ -123,4 +121,14 @@ for id, kelias in keliai_l.items():
offset = road_annotations[id]
ax.annotate(id, kelias.offsets[-1].coords[0], zorder=KAT0, textcoords='offset points', xytext=offset, rotation=angle)
# septynkampis
prev_dirang = float(K1)*pi/180
step = 5*7*pi
heptagon = [np.array(Points[6].xy)]
for i in range(1, 7):
dxy = np.array([float(D1)*cos(prev_dirang), float(D1)*sin(prev_dirang)])
heptagon.append(heptagon[i-1] + dxy)
prev_dirang += step
ax.add_patch(PolygonPatch(asPolygon(heptagon), linewidth=2, fc='grey'))
plt.show()

View File

@ -2,6 +2,7 @@
from collections import namedtuple
from decimal import Decimal as Dec
from math import sin, cos, pi
import numpy as np
def normalize(ang):
while ang > 180:
@ -37,7 +38,7 @@ class Vertex:
@property
def xy(self):
"""xy returns a tuple of lksx and lksy coordinates"""
return (self.coords.lksx, self.coords.lksy)
return np.array([float(self.coords.lksx), float(self.coords.lksy)])
# Kategorijos
KAT0, KAT1, KAT2, KAT3, KAT4 = range(5,0,-1)