computational-geometry

Convex Hull in O(n) time if each coordinate of each point is a rational number

北城余情 提交于 2019-12-06 07:34:54
Show that the convex hull of n points in the plane can be computed in O(n) time if each coordinate of each point is a rational number of the form p/q , with bounded values for p and q. Note: This is a homework problem. I can just think of using Jarvis March by somehow avoiding the scan of all points. Maybe this can be done by throwing rays in fixed directions (using the rational condition) to check where the next point exists . Don't use Jarvis March since it has time complexity of O(nh) . In the worst case, h may be as large as n . Note that h is the number of points on the hull. Instead, you

Calculate equidistant point with minimal distance from 3 points in N-dimensional space

六眼飞鱼酱① 提交于 2019-12-06 07:18:28
I'm trying to code the Ritter's bounding sphere algorithm in arbitrary dimensions, and I'm stuck on the part of creating a sphere which would have 3 given points on it's edge, or in other words, a sphere which would be defined by 3 points in N-dimensional space. That sphere's center would be the minimal-distance equidistant point from the (defining) 3 points. I know how to solve it in 2-D (circumcenter of a triangle defined by 3 points), and I've seen some vector calculations for 3D, but I don't know what the best method would be for N-D, and if it's even possible. (I'd also appreciate any

Boost Geometry and exact point types

我与影子孤独终老i 提交于 2019-12-06 07:13:52
问题 I am currently working on a project which deals with geometric problems. Since this project will be used commercially I cannot use libraries like CGAL. I am currently using boost::geometry with inexact types but I encountered numeric issues. I tried to simply use an exact point type from boost::multiprecision but it doesn't compile when I call boost::geometry functions. I found this page which shows how to use a numeric_adaptor to use boost::geometry with exact number types. However, it seems

Largest triangle in convex hull

荒凉一梦 提交于 2019-12-06 07:09:28
问题 The question has already been answered, but the main problem I am facing is in understanding one of the answers.. From https://stackoverflow.com/a/1621913/2673063 How is the following algorithm O(n) ? It states as By first sorting the points / computing the convex hull (in O(n log n) time) if necessary, we can assume we have the convex polygon/hull with the points cyclically sorted in the order they appear in the polygon. Call the points 1, 2, 3, … , n. Let (variable) points A, B, and C,

Width of an arbitrary polygon

試著忘記壹切 提交于 2019-12-06 06:13:31
I need a way to characterize the size of sets of 2-D points, so I can determine whether to render them as individual points in a space or as representative polygons, dependent on the scale of the viewport. I already have an algorithm to calculate the convex hull of the set to produce the representative polygon, but I need a way to characterize its size. One obvious measure is the maximum distance between points on the convex hull, which is the diameter of the set. But I'm really more interested in the size of its cross-section perpendicular to its diameter, to figure out how narrow the

Compose two rotations in D3 geo projection?

 ̄綄美尐妖づ 提交于 2019-12-06 05:58:05
Having fun with D3 geo orthographic projection to build an interactive globe, based on all the great examples I found. You can see my simple mockup at http://bl.ocks.org/patricksurry/5721459 I want the user to manipulate the globe like a trackball ( http://www.opengl.org/wiki/Trackball ). I started with one of Mike's examples ( http://mbostock.github.io/d3/talk/20111018/azimuthal.html ), and improved slightly to use canvas coordinates and express the mouse locations in 'trackball coordinates' (i.e. rotation around canvas horizontal and vertical axes) so that a fixed mouse movement gives more

Algorithm to find intersections in a polar plane

China☆狼群 提交于 2019-12-06 05:55:07
I have a polar plane relative to a base point (colored green in the diagram below). The points and segments are represented thus: class Node { int theta; double radius; } class Segment { //each segment must have node that is northern relative to other Node northern; Node southern; } I want to figure out if the red line going from the base point to each segment node intersects any other segment. In this example, the red line does intersect. What algorithmic approach should I apply? Computational complexity is less important than simplicity of implementation. If you are striving for simplicity

How to find the nearest line segment to a specific point more efficently?

为君一笑 提交于 2019-12-06 05:54:07
问题 This is a problem I came across frequently and I'm searching a more effective way to solve it. Take a look at this pics: Let's say you want to find the shortest distance from the red point to a line segment a n . Assume you only know the start/end point (x,y) of the segments and the point. Now this can be done in O(n), where n are the line segments, by checking every distance from the point to a line segment. This is IMO not effective, because in the worst case there have to be n-1 distance

Autonomous seam detection in Images on matlab

女生的网名这么多〃 提交于 2019-12-06 04:12:04
问题 I'm trying to detect seams in welding images for an autonomous welding process. I want to find pixel positions of the detected line (the red line in the desired image) in the original image. I used the following code and finally removed noise from the image to reach the result below. clc,clear,clf; im = imread('https://i.stack.imgur.com/UJcKA.png'); imshow(im);title('Original image'); pause(0.5); sim = edge(im, 'sobel'); imshow(sim);title('after Sobel'); pause(0.5); mask = im > 5; se = strel(

Surface reconstruction from 2 planar contours [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-06 03:36:12
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . There is a class of algorithms for triangulation between two planar contours. These algorithms try to make a "good triangulation" to fill a space between these contours: One of them (Optimal surface reconstruction from planar contours) is based on the dynamic programming