Utopia  2
Framework for studying models of complex & adaptive systems.
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Utopia::Models::SimpleFlocking::AgentState Class Reference

An agent's state. More...

#include <state.hh>

Public Member Functions

 AgentState ()
 Default constructor with zero-initialized members. More...
 
template<typename RNGType >
 AgentState (const Config &cfg, const std::shared_ptr< RNGType > &rng)
 Constructor with config node and RNG. More...
 
auto get_speed () const
 Returns the current speed of this agent. More...
 
auto get_orientation () const
 Returns the current orientation in radians, [-π, +π) More...
 
const auto & get_displacement () const
 The current value of the displacement vector. More...
 
auto set_speed (double new_speed)
 Sets the speed and subsequently updates the displacement vector. More...
 
auto set_orientation (double new_orientation)
 Sets the orientation and subsequently updates the displacement vector. More...
 

Protected Member Functions

void update_displacement ()
 Updates the displacement vector using current speed and orientation. More...
 

Private Attributes

double speed
 Agent speed. More...
 
double orientation
 Orientation in radians, [-π, +π) More...
 
SpaceVecType< 2 > displacement
 The current displacement vector, updated upon any changes. More...
 

Detailed Description

An agent's state.

Constructor & Destructor Documentation

◆ AgentState() [1/2]

Utopia::Models::SimpleFlocking::AgentState::AgentState ( )
inline

Default constructor with zero-initialized members.

◆ AgentState() [2/2]

template<typename RNGType >
Utopia::Models::SimpleFlocking::AgentState::AgentState ( const Config cfg,
const std::shared_ptr< RNGType > &  rng 
)
inline

Constructor with config node and RNG.

Member Function Documentation

◆ get_displacement()

const auto& Utopia::Models::SimpleFlocking::AgentState::get_displacement ( ) const
inline

The current value of the displacement vector.

◆ get_orientation()

auto Utopia::Models::SimpleFlocking::AgentState::get_orientation ( ) const
inline

Returns the current orientation in radians, [-π, +π)

An orientation value of zero points in positive x direction while a value of ±π/2 points in ±y direction.

◆ get_speed()

auto Utopia::Models::SimpleFlocking::AgentState::get_speed ( ) const
inline

Returns the current speed of this agent.

◆ set_orientation()

auto Utopia::Models::SimpleFlocking::AgentState::set_orientation ( double  new_orientation)
inline

Sets the orientation and subsequently updates the displacement vector.

This also makes sure the new orientation is within a valid range

◆ set_speed()

auto Utopia::Models::SimpleFlocking::AgentState::set_speed ( double  new_speed)
inline

Sets the speed and subsequently updates the displacement vector.

◆ update_displacement()

void Utopia::Models::SimpleFlocking::AgentState::update_displacement ( )
inlineprotected

Updates the displacement vector using current speed and orientation.

Member Data Documentation

◆ displacement

SpaceVecType<2> Utopia::Models::SimpleFlocking::AgentState::displacement
private

The current displacement vector, updated upon any changes.

◆ orientation

double Utopia::Models::SimpleFlocking::AgentState::orientation
private

Orientation in radians, [-π, +π)

Orientation zero points in positive x direction while ±π/2 points in ±y direction.

◆ speed

double Utopia::Models::SimpleFlocking::AgentState::speed
private

Agent speed.


The documentation for this class was generated from the following file: