unsuccessful polygon
This commit is contained in:
parent
829b93317c
commit
03d5b2d19d
@ -19,7 +19,6 @@ CONTINUOUS = (1,0)
|
|||||||
DASHDOTX2 = (10,3,2,3)
|
DASHDOTX2 = (10,3,2,3)
|
||||||
DASHED = (100,20)
|
DASHED = (100,20)
|
||||||
|
|
||||||
|
|
||||||
keliai = [
|
keliai = [
|
||||||
kelias(
|
kelias(
|
||||||
id='A-08',
|
id='A-08',
|
||||||
@ -86,8 +85,7 @@ point_annotations = {
|
|||||||
17: N, 18: E, 19: N, 20: S,
|
17: N, 18: E, 19: N, 20: S,
|
||||||
21: N, 22: S, 23: E, 24: N,
|
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
|
# implementacija
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
@ -123,4 +121,14 @@ for id, kelias in keliai_l.items():
|
|||||||
offset = road_annotations[id]
|
offset = road_annotations[id]
|
||||||
ax.annotate(id, kelias.offsets[-1].coords[0], zorder=KAT0, textcoords='offset points', xytext=offset, rotation=angle)
|
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()
|
plt.show()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from decimal import Decimal as Dec
|
from decimal import Decimal as Dec
|
||||||
from math import sin, cos, pi
|
from math import sin, cos, pi
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
def normalize(ang):
|
def normalize(ang):
|
||||||
while ang > 180:
|
while ang > 180:
|
||||||
@ -37,7 +38,7 @@ class Vertex:
|
|||||||
@property
|
@property
|
||||||
def xy(self):
|
def xy(self):
|
||||||
"""xy returns a tuple of lksx and lksy coordinates"""
|
"""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
|
# Kategorijos
|
||||||
KAT0, KAT1, KAT2, KAT3, KAT4 = range(5,0,-1)
|
KAT0, KAT1, KAT2, KAT3, KAT4 = range(5,0,-1)
|
||||||
|
Loading…
Reference in New Issue
Block a user