PDA

View Full Version : checking object location in an inclosed area of the world


Chapre
10-06-2010, 11:42 PM
Hello, is are there function that can help me check if an object is inside an area or inside another object.
illustration 1: how will I check if a wheelchair is inside the train or inside house
illustration 2: how will I check if a wheelchair is inside an inclosed area in the world

farshizzo
10-07-2010, 12:48 PM
If you have the bounding box the enclosed area and the position of the wheelchair, then you can use the following code to check whether the wheelchair is inside the enclosed area:# bb is bounding box of enclosed area
# p is [x,y,z] position of wheelchair

if (bb.xmin <= p[0] <= bb.xmax) and (bb.ymin <= p[1] <= bb.ymax) and (bb.zmin <= p[2] <= bb.zmax):
print 'Wheelchair inside'
else:
print 'Wheelchair outside'

Chapre
10-08-2010, 12:57 AM
Thanks a lot farshizzo, this is what I needed