computational-geometry

Simplified (or smooth) polygons that contain the original detailed polygon

跟風遠走 提交于 2019-11-28 16:43:33
问题 I have a detailed 2D polygon (representing a geographic area) that is defined by a very large set of vertices. I'm looking for an algorithm that will simplify and smooth the polygon, (reducing the number of vertices) with the constraint that the area of the resulting polygon must contain all the vertices of the detailed polygon. For context, here's an example of the edge of one complex polygon: My research: I found the Ramer–Douglas–Peucker algorithm which will reduce the number of vertices -

FInd overlapping appointments in O(n) time?

孤街醉人 提交于 2019-11-28 16:34:23
I was recently asked this question in an interview. Even though I was able to come up the O ( n ²) solution, the interviewer was obsessed with an O ( n ) solution. I also checked few other solutions of O ( n log n ) which I understood, but O ( n ) solution is still not my cup of tea which assumes appointments sorted by start-time. Can anyone explain this? Problem Statement: You are given n appointments. Each appointment contains a start time and an end time. You have to retun all conflicting appointments efficiently. Person: 1,2, 3, 4, 5 App Start: 2, 4, 29, 10, 22 App End: 5, 7, 34, 11, 36

Algorithm to compute a Voronoi diagram on a sphere?

南笙酒味 提交于 2019-11-28 16:06:03
I'm looking for a simple (if exists) algorithm to find the Voronoi diagram for a set of points on the surface of a sphere. Source code would be great. I'm a Delphi man (yes, I know...), but I eat C-code too. Jason S Here's a paper on spherical Voronoi diagrams . Or if you grok Fortran (bleah!) there's this site . Update in July 2016: Thanks to a number of volunteers (especially Nikolai Nowaczyk and I), there is now far more robust / correct code for handling Voronoi diagrams on the surface of a sphere in Python. This is officially available as scipy.spatial.SphericalVoronoi from version 0.18

Circular approximation of polygon (or its part)

混江龙づ霸主 提交于 2019-11-28 14:16:45
SHORT DESCRIPTION OF MY PROBLEM I need to implement GCODE autorefactoring from G1 instructions to G2 and G3 ( http://www.cnccookbook.com/CCCNCGCodeArcsG02G03.htm ) for 3D Printing. G1 is a movement in straight line with printing (path is describe by vector). I'm searching for algorytm to aproxymate circle/arc (specialy it's midpoint) based on given vectors path. Note that G2 and G3 can't print curves that are not part of a circle - so not every vectors path can be approximate this way. LONG DESCRIPTION OF MY PROBLEM I'm searching way to approximate part (or all) of vectors path (can be regular

Graham scan issue at high amount of points

大城市里の小女人 提交于 2019-11-28 11:32:27
I have an issue in graham scan algorithm when my list have a lot of points, but works every time fine with low amount of points. I made some screenshots : working : (300 points) not working (5000 points) angle calculation: public static double angle(MyVector3D vec1, MyVector3D vec2) { return Math.Atan2(vec2.Y - vec1.Y, vec2.X - vec1.X) * 180 / Math.PI; } sorting points by polar angle depend on max Y point : //bubblesort private void sortList() { double temp = 0.0; MyVector3D tempVector = new MyVector3D(); for (int i = 1; i < points.Count; i++) { for (int j = 1; j < points.Count - 1; j++) { if

Detecting arbitrary shapes

时光毁灭记忆、已成空白 提交于 2019-11-28 11:27:24
Greetings, We have a set of points which represent an intersection of a 3d body and a horizontal plane. We would like to detect the 2D shapes that represent the cross sections of the body. There can be one or more such shapes. We found articles that discuss how to operate on images using Hough Transform, but we may have thousands of such points, so converting to an image is very wasteful. Is there a simpler way to do this? Thank you In converting your 3D model to a set of points, you have thrown away the information required to find the intersection shapes. Walk the edge-face connectivity

Spherical space constrained delaunay triangulation [closed]

流过昼夜 提交于 2019-11-28 10:34:44
For the purposes of implementing a high-performance dynamic pathfinding algorithm on a sphere (in C++), I'm interested in performing an incremental constrained delaunay triangulation on the surface of a sphere. Existing libraries do not seem to be sufficient - the closest that I've been able to find so far is CGAL, which has the topological space right but the metric space wrong. The library should have: Reasonable performance (I have about 100k points to put into it) Spherical topological and metric space (honestly, this overrules #1 by a wide margin) Incremental point insertion and deletion

How can I detect the maximum-sized rectangle that I can draw onto the mask?

99封情书 提交于 2019-11-28 10:13:44
I'm making an image processing project and I have stuck in one the project's steps. Here is the situation; This is my mask: and I want to detect the maximum-sized rectangle that can fit into this mask like this. I'm using MATLAB for my project. Do you know any fast way to accomplish this aim. Any code sample, approach or technique would be great. EDIT 1 : The two algorithms below are works with lot's of the cases. But both of them give wrong results in some difficult cases. I'am using both of them in my project. This approach starts with the entire image and shrinks each border in turn pixel

Search in locality sensitive hashing

杀马特。学长 韩版系。学妹 提交于 2019-11-28 09:35:13
问题 I'm trying to understand the section 5. of this paper about LSH, in particular how to bucket the generated hashes. Quoting the linked paper: Given bit vectors consisting of d bits each, we choose N = O(n 1/(1+epsilon) ) random permutations of the bits. For each random permutation σ, we maintain a sorted order O σ of the bit vectors, in lexicographic order of the bits permuted by σ. Given a query bit vector q, we find the approximate nearest neighbor by doing the following: For each permu-

Approximate a curve with a limited number of line segments and arcs of circles

自作多情 提交于 2019-11-28 05:28:38
问题 Is there any algorithm that would allow to approximate a path on the x-y plane (i.e. an ordered suite of points defined by x and y) with a limited number of line segments and arcs of circles (constant curvature)? The resulting curve needs to be C1 (continuity of slope). The maximum number or segments and arcs could be a parameter. An additional interesting constraint would be to prevent two consecutive circles of arcs without an intermediate line segment joining them. I do not see any way to