Skip to content

Commit 08480e3

Browse files
chore: auto fixes from pre-commit hooks
1 parent 0c68472 commit 08480e3

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/ansys/geometry/core/shapes/surfaces/nurbs.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
if TYPE_CHECKING: # pragma: no cover
4444
import geomdl.NURBS as geomdl_nurbs # noqa: N811
4545

46+
4647
class 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

298298
class 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-

tests/test_primitives.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ def test_nurbs_surface_fitting():
16541654
degree_v = 2
16551655

16561656
surface = NURBSSurface.fit_surface_from_points(
1657-
points=points, size_u = 3, size_v = 3, degree_u=degree_u, degree_v=degree_v
1657+
points=points, size_u=3, size_v=3, degree_u=degree_u, degree_v=degree_v
16581658
)
16591659

16601660
assert isinstance(surface._nurbs_surface, geomdl.NURBS.Surface)
@@ -1682,10 +1682,10 @@ def test_nurbs_surface_equality():
16821682
degree_v = 2
16831683

16841684
surface = NURBSSurface.fit_surface_from_points(
1685-
points=points, size_u = 3, size_v = 3, degree_u=degree_u, degree_v=degree_v
1685+
points=points, size_u=3, size_v=3, degree_u=degree_u, degree_v=degree_v
16861686
)
16871687
other_surface = NURBSSurface.fit_surface_from_points(
1688-
points=points, size_u = 3, size_v = 3, degree_u=degree_u, degree_v=degree_v
1688+
points=points, size_u=3, size_v=3, degree_u=degree_u, degree_v=degree_v
16891689
)
16901690

16911691
assert surface == other_surface
@@ -1707,7 +1707,7 @@ def test_nurbs_surface_equality():
17071707
)
17081708

17091709
assert surface != different_surface
1710-
1710+
17111711
# Test comparison with a non-NURBSSurface object
17121712
non_nurbs_object = "Not a NURBSSurface"
17131713
assert surface != non_nurbs_object
@@ -1802,4 +1802,4 @@ def test_nurbs_surface_simple_evaluation():
18021802
assert isinstance(eval.uv_derivative, Vector3D)
18031803
assert isinstance(eval.vv_derivative, Vector3D)
18041804
assert isinstance(eval.normal, UnitVector3D)
1805-
assert isinstance(eval.surface, NURBSSurface)
1805+
assert isinstance(eval.surface, NURBSSurface)

0 commit comments

Comments
 (0)