diff --git a/src/harmonic.cpp b/src/harmonic.cpp index 4d461e64..27ab2207 100644 --- a/src/harmonic.cpp +++ b/src/harmonic.cpp @@ -30,7 +30,7 @@ Examples )igl_Qu8mg5v7"; -npe_function(harmonic_weights) +npe_function(harmonic) npe_doc(ds_harmonic_w) npe_arg(v, dense_float, dense_double) npe_arg(f, dense_int, dense_long, dense_longlong) @@ -78,7 +78,7 @@ Examples )igl_Qu8mg5v7"; -npe_function(harmonic_weights_uniform_laplacian) +npe_function(harmonic_uniform_laplacian) npe_doc(ds_harmonic_ul) npe_arg(f, dense_int, dense_long, dense_longlong) @@ -134,7 +134,7 @@ Examples )igl_Qu8mg5v7"; -npe_function(harmonic_weights_from_laplacian_and_mass) +npe_function(harmonic_from_laplacian_and_mass) npe_doc(ds_harmonic) //TODO: l and bc need to have same type, matching missing npe_arg(l, sparse_float, sparse_double) @@ -187,7 +187,7 @@ Examples )igl_Qu8mg5v7"; -npe_function(harmonic_weights_integrated_from_laplacian_and_mass) +npe_function(harmonic_integrated_from_laplacian_and_mass) npe_doc(ds_harmonic_int_lapl) npe_arg(l, sparse_float, sparse_double) @@ -231,7 +231,7 @@ Examples )igl_Qu8mg5v7"; -npe_function(harmonic_weights_integrated) +npe_function(harmonic_integrated) npe_doc(ds_harmonic_int) npe_arg(v, dense_float, dense_double) diff --git a/tests/test_basic.py b/tests/test_basic.py index 5cfcb4b1..21919529 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -934,7 +934,7 @@ def test_arap1(self): thetas = np.linspace(0, 2 * np.pi, len(b))[:, np.newaxis] bc = np.concatenate([np.cos(thetas), np.sin( thetas), np.zeros_like(thetas)], axis=1) - uv_initial_guess = igl.harmonic_weights(v, f, b, bc, 1) + uv_initial_guess = igl.harmonic(v, f, b, bc, 1) v2d = v[:, :2].copy() arap1 = igl.ARAP(v2d, f, 2, b) @@ -965,7 +965,7 @@ def test_arap2(self): circle_b = np.concatenate( [np.cos(thetas), np.sin(thetas), np.zeros([len(b), 1])], axis=1) - v0 = igl.harmonic_weights(v, f, b, circle_b, 1) + v0 = igl.harmonic(v, f, b, circle_b, 1) arap = igl.ARAP(v, f, 2, b) v2 = arap.solve(circle_b[:, :2], v0[:, :2]) @@ -983,7 +983,7 @@ def test_arap3(self): bnd_uv = igl.map_vertices_to_circle(v, bnd) # Harmonic parametrization for the internal vertices - uv = igl.harmonic_weights(v, f, bnd, bnd_uv, 1) + uv = igl.harmonic(v, f, bnd, bnd_uv, 1) arap = igl.ARAP(v, f, 2, np.zeros((0))) uva = arap.solve(np.zeros((0, 0)), uv) @@ -995,7 +995,7 @@ def test_arap4(self): thetas = np.linspace(0, 2 * np.pi, len(b))[:, np.newaxis] bc = np.concatenate([np.cos(thetas), np.sin( thetas), np.zeros_like(thetas)], axis=1) - uv_initial_guess = igl.harmonic_weights(v, f, b, bc, 1) + uv_initial_guess = igl.harmonic(v, f, b, bc, 1) arap = igl.ARAP(v, f, 3, b, igl.ARAP_ENERGY_TYPE_SPOKES) uva = arap.solve(bc, uv_initial_guess) @@ -1006,7 +1006,7 @@ def test_slim(self): thetas = np.linspace(0, 2 * np.pi, len(b))[:, np.newaxis] bc = np.concatenate([np.cos(thetas), np.sin( thetas), np.zeros_like(thetas)], axis=1) - uv_initial_guess = igl.harmonic_weights(v, f, b, bc, 1) + uv_initial_guess = igl.harmonic(v, f, b, bc, 1) slim = igl.SLIM( v, f, uv_initial_guess[:, :2], b, bc[:, :2], igl.SLIM_ENERGY_TYPE_ARAP, 0.0) @@ -1060,28 +1060,28 @@ def test_boundary_conditions(self): # tested in test bbw pass - def test_harmonic_weights(self): + def test_harmonic(self): # tested in test_slim, test_arap2, and test_arap1 pass - def test_harmonic_weights_integrated(self): - Q = igl.harmonic_weights_integrated(self.v1, self.f1, 1) + def test_harmonic_integrated(self): + Q = igl.harmonic_integrated(self.v1, self.f1, 1) self.assertTrue(Q.dtype == self.v1.dtype) - def test_harmonic_weights_uniform_laplacian(self): + def test_harmonic_uniform_laplacian(self): b = np.array([0, 10]) bc = np.array([ [0, 0], [10., 10.]]) - W = igl.harmonic_weights_uniform_laplacian(self.f1, b, bc, 1) + W = igl.harmonic_uniform_laplacian(self.f1, b, bc, 1) self.assertTrue(W.dtype == self.v1.dtype) self.assertTrue(W.flags.c_contiguous) - def test_harmonic_weights_integrated_from_laplacian_and_mass(self): + def test_harmonic_integrated_from_laplacian_and_mass(self): l = igl.cotmatrix(self.v1, self.f1) m = igl.massmatrix(self.v1, self.f1, igl.MASSMATRIX_TYPE_VORONOI) - Q = igl.harmonic_weights_integrated_from_laplacian_and_mass(l, m, 1) + Q = igl.harmonic_integrated_from_laplacian_and_mass(l, m, 1) self.assertTrue(Q.dtype == self.v1.dtype) # deal with igl::PerEdgeNormalsWeightingType @@ -1112,10 +1112,10 @@ def test_harmonic(self): b = np.array([1, 2, 10, 7]) bc = self.v1[b, :] k = 1 - w = igl.harmonic_weights_from_laplacian_and_mass(l, m, b, bc, k) + w = igl.harmonic_from_laplacian_and_mass(l, m, b, bc, k) self.assertTrue(w.flags.c_contiguous) - def test_harmonic_weights_from_laplacian_and_mass(self): + def test_harmonic_from_laplacian_and_mass(self): # tested in test_harmonic pass @@ -2246,7 +2246,7 @@ def test_bijective_composite_harmonic_mapping(self): b = igl.boundary_loop(f) thetas = np.linspace(0, 2 * np.pi, len(b))[:, np.newaxis] bc = np.concatenate([np.cos(thetas), np.sin(thetas)], axis=1) - v2d = igl.harmonic_weights(v, f, b, bc, 1)[:, :2] + v2d = igl.harmonic(v, f, b, bc, 1)[:, :2] ret0, mapping0 = igl.bijective_composite_harmonic_mapping( v2d, f, b, bc) self.assertTrue(ret0) diff --git a/tutorial/igl_docs.md b/tutorial/igl_docs.md index 6a024a59..078a25ad 100644 --- a/tutorial/igl_docs.md +++ b/tutorial/igl_docs.md @@ -1280,8 +1280,8 @@ GRAD_INTRINSIC Construct an intrinsic gradient operator. |Returns| G \#F*2 by \#V gradient matrix: G=[Gx;Gy] where x runs along the 23 edge and
y runs in the counter-clockwise 90° rotation. | -### harmonic_weights -**`harmonic_weights(v: array, f: array, b: array, bc: array, k: int)`** +### harmonic +**`harmonic(v: array, f: array, b: array, bc: array, k: int)`** Compute k-harmonic weight functions "coordinates". @@ -1291,8 +1291,8 @@ Compute k-harmonic weight functions "coordinates". |Returns| W \#V by \#W list of weights | -### harmonic_weights_from_laplacian_and_mass -**`harmonic_weights_from_laplacian_and_mass(l: sparse_matrix, m: sparse_matrix, b: array, bc: array, k: int)`** +### harmonic_from_laplacian_and_mass +**`harmonic_from_laplacian_and_mass(l: sparse_matrix, m: sparse_matrix, b: array, bc: array, k: int)`** Compute a harmonic map using a given Laplacian and mass matrix @@ -1302,8 +1302,8 @@ Compute a harmonic map using a given Laplacian and mass matrix |Returns| W \#V by \#V list of weights | -### harmonic_weights_integrated -**`harmonic_weights_integrated(v: array, f: array, k: int)`** +### harmonic_integrated +**`harmonic_integrated(v: array, f: array, k: int)`** | | | @@ -1312,8 +1312,8 @@ Compute a harmonic map using a given Laplacian and mass matrix |Returns| Q \#V by \#V discrete (integrated) k-Laplacian | -### harmonic_weights_integrated_from_laplacian_and_mass -**`harmonic_weights_integrated_from_laplacian_and_mass(l: sparse_matrix, m: sparse_matrix, k: int)`** +### harmonic_integrated_from_laplacian_and_mass +**`harmonic_integrated_from_laplacian_and_mass(l: sparse_matrix, m: sparse_matrix, k: int)`** Build the discrete k-harmonic operator (computing integrated quantities). That is, if the k-harmonic PDE is Q x = 0, then this minimizes x' Q x @@ -1324,8 +1324,8 @@ That is, if the k-harmonic PDE is Q x = 0, then this minimizes x' Q x |Returns| Q \#V by \#V discrete (integrated) k-Laplacian | -### harmonic_weights_uniform_laplacian -**`harmonic_weights_uniform_laplacian(f: array, b: array, bc: array, k: int)`** +### harmonic_uniform_laplacian +**`harmonic_uniform_laplacian(f: array, b: array, bc: array, k: int)`** Compute harmonic map using uniform laplacian operator diff --git a/tutorial/tut-chapter3.ipynb b/tutorial/tut-chapter3.ipynb index faa2ac61..180f8840 100644 --- a/tutorial/tut-chapter3.ipynb +++ b/tutorial/tut-chapter3.ipynb @@ -72,7 +72,7 @@ "are asking that the bi-Laplacian of each of spatial coordinate function to be\n", "zero.\n", "\n", - "In libigl, one can solve a biharmonic problem with `harmonic_weights`\n", + "In libigl, one can solve a biharmonic problem with `harmonic`\n", "and setting $k=2$ (_bi_-harmonic).\n", "\n", "This produces a smooth surface that interpolates the handle constraints, but all\n", @@ -109,7 +109,7 @@ "\n", " $\\mathbf{d}_b = \\mathbf{x}_{bc} - \\mathbf{x}_b.$\n", "\n", - "Again we can use `harmonic_weights` with $k=2$, but this time solve for the\n", + "Again we can use `harmonic` with $k=2$, but this time solve for the\n", "deformation field and then recover the deformed positions:" ] }, @@ -144,7 +144,7 @@ "for i in range(3):\n", " u_bc_anim = v_bc + i*0.6 * (u_bc - v_bc)\n", " d_bc = u_bc_anim - v_bc\n", - " d = igl.harmonic_weights(v, f, b, d_bc, 2)\n", + " d = igl.harmonic(v, f, b, d_bc, 2)\n", " u = v + d\n", " subplot(u, f, s, shading={\"wireframe\": False, \"colormap\": \"tab10\"}, s=[1, 4, i+1], data=p)\n", "p\n", @@ -156,10 +156,10 @@ "\n", "# if deformation_field:\n", "# d_bc = u_bc_anim - v_bc\n", - "# d = igl.harmonic_weights(v, f, b, d_bc, 2)\n", + "# d = igl.harmonic(v, f, b, d_bc, 2)\n", "# u = v + d\n", "# else:\n", - "# u = igl.harmonic_weights(v, f, b, u_bc_anim, 2)\n", + "# u = igl.harmonic(v, f, b, u_bc_anim, 2)\n", "# p.update_object(vertices=u)" ] }, @@ -231,7 +231,7 @@ "c = np.array(is_outer)\n", "\n", "for i in range(1,5):\n", - " z = igl.harmonic_weights(v, f, b, bc, int(i))\n", + " z = igl.harmonic(v, f, b, bc, int(i))\n", " u[:, 2] = z\n", " if i == 1:\n", " p = subplot(u, f, c, shading={\"wire_width\": 0.01, \"colormap\": \"tab10\"}, s=[1, 4, i-1])\n", @@ -243,7 +243,7 @@ "# @interact(z_max=(0.0, 1.0), k=(1, 4))\n", "# def update(z_max, k):\n", "# print(k)\n", - "# z = igl.harmonic_weights(v, f, b, bc, int(k))\n", + "# z = igl.harmonic(v, f, b, bc, int(k))\n", "# u[:, 2] = z_max * z\n", "# p.update_object(vertices=u)" ] diff --git a/tutorial/tut-chapter4.ipynb b/tutorial/tut-chapter4.ipynb index 71cbd474..350fde11 100644 --- a/tutorial/tut-chapter4.ipynb +++ b/tutorial/tut-chapter4.ipynb @@ -91,7 +91,7 @@ "bnd_uv = igl.map_vertices_to_circle(v, bnd)\n", "\n", "## Harmonic parametrization for the internal vertices\n", - "uv = igl.harmonic_weights(v, f, bnd, bnd_uv, 1)\n", + "uv = igl.harmonic(v, f, bnd, bnd_uv, 1)\n", "v_p = np.hstack([uv, np.zeros((uv.shape[0],1))])\n", "\n", "p = subplot(v, f, uv=uv, shading={\"wireframe\": False, \"flat\": False}, s=[1, 2, 0])\n", @@ -204,7 +204,7 @@ "bnd_uv = igl.map_vertices_to_circle(v, bnd)\n", "\n", "## Harmonic parametrization for the internal vertices\n", - "uv = igl.harmonic_weights(v, f, bnd, bnd_uv, 1)\n", + "uv = igl.harmonic(v, f, bnd, bnd_uv, 1)\n", "\n", "arap = igl.ARAP(v, f, 2, np.zeros(0))\n", "uva = arap.solve(np.zeros((0, 0)), uv)\n", diff --git a/tutorial/tutorials.ipynb b/tutorial/tutorials.ipynb index fb92cb43..868ea3be 100644 --- a/tutorial/tutorials.ipynb +++ b/tutorial/tutorials.ipynb @@ -1080,7 +1080,7 @@ "are asking that the bi-Laplacian of each of spatial coordinate function to be\n", "zero.\n", "\n", - "In libigl, one can solve a biharmonic problem with `harmonic_weights`\n", + "In libigl, one can solve a biharmonic problem with `harmonic`\n", "and setting $k=2$ (_bi_-harmonic).\n", "\n", "This produces a smooth surface that interpolates the handle constraints, but all\n", @@ -1117,7 +1117,7 @@ "\n", " $\\mathbf{d}_b = \\mathbf{x}_{bc} - \\mathbf{x}_b.$\n", "\n", - "Again we can use `harmonic_weights` with $k=2$, but this time solve for the\n", + "Again we can use `harmonic` with $k=2$, but this time solve for the\n", "deformation field and then recover the deformed positions:" ] }, @@ -1157,10 +1157,10 @@ "\n", " if deformation_field:\n", " d_bc = u_bc_anim - v_bc\n", - " d = igl.harmonic_weights(v, f, b, d_bc, 2)\n", + " d = igl.harmonic(v, f, b, d_bc, 2)\n", " u = v + d\n", " else:\n", - " u = igl.harmonic_weights(v, f, b, u_bc_anim, 2)\n", + " u = igl.harmonic(v, f, b, u_bc_anim, 2)\n", " p.update_object(vertices=u)" ] }, @@ -1235,7 +1235,7 @@ "\n", "@interact(z_max=(0.0, 1.0), k=(1, 4))\n", "def update(z_max, k):\n", - " z = igl.harmonic_weights(v, f, b, bc, int(k))\n", + " z = igl.harmonic(v, f, b, bc, int(k))\n", " u[:, 2] = z_max * z\n", " p.update_object(vertices=u)" ] @@ -1457,7 +1457,7 @@ "bnd_uv = igl.map_vertices_to_circle(v, bnd)\n", "\n", "## Harmonic parametrization for the internal vertices\n", - "uv = igl.harmonic_weights(v, f, bnd, bnd_uv, 1)\n", + "uv = igl.harmonic(v, f, bnd, bnd_uv, 1)\n", "v_p = np.hstack([uv, np.zeros((uv.shape[0],1))])\n", "\n", "p = plot(v, f, uv=uv, shading={\"wireframe\": False, \"flat\": False}, return_plot=True)\n", @@ -1568,7 +1568,7 @@ "bnd_uv = igl.map_vertices_to_circle(v, bnd)\n", "\n", "## Harmonic parametrization for the internal vertices\n", - "uv = igl.harmonic_weights(v, f, bnd, bnd_uv, 1)\n", + "uv = igl.harmonic(v, f, bnd, bnd_uv, 1)\n", "\n", "arap = igl.ARAP(v, f, 2, np.zeros(0))\n", "uva = arap.solve(np.zeros((0, 0)), uv)\n",