Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //60ft up
- //rocket is 3.55km away, tip is 144 meters up
- //plane is 339.04km away, and 11.28km up
- //earth has an approx diameter of 12,742 km
- //measurements in meters
- float destinHeight = 18.288;
- float rocketDistance = 3550.0;
- float rocketHeight = 144.0;
- float planeDistance = 339040.0;
- float planeHeight = 11280.0;
- float earthDiameter = 12742000.0;
- float scale = 0.4; //zoom in
- //float scale = 0.005; //zoom out
- void setup(){
- size(1920,1080);
- strokeCap(SQUARE);
- }
- void draw(){
- background(51);
- noStroke();
- fill(100,150,100);
- ellipse(width/2.0, earthDiameter/2.0*scale+height/2.0, earthDiameter*scale, earthDiameter*scale);
- float rocketRadians = (rocketDistance / (earthDiameter * PI)) * TWO_PI;
- float planeRadians = (planeDistance / (earthDiameter * PI)) * TWO_PI;
- float startingAngle = PI*3.0/2.0-PI/11500.0; //zoom in
- //float startingAngle = PI*3.0/2.0-PI/115.0; //zoom out
- strokeWeight(8);
- stroke(200,150,10);
- //arc(width/2.0, earthDiameter/2.0*scale+height/2.0, earthDiameter*scale, earthDiameter*scale, startingAngle, startingAngle+planeRadians);
- strokeWeight(4);
- stroke(100,150,200);
- //arc(width/2.0, earthDiameter/2.0*scale+height/2.0, earthDiameter*scale, earthDiameter*scale, startingAngle, startingAngle+rocketRadians);
- PVector destinPos = new PVector(cos(startingAngle), sin(startingAngle));
- PVector rocketPos = new PVector(cos(startingAngle+rocketRadians), sin(startingAngle+rocketRadians));
- PVector planePos = new PVector(cos(startingAngle+planeRadians), sin(startingAngle+planeRadians));
- strokeWeight(2);
- stroke(0,0,255);
- 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);
- strokeWeight(8);
- stroke(255,0,0);
- 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);
- 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);
- 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);
- 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);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement