Converts the coordinate system of an sfmesh object from Z-up to Y-up.
Syntax
sfmesh ST_ZupToYup(sfmesh mesh);Parameters
| Parameter | Description |
|---|---|
mesh | The sfmesh object to convert. |
Return value
An sfmesh object with its coordinate system converted from Z-up to Y-up.
Description
In some scenarios in which a Z-up coordinate system is used, the Y-up orientation is required. In these scenarios, you can use the ST_ZupToYup function to convert the coordinate system.
You can also call ST_Affine to perform the following matrix transformation to convert the coordinate system:
1.0, 0, 0, 0,
0, 0, -1.0, 0,
0, 1.0, 0, 0This applies the coordinate mapping: x' = x, y' = -z, z' = y.
Example
Convert a mesh from a Z-up source to Y-up orientation:
SELECT ST_AsText(
ST_ZupToYup(
ST_MeshFromText(
'{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}'
)
)
);Result: The function adds a "matrix" field to the node, encoding the Y-up transformation:
{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0,"matrix" : [1,0,0,1,0,0,0,0,-1,0,0,0,0,0,0,1]}]}See also
ST_Affine — Apply an arbitrary affine transformation matrix to an
sfmeshobject.