convex-hull

How to get uniformly distributed points in convex hull?

流过昼夜 提交于 2020-06-13 00:10:20
问题 Given a set of points, points = np.random.randn(...) # n 3d points I would like to uniformly fill the volume defined by the convex hull in which they lie by a list (np.array of shape nx3 ) of 3d points. I can get the convex hull by hull = scipy.spatial.ConvexHull(points) What would be the fastest way to get a list of points that uniformly fills this hull's volume? 回答1: 1) Find delaunay simplices of the hull 2) randomly sample the simplices based on their area 3) for each simplex, find uniform

How does the algorithm of merging two convex hulls by using their tangents work in practice?

瘦欲@ 提交于 2020-04-15 08:37:19
问题 I'm trying to implement in C++ the divide and conquer algorithm of finding the convex hull from a set of two dimensional points. For simplicity let's assume that all the points are described with integers. The most important part of the algorithm is merging the two convex hulls that you have computed from previous recursive calls. This part involves finding the lower and upper tangents of the two convex hulls and then proceeding with the merging. The merging is trivial, if you have found the

Algorithm to create minimal bounding-box composition of point cloud

若如初见. 提交于 2020-03-03 06:58:03
问题 I have a set of 2D points. I want to find a set of (possibly overlapping and arbitrarily oriented) bounding-boxes for subsets of these points such that each point lies within at least one box, each box contains at least k points and such that the combined area of the boxes is minimized. One idea for an algorithm I have is: use a concave-hull algorithm to find a concave hull for the points. use convex decomposition algorithm to find a set of convex hulls. compute arbitrarily oriented minimum

Intersection of nD line with convex hull in Python

守給你的承諾、 提交于 2020-01-31 04:24:07
问题 I have created a convex hull using scipy.spatial.ConvexHull. I need to compute the intersection point between the convex hull and a ray, starting at 0 and in the direction of some other defined point. The convex hull is known to contain 0 so the intersection should be guaranteed. The dimension of the problem can vary between 2 and 5. I have tried some google searching but haven't found an answer. I am hoping this is a common problem with known solutions in computational geometry. Thank you.

Convhull in Matlab

折月煮酒 提交于 2020-01-17 15:27:11
问题 I have 3 vectors of position data : x , y and z x = [0.1524 0.1219 0.0610 0.0914 0.0610 0.1219 0.0305 0.0914 0.2134 0.0610 0.1219 0.0305 0.0610 0.1219 0.0914 0.1524 0.0610 0.1524 0.0610 0.0610 0.0610 0.0610 0.1524 0.0914 0.0610 0.1524 0.0610 0.2134 0.0610 0.0914 0.1524]; y = [0.1219 0.1524 0.0305 0.1219 0.1524 0.1524 0.0610 0.1219 0.1219 0.1524 0.1524 0.0610 0.0914 0.1524 0.1829 0.1829 0.0914 0.1829 0.2134 0.0914 0.2134 0.0914 0.1829 0.0610 0.0914 0.1829 0.0914 0.1829 0.2134 0.1219 0.1829]; z

Computing the distance to a convex hull

会有一股神秘感。 提交于 2020-01-14 12:59:23
问题 I am using the ConvexHull class of scipy to construct a convex hull for a set of points. I am interested in a way to compute the minimum distance of a new point P from the convex hull. With the help of the internet and a little tweaking by myself I came up with this formula to compute the distance of a point P or a set of points points to the convex hull facets: np.max(np.dot(self.equations[:, :-1], points.T).T + self.equations[:, -1], axis=-1) For a convex hull in 2D the equation above will

Orthogonal hull algorithm

两盒软妹~` 提交于 2020-01-13 07:22:13
问题 I am trying to find a way to determine the rectilinear polygon from a set of integer points (indicated by the red dots in the pictures below). The image below shows what I would like to achieve: 1. I need only the minimal set of points that define the boundary of the rectilinear polygon. Most hull algorithms I can find do not satisfy the orthogonal nature of this problem, such as the gift-wrapping algorithm, which produce the following result (which is not what I want)... 2. How can I get the

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

荒凉一梦 提交于 2020-01-09 18:37:09
问题 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", find_hull) plot <- ggplot(data = df, aes(x = Sepal.Length, y = Sepal.Width, colour=Species, fill = Species)) + geom_point() + geom_polygon(data = hulls, alpha = 0.5) + labs(x = "Sepal.Length", y = "Sepal.Width") plot I was wondering though how one could

Intersection of 2 polyhedra using intersectn() R

一世执手 提交于 2020-01-05 04:21:10
问题 I have 2 polyhedra generated by the following extreme points: df1 = structure(c(3, 5, 8, 6), .Dim = c(2L, 2L)) df2 = structure(c(2, 4, 9, 7), .Dim = c(2L, 2L)) Those points, taken as constraint inequalities, create a space. I would like to select the hull formed by the intersection of those 2 polyhedra. The use of the function intersectn() from the geometry package, but I get the following error. Error in convhulln(ps1, "n FA") : Received error code 1 from qhull. Qhull error: QH6214 qhull

fast dirty approximation of center of (list of 3D vertex) that forms a very shallow convex hull

寵の児 提交于 2020-01-04 14:16:40
问题 I want to find XY of the center (red) of a convex-hull points (orange circles) set that is a result from collision detection. Using separating-axis technique, I know for sure that the convex shape (pink) is relatively thin in Z-axis . In >90% of my use cases, the amount of vertices is not more than 8. My poor algorithm (AABB) ... MCVE I tried to implement it by calculating the center point of AABB. However, when I use it in real Physics simulation, the collision point (red) is not accurate