Convex Hull Calculator
What this convex hull calculator does
A convex hull is the smallest convex boundary that contains every point in a set. If you imagine hammering pegs into a board and stretching a rubber band around the outermost pegs, the shape traced by the band is the convex hull. This calculator takes a list of planar coordinates, applies the Jarvis March method, and returns the boundary vertices in wrap order. In plain language, it finds the points that actually matter for the outside fence and ignores points that sit safely inside that fence.
That sounds abstract at first, but the idea turns up everywhere. A hull can approximate a region on a map, define an outer safety envelope around sensors, summarize a cloud of sample points, or simplify a shape before later measurements are taken. The result here is intentionally simple: the output is a list of points, one per line, ordered around the outside. That makes it easy to plot, inspect, or pass into another workflow that needs the extreme boundary rather than every interior coordinate.
How to enter coordinates clearly
Enter one point per line, using either a space or a comma between the x-value and the y-value. So 3 5, 3,5, and 3, 5 are all acceptable. Negative values and decimals are fine. The calculator does not impose a unit, which means your coordinates can represent meters, pixels, kilometers, or any other consistent planar measure. The key word is consistent. If x is measured in meters, y should also be measured in meters; if one axis is pixels and the other is centimeters, the geometry is no longer meaningful.
The tool needs at least three valid points to attempt a hull. Duplicates do not help, and they may produce repeated candidates that are still filtered out by the outer-boundary logic. If all points lie on a single straight line, the boundary is degenerate rather than polygonal, so the returned hull may collapse to the extreme endpoints. That is not a bug. It reflects the geometric fact that a line of collinear points does not enclose area even though it still has a well-defined outer extent.
How Jarvis March builds the hull
This page uses Jarvis March, often called the gift wrapping algorithm. The name is memorable because the process feels like wrapping paper around the outside of a scattered set of points. The algorithm starts from a leftmost point. From there, it searches for the next point that makes every other point stay on the same side of the candidate edge. Once that next boundary point is chosen, the search repeats from the new location. The hull grows one edge at a time until the walk returns to the starting point.
Jarvis March is especially readable for education because each step has a clear geometric meaning: choose the next extreme turn. Its running time is commonly described as O(nh), where n is the number of input points and h is the number of points on the hull. That makes it attractive when the hull itself is relatively small compared with the full dataset. Even if you never use the complexity formula directly, the practical takeaway is simple: the calculator checks all points while selecting each hull vertex, so bigger clouds naturally take more work than small examples.
The geometric test behind each step
The heart of the method is an orientation test. For a current point A, a candidate point B, and another point C, the algorithm looks at the sign of a two-dimensional cross product. The sign tells you whether C lies to one side of the directed segment from A to B or the other. This specific implementation updates the candidate whenever the cross-product value is negative, and when three points are collinear it keeps the farther point so the walk stays on the true outside edge.
In a broad sense, many calculators can be summarized as a result function applied to inputs. The generic pattern below is preserved because it still describes the overall structure of turning input values into an output, even though this page ultimately uses a geometric algorithm rather than a single weighted total:
Likewise, the weighted-sum form below is a useful reminder that many scientific tools combine components after assigning different importance or scale factors. It is not the convex hull rule itself, but it helps frame how calculators transform raw entries into structured results:
For this convex hull calculator, the actual orientation rule is better written explicitly. If A, B, and C are three points, then the signed area test is:
If the result changes sign, the turning direction changes. If the result is zero, the points are collinear, and this implementation keeps the farther point so the hull does not stop early on an interior point that happens to line up with the true boundary. That detail matters more than it may first appear. Without the distance tie-breaker, a line of edge points could cause the hull to clip inward instead of tracing the full outer extent.
Worked example
Suppose you enter the following points: (0,0), (4,0), (4,3), (0,3), (2,1), (1,2), and (2,2). Four of those points are the corners of a rectangle, and three lie inside it. The hull should therefore contain only the four corners. The algorithm begins at a leftmost point. In this dataset that is (0,0) or (0,3), depending on how ties appear in the input order. From that start, the method scans all points to find the next boundary vertex. It continues walking around the outside until it returns to the beginning.
With the sample order used by the button below, the returned hull is typically:
(0,0) (4,0) (4,3) (0,3)
The points (2,1), (1,2), and (2,2) do not appear because they are interior points. They never become corners of the outer fence. That is exactly the value of a hull: it compresses a noisy cloud into the smallest set of coordinates that still define the outside shape. If you plotted all seven points, the hull polygon would contain all of them, but only the four corners would be needed to reproduce the boundary.
| Point | Role in the example | Why it is kept or discarded |
|---|---|---|
| (0,0) | Hull vertex | Extreme lower-left corner of the cloud. |
| (4,0) | Hull vertex | Extreme lower-right corner and next wrap point along the boundary. |
| (2,1) | Interior point | Inside the rectangle, so it never defines the outer fence. |
When you test your own data, the same interpretation applies. If a point does not appear in the result, that does not mean the point was invalid; it usually means the point lies inside the hull or along an edge where another farther collinear point already covers the outside boundary. That distinction is useful when you are simplifying data for later use.
How to read the result
The result box lists hull vertices one per line in wrap order. Order matters. If you connect the listed points in sequence and then connect the last one back to the first, you obtain the outer polygon found by the algorithm. Because the output is a boundary description rather than a single numeric summary, the best sanity check is visual: plot the returned points and confirm that the path encloses every input point without cutting through the cloud.
This calculator does not directly compute area, perimeter, centroid, or a bounding box. However, the hull it returns is exactly the right starting point if you want to compute those later. In many workflows, that separation is helpful. First reduce the dataset to the essential boundary, then run downstream measurements on the simplified polygon. That approach is common in mapping, clustering, robotics, computer vision, and quick shape summaries where the full interior cloud is more detail than the next step actually needs.
Assumptions and limitations
The calculator assumes ordinary two-dimensional Cartesian coordinates. If your data are latitude and longitude on the Earth, you may want a map projection first, because geometric operations on raw spherical coordinates can be misleading over large distances. The parser also assumes each usable line contains two numeric values. Extra numbers on a line are ignored by the filter only if the first two values still parse correctly, so a clean two-number format is the safest way to avoid accidental input ambiguity.
Like most browser tools, the calculation uses standard floating-point arithmetic. For typical educational and practical point sets, that is perfectly fine. Very large values, nearly identical coordinates, or heavily repeated points can make edge cases harder to interpret, especially when several points are almost collinear. The implementation also chooses its starting point by scanning for a leftmost x-value, then wraps from there. That is consistent and useful, but it means a different input order can affect which tied leftmost point becomes the first listed vertex even when the hull shape itself is unchanged.
One more limitation is worth stating clearly: a convex hull is always convex. If your real shape has bays, holes, inward dents, or narrow passages, the hull will intentionally span across those details. In other words, it answers the question, what is the smallest convex enclosure, not the question, what is the exact original outline. For rough envelopes that is a strength. For detailed boundary reconstruction, you would need a different tool.
Why convex hulls matter in practice
Convex hulls are one of the foundational ideas in computational geometry because they convert a cloud of many points into a clean outer story. Survey points can be turned into a quick envelope. Sampled positions from a robot can be summarized into reachable space. Pixel coordinates from a segmented object can be reduced to a boundary before later shape analysis. Financial or engineering datasets can also use hull ideas conceptually when identifying extreme scenarios or dominated alternatives. In every case, the common theme is the same: the outside points tell a story that the interior points alone cannot.
If you want an intuition check before relying on your own data, use the sample dataset, compute the hull, and compare the output to the narrative example above. Then try adding an obviously interior point and note that the result does not change. After that, move one corner outward and watch how the hull updates immediately. Those quick experiments are the fastest way to build trust in both the input format and the algorithmic logic.
Mini-game: Gift Wrap Sprint
Want a more hands-on intuition for the algorithm? This optional mini-game turns the same convex hull idea into a fast arcade challenge. You start from the glowing leftmost point, then race to choose the next outside vertex before time runs out. The later rounds add drift and pressure, which makes the difference between true boundary points and tempting interior points much easier to feel than to memorize.
Best score: 0. Educational takeaway: a convex hull keeps only the extreme boundary points; interior points never become fence corners.
