From e0b8931501bd2bf9f1989cd4b237aad740a5b1ee Mon Sep 17 00:00:00 2001 From: Peter Sharpe Date: Thu, 4 Apr 2024 17:47:47 -0400 Subject: [PATCH] adds logic that keeps airfoil coordinates counterclockwise even with scale_x<0 --- aerosandbox/geometry/airfoil/airfoil.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/aerosandbox/geometry/airfoil/airfoil.py b/aerosandbox/geometry/airfoil/airfoil.py index a7e09e08..7189ab4c 100644 --- a/aerosandbox/geometry/airfoil/airfoil.py +++ b/aerosandbox/geometry/airfoil/airfoil.py @@ -1420,13 +1420,26 @@ def scale(self, x = self.x() * scale_x y = self.y() * scale_y + if scale_x < 0: + TE_index = np.argmax(x) + x = np.concatenate([ + x[TE_index::-1], + x[-2:TE_index-1:-1] + ]) + y = np.concatenate([ + y[TE_index::-1], + y[-2:TE_index-1:-1] + ]) + if scale_y < 0: x = x[::-1] y = y[::-1] + coordinates = np.stack((x, y), axis=1) + return Airfoil( name=self.name, - coordinates=np.stack((x, y), axis=1) + coordinates=coordinates, ) def translate(self,