From 3d1236e594da3d3771a13591c7447088ead41939 Mon Sep 17 00:00:00 2001 From: CensoredUsername Date: Sat, 4 Oct 2025 04:23:53 +0200 Subject: [PATCH] Small simplification of FlightIntergratorPerf.SetDragCubeDrag: no need to normalize and immediately denormalize. --- KSPCommunityFixes/Performance/FlightIntegratorPerf.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/KSPCommunityFixes/Performance/FlightIntegratorPerf.cs b/KSPCommunityFixes/Performance/FlightIntegratorPerf.cs index c52a96d..c643998 100644 --- a/KSPCommunityFixes/Performance/FlightIntegratorPerf.cs +++ b/KSPCommunityFixes/Performance/FlightIntegratorPerf.cs @@ -757,13 +757,12 @@ private static void SetDragCubeDrag(DragCubeList dragCubes, Vector3 direction) double weightedDrag = dragCubes.weightedDrag[i]; double dot = Vector3.Dot(direction, faceDir); - double dotNormalized = (dot + 1.0) * 0.5; double drag; // = PhysicsGlobals.DragCurveValue(__instance.SurfaceCurves, dotNormalized, machNumber); - if (dotNormalized <= 0.5) - drag = Numerics.Lerp(fiData.dragTail, fiData.dragSurf, dotNormalized * 2.0) * fiData.dragMult; + if (dot <= 0.0) + drag = Numerics.Lerp(fiData.dragSurf, fiData.dragTail, -dot) * fiData.dragMult; else - drag = Numerics.Lerp(fiData.dragSurf, fiData.dragTip, (dotNormalized - 0.5) * 2.0) * fiData.dragMult; + drag = Numerics.Lerp(fiData.dragSurf, fiData.dragTip, dot) * fiData.dragMult; double areaOccludedByDrag = areaOccluded * drag; area += areaOccludedByDrag;