Changes between Version 38 and Version 39 of UsersWikiplpgsqlfunctions


Ignore:
Timestamp:
Sep 20, 2021, 3:34:28 PM (3 years ago)
Author:
mdavis
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiplpgsqlfunctions

    v38 v39  
    1717 $$
    1818   SELECT ST_Translate( ST_Rotate( ST_Scale( ST_Buffer(ST_Point(0,0), 0.5, quadSeg), rx, ry), rotation), x, y)
     19$$
     20 LANGUAGE 'sql';
     21}}}
     22
     23Alternate:
     24{{{
     25#!sql
     26-- pt - center point
     27-- rx, ry - X radius, Y radius
     28-- rotation - CW rotation in radians
     29-- quadSeg - number of segments in a quadrant
     30 
     31CREATE OR REPLACE FUNCTION ST_Ellipse(
     32  pt geometry,
     33  rx double precision, ry double precision,
     34  rotation double precision DEFAULT 0.0,
     35  quadSeg integer DEFAULT 8)
     36 RETURNS geometry AS
     37 $$
     38   SELECT ST_Translate( ST_Rotate( ST_Scale( ST_Buffer(ST_Point(0,0), 0.5, quadSeg), rx, ry), rotation), ST_X(pt), ST_Y(pt))
    1939$$
    2040 LANGUAGE 'sql';