private bool TryGetZ(PointLane <Vector3> lane, Vector3 key, out T t) { //search down the z lane for the coordianate Vector3 v; if (lane.TryGet(key.z, out v)) { t = mapping[v]; return(true); } t = default(T); return(false); }
private bool TryGetY(PointLane <PointLane <Vector3> > lane, Vector3 key, out T t) { //search the sub lanes for sub sub lanes that match the y value PointLane <Vector3> left, center, right; (left, center, right) = lane.GetOrInitLanes(key.y, () => new PointLane <Vector3>(percision)); //search down the sub lanes if (center != null && TryGetZ(center, key, out t)) { return(true); } if (left != null && TryGetZ(left, key, out t)) { return(true); } if (right != null && TryGetZ(right, key, out t)) { return(true); } t = default(T); return(false); }
/// <summary> /// Create a new point dictionary with the required precision /// </summary> /// <param name="percision"></param> public PointDictionary(float percision = 0.0001f) { this.percision = percision; lanes = new PointLane <PointLane <PointLane <Vector3> > >(percision); }