Code Monkey home page Code Monkey logo

fast-simplification's Introduction

PyVista

3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)
pyvista

PyVista is:

  • Pythonic VTK: a high-level API to the Visualization Toolkit (VTK)
  • mesh data structures and filtering methods for spatial datasets
  • 3D plotting made simple and built for large/complex data geometries

pyvista ipython demo

PyVista is a helper module for the Visualization Toolkit (VTK) that wraps the VTK library through NumPy and direct array access through a variety of methods and classes. This package provides a Pythonic, well-documented interface exposing VTK's powerful visualization backend to facilitate rapid prototyping, analysis, and visual integration of spatially referenced datasets.

This module can be used for scientific plotting for presentations and research papers as well as a supporting module for other mesh 3D rendering dependent Python modules; see Connections for a list of projects that leverage PyVista.

Share this project on X: tweet

PyVista is a NumFOCUS affiliated project

NumFOCUS affiliated projects

Status badges

Deployment pypi conda Packaging status
Build Status GH-CI python pre-commit.ci status
Metrics codacy codecov
Activity PyPIact condaact
Citation joss zenodo
License MIT
Community slack discuss Good first issue
Formatter prettier
Linter Ruff
Affiliated NumFOCUS Affiliated
Mentioned Awesome Scientific Computing

Highlights

Head over to the Quick Examples page in the docs to explore our gallery of examples showcasing what PyVista can do. Want to test-drive PyVista? All of the examples from the gallery are live on MyBinder for you to test drive without installing anything locally: Launch on Binder

Overview of Features

  • Extensive gallery of examples (see Quick Examples)
  • Interactive plotting in Jupyter Notebooks with server-side and client-side rendering with trame.
  • Filtering/plotting tools built for interactivity (see Widgets)
  • Direct access to mesh analysis and transformation routines (see Filters)
  • Intuitive plotting routines with matplotlib similar syntax (see Plotting)
  • Import meshes from many common formats (use pyvista.read()). Support for all formats handled by meshio is built-in.
  • Export meshes as VTK, STL, OBJ, or PLY (mesh.save()) file types or any formats supported by meshio (pyvista.save_meshio())

Documentation

Refer to the documentation for detailed installation and usage details.

For general questions about the project, its applications, or about software usage, please create a discussion in pyvista/discussions where the community can collectively address your questions. You are also welcome to join us on Slack.

Installation

PyVista can be installed from PyPI using pip on Python >= 3.8:

pip install pyvista

You can also visit PyPI, Anaconda, or GitHub to download the source.

See the Installation for more details regarding optional dependencies or if the installation through pip doesn't work out.

Connections

PyVista is a powerful tool that researchers can harness to create compelling, integrated visualizations of large datasets in an intuitive, Pythonic manner.

Learn more about how PyVista is used across science and engineering disciplines by a diverse community of users on our Connections page.

Authors

Please take a look at the contributors page and the active list of authors to learn more about the developers of PyVista.

contrib.rocks

Made with contrib rocks.

Contributing

Contributor Covenant Code Triage Open in GitHub Codespaces

We absolutely welcome contributions and we hope that our Contributing Guide will facilitate your ability to make PyVista better. PyVista is mostly maintained on a volunteer basis and thus we need to foster a community that can support user questions and develop new features to make this software a useful tool for all users while encouraging every member of the community to share their ideas. To learn more about contributing to PyVista, please see the Contributing Guide and our Code of Conduct.

Citing PyVista

There is a paper about PyVista.

If you are using PyVista in your scientific research, please help our scientific visibility by citing our work.

Sullivan and Kaszynski, (2019). PyVista: 3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK). Journal of Open Source Software, 4(37), 1450, https://doi.org/10.21105/joss.01450

BibTex:

@article{sullivan2019pyvista,
  doi = {10.21105/joss.01450},
  url = {https://doi.org/10.21105/joss.01450},
  year = {2019},
  month = {May},
  publisher = {The Open Journal},
  volume = {4},
  number = {37},
  pages = {1450},
  author = {Bane Sullivan and Alexander Kaszynski},
  title = {{PyVista}: {3D} plotting and mesh analysis through a streamlined interface for the {Visualization Toolkit} ({VTK})},
  journal = {Journal of Open Source Software}
}

Professional Support

While PyVista is an Open Source project with a big community, you might be looking for professional support. This section aims to list companies with VTK/PyVista expertise who can help you with your software project.

Company Name Kitware Inc.
Description Kitware is dedicated to build solutions for our customers based on our well-established open source platforms.
Expertise CMake, VTK, PyVista, ParaView, Trame
Contact https://www.kitware.com/contact/

fast-simplification's People

Contributors

akaszynski avatar louis-pujol avatar pre-commit-ci[bot] avatar zfb132 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fast-simplification's Issues

Keeping track of the history of edge's collapses

Hello,

First of all thank you for this very nice python wrapper of fqmr. For one of my projects, I need to decimate triangular meshes and keep the history of the successive collapses. This can help for various tasks :

  • It allows to "replay" the decimation process and make accessible intermediate states of the mesh between the input and the output
  • It allows to compute a map from the vertices of the input and the one of the output. In my application some vertices of the input are marked as landmarks and I want to conserve these landmarks on the output
  • If one has a collection of registered meshes (as the SCAPE dataset) it allows to simplify one mesh and apply the same simplification process to the other meshes. This results in a collection of simplified registered meshes

I created a fork of this repository here to implement a version of simplification with collapses recording. I modified the code of fast_simplification in order to be able to access the collapses history, encoded as a (n_collapses, 2) integer array. If collapses[j] = [i0, i1], it means that the (j+1)th collapses edge was (i0, i1) with the convention that the index of the point resulting from the collapse is i0.

  • In Simplify.h : a global variable collapses (vector<vector <int>>) is created and when a collapse occurs in the function simplify_mesh it is updated with collapses.push_back(std::vector<int>({i0,i1}));
  • wrapper.h, _simplify.pyx are modified to make accessible collapses in python. get_collapses() and return_collapses() functions are defined in the same way as get_points(), get_triangles(), return_points(), return_triangles()
  • The python interface in simplify.py is modified to make access to collapses. In simplify() , I have added an argument return_collapses (default to False). If return_collapses is True, then the output of simplify is (points, triangles, collapses) instead of (points, triangles). In simplify_mesh(), I added collapse as a field data of the output mesh

All the tests previously defined still pass and I added two tests to check that input.n_points - n_collapses = output.n_points in a separate test file

Do you think this could be pertinent to merge these modifications to fast_simplification ?

Having access to collapses is a first step for the tasks I mentioned above. I am working on implementing these based on the (points, triangles, collapses) information in another repository (it is a draft for the moment). Maybe it could be of interest to also add these to fast-simplification in the future ?

Thank you,

Lack of support for double-float vertex coordinates

Internally it looks like the Fast-Quadric-Mesh-Simplification stores vertex coordinates as doubles, but the fast-simplification wrapper only loads floats.

The simplification calculations are adversely affected by lower-precision data, especially when the mesh is not "centered" (moved near the origin).

Also, for vertices that aren't collapsed, it can simplify user code for their coordinates not to be changed, and the double->single->double conversion loses information.

Issues with Numpy>=2.0

Hi @akaszynski !

There is an issue for fast-simplification with Numpy2.0. An example in a recent PR: https://github.com/pyvista/fast-simplification/actions/runs/10048065221/job/27771195361?pr=37

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

So far oldest-supported-numpy is used for the build. To use fast-simplification with the precompiled wheel, I need to downgrade Numpy to 1.26. What do you think about changing oldest-supported-numpy to numpy>=2.0 in the build requirements ?

Holes generation in flat geometries

Hello guys,

Thanks for this tool, quite interesting. Today, I was playing around and I noticed that fast_simplification produces holes in the geometry if operating on flat surfaces 2D surfaces. Does this ring a bell?

Commnad I ma using is simply:
points_out, faces_out = fast_simplification.simplify(points, faces, 0.5)

Maybe I can add more flags to prevent this.

Many thanks.

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.