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

Error in show_options, colors are ignored for some reason #315

Open
jzwar opened this issue Dec 3, 2023 · 5 comments
Open

Error in show_options, colors are ignored for some reason #315

jzwar opened this issue Dec 3, 2023 · 5 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jzwar
Copy link
Collaborator

jzwar commented Dec 3, 2023

If colors are set differently for the knots and control points via keyword arguments, these will be ignored if the color c is stated. Here is an example:

import splinepy as sp

# Options
options = {
    "control_points": True,
    "control_point_ids": False,
    "control_mesh_c": "k",  # Will be ignored
    "control_point_r": 20,
    "control_point_c": "k",  # Will be ignored
    "c": (0, 240, 156),  # Uses this instead : why?
    "lighting": "off",
}

deformation_function = sp.BSpline(
    degrees=[2, 1],
    knot_vectors=[[0, 0, 0, 0.5, 1, 1, 1], [0, 0, 1, 1]],
    control_points=[
        [0.0, 0.0],
        [0.5, 0.2],
        [1.0, 0.],
        [1.5, 0.2],
        [0.0, 1.0],
        [0.5, 1.2],
        [1.0, 1.0],
        [1.5, 1.2],

    ]
)
deformation_function.show(**options)

Results in:
image

@jzwar jzwar added bug Something isn't working help wanted Extra attention is needed labels Dec 3, 2023
@jzwar
Copy link
Collaborator Author

jzwar commented Dec 3, 2023

It seems that the function eval in make_showable keeps track of the results. I think that the key words are just passt without checks to the vedo interface. Maybe we should not use vedo-keywords as show_options. Use spline_c / spline_color / 'base_color` instead? The keywords are not really consistent. We use full snake-case for some keys but abbreviations for others.

@j042
Copy link
Member

j042 commented Dec 4, 2023

If you use show_options to set options, it will show you as expected. To answer # Uses this instead : why? - as **kwargs are passed to gus.show, it overwrites all the options that's applicable to sampled objects. c is a very common option. We can stop processing show_options from kwargs to avoid confusion.

@j042 j042 closed this as completed Dec 4, 2023
@jzwar
Copy link
Collaborator Author

jzwar commented Dec 4, 2023

I know that c is applicable to points and meshes as well, which is exactly why I think we should rename the spline color options c, alpha, etc. to unique splinepy option names. Having duplicates is confusing imo, or we have to set vedo options more explicitly, with something like 'vedo_options=dict`

@jzwar jzwar reopened this Dec 4, 2023
@j042
Copy link
Member

j042 commented Dec 4, 2023

That's a problem related to using the workflow gus.show(..., **show_options). You can maybe edit that part

@j042
Copy link
Member

j042 commented Mar 11, 2024

This may be - "this is a feature not a bug"
However, I see that we may want some lazy-but-accurate show_options options.
Some thoughts:

  • prefix to kwargs - spp_. We will have to wrap gus.show
  • inherit vedo.Plotter and extend functions for our use. This will allow us to write easier interactive miniapps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants