Trait Interaction
pub trait Interaction<Pos, Vel, Force, Inf = ()> {
// Required methods
fn get_interaction_information(&self) -> Inf;
fn calculate_force_between(
&self,
own_pos: &Pos,
own_vel: &Vel,
ext_pos: &Pos,
ext_vel: &Vel,
ext_info: &Inf,
) -> Result<(Force, Force), CalcError>;
// Provided methods
fn is_neighbor(
&self,
own_pos: &Pos,
ext_pos: &Pos,
ext_inf: &Inf,
) -> Result<bool, CalcError> { ... }
fn react_to_neighbors(&mut self, neighbors: usize) -> Result<(), CalcError> { ... }
}
Expand description
Trait describing force-interactions between cellular agents.
Required Methods§
fn get_interaction_information(&self) -> Inf
fn get_interaction_information(&self) -> Inf
Get additional information of cellular properties (ie. for cell-specific interactions). For now, this can also be used to get the mass of the other cell-agent. In the future, we will probably provide a custom function for this.
fn calculate_force_between(
&self,
own_pos: &Pos,
own_vel: &Vel,
ext_pos: &Pos,
ext_vel: &Vel,
ext_info: &Inf,
) -> Result<(Force, Force), CalcError>
fn calculate_force_between( &self, own_pos: &Pos, own_vel: &Vel, ext_pos: &Pos, ext_vel: &Vel, ext_info: &Inf, ) -> Result<(Force, Force), CalcError>
Calculates the forces (velocity-derivative) on the corresponding external position given external velocity. By providing velocities, we can calculate terms that are related to friction. The function returns two forces, one acting on the current agent and the other on the external agent.
Provided Methods§
fn is_neighbor(
&self,
own_pos: &Pos,
ext_pos: &Pos,
ext_inf: &Inf,
) -> Result<bool, CalcError>
fn is_neighbor( &self, own_pos: &Pos, ext_pos: &Pos, ext_inf: &Inf, ) -> Result<bool, CalcError>
Checks if the other cell represented by position and information is a neighbor to the current one or not.
fn react_to_neighbors(&mut self, neighbors: usize) -> Result<(), CalcError>
fn react_to_neighbors(&mut self, neighbors: usize) -> Result<(), CalcError>
Reacts to the results gathered by the Interaction::is_neighbor method and changes the state of the cell.