Giter VIP home page Giter VIP logo

laplacian-deformation's Introduction

laplacian deformation module

CLICK HERE FOR DEMO

This module implements laplacian surface editing. This technique allows you to deform the surface of a mesh, while still preserving the details of the surface. We implement this by minimizing the energy function (5) in the linked paper.

To run a minimal example do:

npm run minimal

To run a more advanced demo do:

npm run start

In our current API, we load the module as

require("laplacian-deformation").load(function(initModule,prepareDeform, doDeform, freeModule) {
// code that uses the API here.
}

The API consists of four methods. We describe them below.

initModule(mesh)

initializes the module for doing deformation on mesh. Must be called before any other methods in the API.

prepareDeform(handles, unconstrained)

Does precalculations necessary for performing deformation on a region of vertices of the mesh. Note that this is a slow operation that performs performs a cholesky decomposition!

  • handles vertices that can be freely manipulated and moved by the user of the library.

  • unconstrained these are vertices that are free, and are solved for in the laplacian deformation calculations.

Some images will serve to clarify the meaning of the above parameters.

In the image, handles is yellow, unconstrained is blue, and the gray region are vertices not affected by the deformation. Only yellow and blue vertices are affected by the deformation, so these are in the region of deformation. Note that the user is expected to specify boundary vertices that specify the end of the region of deformation. In the above image, these boundary vertices are the yellow vertices above the gray vertices, and these boundary vertices are part of the handles vertices. So their positions can be manipulated as well.

The user of the library deforms the mesh by setting the positions of the handles vertices by calling doDeform. One possible deformation can look like the below:

It is shown in minimal/minimal.js how this deformation was done.

deDeform(handlesPositions)

After calling prepareDeform(), we can use doDeform() to specify the positions of the handles vertices, and thus deform the mesh. The function returns the vertex coordinates of the deformed mesh. We can call this function as many times as we want after calling prepareDeform. In difference to prepareDeform, this is a very fast operation.

  • handlesPositions is simply an array of coordinates of the format [[x,y,z], [x,y,z], ...]. The first coordinate sets the positions of the handle handles[0], and so on.

laplacian-deformation's People

Contributors

erkaman avatar mikolalysenko avatar

Stargazers

Yu-Sheng Tzou 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.