# Tag Info

### How can I determine if two vertices on a polygon are consecutive?

As the polygon is convex, it is simple! Two vertices are consecutive if all other vertices are located on the same side of the line that goes through these two points. This means that the cross ...
• 3,572

### How can I determine if two vertices on a polygon are consecutive?

Given that the polygon is convex, its centroid $C$ is in its interior. Test the gradients of the lines $CV$ for each vertex $V$. This gives a linear time test.
• 2,082

### How can I determine if two vertices on a polygon are consecutive?

An alternative to OmG's answer (which is great) would be to sort your points into an ordered array where you can find any points neighbors by looking at the points on either side. This method would be ...
• 141
Accepted

• 201

### Is there an efficient algorithm to extract the farthest ends of a thin contour?

Run Flood Fill from any point and the farthest points in the both directions are your result. If you find that the distance in one of the directions is zero it means that it was one of them. ...
• 9,455
Accepted

### Simplex Algorithm: Why must the optimal value of the LP lie on the face or vertex of a polyhedron?

Suppose $P = \lbrace x: Ax \leq b \rbrace$ is the polyhedra, where $x \in \mathbb{R}^n$. Further assume $P$ is full dimensional, then let $x_0$ be some interior point in P. Let $c \in \mathbb{R}^n$ (...
Accepted

### Selecting a polygon within an array of complex polygons

I would use a winding number algorithm. There are a few, but the fastest goes like this:Imagine a line from your point along the positive x-axis. Now, for every edge of your polygon, determine if it ...

### Is Dual Graph of a Triangulation of a Polygon Tree?

Below is an example of a polygon with a single hole. The red area is the interior of the polygon, and the white triangle in the center is the hole (which lies outside the polygon). In the figure, I've ...
• 8,248
Accepted

### assign points to non-overlapping rectangles

Most spatial indexes should be good, especially if your rectangles are axis aligned. Spatial indexes typically have about $O(log{M})$ insertion time so you could build in index in $O(M * log{M})$. ...
• 764
Accepted

### Finding the Point with Maximum Distance from the Boundary of a Closed Polygon in 2D Euclidean Space

The medial axis is the set of points in the interior of the shape that has two closest points on the boundary. Intuitively, the largest "incircle" in a polygon must touch the boundary at at ...
• 22.1k
1 vote

### How to find simple polygons in a complex polygon created by two lines

Please take a look at the DCEL data structure, which is normally used for representation and processing of polygonal subdivisions of the plane. This data structure usually stores three kinds of ...
• 3,088
1 vote

### Euler polygon division algorithm

You can use the formula to count the number of division to generate them. Suppose you want to generate a division of a $n$-polygon whose vertices are $1, 2, …, n$. We know that there are $C_{n-2}$ ...
• 15.6k
1 vote

### Euler polygon division algorithm

See: Hurtado and Noy, Graph of triangulations of a convex polygon and tree of triangulations, Computational Geometry 13 (1999) pp179–188. Section 3 of that paper gives a relatively straightforward ...
• 22.1k
1 vote
Accepted

### Is there a computationally optimal point-in-polygon solution (for a dynamic scenario)?

I can list three candidate approaches. I'm not sure how to choose among them -- you might need to experiment among them to see which will work best in your situation. Approach #1: sweepline algorithm ...
• 159k
1 vote

### Find an edge that is completely visible from point outside a polygon (Convex Hull)

It is not too hard. connect the point to the end-point of an edge. If none of these two segments has an intersection with convex-hull, it means you can see that edge completely (as you consider a ...
• 3,572
1 vote

### Joining points of polygon in correct order

Start from the leftmost point $x_0$ (the one with minimum $x$-coordinate). If there are ties break them in favor of the point with minimum $y$ coordinate. Suppose for simplicity that there are no ...
• 29.5k
1 vote

### Efficient rasterisation of vector image with polygons

The quad tree suggestion by D.W. is interesting. I want to expand on it here. The principle of it is to break the area into big (and then progressively smaller) squares and check whether these squares ...
• 121
1 vote

### Efficient rasterisation of vector image with polygons

An alternative approach is to use a quad-tree. One approach is to store each polygon in the deepest node that corresponds to a region that wholly contains the polygon. Given a test point, you ...
• 159k
1 vote

### Convert a polygon mesh into a b-spline surface

Without any assumptions on the input mesh, you cannot in general get a single b-spline surface that replicates an arbitrary polygon mesh. You would need the mesh to be connected, but you would also ...
• 3,513
1 vote
Accepted

### Detecting rotational symmetries of spatial structures

Here is one approach to identify all rotational symmetries of the graph: Pick any three vertices, $v_1,\dots,v_3$. Loop over all possible combinations of three vertices $w_1,\dots,w_3$. For each ...
• 159k
1 vote

First, assume we already have a list $L$ with all segments in $P$ that are at least partially visible from $p$, ordered by the smallest angle $\theta$ such that a segment is visible from $p$ at angle $... • 8,248 1 vote ### Is there an efficient algorithm to extract the farthest ends of a thin contour? Build a graph, with one vertex per black pixel, and an edge between two pixels if they are adjacent. Compute all-pairs shortest-path distances$d(x,y)$. For each vertex$x$, compute$\$f(x) = \max \{...
• 159k

Only top scored, non community-wiki answers of a minimum length are eligible