diff --git a/utils/field/vector.py b/utils/field/vector.py index e348435e09..3da17856dd 100644 --- a/utils/field/vector.py +++ b/utils/field/vector.py @@ -1044,7 +1044,7 @@ def _evaluate(self, vertices): if self.only_2D: return self.surface.evaluate_array(us, vs) - spline_normals, surf_vertices = self.surface.normal_array_with_source_vertices(us, vs) + spline_normals, surf_vertices = self.surface.normal_vertices_array(us, vs) zs = vertices[:,self.orient_axis].flatten() zs = zs[np.newaxis].T v1 = zs * spline_normals diff --git a/utils/surface/algorithms.py b/utils/surface/algorithms.py index 7404cf3a5b..10941e8bc3 100644 --- a/utils/surface/algorithms.py +++ b/utils/surface/algorithms.py @@ -159,11 +159,7 @@ def normal(self, u, v): # normals = [self._normal(u, v) for u,v in zip(us, vs)] # return np.array(normals) - def normal_array(self, us, vs): - result_normals, *_ = self.normal_array_with_source_vertices(us, vs) - return result_normals - - def normal_array_with_source_vertices(self, us, vs): + def normal_vertices_array(self, us, vs): h = 0.001 _points = np.empty( (0, 3), dtype=np.float64) _points_u_h = np.empty( (0, 3), dtype=np.float64) @@ -316,7 +312,7 @@ def normal(self, u, v): normal = normal / n return normal - def normal_array(self, us, vs): + def normal_vertices_array(self, us, vs): surf_vertices = self.evaluate_array(us, vs) u_plus = self.evaluate_array(us + self.normal_delta, vs) v_plus = self.evaluate_array(us, vs + self.normal_delta) @@ -329,7 +325,7 @@ def normal_array(self, us, vs): #if norm != 0: normal = normal / norm #self.info("Normals: %s", normal) - return normal + return normal, surf_vertices class SvRevolutionSurface(SvSurface): __description__ = "Revolution" diff --git a/utils/surface/core.py b/utils/surface/core.py index e93c0a02e2..800fded7c8 100644 --- a/utils/surface/core.py +++ b/utils/surface/core.py @@ -38,6 +38,10 @@ def normal(self, u, v): return normal def normal_array(self, us, vs): + normal, *_ = self.normal_vertices_array(us, vs) + return normal + + def normal_vertices_array(self, us, vs): surf_vertices = self.evaluate_array(us, vs) u_plus = self.evaluate_array(us + self.normal_delta, vs) v_plus = self.evaluate_array(us, vs + self.normal_delta) @@ -50,7 +54,7 @@ def normal_array(self, us, vs): #if norm != 0: normal = normal / norm #self.info("Normals: %s", normal) - return normal + return normal, surf_vertices def derivatives_data_array(self, us, vs): if hasattr(self, 'normal_delta'): @@ -403,7 +407,7 @@ def evaluate_array(self, us, vs): def normal(self, u, v): return self.normal_array(np.array([u]), np.array([v]))[0] - def normal_array(self, us, vs): + def normal_vertices_array(self, us, vs): surf_vertices = self.evaluate_array(us, vs) u_plus = self.evaluate_array(us + self.normal_delta, vs) v_plus = self.evaluate_array(us, vs + self.normal_delta) @@ -416,5 +420,5 @@ def normal_array(self, us, vs): #if norm != 0: normal = normal / norm #self.info("Normals: %s", normal) - return normal + return normal, surf_vertices diff --git a/utils/surface/rbf.py b/utils/surface/rbf.py index 969e09d4c4..b6d894cc8b 100644 --- a/utils/surface/rbf.py +++ b/utils/surface/rbf.py @@ -69,7 +69,7 @@ def evaluate_array(self, us, vs): def normal(self, u, v): return self.normal_array(np.array([u]), np.array([v]))[0] - def normal_array(self, us, vs): + def normal_vertices_array(self, us, vs): surf_vertices = self.evaluate_array(us, vs) u_plus = self.evaluate_array(us + self.normal_delta, vs) v_plus = self.evaluate_array(us, vs + self.normal_delta) @@ -82,5 +82,5 @@ def normal_array(self, us, vs): #if norm != 0: normal = normal / norm #self.info("Normals: %s", normal) - return normal + return normal, surf_vertices