// find all neighbors within the given sphere (as center and radius) public override void findNeighbors(Vector3 center, float radius, ArrayList results) { // loop over all tokens float r2 = radius * radius; //bfpd.group.ForEach(delegate(tokenType tToken) for (int i = 0; i < bfpd.group.Count; i++) { tokenType tToken = (tokenType)bfpd.group[i]; //for (tokenIterator i = bfpd->group.begin(); i != bfpd->group.end(); i++) //{ Vector3 offset = center - tToken.position; float d2 = offset.SquaredLength; // push onto result vector when within given radius if (d2 < r2) { results.Add(tToken.tParentObject); //.push_back ((**i).object); } } ; }
// allocate a token to represent a given client object in this database //public override tokenType allocateToken (Object parentObject) public override AbstractTokenForProximityDatabase allocateToken(AbstractVehicle parentObject) { tokenType tToken = new tokenType(parentObject, this); return((AbstractTokenForProximityDatabase)tToken); }
// allocate a token to represent a given client object in this database //public override tokenType allocateToken (Object parentObject) public override AbstractTokenForProximityDatabase allocateToken(AbstractVehicle parentObject) { tokenType tToken=new tokenType (parentObject, this); return (AbstractTokenForProximityDatabase)tToken; }