question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

clip_box behavior is broken

See original GitHub issue

Hi,

to follow up on the thread started in Discussions, clip_box behavior is broken, as the clipped part doesn’t match the passed box.


To Reproduce

import pyvista as pv
from pyvista import examples

mesh = examples.load_airplane()

# Use `pv.Box()` or `pv.Cube()` to create a region of interest
roi = pv.Cube(center=(0.9e3, 0.2e3, mesh.center[2]),
              x_length=500, y_length=500, z_length=500)

extracted = mesh.clip_box(roi, invert=False)

p = pv.Plotter(shape=(1,2))
p.add_mesh(roi, opacity=0.75, color="red")
p.add_mesh(mesh)
p.subplot(0,1)
p.add_mesh(extracted)
p.add_mesh(roi, opacity=0.75, color="red")
p.link_views()
p.view_isometric()
p.show()

Screenshots Screenshot from 2022-03-07 17-14-12


System Information:


  Python 3.8.10 (default, Nov 26 2021, 20:14:08)  [GCC 9.3.0]

           pyvista : 0.33.2
               vtk : 9.0.1
             numpy : 1.21.0
           imageio : 2.14.1
           appdirs : 1.4.4
            scooby : 0.5.11
        matplotlib : 3.4.2
             PyQt5 : 5.12.3
           IPython : 7.22.0
              tqdm : 4.48.2

According to @banesullivan , the regresion occured in v.0.33.0

Also, from my investigations, in the previous example if instead of the Cube object, we pass its bounds, then clipping is sane. However if the cube is rotated, then the clipping breaks (albeit in a different way).

Edit: to complete, the bug is not linked to the invert parameter either

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
einocommented, Mar 9, 2022

Well seen! Indeed it does fix the problem 👍

I can prepare a PR to fix it.

1reaction
einocommented, Mar 9, 2022

Hi, I ran a git bisect, and found the regression occurred in commit 4b83f5c9

And more precisely, it’s the change to utilities/geometric_objects.py, setting the parameter clean=True that made Cube not suitable to be passed to clib_box. If we change the above example to pass clean=False to the Cube creation, then the clipping works as expected.

I wonder if the Cube should be cleaned by default. If it does, maybe a warning should be placed in clip_box doc, and examples amended. What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

For an app with broken clipboard behavior, can I route the ...
I have a remote connection to a VM that is a bit of a problem. If I want to paste text into the...
Read more >
My clipboard is broken, crashing, and is invisible whenever I ...
My clipboard is broken, crashing, and is invisible whenever I open it. Hello! Can anyone help me with my problem?
Read more >
Inconsistent copy and paste behaviour. Is there a fix?
I've encountered what I can best describe as "unpredictable" behaviour of the "clipboard". But in its own way, it actually is "predictable"", as...
Read more >
clipboard sharing in RDP sessions broken? - Devolutions Forum
6.0 I was able to cut and past from my local clipboard to the RDP session and vice-versa. Now I no longer have...
Read more >
Different (broken) behaviour of "Reveal Sequence in Project ...
To clarify - the issue only occurs when, in the Project Panel, you have navigated into a bin that doesn't contain your sequence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found