isVictory property

bool get isVictory

Whether the hand is doing a victory/peace gesture (index & middle extended, others curled).

Implementation

bool get isVictory {
  final palm = palmPosition;
  final index = joints[HandJoint.indexTip];
  final middle = joints[HandJoint.middleTip];
  if (palm == null || index == null || middle == null) return false;

  if ((index - palm).length < 0.075 || (middle - palm).length < 0.075) return false;

  final curledTips = [
    HandJoint.thumbTip,
    HandJoint.ringTip,
    HandJoint.littleTip,
  ];
  for (final tip in curledTips) {
    final pos = joints[tip];
    if (pos == null || (pos - palm).length > 0.045) return false;
  }
  return true;
}