Skip to content

Commit

Permalink
Merge pull request #1304 from compas-dev/fix-bug-curve-degree
Browse files Browse the repository at this point in the history
Fix bug related to value of degree in Nurbs Curves
  • Loading branch information
tomvanmele authored Feb 27, 2024
2 parents 910965d + b9fc3e9 commit 80e58ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Changed `compas.datastructures.TreeNode` to skip serialising `attributes`, `name` and `children` if being empty.
* Changed `compas.datastructures.TreeNode.__repr__` to omit `name` if `None`.
* Fix bug in `compas_rhino.geometry.NurbsCurve.from_parameters` and `compas_rhino.geometry.NurbsCurve.from_points` related to the value of the parameter `degree`.
* Changed `compas.scene.descriptors.ColorDictAttribute` to accept a `compas.colors.ColorDict` as value.
* Changed `compas_rhino.scene.RhinoMeshObject.draw` to preprocess vertex and face color dicts into lists.
* Changed `compas_rhino.conversions.vertices_and_faces_to_rhino` to handle vertex color information correctly.
Expand Down
6 changes: 4 additions & 2 deletions src/compas_rhino/geometry/curves/nurbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def from_parameters(cls, points, weights, knots, multiplicities, degree, is_peri
"""
curve = cls()
degree = min(degree, len(points) - 1)
curve.rhino_curve = rhino_curve_from_parameters(points, weights, knots, multiplicities, degree)
return curve

Expand All @@ -208,9 +209,10 @@ def from_points(cls, points, degree=3, is_periodic=False):
:class:`compas_rhino.geometry.RhinoNurbsCurve`
"""
points[:] = [point_to_rhino(point) for point in points]
curve = cls()
curve.rhino_curve = Rhino.Geometry.NurbsCurve.Create(is_periodic, degree, points)
degree = min(degree, len(points) - 1)
rhino_curve = Rhino.Geometry.NurbsCurve.Create(is_periodic, degree, [point_to_rhino(point) for point in points])
curve.rhino_curve = rhino_curve
return curve

@classmethod
Expand Down

0 comments on commit 80e58ff

Please sign in to comment.