robustfpm.util.points module

robustfpm.util.points.unique_points_union(points1, points2)

Returns the union of two point sets.

Parameters
  • points1 (array-like) – A set of unique lattice points.

  • points2 (array-like) – A set of unique lattice points.

Returns

Union of points1 and points2.

Return type

numpy.ndarray

robustfpm.util.points.minksum_points(points1, points2, recur_max_level=None)

Returns the Minkowski sum of two point sets.

Parameters
  • points1 (array-like) – A set of lattice points.

  • points2 (array-like) – A set of lattice points.

  • recur_max_level (int) – Max recursion level for the numeric algorithm. When None, half of the maximum allowed recursion level is used.

Returns

Minkowski sum of points1 and points2.

Return type

numpy.ndarray

robustfpm.util.points.minkprod_points(lattice, points, set_handler, pos=False, recur_max_level=None)

Calculates the set of element-wise products of two sets.

For the provided set handler and the set of points on the lattice calculates the approximation of the set of element-wise (Hadamard) products \(\{x\cdot y\}\), where \(x\) is from the set, \(y\) is from the set handler projection on the lattice. Optionally filters out points of the product which have non-positive coordinates.

Parameters
  • lattice (class:lattice) – Point lattice.

  • points (array-like) – Sequence of points on the lattice.

  • set_handler (class:ISetHandler) – Set handler, representing a non-negative set.

  • pos (bool) – If True, the points of the product with the non-positive coordinates will be filtered out from the result.

  • recur_max_level (int) – Max recursion level for the numeric algorithm. When None, half of the maximum allowed recursion level is used.

Returns

Set of element-wise products of the provided sets.

Return type

numpy.ndarray

robustfpm.util.points.isin_points(points1, points2)

numpy.in1d for sets of unique points

Parameters
  • points1 (array-like) – A set of unique lattice points.

  • points2 (array-like) – A set of unique lattice points.

Returns

See numpy.in1d

Return type

numpy.ndarray

robustfpm.util.points.setdiff_points(pointsA, pointsB)

Set difference for sets of unique points

Parameters
  • pointsA (array-like) – A set of unique lattice points.

  • pointsB (array-like) – A set of unique lattice points.

Returns

Points from pointsA which are not in pointsB.

Return type

array-like

robustfpm.util.points.square_neighbourhood_on_lattice(lattice_point, radius, include_center=False)

Returns a lattice set, representing the Moore (square) neighbourhood of the specified point.

Square neighbourhood (denoted by X) of a point (denoted by *):

O|O|O|O|O
---------
O|X|X|X|O
---------
O|X|*|X|O
---------
O|X|X|X|O
---------
O|O|O|O|O
Parameters
  • lattice_point (array-like) – A lattice point.

  • radius (int >= 0) – Radius of the neighbourhood.

  • include_center (bool) – If True, lattice_point is included in the returned set. Default is False.

Returns

Set of lattice points, representing a square neighbourhood with the specified radius.

Return type

array-like

robustfpm.util.points.diamond_neighbourhood_on_lattice(lattice_point, radius, include_center=False)

Returns a lattice set, representing the von Neumann (diamond) neighbourhood of the specified point.

Diamond neighbourhood (denoted by X) of a point (denoted by *):

O|O|O|O|O
---------
O|O|X|O|O
---------
O|X|*|X|O
---------
O|O|X|O|O
---------
O|O|O|O|O
Parameters
  • lattice_point (array-like) – A lattice point.

  • radius (int >= 0) – Radius of the neighbourhood.

  • include_center (bool) – If True, lattice_point is included in the returned set. Default is False.

Returns

Set of lattice points, representing a von Neumann neighbourhood with the specified radius.

Return type

array-like