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
| Parameter | Description |
|---|---|
geom | The meshgeom object to scale. |
sfmeshObject | The sfmesh object to scale. |
XFactor | The scaling factor of the x-axis. |
YFactor | The scaling factor of the y-axis. |
ZFactor | The 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 * zExample
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.