-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathObstacleList.py
28 lines (23 loc) · 901 Bytes
/
ObstacleList.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# The file contains data structure which is in form of the list of obstacles
import IncludeHeader
import numpy as np
from ObstacleStructure import ObstacleStructure
class ObstacleList( ObstacleStructure ):
def __init__( self, segmentList ):
# List of all line segments of all obstacles
self.data = segmentList
def findIntersectObject( self, line2 ):
for line in self.data:
intersectPts = self.lineIntersectionTest( line, line2 )
if intersectPts is not None:
return intersectPts
return None
def findClosestObject( self, point ):
minDist = 10000
for line in self.data:
dist = self.shortestDistancePointLine( line, point )
if (dist < minDist):
minDist = dist
return minDist
def __len__( self ):
return len( self.data )