|
AI for Games 1.1.1
|

Public Member Functions | |
| GraphNode (int id) | |
| GraphNode (int id, double x, double y, double z) | |
| GraphNode (int id, double x, double y) | |
| GraphNode (GraphNode node) | |
| int | id () |
| void | id (int id) |
| double | x () |
| float | xf () |
| void | x (double x) |
| double | y () |
| float | yf () |
| void | y (double y) |
| double | z () |
| float | zf () |
| void | z (double z) |
| int | compareTo (Object o) |
| String | toString () |
Protected Attributes | |
| int | id |
Package Attributes | |
| double | x |
| double | y |
| double | z |
This class represents a node (vertex) that can be used with the Graph class.
The node has a position in 3D space for 2D applications the z value should be zero.
Each node should be given a unique ID number >= 0. Node ID numbers do not need to start at 0 (zero) or be sequential but they must be unique.
It is the responsibility of the user to ensure that each node ID is unique as duplicate ID numbers can lead to unpredictable behaviour.
| game2dai.graph.GraphNode.GraphNode | ( | int | id | ) |
Create a node with a given ID
| id |
| game2dai.graph.GraphNode.GraphNode | ( | int | id, |
| double | x, | ||
| double | y, | ||
| double | z | ||
| ) |
Create a node
| id | unique id number for this node |
| x | |
| y | |
| z | set to 0 (zero for 2D applications |
| game2dai.graph.GraphNode.GraphNode | ( | int | id, |
| double | x, | ||
| double | y | ||
| ) |
Create a node
| id | unique id number for this node |
| x | |
| y |
| game2dai.graph.GraphNode.GraphNode | ( | GraphNode | node | ) |
Copy constructor.
| node | node to copy from |
| int game2dai.graph.GraphNode.compareTo | ( | Object | o | ) |
Compare nodes based on ID number.
| int game2dai.graph.GraphNode.id | ( | ) |
Get the node ID
| void game2dai.graph.GraphNode.id | ( | int | id | ) |
Change the node id.
Care should be taken to ensure the new ID number is unique
| id | the id to set |
| double game2dai.graph.GraphNode.x | ( | ) |
| void game2dai.graph.GraphNode.x | ( | double | x | ) |
| x | the new x position |
| float game2dai.graph.GraphNode.xf | ( | ) |
| double game2dai.graph.GraphNode.y | ( | ) |
| void game2dai.graph.GraphNode.y | ( | double | y | ) |
| y | the new y position |
| float game2dai.graph.GraphNode.yf | ( | ) |
| double game2dai.graph.GraphNode.z | ( | ) |
| void game2dai.graph.GraphNode.z | ( | double | z | ) |
| z | the new z position |
| float game2dai.graph.GraphNode.zf | ( | ) |