-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathST_3D_GeoAstroide_csc
More file actions
50 lines (46 loc) · 1.83 KB
/
Copy pathST_3D_GeoAstroide_csc
File metadata and controls
50 lines (46 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
DROP FUNCTION IF EXISTS ST_3D_GeoAstroide_csc(
geom GEOMETRY,
distance float,
direction_degrees_teta numeric,
direction_degrees_fi numeric,
x_transform_angle numeric,
y_transform_angle numeric,
h_transform_angle numeric,
first_numerator_exponentiation numeric,
first_denominator_exponentiation numeric,
second_numerator_exponentiation numeric,
second_denominator_exponentiation numeric,
third_numerator_exponentiation numeric,
third_denominator_exponentiation numeric)
CREATE OR REPLACE FUNCTION ST_3D_GeoAstroide_csc(
geom GEOMETRY,
distance float,
direction_degrees_teta numeric,
direction_degrees_fi numeric,
x_transform_angle numeric,
y_transform_angle numeric,
h_transform_angle numeric,
first_numerator_exponentiation numeric,
first_denominator_exponentiation numeric,
second_numerator_exponentiation numeric,
second_denominator_exponentiation numeric,
third_numerator_exponentiation numeric,
third_denominator_exponentiation numeric)
RETURNS GEOMETRY AS
$BODY$
SELECT ST_MakePoint(
ST_X($1)+$2*(COSD($3+$5))^$8*$9,
ST_Y($1)+$2*(SIND($3+$6))^$10*$11,
ST_Z($1)+$2*(COSD($4+$7)^$12*$13)
);
$BODY$
LANGUAGE SQL
Example
1) SELECT ST_ASText(ST_SetSrid(ST_MakeLine(ST_3D_GeoAstroide_csc(geom, exp(COSD(i))-2*COSD(4*i)+(SIND(i/12))^5/7, i, r, 0, 0, 0, 1, 1, 1, 1, 1, 1)),4326)) geom FROM
(SELECT ST_MakePoint(0, 0, 0) geom, generate_series (0,360) i) foo CROSS JOIN generate_series (0,360,10) r;
2) SELECT ST_ASText(ST_SetSrid(ST_MakeLine(ST_3D_GeoAstroide_csc(geom, SIND(3*i) , i, r, 0, 0, 0, 1, 1, 1, 1, 1, 1)),4326)) geom FROM
(SELECT ST_MakePoint(0, 0, 0) geom, generate_series (0,360) i) foo CROSS JOIN generate_series (0,360,10) r
3) ...∞
*Experimental function*
* Note
To visualize the result of building ST_3D() function it is necessary to use PostGIS ST_AsX3D() function. The link to an example of its use is located at - https://postgis.net/docs/ST_AsX3D.html