Example #1
0
 def __init__ (self, geom, data, invertProj = False):
     Spatial.__init__ (self, data)
     self.simplePolygons = []
     for s in geom:
         self.simplePolygons.append (SimplePolygon (s, invertProj))
     self.features = []
     self.db = None
Example #2
0
 def __init__ (self, geom, data = [], invertProj = False):
     Spatial.__init__ (self, data)
     if not invertProj:
         self.x = geom[0]
         self.y = geom[1]
     else:
         self.x = geom[1]
         self.y = geom[0]
Example #3
0
 def compute (self, mode, func, dst, *src):
     if mode == enum.ONE_TO_ONE:
         Spatial.compute (self, mode, func, dst, *src)
         for f in self.features:
             f.compute (mode, func, dst, *src)
     elif mode == enum.MANY_TO_ONE:
         params = []
         for f in self.features:
             for s in src:
                 if f.has_key (s):
                     params.append (f[s])
         if len (params) > 0:
             self[dst] = func (*params)
Example #4
0
import bpy
import sys
import os

filepath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, filepath)
#sys.path.append('/home/georgiy/.local/lib/python3.7/site-packages/')

from world import World
from spatial import Spatial

datapath = sys.argv[-2]
train_flag = sys.argv[-1]

world = World(bpy.context.scene, simulation_mode=True)
spatial = Spatial(world)

with open(datapath, "r") as f:
    lines = f.readlines()
    annotations = [line.split(":") for line in lines if line.strip() != ""]
    #spatial.reload(world)
    if train_flag == 'train':
        spatial.train(annotations, 10)
        spatial.save_parameters()
    else:
        spatial.evaluate(annotations)
    #bpy.ops.wm.quit_blender()

# for entity in world.entities:
# 	en_info = spatial.preprocessig(entity)
# 	print(en_info)