Giter VIP home page Giter VIP logo

justachetan / diffgeoops Goto Github PK

View Code? Open in Web Editor NEW
52.0 1.0 6.0 2.08 MB

Python implementation of the paper "Discrete Differential-Geometry Operators for Triangulated 2-Manifolds" by Meyer et. al. VisMath 2002

Home Page: http://multires.caltech.edu/pubs/diffGeoOps.pdf

License: MIT License

Python 100.00%
differential-geometry manifolds curvature python3 mayavi 3d scientific-computing numerical-methods discrete-differential-geometry 2-manifolds

diffgeoops's Introduction

DiffGeoOps

This repository contains a Python implementation of the paper:

Discrete Differential-Geometry Operators for Triangulated 2-Manifolds. Mark Meyer, Mathieu Desbrun, Peter Schröder and Alan H. Barr. VisMath 2002

This module implements the discrete versions of three differential geometry operators for Triangulated 2-manifolds that have been discussed in the paper. They are:

  • Mean Curvature
  • Gaussian Curvature
  • Principal Curvature

Usage

$ python3 DiffGeoOps.py -h
usage: DiffGeoOps.py [-h] --mode MODE [--ops OPS] [--mesh MESH] [--save]
                     [--title TITLE]
                     i [i ...]

First, use '--mode 0' to generate files for containing value of the
operator and then plot the operatore using '--mode 1' and '--mesh'. For
'--ops', the operations are encoded as:
  - 1: Mean Curvature
  - 2: Gaussian Curvature
  - 3: Principal Curvatures
Note that each operation is performed for all the input files.

positional arguments:
  i              path to input file(s)

optional arguments:
  -h, --help     show this help message and exit
  --mode MODE    specifies mode for program:
                 - 0: For computation
                 - 1: For Plotting
  --ops OPS      number to denote all the operations to be
                 performed on each file.
  --mesh MESH    mesh on which curvatures were calculated (redundant in computation mode)
  --save         flag for saving the plot (redundant in computation mode)
  --title TITLE  title of plot (redundant in computation mode)

First you need to provide a 3D mesh as an input to the code with --mode 0 for computation. The mesh should be in Object File Format (.off). Then use the command with --mode 1 for plotting. For more explaination, see Example Usage.

Example Usage

$ # Calculating Gaussian Curvature of a Torus mesh
$ python3 DiffGeoOps.py --mode 0 --op 2 torus.off
$ # Plotting the generated values. The file generated will be <MESH-NAME>_<OP>.npy
$ python3 DiffGeoOps.py --mode 1 --mesh torus.off torus_KG.npy

You can also provide multiple files as input for --mode 0 now:

$ # Calculating Mean and Gaussian curvatures for 2 meshes
$ python DiffGeoOps.py --mode 0 --op 12 example_meshes/torus.off example_meshes/moebius.off
[DiffGeoOps]: Mean Curvature for example_meshes/torus.off saved to ./example_meshes/torus_KH.npy
[DiffGeoOps]: Gaussian Curvature for example_meshes/torus.off saved to ./example_meshes/torus_KG.npy
[DiffGeoOps]: Mean Curvature for example_meshes/moebius.off saved to ./example_meshes/moebius_KH.npy
[DiffGeoOps]: Gaussian Curvature for example_meshes/moebius.off saved to ./example_meshes/moebius_KG.npy

Note: The plot mode does not yet support multiple inputs

Some results

  • Plot of Gaussian curvature for Torus

Gaussian curvature for Torus



  • Plot of Mean curvature for the Mother-son mesh Mean curvature for Mother-son mesh

License

Copyright (c) 2019 Aditya Chetan

For license information, see LICENSE or http://mit-license.org


This code was written as a part of my independent study in Differential Geometry with Dr. Kaushik Kalyanaraman at IIIT Delhi during Winter 2019 Semester.

For bugs in the code, please write to: aditya16217 [at] iiitd [dot] ac [dot] in

diffgeoops's People

Contributors

dependabot[bot] avatar justachetan 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

Watchers

 avatar

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.