All Products
Search
Document Center

PolarDB:ST_Scale

Last Updated:Mar 28, 2026

Scales a meshgeom or sfmesh object along the x, y, and z axes by independent scaling factors.

Syntax

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

Parameters

ParameterDescription
geomThe meshgeom object to scale.
sfmeshObjectThe sfmesh object to scale.
XFactorThe scaling factor of the x-axis.
YFactorThe scaling factor of the y-axis.
ZFactorThe scaling factor of the z-axis.

How it works

Each coordinate is multiplied by its corresponding scaling factor:

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

Example

Scale a meshgeom object by 0.5 on x, 0.8 on y, and 2.0 on z:

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
  )
);

Result:

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

The x-coordinates are halved (10 → 5), the y-coordinates are multiplied by 0.8 (10 → 8), and the z-axis factor has no visible effect on 2D vertex coordinates in this example.