All Products
Search
Document Center

PolarDB:ST_SnapToPolygon

Last Updated:Feb 29, 2024

This topic describes the ST_SnapToPolygon function. This function smoothly fits sfmesh vertices to 3D polygons in the Z direction.

Syntax

sfmesh ST_SnapToPolygon(sfmesh  sfmesh, geometry geom, f8 zlowd, f8 zupd, f8 buffer, i4 times);

Return values

The sfmesh object with its vertices moothly fit is returned.

Parameters

Parameter

Description

sfmesh

The sfmesh model object.

geom

The 3D polygon.

zlowd

The lower distance limit in the Z direction.

zupd

The upper distance limit in the Z direction.

buffer

The buffer used for smooth fitting.

times

The number of smooth fitting actions. A higher number of smooth fitting actions brings a better fitting result. We recommend that you set the value to between 5 and 20.

Description

  • This function smoothly fits terrain mesh vertices to 3D polygons in the Z direction.

  • The zlowd and zupd parameters specify the vertices to be smoothly fit.

  • The buffer parameter sets the smooth transition range.

  • The times parameter defines the number of smooth fitting actions. A higher number of smooth fitting actions brings a better fitting result.

Examples

SELECT BOX3D(ST_SnapToPolygon(
    ST_3DIntersection(ST_3DMakeSphere(1.0, 4), 'BOX3D(-1 -1 0, 1 1 1)'::box3d),
    'POLYGON((-5 -0.1 0.5, 5 -0.1 0.5, 5 0.1 0.5, -5 0.1 0.5, -5 -0.1 0.5))', 0.5, 0.5, 0.5, 10));
--------------------------------------
 BOX3D(-1 -1 0,1 1 0.782785594463348)