Giter Site home page Giter Site logo

3d-cutter's Introduction

3d-cutter

Description

If you want to cut a tetrahedral mesh with an arbitrary surface in 3d, this is the code to use!

It's a simplified implementation of the paper "An Adaptive Virtual Node Algorithm with Robust Mesh Cutting" http://www.seas.upenn.edu/~cffjiang/research/cut/paper.pdf. The resolution of the cutting details is constrained by the tetrahedral mesh, which is adaptively refined after each cut. For now it doesn't support robust intersection computations or cutting through nodes, edges or faces, so you will need to perturb your meshes to avoid these degenerate cases if they happen.

Usage

Written in C++11, the header only cutter depends on the standard library alone, and it has a simple interface:

TetMesh Cutter3D::run(const TetMesh& tetMesh, const TriMesh& triMesh).

You simply feed the cutter a tetrahedral mesh and a cutting surface mesh, and it will return a new tetrahedral mesh that is cut.

The meshes can be easily constructed from std::vector and std::array, so just convert your meshes into these std data structures and start running the cutter!

TetMesh(vector<array<T,3>>& nodes, vector<array<int,4>>& mesh)

TriMesh(vector<array<T,3>>& nodes, vector<array<int,3>>& mesh)

Demo

main.cpp is an interactive cutting interface that depends on OpenGL and GLUT. It supports drawing a curve that will be extended along the z direction into a cutting surface, dragging pieces around, rotation and shifting. For more details, please see the comments in the keyboard callback function "void key(unsigned char key, int x, int y)".

The video demo.mov is added to showcase the cutting effects.

3d-cutter's People

Contributors

dxd39 avatar loopstring 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3d-cutter's Issues

Possibility to get the intersection result of splitting ?

Hello,
I would like to use your library for doing slicing (volume by 3D surface offsets).
So i could mesh the solid with tétras and split/cut it by cutting surface mesh (and then loop, in parallel).
But i would need to get the slice mesh (intersection result). Do you think it would be possible as-it, or need adjustments (if yes, which ones)?

thank you.

Virtual tissue cutting in real-time medical simulations

Hello @loopstring ,

first of all, big thanks for sharing this code! Great work - mesh cutting is a super challenging topic and, beside tetcutter, I am not aware of any other open code in this field. May I ask if you are the author behind the Adaptive Virtual Node paper? If yes then I would like to congratulate on your work!

I have smoothly integrated your code with my Position Based Dynamics simulation framework in Unity3D and run some initial test. https://cdn.pbrd.co/images/H8e6mfy.jpg

So far so good. However, there is still a long way before apply this method in simulation.

For example, any general suggestions on how to tackle the gradual cutting, e. g. when scalpel is going through the tissue?

Currently, it seems that there is no snapping or resulting structures optimizations. Also the edges of cutting mesh generate new nodes on the cutted mesh.

In other words, what are the plans for further developments? Are you interested only in the cutting algorithm alone or you'd like to push it further towards complete out-of-the-box solution

Thank you

running rate

@loopstring Hello, first of all thank you for providing such excellent code~ I ran your code on my machine, Windows10+VS2015, but unfortunately it was very slow, taking about two or three minutes to complete a cut. However, the effect I saw in your demo is very smooth. WWhat do you think is the main reason please?!

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.