本文整理汇总了C++中BitSet32::getIndexOfBit方法的典型用法代码示例。如果您正苦于以下问题:C++ BitSet32::getIndexOfBit方法的具体用法?C++ BitSet32::getIndexOfBit怎么用?C++ BitSet32::getIndexOfBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitSet32
的用法示例。
在下文中一共展示了BitSet32::getIndexOfBit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addMovement
void VelocityTracker::addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions) {
while (idBits.count() > MAX_POINTERS) {
idBits.clearLastMarkedBit();
}
if ((mCurrentPointerIdBits.value & idBits.value)
&& eventTime >= mLastEventTime + ASSUME_POINTER_STOPPED_TIME) {
#if DEBUG_VELOCITY
ALOGD("VelocityTracker: stopped for %0.3f ms, clearing state.",
(eventTime - mLastEventTime) * 0.000001f);
#endif
// We have not received any movements for too long. Assume that all pointers
// have stopped.
mStrategy->clear();
}
mLastEventTime = eventTime;
mCurrentPointerIdBits = idBits;
if (mActivePointerId < 0 || !idBits.hasBit(mActivePointerId)) {
mActivePointerId = idBits.isEmpty() ? -1 : idBits.firstMarkedBit();
}
mStrategy->addMovement(eventTime, idBits, positions);
#if DEBUG_VELOCITY
ALOGD("VelocityTracker: addMovement eventTime=%" PRId64 ", idBits=0x%08x, activePointerId=%d",
eventTime, idBits.value, mActivePointerId);
for (BitSet32 iterBits(idBits); !iterBits.isEmpty(); ) {
uint32_t id = iterBits.firstMarkedBit();
uint32_t index = idBits.getIndexOfBit(id);
iterBits.clearBit(id);
Estimator estimator;
getEstimator(id, &estimator);
ALOGD(" %d: position (%0.3f, %0.3f), "
"estimator (degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f)",
id, positions[index].x, positions[index].y,
int(estimator.degree),
vectorToString(estimator.xCoeff, estimator.degree + 1).c_str(),
vectorToString(estimator.yCoeff, estimator.degree + 1).c_str(),
estimator.confidence);
}
#endif
}
示例2: getVelocity
void VelocityTrackerState::getVelocity(int32_t id, float* outVx, float* outVy) {
if (id == ACTIVE_POINTER_ID) {
id = mVelocityTracker.getActivePointerId();
}
float vx, vy;
if (id >= 0 && id <= MAX_POINTER_ID && mCalculatedIdBits.hasBit(id)) {
uint32_t index = mCalculatedIdBits.getIndexOfBit(id);
const Velocity& velocity = mCalculatedVelocity[index];
vx = velocity.vx;
vy = velocity.vy;
} else {
vx = 0;
vy = 0;
}
if (outVx) {
*outVx = vx;
}
if (outVy) {
*outVy = vy;
}
}