예제 #1
0
파일: Scene.py 프로젝트: niamiot/RGPA
	def generate(self):
		g.cloud(self.an,name='scene',color='r',dice=6,R=1,access='new')
		try :
			ll=np.shape(self.bn)[1]
			for i in range (ll):
				g.cloud(self.bn[i,:],display=False,name='scene',color='g',dice=6,access='append')
		except :
			g.cloud(self.bn,display=False,name='scene',color='g',dice=6,access='append')
예제 #2
0
파일: CLA.py 프로젝트: niamiot/RGPA
	def show3(self,l=-1,amb=False,sc='all'):
		""" Display constraints and theirs boxes through geomview. 


		geomview parameters are the following

		self.parmsh['display']=False   		# launch geomview interactively 
		self.parmsh['scene']=True      		# display whole scene
		self.parmsh['boxes']=True      		# display constraint box
		self.parmsh['constr_boxes']=False       # display constraint box
		self.parmsh['estimated']=True  		# display estimated point
		
		...


		.. todo:

			create a .ini file for geomview parameters

		:Parameters:

			l	: layer number to observe. If -1 estimation is made on the highest available layer. default = -1
			amb	: display ambiguous boxes. default = false
			sc 	: display all constraint or give a list with the constrinat number to observe ex: [0,1,3]. default 'all'

		:Returns:
			Nothing but calls a geomview instance 
		
		
		"""
		Nc = self.Nc
		filename = "./geom/cla.list"
		fd =open(filename,"w")
		fd.write("LIST\n")
		par=self.parmsh

		if par['constr_boxes']:

			if l==-1:
				if sc == 'all':
					for c in self.c:
						c.parmsh['display']=False
						c.parmsh['scene']=False
						fname = c.show3()
						fd.write("{<"+fname+".list}\n")
				else :
					try: 
						for vsc in sc:
							self.c[vsc].parmsh['display']=False
							self.c[vsc].parmsh['scene']=False
							fname = self.c[vsc].show3()
							fd.write("{<"+fname+".list}\n")
					except :
						self.c[sc].parmsh['display']=False
						self.c[sc].parmsh['scene']=False
						fname = self.c[sc].show3()
						fd.write("{<"+fname+".list}\n")

			else:
				self.c[l].parmsh['dispay']=False
				self.c[l].parmsh['scene']=False
				fname = self.c[l].show3()
				fd.write("{<"+fname+".list}\n")
		
		col = ['r','b','g','m','y','b','r']	

		

		if par['scene']:
			an= np.zeros(len(self.bn))
			for c in self.c:
				an=np.vstack((an,c.p))




			S=Scene(an=an,bn=self.bn)
			sce=S.generate()


		if par['estimated']:
			try :
				sce = g.cloud(self.pe,display=False,name='scene',color='k',dice=6,access='append')
			except : 
				pass

			fd.write("{<"+sce+"}\n")

		if par['boxes']:

			for l in self.dlayer.keys():
				self.dlayer[l][0].parmsh['display']=False
				self.dlayer[l][1].parmsh['display']=False

				try :
					fname = self.dlayer[l][0].show3(col=col[Nc-l+1],Id=l)
					fd.write("{<"+fname+"}\n")
				except :
					pass

				if amb :
					coco=['r','v','b','y']
					fname = self.dlayer[l][1].show3(col=col[Nc-l],Id=l+1)
#					fname = self.dlayer[l][1].show3(col=coco,Id=l+1)
					fd.write("{<"+fname+"}\n")

		
		fd.close()	
		chaine = "geomview  -nopanel  -b 1 1 1 " + filename + " 2>/dev/null &"

		os.system(chaine)