xxxxxxxxxx
88
const as2rad = 4.848e-6;
let D = 8.;
let lgsR = 25;
let ngsR = 20;
let alts = [0, 6e3, 13.5e3];
let alttur = [0, 6e3, 13.5e3];
//let alts = [0e3];
let nlgs = 8;
let nngs = 0;
let xlgs = [];
let ylgs = [];
let xngs = [];
let yngs = [];
let lgsalt = 90e3;
let ngsalt = 1e13;
let sc = 40;
let scy = 15;
let fov = 15;
let alt_scale = [];
function setup() {
createCanvas(1200, 700);
for (let ni = 0; ni < nlgs; ni++) {
xlgs.push(lgsR * cos(ni * TWO_PI / nlgs + PI / 2.0));
ylgs.push(lgsR * sin(ni * TWO_PI / nlgs + PI / 2.0));
}
for (let ni = 0; ni < nngs; ni++) {
xngs.push(ngsR * cos(ni * TWO_PI / nngs + PI / 2.0));
yngs.push(ngsR * sin(ni * TWO_PI / nngs + PI / 2.0));
}
divl = createDiv("LGS Radius")
divn = createDiv("NGS Radius")
sliderl = createSlider(0, 100, 17.5);
slidern = createSlider(0, 100, 30);
divl.child(sliderl);
divn.child(slidern);
alt_scale.push([1.0, 1.0]);
alt_scale.push([49.0 / 41.0 * 1.25, (120 * 4.848e-6 * alts[1] + D) / D]);
alt_scale.push([49.0 / 41.0 * 1.75, (120 * 4.848e-6 * alts[2] + D) / D]);
}
function draw() {
background(240);
fill(100);
rect(0,0,120,60);
lgsR = sliderl.value();
ngsR = slidern.value();
xlgs = [];
ylgs = [];
xngs = [];
yngs = [];
for (let ni = 0; ni < nlgs; ni++) {
xlgs.push(lgsR * cos(ni * TWO_PI / nlgs + PI / 2.0));
ylgs.push(lgsR * sin(ni * TWO_PI / nlgs + PI / 2.0));
}
for (let ni = 0; ni < nngs; ni++) {
xngs.push(ngsR * cos(ni * TWO_PI / nngs + PI / 2.0));
yngs.push(ngsR * sin(ni * TWO_PI / nngs + PI / 2.0));
}
fill(0, 255, 0, 255);
text("LGS Rad: " + lgsR.toFixed(2), 10, 20);
fill(0, 255, 255, 255);
text("NGS Rad: " + ngsR.toFixed(2), 10, 40);
noStroke();
fill(0);
//text(alts[0].toFixed(0).toString(), 20, 20);
noStroke();
//fill(255, 0, 0, 80);
for (let mi = 0; mi < alts.length; mi++) {
push();
translate(width / 2, (0.8 - alts[mi] / 25e3) * height);
fill(255, 0, 0, 80);
ellipse(0, 0, sc * (D) * alt_scale[mi][0], alt_scale[mi][0] * scy * (D));
fill(0, 0, 255, 80);
ellipse(0, 0, sc * (D) * alt_scale[mi][1], alt_scale[mi][1] * scy * (D));
for (let ni = 0; ni < nlgs; ni++) {
fill(0, 255, 0, 50);
stroke(0);
ellipse(sc * xlgs[ni] * as2rad * alts[mi], scy * ylgs[ni] * as2rad * alts[mi], D * sc * (1 - alts[mi] / lgsalt), D * scy * (1 - alts[mi] / lgsalt));
}
for (let ni = 0; ni < nngs; ni++) {
fill(0, 255, 255, 50);
stroke(0);
ellipse(sc * xngs[ni] * as2rad * alts[mi], scy * yngs[ni] * as2rad * alts[mi], D * sc * (1 - alts[mi] / ngsalt), D * scy * (1 - alts[mi] / ngsalt));
}
pop();
}
}