Skip to content

Commit c2dff66

Browse files
committed
Update unit test to avoid using principal curvatures.
1 parent a72ca93 commit c2dff66

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

tests/test_all.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -652,46 +652,46 @@ def test_compute_frame_field_bisectors(icosahedron):
652652
def test_comb_cross_field(icosahedron):
653653
V,F = icosahedron
654654

655-
# Get principal curvature directions (cross field)
656-
PD1,PD2,_,_,_ = igl.principal_curvature(V,F)
655+
# Get local basis
656+
B1,B2,_ = igl.local_basis(V,F)
657657

658658
# Comb the cross field
659-
PD1_combed,PD2_combed = igl.comb_cross_field(V,F,PD1,PD2)
659+
B1_combed,B2_combed = igl.comb_cross_field(V,F,B1,B2)
660660

661661
# Check output shapes
662-
assert PD1_combed.shape == (F.shape[0], 3)
663-
assert PD2_combed.shape == (F.shape[0], 3)
662+
assert B1_combed.shape == (F.shape[0], 3)
663+
assert B2_combed.shape == (F.shape[0], 3)
664664

665665
def test_cross_field_mismatch(icosahedron):
666666
V,F = icosahedron
667667

668-
# Get principal curvature directions (cross field)
669-
PD1,PD2,_,_,_ = igl.principal_curvature(V,F)
668+
# Get local basis
669+
B1,B2,_ = igl.local_basis(V,F)
670670

671671
# Comb the cross field first
672-
PD1_combed,PD2_combed = igl.comb_cross_field(V,F,PD1,PD2)
672+
B1_combed,B2_combed = igl.comb_cross_field(V,F,B1,B2)
673673

674674
# Compute mismatch on combed field
675-
mismatch = igl.cross_field_mismatch(V,F,PD1_combed,PD2_combed,True)
675+
mismatch = igl.cross_field_mismatch(V,F,B1_combed,B2_combed,True)
676676

677677
# Check output shape (should be #F by 3 for triangular mesh)
678678
assert mismatch.shape == (F.shape[0], 3)
679679

680680
# Test with uncombed field (function will comb it first)
681-
mismatch_uncombed = igl.cross_field_mismatch(V,F,PD1,PD2,False)
681+
mismatch_uncombed = igl.cross_field_mismatch(V,F,B1,B2,False)
682682
assert mismatch_uncombed.shape == (F.shape[0], 3)
683683

684684
def test_find_cross_field_singularities(icosahedron):
685685
V,F = icosahedron
686686

687-
# Get principal curvature directions (cross field)
688-
PD1,PD2,_,_,_ = igl.principal_curvature(V,F)
687+
# Get local basis
688+
B1,B2,_ = igl.local_basis(V,F)
689689

690-
# Comb the cross field
691-
PD1_combed,PD2_combed = igl.comb_cross_field(V,F,PD1,PD2)
690+
# Comb the cross field first
691+
B1_combed,B2_combed = igl.comb_cross_field(V,F,B1,B2)
692692

693693
# Compute mismatch
694-
mismatch = igl.cross_field_mismatch(V,F,PD1_combed,PD2_combed,True)
694+
mismatch = igl.cross_field_mismatch(V,F,B1_combed,B2_combed,True)
695695

696696
# Find singularities from mismatch
697697
isSingularity,singularityIndex = igl.find_cross_field_singularities(V,F,mismatch)
@@ -704,7 +704,7 @@ def test_find_cross_field_singularities(icosahedron):
704704
assert singularityIndex.shape[0] == V.shape[0]
705705

706706
# Test overload that computes mismatch internally
707-
isSingularity2,singularityIndex2 = igl.find_cross_field_singularities(V,F,PD1_combed,PD2_combed,True)
707+
isSingularity2,singularityIndex2 = igl.find_cross_field_singularities(V,F,B1_combed,B2_combed,True)
708708

709709
# Check Poincaré-Hopf theorem
710710
assert np.sum(singularityIndex2) == 2 * 4 # Euler characteristic * 4-rosy fields
@@ -714,7 +714,7 @@ def test_find_cross_field_singularities(icosahedron):
714714
assert singularityIndex2.shape[0] == V.shape[0]
715715

716716
# Test with uncombed field
717-
isSingularity3,singularityIndex3 = igl.find_cross_field_singularities(V,F,PD1,PD2,False)
717+
isSingularity3,singularityIndex3 = igl.find_cross_field_singularities(V,F,B1,B2,False)
718718
assert isSingularity3.shape[0] == V.shape[0]
719719
assert singularityIndex3.shape[0] == V.shape[0]
720720

@@ -724,17 +724,17 @@ def test_find_cross_field_singularities(icosahedron):
724724
def test_comb_frame_field(icosahedron):
725725
V,F = icosahedron
726726

727-
# Get principal curvature directions (frame field)
728-
PD1,PD2,_,_,_ = igl.principal_curvature(V,F)
727+
# Get local basis
728+
B1,B2,_ = igl.local_basis(V,F)
729729

730730
# Compute bisectors
731-
BIS1,BIS2 = igl.compute_frame_field_bisectors(V,F,PD1,PD2)
731+
BIS1,BIS2 = igl.compute_frame_field_bisectors(V,F,B1,B2)
732732

733733
# Comb the bisectors (which are a cross field)
734734
BIS1_combed,BIS2_combed = igl.comb_cross_field(V,F,BIS1,BIS2)
735735

736736
# Comb the frame field using combed bisectors
737-
PD1_combed,PD2_combed = igl.comb_frame_field(V,F,PD1,PD2,BIS1_combed,BIS2_combed)
737+
PD1_combed,PD2_combed = igl.comb_frame_field(V,F,B1,B2,BIS1_combed,BIS2_combed)
738738

739739
# Check output shapes
740740
assert PD1_combed.shape == (F.shape[0], 3)

0 commit comments

Comments
 (0)