pub fn graham_scan(input_set: &mut Vec<Point2D>) -> Vec<Point2D> {
    let sorted_input_set = input_set;

    //initialize the stack that will maintain the candidate points
    let mut hull_points: Vec<Point2D> = Vec::new();
    hull_points.push(sorted_input_set[0]);
    hull_points.push(sorted_input_set[1]);
    hull_points.push(sorted_input_set[2]);
    for i in 3..sorted_input_set.len() {
        while !hull_points[hull_points.len() - 2]
            .ccw(&hull_points[hull_points.len() - 1], &sorted_input_set[i])
        {
            hull_points.pop();
        }
        hull_points.push(sorted_input_set[i])
    }
    hull_points
}
/// Solves the convexhull problem using Graham-Scan
///
/// This method solves the convex-hull by maintaining a stack S
/// of candidate points. It pushes each point of the input
/// set Q onto the stack one at a time, and it eventually
/// pops from the stack each point that is not a vertex of
/// CH(Q). When the algorithm terminates, stack S cpntains
/// exactly the vertices of CH(Q), in counter clockwise
/// order of their appearance on the boundary.
///
/// The psedocode for this algorithm is referred from
/// Introduction to Algorithms (Third Edition)
/// Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein
Solves the convexhull problem using Graham-Scan
This method solves the convex-hull by maintaining a stack S
of candidate points. It pushes each point of the input
set Q onto the stack one at a time, and it eventually
pops from the stack each point that is not a vertex of
CH(Q). When the algorithm terminates, stack S cpntains
exactly the vertices of CH(Q), in counter clockwise
order of their appearance on the boundary.

The psedocode for this algorithm is referred from
Introduction to Algorithms (Third Edition)
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein
Solves the convexhull problem using Graham - Scan This method solves the convex - hull by maintaining a stack S of candidate points . It pushes each point of the input set Q onto the stack one at a time and it eventually pops from the stack each point that is not a vertex of CH ( Q ) . When the algorithm terminates stack S cpntains exactly the vertices of CH ( Q ) in counter clockwise order of their appearance on the boundary . The psedocode for this algorithm is referred from Introduction to Algorithms ( Third Edition ) Authors : Thomas H . Cormen Charles E . Leiserson Ronald L . Rivest and Clifford Stein
pub fn graham_scan(input_set: &mut Vec<Point2D>) -> Vec<Point2D> {
    let sorted_input_set = input_set;
    //initialize the stack that will maintain the candidate points
    let mut hull_points: Vec<Point2D> = Vec::new();
    hull_points.push(sorted_input_set[0]);
    hull_points.push(sorted_input_set[1]);
    hull_points.push(sorted_input_set[2]);
    for i in 3..sorted_input_set.len() {
        while !hull_points[hull_points.len() - 2]
            .ccw(&hull_points[hull_points.len() - 1], &sorted_input_set[i])
        {
            hull_points.pop();
        }
        hull_points.push(sorted_input_set[i])
    }
    hull_points
}
pub fn graham_scan ( input_set : & mut Vec < Point2D > ) -> Vec < Point2D > { let sorted_input_set = input_set ; //initialize the stack that will maintain the candidate points let mut hull_points : Vec < Point2D > = Vec :: new ( ) ; hull_points . push ( sorted_input_set [ 0 ] ) ; hull_points . push ( sorted_input_set [ 1 ] ) ; hull_points . push ( sorted_input_set [ 2 ] ) ; for i in 3 .. sorted_input_set . len ( ) { while ! hull_points [ hull_points . len ( ) - 2 ] . ccw ( & hull_points [ hull_points . len ( ) - 1 ] , & sorted_input_set [ i ] ) { hull_points . pop ( ) ; } hull_points . push ( sorted_input_set [ i ] ) } hull_points }
Solves the convexhull problem using Graham-Scan
This method solves the convex-hull by maintaining a stack S
of candidate points.
Solves the convexhull problem using Graham - Scan This method solves the convex - hull by maintaining a stack S of candidate points .
input_set
&mut Vec<Point2D>
input_set
&mut Vec<Point2D>