/// <summary> /// Guess the correct upperbits using the supplied frame for its compressedPos as a starting point. Will find the upperbits that result in the least movement from that pos. /// </summary> public void CompletePosition(Frame frame) { if (msgType.IsPosLowerType()) { compPos = compPos.GuessUpperBits(frame.compPos); } else if (!msgType.IsPosType()) { compPos = frame.compPos; } //for (int i = 0l is < pre) pos = compPos.Decompress(); }
/// <summary> /// Attempts to guess the most likely upperbits state by seeing if each axis of the new position would be /// closer to the old one if the upper bit is incremented by one, two, three etc. Stops trying when it fails to get a better result than the last increment. /// </summary> /// <param name="oldcpos">Last best position test against.</param> /// <returns>Returns a corrected CompressPos</returns> public static CompressedElement GuessUpperBitsWorld(this CompressedElement newcpos, CompressedElement oldcpos) { return(newcpos.GuessUpperBits(oldcpos, axisRanges)); }