Пример #1
0
 void OBStereo::Permutate(OBStereo::Refs &refs, int i, int j)
 {
   if (i < 0 || i >= refs.size())
     return;
   if (j < 0 || j >= refs.size())
     return;
   unsigned long id = refs.at(i);
   refs[i] = refs.at(j);
   refs[j] = id;
 }
Пример #2
0
bool hasSameWinding(const OBStereo::Refs &refs1, const OBStereo::Refs &refs2)
{
  OB_REQUIRE( refs1.size() == 3 );
  OB_REQUIRE( refs2.size() == 3 );

  int Ni1 = OBStereo::NumInversions(refs1);
  int Ni2 = OBStereo::NumInversions(refs2);

  return ((Ni1 + Ni2) % 2 == 0);
}
Пример #3
0
 OBStereo::Refs OBStereo::Permutated(const OBStereo::Refs &refs, int i, int j)
 {
   if (i < 0 || i >= refs.size())
     return refs;
   if (j < 0 || j >= refs.size())
     return refs;
   OBStereo::Refs result(refs);
   result[i] = refs.at(j);
   result[j] = refs.at(i);
   return result;
 }
Пример #4
0
  bool OBStereo::ContainsSameRefs(const OBStereo::Refs &refs1, const OBStereo::Refs &refs2)
  {
    if (refs1.size() != refs2.size())
      return false;

    int count = 0;
    for (ConstRefIter i = refs1.begin(); i != refs1.end(); ++i)
      for (ConstRefIter j = refs2.begin(); j != refs2.end(); ++j)
        if (*i == *j) {
          count++;
          break;
        }

    return (count == refs1.size());
  }