예제 #1
0
        private static bool MatchLocation(BitPointSet locationPointSet, BitPointSet queryPointSet)
        {
            if (!locationPointSet.IsEmpty && locationPointSet.IsSubsetOf(queryPointSet))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        private short Distance(BitPointSet pSet, BitPointSet qSet)
        {
            if (pSet.Overlaps(qSet)) // it's faster than comparing distances
            {
                return(0);
            }

            var minDistance = short.MaxValue;

            for (var p = pSet.GetNextPoint(0); p != -1; p = pSet.GetNextPoint(p + 1))
            {
                for (var q = qSet.GetNextPoint(0); q != -1; q = qSet.GetNextPoint(q + 1))
                {
                    var distance = Distance(p, q);
                    if (distance < minDistance)
                    {
                        minDistance = distance;
                    }
                }
            }

            return(minDistance);
        }
예제 #3
0
 private static bool MatchRelocation(BitPointSet relocationPointSet, BitPointSet queryPointSet)
 {
     return(relocationPointSet.Overlaps(queryPointSet));
 }
예제 #4
0
 public bool IsSubsetOf(BitPointSet other)
 {
     return(_cardinality == OpenBitSet.intersectionCount(_points, other._points));
 }
예제 #5
0
 public bool Overlaps(BitPointSet other)
 {
     return(_points.intersects(other._points));
 }
예제 #6
0
 public void UnionWith(BitPointSet other)
 {
     _points.union(other._points);
     _cardinality = (int)_points.cardinality();
 }