• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python visual.display函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中visual.display函数的典型用法代码示例。如果您正苦于以下问题:Python display函数的具体用法?Python display怎么用?Python display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了display函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: set_scene

def set_scene(r):   # r = position of test body
    vp.display(title='Restricted 3body', background=(1,1,1))
    body = vp.sphere(pos=r, color=(0,0,1), radius=0.03, make_trail=1)
    sun = vp.sphere(pos=(-a,0), color=(1,0,0), radius=0.1)
    jupiter = vp.sphere(pos=(b, 0), color=(0,1,0), radius=0.05)
    circle = vp.ring(pos=(0,0), color=(0,0,0), thickness=0.005,
                     axis=(0,0,1), radius=1)      # unit circle
    return body
开发者ID:com-py,项目名称:compy,代码行数:8,代码来源:Program_4.7_r3body.py


示例2: set_scene

def set_scene(R, r):        # create bodies, velocity arrows
    vp.display(title='Three-body motion', background=(1,1,1))
    body, vel = [], []      # bodies, vel arrows
    c = [(1,0,0), (0,1,0), (0,0,1), (0,0,0)]    # RGB colors
    for i in range(3):
        body.append(vp.sphere(pos=r[i],radius=R,color=c[i],make_trail=1))
        vel.append(vp.arrow(pos=body[i].pos,shaftwidth=R/2,color=c[i]))
    line, com = vp.curve(color=c[3]), vp.sphere(pos=(0,0), radius=R/4.)
    return body, vel, line
开发者ID:com-py,项目名称:compy,代码行数:9,代码来源:Program_4.5_3body.v1.py


示例3: __init__

    def __init__(self, npts=100000, Rotate=False, title=''):
        ptsize = 3
        mapptsize = 1
        self.scene_angle = 0
        self.localscene = visual.display(title=title + ' Local Coordinate System')
        self.globalscene = visual.display(title=title + ' Global Coordinate System')
        #self.globalscene.background = (1, 1, 1)
        #self.globalscene.up = (0, 0, 1)
        #self.globalscene.forward = (0, 1, -0.4)
        self.currentrow = 0

        self.auto_colour = False

        # Set up the global coordinate frame visualiser
        self.globalscene.select()

        self.globalscene.up =(0, 0, 1.0)

        #self.visualrobot = visual.box(length=3, height=2, width=1.5)
        w = 1
        wid = 0.2
        self.robotpts = np.array(( (0, -wid, 0, w), (0, wid, 0, w), (3*wid, 0, 0, w), (0, -wid, 0, w) ))
        #self.visualrobot = visual.points(pos=self.robotpts[:, :3], size=4, shape='round', color=(0, 1, 1))
        self.visualrobot = visual.curve(pos=self.robotpts[:, :3], color=(0, 1, 1))

        X = np.array([(-1, -1), (-1, 1), (1, 1), (1, -1), (-1, -1)])
        square = visual.curve(pos=50*X)
        self.leftmappts = visual.points(size=ptsize, shape='square', color=(1, 0, 0))
        self.rightmappts = visual.points(size=ptsize, shape='square', color=(0, 1, 0))
        self.spinmappts = visual.points(size=ptsize, shape='square', color=(0, 0, 1))
        X = np.zeros((npts, 3))
        self.mappts = visual.points(pos=X, size=mapptsize, shape='square', color=(1, 1, 1))
        self.trajpts_ind = 0
        self.trajpts = visual.points(pos=np.zeros((10000, 3)), color=(0, 0, 1), size=2)
        visual.scene.show_rendertime = True

        if Rotate:
            # Enable continuous rotation
            RV = RotateVisual(self.globalscene)
            RV.start()
        else:
            # Enable mouse panning
            MT = dispxyz.EnableMouseThread(self.globalscene)
            MT.start()

        # Set up the local coordinate frame visualiser
        if showlocal:
            self.localscene.select()
            self.leftpts = visual.points(color=(1, 0, 0), size=ptsize, shape='square')
            self.rightpts = visual.points(color=(0, 1, 0), size=ptsize, shape='square')
            self.spinpts = visual.points(color=(0, 0, 1), size=ptsize, shape='square')
            visual.scene.show_rendertime = True
        
        self.colourmin = -4
        self.colourmax = 4
开发者ID:ChristopherMcFaul,项目名称:Previous-Work,代码行数:55,代码来源:robotvisualiser.py


示例4: visualize

def visualize(flow_grid, input_grid):
    """
    Visualize the flow in flow_grid on input_grid with VPython, using gray 
    squares for blocked spaces (input_grid[i][j] = 1) and blue squares for
    spaces with flow (flow_grid[i][j] = '*').

    All objects in the scene will be removed prior to drawing.  The active 
    scene will be used.

    >>> visualize([['*','*',1],['*',1,1],['*',1,1]], [[0,0,1],[0,1,1],[0,0,1]])
    """
    from visual import box, display

    blue = (0, 0, 1)
    gray = (.5, .5, .5)
    black = (0.3, 0.3, 0.3)

    size = len(input_grid)
    total_size = size * size
    disp = display.get_selected()       # gets the active display
    if disp is None:                    # no display, so create one
        display(title="Percolation", autocenter=True)
    else:                               # display exists, empty it
        disp.autocenter = True          # autocenter for convenience
        # We only need to delete these boxes if there is a mismatch in the
        # number of boxes versus the number of grid cells. We assume that no
        # other objects are on the scene.
        if total_size != len(disp.objects):
            for object in disp.objects:
                object.visible = False  # make all objects in display invisible

    # redraw all of the grid, because of the size mismatch
    if total_size != len(disp.objects):
        for row in range(size):
            for col in range(size):
                # for blocked spaces, draw a gray box
                if input_grid[row][col]==1:
                    box(pos=(col, -row, 0), color=gray)
                # for spaces with flow, draw a blue box
                elif flow_grid[row][col]!=-1:
                    box(pos=(col, -row, 0), color=blue)
                else:
                    box(pos=(col, -row, 0), color=black)
    # or just change the colors, based on the grids given
    else:
        for object in disp.objects:
            x, y, _ = object.pos
            x, y = int(x), int(y)
            if flow_grid[-y][x] != -1:
                object.color = blue
            elif input_grid[-y][x] == 1:
                object.color = gray
            else:
                object.color = black
开发者ID:IMECH,项目名称:CRS-2011-Nov-Computational-Phys,代码行数:54,代码来源:grid.py


示例5: __init__

	def __init__( self ):
		QtCore.QThread.__init__( self )
		self.C = 0
		# it is requred to process input events from visual window
		self.display = visual.display ()
		self.s = visual.sphere( pos=visual.vector( 1, 0, 0 ) )
		self.keep_running=True
开发者ID:lauyader,项目名称:proyectoPython,代码行数:7,代码来源:qt.py


示例6: main

def main():
    scene = visual.display(width=settings.SCENE_WIDTH, height=settings.SCENE_HEIGHT)
    ground = visual.box(axis=(0, 1, 0), pos=(0, 0, 0), length=0.1, height=500, width=500, color=visual.color.gray(0.75), opacity=0.5)

    def addGait(gaitClass, gaitName):
        gait = gaitClass(gaitName, settings.GAIT_LEGS_GROUPS[gaitName], settings.GAIT_PARAMS[gaitName])
        GaitManager().add(gait)

    addGait(GaitTripod, "tripod")
    addGait(GaitTetrapod, "tetrapod")
    addGait(GaitRiple, "riple")
    addGait(GaitWave, "metachronal")
    addGait(GaitWave, "wave")
    GaitManager().select("riple")

    robot = Hexapod3D()

    remote = Gamepad(robot)

    GaitSequencer().start()
    remote.start()

    robot.setBodyPosition(z=30)

    robot.mainLoop()

    remote.stop()
    remote.join()
    GaitSequencer().stop()
    GaitSequencer().join()
开发者ID:fma38,项目名称:Py4bot,代码行数:30,代码来源:hexapod.py


示例7: setup_scene

def setup_scene(fullscreen):
  '''
  Sets up the scene for the display output.
  '''
  # Set title and background color (white)
  scene = visual.display(title="Robot Simulation",background=(1,1,1))
  # Automatically center
  scene.autocenter = True
  # Removing autoscale
  scene.autoscale = 0
  # Set whether the windows will take up entire screen or not
  scene.fullscreen = fullscreen
  # Size of the windows seen is the size of one beam (to begin)
  scene.range = (BEAM['length'],BEAM['length'],BEAM['length'])
  # The center of the windows exists at the construction location
  scene.center = helpers.scale(.5,helpers.sum_vectors(
    CONSTRUCTION['corner'],scene.range))
  # Vector from which the camera start
  scene.forward = (1,0,0)
  # Define up (used for lighting)
  scene.up = (0,0,1)
  # Defines whether or not we exit the program when we exit the screen
  # visualization
  scene.exit = False

  return scene
开发者ID:kandluis,项目名称:sap2000,代码行数:26,代码来源:visualization.py


示例8: PlotSpheres3

def PlotSpheres3(f):
  data = json.loads(open(f, "r").read())

  scene = vs.display(title='3D representation',
    x=0, y=0, width=1920, height=1080,
    autocenter=True,background=(0,0,0))

  vs.box(pos=(
    (data["SystemSize"][1][0]+data["SystemSize"][0][0])*0.5,
    (data["SystemSize"][1][1]+data["SystemSize"][0][1])*0.5,
    (data["SystemSize"][1][2]+data["SystemSize"][0][2])*0.5
  ),
  length=data["SystemSize"][1][0]-data["SystemSize"][0][0],
  height=data["SystemSize"][1][1]-data["SystemSize"][0][1],
  width= data["SystemSize"][1][2]-data["SystemSize"][0][2],
  opacity=0.2,
  color=vs.color.red)

  spheres = [vs.sphere(radius=data["SphereSize"],pos=(data["Data"][0][i], data["Data"][1][i], data["Data"][2][i])) for i in range(data["SpheresNumber"])]

  vs.arrow(pos=data["SystemSize"][0], axis=(1,0,0), shaftwidth=0.1, color=vs.color.red)
  vs.arrow(pos=data["SystemSize"][0], axis=(0,1,0), shaftwidth=0.1, color=vs.color.green)
  vs.arrow(pos=data["SystemSize"][0], axis=(0,0,1), shaftwidth=0.1, color=vs.color.blue)

  while True:
    vs.rate(60)
开发者ID:Milias,项目名称:ModellingSimulation,代码行数:26,代码来源:graphs.py


示例9: PlotSphereEvolution3

def PlotSphereEvolution3(f):
  data = json.loads(open(f, "r").read())

  center = (
    (data["SystemSize"][1][0]+data["SystemSize"][0][0])*0.5,
    (data["SystemSize"][1][1]+data["SystemSize"][0][1])*0.5,
    (data["SystemSize"][1][2]+data["SystemSize"][0][2])*0.5
  )

  scene = vs.display(title='3D representation',
    x=0, y=0, width=1920, height=1080,
    center=center,background=(0,0,0)
  )

  vs.box(pos=center,
  length=data["SystemSize"][1][0]-data["SystemSize"][0][0],
  height=data["SystemSize"][1][1]-data["SystemSize"][0][1],
  width= data["SystemSize"][1][2]-data["SystemSize"][0][2],
  opacity=0.2,
  color=vs.color.red)

  spheres = [vs.sphere(radius=data["SphereSize"],pos=(data["Data"][0][0][i], data["Data"][1][0][i], data["Data"][2][0][i])) for i in range(data["SpheresNumber"])]

  nt = 0
  while True:
    vs.rate(60)
    for i in range(data["SpheresNumber"]):
      spheres[i].pos = (data["Data"][0][nt][i], data["Data"][1][nt][i], data["Data"][2][nt][i])
    if nt + 1 >= data["SavedSteps"]:
      nt = 0
    else:
      nt += 1
开发者ID:Milias,项目名称:ModellingSimulation,代码行数:32,代码来源:graphs.py


示例10: show_protective

def show_protective(nparticles):
    # create scene
    scene = visual.display(title='Protective zones', width=600, height=400, center=(0,0,0))
    scene.select()

    # read in positions, state and protective zones
    positions = (numpy.genfromtxt('position.dat'))[:nparticles]
    state = (numpy.genfromtxt('state.dat'))[:nparticles]
    zones = (numpy.genfromtxt('fpt.dat'))[:nparticles]

    # go through particles and display them
    for i in range(nparticles):
        # color the spheres according to state
        cball = visual.color.green

        if (state[i,0]==1):
            cball = visual.color.red
        else:
            cball = visual.color.blue

        if (state[i,3]==1):
            cball = visual.color.yellow
            
        if (state[i,3]==2):
            cball = visual.color.orange

        visual.sphere(pos=(positions[i,0], positions[i,1], positions[i,2]), radius=zones[i], color=cball)
        visual.label(pos=(positions[i,0], positions[i,1], positions[i,2]), text='{0:d}'.format(i))
开发者ID:Inchman,项目名称:Inchman,代码行数:28,代码来源:randomwalk.py


示例11: __init__

    def __init__(self):
        ode.World.__init__(self)
        self._myScene = visual.display()

        # A joint group for the contact joints that are generated whenever
        # two bodies collide
        self._contactGroup = ode.JointGroup()
开发者ID:PeterJCLaw,项目名称:3D-SR-Sim,代码行数:7,代码来源:__init__.py


示例12: __init__

    def __init__(self, background=None, ambient=None, show_axis=True):
        super(Visualiser, self).__init__()
        if not VISUAL_INSTALLED:
            return

        if background is None:
            background = (0.957, 0.957, 1)
        if ambient is None:
            ambient = 0.5
        self.display = visual.display(title='PVTrace', x=0, y=0, width=800, height=600, background=background,
                                      ambient=ambient)
        self.display.bind('keydown', self.keyInput)
        self.display.exit = False

        self.display.center = (0.025, 0.015, 0)
        self.display.forward = (0, 0.83205, -0.5547)
        
        show_axis = False
        if show_axis:
            visual.curve(pos=[(0, 0, 0), (.08, 0, 0)], radius=0.0005, color=visual.color.red)
            visual.curve(pos=[(0, 0, 0), (0, .07, 0)], radius=0.0005, color=visual.color.green)
            visual.curve(pos=[(0, 0, 0), (0, 0, .08)], radius=0.0005, color=visual.color.blue)
            visual.label(pos=(.09, 0, 0), text='X', background=visual.color.red, linecolor=visual.color.red)
            visual.label(pos=(0, .08, 0), text='Y', background=visual.color.green, linecolor=visual.color.green)
            visual.label(pos=(0, 0, .07), text='Z', background=visual.color.blue, linecolor=visual.color.blue)
开发者ID:dcambie,项目名称:pvtrace,代码行数:25,代码来源:Visualise.py


示例13: __init__

	def __init__(self, room_=1, beam_axis_=0, target_pos_=(0,0,0)):
		self.labScene = visual.display(title="7Be(d,n)8B Experiment", width=800, height=600, background=GetRGBcode(153,204,255))
		axisx = visual.box(pos=(0,0,0), axis=(10.0,0,0), width=0.05, height=0.05, color=visual.color.red)
		axisy = visual.box(pos=(0,0,0), axis=(0,10.0,0), width=0.05, height=0.05, color=visual.color.blue)
		axisz = visual.box(pos=(0,0,0), axis=(0,0,10.0), width=0.05, height=0.05, color=visual.color.green)
		labelx = visual.label(pos=(5.0,0,0), text="Z-Axis")
		labely = visual.label(pos=(0,5.0,0), text="Y-Axis")
		labelz = visual.label(pos=(0,0,5.0), text="X-Axis")
		self.labScene.center = target_pos_
		self.labScene.autoscale = False
		
		self.room = room_
		self.beam_axis = beam_axis_
		self.target_pos = target_pos_
		
		self.Floors = []
		self.Walls = []
		self.Columns = []
		self.Others = []		

		self.BuildRoom()

		if(self.room == 1 or self.room == 2):
			chamber_radius = 0.25
			self.Beamline1 = visual.cylinder(pos=Translate(self.target_pos,GetCartesianCoords(chamber_radius, math.pi/2.0, DegToRad(180+self.beam_axis))), axis=ConvIM3(71.75,0,-71.75*math.tan(DegToRad(180-self.beam_axis))), radius=ConvIM(1.75), color=visual.color.blue) # East beamline
			self.Beamline2 = visual.cylinder(pos=Translate(self.target_pos,GetCartesianCoords(chamber_radius, math.pi/2.0, DegToRad(self.beam_axis))), axis=ConvIM3(-217.5,0,217.5*math.tan(DegToRad(180-self.beam_axis))), radius=ConvIM(1.75), color=visual.color.blue) # West beamline
			self.OneMeterChamber = visual.cylinder(pos=self.target_pos, axis=(0,chamber_radius*2,0), radius=chamber_radius, color=visual.color.blue)
			self.OneMeterChamber.pos[1] = -0.5
开发者ID:cthornsb,项目名称:vandmc,代码行数:28,代码来源:Layout.py


示例14: __init__

 def __init__( self, NCellsPerDimension, Length, E0 ):
     self.n   = NCellsPerDimension
     self.L   = Length
     self.V   = self.L**3
     self.N   = 4 * self.n**3
     self.a   = self.L / self.n
     self.E0  = E0
     self.E   = E0
     self.U   = 0
     self.dU  = 0
     self.ddU = 0
     self.particles = []
     self.index = 0
     self.dt    = 1e-2
     self.dt_2  = self.dt * 0.5
     self.dt2_2 = self.dt * self.dt_2
 
     self.scene = visual.display( title = 'System',
                                  x=800, y=0,
                                  width=800, height=800,
                                  center = visual.vector(0.5,0.5,0.5) * self.L,
                                  autoscale = False,
                                  range = 1.5 * self.L)
 
     self.box   = visual.box( pos     = visual.vector(0.5,0.5,0.5) * self.L,
                              length  = self.L,
                              height  = self.L,
                              width   = self.L,
                              color   = visual.color.green,
                              opacity = 0.2 )
开发者ID:gonzaponte,项目名称:Python,代码行数:30,代码来源:run.py


示例15: __init__

 def __init__(self):
   win = vs.window(width=1024, height=720, menus=False, title='SIMULATE VPYTHON GUI')# make a main window. Also sets w.panel to addr of wx window object.
   scene = vs.display( window=win, width=800, height=720, forward=-vs.vector(1,1,2))# make a 3D panel
   vss = scene
   p = win.panel
   sphere_button = wx.Button(p, label='Sphere', pos=(810,10), size=(190,100))
   #sphere_button.Bind(wx.EVT_BUTTON, self.options())
   cube_button = wx.Button(p, label='Cube', pos=(810,120), size=(190,100))
开发者ID:anupcec,项目名称:vortex,代码行数:8,代码来源:workspace.py


示例16: __init__

 def __init__(self):
     Node.__init__(self)
     self.step = 1
     self.maxlen = (slen / 2) / self.step
     self.g = visual.display(width=600, height=200,center=(slen/4,30,0))
     self.curves = []
     self.label = False
     self.lastdominant = 0
开发者ID:leshy,项目名称:fourier-to-midi,代码行数:8,代码来源:basic.py


示例17: __init__

    def __init__(self, vals, scene=None):
        data_show.__init__(self, vals)
        # If no axes are defined, create some.

        if scene==None:
            self.scene = visual.display(title='Data Visualization')
        else:
            self.scene = scene
开发者ID:buntyke,项目名称:GPy,代码行数:8,代码来源:visualize.py


示例18: animate_motion

def animate_motion(x, k):
    # Animate using Visual-Python
    CO = zeros((n, 3))
    B2 = zeros((n, 3))
    C1 = zeros((n, 3))
    C3 = zeros((n, 3))
    CN = zeros((n, 3))

    for i, state in enumerate(x[:,:5]):
        CO[i], B2[i], C1[i], C3[i] = rd.anim(state, r)
        # Make the out of plane axis shorter since this is what control the height
        # of the cone
        B2[i] *= 0.001
        C1[i] *= r
        C3[i] *= r
        CN[i, 0] = state[3]
        CN[i, 1] = state[4]

    from visual import display, rate, arrow, curve, cone, box
    black = (0,0,0)
    red = (1, 0, 0)
    green = (0, 1, 0)
    blue = (0, 0, 1)
    white = (1, 1, 1)
    NO = (0,0,0)
    scene = display(title='Rolling disc @ %0.2f realtime'%k, width=800,
            height=800, up=(0,0,-1), uniform=1, background=white, forward=(1,0,0))
    # Inertial reference frame arrows
    N = [arrow(pos=NO,axis=(.001,0,0),color=red),
         arrow(pos=NO,axis=(0,.001,0),color=green),
         arrow(pos=NO,axis=(0,0,.001),color=blue)]
    # Two cones are used to look like a thin disc
    body1 = cone(pos=CO[0], axis=B2[0], radius=r, color=blue)
    body2 = cone(pos=CO[0], axis=-B2[0], radius=r, color=blue)
    # Body fixed coordinates in plane of disc, can't really be seen through cones
    c1 = arrow(pos=CO[0],axis=C1[0],length=r,color=red)
    c3 = arrow(pos=CO[0],axis=C3[0],length=r,color=green)
    trail = curve()
    trail.append(pos=CN[0], color=black)
    i = 1
    while i<n:
        rate(k/ts)
        body1.pos = CO[i]
        body1.axis = B2[i]
        body2.pos = CO[i]
        body2.axis = -B2[i]
        c1.pos = body1.pos
        c3.pos = body1.pos
        c1.axis = C1[i]
        c3.axis = C3[i]
        c1.up = C3[i]
        c3.up = C1[i]
        trail.append(pos=CN[i])
        i += 1
开发者ID:certik,项目名称:pydy,代码行数:54,代码来源:plot_rollingdisc.py


示例19: display

def display(cylinders,Lx,Ly):
    scene = visual.display(center = [Ly/2.0,.14,Lx/2.0], forward = [0,-1,0],
            up = [1,0,0],background=(1,1,1))
    surr = visual.curve(pos=[(0,0,0),(0,0,Lx),(Ly,0,Lx),(Ly,0,0),(0,0,0)],
            radius=.005*Lx,color=(0,0,0))
    for cyl in cylinders:
        x = cyl.pos[0]
        y = cyl.pos[1]
        z = 0
        rod = visual.cylinder(pos=(y,z,x), axis=(0,.001,0), radius = cyl.radius,
                color=(200,0,0))
开发者ID:johnaparker,项目名称:meep-random-2d,代码行数:11,代码来源:random2d.py


示例20: __init__

    def __init__(self):
        self.canvas = visual.display(title='Crystal Viewer'
                                     , width=500
                                     , height=500
                                     , background=(0, 0, 0)
                                     , fov=math.pi / 10
                                     , scale=(0.5, 0.5, 0.5)
                                     , userspin=0
                                     , exit=0)

        self.lastRotation = (0, 0, 0)
开发者ID:kreativt,项目名称:ebsdtools,代码行数:11,代码来源:crystalObject.py



注:本文中的visual.display函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python visual.label函数代码示例发布时间:2022-05-26
下一篇:
Python visual.cylinder函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap