Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug related to value of degree in Nurbs Curves #1304

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading