Castle Game Engine: CastleSectors: Class TSectorList

# Class TSectorList
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleSectors ## Declaration `type TSectorList = class(specialize TFPGObjectList<TSector>)` ## Description ## Hierarchy TFPGObjectList TSectorList ## Overview ### Methods
| `procedure LinkToWaypoints(Waypoints: TWaypointList);`
| `function SectorWithPoint(const Point: TVector3Single): TSector;`
| `class function FindWay(SectorBegin, SectorEnd: TSector; Waypoints: TWaypointList): boolean;`
## Description ### Methods
| `procedure LinkToWaypoints(Waypoints: TWaypointList);`
Connect sectors and waypoints into a graph. Adds appropriate waypoints to sectors and sectors to waypoints, knowing which waypoint belongs (presumably, lies at the border of) to which sector. A waypoint belongs to the sector simply when TWaypoint.Box collides with one of the sector boxes. ###### Exceptions raised ESectorNotInitialized When some sector is nil. EWaypointNotInitialized When some waypoint is nil.
| `function SectorWithPoint(const Point: TVector3Single): TSector;`
Returns sector with given point (using IsPointInside of each sector). Returns nil if no such sector.
| `class function FindWay(SectorBegin, SectorEnd: TSector; Waypoints: TWaypointList): boolean;`
This sets Waypoints contents to the list of waypoints that must be passed to travel from sector SectorBegin to SectorEnd. Special cases: when either SectorBegin or SectorEnd are nil (this can easily happen if you pass here results of SectorWithPoint method), or when SectorBegin = SectorEnd, or when there is no possible way, it returns `False` and just clears Waypoints (i.e. sets Waypoints.Count to 0). Otherwise (if a way is found) it returns `True` and sets Waypoints items as appropriate. The order of Waypoints is significant: starting from SectorBegin, you should first travel to Waypoints[0], then to Waypoints[1] etc. In this case for sure we have at least one Waypoint. (So the result of this function is actually just a comfortable thing, you can get the same result just checking Waypoints.Count <> 0) TODO: This should use breadth-first search. Right now it uses depth-first search. For small sectors+waypoints graphs it doesn't matter.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:11