Zhen Ye
feat: Continuous object tracking, speed estimation, and overlay syncing
ff50694
APP.core.physics = {};
APP.core.physics.defaultAimpoint = function (label) {
const l = (label || "object").toLowerCase();
if (l.includes("airplane") || l.includes("drone") || l.includes("uav") || l.includes("kite") || l.includes("bird")) {
return { relx: 0.62, rely: 0.55, label: "engine" };
}
if (l.includes("helicopter")) {
return { relx: 0.50, rely: 0.45, label: "rotor_hub" };
}
if (l.includes("boat") || l.includes("ship")) {
return { relx: 0.60, rely: 0.55, label: "bridge/engine" };
}
if (l.includes("truck") || l.includes("car")) {
return { relx: 0.55, rely: 0.62, label: "engine_block" };
}
return { relx: 0.50, rely: 0.55, label: "center_mass" };
};
APP.core.physics.aimpointByLabel = function (label) {
const l = String(label || "").toLowerCase();
if (l.includes("engine") || l.includes("fuel")) return { relx: 0.64, rely: 0.58, label: label };
if (l.includes("wing")) return { relx: 0.42, rely: 0.52, label: label };
if (l.includes("nose") || l.includes("sensor")) return { relx: 0.28, rely: 0.48, label: label };
if (l.includes("rotor")) return { relx: 0.52, rely: 0.42, label: label };
return { relx: 0.50, rely: 0.55, label: label || "center_mass" };
};
APP.core.physics.getKnobs = function () {
const { $ } = APP.core.utils;
const helPower = $("#helPower");
const helAperture = $("#helAperture");
const helM2 = $("#helM2");
const helJitter = $("#helJitter");
const helDuty = $("#helDuty");
const helMode = $("#helMode");
const atmVis = $("#atmVis");
const atmCn2 = $("#atmCn2");
const seaSpray = $("#seaSpray");
const aoQ = $("#aoQ");
const rangeBase = $("#rangeBase");
if (!helPower) return {};
const PkW = +helPower.value;
const aperture = +helAperture.value;
const M2 = +helM2.value;
const jitter_urad = +helJitter.value;
const duty = (+helDuty.value) / 100;
const mode = helMode ? helMode.value : "cw";
const vis_km = +atmVis.value;
const cn2 = +atmCn2.value;
const spray = +seaSpray.value;
const ao = +aoQ.value;
const baseRange = +rangeBase.value;
return { PkW, aperture, M2, jitter_urad, duty, mode, vis_km, cn2, spray, ao, baseRange };
};