How to efficiently find upper and lower hulls (w.r.t. some dimension) for Convex Hull in dimension d? - convex-hull

There are a few undefined things in the Wikipedia page like "upward ray".
A lot of explanations only deal with 2d. If you pick a dimension you can calculate the convex hull of the points with that dimension dropeed and I think that gives you the extreme points. But how do you determine (computationally, not with epsilon statements) whether the other points are above or below efficiently?
In two dimensions, the convex hull is sometimes partitioned into two
parts, the upper hull and the lower hull, stretching between the
leftmost and rightmost points of the hull. More generally, for convex
hulls in any dimension, one can partition the boundary of the hull
into upward-facing points (points for which an upward ray is disjoint
from the hull), downward-facing points, and extreme points. For
three-dimensional hulls, the upward-facing and downward-facing parts
of the boundary form topological disks.[7]

Related

Extrapolation delaunay triangulation

Shown Figure (1) is a typical Delaunay triangulation (blue) and it has a boundary line (black rectangle).
Each vertex in the Delaunay triangulation has a height value. So I can calculate the height inside convex hull. I am figuring out a method to calculate the height up to the boundary line (some sort of extrapolation).
There are two things associated with this task
Triangulate up to the boundary point
Figuring out the height at newly created triangle vertices
Anybody come across this issue?
Figure 1:
I'd project the convex hull points of the triangulation to the visible box segments and then insert the 4 box corners and the projected points into the triangulation.
There is no unique correct way to assign heights to the new points. One easy and stable method would be to assign to each new point the height of the closest visible convex hull vertex. Be careful with extrapolation: Triangles of the convex hull tend to have unstable slopes, see the large triangles in front of the below terrain image. Their projection to the xy plane has almost 0 area but due to the height difference they are large and almost 90 degrees to the xy plane.
I've had some luck with the following approach:
Find the segment on the convex hull that is closet to the extrapolation point
If I can drop a perpendicular onto the segment, interpolate between the two vertices of the segment.
If I can not construct the perpendicular, just use the closest vertex
This approach results in a continuous surface, but does not provide 1st derivative continuity.
You can find some code that might be helpful at TriangularFacetInterpolator.java. Look for the interpolateWithExteriorSupport method.

Identifying concave hull of points in higher dimension

I have a set of points(clusters) in higher dimension (30d to 100d). I need to identify concave hull of these points in an efficient manner.
Is there a way to do get the exact concave hull or atleast approximate concave hull of these set of points?
Further, if we have a set of points identified as a border point, is there a way to verify whether the points are actually border points?
In 100d, almost every point will be on the convex hull.
Just remember that a rectangle in 2d has 4 corners, but in 100d, it has 2^100 corners.
As an extremely rough approximation, take the minimum and maximum along each axis. If it is unique, the point is on the hull. For additional points, you can sample some random projections.
But again, the expected behaviour is that almost every point is on the hull, because it is the smallest or largest in some linear combination of features.

Computing the Convex Hull of two non intersecting polygon in scipy

Is there any scipy method that computes the Convex hull of two non intersecting polygon? I have 2 set of points P1 and P2 and their convex hulls CH(P1) and CH(P2), where the hulls are non intersecting. I want to find the Convex hull of union of points in P1 and P2. Is there any build in method in scipy?
Documentation for Scipy's convex hull implementation can be found here. Simply concatenate the two arrays of points to obtain their union. Feed this set to the convex hull algorithm.
Every point in each polygon lies within the convex hull of its polygon. In turn, both polygons have their convex hull contained entirely inside the larger convex hull. So, every point in each polygon lies within the larger convex hull, meaning it is also valid for the complete union of polygon points.

Finding the concavness pixel/point in binary map using Matlab

Given an binary mask with an object in Matlab. I am going to find the concavity point of the object boundary. The concavity point I mean here is the deepest concavity point with respect to the Euclidean distance to the convex hull chords K_1, K_2 ,and K_3 in the concavity regions B_1, B_2, B_3, respectively. The red dot indicates the concavity point I want to find, where in concavity region B_1 I draw three lines perpendicular to the chord K_1, the deepest concavity point is the middle one since it has the largest length.
Anyone have efficient way/code to do that? Thanks.
Another figure below gives an example with the convex hull, where the red dot indicates the valid concavity point.
Efficient is relative...
How about computing the convex hull (there are standard algorithms for it) and then shrinking it until it is completely inside the object boundaries. The last point touching is your desired concavity point.
Alternative strategy:
calculate convex hull
find all differences between convex hull and object boundary (have to be straight lines, K1 K2 K3 in your case)
for every line, rotate image such that line is horizontal
take the lowest pixel of the object boundary below the line

How do I break a polyhedron into tetrahedra in MATLAB?

I have a polyhedron, with a list of vertices (v) and surfaces (s). How do I break this polyhedron into a series of tetrahedra?
I would particularly like to know if there are any built-in MATLAB commands for this.
For the convex case (no dents in the surface which cause surfaces to cover each other) and a triangle mesh, the simple solution is to calculate the center of the polyhedron and then connect the three corners of every face with the new center.
If you don't have a triangle mesh, then you must triangulate, first. Delaunay triangulation might help.
If there are holes or caves, this can be come arbitrarily complex.
I'm not sure the OP wanted a 'mesh' (Steiner points added) or a tetrahedralization (partition into tetrahedra, no Steiner points added). for a convex polyhedron, the addition of Steiner points (e.g. the 'center' point) is not necessary.
Stack overflow will not allow me to comment on gnovice's post (WTF, SO?), but the proof of the statement "the surfaces of a convex polyhedron are constraints in a Delaunay Tesselation" is rather simple: by definition, a simplex or subsimplex is a member in the Delaunay Tesselation if and only if there is a n-sphere circumscribing the simplex that strictly contains no point in the point set. for a surface triangle, construct the smallest circumscribing sphere, and 'puff' it outwards, away from the polyhedron, towards 'infinity'; eventually it will contain no other point. (in fact, the limit of the circumscribing sphere is a half-space; thus the convex hull is always a subset of the Delaunay Tesselation.)
for more on DT, see Okabe, et. al, 'Spatial Tesselations', or any of the papers by Shewchuk
(my thesis was on this stuff, but I remember less of it than I should...)
I would suggest trying the built-in function DELAUNAY3. The example given in the documentation link resembles Aaron's answer in that it uses the vertices plus the center point of the polyhedron to create a 3-D Delaunay tessellation, but shabbychef points out that you can still create a tessellation without including the extra point. You can then use TETRAMESH to visualize the resulting tetrahedral elements.
Your code might look something like this (assuming v is an N-by-3 matrix of vertex coordinate values):
v = [v; mean(v)]; %# Add an additional center point, if desired (this code
%# adds the mean of the vertices)
Tes = delaunay3(v(:,1),v(:,2),v(:,3)); %# Create the triangulation
tetramesh(Tes,v); %# Plot the tetrahedrons
Since you said in a comment that your polyhedron is convex, you shouldn't have to worry about specifying the surfaces as constraints in order to do the triangulation (shabbychef appears to give a more rigorous and terse proof of this than my comments below do).
NOTE: According to the documentation, DELAUNAY3 will be removed in a future release and DelaunayTri will effectively take its place (although currently it appears that defining constrained edges is still limited to only 2-D triangulations). For the sake of completeness, here is how you would use DelaunayTri and visualize the convex hull (i.e. polyhedral surface) as well:
DT = DelaunayTri(v); %# Using the same variable v as above
tetramesh(DT); %# Plot the tetrahedrons
figure; %# Make new figure window
ch = convexHull(DT); %# Get the convex hull
trisurf(ch,v(:,1),v(:,2),v(:,3),'FaceColor','cyan'); %# Plot the convex hull