All Products
Search
Document Center

PolarDB:ST_Scale

Last Updated:Mar 28, 2026

Scales a meshgeom or sfmesh object by the specified factors along each axis.

Syntax

meshgeom ST_Scale(meshgeom geom, float XFactor, float YFactor, float ZFactor);
sfmesh ST_Scale(sfmesh sfmeshObject, float XFactor, float YFactor, float ZFactor);

Parameters

ParameterTypeDescription
geommeshgeomThe meshgeom object to scale.
sfmeshObjectsfmeshThe sfmesh object to scale.
XFactorfloatThe scaling factor for the x-axis.
YFactorfloatThe scaling factor for the y-axis.
ZFactorfloatThe scaling factor for the z-axis.

Description

ST_Scale applies the following coordinate transformation to every vertex in the geometry:

x' = XFactor * x
y' = YFactor * y
z' = ZFactor * z

Examples

Scale a meshgeom object

The following example scales a meshgeom object with XFactor=0.5, YFactor=0.8, and ZFactor=2.0. The x-coordinates are halved, y-coordinates are multiplied by 0.8, and z-coordinates are doubled.

SELECT ST_asText(
  ST_Scale(
    'MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0,0 10,10 10,10 0), INDEX((0,1,2),(1,2,3)))))'::meshgeom,
    0.5, 0.8, 2.0
  )
);

Output:

MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0,0 8,5 8,5 0),INDEX((0,1,2),(1,2,3)))))