亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? logtracer.java

?? 一款機(jī)器人仿真軟件,功能上與microsoft robotics studio有些相似,但基于Java平臺(tái).突出特點(diǎn)是給出了傳感器仿真,如聲納,激光等.
?? JAVA
字號(hào):
/*
 * Created on 13 mai 2005
 * 
 * Tobot log tracer - write the trajectory of a robot into an image file. 
 *
 */
package contribs.robotlogtracer;

import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.JFrame;



/**
 * This class will take a structure proposing the trace to create a png file (or a jpg) will be created.
 * In the basic, i will use a pixel matrix, ie an array of array. This matrix defines a density of passages
 * of the robots on each cases of the matrix. The more it went on a place, the darker the trace will be.
 * 
 * How it works : 
 * 
 *  The trace is represented by some kind of pixel Matrix. It is an integer matrix (ie int[][]).
 * The value of the integers at the position [i][j] represent how much the robot went on the 
 * position [i][j] in the environment. So the more it went, the darker the trace will be ( because 
 * the value will be greater )
 * 
 * In supplement, it is possible to plot points on specific locations with specific
 * colors. For example i do put a red point on my starting position adding the position 
 * with the setBeginTrace(x,y) function
 * For the collisions, i can add a second matrix to plot the collisions with green points.
 * 
 * It is also now possible to trace manualy a point with the function : tracePoint(..) 
 * 
 * 
 * TODO : Tracing the walls should be hand-written
 * 
 * @author Cedric Hartland
 *
 */
public class LogTracer extends JFrame {


	private String _path = "log/trace-"+(System.currentTimeMillis()/1000);
	
	private String _type = "png";
	
	private final String [] _stringType = ImageIO.getWriterFormatNames();
	
	private int _startingX;
	private int _startingZ;
	
	/**
	 * Default constructor.
	 *
	 */
	public LogTracer  () {	}
	
	/**
	 * Second constructor, take the path and the name of the (PNG) file to create.  
	 * @param __pathFile the formated \"path/filename.png\" to create
	 */
	public LogTracer (String __pathFile)
	{
		_path=__pathFile;
	}
	
	/**
	 * Thrid constructor, takes a path and a file type (image type). The pah may be empty if the default is to be used.
	 * @param __pathFile
	 * @param __type
	 */
	public LogTracer (String __pathFile, String __type)
	{
		if (__pathFile!="") _path=__pathFile;
		
		boolean found=false;
		int i=0;
		while (i<_stringType.length && !found)
		{
			if (_stringType[i]==_type)
			{ 
			_type=__type;
			found=true;
			}
			i++;
		}
		if (!found)
		{
			_type="png";
			System.err.println("Warning : the given type of file is unsupported, please ensure the format is correct");
			System.err.println("Warning : the file type for the traces will be png instead");			
		}
	}
	
	/**
	 * decide the type from the path name, else, keep the default one.
	 *
	 */
	private void setType(){
		try 
		{
		// if the last four are to be the file type, then, we can change the file type
		// else we do nothing but just test for the last char to be a dot, else we add
		char dot = _path.charAt(_path.length()-4);
		if (dot=='.') 
		{
			String type = _path.substring(_path.length()-3,_path.length());
			boolean found=false;
			int i=0;
			while (i<_stringType.length && !found)
			{
				if (_stringType[i].compareTo(type)==0)
				{ 
				_type=type;
				found=true;
				}
				i++;
			}
			_path=_path.substring(0,_path.length()-4);
			if (!found)
			{
				_type="png";
				System.err.println("Warning : the given type of file is unsupported, please ensure the format is correct");
				System.err.println("Warning : the file type for the traces will be png instead");
				System.err.flush();
			}
		}
		}
		catch(Exception e) 
		{ 
			//do nothing 
		}
	}
	
	/**
	 * trace a point on the graphic
	 * @param bi
	 * @param colour
	 * @param width
	 * @param height
	 */
	private void tracePoint(BufferedImage bi, int colour, int width, int height)
	{
		// define the range of the coords
		int beginX;
		int endX;
		int beginZ;
		int endZ;
		
		if (this._startingX<10) beginX=0;
		else beginX=this._startingX-10;
		if (this._startingX>height-10) endX=height;
		else endX=this._startingX+10;
		
		if (this._startingZ<10) beginZ=0;
		else beginZ=this._startingZ-10;
		if (this._startingZ>width-10) endZ=width;
		else endZ=this._startingZ+10;
		
		for(int i=beginX; i<endX; i++) bi.setRGB(i,this._startingZ,colour);
		for(int i=beginZ; i<endZ; i++) bi.setRGB(this._startingX,i,colour);		
	}
	
	/**
	 * trace a point on the graphic
	 * @param bi
	 * @param colour
	 * @param width
	 * @param height
	 * @param x
	 * @param z
	 */
	public void tracePoint(BufferedImage bi, int colour, int width, int height, int x, int z)
	{
		// define the range of the coords
		int beginX;
		int endX;
		int beginZ;
		int endZ;
		
		if (x<10) beginX=0;
		else beginX=x-10;
		if (x>height-10) endX=height;
		else endX=x+10;
		
		if (z<10) beginZ=0;
		else beginZ=z-10;
		if (z>width-10) endZ=width;
		else endZ=z+10;
		
		for(int i=beginX; i<endX; i++) bi.setRGB(i,z,colour);
		for(int i=beginZ; i<endZ; i++) bi.setRGB(x,i,colour);		
	}
	
	public void setBeginTrace(int __x, int __z)
	{
		this._startingX=__x;
		this._startingZ=__z;
	}
	
	/**
	 * This function commits the trace of the pixel matrix to a precise filename and path. The default output generated will be a png.
	 * @param traceMatrix the trace matrix that will be used to generate a file.
	 * @param __path the path and the name of the file to generate
	 */
	public void commitTrace(int [] [] traceMatrix, String __path)
	{
		_path = __path;
		commitTrace(traceMatrix);
	}
	
	/**
	 * This function commits the trace of the pixel matrix to a precise filename and path. The default output generated will be a png.
	 * @param traceMatrix the trace matrix that will be used to generate a file.
	 * @param __path the path and the name of the file to generate
	 */
	public void commitTrace(int [] [] traceMatrix, String __path, boolean [][] collisionMatrix)
	{
		_path = __path;
		commitTrace(traceMatrix,collisionMatrix);
	}
	
	/**
	 * Get the traceMatrix and write the image corresponding to a file. The height/width length of the matrix will be the same as the height/width of the image.
	 * The trace matrix represents the arena and the number of times the robots
	 * have been on a quadrant of it. The more it went, the darker the trace 
	 * will be.
	 * @param traceMatrix the trace matrix generated by the robot
	 */
	public void commitTrace(int [][] traceMatrix)
	{
		setType();
		
		//define the height/width of the image
		int height=traceMatrix.length;
		int width=traceMatrix[0].length; 
		
		// integrity checks
		for(int i=0;i<traceMatrix.length;i++)
		{
			if (traceMatrix[i].length!=width)
			{
				System.err.println("The pixel matrix is not well formed, it should be X*Y but some of its columns are not the right size");
				return;
			}
		}
		
		//define the BufferedImage 
		BufferedImage bufferedImage = new BufferedImage(height,width,BufferedImage.TYPE_INT_RGB);	
		
		//the trace define an intensity of passage to a pixel point, the more it is visited, the darker it will be.
		int value,col;
		int alpha = 255;
		int red = 255;
		int green = 255;
		int blue = 255;
		// we fill the BufferedImage
		for(int i=0; i<height;i++)
		{
			for(int j=0;j<width;j++)
			{
				// to be visible, we define grey traits on white board
				value= Math.min(255,10*(traceMatrix[i][j]));
				col =  (alpha << 24) |  ((red-value) << 16) |  ((green-value) << 8 ) | (blue-value);
				bufferedImage.setRGB(i,j,col);
			}
		}
		
		// set the starting point
		if (this._startingX!=0 || this._startingZ!=0)
		{
			col =  (alpha << 24) |  ((red) << 16) |  ((green-255) << 8 ) | (blue-255);
			this.tracePoint(bufferedImage,col,width,height);
		}
		
		// finaly we write the BufferedImage to a file
		try {
			File f = new File(_path+"."+_type);
			ImageIO.write( bufferedImage , _type , f );
		}
		catch(Exception e){
			System.out.println("Error append during the creation of the image");
			System.out.println("The process will now try to write it in the root of the classpath");
			try {
				System.err.println("Warning : the file could not be created, another try with the default settings will be computed on the root path");
				_path = "trace-"+(System.currentTimeMillis()/1000)+"."+this._type;
				File f = new File(_path);
				ImageIO.write( bufferedImage , _type , f );
			}
			catch(Exception e2){ e.printStackTrace(); }
		}
	}
	
	/**
	 * 	 * Get the traceMatrix and write the image corresponding to a file. The height/width length of the matrix will be the same as the height/width of the image.
	 * The trace matrix represents the arena and the number of times the robots
	 * have been on a quadrant of it. The more it went, the darker the trace 
	 * will be.
	 * @param traceMatrix the trace matrix generated by the robot
	 * @param collisionMatrix define the points where the robot did hit the wall
	 */
	public void commitTrace(int [][] traceMatrix, boolean [][] collisionMatrix)
	{
		setType();
		
		//define the height/width of the image
		int height=traceMatrix.length;
		int width=traceMatrix[0].length; 
		
		// integrity checks
		for(int i=0;i<traceMatrix.length;i++)
		{
			if (traceMatrix[i].length!=width)
			{
				System.err.println("The pixel matrix is not well formed, it should be X*Y but some of its columns are not the right size");
				return;
			}
		}
		for(int i=0;i<collisionMatrix.length;i++)
		{
			if (collisionMatrix[i].length!=width)
			{
				System.err.println("The pixel matrix is not well formed, it should be X*Y but some of its columns are not the right size");
				return;
			}
		}
		
		//define the BufferedImage 
		BufferedImage bufferedImage = new BufferedImage(height,width,BufferedImage.TYPE_INT_RGB);	
		
		//the trace define an intensity of passage to a pixel point, the more it is visited, the darker it will be.
		int value,col;
		int alpha = 255;
		int red = 255;
		int green = 255;
		int blue = 255;
		// we fill the BufferedImage
		for(int i=0; i<height;i++)
		{
			for(int j=0;j<width;j++)
			{
				// to be visible, we define grey traits on white board
				value= Math.min(255,10*(traceMatrix[i][j]));
				col =  (alpha << 24) |  ((red-value) << 16) |  ((green-value) << 8 ) | (blue-value);
				bufferedImage.setRGB(i,j,col);
			}
		}
		
		// put points on the colision positions
		for(int i=0; i<height;i++)
		{
			for(int j=0;j<width;j++)
			{
				if (collisionMatrix[i][j])
				{
					col =  (alpha << 24) |  ((red-255) << 16) |  ((green) << 8 ) | (blue-255);
					this.tracePoint(bufferedImage,col,width,height,i,j);
				}
			}
		}
		
		// set the starting point
		if (this._startingX!=0 || this._startingZ!=0)
		{
			col =  (alpha << 24) |  ((red) << 16) |  ((green-255) << 8 ) | (blue-255);
			this.tracePoint(bufferedImage,col,width,height);
		}
		
		
		// finaly we write the BufferedImage to a file
		try {
			File f = new File(_path+"."+_type);
			ImageIO.write( bufferedImage , _type , f );
		}
		catch(Exception e){
			System.out.println("Error append during the creation of the image");
			System.out.println("The process will now try to write it in the root of the classpath");
			try {
				System.err.println("Warning : the file could not be created, another try with the default settings will be computed on the root path");
				_path = "trace-"+(System.currentTimeMillis()/1000)+"."+this._type;
				File f = new File(_path);
				ImageIO.write( bufferedImage , _type , f );
			}
			catch(Exception e2){ e.printStackTrace(); }
		}
	}
	

	
	/**
	 * TEST: used to test the class.
	 * @param args the arguments ...
	 */
	public static void main(String[] args) 
	{
		int [][] trace = new int [256][256];
		int k=0;
		for(int i=0;i<trace.length;i++)
		{
			for(int j=0;j<trace[i].length;j++)
			{
				if (i==100 & j<100) trace[i][j]=(k++)/10;
				if (j==100 & i>100 & i<180) trace[i][j]=(k++)/10;
				if (i==180 & j>100) trace[i][j]=(k++)/10;
				
				//trace[i][j]=rand.nextInt((k++/1000)+1);
			}
		}
		
		LogTracer tr = new LogTracer("trace.png");
		tr.commitTrace(trace);
		//tr.setType();
	}
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人爽a毛片一区二区免费| 99re在线视频这里只有精品| 日本一区二区电影| 欧美性生活久久| 国产成人免费视频网站高清观看视频 | 国产成人高清视频| 亚洲欧美偷拍另类a∨色屁股| 欧美一区二区黄| 91色porny蝌蚪| 国产精品正在播放| 日本三级韩国三级欧美三级| 亚洲蜜臀av乱码久久精品蜜桃| 久久尤物电影视频在线观看| 欧美日韩精品三区| 色综合 综合色| 成人av在线资源| 国产电影一区在线| 久久草av在线| 日本女优在线视频一区二区| 亚洲自拍偷拍图区| 亚洲素人一区二区| 国产精品欧美久久久久一区二区| 日韩视频一区二区三区| 欧美日韩你懂的| 欧美影院精品一区| 色婷婷精品久久二区二区蜜臂av| 成人综合在线视频| 国产美女久久久久| 国内欧美视频一区二区 | 成人免费一区二区三区视频| 精品捆绑美女sm三区| 欧美一区二区三区四区高清 | 久久久久久久久岛国免费| 欧美一区二区三区小说| 51久久夜色精品国产麻豆| 欧美性极品少妇| 精品视频1区2区| 色偷偷久久一区二区三区| 色综合久久中文字幕| 一本一本大道香蕉久在线精品| 99久久精品国产毛片| 97精品久久久午夜一区二区三区 | 国产午夜亚洲精品午夜鲁丝片 | 日韩视频在线永久播放| 4438x亚洲最大成人网| 欧美电影影音先锋| 欧美一二区视频| 精品久久久三级丝袜| 久久综合中文字幕| 国产三级三级三级精品8ⅰ区| 久久久精品国产免费观看同学| 久久久777精品电影网影网| 久久久.com| 国产精品久久久久7777按摩| 有码一区二区三区| 午夜一区二区三区视频| 美女一区二区三区| 国产一区二区在线影院| 成人小视频免费观看| 色综合色综合色综合色综合色综合| 91免费国产视频网站| 欧美精品vⅰdeose4hd| 日韩一二三四区| 国产人久久人人人人爽| 亚洲欧洲国产日韩| 性感美女极品91精品| 紧缚捆绑精品一区二区| proumb性欧美在线观看| 欧美偷拍一区二区| 精品久久久久久久久久久久久久久| 国产欧美视频一区二区| 亚洲精品写真福利| 裸体一区二区三区| 成人国产一区二区三区精品| 欧美日韩综合不卡| www国产成人免费观看视频 深夜成人网| 国产欧美一区二区在线| 亚洲综合色噜噜狠狠| 精品综合免费视频观看| 色综合天天做天天爱| 欧美一区二区三级| 中文字幕一区在线观看视频| 偷拍亚洲欧洲综合| 从欧美一区二区三区| 欧美色视频在线| 国产精品无遮挡| 天天操天天色综合| 成人av网站大全| 欧美一区二区在线看| 亚洲欧洲精品一区二区三区| 免费看欧美女人艹b| 97精品电影院| 久久综合色播五月| 亚洲在线成人精品| 国产精品18久久久久久久久久久久 | 精品一区二区在线视频| 日本精品一级二级| 久久综合久久综合久久综合| 一区二区三区日韩欧美| 国产成人午夜视频| 7878成人国产在线观看| 亚洲欧美视频在线观看视频| 国产原创一区二区三区| 欧美精品日日鲁夜夜添| 18欧美乱大交hd1984| 国产伦精品一区二区三区免费迷 | 精品久久久久久久久久久久久久久久久| 中文字幕日韩一区| 国产一区在线观看视频| 欧美一级久久久| 亚洲午夜视频在线观看| 99久久精品一区| 国产亚洲精品7777| 久久99久久精品欧美| 777午夜精品视频在线播放| 亚洲色图视频网| 成人免费av网站| 久久久91精品国产一区二区三区| 美腿丝袜在线亚洲一区| 777xxx欧美| 香港成人在线视频| 欧美天天综合网| 一区二区三区不卡视频| 99久久综合精品| 国产精品进线69影院| 国产成人一区在线| 国产午夜一区二区三区| 国模大尺度一区二区三区| 欧美白人最猛性xxxxx69交| 日本午夜一本久久久综合| 欧美久久久久久久久久| 午夜伊人狠狠久久| 欧美日韩一区二区三区四区| 亚洲精品国产一区二区精华液| 97精品国产露脸对白| 亚洲少妇最新在线视频| 91亚洲永久精品| 亚洲伦理在线精品| 91福利小视频| 亚洲国产精品视频| 欧美精品久久一区二区三区| 午夜视频久久久久久| 91精品国产综合久久蜜臀| 免费成人深夜小野草| 日韩欧美国产三级电影视频| 老色鬼精品视频在线观看播放| 日韩欧美一二三| 极品美女销魂一区二区三区免费| 精品日本一线二线三线不卡| 紧缚奴在线一区二区三区| 国产日韩影视精品| 不卡的看片网站| 亚洲精品老司机| 欧美日本国产视频| 久久激情五月激情| 欧美r级在线观看| 国产91精品久久久久久久网曝门| 日本一区二区三级电影在线观看| 成人综合日日夜夜| 亚洲精品日韩综合观看成人91| 欧美日韩国产成人在线91| 久久精品国产精品亚洲综合| 欧美激情中文字幕一区二区| 91丨porny丨在线| 日韩黄色免费电影| 久久精子c满五个校花| 91香蕉国产在线观看软件| 亚洲成人动漫在线免费观看| 欧美成人一区二区三区片免费| 国产福利91精品一区二区三区| 日韩一区欧美小说| 337p亚洲精品色噜噜| 东方欧美亚洲色图在线| 亚洲国产一区二区在线播放| www久久精品| 色婷婷综合久色| 麻豆免费精品视频| 中文字幕在线观看一区| 3751色影院一区二区三区| 成人性生交大合| 日韩在线a电影| 国产精品久久一级| 欧美一区二区大片| 99久久99久久免费精品蜜臀| 日韩激情视频网站| 国产精品久久久久久久久免费樱桃 | 欧美日韩国产综合一区二区| 国产在线看一区| 一区二区三区四区不卡视频| 久久综合色播五月| 欧美色成人综合| 成人看片黄a免费看在线| 天天综合日日夜夜精品| 国产精品另类一区| 91精品国产综合久久精品图片 | 欧美刺激午夜性久久久久久久 | 欧美精品一区视频| 欧美亚洲另类激情小说| 国产不卡视频在线播放| 日本中文一区二区三区|