K3D-tools / K3D-jupyter

K3D lets you create 3D plots backed by WebGL with high-level API (surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects, volume renderer, colormaps, etc). The primary aim of K3D-jupyter is to be easy for use as stand alone package like matplotlib, but also to allow interoperation with existing libraries as VTK.
MIT License
921 stars 123 forks source link

Additional line when using 'simple' shader in k3d.lines #348

Closed ishomam closed 2 years ago

ishomam commented 2 years ago

First, thank you so much for the new release and the new lines object, it works very well. However, I noticed a small issue. When using 'simple' shader in k3d.lines, an additional undesired line is created. This example will generate the problem:

plot = k3d.plot()
X_Ia = np.array([
    [   0.     ,    0.     ,    0.     ],
       [ 553.6447 , -970.6123 ,   37.2735 ],
       [-416.0319 , -999.26416,  279.9797 ],
       [ 416.0319 ,  999.26416,  279.9797 ],
       [-553.6447 ,  970.6123 ,   37.2735 ],
       [ 434.9501 ,    0.     ,  246.61386],
       [-434.9501 ,    0.     ,  246.61386]])
I_Fi = np.array([[0, 1, 2],
       [0, 3, 4],
       [0, 1, 5],
       [0, 5, 3],
       [0, 2, 6],
       [0, 6, 4]])
lines = k3d.lines(X_Ia, I_Fi, shader='simple')
plot += lines
plot.display()

With shader='simple' we see the following:

image

Without it, we see the following (which is correct):

image

For shader='mesh' the problem is also not there.

Thanks in advance!

artur-trzesiok commented 2 years ago

Good spot! I'm working on it

artur-trzesiok commented 2 years ago

Please bump k3d to 2.13.1. It should be fixed. It is already on pypi (we are waiting for conda-forge bot)

ishomam commented 2 years ago

Thanks for the quick response! I've just upgraded it from conda-forge and it works properly now ;)

artur-trzesiok commented 2 years ago

Thanks @ishomam for your feedback!