Mentions légales du service

Skip to content
Snippets Groups Projects

Merge obstacles into dev_whatever

Merged VAN TOLL Wouter requested to merge obstacles into dev_whatever
6 files
+ 49
23
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -19,22 +19,23 @@
** See the file AUTHORS.md for a list of all contributors.
*/
#ifndef LIB_AGENT_INTERACTION_FORCES_H
#define LIB_AGENT_INTERACTION_FORCES_H
#ifndef LIB_OBJECT_INTERACTION_FORCES_H
#define LIB_OBJECT_INTERACTION_FORCES_H
#include <CostFunctions/ForceBasedFunction.h>
/// <summary>An abstract class for a force-based function that computes a force per neighboring agent and sums them up.</summary>
/// <summary>An abstract class for a force-based function that computes a force per neighboring agent/obstacle and sums them up.</summary>
/// <remarks>The specific force per neighbor needs to be filled in by a child class, in the method ComputeAgentInteractionForce().</remarks>
class AgentInteractionForces : public ForceBasedFunction
class ObjectInteractionForces : public ForceBasedFunction
{
protected:
AgentInteractionForces() : ForceBasedFunction() {}
virtual ~AgentInteractionForces() {}
ObjectInteractionForces() : ForceBasedFunction() {}
virtual ~ObjectInteractionForces() {}
protected:
/// <summary>Computes and returns a 2D force vector that the agent experiences.</summary>
/// <remarks>In the case of AgentInteractionForces, this method calls ComputeAgentInteractionForce() for each neighbor of the querying agent,
/// <remarks>In the case of ObjectInteractionForces,
/// this method calls ComputeAgentInteractionForce() and ComputeObstacleInteractionForce() for each neighbor of the querying agent,
/// and returns the sum of all these interaction forces.</remarks>
/// <param name="agent">The agent for which a force is requested.</param>
/// <param name="world">The world in which the simulation takes place.</param>
@@ -42,11 +43,18 @@ protected:
virtual Vector2D ComputeForce(Agent* agent, const WorldBase* world) const override;
/// <summary>Computes a 2D force vector that a given agent experiences due to a neighboring agent.</summary>
/// <remarks>Subclasses of AgentInteractionForces must implement this function.</remarks>
/// <remarks>Subclasses of ObjectInteractionForces must implement this function.</remarks>
/// <param name="agent">The agent for which a force is requested.</param>
/// <param name="other">The neighboring agent.</param>
/// <returns>A 2D vector describing the force that 'other' applies to 'agent', according to a particular force model.</returns>
virtual Vector2D ComputeAgentInteractionForce(const Agent* agent, const PhantomAgent& other) const = 0;
/// <summary>Computes a 2D force vector that a given agent experiences due to a neighboring obstacle segment.</summary>
/// <remarks>Subclasses of ObjectInteractionForces must implement this function.</remarks>
/// <param name="agent">The agent for which a force is requested.</param>
/// <param name="obstacle">The neighboring obstacle segment.</param>
/// <returns>A 2D vector describing the force that 'obstacle' applies to 'agent', according to a particular force model.</returns>
virtual Vector2D ComputeObstacleInteractionForce(const Agent* agent, const LineSegment2D& obstacle) const = 0;
};
#endif //LIB_AGENT_INTERACTION_FORCE_H
#endif //LIB_OBJECT_INTERACTION_FORCES_H
Loading