Identify surface points in a point cloud - math

imagine you have a point cloud of a 3D object, where you have points on the surface of the object as well as points from inside the object.
Is there a way to know which points lie on the surface, and which are inside if you don’t have that information?
I tried looking at how stl models do it but no luck!

Related

How to compute a 2-D embedding from a distance matrix?

I would like to draw a map of NYC where the distances between neighborhoods are scaled by transit time. I computed a distance matrix using the Google Maps Distance Matrix API for public transit.
To visualize it, I tried embedding using sklearn.manifold.MDS (metric MDS) and then making a scatter plot. This works kind of ok. Unfortunately, the axes are rescaled as part of this process, and I would like to provide a scale that reflects the raw transit time. In addition, the orientation of the points does not influence the fit, but for drawing a map, it would be nice if I could specify the orientation.
Does anyone have other methods that would be a better fit for my problem? I thought about fixing some reference points and using them to triangulate the remaining points on a map, but I don't know of an off-the-shelf way to do this.

How to use delaunay trianglation in 3d points?

I understand how to use delaunay triangulation in 2d points?
But how to use delaunay triangulation in 3d points?
I mean I want to generate surface triangle mesh not tetrahedron mesh, so how can I use delaunay triangulation to generate 3d surface mesh?
Please give me some hint.
To triangulate a 3D point cloud you need the BallPivoting algorithm: https://vgc.poly.edu/~csilva/papers/tvcg99.pdf
There are two meanings of a 3D triangulation. One is when the whole space is filled, likely with tetrahedra (hexahedra and others may be also used). The other is called 2.5D, typically for terrains where the z is a property as the color or whatever, which doesn't influence the resulting triangulation.
If you use Shewchuk's triangle you can get the result.
If you are curious enough, you'll be able to select those tetrahedra that have one face not shared with other tetrahedra. These are the same tetrahedra "joined" with infinite/enclosing points. Extract those faces and you have your 3D surface triangulation.
If you want "direct" surface reconstruction then you undoubtly need to know in advance which vertices among the total given are in the surface. If you don't know them, perhaps the "maxima method" allows to find them out.
One your points cloud consists only of surface vertices, the triangulation method can be any one you like, from (adapted) incremental Chew's, Ruppert, etc to "ball-pivoting" method and "marching cubes" method.
The Delaunay tetrahedrization doesn't fit for two reasons
it fills a volume with tetrahedra, instead of defining a surface,
it fills the convex hull of the points, which is probably not what you expect.
To address the second problem, you need to accept concavities, and this implies that you need to specify a reference scale that tells what level of detail you want. This leads to the concept of Alpha Shapes, which are obtained as a subset of the faces.
Lookup "Alpha Shape" in an image search engine.

Map 3D point cloud onto surface then flatten

Mapping a point cloud onto a 3D "fabric" then flattening.
So I have a scientific dataset consisting of a point cloud in 3D, this point cloud comprises points on a surface that is curved. In order to perform quantitative analysis I however need to map these point clouds onto a surface I can then flatten. I thought about using mapping tools sort of like in the case of the 3d world being flattened onto a map, but not sure how to even begin as I have no experience in cartography and maybe I'm trying to solve an easy problem with the wrong tools.
Just to briefly describe the dataset: imagine entirely transparent curtains on the window with small dots on them, if I could use that dot pattern to fit the material the dots are on I could then "straighten" it and do meaningful analysis on the spread of the dots. I'm guessing the procedure would be to first manually fit the "sheet" onto the point cloud data by using contours or something along those lines then flattening the sheet thus putting the points into a 2d array. Ultimately I'll probably also reduce that into a 1D but I assume I need the intermediate 2D step as the length of the 2nd dimension is variable (i.e. one end of the sheet is shorter than the other but still corresponds to the same position in terms of contours) I'm using Matlab and Amira though I'm always happy to learn new tools!
Any advice or hints how to approach are much appreciated!
You can use a space filling curve to reduce the 3d complexity to a 1d complexity. I use a hilbert curve to index lat-lng pairs on a 2d map. You can do the same with a 3d space but it's easier to start with a simple curve for example a z morton order curve. Space filling curves are often used in mapping applications. A space filling curve also adds some proximity information and a new sort order to the 3d points.
You can try to build a surface that approximates your dataset, then unfold the surface with the points you want. Solid3dtech.com has the tool to unfold the surfaces with the curves or points.

Point cloud:project city square to ground plane

I have a city square with people, cars, trees and buildings in pcl format. I need to automatically determine the ground plane and project this objects on that ground plane to get a 2D map with occupied places.
Any idea?
I think the best thing to do here would be to familiarise yourself with the following two PCL tutorials:
http://pointclouds.org/documentation/tutorials/planar_segmentation.php
http://pointclouds.org/documentation/tutorials/project_inliers.php
The first tutorial makes use of the RANSAC algorithm to find a dominant plane in a scene. I use it to find tables and floors in robotics scenarios. You would use it to find your dominant ground plane.
The second tutorial shows how to project points directly onto a plane. This is what you would use to make your 3D point cloud into a 2D one. Note that, despite the "inlier" keyword, you can pass your whole point cloud to be projected onto the plane.
Actually, if you are after "occupied" places, you might want to project all of the points that aren't in the ground plane (i.e. the outliers), and that are above it (you can use a PCL filter, such as PlaneClipper3D, for example, or just the complement of the outliers from the plane-segmentation operation.
If the plane that you end up with (containing all your projected points) is not in the coordinate frame you want, you may wish to rotate the whole lot, for example, to align with the coordinate axes so that all z-coordinates are zero. See pcl::transformPointCloud for this (the transform will be obtainable from the plane coefficients returned from the plane segmentation).
I hope this is helpful and not at too basic a level, though the question was rather general so I suppose it should be okay.

Rendering 3D surfaces

I've got data representing 3D surfaces (i.e. earthquake fault planes) in xyz point format. I'd like to create a 3D representation of these surfaces. I've had some success using rgl and akima, however it can't really handle geometry that may fold back on itself or have multiple z values at the same x,y point. Alternatively, using geometry (the convhulln function from qhull) I can create convex hulls that show up nicely in rgl but these are closed surfaces where in reality, the objects are open (don't completely enclose the point set). Is there a way to create these surfaces and render them, preferably in rgl?
EDIT
To clarify, the points are in a point cloud that defines the surface. They have varying density of coverage across the surface. However, the main issue is that the surface is one-sided, not closed, and I don't know how to generate a mesh/surface that isn't closed for more complex geometry.
As an example...
require(rgl)
require(akima)
faultdata<-cbind(c(1,1,1,2,2,2),c(1,1,1,2,2,2),c(10,20,-10,10,20,-10))
x <- faultdata[,1]
y <- faultdata[,2]
z <- faultdata[,3]
s <- interp(x,z,y,duplicate="strip")
surface3d(s$x,s$y,s$z,col=a,add=T)
This creates generally what I want. However, for planes that are more complex this doesn't necessarily work. e.g. where the data are:
faultdata<-cbind(c(2,2,2,2,2,2),c(1,1,1,2,2,2),c(10,20,-10,10,20,-10))
I can't use this approach because the points are all vertically co-planar. I also can't use convhulln because of the same issue and in general I don't want a closed hull, I want a surface. I looked at alphashape3d and it looks promising, but I'm not sure how to go about using it for this problem.
How do you determine how the points are connected together as a surface? By distance? That can be one way, and the alphashape3d package might be of use. Otherwise, if you know exactly how they are to be connected, then you can visualize it directly with rgl structures.

Resources