src/taesooLib/PhysicsLib/convexhull/graham.cpp
void GrahamScan::partition_points()
    {
        //
        // Step one in partitioning the points is to sort the raw data
        //
        std::sort( raw_points.begin(), raw_points.end() );
        //
        // The the far left and far right points, remove them from the
        // sorted sequence and store them in special members
        //
        left = raw_points.front();
        raw_points.erase( raw_points.begin() );
        right = raw_points.back();
        raw_points.pop_back();
        //
        // Now put the remaining points in one of the two output sequences
        //
        for ( size_t i = 0 ; i < raw_points.size() ; i++ )
        {
            double dir = direction( left, right, raw_points[ i ] );
            if ( dir < 0 )
                upper_partition_points.push_back( raw_points[ i ] );
            else
                lower_partition_points.push_back( raw_points[ i ] );
        }
    }
//
// The initial array of points is stored in vectgor raw_points. I first
// sort it, which gives me the far left and far right points of the hull.
// These are special values, and they are stored off separately in the left
// and right members.
//
// I then go through the list of raw_points, and one by one determine whether
// each point is above or below the line formed by the right and left points.
// If it is above, the point is moved doubleo the upper_partition_points sequence. If it
// is below, the point is moved doubleo the lower_partition_points sequence. So the output
// of this routine is the left and right points, and the sorted points that are in the
// upper and lower partitions.
//
The initial array of points is stored in vectgor raw_points. I first
sort it, which gives me the far left and far right points of the hull.
These are special values, and they are stored off separately in the left
and right members.

I then go through the list of raw_points, and one by one determine whether
each point is above or below the line formed by the right and left points.
If it is above, the point is moved doubleo the upper_partition_points sequence. If it
is below, the point is moved doubleo the lower_partition_points sequence. So the output
of this routine is the left and right points, and the sorted points that are in the
upper and lower partitions.
The initial array of points is stored in vectgor raw_points . I first sort it which gives me the far left and far right points of the hull . These are special values and they are stored off separately in the left and right members . I then go through the list of raw_points and one by one determine whether each point is above or below the line formed by the right and left points . If it is above the point is moved doubleo the upper_partition_points sequence . If it is below the point is moved doubleo the lower_partition_points sequence . So the output of this routine is the left and right points and the sorted points that are in the upper and lower partitions .
void GrahamScan::partition_points()
    {
         Step one in partitioning the points is to sort the raw data
        std::sort( raw_points.begin(), raw_points.end() );
         The the far left and far right points, remove them from the
         sorted sequence and store them in special members
        left = raw_points.front();
        raw_points.erase( raw_points.begin() );
        right = raw_points.back();
        raw_points.pop_back();
         Now put the remaining points in one of the two output sequences
        for ( size_t i = 0 ; i < raw_points.size() ; i++ )
        {
            double dir = direction( left, right, raw_points[ i ] );
            if ( dir < 0 )
                upper_partition_points.push_back( raw_points[ i ] );
            else
                lower_partition_points.push_back( raw_points[ i ] );
        }
    }
void GrahamScan :: partition_points ( ) { std :: sort ( raw_points . begin ( ) , raw_points . end ( ) ) ; left = raw_points . front ( ) ; raw_points . erase ( raw_points . begin ( ) ) ; right = raw_points . back ( ) ; raw_points . pop_back ( ) ; for ( size_t i = 0 ; i < raw_points . size ( ) ; i ++ ) { double dir = direction ( left , right , raw_points [ i ] ) ; if ( dir < 0 ) upper_partition_points . push_back ( raw_points [ i ] ) ; else lower_partition_points . push_back ( raw_points [ i ] ) ; } }
The initial array of points is stored in vectgor raw_points.
The initial array of points is stored in vectgor raw_points .
// // Step one in partitioning the points is to sort the raw data // // // The the far left and far right points, remove them from the // sorted sequence and store them in special members // // // Now put the remaining points in one of the two output sequences //