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
Returns an sfmesh object with the 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.
ST_ZupToYup is equivalent to calling ST_Affine with the following matrix transformation:
1.0, 0, 0, 0,
0, 0, -1.0, 0,
0, 1.0, 0, 0The transformation swaps the Y and Z axes and negates the new Z axis, which is the standard rotation for converting between these two coordinate conventions.
Example
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:
{"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]}]}The "matrix" field added to the node encodes the Z-up to Y-up affine transformation. The mesh geometry itself is unchanged; the transformation is stored as a node-level matrix and applied at render time.
What's next
ST_Affine — apply a custom affine transformation matrix to an
sfmeshobject