terranigmus
(Paul-Benjamin Riedel)
July 16, 2024, 12:04pm
1
I came upon this issue here:
opened 03:00PM - 15 Jul 24 UTC
bug
### Describe the bug, what's wrong, and what you expected.
I am trying to map a… texture to a draped grid of ERT values.
Can't get the png of my texture to be accurately mapped to the grid I am generating.
Turns out, texture_map_to_plane gets some weird results because it doesn't seem to take rotation into account.
To demonstrate we modify the example:
https://docs.pyvista.org/version/stable/examples/02-plot/texture.html
### Steps to reproduce the bug.
```python
# create a structured surface
x = np.arange(-10, 10, 0.25)
z = np.arange(-10, 10, 0.25)
x, z = np.meshgrid(x, z)
r = np.sqrt(x**2 + z**2)
y = np.sin(r)
curvsurf = pv.StructuredGrid(x, y, z)
curvsurf.plot()
curvsurf.texture_map_to_plane(inplace=True)
tex = examples.download_masonry_texture()
curvsurf.plot(texture=tex)
```
Output :
![grafik](https://github.com/user-attachments/assets/9d34d021-f5e5-45dc-b380-0e1ad35fc350)
![grafik](https://github.com/user-attachments/assets/3c032412-8bed-401b-a51d-88e75516185a)
### System Information
```shell
--------------------------------------------------------------------------------
Date: Mon Jul 15 16:59:51 2024 Mitteleuropäische Sommerzeit
OS : Windows (10 10.0.19045 SP0 Multiprocessor Free)
CPU(s) : 12
Machine : AMD64
Architecture : 64bit
RAM : 31.7 GiB
Environment : Jupyter
GPU Vendor : NVIDIA Corporation
GPU Renderer : Quadro T1000/PCIe/SSE2
GPU Version : 4.5.0 NVIDIA 538.18
MathText Support : False
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:40:08)
[MSC v.1938 64 bit (AMD64)]
pyvista : 0.43.7
vtk : 9.2.2
numpy : 1.26.4
matplotlib : 3.7.1
scooby : 0.10.0
pooch : 1.8.1
pillow : 9.5.0
imageio : 2.34.1
pyvistaqt : 0.11.0
PyQt5 : 5.15.9
IPython : 8.4.0
ipywidgets : 8.1.2
scipy : 1.13.0
tqdm : 4.66.4
jupyterlab : 4.2.0
nest_asyncio : 1.6.0
--------------------------------------------------------------------------------
```
### Screenshots
_No response_
Basically, automated plane generation works as long as the normal of that plane is in z direction, for everything else it doesn’t work.
Since providing the correct origin, point1 and point2 by hand and NOT calling the automated plane finding through setting “SetAutomaticPlaneGeneration(True)” to true WORKS AS INTENDED and paraview showing exactly the same bug when using the “Texture Map To Plane”- Filter, this must be at the end of the VTK library.
Unfortunately my knowledge and capability ends here. I work around this by providing the required points though a few lines of code, but it would be nice if this was fixed/clarified.
Cheers!
1 Like