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.
- 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.
- 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]])
- class goo.division.DivisionLogic[source]¶
Bases:
object
Base class for defining division logic for cells.
- 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:
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]])
- 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.