|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--netwar.game.SelfSortingMutualDistanceSquared
This class provides a high-RAM, low computation way to find a listing of all other GameObjects, sorted from closest to farthest. This also provides pre-calculated distance squared values. These are faster to calculate than distances, but can be compared as if they were distances to find longer or shorter.
| Method Summary | |
float |
getDistanceSquared()
Get a pre-calculated distance squared between the two GameObjects. |
SelfSortingMutualDistanceSquared |
getNext(GameObject go)
Get the next SSMDS in go's list. |
GameObject |
getOther(GameObject go)
Get the other GameObject for this SSMDS. |
SelfSortingMutualDistanceSquared |
getTarget(GameObject go,
GameObject target)
Traverse go's list, and find the SSMDS that matches with target. |
Point3D |
getVector(GameObject go)
Get a Point3D which is the vector from the passed GameObject to the other GameObject. |
static void |
newSSMDS(GameObject younger,
GameObject older)
This calls the constructor for SSMDS to prevent the new object from being assigned to a reference, which would be improper usage. |
void |
remove(GameObject go)
When called on the go.firstSSMDS, it will recursively remove all of the SSMDSs' which reference go. |
void |
update()
When a GameObject moves, it should call this on each SSMDS in its list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void newSSMDS(GameObject younger,
GameObject older)
younger - the newly made GameObject.older - the GameObject already included in the system.public void remove(GameObject go)
go - The GameObject which is being invalidated.public void update()
public float getDistanceSquared()
public Point3D getVector(GameObject go)
go - the GameObject to measure the vector from.public GameObject getOther(GameObject go)
go - The GameObject which is known.
public SelfSortingMutualDistanceSquared getTarget(GameObject go,
GameObject target)
go - - the GameObject which you are searching with.target - - the other GameObject for the desired SSMDS.public SelfSortingMutualDistanceSquared getNext(GameObject go)
go - The GameObject whose list you are traversing.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||