capytaine.meshes.predefined.rectangles module

Generate rectangular bodies.

capytaine.meshes.predefined.rectangles.mesh_parallelepiped(size=(1.0, 1.0, 1.0), center=(0, 0, 0), resolution=(4, 4, 4), faces_max_radius=None, missing_sides={}, reflection_symmetry=False, translation_symmetry=False, name=None)[source]

Six rectangles forming a parallelepiped.

Parameters:
  • size (3-ple of floats, optional) – dimensions of the parallelepiped (width, thickness, height) for coordinates (x, y, z).

  • center (3-ple of floats, optional) – coordinates of the geometric center of the parallelepiped

  • resolution (3-ple of ints, optional) – number of faces along the three directions

  • faces_max_radius (float, optional) – maximal radius of a panel. (Default: no maximal radius.) If the provided resolution is too coarse, the number of panels is changed to fit the constraint on the maximal radius.

  • missing_sides (set of string, optional) – if one of the keyword “top”, “bottom”, “front”, “back”, “left”, “right” is in the set, then the corresponding side is not included in the parallelepiped. May be ignored when building a mesh with a symmetry.

  • reflection_symmetry (bool, optional) – use xOz and yOz symmetry plane to generate the mesh

  • translation_symmetry (bool, optional) – if True, use the translation symmetry in the x direction to speed up the computations. To use the translation symmetry in the y direction, create a x-symmetric body and then rotate it by pi/2.

  • name (string, optional) – a name for the body

capytaine.meshes.predefined.rectangles.mesh_rectangle(*, size=(5.0, 5.0), center=(0.0, 0.0, 0.0), resolution=(5, 5), faces_max_radius=None, normal=(0.0, 0.0, 1.0), translation_symmetry=False, reflection_symmetry=False, name=None)[source]

One-sided rectangle.

By default, the rectangle is horizontal, the normals are oriented upwards.

Parameters:
  • size (couple of floats, optional) – dimensions of the rectangle (width and height)

  • center (3-ple of floats, optional) – position of the geometric center of the rectangle, default: (0, 0, 0)

  • resolution (couple of ints, optional) – number of faces along each of the two directions

  • faces_max_radius (float, optional) – maximal radius of a panel. (Default: no maximal radius.) If the provided resolution is too coarse, the number of panels is changed to fit the constraint on the maximal radius.

  • normal (3-ple of floats, optional) – normal vector, default: (0, 0, 1)

  • translation_symmetry (bool, optional) – if True, use the translation symmetry to speed up the computations

  • reflection_symmetry (bool, optional) – if True, use the reflection symmetry to speed up the computations

  • name (string, optional) – a name for the body