cellular_raza_concepts

Trait Interaction

Source
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§

Source

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.

Source

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§

Source

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.

Source

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.

Implementors§

Source§

impl<Pos, Vel, For, Inf, A> Interaction<Pos, Vel, For, Inf> for CellAgentBox<A>
where A: Interaction<Pos, Vel, For, Inf> + Serialize + for<'a> Deserialize<'a>,