
jbe@0: 
jbe@10: CREATE OR REPLACE FUNCTION tmp_three_points()
jbe@10:   RETURNS epoint[]
jbe@10:   LANGUAGE plpgsql VOLATILE AS $$
jbe@10:     DECLARE
jbe@10:       p1 epoint;
jbe@10:       p2 epoint;
jbe@10:       p3 epoint;
jbe@10:     BEGIN
jbe@10:       p1 := epoint((asin(2*random()-1) / pi()) * 180, (2*random()-1) * 180);
jbe@10:       p2 := epoint(latitude(p1) + (2*random()-1), longitude(p1) + cos(latitude(p1)/180*pi()) * (2*random()-1));
jbe@10:       p3 := epoint(latitude(p1) + (2*random()-1), longitude(p1) + cos(latitude(p1)/180*pi()) * (2*random()-1));
jbe@10:       RETURN ARRAY[p1, p2, p3];
jbe@10:     END;
jbe@10:   $$;
jbe@10: 
jbe@10: INSERT INTO "test" ("location", "surrounding", "multipoint", "triangle") SELECT
jbe@0:   epoint((asin(2*random()-1) / pi()) * 180, (2*random()-1) * 180),
jbe@10:   ecircle((asin(2*random()-1) / pi()) * 180, (2*random()-1) * 180, -ln(1-random()) * 1000),
jbe@10:   ecluster_create_multipoint(tmp_three_points()),
jbe@10:   ecluster_create_polygon(tmp_three_points())
jbe@0:   FROM generate_series(1, 10000);
jbe@0: 
jbe@10: DROP FUNCTION tmp_three_points();




