The purpose of this code is to define interpolant and projector on 1D - 2D and 3D convex polytopes.
Start by running run_me2.mlx
, or if it doesn't work because of compatibility issues, run_me.m
.
For Matlab versions earlier than R2020B, you have to install MMX on your system :
https://github.com/yuvaltassa/mmx.
Hereafter are some examples of projected points onto 2D and 3D polytopes obtained with this code :
run_me.m
and run_me2.mlx are examples files.Domain.m
is a class file which includes the definition of polytopes, the projection and the display methods. Among them, you can use :domain = Domain(type)
: constructor of aDomain
instance ;type
can be a string or a number, typehelp Domain
for more detailsdomain.projection(x)
: project the pointsx
ontodomain
domain.plot()
: display thedomain
domain.plot_normalFan()
: display the normal fan ofdomain
domain.plot_Wachspress(n)
: display the shape of the Wachspress basis function associated with then
-vertex
wachspress.m
is a function which returns the values of the Wachspress basis functions and their gradient a given points and a given domain. The points should be inside the domain. This file is an optimized version of a code provided by Floater et. al. 1t.m
andmult.m
are multithread transpose and matrix multiplication operators, respectively, to speed up the calculation when there are lots of points.
NB The code has been tested with success on Matlab R2020b and R2022b.
Please use the following citation reference if you use the code:
T. Cherrière and L. Laurent. tcherrie/wachspress2d3d: Wachspress2d3d (v1.0.1), March 2023. Zenodo. https://doi.org/10.5281/zenodo.7701776
Bibtex entry:
@software{tcherrie_2022_7701776,
author = {Cherrière, Théodore and Laurent, Luc},
title = {tcherrie/Wachspress2D3D: Wachspress2D3D},
month = mar,
year = 2023,
publisher = {Zenodo},
version = {v1.0.1},
doi = {10.5281/zenodo.7701776},
url = {https://doi.org/10.5281/zenodo.7701776}
}
NB: version number and DOI must be adapted from Zenodo's repository.
Copyright (C) 2022 Théodore CHERRIERE (theodore.cherriere@ens-paris-saclay.fr)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Footnotes
-
M. Floater, A. Gillette, and N. Sukumar, “Gradient bounds for Wachspress coordinates on polytopes,” SIAM J. Numer. Anal., vol. 52, no. 1, pp. 515–532, 2014, doi: 10.1137/130925712 ↩