當前位置: 首頁>>代碼示例>>Python>>正文


Python PandaModules.LineSegs類代碼示例

本文整理匯總了Python中pandac.PandaModules.LineSegs的典型用法代碼示例。如果您正苦於以下問題:Python LineSegs類的具體用法?Python LineSegs怎麽用?Python LineSegs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了LineSegs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: draw

	def draw(self):
		# Draw attack radius
		attackRadLine = LineSegs()
		attackRadLine.setThickness(1)
		attackRadLine.setColor(self._color)
		attackRadLine.moveTo(self.attackRad, 0, 0)
		for i in range(self._EDGES + 1):
			newX = (self.attackRad * math.cos((2*math.pi/self._EDGES)*i))
			newY = (self.attackRad * math.sin((2*math.pi/self._EDGES)*i))
			attackRadLine.drawTo(newX, newY, 0)
		attackRadGeom = attackRadLine.create()
		self._attackRadCircleNP = NodePath(attackRadGeom)
		self._attackRadCircleNP.reparentTo(self._np)
		
		# Draw foot circle
		self._footCircle.setThickness(1)
		self._footCircle.setColor(self._color)
		self._footCircle.moveTo(self.footRad, 0, 0)
		for i in range(self._EDGES):
			newX = (self.footRad * math.cos((2*math.pi/self._EDGES)*i))
			newY = (self.footRad * math.sin((2*math.pi/self._EDGES)*i))
			self._footCircle.drawTo(newX, newY, 0)
		self._footCircle.drawTo(self.footRad, 0, 0)
		footCircleGeom = self._footCircle.create()
		self._footCircleNP = NodePath(footCircleGeom)
		self._footCircleNP.reparentTo(self._np)
開發者ID:crempp,項目名稱:psg,代碼行數:26,代碼來源:GeomObjects.py

示例2: __init__

	def __init__(self, parent, entity, foot=1):
		self.entity = entity
		self._moveRadCircleNP  = NodePath("Movement Radius Node")
		self._moveLine         = LineSegs()
		self._moveLineNP       = NodePath("Movement Direction Line Node")
		self._moveZLine        = LineSegs()
		self._moveZLineNP      = NodePath("Movement Z Line Node")
		self._moveZFootNP      = NodePath("Movement Z Foot Node")
		self._moveFootCircle   = LineSegs()
		self._moveFootCircleNP = NodePath("Movement Foot Circle Node")
		self._attackRadCircle  = LineSegs()
		self._attackRadCircleNP= NodePath("Attack Radius Node")
		self._np               = NodePath("Movement Node")
		self.attackables       = []
		Event.Dispatcher().register(self, 'E_Key_ZUp', self.onZChange)
		Event.Dispatcher().register(self, 'E_Key_ZDown', self.onZChange)
		Event.Dispatcher().register(self, 'E_Key_ZUp-up', self.onZChange)
		Event.Dispatcher().register(self, 'E_Key_ZDown-up', self.onZChange)
		self.aaLevel= int(GameSettings().getSetting('ANTIALIAS'))
		self.parent = parent
		self.start  = Vec3(0, 0, 0)
		self.moveRad = entity.moveRad
		self.footRad = foot
		self.attackRad = entity.attackRad
		self.plane = Plane(Vec3(0, 0, 1), Point3(0, 0, 0))
		self.draw()
		self._np.reparentTo(self.parent)
		if self.aaLevel > 0:
			self._np.setAntialias(AntialiasAttrib.MLine, self.aaLevel)
		taskMgr.add(self.updateMovePos, 'Movement Indicator Update Task')
開發者ID:crempp,項目名稱:psg,代碼行數:30,代碼來源:GeomObjects.py

示例3: add_line

 def add_line(self, rendering_node, color, thickness, start, end):
     linesegs = LineSegs()  
     linesegs.setColor(*color) 
     linesegs.setThickness(thickness)
     linesegs.drawTo((start[0], start[1], start[2])) 
     linesegs.drawTo((end[0], end[1], end[2]))    
     new_node = linesegs.create()
     rendering_node.attachNewNode(new_node)
開發者ID:charles-daumont,項目名稱:PyNetLogo,代碼行數:8,代碼來源:Main.py

示例4: drawLineToNeighbors

 def drawLineToNeighbors(self):
     ls = LineSegs()
     ls.setThickness(1.0)
     for neighbor in self.neighbors:
         ls.setColor(1,1,1,1)
         ls.moveTo(self.getPos(render))
         ls.drawTo(neighbor.getPos(render))
     self.np = NodePath(ls.create("Neighbor Line Segment"))
     self.np.reparentTo(render)
開發者ID:Babi-Wan,項目名稱:robotic-agent-path-planning-project,代碼行數:9,代碼來源:waypoint.py

示例5: __createLine

 def __createLine(self, length=1, color=(1,1,1,1), endColor=None):
   LS=LineSegs()
   LS.setColor(*color)
   LS.moveTo(0,0,0)
   LS.drawTo(length*1,0,0)
   node=LS.create()
   if endColor:
     LS.setVertexColor(1,*endColor)
   return node
開發者ID:KillerGoldFisch,項目名稱:panda3d-editor,代碼行數:9,代碼來源:pDirectTree.py

示例6: xBox

def xBox(frame, lineThick=2, color=(1,1,1,1), brdrColor=(1,1,1,1), BGColor = None):
	w = frame[1]-frame[0]
	h = frame[3]-frame[2]
	bx = LineSegs('xbox')
	rect(bx, (frame[1]-h/4,frame[1]-3*h/4,frame[2]+h/4,frame[3]-h/4))
	ex(bx, (frame[1]-h/4,frame[1]-3*h/4,frame[2]+h/4,frame[3]-h/4))
	box = bx.create()
	if BGColor:
		fill(rectangleLine, frame, BGColor, lineThick).reparentTo(NodePath(box))
	return box
開發者ID:rll,項目名稱:labeling_tool,代碼行數:10,代碼來源:buttonjoe.py

示例7: drawBestPath

 def drawBestPath(self):
     if self.bestPath != None:
         ls = LineSegs()
         ls.setThickness(10.0)
         for i in range(len(self.bestPath) - 1):
             ls.setColor(0, 0, 1, 1)
             ls.moveTo(self.bestPath[i].getPos())
             ls.drawTo(self.bestPath[i + 1].getPos())
             np = NodePath(ls.create("aoeu"))
             np.reparentTo(render)
開發者ID:Babi-Wan,項目名稱:robotic-agent-path-planning-project,代碼行數:10,代碼來源:npc.py

示例8: sepLine

def sepLine(frame, styles):
	style = styles['menu separator']
	ls = LineSegs('sepLine')
	ls.setColor(style['color'])
	ls.setThickness(style['thick'])
	hpad = (frame[1]-frame[0])*.2
	hh = frame[3]+(frame[3]-frame[2])#/2
	ls.moveTo(frame[0]+hpad,0,hh)
	ls.drawTo(frame[1]-hpad,0,hh)
	return ls.create()
開發者ID:rll,項目名稱:labeling_tool,代碼行數:10,代碼來源:buttonjoe.py

示例9: __init__

    def __init__( self, *args, **kwargs ):
        colour = kwargs.pop( 'colour', (1, 1, 1, .2) )
        p3d.SingleTask.__init__( self, *args, **kwargs )

        # Create a card maker
        cm = CardMaker( self.name )
        cm.setFrame( 0, 1, 0, 1 )
        
        # Init the node path, wrapping the card maker to make a rectangle
        NodePath.__init__( self, cm.generate() )
        self.setColor( colour )
        self.setTransparency( 1 )
        self.reparentTo( self.root2d )
        self.hide()
        
        # Create the rectangle border
        ls = LineSegs()
        ls.moveTo( 0, 0, 0 )
        ls.drawTo( 1, 0, 0 )
        ls.drawTo( 1, 0, 1 )
        ls.drawTo( 0, 0, 1 )
        ls.drawTo( 0, 0, 0 )
        
        # Attach border to rectangle
        self.attachNewNode( ls.create() )
開發者ID:Derfies,項目名稱:panda3d-editor,代碼行數:25,代碼來源:marquee.py

示例10: makeArc

def makeArc(color, angle_degrees = 360, numsteps = 16, horizon_plane = 0,): 
    ls = LineSegs() 
    ls.setColor(color)
    angleRadians = deg2Rad(angle_degrees) 

    for i in xrange(numsteps + 1): 
        a = angleRadians * i / numsteps 
        y = math.sin(a) 
        x = math.cos(a) 

        ls.drawTo(x, y, horizon_plane)
        ls.setThickness(2.0)
        ls.setColor(color)
    node = ls.create() 
    return NodePath(node)
開發者ID:mcgillcomp361,項目名稱:COMP361Project,代碼行數:15,代碼來源:shapes.py

示例11: __init__

    def __init__(self, *args, **kwargs):
        ViewTowers.__init__(self, *args, **kwargs)

        # ignore keys set by viewer
        for key in self.getAllAccepting():
            if key in ("s", "escape"):
                continue
            self.ignore(key)
        self.permanent_events = self.getAllAccepting()

        # global variables
        self.text_bg = (1, 1, 1, 0.7)
        self.font = self.loader.loadFont("cmr12.egg")
        self.question = "Use the mouse to indicate the direction that " "the tower will fall."
        self.feedback_time = 3.0
        self.buffer_time = 0.75

        # create text
        self.create_all_text()

        # create direction line
        self.line = LineSegs()
        self.line_node = None
        self.angle = None

        alight = AmbientLight("alight3")
        alight.setColor((0.8, 0.8, 0.8, 1))
        self.line_light = self.lights.attachNewNode(alight)
開發者ID:jhamrick,項目名稱:pycon-2014-talk,代碼行數:28,代碼來源:which_direction.py

示例12: __init__

    def __init__(self, width=1, depth=1, height=1, thickness=1.0, origin=Point3(0, 0, 0)):
        def __Get3dPoint(pt, origin, axis):
            p = Point3(pt.x, pt.y, 0) - origin
            return RotatePoint3(p, Vec3(0, 0, 1), axis)

        # Create line segments
        self.ls = LineSegs()
        self.ls.setThickness(thickness)

        # axes = [Vec3(1, 0, 0), Vec3(0, 1, 0), Vec3(0, 0, 1), Vec3(1, 0, 0), Vec3(0, 1, 0), Vec3(0, 0, 1)]
        # origins = [origin, origin, origin, origin + Point3(0, 0, -1), origin + Point3(0, 0, -1), origin + Point3(0, 0, 1)]
        axes = [Vec3(1, 0, 0), Vec3(0, 1, 0), Vec3(-1, 0, 0), Vec3(0, -1, 0)]
        origins = [origin, origin, origin, origin]
        for m in range(len(axes)):

            # Get the points for square, append the first one to the end to
            # complete the square
            pts = GetPointsForSquare2(width, height)
            pts.append(pts[0])
            for i in range(len(pts) - 1):

                # Get the distance a third of the way along the edge
                dist = (pts[i + 1] - pts[i]) / 3

                # Draw one square
                self.ls.moveTo(__Get3dPoint(pts[i], origins[m], axes[m]))
                self.ls.drawTo(__Get3dPoint(pts[i] + dist, origins[m], axes[m]))
                self.ls.moveTo(__Get3dPoint(pts[i] + dist + dist, origins[m], axes[m]))
                self.ls.drawTo(__Get3dPoint(pts[i + 1], origins[m], axes[m]))

        # Init the node path, wrapping the lines
        node = self.ls.create()
        NodePath.__init__(self, node)
開發者ID:LBdN,項目名稱:labs,代碼行數:33,代碼來源:geometry.py

示例13: rectangle

def rectangle(frame, lineThick=2, color=(1,1,1,1), brdrColor=(1,1,1,1), BGColor = None):
	ls = LineSegs()
	ls.setThickness(lineThick)
	if brdrColor != 'transparent':
		ls.setColor(brdrColor)
		rectangleLine(ls, frame)
	else:
		ls.setColor(color)
	a = ls.create()
	if BGColor:
		fill(rectangleLine, frame, BGColor, lineThick).reparentTo(NodePath(a))
	return a
開發者ID:rll,項目名稱:labeling_tool,代碼行數:12,代碼來源:buttonjoe.py

示例14: bevelArrow

def bevelArrow(frame, bevel=.35, arrowhead=.4, lineThick=2, color=(1,1,1,1), brdrColor=(1,1,1,1), BGColor = None):
	ls = LineSegs()
	ls.setThickness(lineThick)
	if brdrColor != 'transparent':
		ls.setColor(brdrColor)
		bevelArrowLine(ls, frame, bevel, arrowhead)
	else:
		ls.setColor(color)
	a = ls.create()
	if BGColor:
		fill(bevelArrowLine, frame, BGColor, lineThick, bevel, arrowhead).reparentTo(NodePath(a))
	return a
開發者ID:rll,項目名稱:labeling_tool,代碼行數:12,代碼來源:buttonjoe.py

示例15: Arc

class Arc(NodePath):

    """NodePath class representing a wire arc."""

    def __init__(self, radius=1.0, numSegs=16, degrees=360, axis=Vec3(1, 0, 0), thickness=1.0, origin=Point3(0, 0, 0)):

        # Create line segments
        self.ls = LineSegs()
        self.ls.setThickness(thickness)

        # Get the points for an arc
        for p in GetPointsForArc(degrees, numSegs):

            # Draw the point rotated around the desired axis
            p = Point3(p[0], p[1], 0) - origin
            p = RotatePoint3(p, Vec3(0, 0, 1), axis)
            self.ls.drawTo(p * radius)

        # Init the node path, wrapping the lines
        node = self.ls.create()
        NodePath.__init__(self, node)
開發者ID:LBdN,項目名稱:labs,代碼行數:21,代碼來源:geometry.py


注:本文中的pandac.PandaModules.LineSegs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。