Class TArena
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 > TObjectMethods
Overview
Description
 |
constructor Create; |
Default constructor.
 |
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.
 |
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.
 |
procedure AddAmbience(Description: TStringList); |
Procedure used internally when parsing the arena definition file.
 |
procedure AddAmbienceProperty(Description: TStringList); |
Procedure used internally when parsing the arena definition file.
Use this routine to add objects to the arena during run-time. Objects added to TArena are automatically destroyed when destroying TArena.
 |
procedure AddArenaObject(Description: TStringList); overload; |
Procedure used internally when parsing the arena definition file.
 |
procedure AddArenaObjectProperty(Description: TStringList); |
Procedure used internally when parsing the arena definition file.
Use this procedure to remove an arena object (and free the associated memory allocation).
 |
procedure GenerateDescription(Memo: TMemo); |
Deprecated procedure.
 |
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.
 |
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.
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.
 |
procedure ResetState; |
Procedure that sets all arena objects back to their initial states (see TInitialArenaObjectProperty).
 |
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.
 |
procedure SetRobotPersonalSphere(XPos, YPos, Radius: real); |
Deprecated procedure.
 |
procedure Step(TimeStep: real); |
Deprecated procedure. Previously, this procedure was used for enforcing periodic boundary conditions.
Properties
Overview
Description
Provides read-only access to the TAmbience object.
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.
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.
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.
 |
property NumberOfArenaObjects: integer; |
The number of arena object contained in the arena.
Provides access to the slice list created by calling GenerateSlice.
Generated by PasDoc 0.8.8.3 on 2005-05-28 08:13:49