Exemple #1
0
def test_lower_hull(filename = None):
  mesh,X = icosahedron_mesh()
  mlh,Xlh = lower_hull(mesh, X, [0.3, 0.3, 1.0], -4., 5./180.*pi, 30./180.*pi)

  if filename is not None:
    write_mesh(filename+'-input.obj', mesh, X);
    write_mesh(filename+'-output.obj', mlh, Xlh);
Exemple #2
0
def test_volume():
  mesh,X = icosahedron_mesh()
  a = 2 # see http://en.wikipedia.org/wiki/Icosahedron
  assert relative_error(mesh.surface_area(X),5*sqrt(3)*a**2) < 1e-5
  assert relative_error(mesh.volume(X),5/12*(3+sqrt(5))*a**3) < 1e-5
  mesh,X = sphere_mesh(4)
  assert relative_error(mesh.surface_area(X),4*pi) < .01
  assert relative_error(mesh.volume(X),4/3*pi) < .01
Exemple #3
0
def test_volume():
    mesh, X = icosahedron_mesh()
    a = 2  # see http://en.wikipedia.org/wiki/Icosahedron
    assert relative_error(mesh.surface_area(X), 5 * sqrt(3) * a**2) < 1e-5
    assert relative_error(mesh.volume(X), 5 / 12 * (3 + sqrt(5)) * a**3) < 1e-5
    mesh, X = sphere_mesh(4)
    assert relative_error(mesh.surface_area(X), 4 * pi) < .01
    assert relative_error(mesh.volume(X), 4 / 3 * pi) < .01