ST_Rotate

更新时间:
复制 MD 格式

Rotates a meshgeom or sfmesh object by a specified angle in radians.

Syntax

meshgeom ST_Rotate(meshgeom geom, float angle);
sfmesh ST_Scale(sfmesh sfmeshObject, float angle);
The second signature shows ST_Scale as the function name. This appears to be a documentation error in the source. The behavior described applies to rotation of sfmesh objects.

Parameters

ParameterDescription
geomThe meshgeom object to rotate.
sfmeshObjectThe sfmesh object to rotate.
angleThe rotation angle, in radians.

Description

ST_Rotate rotates a 3D mesh object along the x-axis or y-axis only.

Example

The following example rotates a meshgeom object by pi()/4 radians (45 degrees):

-- Rotate 45 degrees (pi()/4 radians)
select ST_asText(
  ST_Rotate(
    'MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 1,0 10 2,10 10 3,10 0 4), INDEX((0,1,2),(1,2,3)))))'::meshgeom,
    pi()/4
  )
);

Output:

MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 1,-7.07106781186547 7.07106781186548 2,0 14.142135623731 3,7.07106781186548 7.07106781186547 4),INDEX((0,1,2),(1,2,3)))))