基本信息
源码名称:processing(sketch_201120a.pde)
源码大小:1.26KB
文件格式:.pde
开发语言:Java
更新时间:2020-11-20
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 10 元 
   源码介绍

用processing进行可视化数据

void draw(){
  background(51);
  //image(earth,0,0);
  translate(width*0.5,height*0.5);
  rotateY(angle);
  angle =0.03;
  lights();
  fill(200);
 
  
  //sphere(r);
  shape(globe);
  
  for (TableRow row:table.rows()){
   float lat=row.getFloat("latitude");
   float lon=row.getFloat("longitude");
   float mag=row.getFloat("mag");

   float theta=radians(lat) PI/2;
   float phi=radians(lon) PI;
   float x=r*sin(theta)*cos(phi);
   float y=-r*sin(theta)*sin(phi);
   float z=r*cos(theta);
   PVector pos=new PVector(x,y,z);
   
   float h=pow(10,mag);
   float maxh=pow(10,7);
   h=map(h,0,maxh,10,100);
   PVector xaxis=new PVector(1,0,0);
   float angleb=PVector.angleBetween(xaxis,pos); 
   PVector raxis=xaxis.cross(pos);
  
   
   pushMatrix();
   translate(x,y,z);
    rotate(angleb,raxis.x,raxis.y,raxis.z);
   fill(225);
   box(h,5,5);
   popMatrix();
  }
}