Beispiel #1
0
 def getTurnAngle(self) :
     dirToHead = distAngleCalc.calcAngle(
         self.curXCoord, self.curYCoord, self.nexXCoord, self.nexYCoord, self.northAt)
     turnAngle = dirToHead - self.curAngle 
     if turnAngle > 180 :
         turnAngle -= 360
     elif turnAngle <= -180 :
         turnAngle += 360
     return turnAngle
Beispiel #2
0
 def fillAMatrix(self) :
 # angle always is calculated from the smaller index to the larger index
 # negative angle means turn left, positive means right
         for i in range(self.numElements) :
                 self.linkString = self.buildingMap['map'][i]['linkTo']
                 self.linkArray = [int(s) for s in self.linkString.split(',')]
                 x1 = int(self.buildingMap['map'][i]['x'])
                 y1 = int(self.buildingMap['map'][i]['y'])
                 for j in self.linkArray :
                         x2 = int(self.buildingMap['map'][j-1]['x'])
                         y2 = int(self.buildingMap['map'][j-1]['y'])
                         if self.matrix[j-1][i] == 0 :
                                 self.matrix[i][j-1] = distAngleCalc.distance(
                                     x1, y1, x2, y2)
                         else :
                                 self.matrix[i][j-1] = distAngleCalc.calcAngle(
                                     x2, y2, x1, y1, self.northAt)
import distAngleCalc

x1 = 3330
y1 = 934

x2 = 3376
y2 = 1787

northAt = 315

print distAngleCalc.calcAngle(x1, y1, x2, y2, northAt)