Code Monkey home page Code Monkey logo

Comments (3)

marcomusy avatar marcomusy commented on July 17, 2024

it's clearly a bug in the k3d interface! Thanks a lot for spotting it,
while I fix it you can either:

  • set a very small non-zero number like `array([0.00001, 0., 0.])
  • use the 'itkwidget' backend instead of k3d:
from vtkplotter import Points, embedWindow
import numpy as np

embedWindow('itk')

positions = np.array(
      [[0.16621395, 0.28789101, 0.        ],
       [0.        , 0.        , 0.        ],
       [0.24386514, 0.        , 0.        ],
       [0.07767649, 0.04484654, 0.12684517],
       [0.        , 0.        , 0.        ],
       [0.02198013, 0.01269023, 0.0358934 ],
       [0.13108585, 0.00570134, 0.01612581],
       [0.36077809, 0.        , 0.        ],
       [0.22941974, 0.3399008 , 0.08126898],
       [0.15449964, 0.01249786, 0.03534928]])

Points(positions, c='black').show(bg='white')

from vedo.

mahendra-ramajayam avatar mahendra-ramajayam commented on July 17, 2024

Thank you.

from vedo.

marcomusy avatar marcomusy commented on July 17, 2024

I just realized that you have a duplicated point in the list.. the k3d interface removes which causes the mismatch. I managed to fix that , the fix will be available in the next release.
If you use numpy.unique that also solves the problem:

from numpy import array, unique
from vtkplotter import show, Points, Plotter
positions = array([[0.16621395, 0.28789101, 0.        ],
       [0.        , 0.        , 0.        ],
       [0.24386514, 0.        , 0.        ],
       [0.07767649, 0.04484654, 0.12684517],
       [0.        , 0.        , 0.        ],
       [0.02198013, 0.01269023, 0.0358934 ],
       [0.13108585, 0.00570134, 0.01612581],
       [0.36077809, 0.        , 0.        ],
       [0.22941974, 0.3399008 , 0.08126898],
       [0.15449964, 0.01249786, 0.03534928]])

positions = unique(positions, axis=0)

plot_cba = Plotter()
points_cba = Points(positions, c='black', r=10)
plot_cba += points_cba
show(points_cba)

Thanks!
Marco

from vedo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.