This is the pseudocode for the algorithm I implemented in my program to compute 2D convex hulls. I chose this incremental algorithm, which adds the points one by one and updates the solution after each point added. We must ensure that every turn (walking from vertex to vertex is a turn) is a right turn, so we take the last 3 points at the current point of the solution and determine if they make a right turn. Using the last 3 points p0, p1, and p2, we can determine if they make a right or left turn by calculating the cross product of the two vectors p0-p1 and p2-p1. Since it’s a 2D x-y plane, the z coordinate of the cross product is the only nonzero value. If this component is positive, the second vector is to the left of the first, and if
*…show more content…*

In this case (1, 1) and (3,3) are part of the convex hull, but not (2,2) since it’s along the same line and is in the middle. In this case, the values (1,1), (2,1), and (3,1) all have the same x-coordinate which can cause problems in the algorithm if not handled correctly. A general way to order the convex hull points is simply by x-coordinate, so if two points shared that x-coordinate, the ordering system is defined poorly. This was fixed by ordering the points in a lexicographical way, such that if two points have the same x-coordinate, they will be further sorted by the y coordinate. I’ve done this type of sorting in my code. This is an example with 20 points with the x and y coordinates ranging from 0-20. As you can see from the graph, the convex hull is correctly computed and the output is all the vertices of the hull in a clockwise ordering. This is another regular case example with 10 points, with the x and y coordinates ranging from 0-10. As you can see from the graph to the right, the convex hull is correctly computed with exactly 5 vertices, just like the algorithm’s output with the points listed in a clockwise fashion. I’ve tested my algorithm with various numbers of points (input) to analyze the performance. For inputs with less than 100,000 points, the algorithm only takes about a second to complete. The algorithm starts taking 30 seconds around an input of 1,000,000 points. For

Related

- Good Essays
## Cookies Portfolio: Unit Problem

- 1219 Words
- 5 Pages

The diagram below shows the feasible region of the intersection of two lines. This means that any point within the feasible region satisfies all constraints that we established before graphing. Feasible regions make it easier for us to determine the maximum profit and now we know all the possible combinations it’s important to know what point on the graph is going to be the most profitable.

- 1219 Words
- 5 Pages

Good Essays - Satisfactory Essays
## USATestprep Math Answer Key: Number and Operations

- 1482 Words
- 6 Pages

This is the name for one of the line segments which make up a polygon.

- 1482 Words
- 6 Pages

Satisfactory Essays - Decent Essays
## Nt1310 Unit 3

- 445 Words
- 2 Pages

The area in question is located on the lawn between Powell Residence Hall and Weinbach Ave and across from Hale Residence Hall. The known elevation is 380’ and is located on the sidewalk outside Powell. First using the Total Station, our group gathered the information for the distances between points. With one person holding the prism reflector and another operating the Total Station, the distance between two points can be measured. Each set is measured multiple times with an average taken. The averages between points 1 and 2 is 96. 930 ft., 2 and 3 is 120.267 ft., 3 and 4 is 103.528 ft., and 4 and 1 is 99.597 ft. Next with the Total Station, the angles can be measured between points. The zero line is set, then the rod person moves clockwise to the

- 445 Words
- 2 Pages

Decent Essays - Satisfactory Essays
## Nt1310 Unit 6 Lab Report

- 195 Words
- 1 Pages

You do this because, all points have been translated in a straight line, in the same direction (the direction is [7 -1]) by the same distance, the new figure A'B'C'D' would have the same shape, same orientation and same size as the original image. It would just be in a different location on the graph. If you were to join A with A', B with B', and so on, you would see that all 4 of the vectors are parallel and are all equal length.

- 195 Words
- 1 Pages

Satisfactory Essays - Decent Essays
## Nt1310 Unit 6 Lab Report

- 367 Words
- 2 Pages

In this step, we take as input the graph $\overline{G} = (V, \overline{E})$ from the previous step and return graph $\widetilde{G}$ which has both both direct and CC links. The Figure \ref{top_cc} shows the output of step 2. In this graph, direct links $\overline{v_i v_j} \in E$ are shown in black and the CC links $\widetilde{v_i v_j} \in \overline{E}$ are shown in gray. Note that, the CC links are unidirectional, that is, the existence of $\widetilde{v_i v_j} \in \overline{E}$ does not imply $\widetilde{v_j v_i} \in

- 367 Words
- 2 Pages

Decent Essays - Good Essays
## Hieronymus Bosch: Garden Of Earthly Delights

- 974 Words
- 4 Pages

It appears that Bosch uses line to draw your attention to the center of each panel. He used the lines of the body of water in the

- 974 Words
- 4 Pages

Good Essays - Satisfactory Essays
## Nt1310 Unit 3 Rank Case Study

- 298 Words
- 2 Pages

Attending to the average accuracy results, the highest accuracy obtained by the Hassanat distance which achieved the first rank in all noise levels, followed by Lorentzian distance. The Lorentzian distance achieved the second rank only at level noise 10 %, 30%, 40%, 50%, 80% and 90%, but at level noise 20%, 60%, and 80% outperformed by Canberra distance and at level noise 40 %, it outperformed by Manhattan distance, where these distances, Canberra and Manhattan achieved the second rank in theses level of noise. The Canberra distance achieved the third rank at a level of noise 80% and 50%, 40%, 30% and 10 %. This distance at level noise 10 % was equivalent to the Square chi-square distance in the result. At a level of noise 90%, the

- 298 Words
- 2 Pages

Satisfactory Essays - Good Essays
## Bis 155 Week 2 Quiz Data Analysis with Spreadsheets with Lab

- 1309 Words
- 6 Pages

Evaluates a condition and returns one value if the condition is true and a different value if the condition is false

- 1309 Words
- 6 Pages

Good Essays - Satisfactory Essays
## False Easting Means

- 134 Words
- 1 Pages

Those irregularly shaped (blank) polygons breaking up the PLSS grid north of the Columbia are: [2]

- 134 Words
- 1 Pages

Satisfactory Essays - Decent Essays
## Research Paper On Import Numpy

- 615 Words
- 3 Pages

import numpy import matplotlib.pyplot as plt class Sphere: def __init__(self): z=1 def add(self, points, radius, color): return dict(type='sphere', points=numpy.array(points), radius=numpy.array(radius), color=numpy.array(color), reflection=.5) def intersect(self, e, s, pos, Rad): # Check for intersects A = numpy.dot(s, s) B = 2 * numpy.dot(s, (e - pos)) C = numpy.dot((e - pos), (e - pos)) - Rad * Rad delta =

- 615 Words
- 3 Pages

Decent Essays - Satisfactory Essays
## Apply Viola-Jones Case Analysis

- 62 Words
- 1 Pages

Using RANSAC, find homography between the two sets of points and identify the face region.

- 62 Words
- 1 Pages

Satisfactory Essays - Good Essays
## Sierpinski Triangle Essay

- 1136 Words
- 5 Pages

Of course, this would only be a true Sierpinski Triangle if you were to repeat these steps an infinite number of times. So, realistically, this method only creates an image that resembles the Sierpinski Triangle.

- 1136 Words
- 5 Pages

Good Essays - Decent Essays
## Acc564 Week 5 Homewrk

- 2054 Words
- 9 Pages

In this case, it checks the cell containing the plane code to verify that it is only 1 letter. If the test is true, no error message is displayed (the second argument of the IF statement has two double-quotes). If the test is false, it displays the error message in the third argument of the IF function.

- 2054 Words
- 9 Pages

Decent Essays - Good Essays
## Different Ways Of Solving The Travelling Salesperson Problem

- 1209 Words
- 5 Pages

G(1,V-{1}) = min { C(1,k) + G(k, V-{k,1})} where k is from the set V-{1}

- 1209 Words
- 5 Pages

Good Essays - Good Essays
## Xcp : X Coordinate Control Point

- 772 Words
- 4 Pages

xcp: x-coordinate control point ycp: y-coordinate control point x: x-coordinate of aerofoil (panel boundary point) y: y-coordinate of aerofoil (panel boundary point) xc: x-coordinate control point yc: y-coordinate control point t: panel angle with respect to horizontal s: panel length g: dimensionless circulation density at boundary point Vd: velocity parallel to panel (non-dimensional)

- 772 Words
- 4 Pages

Good Essays