fractaldna.structure_models.random_placements.PrismList

class fractaldna.structure_models.random_placements.PrismList(center, extent, resolution)

Bases: object

A List of Non-Overlapping Rectangular Prisms

This class facilitates generation of a set of prisms so that when a new prism is added, it:

  1. does not overlap other prisms and

  2. only checks for overlaps against nearby prisms

A ‘prism grid’ is constructed which divides the space within ‘+/- extent’ of the grid centre into cells with side length specified by ‘resolution’. This helper grid is used so that the routine only needs to see if the prism being placed overlaps local prisms.

Parameters:
  • center (List) – XYZ-position where the prism should be centered

  • extent (List) – XYZ-half lengths for the maximum bounding cube of all prisms to be placed.

  • resolution (float) – The size of a ‘cell’ in the prism grid.

__init__(center, extent, resolution)

Methods

__init__(center, extent, resolution)

append(prism)

Append a new prism to the Prism list

get_prism_grid_indices(prism)

Get the prism grid indices

to_frame([suppress_hash])

Generate a Data Frame describing the prisms

append(prism)

Append a new prism to the Prism list

Parameters:

prism (Prism) – prism to be appended.

Return type:

bool

Returns:

True if a prism is placed, else False

get_prism_grid_indices(prism)

Get the prism grid indices

Return type:

Set[int]

to_frame(suppress_hash=False)

Generate a Data Frame describing the prisms

Parameters:

suppress_hash (bool) – Hide the hash in front of the ‘IDX’ column which is kept for compatibiilty with the Geant4 DNA simulation format

Return type:

DataFrame

Returns:

Voxelised fractal as a data frame