Skip to content

Commit 83b13ac

Browse files
author
Teseo Schneider
committed
added per_corner_normals
1 parent 3976db3 commit 83b13ac

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

src/per_corner_normals.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include <common.h>
2+
#include <npe.h>
3+
#include <typedefs.h>
4+
#include <igl/per_corner_normals.h>
5+
6+
const char *ds_per_corner_normals = R"igl_Qu8mg5v7(
7+
8+
Compute vertex normals via vertex position list, face list
9+
10+
Parameters
11+
----------
12+
V #V by 3 eigen Matrix of mesh vertex 3D positions
13+
F #F by 3 eigen Matrix of face (triangle) indices
14+
corner_threshold threshold in degrees on sharp angles
15+
16+
Returns
17+
-------
18+
CN #F*3 by 3 eigen Matrix of mesh vertex 3D normals, where the normal for corner F(i,j) is at CN(i*3+j,:)
19+
20+
See also
21+
--------
22+
23+
24+
Notes
25+
-----
26+
None
27+
28+
Examples
29+
--------
30+
31+
)igl_Qu8mg5v7";
32+
33+
npe_function(per_corner_normals)
34+
npe_doc(ds_per_corner_normals)
35+
36+
npe_arg(v, dense_float, dense_double)
37+
npe_arg(f, dense_int, dense_long, dense_longlong)
38+
npe_arg(corner_threshold, double)
39+
40+
41+
npe_begin_code()
42+
assert_valid_3d_tri_mesh(v, f);
43+
EigenDenseLike<npe_Matrix_v> n;
44+
igl::per_corner_normals(v, f, corner_threshold, n);
45+
return npe::move(n);
46+
47+
npe_end_code()
48+

tests/test_basic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,12 @@ def test_per_vertex_normals(self):
711711
self.assertEqual(n.dtype, self.v1.dtype)
712712
self.assertTrue(n.flags.c_contiguous)
713713

714+
def test_per_corner_normals(self):
715+
n = igl.per_corner_normals(self.v1, self.f1, 80)
716+
self.assertEqual(n.shape, (self.f1.shape[0]*3, 3))
717+
self.assertEqual(n.dtype, self.v1.dtype)
718+
self.assertTrue(n.flags.c_contiguous)
719+
714720
def test_per_vertex_attribute_smoothing(self):
715721
aout = igl.per_vertex_attribute_smoothing(self.v1, self.f1)
716722
self.assertEqual(aout.shape, self.v1.shape)

0 commit comments

Comments
 (0)