print('averageSize', sphere.averageSize()) assert 0.9 < sphere.averageSize() < 1.0 print('diagonalSize', sphere.diagonalSize()) assert 3.3 < sphere.diagonalSize() < 3.5 print('maxBoundSize', sphere.maxBoundSize()) assert 1.9 < sphere.maxBoundSize() < 2.1 print('centerOfMass', sphere.centerOfMass()) assert np.allclose(sphere.centerOfMass(), [0, 0, 0]) print('volume', sphere.volume()) assert 4.1 < sphere.volume() < 4.2 print('area', sphere.area()) assert 12.5 < sphere.area() < 12.6 ###################################### closestPoint pt = [12, 34, 52] print('closestPoint', sphere.closestPoint(pt), [0.19883616, 0.48003298, 0.85441941]) assert np.allclose(sphere.closestPoint(pt), [0.19883616, 0.48003298, 0.85441941]) ###################################### findCellsWithin ics = sphere.findCellsWithin(xbounds=(-0.5, 0.5)) print('findCellsWithin', len(ics), 1404) assert len(ics) == 1404 ######################################transformMesh T = cone.clone().pos(35, 67, 87).getTransform() s3 = sphere.clone().applyTransform(T) print('transformMesh', s3.centerOfMass(), (35, 67, 87)) assert np.allclose(s3.centerOfMass(), (35, 67, 87))
assert 0.9 < sphere.averageSize() < 1.0 print('diagonalSize',sphere.diagonalSize()) assert 3.3 < sphere.diagonalSize() < 3.5 print('maxBoundSize',sphere.maxBoundSize()) assert 1.9 < sphere.maxBoundSize() < 2.1 print('centerOfMass',sphere.centerOfMass()) assert np.allclose(sphere.centerOfMass(), [0,0,0]) print('volume',sphere.volume()) assert 4.1 < sphere.volume() < 4.2 print('area',sphere.area()) assert 12.5 < sphere.area() < 12.6 ###################################### closestPoint pt = [12,34,52] print('closestPoint',sphere.closestPoint(pt), [0.19883616, 0.48003298, 0.85441941]) assert np.allclose(sphere.closestPoint(pt), [0.19883616, 0.48003298, 0.85441941]) ###################################### findCellsWithin ics = sphere.findCellsWithin(xbounds=(-0.5, 0.5)) print('findCellsWithin',len(ics) , 1404) assert len(ics) == 1404 ######################################transformMesh T = cone.clone().pos(35,67,87).getTransform() s3 = sphere.clone().setTransform(T) print('transformMesh',s3.centerOfMass(), (35,67,87)) assert np.allclose(s3.centerOfMass(), (35,67,87))
assert np.allclose(ss.ybounds(), [-2, 2], atol=0.01) assert np.allclose(ss.zbounds(), [-3, 3], atol=0.01) ###################################### averageSize print('Test sizes et al') assert 0.9 < sphere.averageSize() < 1.0 assert 3.3 < sphere.diagonalSize() < 3.5 assert 1.9 < sphere.maxBoundSize() < 2.1 assert np.allclose(sphere.centerOfMass(), [0, 0, 0]) assert 4.1 < sphere.volume() < 4.2 assert 12.5 < sphere.area() < 12.6 ###################################### closestPoint print('Test closestPoint') pt = [12, 34, 52] assert np.allclose(sphere.closestPoint(pt), [0.19883616, 0.48003298, 0.85441941]) ###################################### findCellsWithin print('Test findCellsWithin') ics = sphere.findCellsWithin(xbounds=(-0.5, 0.5)) assert len(ics) == 1404 ######################################transformMesh print('Test transformMesh') T = cone.clone().pos(35, 67, 87).getTransform() s3 = sphere.clone().setTransform(T) assert np.allclose(s3.centerOfMass(), (35, 67, 87)) ######################################normalize print('Test normalize')