Adds a geometry module with a segment_intersection function

This commit is contained in:
Johann Dreo 2014-05-17 16:02:01 +02:00
commit c7dd463eb5
5 changed files with 217 additions and 28 deletions

View file

@ -1,13 +1,7 @@
import sys
import math
def x( point ):
return point[0]
def y( point ):
return point[1]
from geometry import x,y
def LOG( *args ):
"""Print something on stderr and flush"""
@ -84,7 +78,7 @@ def adjacency_from_set( segments ):
return graph
def vertices_from_set( segments ):
def vertices_of( segments ):
vertices = set()
for start,end in segments:
vertices.add(start)
@ -98,6 +92,3 @@ def tour(lst):
yield (a,b)
def euclidian_distance( ci, cj, graph = None):
return math.sqrt( float(ci[0] - cj[0])**2 + float(ci[1] - cj[1])**2 )