@requires_tvtk
@requires_mayavi
def test_decimate_surface():
 points = np.array([[(-0.00686118), (-0.1036986), 0.0261517], [(-0.00713948), (-0.10370162), 0.02614874], [(-0.00686208), (-0.10368247), 0.02588313], [(-0.00713987), (-0.10368724), 0.02587745]])
 tris = np.array([[0, 1, 2], [1, 2, 3], [0, 3, 1], [1, 2, 0]])
 for n_tri in [4, 3, 2]:
  (_, this_tris) = decimate_surface(points, tris, n_tri)
  assert_true(((len(this_tris) == n_tri) if (not (n_tri % 2)) else 2))
 nirvana = 5
 tris = np.array([[0, 1, 2], [1, 2, 3], [0, 3, 1], [1, 2, nirvana]])
 assert_raises(ValueError, decimate_surface, points, tris, n_tri)

@ requires_tvtk @ requires_mayavi def test_decimate_surface ( ) : points = np . array ( [ [ ( - 0.00686118 ) , ( - 0.1036986 ) , 0.0261517 ] , [ ( - 0.00713948 ) , ( - 0.10370162 ) , 0.02614874 ] , [ ( - 0.00686208 ) , ( - 0.10368247 ) , 0.02588313 ] , [ ( - 0.00713987 ) , ( - 0.10368724 ) , 0.02587745 ] ] ) tris = np . array ( [ [ 0 , 1 , 2 ] , [ 1 , 2 , 3 ] , [ 0 , 3 , 1 ] , [ 1 , 2 , 0 ] ] ) for n_tri in [ 4 , 3 , 2 ] : ( _ , this_tris ) = decimate_surface ( points , tris , n_tri ) assert_true ( ( ( len ( this_tris ) == n_tri ) if ( not ( n_tri % 2 ) ) else 2 ) ) nirvana = 5 tris = np . array ( [ [ 0 , 1 , 2 ] , [ 1 , 2 , 3 ] , [ 0 , 3 , 1 ] , [ 1 , 2 , nirvana ] ] ) assert_raises ( ValueError , decimate_surface , points , tris , n_tri )
test triangular surface decimation .