What is the most efficient algorithm to find a straight line that goes through most points?

There is likely no solution to this problem that is significantly better than O(n^2) in a standard model of computation. The problem of finding three collinear points reduces to the problem of finding the line that goes through the most points, and finding three collinear points is 3SUM-hard, meaning that solving it in less than … Read more

Find if a point is inside a convex hull for a set of points without computing the hull itself

The problem can be solved by finding a feasible point of a Linear Program. If you’re interested in the full details, as opposed to just plugging an LP into an existing solver, I’d recommend reading Chapter 11.4 in Boyd and Vandenberghe’s excellent book on convex optimization. Set A = (X[1] X[2] … X[n]), that is, … Read more

How do I efficiently determine if a polygon is convex, non-convex or complex?

You can make things a lot easier than the Gift-Wrapping Algorithm… that’s a good answer when you have a set of points w/o any particular boundary and need to find the convex hull. In contrast, consider the case where the polygon is not self-intersecting, and it consists of a set of points in a list … Read more

robust algorithm for surface reconstruction from 3D point cloud?

I have been facing this dilemma for some months now, and made exhaustive research. Algorithms Mainly there are 2 categories of algorithms: computation geometry, and implicit surfaces. Computation Geometry They fit the mesh on the existing points. Probably the most famous algorithm of this group is powercrust, because it is theoretically well-established – it guarantees … Read more

An algorithm for inflating/deflating (offsetting, buffering) polygons

I thought I might briefly mention my own polygon clipping and offsetting library – Clipper. While Clipper is primarily designed for polygon clipping operations, it does polygon offsetting too. The library is open source freeware written in Delphi, C++ and C#. It has a very unencumbered Boost license allowing it to be used in both … Read more

How to determine if a list of polygon points are in clockwise order?

Some of the suggested methods will fail in the case of a non-convex polygon, such as a crescent. Here’s a simple one that will work with non-convex polygons (it’ll even work with a self-intersecting polygon like a figure-eight, telling you whether it’s mostly clockwise). Sum over the edges, (x2 − x1)(y2 + y1). If the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)