parameters: (self,fn : str)
docstring: Loads from a viewport txt file. The file format is compatible with
          the RobotTest, RobotPose, and SimTest apps.
docstring_summary: Loads from a viewport txt file. The file format is compatible with
          the RobotTest, RobotPose, and SimTest apps.
docstring_tokens: Loads from a viewport txt file . The file format is compatible with the RobotTest RobotPose and SimTest apps .
function: def load_file(self,fn : str) -> None:
          """Loads from a viewport txt file. The file format is compatible with
          the RobotTest, RobotPose, and SimTest apps.
          """
          f = open(str(fn),'r')
          read_viewport = False
          mat = None
          for line in f:
              entries = line.split()
              if len(entries) == 0:
                  continue
              kw = entries[0]
              args = entries[1:]
              if kw == 'VIEWPORT':
                  read_viewport = True
                  continue
              else:
                  if not read_viewport:
                      warnings.warn("File does not appear to be a valid viewport file, must start with VIEWPORT")
                      break
              if kw == 'FRAME':
                  self.x,self.y,self.w,self.h = [int(x) for x in args]
              elif kw == 'PERSPECTIVE':
                  if args[0] != '1':
                      warnings.warn("CANNOT CHANGE TO ORTHO MODE IN PYTHON VISUALIZATION")
              elif kw == 'SCALE':
                  scale = float(args[0])
                  aspect = float(self.w)/float(self.h)
                  #2.0*math.tan(rfov*0.5/aspect)*aspect = 1.0/scale
                  #math.tan(rfov*0.5/aspect) = 0.5/(scale*aspect)
                  #rfov*0.5/aspect = math.atan(0.5/(scale*aspect))
                  #rfov = 2*aspect*math.atan(0.5/(scale*aspect))
                  rfov = math.atan(0.5/(scale*aspect))*2*aspect
                  self.fov = math.degrees(rfov)
              elif kw == 'NEARPLANE':
                  self.clippingplanes = (float(args[0]),self.clippingplanes[1])
              elif kw == 'FARPLANE':
                  self.clippingplanes = (self.clippingplanes[0],float(args[0]))
              elif kw == 'CAMTRANSFORM':
                  mat = [args[0:4],args[4:8],args[8:12],args[12:16]]
                  for i,row in enumerate(mat):
                      mat[i] = [float(x) for x in row]
              elif kw == 'ORBITDIST':
                  self.camera.dist = float(args[0])
              else:
                  raise RuntimeError("Invalid viewport keyword "+kw)
          if mat is not None:
              self.camera.set_matrix(se3.from_homogeneous(mat))
  
          f.close()
function_tokens: def load_file ( self , fn : str ) -> None : f = open ( str ( fn ) , 'r' ) read_viewport = False mat = None for line in f : entries = line . split ( ) if len ( entries ) == 0 : continue kw = entries [ 0 ] args = entries [ 1 : ] if kw == 'VIEWPORT' : read_viewport = True continue else : if not read_viewport : warnings . warn ( "File does not appear to be a valid viewport file, must start with VIEWPORT" ) break if kw == 'FRAME' : self . x , self . y , self . w , self . h = [ int ( x ) for x in args ] elif kw == 'PERSPECTIVE' : if args [ 0 ] != '1' : warnings . warn ( "CANNOT CHANGE TO ORTHO MODE IN PYTHON VISUALIZATION" ) elif kw == 'SCALE' : scale = float ( args [ 0 ] ) aspect = float ( self . w ) / float ( self . h ) #2.0*math.tan(rfov*0.5/aspect)*aspect = 1.0/scale #math.tan(rfov*0.5/aspect) = 0.5/(scale*aspect) #rfov*0.5/aspect = math.atan(0.5/(scale*aspect)) #rfov = 2*aspect*math.atan(0.5/(scale*aspect)) rfov = math . atan ( 0.5 / ( scale * aspect ) ) * 2 * aspect self . fov = math . degrees ( rfov ) elif kw == 'NEARPLANE' : self . clippingplanes = ( float ( args [ 0 ] ) , self . clippingplanes [ 1 ] ) elif kw == 'FARPLANE' : self . clippingplanes = ( self . clippingplanes [ 0 ] , float ( args [ 0 ] ) ) elif kw == 'CAMTRANSFORM' : mat = [ args [ 0 : 4 ] , args [ 4 : 8 ] , args [ 8 : 12 ] , args [ 12 : 16 ] ] for i , row in enumerate ( mat ) : mat [ i ] = [ float ( x ) for x in row ] elif kw == 'ORBITDIST' : self . camera . dist = float ( args [ 0 ] ) else : raise RuntimeError ( "Invalid viewport keyword " + kw ) if mat is not None : self . camera . set_matrix ( se3 . from_homogeneous ( mat ) ) f . close ( )