| 19 | $$ |
| 20 | LANGUAGE 'sql'; |
| 21 | }}} |
| 22 | |
| 23 | Alternate: |
| 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 | |
| 31 | CREATE 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)) |