Polarith AI
1.8
PlanarSensor Class Reference

Description

The PlanarSensor is a special type of Sensor with the assumption that there is a (virtual) ground in the world (back-end class).

Within a planar sensor shape, each receptor has got two neighbours at maximum, one precessing and one succeeding neighbour. If any of these are not existent, the corresponding neighbour ID is -1. All contained receptors lay within a plane which correlates to the ground of the world.

This class extends the methods of its base hierarchy so that they are suitable for the targeted planar case. In addition, it defines static methods for the construction of the most usual planar sensor shapes: CreateLine(int, float, float, PlanarOrientationType) and CreateCircle(int, float, PlanarOrientationType).

Attention, a sensor might be shared by multiple agents! Changing the data of a shared sensor at runtime is not thread-safe.

Back-end class of AIMPlanarSensor.

Inheritance diagram for PlanarSensor:
Sensor

Protected Fields

List< Receptorreceptors = new List<Receptor>()
 All contained receptor instances forming the shape of this sensor. More...
 

Properties

override Sensor Clone [get]
 Constructs a copy of this instance, especially deep copies the contained receptors (read only). More...
 
override Quaternion Rotation [get]
 The current rotation with respect to the set PlanarOrientation (read only). More...
 
override Quaternion InverseRotation [get]
 The inverse of the current rotation with respect to the set PlanarOrientation (read only). More...
 
PlanarOrientationType PlanarOrientation [get, set]
 Specifies how this Sensor is oriented with respect to a virtual axis-aligned plane. More...
 
override VectorProjectionType ProjectionMode [get]
 The VectorProjectionType derived from the PlanarOrientationType. More...
 
override int ReceptorCount [get]
 The number of contained receptors (read only). More...
 
override IReceptor< Structurethis[int id] [get]
 Provides quick read-only access to a contained Receptor instance. More...
 

Public Methods

override IReceptor< StructureAddReceptor ()
 Constructs and adds a Receptor instance into this sensor. More...
 
override IReceptor< StructureInsertReceptor (int id)
 Constructs and inserts a Receptor instance into this sensor with the specified id . More...
 
int GetNeighbourID (int id, int targetNeighbour)
 Recursively gets the neighbour ID at the specified place targetNeighbour . More...
 
void InitializeNeighbours (bool closed)
 Rebuilds and updates the neighbour IDs for each receptor. More...
 
override IReceptor< StructureGetReceptor (int id)
 Gets the Receptor with the specified id . More...
 
override void RemoveReceptorAt (int id)
 Removes the Receptor with the specified id . More...
 
override void ClearReceptors ()
 Removes all contained Receptor instances. More...
 

Public Static Methods

static PlanarSensor CreateLine (int receptorCount, float width, float positionY, PlanarOrientationType planarOrientation=PlanarOrientationType.PlaneXY)
 Constructs a sensor shape so that its receptors lay on a horizontal line pointing upwards. More...
 
static PlanarSensor CreateCircle (int receptorCount, float radius, PlanarOrientationType planarOrientation=PlanarOrientationType.PlaneXY)
 Constructs a radial sensor shape so that its receptors has got the same position (when the given radius is 0) with their directions arranged in a circle pointing outside. More...
 
Imprint