Skip to content

Commit 6db7f33

Browse files
committed
debugged vertex property computation using angular sector weighting + added test for compute_vertex_property_from_faces
1 parent be8aa9e commit 6db7f33

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/openalea/cellcomplex/property_topomesh/property_topomesh_analysis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,15 +1488,15 @@ def compute_topomesh_vertex_property_from_faces(topomesh,property_name,weighting
14881488
compute_topomesh_property(topomesh,'vertices',2)
14891489
compute_topomesh_property(topomesh,'angles',2)
14901490
compute_topomesh_property(topomesh,'barycenter',2)
1491-
compute_topomesh_property(topomesh,'barycenter',1)
14921491

14931492
vertex_face_face_vertices = topomesh.wisp_property('vertices',2).values(vertex_faces)
14941493
vertex_face_face_angles = topomesh.wisp_property('angles',2).values(vertex_faces)
14951494
vertex_face_barycenter = topomesh.wisp_property('barycenter',2).values(vertex_faces)
1496-
vertex_positions = topomesh.wisp_property('barycenter',1).values(vertex_faces)
1495+
#vertex_positions = topomesh.wisp_property('barycenter',0).values(vertex_face_vertices)
14971496

1498-
face_vertex_positions = np.array([vertex_positions[v] for v in vertex_face_face_vertices])
1499-
face_vertex_barycenter_radii = np.linalg.norm(np.array([[vertex_face_barycenter[f] - v for v in face_vertex_positions[f]] for f in vertex_faces]), axis=1)
1497+
face_vertex_positions = topomesh.wisp_property('barycenter',0).values(vertex_face_face_vertices)
1498+
# face_vertex_barycenter_radii = np.linalg.norm(np.array([[vertex_face_barycenter[f] - v for v in face_vertex_positions[f]] for f in vertex_faces]), axis=1)
1499+
face_vertex_barycenter_radii = np.linalg.norm(face_vertex_positions - vertex_face_barycenter[:,np.newaxis],axis=1)
15001500

15011501
vertex_face_weight = np.array(
15021502
[r[vertices == v] * angles[vertices == v] for v, vertices, r, angles

test/test_topomesh_geometrical_properties.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,14 @@ def test_curvature_property():
127127
assert np.all(
128128
np.isclose(topomesh.wisp_property('mean_curvature', 2).values(),
129129
1. / radius, 1e-1))
130+
131+
def test_normal_property():
132+
radius = 10.
133+
134+
topomesh = sphere_topomesh(radius)
135+
compute_topomesh_property(topomesh, 'normal', 2,
136+
normal_method='orientation')
137+
138+
for weighting in ['uniform','area','angle','cotangent','angular sector']:
139+
compute_topomesh_vertex_property_from_faces(topomesh, 'normal', weighting=weighting)
140+

0 commit comments

Comments
 (0)