From d416cb91583f58f4c94f1447dcfeac8b725df454 Mon Sep 17 00:00:00 2001 From: Mark Allyn Date: Thu, 28 May 2026 09:25:38 -0700 Subject: [PATCH] Made corrections about target reflectivity --- CLAUDE.md | 82 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 9 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1ae3fff..f6873a7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -145,19 +145,73 @@ struct target_data_to_shader_structure { float target_y; // Pre-converted local Cartesian offset Y (meters relative to radar) float length; // Vessel length bounds (meters) float beam; // Vessel beam bounds (meters) - float height; // height of vessel (important for radar equation) float course; // Course over ground vector (radians relative to True North) float altitude; // Target altitude profile (meters) time_t timestamp; // Data aging tracking identifier - enum material; // Target material (metal, wood, etc) + float reflectivity; // derivied from TargetType (see table below) + float heightestivate; // derived from TargetType (see table below) + fload noiseglint; // derived from TargetType (see table below) binary police_boat // this indicates that the target is for the roaming police boat. }; -Here is the enumeration for the target material (this is important for the radar equation) +Plese note that height, reflectivity, and noiseglint have to be derived from the target type +in this table: (note that this is suggested code just to show you what should be happeneing) + +struct RadarMaterialProfile { + float reflectivity; // 0.0 (stealth/fiberglass) to 1.0 (massive steel) + float heightEstimate; // in meters, to calculate radar horizon cutout + float noiseGlint; // simulated signal scintillation +}; + +RadarMaterialProfile getMaterialProfile(int aisTypeCode) { + RadarMaterialProfile profile; + + switch(type) { // type is in the target_data_structure + case 30: // Fishing (often wooden/fiberglass hulls, low sitting) + profile.reflectivity = 0.35; profile.heightEstimate = 4.0; profile.noiseGlint = 0.2; + break; + case 36: // Sailing Vessel (tall aluminum mast, but low fiberglass hull) + profile.reflectivity = 0.25; profile.heightEstimate = 15.0; profile.noiseGlint = 0.4; // High mast glint! + break; + case 37: // Pleasure Craft (fiberglass speedboats, yachts) + profile.reflectivity = 0.20; profile.heightEstimate = 3.0; profile.noiseGlint = 0.1; + break; + case 52: // Tugboats (dense, heavy low-sitting steel blocks) + profile.reflectivity = 0.85; profile.heightEstimate = 6.0; profile.noiseGlint = 0.15; + profile.reflectivity = 0.95; profile.heightEstimate = 35.0; profile.noiseGlint = 0.05; // Perfect metal reflector! + break; + default: // Catch-all / Code 0 - some owners neglect setting this in their transponders + profile.reflectivity = 0.50; profile.heightEstimate = 8.0; profile.noiseGlint = 0.2; + break; + } + return profile; +} + + +The segment handling asynchronous target ingestion is called traffic_cop. +The traffic_cop runs on a dedicated background execution thread separate from the rendering loop. +Data synchronization between threads must be managed explicitly using std::mutex blocks. + + +Using this data, the traffic cop can derive the time varying fluctuations of the target +(note that this is suggested code; may not be the actual code you generate) + +// Inside your C++ target loop (running every frame or every radar sweep) +float baseReflectivity = target.materialProfile.reflectivity; +float glintFactor = target.materialProfile.noiseGlint; + +// Generate a random float between -1.0 and 1.0 +float randomNoise = ((float)rand() / RAND_MAX) * 2.0f - 1.0f; + +// Calculate the dynamic, fluctuating reflectivity for THIS frame +float dynamicReflectivity = baseReflectivity + (randomNoise * glintFactor); + +// Clamp it so it doesn't drop below 0 or overshoot 1.0 +dynamicReflectivity = std::max(0.0f, std::min(1.0f, dynamicReflectivity)); + +// Pass 'dynamicReflectivity' to your GLSL shader uniform array +glUniform1f(glGetUniformLocation(shaderProgram, "targetReflectivity[i]"), dynamicReflectivity); -1. Metal -2. Wood -3. Fiberglass The segment handling asynchronous target ingestion is called traffic_cop. The traffic_cop runs on a dedicated background execution thread separate from the rendering loop. @@ -166,12 +220,22 @@ Data synchronization between threads must be managed explicitly using std::mutex [TRAFFIC COP OPERATIONAL TIMING PROTOCOL] 1. Processing Loop: Aggregated targets are packaged into a uniform array and dispatched as they arrive to the traffic cop from the simulator or the receiver handling the raspberry pis. -2. Range Filtering: Discard any targets residing outside the active radar's designated maximum operational range. +2. Range Filtering: Discard any targets residing outside the active radar's + designated maximum operational range. 3. Altitude Restriction: Enforce a strict <= 40-meter restriction for marine nodes (Marine Chain Home and all PPI Marine radars). Discard any aircraft violating this ceiling. 4. Precision Alignment: Latitude and longitude coordinate conversions into local meters relative to - the radar origin must be handled on the CPU thread within traffic_cop to protect against FP32 structural precision rounding errors inside the GPU. -5. Critical Section: Assert a std::mutex to gain safe writing access to the double-buffered array driving the SSBO, copy the structural contents, and clear the mutex immediately. + the radar origin must be handled on the CPU thread within traffic_cop + to protect against FP32 structural precision rounding errors inside the GPU. +6. The determination of the reflectivity, height estimate, and the noiseglint must + be processed by the traffic cop +7. The traffic cop needs to know the longitude and latitude of the chain home ascope, the marine ascope, + and the marine traffic control radars. It will already have the longitude and latitude of the + police boat radar as it will be processing the location of the police boat radar from the + simulator. +5. Critical Section: Assert a std::mutex to gain safe writing access to the + double-buffered array driving the SSBO, copy the structural contents, and + clear the mutex immediately. Note that the construction of the simulator will be discussed later in this document.