Skip to content

Commit fb36991

Browse files
authored
Merge pull request #1078 from nmaslarinos/RhinoSurface_curvature_fix
Rhino surface curvature fix
2 parents bc1dc13 + 6a8e0c7 commit fb36991

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727

2828
* Based all gltf data classes on `BaseGLTFDataClass`
2929
* Fixed `Color.__get___` AttributeError.
30+
* Fixed `RhinoSurface.curvature_at` not returning a Vector, but a Rhino SurfaceCurvature class object
3031
* Fixed `cylinder_to_rhino` conversion to match `compas.geometry.Cylinder` location.
3132
* Changed identification of cylinder brep face to non-zero in `compas_rhino.conversions.cylinder.Cylinder`.
3233
* Changed linter to `black`.
@@ -35,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3536
* Fixed bug in `_core.tangent` where the Circle's Plane was accessed instead of the centre.
3637
* Fixed the `test_tangent` to work with a properly defined circle
3738
* `RhinoBrep` serialization works now with surface types other than NURBS.
39+
3840
### Removed
3941

4042

src/compas_rhino/geometry/surfaces/surface.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,20 @@ def curvature_at(self, u, v):
260260
261261
Returns
262262
-------
263-
:class:`~compas.geometry.Vector`
263+
tuple[[float, float, float], [float, float, float], float, [float, float, float], float, [float, float, float], float, float] | None
264+
A tuple containing the point, normal vector, maximum principal curvature value, maximum principal curvature direction,
265+
minimun principal curvature value, minimun principal curvature direction, gaussian curvature value and mean curvature
266+
value for the point at UV. None at failure.
264267
265268
"""
266-
vector = self.rhino_surface.CurvatureAt(u, v)
267-
return vector_to_compas(vector)
269+
surface_curvature = self.rhino_surface.CurvatureAt(u, v)
270+
if surface_curvature:
271+
point, normal, kappa_u, direction_u, kappa_v, direction_v, gaussian, mean = surface_curvature
272+
cpoint = point_to_compas(point)
273+
cnormal = vector_to_compas(normal)
274+
cdirection_u = vector_to_compas(direction_u)
275+
cdirection_v = vector_to_compas(direction_v)
276+
return (cpoint, cnormal, kappa_u, cdirection_u, kappa_v, cdirection_v, gaussian, mean)
268277

269278
def frame_at(self, u, v):
270279
"""Compute the local frame at a point on the curve.

0 commit comments

Comments
 (0)