我的表格里面有三列ID,GInfo,Rotation
其中GInfo是geometry类型的数据,里面是Polygon. 我现在想选出GInfo里面startpoint的矢量夹角=Rotation的数值的数据如果上面过于复杂,下面有两个自定义的点。我该如何写才能得到其矢量夹角=180度或者PI呢
谢谢
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POINT(20 10)', 0);
SET @h = geometry::STGeomFromText('POINT(10 10)', 0);
其中GInfo是geometry类型的数据,里面是Polygon. 我现在想选出GInfo里面startpoint的矢量夹角=Rotation的数值的数据如果上面过于复杂,下面有两个自定义的点。我该如何写才能得到其矢量夹角=180度或者PI呢
谢谢
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POINT(20 10)', 0);
SET @h = geometry::STGeomFromText('POINT(10 10)', 0);
(2点重合算90度=pi/2,)select a_gh=
case
when @[email protected] then
case when @g.STY<[email protected] then pi()/2 else 1.5*pi() end
else case
when @g.STX<@h.STX and @g.STY<[email protected] then atan((@[email protected])/(@[email protected]))
when @g.STX>@h.STX and @g.STY<[email protected] then pi()-atan((@[email protected])/(@[email protected]))
when @g.STX<@h.STX and @g.STY>[email protected] then pi()+atan((@[email protected])/(@[email protected]))
when @g.STX>@h.STX and @g.STY>[email protected] then 2*pi()-atan((@[email protected])/(@[email protected]))
end
end