Advertisement
MrMusAddict

Destin Contrail

Feb 4th, 2018
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.22 KB | None | 0 0
  1. //60ft up
  2. //rocket is 3.55km away, tip is 144 meters up
  3. //plane is 339.04km away, and 11.28km up
  4. //earth has an approx diameter of 12,742 km
  5.  
  6. //measurements in meters
  7. float destinHeight = 18.288;
  8. float rocketDistance = 3550.0;
  9. float rocketHeight = 144.0;
  10. float planeDistance = 339040.0;
  11. float planeHeight = 11280.0;
  12. float earthDiameter = 12742000.0;
  13.  
  14. float scale = 0.4;  //zoom in
  15. //float scale = 0.005;  //zoom out
  16.  
  17.  
  18.  
  19. void setup(){
  20.   size(1920,1080);
  21.   strokeCap(SQUARE);
  22. }
  23.  
  24. void draw(){
  25.   background(51);
  26.   noStroke();
  27.   fill(100,150,100);
  28.   ellipse(width/2.0, earthDiameter/2.0*scale+height/2.0, earthDiameter*scale, earthDiameter*scale);
  29.  
  30.   float rocketRadians = (rocketDistance / (earthDiameter * PI)) * TWO_PI;
  31.   float planeRadians = (planeDistance / (earthDiameter * PI)) * TWO_PI;
  32.  
  33.   float startingAngle = PI*3.0/2.0-PI/11500.0;  //zoom in
  34.   //float startingAngle = PI*3.0/2.0-PI/115.0;  //zoom out
  35.  
  36.   strokeWeight(8);
  37.   stroke(200,150,10);
  38.   //arc(width/2.0, earthDiameter/2.0*scale+height/2.0, earthDiameter*scale, earthDiameter*scale, startingAngle, startingAngle+planeRadians);
  39.   strokeWeight(4);
  40.   stroke(100,150,200);
  41.   //arc(width/2.0, earthDiameter/2.0*scale+height/2.0, earthDiameter*scale, earthDiameter*scale, startingAngle, startingAngle+rocketRadians);
  42.  
  43.  
  44.   PVector destinPos = new PVector(cos(startingAngle), sin(startingAngle));
  45.   PVector rocketPos = new PVector(cos(startingAngle+rocketRadians), sin(startingAngle+rocketRadians));
  46.   PVector planePos = new PVector(cos(startingAngle+planeRadians), sin(startingAngle+planeRadians));
  47.  
  48.   strokeWeight(2);
  49.   stroke(0,0,255);
  50.  
  51.   line(width/2.0 + destinPos.x * (earthDiameter/2.0 + destinHeight) * scale, earthDiameter/2.0*scale+height/2.0 + destinPos.y * (earthDiameter/2.0+ destinHeight)* scale, width/2.0 + planePos.x * (earthDiameter/2.0 + planeHeight) * scale, earthDiameter/2.0*scale+height/2.0 + planePos.y * (earthDiameter/2.0+ planeHeight)* scale);
  52.  
  53.   strokeWeight(8);
  54.   stroke(255,0,0);
  55.  
  56.   line(width/2.0 + destinPos.x * (earthDiameter/2.0) * scale, earthDiameter/2.0*scale+height/2.0 + destinPos.y * (earthDiameter/2.0) * scale, width/2.0 + destinPos.x * (earthDiameter/2.0 + destinHeight) * scale, earthDiameter/2.0*scale+height/2.0 + destinPos.y * (earthDiameter/2.0+ destinHeight)* scale);
  57.   line(width/2.0 + rocketPos.x * (earthDiameter/2.0) * scale, earthDiameter/2.0*scale+height/2.0 + rocketPos.y * (earthDiameter/2.0) * scale, width/2.0 + rocketPos.x * (earthDiameter/2.0 + rocketHeight) * scale, earthDiameter/2.0*scale+height/2.0 + rocketPos.y * (earthDiameter/2.0+ rocketHeight)* scale);
  58.   line(width/2.0 + planePos.x * (earthDiameter/2.0) * scale, earthDiameter/2.0*scale+height/2.0 + planePos.y * (earthDiameter/2.0) * scale, width/2.0 + planePos.x * (earthDiameter/2.0 + planeHeight) * scale, earthDiameter/2.0*scale+height/2.0 + planePos.y * (earthDiameter/2.0+ planeHeight)* scale);
  59.  
  60.   println(dist(width/2.0 + destinPos.x * (earthDiameter/2.0 + destinHeight) * scale, earthDiameter/2.0*scale+height/2.0 + destinPos.y * (earthDiameter/2.0+ destinHeight)* scale, width/2.0 + planePos.x * (earthDiameter/2.0 + planeHeight) * scale, earthDiameter/2.0*scale+height/2.0 + planePos.y * (earthDiameter/2.0+ planeHeight)* scale)/scale);
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement