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


Python Polygon.center方法代碼示例

本文整理匯總了Python中Polygon.center方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.center方法的具體用法?Python Polygon.center怎麽用?Python Polygon.center使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Polygon的用法示例。


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

示例1: len

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import center [as 別名]
		
		
		if country in i_country_dict.keys():
			i_country_dict[country]=i_country_dict[country]+len(x_points)
			i_area_dict[country]=i_area_dict[country]+i_area
		else:
			i_country_dict[country]=len(x_points)
			i_area_dict[country]=i_area

		
		if len(x_points)<20: 
			print "Dropped for too small."
			continue
			
		if len(x_points)<50: 
			center=i_poly.center()
			if check_pop(pop_dict,center)<1.0:
				print "Dropped for too few people."
				continue

		
		inter_x,inter_y=chi(x_points,y_points,lam)
		new_x,new_y=linear(inter_x,inter_y,threshold)
		l_area=Polygon([[new_x[i],new_y[i]] for i in range(len(new_x))]).area()

		i_lam=lam
		if len(x_points)>=5000: 
			num_thres=500
		elif len(x_points)>=500: 
			num_thres=200
		else: 
開發者ID:MingruBai,項目名稱:Alidade_shapeSimplification,代碼行數:33,代碼來源:chi_linear_auto.py

示例2: __init__

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import center [as 別名]

#.........這裏部分代碼省略.........
        self.realRobot.rotate(pose[2]-pi/2,pose[0],pose[1]) 
                      
        #constructing map with all the regions included           
        for region in self.rfi.regions: 
            if region.name.lower()=='freespace':
                pointArray = [x for x in region.getPoints()]
                pointArray = map(self.coordmap_map2lab, pointArray)
                regionPoints = [(pt[0],pt[1]) for pt in pointArray]
                freespace    = Polygon(regionPoints)
                freespace_big= Polygon(regionPoints)                
                freespace_big.scale(1.2, 1.2)
                self.freespace = freespace_big -freespace
                self.map += freespace_big -freespace               #without including freespace

            else:
                pointArray = [x for x in region.getPoints()]
                pointArray = map(self.coordmap_map2lab, pointArray)
                regionPoints = [(pt[0],pt[1]) for pt in pointArray]
                self.map +=  Polygon(regionPoints)  

                
        #Plot the robot on the map in figure 1
        if self.PLOT == True:
            plt.figure(self.original_figure)
            plt.clf()            
            self.plotPoly(self.realRobot, 'r')
            self.plotPoly(self.robot, 'b')
            plt.plot(pose[0],pose[1],'bo')
            self.plotPioneer(self.original_figure)

    def gotoRegion(self, current_reg, next_reg, last=False):
        
        """
        If ``last`` is True, we will move to the center of the destination region.

        Returns ``True`` if we've reached the destination region.
        """

        q_gBundle              = [[],[]]          # goal bundle
        q_overlap              = [[],[]]          # overlapping points with robot range       
        pose = self.pose_handler.getPose()        # Find our current configuration 
        
        #Plot the robot on the map in figure 1
        if self.PLOT == True:
            plt.figure(self.original_figure)
            plt.clf()         
            self.plotPoly(self.realRobot, 'r')
            self.plotPoly(self.robot, 'b')
            plt.plot(pose[0],pose[1],'bo') 
            self.plotPioneer(self.original_figure)
        
        if current_reg == next_reg and not last:
            # No need to move!
            self.drive_handler.setVelocity(0, 0)  # So let's stop
            return False
               
        # Check if Vicon has cut out
        if math.isnan(pose[2]):
            print "WARNING: No Vicon data! Pausing."
            #self.drive_handler.setVelocity(0, 0)  # So let's stop
            time.sleep(1)
            return False

        ###This part is run when the robot goes to a new region, otherwise, the original map will be used.       
        if not self.previous_current_reg == current_reg:
            print 'getting into bug alogorithm'
開發者ID:SMSmith,項目名稱:LTLMoP,代碼行數:70,代碼來源:BugController.py


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