computational-geometry

Hausdorff Distance Between Convex Polygons

早过忘川 提交于 2019-12-07 18:58:06
问题 I'm interested in calculating the Hausdorff Distance between 2 polygons (specifically quadrilaterals which are almost rectangles) defined by their vertices. They may overlap. Recall $d_H(A,B) = \max(d(A,B), d(B,A))$ where $d$ is the Hausdorff semi-metric $d(A,B) = \sup_{a\in A}\inf_{b\in B}d(a,b)$. Is it true that, given a finite disjoint covering of $A$, ${A_i}$, $d(A,B)=\max{d(A_i,B)}$? A corollary of which is that $d(A,B)=d(A\setminus B,B)$. I have found a paper by Atallah 1 (PDF). I'm

Ideas for generating random lobulated pulmonary nodule contours

匆匆过客 提交于 2019-12-07 18:21:57
问题 I need to generate random lobulated contours such as the following Any ideas or algorithms on how to do this ?? The software I am going to use is matlab, however I have no problem if you post solutions in other languages too... p.s I only need to plot a random contour that resembles the above... 回答1: How about this? degree = 5; numPoints = 1000; blobWidth = 5; theta = 0:(2*pi)/(numPoints-1):2*pi; coeffs = rand(degree,1); rho = zeros(size(theta)); for i = 1:degree rho = rho + coeffs(i)*sin(i

calculating outward normal of a non-convex polyhedral

孤者浪人 提交于 2019-12-07 16:51:50
问题 If all nodes of a polyhedron (may be non-convex) and their coordinates are known, the points of a face are given in order (anti-clockwise or clockwise around the outward normal), how do I obtain the outward normal vector of each face? Here is a method for convex polyhedron: Computing face normals and winding How about a general polyhedron that could be non-convex? 回答1: Here is one method. Fix the orientation of one face F0 of your polyhedron P . You don't yet know if this is counterclockwise

Finding intersection between straight line and contour

倾然丶 夕夏残阳落幕 提交于 2019-12-07 13:40:16
问题 I am trying to find the intersection point of a straight(dashed red) with the contour-line highlighted in red(see plot). I used .get_paths in the second plot to isolate said contour line form the others(second plot). I have looked at a contour intersection problem, How to find all the intersection points between two contour-set in an efficient way, and have tried to use it as a base but have not been able to reproduce anything useful. http://postimg.org/image/hz01fouvn/ http://postimg.org

How to search in a Range Tree?

与世无争的帅哥 提交于 2019-12-07 13:18:53
问题 I read several slides, like this one's last page, where the describe the search algorithm. However, I have a basic question. The data lie in a 2D space. I first build a Binary Search Tree based on the x value of the points. Every inner node holds a BST based on the y value of the points that lie in the subtree of that inner node. Then I think I should search for the points that lie in the range query [x1, x2] and then check if for that points the requested [y1, y2] range query is satisfied.

How to print the faces of a Voronoi diagram?

[亡魂溺海] 提交于 2019-12-07 08:58:50
问题 Code bellow assumes input is points, not line segments (which is wrong). Following this 2D Voronoi Diagram Adaptor example, I am trying to write a program which takes as input line segments and prints the vertices of the faces of the Voronoi diagram. Here is my attempt (keeping includes/typedefs of the example): // standard includes #include <iostream> #include <fstream> #include <cassert> // includes for defining the Voronoi diagram adaptor #include <CGAL/Exact_predicates_inexact

Closest pair of points

浪子不回头ぞ 提交于 2019-12-07 08:06:13
问题 In http://en.wikipedia.org/wiki/Closest_pair_of_points_problem we can see that it mentions that is at most 6 points that is closest to the point on the other half, which can be represented as the graph below: My question is for point P1 and Point P2, the distance to the red point will exceed sqrt(2)*d, why it is part of the solution? Why it is not at most 4 points that is closest to P rather than at most 6 points? Thanks. 回答1: P1 and P2 are not part of the solution, but they have to be

Slicing a circle in equal segments, Python

时间秒杀一切 提交于 2019-12-07 02:32:14
问题 I have a set of close of 10,000 points on the sky. They are plotted using the RA (right ascension) and DEC (declination) on the sky. When plotted, they take the shape of a circle. What I would like to do is to slice the circle into 8 equal parts and remove each part one at a time and do some calculations using the remaining parts. To do so I came up with this illustration in mind, i.e. slicing them using the arcs. I know that the equation of the arc is given by: S = r * theta where r -->

Smallest circle which covers given points on 2D plane

倾然丶 夕夏残阳落幕 提交于 2019-12-07 00:47:00
问题 Problem: What is the smallest possible diameter of a circle which covers given N points on a 2D plane? What is the most efficient algorithm to solve this problem and how does it work? 回答1: This is the smallest circle problem. See the references for the links to the suggested algorithms. E.Welzl, Smallest Enclosing Disks (Balls and Ellipsoids), in H. Maurer (Ed.), New Results and New Trends in Computer Science, Lecture Notes in Computer Science, Vol. 555, Springer-Verlag, 359–37 (1991) is the

Generate Non-Degenerate Point Set in 2D - C++

扶醉桌前 提交于 2019-12-06 20:52:24
问题 I want to create a large set of random point cloud in 2D plane that are non-degenerate (no 3 points in a straight line in the whole set). I have a naive solution which generates a random float pair P_new(x,y) and checks with every pair of points (P1, P2) generated till now if point (P1, P2, P) lie in same line or not. This takes O(n^2) checks for each new point added to the list making the whole complexity O(n^3) which is very slow if I want to generate more than 4000 points (takes more than