Version 0.59.0

convhull_points::conv_hull

Calculates the convex hull of a set of points.

Signatures

  •   conv_hull( vector& points[], int& facets[][] )

Details

The convex hull of a set of space points is calculated and returned in the form of point index triples that represent the triangle facets.

Example

 #import( "std/convhull_points.sps" )

 vector points[100]
 for( int p = 0; p < points.length(); ++p )
   points[p] = <[ rand( 10.0 ), rand( 10.0 ), rand( 10.0 ) ]>

 int facets[][]
 convhull_points::conv_hull( points, facets )

 sheet sheets[facets.length()]
 for( int f = 0; f < sheets.length(); ++f )
   sheets[f] = min_surf( points[facets[f][0]] -> points[facets[f][1]] -> points[facets[f][2]] -><- )
 make sheets_to_solid( sheets )
 

Result of the example

Return value

'true' on success, 'false' otherwise

Parameters

points

Input parameter that shall contain a list of 3d points. The convex hull is constructed of these points. The array is not modified by the function.

facets

Returns an array of the size [F][3] where F is the number of facets of the resulting convex hull. The parameter contains three index values per triangular facet. These indices refer to array points and represent the corners of each triangle, in right-hand order.

🗙

Search results for