goo.division

class goo.division.BisectDivisionLogic(margin=0.025)[source]

Bases: DivisionLogic

Division logic that uses low-level bmesh operations, i.e. bmesh.ops.bisect_plane to divide a cell along its major axis.

Variables:

margin (float) – Distance of margin between divided cells.

flush()[source]

Finish performing all stored divisions.

make_divide(mother)[source]

Divide a mother cell into two daughter cells.

Parameters:

mother – The mother cell to divide.

Returns:

A tuple containing the two daughter cells that will result from the division.

Note

The meshes of the daughter should not be updated at this stage. flush() must be called to update all cells at once so that they do not interfere with each other.

class goo.division.BooleanDivisionLogic[source]

Bases: DivisionLogic

Division logic that creates a plane of division and applies the Boolean modifier to create a division.

flush()[source]

Finish performing all stored divisions.

make_divide(mother: Cell)[source]

Divide a mother cell into two daughter cells.

Parameters:

mother (Cell) – The mother cell to divide.

Returns:

A tuple containing the two daughter cells that will result from the division.

Note

The meshes of the daughter should not be updated at this stage. flush() must be called to update all cells at once so that they do not interfere with each other.

class goo.division.DivisionHandler(division_logic, mu, sigma)[source]

Bases: Handler

Handler for managing cell division processes.

This handler is responsible for managing the division of cells based on the provided division logic. It determines which cells are eligible for division and performs the division process.

Variables:

division_logic (DivisionLogic) – The division logic used to execute cell division.

can_divide(cell: Cell) bool[source]

Check if a cell is eligible for division.

This method must be implemented by all subclasses.

Parameters:

cell (Cell) – The cell to check.

Returns:

True if the cell can divide, False otherwise.

Return type:

bool

run(scene, depsgraph)[source]

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

setup(get_cells: Callable[[], list[Cell]], get_diffsystems: Callable[[], list[DiffusionSystem]], dt: float)[source]

Set up the handler.

Parameters:
  • get_cells (Callable[[], list[Cell]]) – A function that, when called, retrieves the list of cells that may divide.

  • dt (float) – The time step for the simulation.

  • get_diffsystems (Callable[[], list[DiffusionSystem]])

update_on_divide(cell: Cell)[source]

Perform updates after a cell has divided.

This method can be overridden by subclasses to perform additional updates (e.g. set a property) after a cell has divided.

Parameters:

cell (Cell) – The cell that has divided.

class goo.division.DivisionLogic[source]

Bases: object

Base class for defining division logic for cells.

flush()[source]

Finish performing all stored divisions.

make_divide(mother: Cell) tuple[Cell, Cell][source]

Divide a mother cell into two daughter cells.

Parameters:

mother (Cell) – The mother cell to divide.

Returns:

A tuple containing the two daughter cells that will result from the division.

Return type:

tuple[Cell, Cell]

Note

The meshes of the daughter should not be updated at this stage. flush() must be called to update all cells at once so that they do not interfere with each other.

class goo.division.SizeDivisionHandler(division_logic, mu=30, sigma=0)[source]

Bases: DivisionHandler

Division handler that determines eligibility based on size of cell.

Variables:
  • division_logic (DivisionLogic) – see base class.

  • threshold (float) – minimum size of cell able to divide.

can_divide(cell: Cell)[source]

Check if a cell is eligible for division.

This method must be implemented by all subclasses.

Parameters:

cell (Cell) – The cell to check.

Returns:

True if the cell can divide, False otherwise.

run(scene, depsgraph)

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

setup(get_cells: Callable[[], list[Cell]], get_diffsystems: Callable[[], list[DiffusionSystem]], dt: float)

Set up the handler.

Parameters:
  • get_cells (Callable[[], list[Cell]]) – A function that, when called, retrieves the list of cells that may divide.

  • dt (float) – The time step for the simulation.

  • get_diffsystems (Callable[[], list[DiffusionSystem]])

update_on_divide(cell: Cell)

Perform updates after a cell has divided.

This method can be overridden by subclasses to perform additional updates (e.g. set a property) after a cell has divided.

Parameters:

cell (Cell) – The cell that has divided.

class goo.division.TimeDivisionHandler(division_logic, mu=20, sigma=0)[source]

Bases: DivisionHandler

Division handler that determines eligibility based on time from last divsion.

Variables:
  • division_logic (DivisionLogic) – see base class.

  • mu (float) – Time interval between cell divisions.

  • var (float) – Variance in the time interval.

can_divide(cell: Cell)[source]

Check if a cell is eligible for division.

This method must be implemented by all subclasses.

Parameters:

cell (Cell) – The cell to check.

Returns:

True if the cell can divide, False otherwise.

run(scene, depsgraph)

Run the handler.

This is the function that gets passed to Blender, to be called upon specified events (e.g. post-frame change).

Parameters:
  • scene – The Blender scene.

  • depsgraph – The dependency graph.

setup(get_cells, dt)[source]

Set up the handler.

Parameters:
  • get_cells – A function that, when called, retrieves the list of cells that may divide.

  • dt – The time step for the simulation.

update_on_divide(cell: Cell)[source]

Perform updates after a cell has divided.

This method can be overridden by subclasses to perform additional updates (e.g. set a property) after a cell has divided.

Parameters:

cell (Cell) – The cell that has divided.