Finding the faces of a shape from coordinates

370 Views Asked by At

I have shapes, both regular and irregular that are defined by a set of 3D xyz coordinates i.e. 100 coordinates that define a cube. Some of there coordinates make up the faces of the cube and some of the coordinates are within the cube.

I want to know whether there is some form of algorithm or formula that can analyse the coordinates and determine which of the coordinates make up the faces of the cube?

Thanks for the help in advance.

1

There are 1 best solutions below

0
On

It is very important to know, whether the set of coordinates (let's call it $C$) really contains corner-vertices. If not, the cube won't be unique (but you could search for a cube with minimal volume or something like that). See those 2D-pictures: enter image description here

We see two possible "cubes" that realise the coordinates, though the middle picture really realises some coordinates as corners.

If you know that the $C$ contains all corners of the cube you search, then the cube is the convex hull of $C$. There is a well etablished set of algorithms which calculate the convex hull, as Jaap Scherphuis already pointed out.