From f71aab6abbf5f365ea49320de8bfb92e5f15a6d3 Mon Sep 17 00:00:00 2001 From: Mark Allyn Date: Sun, 17 May 2026 21:07:24 -0700 Subject: [PATCH] adding pseudo code --- CLAUDE.md | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 520b2a8..f60130d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -404,7 +404,14 @@ Individual scope informations the backscattering intensity receives an explicit 1.5x structural cross-section multiplier. // Pseudocode for Shader/Logic - float resonance = (targetLength >= wavelength * 0.4 && targetLength <= wavelength * 0.6) ? 1.5 : 1.0; + // Derive range and bearing from SSBO Cartesian fields + float ch_range = sqrt(target.target_x * target.target_x + target.target_y * target.target_y); + float ch_bearing_rad = atan(target.target_x, target.target_y); // GLSL atan(y,x) measured from north + float ch_aspect_angle = ch_bearing_rad - target.course; // course is radians in SSBO + float ch_proj_width = abs(sin(ch_aspect_angle)) * target.length + abs(cos(ch_aspect_angle)) * target.beam; + float base_sigma = ch_proj_width * 2.5; + + float resonance = (target.length >= wavelength * 0.4 && target.length <= wavelength * 0.6) ? 1.5 : 1.0; float final_sigma = base_sigma * resonance; The 20-Mile Markers: Chain Home used crystal-controlled oscillators to create @@ -490,11 +497,23 @@ Individual scope informations Now, here is a snippet of pseudo code: /* Uniform Variables provided by CPU */ - uniform float u_AntennaBearing; // Current rotation of knob/motor - uniform float horizontal_beamwidth; // Fixed for the scope (e.g., 2.5 degrees) + uniform float u_AntennaBearing; // Current rotation of knob/motor, degrees + uniform float horizontal_beamwidth; // Fixed for the scope (e.g., 2.5 degrees) - /* Logic for each Target (calculated on CPU or in Geometry Shader) */ - float angle_diff = abs(target.bearing - u_AntennaBearing); + /* Logic for each Target — all derived from SSBO fields target_x, target_y, length, beam, course */ + + // Derive range (meters) and bearing (degrees, north-clockwise) from Cartesian SSBO fields + float target_range = sqrt(target.target_x * target.target_x + target.target_y * target.target_y); + float target_bearing_rad = atan(target.target_x, target.target_y); // GLSL atan(y,x) from north + float target_bearing_deg = degrees(target_bearing_rad); + if (target_bearing_deg < 0.0) target_bearing_deg += 360.0; + + // Compute RCS from length and beam using aspect angle (course is radians in SSBO) + float aspect_angle = target_bearing_rad - target.course; + float projected_width = abs(sin(aspect_angle)) * target.length + abs(cos(aspect_angle)) * target.beam; + float target_rcs = projected_width * 2.5; + + float angle_diff = abs(target_bearing_deg - u_AntennaBearing); // Handle the 359 to 0 degree wrap-around if (angle_diff > 180.0) angle_diff = 360.0 - angle_diff; @@ -503,9 +522,9 @@ Individual scope informations // This creates the "fade in / fade out" effect as you turn the knob float beam_factor = exp(-2.77 * pow(angle_diff / (horizontal_beamwidth / 2.0), 2.0)); - // Final received power Pr - float Pr = (peak_power * pow(antenna_gain, 2) * pow(wavelength, 2) * target.rcs * beam_factor) / - (pow(4.0 * PI, 3.0) * pow(target.range, 4.0)); + // Final received power Pr — uses only derived values, no missing SSBO fields + float Pr = (peak_power * pow(antenna_gain, 2.0) * pow(wavelength, 2.0) * target_rcs * beam_factor) / + (pow(4.0 * PI, 3.0) * pow(target_range, 4.0)); 3. PPI Scope