Interface ICollisionEnvironment<TCharacter, TObstacle>
The collision environment manages characters and obstacles for exploration and movement. Collision situations
are checked by the environment and resolved by calling responsible collision handles.
Assembly: Mars.Components.dll
Syntax
public interface ICollisionEnvironment<TCharacter, TObstacle> : IEnvironment, IModelObject where TCharacter : ICharacter where TObstacle : IObstacle
Type Parameters
| Name |
Description |
| TCharacter |
Are movable, point entities. |
| TObstacle |
Can have arbitrary geometries and precise collision handles. |
Properties
|
Improve this Doc
View Source
BoundingBox
Defines the spatial extent of the environment.
Declaration
BoundingBox BoundingBox { get; set; }
Property Value
|
Improve this Doc
View Source
Characters
All characters that are inserted in the environment.
Declaration
IEnumerable<TCharacter> Characters { get; }
Property Value
| Type |
Description |
| System.Collections.Generic.IEnumerable<TCharacter> |
|
|
Improve this Doc
View Source
DefaultCollision
Gets or sets the default colliding behaviour,
when no custom collision handle is provided.
Declaration
CollisionKind DefaultCollision { get; set; }
Property Value
|
Improve this Doc
View Source
DefaultVisibility
Gets or sets the default visibility behaviour,
when no custom visibility handle is provided.
Declaration
VisibilityKind DefaultVisibility { get; set; }
Property Value
|
Improve this Doc
View Source
RoutingPointsGenerator
A routing points generator for route searching purposes.
Declaration
IRoutingPointsGenerator RoutingPointsGenerator { get; set; }
Property Value
Methods
|
Improve this Doc
View Source
ExploreCharacters(TCharacter, Geometry, Func<TCharacter, Boolean>)
Explores all characters within a given geometry that match given predicate.
Declaration
IEnumerable<TCharacter> ExploreCharacters(TCharacter source, Geometry geometry, Func<TCharacter, bool> predicate = null)
Parameters
| Type |
Name |
Description |
| TCharacter |
source |
The requesting character will not be part of the result set. |
| NetTopologySuite.Geometries.Geometry |
geometry |
Defines the spatial area of the exploration. |
| System.Func<TCharacter, System.Boolean> |
predicate |
Optionally reduces the result by defined criteria. |
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<TCharacter> |
All other characters that comply with given parameters. |
|
Improve this Doc
View Source
ExploreObstacles(Geometry, Func<TObstacle, Boolean>)
Explores all obstacles within a given geometry that match given predicate.
Declaration
IEnumerable<TObstacle> ExploreObstacles(Geometry geometry, Func<TObstacle, bool> predicate = null)
Parameters
| Type |
Name |
Description |
| NetTopologySuite.Geometries.Geometry |
geometry |
Defines the spatial area of the exploration. |
| System.Func<TObstacle, System.Boolean> |
predicate |
Optionally reduces the result by defined criteria. |
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<TObstacle> |
All obstacles that comply with given parameters. |
|
Improve this Doc
View Source
FindRoute(TCharacter, Position)
Finds a route from the characters current position to the goal by avoiding non passable obstacles.
Declaration
IEnumerable<Position> FindRoute(TCharacter character, Position goal)
Parameters
| Type |
Name |
Description |
| TCharacter |
character |
For that a route search is performed. |
| Position |
goal |
Defines the end of the route. |
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<Position> |
The in-between positions from start (characters current position) to goal. |
|
Improve this Doc
View Source
Insert(TCharacter, Position)
Tries to insert a character at given initial coordinate. If a blocking or removing collision occurs,
the operation is aborted.
Declaration
bool Insert(TCharacter character, Position position)
Parameters
| Type |
Name |
Description |
| TCharacter |
character |
That is inserted. |
| Position |
position |
The location where the character is inserted. |
Returns
| Type |
Description |
| System.Boolean |
true if insertion is successful; false otherwise. |
|
Improve this Doc
View Source
Insert(TObstacle, Geometry)
Tries to insert an obstacle with given geometry. If a blocking or removing collision occurs, the
operation is aborted.
Declaration
bool Insert(TObstacle obstacle, Geometry geometry)
Parameters
| Type |
Name |
Description |
| TObstacle |
obstacle |
That is inserted. |
| NetTopologySuite.Geometries.Geometry |
geometry |
Describes spatial dimension and form as well as location. |
Returns
| Type |
Description |
| System.Boolean |
true if insertion is successful; false otherwise. |
|
Improve this Doc
View Source
Move(TCharacter, Double, Double)
Moves given character with a bearing for a distance. If the character collides with an obstacle on the
way, the obstacles collision handle is called to react and resolve the situation. The character may be
removed or repositioned by the handle.
Declaration
Position Move(TCharacter character, double bearing, double distance)
Parameters
| Type |
Name |
Description |
| TCharacter |
character |
That is moved. |
| System.Double |
bearing |
Defines the direction of movement (bearing is between 0 and 360). |
| System.Double |
distance |
Distance for movement. |
Returns
| Type |
Description |
| Position |
The new position where the character actually ends up. |
|
Improve this Doc
View Source
PosAt(TCharacter, Position)
Moves the character directly to the target position without checking collisions on the way. It is still
checked if collisions appear at the new position.
Declaration
Position PosAt(TCharacter character, Position target)
Parameters
| Type |
Name |
Description |
| TCharacter |
character |
That is positioned. |
| Position |
target |
The goal position of the character. |
Returns
| Type |
Description |
| Position |
The new position where the character actually ends up. |
|
Improve this Doc
View Source
Remove(TCharacter)
Removes the character.
Declaration
bool Remove(TCharacter character)
Parameters
| Type |
Name |
Description |
| TCharacter |
character |
That is removed. |
Returns
| Type |
Description |
| System.Boolean |
true if successfully removed; false if not found. |
|
Improve this Doc
View Source
Remove(TObstacle)
Removes the obstacle.
Declaration
bool Remove(TObstacle obstacle)
Parameters
| Type |
Name |
Description |
| TObstacle |
obstacle |
That is removed. |
Returns
| Type |
Description |
| System.Boolean |
true if successfully removed; false if not found. |
Extension Methods