pub trait Interaction<Pos, Vel, Force, Inf = ()>: InteractionInformation<Inf> {
// Required method
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§
Sourcefn 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§
Sourcefn 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.
Sourcefn 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.