def radial(center, vertex, b):

    #Sammelt Numerische Werte aus Variables-Objekt
    pForward=singleton.radialpForward
    pTurn=singleton.radialpTurn
    lMin=singleton.radiallMin
    lMax=singleton.radiallMax

    #Berechnet Radialvector und Vektor des letzten Weges zu diesem Punkt
    radialvector=vertex.coords-center
    previous_vector=np.array(vertex.coords-vertex.neighbours[len(vertex.neighbours)-1].coords)
    previous_vector=previous_vector/np.linalg.norm(previous_vector)

    suggested_vertices=[]
    weiter=False

    #Berechnet, ob der Vektor eher Radial oder Tangential verlaeuft
    alpha=case_differentiation(previous_vector, radialvector)
    previous_vector=rotate(alpha, previous_vector)


    #Geradeaus
    v=random.uniform(lMin, lMax)*previous_vector
    random_number=random.randint(0, 100)
    if random_number<=pForward:
        k=Vertex(vertex.coords+v)
        suggested_vertices.append(k)

    #Rechts
    v=random.uniform(lMin, lMax)*previous_vector
    random_number=random.randint(0, 100)
    if random_number<=pTurn*b*b:
        k=Vertex(vertex.coords+rotate(90, v))
        suggested_vertices.append(k)
        weiter=True

    #Links
    v=random.uniform(lMin, lMax)*previous_vector
    random_number=random.randint(0, 100)
    if random_number<=pTurn*b*b:
        k=Vertex(vertex.coords-rotate(90, v))
        suggested_vertices.append(k)
        weiter=True


    #Seed!
    if not weiter:
        vertex.seed=True
        singleton.global_lists.vertex_queue.append([vertex, 0])


    return suggested_vertices
Example #2
0
def radial(center, vertex, b):

    #Sammelt Numerische Werte aus Variables-Objekt
    pForward = singleton.radialpForward
    pTurn = singleton.radialpTurn
    lMin = singleton.radiallMin
    lMax = singleton.radiallMax

    #Berechnet Radialvector und Vektor des letzten Weges zu diesem Punkt
    radialvector = vertex.coords - center
    previous_vector = np.array(vertex.coords -
                               vertex.neighbours[len(vertex.neighbours) -
                                                 1].coords)
    previous_vector = previous_vector / np.linalg.norm(previous_vector)

    suggested_vertices = []
    weiter = False

    #Berechnet, ob der Vektor eher Radial oder Tangential verlaeuft
    alpha = case_differentiation(previous_vector, radialvector)
    previous_vector = rotate(alpha, previous_vector)

    #Geradeaus
    v = random.uniform(lMin, lMax) * previous_vector
    random_number = random.randint(0, 100)
    if random_number <= pForward:
        k = Vertex(vertex.coords + v)
        suggested_vertices.append(k)

    #Rechts
    v = random.uniform(lMin, lMax) * previous_vector
    random_number = random.randint(0, 100)
    if random_number <= pTurn * b * b:
        k = Vertex(vertex.coords + rotate(90, v))
        suggested_vertices.append(k)
        weiter = True

    #Links
    v = random.uniform(lMin, lMax) * previous_vector
    random_number = random.randint(0, 100)
    if random_number <= pTurn * b * b:
        k = Vertex(vertex.coords - rotate(90, v))
        suggested_vertices.append(k)
        weiter = True

    #Seed!
    if not weiter:
        vertex.seed = True
        singleton.global_lists.vertex_queue.append([vertex, 0])

    return suggested_vertices
Example #3
0
def organic(vertex, b):

    # Sammelt Numerische Werte aus Variables-Objekt
    pForward = singleton.organicpForward
    pTurn = singleton.organicpTurn
    lMin = singleton.organiclMin
    lMax = singleton.organiclMax

    suggested_vertices = []
    weiter = False

    # Berechnet den Vektor des letzten Weges zu diesem Punkt
    previous_vector = np.array(vertex.coords -
                               vertex.neighbours[len(vertex.neighbours) -
                                                 1].coords)
    previous_vector = previous_vector / np.linalg.norm(previous_vector)

    # Geradeaus
    v = random.uniform(lMin, lMax) * previous_vector
    random_number = random.randint(0, 100)
    if random_number <= pForward:
        k = Vertex(vertex.coords + rotate(np.random.uniform(-30, 30), v))
        suggested_vertices.append(k)

    # Rechts
    v = random.uniform(lMin, lMax) * previous_vector
    random_number = random.randint(0, 100)
    if random_number <= b * pTurn:
        k = Vertex(vertex.coords + rotate(np.random.uniform(-120, -60), v))
        suggested_vertices.append(k)
        weiter = True

    # Links
    v = random.uniform(lMin, lMax) * previous_vector
    random_number = random.randint(0, 100)
    if random_number <= b * pTurn:
        k = Vertex(vertex.coords + rotate(np.random.uniform(60, 120), v))
        suggested_vertices.append(k)
        weiter = True

    # Seed!
    if not weiter:
        vertex.seed = True
        singleton.global_lists.vertex_queue.append([vertex, 0])

    return suggested_vertices
def organic(vertex,b):
	
	#Sammelt Numerische Werte aus Variables-Objekt
	pForward=singleton.organicpForward
	pTurn=singleton.organicpTurn
	lMin=singleton.organiclMin
	lMax=singleton.organiclMax
	
	
	suggested_vertices=[]
	weiter=False
	
	#Berechnet den Vektor des letzten Weges zu diesem Punkt
	previous_vector=np.array(vertex.coords-vertex.neighbours[len(vertex.neighbours)-1].coords)
	previous_vector=previous_vector/np.linalg.norm(previous_vector)
	
	
	#Geradeaus
	v=random.uniform(lMin,lMax)*previous_vector
	random_number=random.randint(0,100)
	if random_number<=pForward:
		k=Vertex(vertex.coords+rotate(np.random.uniform(-30,30),v))
		suggested_vertices.append(k)
	
	#Rechts
	v=random.uniform(lMin,lMax)*previous_vector
	random_number=random.randint(0,100)
	if random_number<=b*pTurn:
		k=Vertex(vertex.coords+rotate(np.random.uniform(-120,-60),v))
		suggested_vertices.append(k)
		weiter=True
	
	#Links
	v=random.uniform(lMin,lMax)*previous_vector
	random_number=random.randint(0,100)
	if random_number<=b*pTurn:
		k=Vertex(vertex.coords+rotate(np.random.uniform(60,120),v))
		suggested_vertices.append(k)
		weiter=True
	
	#Seed!
	if not weiter:
		vertex.seed=True
		singleton.global_lists.vertex_queue.append([vertex, 0])
	
	return suggested_vertices
def seed(vertex,b):
	
	pSeed=singleton.pSeed
	lMin=singleton.seedlMin
	lMax=singleton.seedlMax
	
	suggested_vertices=[]
	
	l=len(vertex.neighbours)
	v1=rotate(90,vertex.neighbours[0].coords-vertex.coords)
	v2=None
	if l==1:
		v2=v1
	elif l==2:
		v2=rotate(90,vertex.neighbours[1].coords-vertex.coords)*-1
	else:
		return []
	v1=v1/np.linalg.norm(v1)
	v2=v2/np.linalg.norm(v2)
	#Rechts
	if b*b*pSeed>np.random.randint(0,100):
		l=np.random.uniform(lMin,lMax)
		k=np.random.uniform(0,1)
		coords=((1-k)*v1+k*v2)*l
		k=Vertex(vertex.coords+coords)
		k.minor_road=True
		suggested_vertices.append(k)
	
	
	v1=v1*-1
	v2=v2*-1
	
	#Links
	if 	b*b*pSeed>np.random.randint(0,100):
		l=np.random.uniform(lMin,lMax)
		k=np.random.uniform(0,1)
		coords=((1-k)*v1+k*v2)*l
		k=Vertex(vertex.coords+coords)
		k.minor_road=True
		suggested_vertices.append(k)
	
	return suggested_vertices
Example #6
0
def seed(vertex, b):

    pSeed = singleton.pSeed
    lMin = singleton.seedlMin
    lMax = singleton.seedlMax

    suggested_vertices = []

    l = len(vertex.neighbours)
    v1 = rotate(90, vertex.neighbours[0].coords - vertex.coords)
    v2 = None
    if l == 1:
        v2 = v1
    elif l == 2:
        v2 = rotate(90, vertex.neighbours[1].coords - vertex.coords) * -1
    else:
        return []
    v1 = v1 / np.linalg.norm(v1)
    v2 = v2 / np.linalg.norm(v2)
    #Rechts
    if b * b * pSeed > np.random.randint(0, 100):
        l = np.random.uniform(lMin, lMax)
        k = np.random.uniform(0, 1)
        coords = ((1 - k) * v1 + k * v2) * l
        k = Vertex(vertex.coords + coords)
        k.minor_road = True
        suggested_vertices.append(k)

    v1 = v1 * -1
    v2 = v2 * -1

    #Links
    if b * b * pSeed > np.random.randint(0, 100):
        l = np.random.uniform(lMin, lMax)
        k = np.random.uniform(0, 1)
        coords = ((1 - k) * v1 + k * v2) * l
        k = Vertex(vertex.coords + coords)
        k.minor_road = True
        suggested_vertices.append(k)

    return suggested_vertices