예제 #1
0
def readpoints(filename):
    points = []
    with open(filename) as f:
        for line in f:
            pid,x,y,z = [int(x) for x in line.split()]
            points.append(mapPoint(pid,x,y,z))
    return points
예제 #2
0
 def calcCentroid(self,cluster,name):
     x = 0.0
     y = 0.0
     z = 0.0
     i = 0
     for point in cluster:
         x+=point.x
         y+=point.y
         z+=point.z
         i+=1
     return mapPoint(name,x/i,y/i,z/i)