-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathST_GeoAstroideAsymmetrical
More file actions
39 lines (36 loc) · 1.6 KB
/
ST_GeoAstroideAsymmetrical
File metadata and controls
39 lines (36 loc) · 1.6 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
DROP FUNCTION ST_GeoAstroideAsymmetrical(
geom GEOMETRY,
distance float,
direction_degrees_npts 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,
fourth_numerator_exponentiation numeric,
fourth_denominator_exponentiation numeric)
CREATE OR REPLACE FUNCTION ST_GeoAstroideAsymmetrical(
geom GEOMETRY,
distance float,
direction_degrees_npts 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,
fourth_numerator_exponentiation numeric,
fourth_denominator_exponentiation numeric)
RETURNS GEOMETRY AS
$BODY$
SELECT ST_Point(ST_X($1)+$2*(COSD($3)^$4/$5)^$6/$7, ST_Y($1)+$2*(SIND($3)^$8/$9)^$10/$11);
$BODY$
LANGUAGE SQL
SELECT ST_SetSrid(ST_MakeLine(ST_GeoAstroideAsymmetrical(geom, 1, i, 1, 1, 1, 1, 1, 1, 1, 1)),4326) geom FROM
(SELECT ST_Point(0, 0) geom) foo CROSS JOIN generate_series (0,360) AS step(i) UNION
SELECT ST_SetSrid(ST_MakeLine(ST_GeoAstroideAsymmetrical(geom, 1, i, 3, 1, 3, 1, 1, 1, 3, 1)),4326) geom FROM
(SELECT ST_Point(0, 0) geom) foo CROSS JOIN generate_series (0,360) AS step(i) UNION
SELECT ST_SetSrid(ST_MakeLine(ST_GeoAstroideAsymmetrical(geom, -1, i, 3, 1, 3, 1, 1, 1, 1, 1)),4326) geom FROM
(SELECT ST_Point(0, 0) geom) foo CROSS JOIN generate_series (0,360) AS step(i);
*Experimental function*