Bichromatic closest pair when R and B are separated by a vertical line (continue)
http://stackoverflow.com/questions/8203576/closest-distance-between-two-pointsdisjoint-set

In the Bichromatic Closest Pair Problem, we are given a set R of red points and a set B of blue points in the plane. The problem is to return the pair of points, one red and one blue, whose distance is minimum over all red-blue pairs.

My algorithm is a kind of them.

    1: If both R and B store only a constant number of points, sort the points according to <y , com- pute a bichromatic closest pair using a brute- force algorithm, and return.
    
    2: Assume |R| >= |B|, otherwise reverse the roles of R and B.
    
    3: Pick a random element r from R.
    
    4: Find the closest element of b in B to r.
    
    5: Compute the left envelope of disks having radius |rb| centered at each of the points in B.
    
    6: Remove all elements of R that are outside the envelope.

I can't think any idea which implementing to 4,5,6.

some reference said Graham's algorithm. I think it cannot be a circle. and I want to know how I implement them.

and How to make envelope some kind of region? T T..

It is easy draw in a paper, but implementing is always hard to me. someone who advise in C++?
Bichromatic closest pair when R and B are separated by a vertical line (continue)
===

http://stackoverflow.com/questions/8203576/closest-distance-between-two-pointsdisjoint-set

In the Bichromatic Closest Pair Problem, we are given a set R of red points and a set B of blue points in the plane. The problem is to return the pair of points, one red and one blue, whose distance is minimum over all red-blue pairs.

My algorithm is a kind of them.

    1: If both R and B store only a constant number of points, sort the points according to <y , com- pute a bichromatic closest pair using a brute- force algorithm, and return.
    
    2: Assume |R| >= |B|, otherwise reverse the roles of R and B.
    
    3: Pick a random element r from R.
    
    4: Find the closest element of b in B to r.
    
    5: Compute the left envelope of disks having radius |rb| centered at each of the points in B.
    
    6: Remove all elements of R that are outside the envelope.

I can't think any idea which implementing to 4,5,6.

some reference said Graham's algorithm. I think it cannot be a circle. and I want to know how I implement them.

and How to make envelope some kind of region? T T..

It is easy draw in a paper, but implementing is always hard to me. someone who advise in C++?