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 AttributeError and ValueError in Bezier and Interpolation functions #3372

Closed
wants to merge 5 commits into from

Conversation

Don-Yin
Copy link

@Don-Yin Don-Yin commented Sep 20, 2023

  1. Fixed AttributeError in get_bezier_tuples_from_points function:

    • Converted 'points' list to a NumPy array before using the reshape method to prevent AttributeError.
  2. Fixed ValueError in interpolate function:

    • Corrected a typo in the if condition from len(tri1) != len(tri1) to len(tri1) != len(tri2).
    • Added a shape check before using np.all(tri1 == tri2) to prevent broadcasting issues and subsequent ValueError when comparing arrays of different shapes.

Overview: What does this pull request change?

The pull request includes important bugfixes in get_bezier_tuples_from_points and interpolate functions, enhancing the reliability and robustness of the library.

Motivation and Explanation: Why and how do your changes improve the library?

These changes improve the library by preventing errors that were occurring due to the misuse of list methods and broadcasting issues. These fixes make the get_bezier_tuples_from_points and interpolate functions more robust, and prevent crashes that would occur under specific conditions.

Links to added or changed documentation pages

Documentation not affected by these changes.

Further Information and Comments

Thank you for considering this pull request. I believe these changes will greatly enhance the reliability of the mentioned functions.

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

Don-Yin and others added 5 commits September 20, 2023 17:31
1. Fixed AttributeError in get_bezier_tuples_from_points function:
   - Converted 'points' list to a NumPy array before using the reshape method to prevent AttributeError.

2. Fixed ValueError in interpolate function:
   - Corrected a typo in the if condition from `len(tri1) != len(tri1)` to `len(tri1) != len(tri2)`.
   - Added a shape check before using `np.all(tri1 == tri2)` to prevent broadcasting issues and subsequent ValueError when comparing arrays of different shapes.
Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there, thanks for your proposal!

Quick question: why does this PR reintroduce the colour module? The color-related changes in OpenGLMobject seem uninteded, could you please have a look before we consider merging your bugfix?

@@ -10,11 +10,13 @@

import moderngl
import numpy as np
from colour import Color
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look correct.

@MrDiver
Copy link
Collaborator

MrDiver commented Nov 4, 2023

Stale for now

@MrDiver MrDiver closed this Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

3 participants