4343if TYPE_CHECKING : # pragma: no cover
4444 import geomdl .NURBS as geomdl_nurbs # noqa: N811
4545
46+
4647class NURBSSurface (Surface ):
4748 """Represents a NURBS surface.
4849
@@ -71,24 +72,24 @@ def __init__(self, geomdl_object: "geomdl_nurbs.Surface" = None):
7172 @property
7273 def geomdl_nurbs_surface (self ) -> "geomdl_nurbs.Surface" :
7374 """Get the underlying `geomdl` NURBS surface object.
74-
75+
7576 Notes
7677 -----
7778 This property gives access to the full functionality of the NURBS surface
7879 coming from the `geomdl` library. Use with caution.
7980 """
8081 return self ._nurbs_surface
81-
82+
8283 @property
8384 def control_points (self ) -> list [Point3D ]:
8485 """Get the control points of the NURBS surface."""
8586 return [Point3D (pt ) for pt in self ._nurbs_surface .ctrlpts ]
86-
87+
8788 @property
8889 def degree_u (self ) -> int :
8990 """Get the degree of the surface in the U direction."""
9091 return self ._nurbs_surface .degree_u
91-
92+
9293 @property
9394 def degree_v (self ) -> int :
9495 """Get the degree of the surface in the V direction."""
@@ -108,7 +109,7 @@ def knotvector_v(self) -> list[Real]:
108109 def weights (self ) -> list [Real ]:
109110 """Get the weights of the control points."""
110111 return self ._nurbs_surface .weights
111-
112+
112113 @classmethod
113114 @check_input_types
114115 def from_control_points (
@@ -159,7 +160,7 @@ def from_control_points(
159160 nurbs_surface ._nurbs_surface .set_ctrlpts (
160161 ctrlpts_homogenous ,
161162 nurbs_surface ._nurbs_surface .ctrlpts_size_u ,
162- nurbs_surface ._nurbs_surface .ctrlpts_size_v
163+ nurbs_surface ._nurbs_surface .ctrlpts_size_v ,
163164 )
164165
165166 nurbs_surface ._nurbs_surface .knotvector_u = knots_u
@@ -225,7 +226,7 @@ def fit_surface_from_points(
225226 nurbs_surface ._nurbs_surface .weights = surface .weights
226227
227228 return nurbs_surface
228-
229+
229230 def __eq__ (self , other : "NURBSSurface" ) -> bool :
230231 """Determine if two surfaces are equal."""
231232 if not isinstance (other , NURBSSurface ):
@@ -253,8 +254,7 @@ def parameterization(self) -> tuple[Parameterization, Parameterization]:
253254 ParamForm .OTHER ,
254255 ParamType .OTHER ,
255256 Interval (
256- start = self ._nurbs_surface .domain [0 ][0 ],
257- end = self ._nurbs_surface .domain [0 ][1 ]
257+ start = self ._nurbs_surface .domain [0 ][0 ], end = self ._nurbs_surface .domain [0 ][1 ]
258258 ),
259259 ),
260260 Parameterization (
@@ -293,7 +293,7 @@ def contains_point(self, point: Point3D) -> bool: # noqa: D102
293293
294294 def project_point (self , point : Point3D ) -> SurfaceEvaluation : # noqa: D102
295295 raise NotImplementedError ("project_point() is not implemented." )
296-
296+
297297
298298class NURBSSurfaceEvaluation (SurfaceEvaluation ):
299299 """Provides evaluation of a NURBS surface at a given parameter.
@@ -315,7 +315,7 @@ def __init__(self, nurbs_surface: NURBSSurface, parameter: ParamUV) -> None:
315315 domain = nurbs_surface ._nurbs_surface .domain
316316 u_start , u_end = domain [0 ][0 ], domain [0 ][1 ]
317317 v_start , v_end = domain [1 ][0 ], domain [1 ][1 ]
318-
318+
319319 if not (u_start <= u <= u_end and v_start <= v <= v_end ):
320320 raise ValueError (
321321 f"Parameter [u={ u } , v={ v } ] is outside the surface domain: "
@@ -336,7 +336,7 @@ def parameter(self) -> ParamUV:
336336 @cached_property
337337 def position (self ) -> Point3D :
338338 """Position of the evaluation.
339-
339+
340340 Returns
341341 -------
342342 Point3D
@@ -347,13 +347,14 @@ def position(self) -> Point3D:
347347 @cached_property
348348 def normal (self ) -> UnitVector3D :
349349 """Normal to the surface.
350-
350+
351351 Returns
352352 -------
353353 UnitVector3D
354354 Normal to the surface at this evaluation.
355355 """
356356 from geomdl .operations import normal
357+
357358 uv = [float (self ._parameter .u ), float (self ._parameter .v )]
358359 result = normal (self ._surface .geomdl_nurbs_surface , uv )
359360
@@ -362,7 +363,7 @@ def normal(self) -> UnitVector3D:
362363 @cached_property
363364 def u_derivative (self ) -> Vector3D :
364365 """First derivative with respect to the U parameter.
365-
366+
366367 Returns
367368 -------
368369 Vector3D
@@ -373,7 +374,7 @@ def u_derivative(self) -> Vector3D:
373374 @cached_property
374375 def v_derivative (self ) -> Vector3D :
375376 """First derivative with respect to the V parameter.
376-
377+
377378 Returns
378379 -------
379380 Vector3D
@@ -384,7 +385,7 @@ def v_derivative(self) -> Vector3D:
384385 @cached_property
385386 def uu_derivative (self ) -> Vector3D :
386387 """Second derivative with respect to the U parameter.
387-
388+
388389 Returns
389390 -------
390391 Vector3D
@@ -395,7 +396,7 @@ def uu_derivative(self) -> Vector3D:
395396 @cached_property
396397 def uv_derivative (self ) -> Vector3D :
397398 """The second derivative with respect to the U and V parameters.
398-
399+
399400 Returns
400401 -------
401402 Vector3D
@@ -406,7 +407,7 @@ def uv_derivative(self) -> Vector3D:
406407 @cached_property
407408 def vv_derivative (self ) -> Vector3D :
408409 """The second derivative with respect to v.
409-
410+
410411 Returns
411412 -------
412413 Vector3D
@@ -433,4 +434,3 @@ def max_curvature(self) -> Real:
433434 def max_curvature_direction (self ) -> UnitVector3D :
434435 """Maximum curvature direction."""
435436 raise NotImplementedError ("max_curvature_direction() is not implemented." )
436-
0 commit comments