Metadata-Version: 2.4
Name: iarap
Version: 1.0.0
Summary: ARAP regularization for implicit surfaces
Author-email: Tobias Djuren <t.djuren@tu-berlin.de>, Markus Worchel <m.worchel@tu-berlin.de>, Ugo Finnendahl <finnendahl@tu-berlin.de>, Marc Alexa <marc.alexa@tu-berlin.de>
License-Expression: MIT
Project-URL: Homepage, https://gitlab.com/tobidju/arap-regularization-for-implicit-surfaces
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: licence.txt
Requires-Dist: torch>=2.0
Dynamic: license-file

![](/assets/teaser.jpg)


# ARAP-Regularization-for-Implicit-Surfaces

This is the source code for the paper [As-Rigid-As-Possible Regularization for Implicit Surfaces](https://diglib.eg.org/items/de832211-9ab2-431d-bb2b-cde770a5b5ca), SGP 2026.

## Installation

The only dependency is [pytorch](https://pytorch.org/) (tested with torch 2.11.0 with CUDA 12.8). For the demos that generate results similar to those in the paper (implict surface modeling and Gauss Stylization) further dependencies are required (see `demos/requirements.txt`).

````powershell
python -m venv .env
.\.venv\Scripts\Activate.ps1 # depends on your os
pip install git+https://gitlab.com/tobidju/arap-regularization-for-implicit-surfaces.git
````

## Usage (iarap.arap_energy)
`iarap.arap_energy` computes the batch-averaged ARAP regularization energy ($\mathcal{L}_{ARAP}$) for a deformation model $\boldsymbol f$.

* Input:

  `f`: deformation function as `torch.nn.Module` $(B, d) \rightarrow (B, d)$

  `samples`: points of shape $(B, d)$ (tested with $d=2$ and $d=3$)

  `l_bend`: bending weight ($\lambda_{bend}$)
* Output:
  scalar tensor (mean ARAP energy)

Minimal example:

````python
import torch
import iarap

class Identity(torch.nn.Module):
    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return x

f = Identity()
samples = torch.randn(1024, 3, device="cuda" if torch.cuda.is_available() else "cpu")
loss = iarap.arap_energy(f, samples, l_bend=0.1)
print(loss.item())
````

## Demos

Please see `./demos/surface_modeling.ipynb` to see how ARAP regularization can be used to model implicit surfaces with user defined handles. In `./demos/gauss_stylization.ipynb` you will find the implict variant of [Gauss Stylization](https://github.com/ugogon/gaussStylization) as described in the paper.

There are multiple pretrained signed distance functions in `./demos/sdfs`. Please note that some sdfs are based on meshes that are under CC-BY.


## Citation

If you use the repository, please cite
```
@article{10.1111:cgf.70519,
  journal = {Computer Graphics Forum},
  title = {{As-Rigid-As-Possible Regularization for Implicit Surfaces}},
  author = {Djuren, Tobias and 
    Worchel, Markus and 
    Finnendahl, Ugo and 
    Alexa, Marc},
  year = {2026},
  publisher = {The Eurographics Association and John Wiley & Sons Ltd.},
  ISSN = {1467-8659},
  DOI = {10.1111/cgf.70519}
}
```
