Questions tagged [convex-hull]

Convex-hull of a set of points X in a Euclidean space is the convex set with smallest area that contains all points of X.

538 questions
12
votes
1 answer

intersecting svg closed paths

What is a good way (both code-wise and performance-wise) to test if two shapes drawn by svg path is intersecting? I am doing this in d3 and is using the "cardinal-closed" line interpolation More specifically, I am creating convex hulls (more complex…
swenedo
  • 3,074
  • 8
  • 30
  • 49
11
votes
2 answers

Convexity defects C++ OpenCv

I would be grateful to you if you could help me with this issue :) Relating to this question cvConvexityDefects in OpenCV 2.X / C++?, I have the same problem. The OpenCV C++ wrapper has not the function cvConvexityDefects that appears in the C…
cabreracanal
  • 924
  • 1
  • 14
  • 36
11
votes
2 answers

Check if points lies inside a convex hull

I am making a convex hull using the scipy.spatial package http://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html#scipy.spatial.ConvexHull I've tried searching, but have yet to know if there is an easy way to find if any…
bjornasm
  • 2,211
  • 7
  • 37
  • 62
11
votes
2 answers

How to convert the half-spaces that constitute a convex hull to a set of extreme points?

I have a convex set in a Euclidean space (3D, but would like answers for nD) that is characterized by a finite set of half-spaces (normal vector + point). Is there a better algorithm to find the extreme points of the convex set other than compute…
Gyro Gearloose
  • 1,056
  • 1
  • 9
  • 26
10
votes
1 answer

How to fill an area within a polygon in Python using matplotlib?

Here is a code I tried: from scipy.spatial import ConvexHull points = np.random.rand(30, 2) # 30 random points in 2-D hull = ConvexHull(points) import matplotlib.pyplot as plt %matplotlib inline corners=[] for simplex in hull.simplices: …
Nataly
  • 323
  • 2
  • 10
10
votes
1 answer

Convex hull ggplot using data.tables in R

I found a nice example of plotting convex hull shapes using ggplot with ddply here: Drawing outlines around multiple geom_point groups with ggplot I thought I'd try something similar--create something like an Ashby Diagram--to practice with the…
Docuemada
  • 1,703
  • 2
  • 25
  • 44
10
votes
4 answers

How to compute Convex Hull in C#

How to compute the convex hull starting from collection of points? I am looking for an implementation of Convex hull algorithm in C#
Owen
  • 4,063
  • 17
  • 58
  • 78
9
votes
3 answers

Sublinear but simple Dynamic Convex Hull algorithm?

I need to solve dynamic convex hull algorithm problem, i.e. maintaining the convex hull of 2D points, where I can add and delete points. The naive approach is clearly O(N); whenever one of the N points is added/deleted, we recompute the convex hull…
9
votes
2 answers

Alpha shapes in 3D

Is there an "alpha shape" function in 3 dimensions in python, other than the CGAL python bindings? Alternatively, is there a way to extend the example below into 3D? 2D example: draw a smooth polygon around data points in a scatter plot, in…
skytaker
  • 4,159
  • 1
  • 21
  • 31
8
votes
2 answers

How do I find the surface between lines based on intercept and slope which includes the origin?

I'm looking for a way to visualize the surface between a number of straight lines, which are defined in a dataframe through their intercepts and slopes. The surface I am looking for is the one that encloses the origin (0, 0). The number of lines may…
nico.sch
  • 75
  • 7
8
votes
4 answers

Getting the points belonging to the convex hull

I have a binary image of one granule in Matlab. I can find the convex hull of the granule with the following function: [K, V] = convhull(granule); How can I find all pixels which belong to the convex hull, but don't belong to the granule in the…
user2738748
  • 1,106
  • 2
  • 19
  • 36
8
votes
2 answers

R: adding alpha bags to a 2d or 3d scatterplot

I know that in ggplot2 one can add the convex hull to a scatterplot by group as in library(ggplot2) library(plyr) data(iris) df<-iris find_hull <- function(df) df[chull(df$Sepal.Length, df$Sepal.Width), ] hulls <- ddply(df, "Species",…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
8
votes
1 answer

Convex hull in higher dimensions, finding the vertices of a polytope

Suppose I have a point cloud given in 6-dimensional space, which I can make as dense as needed. These points turn out to lie on the surface of a lower-dimensional polytope (i.e. the point vectors (x1, x2, ... x6) appear to be coplanar). I would…
7
votes
3 answers

Java: Finding the Outermost Vertices of a Convex Polygon

Original post: I'm trying to find the outermost vertices of a convex polygon (with relation to a point P outside the polygon). For now, I'm only concerned with rectangles (however, I'd like an algorithm that works with any convex polygon). My plan…
Peter
  • 4,021
  • 5
  • 37
  • 58
7
votes
2 answers

Scipy ConvexHull and QHull: rank/dimension is not maximal

I am trying to create a Convex Hull using the library Scipy and ConvexHull. As far as I know, it calls QHull. The problem appears when the points I want to add do not have 'full dimension'. Example: from scipy.spatial import ConvexHull import numpy…
1
2
3
35 36