updated colors and global area sigil logic

This commit is contained in:
kflux 2020-05-15 14:16:32 +02:00
parent 8bca6e96dc
commit 313ecbf010
3 changed files with 117 additions and 67 deletions

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="600" height="600" viewBox="-300.0 -300.0 600 600">
<defs>
<marker markerWidth="4.0" markerHeight="4.0" viewBox="-0.1 -0.5 1.0 1.0" orient="auto" id="d0">
<path d="M-0.5,-0.3 L0.1,-0.3" stroke-width="2" stroke="black" />
</marker>
</defs>
<circle cx="0" cy="0" r="180" stroke-dasharray="1124.690169985146 6.283185307179565" stroke-dashoffset="-30.0897501812389" stroke="black" stroke-width="5" fill="none" />
<circle cx="0" cy="0" r="190" stroke-dasharray="1187.172957206543 6.6322511575783665" stroke-dashoffset="-718.0588020950981" stroke="yellow" stroke-width="5" fill="none" />
<circle cx="0" cy="0" r="200" stroke-dasharray="1249.65574442794 6.981317007977395" stroke-dashoffset="-1060.3757539550218" stroke="grey" stroke-width="5" fill="none" />
<circle cx="0" cy="0" r="210" stroke-dasharray="1312.138531649337 7.330382858376197" stroke-dashoffset="-751.1443928132429" stroke="orange" stroke-width="5" fill="none" />
<circle cx="0" cy="0" r="220" stroke-dasharray="1374.621318870734 7.6794487087749985" stroke-dashoffset="-726.5038853354837" stroke="green" stroke-width="5" fill="none" />
<circle cx="0" cy="0" r="230" stroke-dasharray="1437.104106092131 8.028514559174027" stroke-dashoffset="-1203.7624117595026" stroke="red" stroke-width="5" fill="none" />
<circle cx="0" cy="0" r="240" stroke-dasharray="1499.586893313528 8.377580409572602" stroke-dashoffset="-1398.0494220910218" stroke="blue" stroke-width="5" fill="none" />
<circle cx="0" cy="0" r="250" stroke-dasharray="1562.069680534925 8.726646259971403" stroke-dashoffset="-1435.7690350181244" stroke="black" stroke-width="5" fill="none" />
<path d="M103,56 l-68,-56 l-70,56 l0,-168 Z" stroke-width="5" stroke="red" fill="red" />
<path d="M103,-56 l-206,0 l68,168 l138,-56 l-138,-56 l138,-112" stroke-width="5" stroke="black" fill="none" marker-end="url(#d0)" />
<circle cx="103" cy="-56" r="10" fill="white" stroke-width="5" stroke="black" />
</svg>

Before

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1,40 +1,71 @@
import time import time
import math
import swisseph as swe import swisseph as swe
import drawSvg as svg import drawSvg as svg
from openlocationcode import openlocationcode as olc from openlocationcode import openlocationcode as olc
def planetaryMoment(lat, lon, epoch): def planetaryMoment(lat, lon, epoch): # calculate planetary ephemeris + ascendant according to location and timestamp
planets = [0,1,2,3,4,5,6] planets = [0,1,2,3,4,5,6]
tmp = time.gmtime(epoch) # convert epoch to time tmp = time.gmtime(epoch) # convert epoch to time
hours = tmp.tm_hour + tmp.tm_min / 60 + tmp.tm_sec / 3600 # convert hh:mm:ss to decimal hours hours = tmp.tm_hour + tmp.tm_min / 60 + tmp.tm_sec / 3600 # convert hh:mm:ss to decimal hours
jd = swe.julday(tmp.tm_year,tmp.tm_mon,tmp.tm_mday,hours,1) # convert to Julian day jd = swe.julday(tmp.tm_year,tmp.tm_mon,tmp.tm_mday,hours,1) # convert to Julian day
te = jd + swe.deltat(jd) # add deltaT te = jd + swe.deltat(jd) # add deltaT
# get ecliptic planet locations # get ecliptic planet locations
for i in range(len(planets)): for i in range(len(planets)):
planets[i] = swe.calc(te, i) planets[i] = swe.calc(te, i)
# clean up # clean up
for i in range(len(planets)): for i in range(len(planets)):
planets[i] = planets[i][0][0] planets[i] = planets[i][0][0]
cusps = swe.houses_ex(jd, lat, lon, b'P',0) # get ecliptic ascendant degree cusps = swe.houses_ex(jd, lat, lon, b'P',0) # get ecliptic ascendant degree
planets.insert(0, cusps[0][0]) planets.insert(0, cusps[0][0])
return planets return planets
def locationSigil(lat, lon, planets): def locationSigil(plusCode, planets, canvas): # draw arcs depending on planetary positions at the moment in time
# draw arcs depending on planetary positions at the moment in time
colors = ['black', 'yellow', 'grey', 'orange', 'green', 'red', 'blue', 'black'] # black inner circle for ascendant and planetary colors colors = ['violet', 'yellow', 'white', 'orange', 'green', 'red', 'royalblue', 'indigo'] # black inner circle for ascendant and planetary colors
d = svg.Drawing(600, 600, origin='center', displayInline=False) # define canvas
# draw rings for ascendant + planets and keep a small gap at the ecliptic degrees they are in # draw rings for ascendant + planets and keep a small gap at the ecliptic degrees they are in
for i in range(len(planets)): for i in range(len(planets)):
circleColor = colors[i] circleColor = colors[i]
# circleColor = 'grey'
degree = planets[i] degree = planets[i]
startArc = degree + 1 + 90 # 0° is at the 12 o'clock position startArc = degree + 90 # 0° is at the 12 o'clock position
endArc = degree - 1 + 90 endArc = degree - 110 + 90
radius = 180 + i * 10 radius = 180 + i * 10
d.append(svg.ArcLine(0, 0, radius, startArc, endArc, stroke=circleColor, stroke_width=5, fill='none')) canvas.append(svg.ArcLine(0, 0, radius, startArc, endArc, stroke=circleColor, stroke_width=7, fill='none'))
# draw sigil based on location
plusCode = olc.encode(lat,lon,10) # generate Open Location Code aka. plus code from coordinates
codeList = list(plusCode.replace('+', '')) # remove the + in the string codeList = list(plusCode.replace('+', '')) # remove the + in the string
# grid for 2dimensional representation of the plus code letters
#draw global area sigil
arrow2 = svg.Marker(-0.5, -0.5, 0.5, 0.5, scale=5, orient='auto') # define line to terminate the sigil
arrow2.append(svg.Line(-0., -0.5, 0., 0.5, stroke_width=0.2, stroke='red'))
dot2 = svg.Marker(-0.5, -0.5, 0.5, 0.5, scale=5, orient='auto') # define circle to start the sigil
dot2.append(svg.Circle(0.0, 0.0, 0.4, stroke_width=0.2, stroke='red'))
# set up sigil path
p = svg.Path(stroke_width=7, stroke='red', fill='none', marker_start=dot2, marker_end=arrow2)
# draw sigil
drawGlobalSigil(codeList, p, 4)
canvas.append(p)
del codeList[0:4] # delete area code from list
#draw local fractal sigil
arrow = svg.Marker(-0.5, -0.5, 0.5, 0.5, scale=5, orient='auto') # define line to terminate the sigil
arrow.append(svg.Line(-0., -0.5, 0., 0.5, stroke_width=0.2, stroke='white'))
dot = svg.Marker(-0.5, -0.5, 0.5, 0.5, scale=5, orient='auto') # define circle to start the sigil
dot.append(svg.Circle(0.0, 0.0, 0.4, stroke_width=0.2, stroke='white'))
# set up sigil path
p = svg.Path(stroke_width=7, stroke='white', fill='none', marker_start=dot, marker_end=arrow)
# draw sigil
drawLocalSigil(codeList, p, 5)
canvas.append(p)
def drawLocalSigil(points, p, length): # draw sigil based on OLC magic square
grid = { grid = {
'R' : [-103, 112], 'V' : [-35, 112], 'W' : [35, 112], 'X' : [103, 112], # | R | V | W | X | 'R' : [-103, 112], 'V' : [-35, 112], 'W' : [35, 112], 'X' : [103, 112], # | R | V | W | X |
'J' : [-103, 56], 'M' : [-35, 56], 'P' : [35, 56], 'Q' : [103, 56], # | J | M | P | Q | 'J' : [-103, 56], 'M' : [-35, 56], 'P' : [35, 56], 'Q' : [103, 56], # | J | M | P | Q |
@ -42,51 +73,61 @@ def locationSigil(lat, lon, planets):
'6' : [-103, -56], '7' : [-35, -56], '8' : [35, -56], '9' : [103, -56], # | 6 | 7 | 8 | 9 | '6' : [-103, -56], '7' : [-35, -56], '8' : [35, -56], '9' : [103, -56], # | 6 | 7 | 8 | 9 |
'2' : [-103, -112], '3' : [-35, -112], '4' : [35, -112], '5' : [103, -112] # | 2 | 3 | 4 | 5 | '2' : [-103, -112], '3' : [-35, -112], '4' : [35, -112], '5' : [103, -112] # | 2 | 3 | 4 | 5 |
} }
#draw area code as red polygon
p = svg.Path(stroke_width=5, stroke='red', fill='red')
# get the starting point # get the starting point
originX = grid[codeList[0]][0] originX = grid[points[0]][0]
originY = grid[codeList[0]][1] originY = grid[points[0]][1]
p.M(originX, originY) p.M(originX, originY)
del codeList[0] # delete starting point from list del points[0] # delete starting point from list
# for all remaining points draw from point to point for c in range(length):
for c in range(3): x = grid[points[c]][0] - originX # abs. to rel. coords
x = grid[codeList[c]][0] - originX # absolute to relative coords y = grid[points[c]][1] - originY # abs. to rel. coords
y = grid[codeList[c]][1] - originY # abs. to rel. coords
p.l(x, y) # draw p.l(x, y) # draw
originX = grid[codeList[c]][0] originX = grid[points[c]][0]
originY = grid[codeList[c]][1] originY = grid[points[c]][1]
p.Z() # close the lines to starting point
d.append(p)
del codeList[0:3] # delete area code from list
#draw address def drawGlobalSigil(points, p, length): # draw sigil based on concentric circle positions
arrow = svg.Marker(-0.1, -0.5, 0.9, 0.5, scale=4, orient='auto') # define arrow to terminate the sigil
arrow.append(svg.Line(-0.5, 0.3, 0.1, 0.3, stroke_width=2, stroke='black'))
p = svg.Path(stroke_width=5, stroke='black', fill='none', marker_end=arrow)
# get the starting point
originX = ogx = grid[codeList[0]][0]
originY = ogy = grid[codeList[0]][1]
p.M(originX, originY)
del codeList[0] # delete starting point from list
for c in range(len(codeList)):
x = grid[codeList[c]][0] - originX # abs. to rel. coords
y = grid[codeList[c]][1] - originY # abs. to rel. coords
p.l(x, y) # draw
originX = grid[codeList[c]][0]
originY = grid[codeList[c]][1]
d.append(p)
d.append(svg.Circle(ogx, ogy, 10, fill='white', stroke_width=5, stroke='black')) # draw circle to beginning
fileName = '%s.svg' % (plusCode)
d.saveSvg(fileName)
decoder = ['2', '3', '4', '5', '6', '7', '8', '9', 'C', 'F', 'G', 'H', 'J', 'M', 'P', 'Q', 'R', 'V', 'W', 'X']
for c in range(length):
index = decoder.index(points[c])
# find coordinates on circle every 18° (360° / 20 digits)
radius = 150 - c * 20
angle = 18 * index
x = radius * math.cos(angle)
y = radius * math.sin(angle)
if c == 0:
p.M(x,y) # starting point
originX = x
originY = y
else:
p.l(x - originX, y - originY) # draw
originX = x
originY = y
def main(): def main():
lat = 55.753687
lon = 37.619938 lat = 37.223187
lon = 38.922438
epoch = time.time() # now epoch = time.time() # now
# calculate OLC and ephemeris
plusCode = olc.encode(lat,lon,10) # generate Open Location Code aka. plus code from coordinates
planets = planetaryMoment(lat, lon, epoch) # generate planetary ephemeris planets = planetaryMoment(lat, lon, epoch) # generate planetary ephemeris
locationSigil(lat,lon, planets) # draw sigil SVG
# set up SVG canvas
d = svg.Drawing(600, 600, origin='center', displayInline=False) # define canvas
d.append(svg.Circle(0, 0, 260, fill='black', stroke_width=0))
# draw sigil
locationSigil(plusCode, planets, d) # draw sigil SVG
# save sigil to SVG file
fileName = '%s-%s.svg' % (plusCode, epoch)
fileName = 'test.svg'
d.saveSvg(fileName)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

29
test.svg Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="600" height="600" viewBox="-300.0 -300.0 600 600">
<defs>
<marker markerWidth="5.0" markerHeight="5.0" viewBox="-0.5 -0.5 1.0 1.0" orient="auto" id="d0">
<circle cx="0.0" cy="-0.0" r="0.4" stroke-width="0.2" stroke="red" />
</marker>
<marker markerWidth="5.0" markerHeight="5.0" viewBox="-0.5 -0.5 1.0 1.0" orient="auto" id="d1">
<path d="M-0.0,0.5 L0.0,-0.5" stroke-width="0.2" stroke="red" />
</marker>
<marker markerWidth="5.0" markerHeight="5.0" viewBox="-0.5 -0.5 1.0 1.0" orient="auto" id="d2">
<circle cx="0.0" cy="-0.0" r="0.4" stroke-width="0.2" stroke="white" />
</marker>
<marker markerWidth="5.0" markerHeight="5.0" viewBox="-0.5 -0.5 1.0 1.0" orient="auto" id="d3">
<path d="M-0.0,0.5 L0.0,-0.5" stroke-width="0.2" stroke="white" />
</marker>
</defs>
<circle cx="0" cy="0" r="260" fill="black" stroke-width="0" />
<circle cx="0" cy="0" r="180" stroke-dasharray="785.3981633974483 345.5751918948772" stroke-dashoffset="-611.7689848594903" stroke="violet" stroke-width="7" fill="none" />
<circle cx="0" cy="0" r="190" stroke-dasharray="829.0313946973066 364.7738136668148" stroke-dashoffset="-1077.3414489697823" stroke="yellow" stroke-width="7" fill="none" />
<circle cx="0" cy="0" r="200" stroke-dasharray="872.6646259971649 383.9724354387524" stroke-dashoffset="-155.4435945077978" stroke="white" stroke-width="7" fill="none" />
<circle cx="0" cy="0" r="210" stroke-dasharray="916.297857297023 403.17105721069015" stroke-dashoffset="-1145.6101047542002" stroke="orange" stroke-width="7" fill="none" />
<circle cx="0" cy="0" r="220" stroke-dasharray="959.9310885968813 422.36967898262776" stroke-dashoffset="-1145.2295665673755" stroke="green" stroke-width="7" fill="none" />
<circle cx="0" cy="0" r="230" stroke-dasharray="1003.5643198967396 441.56830075456537" stroke-dashoffset="-194.32135261741215" stroke="red" stroke-width="7" fill="none" />
<circle cx="0" cy="0" r="240" stroke-dasharray="1047.1975511965977 460.76692252650287" stroke-dashoffset="-346.66820676838495" stroke="royalblue" stroke-width="7" fill="none" />
<circle cx="0" cy="0" r="250" stroke-dasharray="1090.830782496456 479.96554429844036" stroke-dashoffset="-340.59431884378057" stroke="indigo" stroke-width="7" fill="none" />
<path d="M56.326439665051815,-139.02277581266776 l-134.12624864257336,243.1726184580657 l181.6380642842761,-140.44883346951397 l-186.16397132093834,72.6648605751885" stroke-width="7" stroke="red" fill="none" marker-start="url(#d0)" marker-end="url(#d1)" />
<path d="M-103,56 l138,-168 l-70,112 l-68,0 l68,56 l138,-168" stroke-width="7" stroke="white" fill="none" marker-start="url(#d2)" marker-end="url(#d3)" />
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB