对meshgeom和sfmesh对象应用给定的仿射变换。

语法

meshgeom ST_Affine(meshgeom geom,float a,float b,float c,float d, float e,float f,float g,float h,float i, float xoff, float yoff,float zoff*);*
meshgeom ST_Affine(meshgeom geom, float[] p);
sfmesh ST_Affine(sfmesh sfmesh,float a,float b,float c,float d, float e,float f,float g,float h,float i, float xoff, float yoff,float zoff);
sfmesh ST_Affine(sfmesh sfmesh, float[] p);
sfmesh ST_Affine(float8[] p, float8[] p2);

参数

参数名称

描述

geom

meshgeom对象。

sfmeshObject

sfmesh对象。

a-i

参数值。

xoff

x偏移量。

yoff

y偏移量。

zoff

z偏移量。

p

16个仿射变换参数矩阵。

p2

16 个仿射变换参数矩阵

描述

  • ST_Affine生成仿射变换矩阵。

    / a b c xoff \
     | d e f yoff |
     | g h i zoff |
    \ 0 0 0   1 /
    / p[1]   p[2]  p[3]   p[4] \
     | p[5] p[6]  p[7]   p[8]  |
     | p[9]  p[10] p[11]  p[12] |
    \ p[13] p[14] p[15]  p[16] /
  • 对meshgeom和sfmesh对象的所有坐标点执行以下处理。

    x' = a*x + b*y + c*z + xoff
    y' = d*x + e*y + f*z + yoff
    z' = g*x + h*y + i*z + zoff
    x' = p[1]*x + p[2]*y + p[3]*z + p[4]
    y' = p[5]*x + p[6]*y + p[7]*z + p[8]
    z' = p[9]*x + p[10]*y + p[11]*z + p[12]

示例

select ST_asText(ST_Affine('MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0,0 10,10 10,10 0), INDEX((0,1,2),(1,2,3)))))'::meshgeom,  cos(pi()), -sin(pi()), 0,  sin(pi()), cos(pi()), 0,  0, 0, 1,  0, 0, 0));

----------------------------------------------------------------------
 MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0,0 -10,-10 -10,-10 0),INDEX((0,1,2),(1,2,3)))))

-- float array
select ST_asText(ST_Affine('MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0,0 10,10 10,10 0), INDEX((0,1,2),(1,2,3)))))'::meshgeom,  ARRAY[cos(pi()), -sin(pi()), 0, 0,
sin(pi()), cos(pi()), 0, 0,
0, 0, 1, 0,
0, 0, 0, 0]::float8[]));

----------------------------------------------------------------------
 MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0,0 -10,-10 -10,-10 0),INDEX((0,1,2),(1,2,3)))))

-- float array Affine float array
select st_affine('{-0.3583679495453059,-0.9335804264971996,0,72.60910593620417,0.9335804264971996,-0.3583679495453059,0,82.98262879309624,0,0,1,96.52,0,0,0,1}'::float8[], '{-0.3583679495453059,-0.9335804264971996,0,63.25570597150741,0.9335804264971996,-0.3583679495453059,0,107.3490699956786,0,0,1,87.92,0,0,0,1}'::float8[]);

----------------------------------------------------------------------
{-0.743144825477386,0.669130606358867,0,-50.2787022604891,-0.669130606358867,-0.743144825477386,0,103.566451652411,0,0,1,184.44,0,0,0,1}