-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:libigl/libigl-python-bindings into …
…alecjacobson/bump-libigl
- Loading branch information
Showing
10 changed files
with
134 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
//TODO: __example | ||
#include <common.h> | ||
#include <npe.h> | ||
#include <typedefs.h> | ||
#include <igl/blue_noise.h> | ||
|
||
const char* ds_blue_noise = R"igl_Qu8mg5v7( | ||
"Fast Poisson Disk Sampling in Arbitrary Dimensions" [Bridson 2007] | ||
For very dense samplings this is faster than (up to 2x) cyCodeBase's | ||
implementation of "Sample Elimination for Generating Poisson Disk Sample | ||
Sets" [Yuksel 2015]. YMMV | ||
Parameters | ||
---------- | ||
V #V by dim list of mesh vertex positions | ||
F #F by 3 list of mesh triangle indices into rows of V | ||
r Poisson disk radius (evaluated according to Euclidean distance on V) | ||
Returns | ||
------- | ||
B #P by 3 list of barycentric coordinates, ith row are coordinates of | ||
ith sampled point in face FI(i) | ||
FI #P list of indices into F | ||
P #P by dim list of sample positions. | ||
See also | ||
-------- | ||
random_points_on_mesh | ||
Notes | ||
----- | ||
None | ||
Examples | ||
-------- | ||
)igl_Qu8mg5v7"; | ||
|
||
npe_function(blue_noise) | ||
npe_doc(ds_blue_noise) | ||
|
||
npe_arg(v, dense_float, dense_double) | ||
npe_arg(f, dense_int, dense_long, dense_longlong) | ||
npe_arg(r, double) | ||
|
||
|
||
npe_begin_code() | ||
|
||
assert_valid_23d_tri_mesh(v, f); | ||
EigenDenseLike<npe_Matrix_v> b; | ||
Eigen::VectorXi fi; | ||
EigenDenseLike<npe_Matrix_v> p; | ||
igl::blue_noise(v, f, r, b, fi, p); | ||
return std::make_tuple(npe::move(b), npe::move(fi), npe::move(p)); | ||
|
||
npe_end_code() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <npe.h> | ||
#include <common.h> | ||
#include <typedefs.h> | ||
// On macos with cp36, termios.h is getting included for some reason and it | ||
// defines B0 | ||
#ifdef B0 | ||
# undef B0 | ||
#endif | ||
#include <igl/fit_cubic_bezier.h> | ||
#include <pybind11/stl_bind.h> | ||
#include <pybind11/stl.h> | ||
|
||
|
||
const char *ds_fit_cubic_bezier = R"igl_Qu8mg5v7( | ||
Fit a cubic bezier spline (G1 continuous) to an ordered list of input | ||
points in any dimension, according to "An algorithm for automatically | ||
fitting digitized curves" [Schneider 1990]. | ||
Parameters | ||
---------- | ||
d #d by dim list of points along a curve to be fit with a cubic bezier | ||
spline (should probably be roughly uniformly spaced). If d(0)==d(end), | ||
then will treat as a closed curve. | ||
error maximum squared distance allowed | ||
Returns | ||
------- | ||
cubics #cubics list of 4 by dim lists of cubic control points | ||
)igl_Qu8mg5v7"; | ||
|
||
npe_function(fit_cubic_bezier) | ||
npe_doc(ds_fit_cubic_bezier) | ||
|
||
npe_arg(d, dense_float, dense_double) | ||
npe_arg(error, double) | ||
|
||
npe_begin_code() | ||
// igl::fit_cubic_bezier is hard-coded to double, so for now copy. | ||
Eigen::MatrixXd d_cpy = d.template cast<double>(); | ||
std::vector<Eigen::MatrixXd> c_cpy; | ||
igl::fit_cubic_bezier(d_cpy,error,c_cpy); | ||
std::vector<EigenDenseLike<npe_Matrix_d>> c(c_cpy.size()); | ||
std::transform (c_cpy.begin(), c_cpy.end(), c.begin(), | ||
[](const Eigen::MatrixXd & ci){ return ci.cast<npe_Scalar_d>();}); | ||
// numpyeigen's pybind11 fork `numpy_hacks_stable` is printing "Encapsulate move!" | ||
// https://github.com/fwilliams/numpyeigen/issues/58 | ||
return pybind11::detail::type_caster<decltype(c)>::cast(c, pybind11::return_value_policy::move, pybind11::none()); | ||
|
||
npe_end_code() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters