npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

laplacian-deformation

v3.0.0

Published

Laplacian mesh deformation

Downloads

12

Readme

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.