def Init(LayoutFile=None,scale=4,speed=None,center_offset=0):
	"""
	Initialize the module. Must be called before any of the module functions can be called.

	Parameters:
	All parameters are optional.

	LayoutFile: <String> The name of the text file defining the map. If this parameter is
	provided, then the module will keep track of the subject's position in the layout and the subject will
	be prevented from moving through walls. This parameter must be given to use CanMoveForward and GetView.

	scale: <Float> The distance in meters between the center of two nodes in the environment. This is
	the distance that the subject will move when GoForward is called.

	speed: <Float> The speed that the subject will move forward in meters per second. If None, then
	the speed will be set to scale.

	center_offset: <Float> The distance in meters that the subject is separated from his axis of
	rotation. The axis of rotation is always the center of a node.

	Return Value: None.
	"""
	global __MOVEMENT_VAR, __PLAT_VAR
	if not speed: speed = scale
	__MOVEMENT_VAR = __MOVEMENT_CLASS(0,0,0,scale,speed,center_offset)
	viz.eyeheight(0.0)
	#viz.setfov(70,1)
	viz.mouse(viz.OFF) # don't want mouse input
	viz.callback(viz.TIMER_EVENT, TimerCallback)
	if LayoutFile:
		try:
			# use __PLAT_VAR to hold info about LayoutFile
			width, height, size = Navigator.getPlatDim(LayoutFile)
			__PLAT_VAR = Navigator.PLAT(width,height,size)
			__PLAT_VAR.ReadTextImage(LayoutFile)
			__PLAT_VAR.ComputeAllViews(100)
		except:
			__PLAT_VAR = None
			raise ("\n****** Error in Movement.Init ******\nUnable to initialize Plat Object with '%s'\n"%LayoutFile)
 def __init__(self, filename, initialState):
     (_w, _h, _s) = Navigator.getPlatDim(filename)
     self.MyPlat = Navigator.PLAT(_w, _h, _s)
     self.MyPlat.ReadTextImage(filename)
     self.MyPlat.ComputeAllViews(100)
     self.PossiblePositions = []
     #-------------------------------------------------
     # BJS 6/5/2002
     # Compute all of the possible positions in the environment.
     # Place all possible positions in the array PossiblePositions
     #-------------------------------------------------
     for position in self.MyPlat.ChosenList:
         for vCount in range(4):
             self.PossiblePositions.append(
                 (position[0], position[1], vCount))
     #-------------------------------------------------
     # Set the current state.
     # Convert from actual coordinates and angle.
     #-------------------------------------------------
     (x, y, t) = initialState
     if (t > -10 or t > 350) and t < 10: pos = (x, y, 1)
     elif t > 80 and t < 100: pos = (x, y, 2)
     elif t > 170 and t < 190: pos = (x, y, 3)
     else: pos = (x, y, 0)
     self.CurrState = pos
     #-------------------------------------------------
     # BJS 6/5/2002
     # Compute the view at the current state (CurrState)
     #-------------------------------------------------
     self.currView = self.MyPlat.Nodes[self.CurrState[0]][
         self.CurrState[1]].View[self.CurrState[2]]
     #-------------------------------------------------
     # BJS 6/5/2002
     # Find the states in the set of possible states that are
     # consistent with the current view.
     #-------------------------------------------------
     self.PossiblePositions = self.MyPlat.FindView(
         self.currView, self.PossiblePositions[:])
    def __init__(self, filename, width, height, length):
        self.viewmode = 0
        self.scale = width + length
        self.width = width
        self.height = height
        self.length = length

        #target location pointer
        self.targetpointer = viz.addchild(
            './Layouts/SharedMedia/Objects/bvmap_target_pointer.wrl')
        self.targetpointer.scale(self.scale * 0.8, self.scale * 0.8,
                                 self.scale * 0.8)
        self.targetpointer.disable(viz.LIGHTING)
        self.targetpointer.curtain(viz.CLOSE)
        (_w, _h, _s) = Navigator.getPlatDim(filename)
        MyPlat = Navigator.PLAT(_w, _h, _s)
        MyPlat.ReadTextImage(filename)
        #MyPlat.DisplayTextImage()

        maxx = -1
        maxy = -1
        minx = -1
        miny = -1

        #belief vector pointers
        self.pointers = []

        for y in range(MyPlat.y):
            for x in range(MyPlat.x):
                if (x, y) in MyPlat.ChosenList:
                    if x > maxx or maxx == -1: maxx = x
                    if x < minx or minx == -1: minx = x
                    if y > maxy or maxy == -1: maxy = y
                    if y < miny or miny == -1: miny = y

                    pointer_0 = viz.addchild(
                        './Layouts/SharedMedia/Objects/bvmap_pointer.wrl')
                    pointer_0.scale(self.scale, self.scale, self.scale)
                    pointer_0.disable(viz.LIGHTING)
                    pointer_0.curtain(viz.CLOSE)
                    pointer_90 = viz.addchild(
                        './Layouts/SharedMedia/Objects/bvmap_pointer.wrl')
                    pointer_90.scale(self.scale, self.scale, self.scale)
                    pointer_90.disable(viz.LIGHTING)
                    pointer_90.curtain(viz.CLOSE)
                    pointer_180 = viz.addchild(
                        './Layouts/SharedMedia/Objects/bvmap_pointer.wrl')
                    pointer_180.scale(self.scale, self.scale, self.scale)
                    pointer_180.disable(viz.LIGHTING)
                    pointer_180.curtain(viz.CLOSE)
                    pointer_270 = viz.addchild(
                        './Layouts/SharedMedia/Objects/bvmap_pointer.wrl')
                    pointer_270.scale(self.scale, self.scale, self.scale)
                    pointer_270.disable(viz.LIGHTING)
                    pointer_270.curtain(viz.CLOSE)

                    pointer_0.translate(x * self.scale,
                                        self.height + self.scale * 0.11,
                                        -y * self.scale + self.scale * 0.125)
                    pointer_90.translate(x * self.scale + self.scale * 0.125,
                                         self.height + self.scale * 0.11,
                                         -y * self.scale)
                    pointer_180.translate(x * self.scale,
                                          self.height + self.scale * 0.11,
                                          -y * self.scale - self.scale * 0.125)
                    pointer_270.translate(x * self.scale - self.scale * 0.125,
                                          self.height + self.scale * 0.11,
                                          -y * self.scale)
                    pointer_0.rotate(180, 90, 180)
                    pointer_90.rotate(180, 90, 90)
                    pointer_180.rotate(180, 90, 0)
                    pointer_270.rotate(180, 90, 270)

                    self.pointers.append([(x, y, 0), pointer_0])
                    self.pointers.append([(x, y, 90), pointer_90])
                    self.pointers.append([(x, y, 180), pointer_180])
                    self.pointers.append([(x, y, 270), pointer_270])

        # find center point (midx,midy)
        minx = minx * self.scale
        maxx = maxx * self.scale
        miny = -miny * self.scale
        maxy = -maxy * self.scale
        midx = (maxx + minx) / 2
        midy = (maxy + miny) / 2

        #find out how far away the farthest point from the center is.
        farthest = max([(midx - minx), (-midy + miny)])
        _yoffset = farthest + self.height + self.scale
        self.clipLevel = {
            "showMap": (_yoffset - self.height - 1.5, _yoffset - self.height),
            "hideMap":
            (_yoffset - self.height - 1.6, _yoffset - self.height - 1.5)
        }

        # Create a new window in the lower left corner
        self.window = viz.add(viz.WINDOW)
        self.window.position(0, 0.4)
        self.window.size(0.3, 0.4)
        self.window.fov(90, 1)

        # Create a new viewpoint and attach it to the window
        self.view = viz.add(viz.VIEWPOINT)
        self.window.viewpoint(self.view)
        self.view.translate(midx, _yoffset, midy)
        self.view.rotate(1, 0, 0, 90)

        # Hide the window.
        self.window.clip(*self.clipLevel["hideMap"])