# openmc.Halfspace¶

class openmc.Halfspace(surface, side)[source]

A positive or negative half-space region.

A half-space is either of the two parts into which a two-dimension surface divides the three-dimensional Euclidean space. If the equation of the surface is $$f(x,y,z) = 0$$, the region for which $$f(x,y,z) < 0$$ is referred to as the negative half-space and the region for which $$f(x,y,z) > 0$$ is referred to as the positive half-space.

Instances of Halfspace are generally not instantiated directly. Rather, they can be created from an existing Surface through the __neg__ and __pos__ operators, as the following example demonstrates:

>>> sphere = openmc.Sphere(surface_id=1, r=10.0)
>>> inside_sphere = -sphere
>>> outside_sphere = +sphere
>>> type(inside_sphere)
<class 'openmc.surface.Halfspace'>

Parameters: surface (openmc.Surface) – Surface which divides Euclidean space. side ({'+', '-'}) – Indicates whether the positive or negative half-space is used. surface (openmc.Surface) – Surface which divides Euclidean space. side ({'+', '-'}) – Indicates whether the positive or negative half-space is used. bounding_box (tuple of numpy.ndarray) – Lower-left and upper-right coordinates of an axis-aligned bounding box
clone(memo=None)[source]

Create a copy of this halfspace, with a cloned surface with a unique ID.

Parameters: memo (dict or None) – A nested dictionary of previously cloned objects. This parameter is used internally and should not be specified by the user. clone – The clone of this halfspace openmc.Halfspace
get_surfaces(surfaces=None)[source]

Returns the surface that this is a halfspace of.

Parameters: surfaces (collections.OrderedDict, optional) – Dictionary mapping surface IDs to openmc.Surface instances surfaces – Dictionary mapping surface IDs to openmc.Surface instances collections.OrderedDict
remove_redundant_surfaces(redundant_surfaces)[source]

Recursively remove all redundant surfaces referenced by this region

Parameters: redundant_surfaces (dict) – Dictionary mapping redundant surface IDs to surface IDs for the openmc.Surface instances that should replace them.
rotate(rotation, pivot=(0.0, 0.0, 0.0), order='xyz', inplace=False, memo=None)[source]

Rotate surface by angles provided or by applying matrix directly.

New in version 0.12.

Parameters: rotation (3-tuple of float, or 3x3 iterable) – A 3-tuple of angles $$(\phi, \theta, \psi)$$ in degrees where the first element is the rotation about the x-axis in the fixed laboratory frame, the second element is the rotation about the y-axis in the fixed laboratory frame, and the third element is the rotation about the z-axis in the fixed laboratory frame. The rotations are active rotations. Additionally a 3x3 rotation matrix can be specified directly either as a nested iterable or array. pivot (iterable of float, optional) – (x, y, z) coordinates for the point to rotate about. Defaults to (0., 0., 0.) order (str, optional) – A string of ‘x’, ‘y’, and ‘z’ in some order specifying which rotation to perform first, second, and third. Defaults to ‘xyz’ which means, the rotation by angle $$\phi$$ about x will be applied first, followed by $$\theta$$ about y and then $$\psi$$ about z. This corresponds to an x-y-z extrinsic rotation as well as a z-y’-x’’ intrinsic rotation using Tait-Bryan angles $$(\phi, \theta, \psi)$$. inplace (boolean) – Whether or not to return a new instance of Surface or to modify the coefficients of this Surface in place. Defaults to False. memo (dict or None) – Dictionary used for memoization Translated half-space openmc.Halfspace
translate(vector, memo=None)[source]

Translate half-space in given direction

Parameters: vector (iterable of float) – Direction in which region should be translated memo (dict or None) – Dictionary used for memoization Translated half-space openmc.Halfspace