package package1;
//import java.math.*;
public class Doitpoint {
static char map[][]=new char[100][100];
static point pointlin[]=new point[300];
public static void make_point() {
for (int i = 0; i < pointlin.length; i++) {
pointlin = new point();
}
}
//判断是否传感器休眠内部循环
public static void testpointin(point point1, point point2) {
int _x = Math.abs(point1.point_x - point2.point_x);
int _y = Math.abs(point1.point_y - point2.point_y);
double doxy= Math.sqrt(_x*_x+_y*_y);
if(doxy<8)
point1.alive = 'b';
}
//判断是否传感器休眠外部循环
public static void testpoint(point [] pointline) {
//外循环要测试的点
for (int i = 0; i < pointline.length; i++) {
//内循环寻找探针PRB_RPY
if(pointline.alive =='a')
{
for(int j=i+1;j<pointline.length;j++)
{
if(pointline[j].alive =='a')
{
testpointin(pointline, pointline[j]);
}
if (pointline.alive =='b')
break;
}
}
}
}
//绘制传感器覆盖的图像
public static void DrawingPoint(point[] pointlin) {
for (int i = 0; i < pointlin.length; i++) {
if(pointlin.alive =='a')
//覆盖的计算
NewDraw(pointlin.point_x,pointlin.point_y);
}
System.out.println((map.toString()));
}
//刷新覆盖数组
public static void NewDraw(int x ,int y)
{
map[x][y]='*';
int x1=x-8;
if (x1<0) {
x1=0;
}
int x2=x+8;
if (x2>100) {
x2=100;
}
int y1=y-8;
if (y1<0) {
y1=0;
}
int y2=y+8;
if(y2>100){
y2=100;
}
for (int charx = x1; x<=x2 ; x++) {
for (int chary =y1; chary <= y2; chary++) {
if (map[charx][chary] !='*')
{
map[charx][chary] = '0';
}
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
//point pointlin[]=new point[300];
make_point();
DrawingPoint(pointlin);
}
}
求大神指教!!谢谢了!! |
|