Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Brute-Force convex hull: (a) Implement the brute force algorithm described in class to compute the convex hull of a set of points in 2D space.

Brute-Force convex hull:

(a) Implement the brute force algorithm described in class to compute the convex hull of a set of points in 2D space. Create a method that takes an ArrayList of Point objects (java Point class can be used) and returns an ArrayList of points on the convex hull.

(b) Verify running time by generating arrays of Point objects of varying sizes. The points should have a random x and y coordinate values. Hints:

To verify that your implementation is correct, test your code by drawing the points of the input array using StdDraw. You can then draw the points of the convex hull with a different color. The code for this can be used for problem 3 as well. (note that you don't need to draw the output when you are trying to determine running time since the arrays will be of large size).

In order to determine if vectors between three points p1, p2, p3 are a left turn, you can use the following pseudocode (to determine if points form a right turn the value of the cross product will be negative): isLeftTurn(Point p1, Point p2, Point p3) v1x = p2.x - p1.x v1y = p2.y - p1.y v2x = p3.x - p2.x v2y = p3.y - p2.y return v1x * v2y - v1y * v2x > 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago