Class TArena

DescriptionHierarchyFieldsMethodsProperties

Unit

Arena

Declaration

type TArena = class(TObject)

Description

Class implementing an arena (environment in which an agent operates). Normal usage of this class amounts to creating a definition file (see example below) consisting of a sequential list of available arena objects (such as TFloor, TCornerWall, etc.) and calling the constructor CreateFromFile with the arena definition file as argument. See unit Arena for available arena objects (descendants of TArenaObject).


Example of a valid definition file:

object Floor1: TFloor
  Height = 0.0
  Position = 0.0 2.5 0.0
  Velocity = 0.0 0.0 0.0
  Angle = 0.0
  Length = 5
  Width = 5
  TileLength = 2.0
  TileWidth = 2.0
# Texture = Textures/floor09.jpg
  RGBColor = 10 10 10
end

object CornerWall1: TCornerWall
  Height = 2.0
  Position = 0.5 1.0 0.0
  Velocity = 0.0 0.0 0.0
  Angle = -180.0
  LengthPart1 = 0.4
  LengthPart2 = 0.4
  Thickness = 0.20
  RGBColor = 100 100 140
end

Hierarchy

TArena > TObject

Methods

Overview

Public constructor Create;
Public constructor CreateFromFile(FileName: string; Memo: TMemo);
Public destructor Destroy; override;
Public procedure AddAmbience(Description: TStringList);
Public procedure AddAmbienceProperty(Description: TStringList);
Public procedure AddArenaObject(Obj: TArenaObject); overload;
Public procedure AddArenaObject(Description: TStringList); overload;
Public procedure AddArenaObjectProperty(Description: TStringList);
Public procedure DeleteArenaObject(Obj: TArenaObject);
Public procedure GenerateDescription(Memo: TMemo);
Public procedure GenerateSlice(Height: real);
Public procedure GenerateSliceView(Bitmap: TBitmap; xmin,ymin,xmax,ymax: real);
Public function GetSliceAtHeight(Height: real): TSliceList;
Public procedure ResetState;
Public procedure SaveToFile;
Public procedure SetRobotPersonalSphere(XPos, YPos, Radius: real);
Public procedure Step(TimeStep: real);

Description

Public constructor Create;

Default constructor.

Public constructor CreateFromFile(FileName: string; Memo: TMemo);

Constructor that takes an arena definition file as argument and populates the arena with objects defined in the supplied file. After the parsing of the supplied arena file, the initial state of the arena is stored in variables of type TInitialArenaObjectProperty. It should be noted that the arena uses periodic bondary conditions by default.

parameters
FileName
is the name of the arena definition file. FileName can contain both relative and absolute path information.
Memo
provides optional output. If not Nil, the content of FileName will appear in Memo.
Public destructor Destroy; override;

Default destructor. The destructor should never be called explicitly. Instead, use the Free method or the procedure FreeAndNil when releasing a TArena object.

Public procedure AddAmbience(Description: TStringList);

Procedure used internally when parsing the arena definition file.

Public procedure AddAmbienceProperty(Description: TStringList);

Procedure used internally when parsing the arena definition file.

Public procedure AddArenaObject(Obj: TArenaObject); overload;

Use this routine to add objects to the arena during run-time. Objects added to TArena are automatically destroyed when destroying TArena.

Public procedure AddArenaObject(Description: TStringList); overload;

Procedure used internally when parsing the arena definition file.

Public procedure AddArenaObjectProperty(Description: TStringList);

Procedure used internally when parsing the arena definition file.

Public procedure DeleteArenaObject(Obj: TArenaObject);

Use this procedure to remove an arena object (and free the associated memory allocation).

Public procedure GenerateDescription(Memo: TMemo);

Deprecated procedure.

Public procedure GenerateSlice(Height: real);

Procedure for generating a 2D slice of the arena at a specific height (see SliceList). This procedure calls the function GetSliceAtHeight to do the actual slicing of the arena. The resulting slice can be retrieved by using the property SliceList.

parameters
Height
is the Z-coordinate at which the slice will be generated.
Public procedure GenerateSliceView(Bitmap: TBitmap; xmin,ymin,xmax,ymax: real);

Procedure that draws the current SliceList onto a bitmap. Since GenerateSliceView uses the current SliceList for doing the drawing, SliceList needs to be created by calling GenerateSlice prior to calling GenerateSliceView.

parameters
Bitmap
is the bitmap onto which the arena slice is drawn. Note that the height and width of the bitmap needs to be set externally.
xmin
is the minimum (real-world) X-coordinate drawn onto the bitmap.
ymin
is the minimum (real-world) Y-coordinate drawn onto the bitmap.
xmax
is the maximum (real-world) X-coordinate drawn onto the bitmap.
ymax
is the maximum (real-world) Y-coordinate drawn onto the bitmap.
Public function GetSliceAtHeight(Height: real): TSliceList;

Procedure for generating a 2D slice of the arena at a specific height.

parameters
Height
is the Z-coordinate at which the slice will be generated.
returns

TSliceList containing the coordinate pairs (lines) resulting from the slicing of the arena.

Public procedure ResetState;

Procedure that sets all arena objects back to their initial states (see TInitialArenaObjectProperty).

Public procedure SaveToFile;

Saves the current arena into a text file. Use this procedure to save an arena constructed during run-time. The resulting file can be provided as argument to the constructor CreateFromFile.

Public procedure SetRobotPersonalSphere(XPos, YPos, Radius: real);

Deprecated procedure.

Public procedure Step(TimeStep: real);

Deprecated procedure. Previously, this procedure was used for enforcing periodic boundary conditions.

Properties

Overview

Public property Ambience: TAmbience;
Public property InitialState: TInitialArenaObjectPropertyArray;
Public property ItemNamed[Name: string]: TArenaObject;
Public property M[i: integer]: TArenaObject;
Public property NumberOfArenaObjects: integer;
Public property SliceList: TSliceList;

Description

Public property Ambience: TAmbience;

Provides read-only access to the TAmbience object.

Public property InitialState: TInitialArenaObjectPropertyArray;

The initial states of all arena objects as defined in the arena definition file. Returns an array of TInitialArenaObjectProperty containing the initial position, initial velocity, and initial rotation angle. The indexing of the array goes from 1 to NumberOfArenaObjects.

Public property ItemNamed[Name: string]: TArenaObject;

Property for finding an arena object having a specific name. If a matching name is found, the corresponding arena object is returned, otherwise Nil is returned. The search is not case-sensitive.

Public property M[i: integer]: TArenaObject;

Default array property that returns an arena object based on an index number. Use this property to access any arena object contained in the arena. The index (i) goes from 1 to NumberOfArenaObjects.

Public property NumberOfArenaObjects: integer;

The number of arena object contained in the arena.

Public property SliceList: TSliceList;

Provides access to the slice list created by calling GenerateSlice.


Generated by PasDoc 0.8.8.3 on 2005-05-28 08:13:49