Name

CG_3DAlphaWrapping — Computes a 3D Alpha-wrapping strictly enclosing a geometry.

Synopsis

geometry CG_3DAlphaWrapping(geometry geom, integer relative_alpha, integer relative_offset);

Description

Computes the 3D Alpha Wrapping of the points in a geometry. An alpha wrapping is a watertight and orientable surface mesh that strictly encloses the input. It can be seen as an extension or refinement of an alpha-shape.

The relative_alpha parameter controls which features will appear in the output. It can have values from 0 to infinity. Higher relative_alpha values produce coarser wraps; lower values retain more detail.

The relative_offset parameter controls the tightness of the result. It can have values from 0 to infinity. If this parameter is set to 0, its value is automatically determined based on the relative_alpha parameter.

Availability: 3.6.0 - requires SFCGAL >= 2.1.0

This method needs SFCGAL backend.

This function supports 3d and will not drop the z-index.

Examples

Wrap a tetrahedral surface and show the native 3D input beside the actual enclosing mesh.

Code
WITH data AS (
  SELECT 'POLYHEDRALSURFACE Z (
    ((0 0 0,4 0 0,0 4 0,0 0 0)),
    ((0 0 0,0 0 4,4 0 0,0 0 0)),
    ((0 0 0,0 4 0,0 0 4,0 0 0)),
    ((4 0 0,0 0 4,0 4 0,4 0 0))
  )'::geometry AS input_geometry
)
SELECT input_geometry AS input_geometry,
       CG_3DAlphaWrapping(input_geometry, 1)
         AS wrapped_geometry
FROM data;
Output
POLYHEDRALSURFACE Z (((0 0 0,4 0 0,0 4 0,0 0 0)),((0 0 0,0 0 4,4 0 0,0 0 0)),((0 0 0,0 4 0,0 0 4,0 0 0)),((4 0 0,0 0 4,0 4 0,4 0 0))) | POLYHEDRALSURFACE Z (((-0.193 0.127 4,-0.035 -0.228 4.004,0.087 0.087 4.195,-0.193 0.127 4)),((0.083 0.082 3.801,0.087 0.087 4.195,-0.035 -0.228 4.004,0.083 0.082 3.801)),((0.087 0.087 4.195,0.083 0.082 3.801,-0.193 0.127 4,0.087 0.087 4.195)),((0.048 3.84 0.16,3.867 0.133 0.133,0.091 3.926 -0.199,0.048 3.84 0.16)),((3.92 0.08 -0.201,0.037 -0.007 -0.228,0.091 3.926 -0.199,3.92 0.08 -0.201)),((3.867 0.133 0.133,3.92 0.08 -0.201,0.091 3.926 -0.199,3.867 0.133 0.133)),((3.867 0.133 0.133,3.877 -0.195 0.012,4.228 -0.006 0.037,3.867 0.133 0.133)),((3.867 0.133 0.133,4.228 -0.006 0.037,3.92 0.08 -0.201,3.867 0.133 0.133)),((3.877 -0.195 0.012,3.92 0.08 -0.201,4.228 -0.006 0.037,3.877 -0.195 0.012)),((0.012 -0.196 0.121,-0.035 -0.228 4.004,-0.202 0.079 0.078,0.012 -0.196 0.121)),((-0.202 0.079 0.078,0.037 -0.007 -0.228,0.012 -0.196 0.121,-0.202 0.079 0.078)),((3.867 0.133 0.133,0.083 0.082 3.801,3.877 -0.195 0.012,3.867 0.133 0.133)),((0.091 3.926 -0.199,0.101 4.199 0.06,0.048 3.84 0.16,0.091 3.926 -0.199)),((0.101 4.199 0.06,-0.228 4.028 -0.021,0.048 3.84 0.16,0.101 4.199 0.06)),((0.091 3.926 -0.199,-0.228 4.028 -0.021,0.101 4.199 0.06,0.091 3.926 -0.199)),((3.867 0.133 0.133,0.048 3.84 0.16,0.083 0.082 3.801,3.867 0.133 0.133)),((3.877 -0.195 0.012,0.037 -0.007 -0.228,3.92 0.08 -0.201,3.877 -0.195 0.012)),((0.012 -0.196 0.121,0.037 -0.007 -0.228,3.877 -0.195 0.012,0.012 -0.196 0.121)),((0.083 0.082 3.801,0.048 3.84 0.16,-0.193 0.127 4,0.083 0.082 3.801)),((-0.228 4.028 -0.021,-0.193 0.127 4,0.048 3.84 0.16,-0.228 4.028 -0.021)),((-0.228 4.028 -0.021,-0.202 0.079 0.078,-0.193 0.127 4,-0.228 4.028 -0.021)),((-0.202 0.079 0.078,-0.035 -0.228 4.004,-0.193 0.127 4,-0.202 0.079 0.078)),((3.877 -0.195 0.012,0.083 0.082 3.801,-0.035 -0.228 4.004,3.877 -0.195 0.012)),((0.012 -0.196 0.121,3.877 -0.195 0.012,-0.035 -0.228 4.004,0.012 -0.196 0.121)),((0.091 3.926 -0.199,0.037 -0.007 -0.228,-0.228 4.028 -0.021,0.091 3.926 -0.199)),((-0.228 4.028 -0.021,0.037 -0.007 -0.228,-0.202 0.079 0.078,-0.228 4.028 -0.021)))
Figure
Geometry figure for visual-cg-3dalphawrapping-01

See Also

CG_AlphaShape