ST_GeometryMatch

更新时间:
复制 MD 格式

Maps a 2D geometry object onto the surface of a 3D mesh model, returning a 3D geometry object.

Syntax

geometry ST_GeometryMatch(meshgeom geom3d, geometry geom2d, cstring direction, float8 sample)

Description

ST_GeometryMatch absorbs or maps a 2D geometry object to the surface of a 3D meshgeom object and generates a 3D geometry object.

Supported input geometry types: Point, MultiPoint, LineString, and MultiLineString.

The direction parameter controls the adsorption or matching direction. The following directions are supported: top adsorption or matching and bottom adsorption or matching.

ValueDescription
TOPTop adsorption or matching.
BOTTOMBottom adsorption or matching.

The sample parameter sets the sampling interval for the 2D geometry object.

Effect diagram

A 2D line is matched to a 3D meshgeom object along the TOP direction to generate a 3D line. Effect diagram

Parameters

ParameterTypeDescription
geom3dmeshgeomThe 3D mesh geometry object to project onto.
geom2dgeometryThe 2D geometry to project. Supported types: Point, MultiPoint, LineString, MultiLineString.
directioncstringThe matching direction. Valid values: TOP, BOTTOM.
samplefloat8The sampling interval for the 2D geometry object.

Examples

Project a 2D LineString onto a triangulated mesh surface from below (BOTTOM direction) with a sampling interval of 0.02:

SELECT ST_AsText(
  ST_GeometryMatch(
    'MESHGEOM(PATCH(TRIANGLESTRIP Z(0 0 0,10 0 0,0 10 0,0 0 10)))'::mesh,
    'LINESTRING(1 1, 1.1 1.1)',
    'BOTTOM',
    0.02
  )
);

Output:

LINESTRING Z (1 1 0,1.01414213562373 1.01414213562373 0,1.02828427124746 1.02828427124746 0,1.04242640687119 1.04242640687119 0,1.05656854249492 1.05656854249492 0,1.07071067811866 1.07071067811866 0,1.08485281374239 1.08485281374239 0,1.09899494936612 1.09899494936612 0,1.1 1.1 0)