parameters: (self,draw_frustum=True,draw_coords=True)
docstring: Draws an OpenGL widget illustrating the viewport.
docstring_summary: Draws an OpenGL widget illustrating the viewport.
docstring_tokens: Draws an OpenGL widget illustrating the viewport .
function: def drawGL(self,draw_frustum=True,draw_coords=True) -> None:
          """Draws an OpenGL widget illustrating the viewport."""
          GL.glPushMatrix()
  
          mat = se3.homogeneous(self.get_transform())
          cols = list(zip(*mat))
          pack = sum((list(c) for c in cols),[])
          GL.glMultMatrixf(pack)
          n,f = self.clippingplanes
          aspect = float(self.w)/float(self.h)
          rfov = math.radians(self.fov)
          scale = math.tan(rfov*0.5/aspect)*aspect
          #note that +z is *backward* in the camera view
          if draw_frustum:
              xmin = (self.x - self.w*0.5)/((self.w)*0.5)
              xmax = (self.x + self.w*0.5)/((self.w)*0.5)
              ymax = -(self.y - self.h*0.5)/((self.h)*0.5)
              ymin = -(self.y + self.h*0.5)/((self.h)*0.5)
              xscale = scale
              yscale = xscale/aspect
              xmin *= xscale
              xmax *= xscale
              ymin *= yscale
              ymax *= yscale
              GL.glDisable(GL.GL_LIGHTING)
              GL.glColor3f(1,1,0)
              GL.glBegin(GL.GL_LINES)
              #near plane
              GL.glVertex3f(n*xmax,n*ymax,n)
              GL.glVertex3f(n*xmax,n*ymin,n)
              GL.glVertex3f(n*xmax,n*ymin,n)
              GL.glVertex3f(n*xmin,n*ymin,n)
              GL.glVertex3f(n*xmin,n*ymin,n)
              GL.glVertex3f(n*xmin,n*ymax,n)
              GL.glVertex3f(n*xmin,n*ymax,n)
              GL.glVertex3f(n*xmax,n*ymax,n)
              #far plane
              GL.glVertex3f(f*xmax,f*ymax,f)
              GL.glVertex3f(f*xmax,f*ymin,f)
              GL.glVertex3f(f*xmax,f*ymin,f)
              GL.glVertex3f(f*xmin,f*ymin,f)
              GL.glVertex3f(f*xmin,f*ymin,f)
              GL.glVertex3f(f*xmin,f*ymax,f)
              GL.glVertex3f(f*xmin,f*ymax,f)
              GL.glVertex3f(f*xmax,f*ymax,f)
              #connections
              GL.glVertex3f(n*xmax,n*ymax,n)
              GL.glVertex3f(f*xmax,f*ymax,f)
              GL.glVertex3f(n*xmax,n*ymin,n)
              GL.glVertex3f(f*xmax,f*ymin,f)
              GL.glVertex3f(n*xmin,n*ymin,n)
              GL.glVertex3f(f*xmin,f*ymin,f)
              GL.glVertex3f(n*xmin,n*ymax,n)
              GL.glVertex3f(f*xmin,f*ymax,f)
              GL.glEnd()
  
          if draw_coords:
              gldraw.xform_widget(se3.identity(),0.1,0.01)
              
          GL.glPopMatrix()
function_tokens: def drawGL ( self , draw_frustum = True , draw_coords = True ) -> None : GL . glPushMatrix ( ) mat = se3 . homogeneous ( self . get_transform ( ) ) cols = list ( zip ( * mat ) ) pack = sum ( ( list ( c ) for c in cols ) , [ ] ) GL . glMultMatrixf ( pack ) n , f = self . clippingplanes aspect = float ( self . w ) / float ( self . h ) rfov = math . radians ( self . fov ) scale = math . tan ( rfov * 0.5 / aspect ) * aspect #note that +z is *backward* in the camera view if draw_frustum : xmin = ( self . x - self . w * 0.5 ) / ( ( self . w ) * 0.5 ) xmax = ( self . x + self . w * 0.5 ) / ( ( self . w ) * 0.5 ) ymax = - ( self . y - self . h * 0.5 ) / ( ( self . h ) * 0.5 ) ymin = - ( self . y + self . h * 0.5 ) / ( ( self . h ) * 0.5 ) xscale = scale yscale = xscale / aspect xmin *= xscale xmax *= xscale ymin *= yscale ymax *= yscale GL . glDisable ( GL . GL_LIGHTING ) GL . glColor3f ( 1 , 1 , 0 ) GL . glBegin ( GL . GL_LINES ) #near plane GL . glVertex3f ( n * xmax , n * ymax , n ) GL . glVertex3f ( n * xmax , n * ymin , n ) GL . glVertex3f ( n * xmax , n * ymin , n ) GL . glVertex3f ( n * xmin , n * ymin , n ) GL . glVertex3f ( n * xmin , n * ymin , n ) GL . glVertex3f ( n * xmin , n * ymax , n ) GL . glVertex3f ( n * xmin , n * ymax , n ) GL . glVertex3f ( n * xmax , n * ymax , n ) #far plane GL . glVertex3f ( f * xmax , f * ymax , f ) GL . glVertex3f ( f * xmax , f * ymin , f ) GL . glVertex3f ( f * xmax , f * ymin , f ) GL . glVertex3f ( f * xmin , f * ymin , f ) GL . glVertex3f ( f * xmin , f * ymin , f ) GL . glVertex3f ( f * xmin , f * ymax , f ) GL . glVertex3f ( f * xmin , f * ymax , f ) GL . glVertex3f ( f * xmax , f * ymax , f ) #connections GL . glVertex3f ( n * xmax , n * ymax , n ) GL . glVertex3f ( f * xmax , f * ymax , f ) GL . glVertex3f ( n * xmax , n * ymin , n ) GL . glVertex3f ( f * xmax , f * ymin , f ) GL . glVertex3f ( n * xmin , n * ymin , n ) GL . glVertex3f ( f * xmin , f * ymin , f ) GL . glVertex3f ( n * xmin , n * ymax , n ) GL . glVertex3f ( f * xmin , f * ymax , f ) GL . glEnd ( ) if draw_coords : gldraw . xform_widget ( se3 . identity ( ) , 0.1 , 0.01 ) GL . glPopMatrix ( )