Question: I need help to Implement the GRAHAM'S SCAN algorithm using JSXGraph. Through Code: ConvexHull.html This part of the code I have to change in order

I need help to Implement the GRAHAM'S SCAN algorithm using JSXGraph. Through Code: ConvexHull.html This part of the code I have to change in order to run the convex hull in a board /* The Graham's scan function */

function findConvexHull(board) {

var N = 0, P = {};

for(var el in board.objects)

if(board.objects[el].elType == 'point') {

P[N] = board.objects[el];

N++; }

// sort the point set P; to obtain the x-coordinate of 'p', simply use 'p.X()' and similarly you can use 'p.Y()' for the y-coordinate

// run Graham's scan to obtain the convex hull points in some order (clockwise/anticlokwise)

// draw line segments between the convex hull points to obtain the final convex polygon; to draw line segment you can simply

// use --> board.create('segment',[p1,p2],{fillColor: 'green',strokeColor:'green'}); where p1,p2 are the two end-points

}

I have to turn in a .html file

Thanks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!