ok
Direktori : /opt/alt/postgresql11/usr/share/doc/alt-postgresql11-9.2.24/html/ |
Current File : //opt/alt/postgresql11/usr/share/doc/alt-postgresql11-9.2.24/html/functions-geometry.html |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Geometric Functions and Operators</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.2.24 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Functions and Operators" HREF="functions.html"><LINK REL="PREVIOUS" TITLE="Enum Support Functions" HREF="functions-enum.html"><LINK REL="NEXT" TITLE="Network Address Functions and Operators" HREF="functions-net.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2017-11-06T22:43:11"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.2.24 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="Enum Support Functions" HREF="functions-enum.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="functions.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Chapter 9. Functions and Operators</TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="Network Address Functions and Operators" HREF="functions-net.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="FUNCTIONS-GEOMETRY" >9.11. Geometric Functions and Operators</A ></H1 ><P > The geometric types <TT CLASS="TYPE" >point</TT >, <TT CLASS="TYPE" >box</TT >, <TT CLASS="TYPE" >lseg</TT >, <TT CLASS="TYPE" >line</TT >, <TT CLASS="TYPE" >path</TT >, <TT CLASS="TYPE" >polygon</TT >, and <TT CLASS="TYPE" >circle</TT > have a large set of native support functions and operators, shown in <A HREF="functions-geometry.html#FUNCTIONS-GEOMETRY-OP-TABLE" >Table 9-31</A >, <A HREF="functions-geometry.html#FUNCTIONS-GEOMETRY-FUNC-TABLE" >Table 9-32</A >, and <A HREF="functions-geometry.html#FUNCTIONS-GEOMETRY-CONV-TABLE" >Table 9-33</A >. </P ><DIV CLASS="CAUTION" ><P ></P ><TABLE CLASS="CAUTION" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Caution</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > Note that the <SPAN CLASS="QUOTE" >"same as"</SPAN > operator, <TT CLASS="LITERAL" >~=</TT >, represents the usual notion of equality for the <TT CLASS="TYPE" >point</TT >, <TT CLASS="TYPE" >box</TT >, <TT CLASS="TYPE" >polygon</TT >, and <TT CLASS="TYPE" >circle</TT > types. Some of these types also have an <TT CLASS="LITERAL" >=</TT > operator, but <TT CLASS="LITERAL" >=</TT > compares for equal <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >areas</I ></SPAN > only. The other scalar comparison operators (<TT CLASS="LITERAL" ><=</TT > and so on) likewise compare areas for these types. </P ></TD ></TR ></TABLE ></DIV ><DIV CLASS="TABLE" ><A NAME="FUNCTIONS-GEOMETRY-OP-TABLE" ></A ><P ><B >Table 9-31. Geometric Operators</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Operator</TH ><TH >Description</TH ><TH >Example</TH ></TR ></THEAD ><TBODY ><TR ><TD > <TT CLASS="LITERAL" >+</TT > </TD ><TD >Translation</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(1,1))' + point '(2.0,0)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >-</TT > </TD ><TD >Translation</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(1,1))' - point '(2.0,0)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >*</TT > </TD ><TD >Scaling/rotation</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(1,1))' * point '(2.0,0)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >/</TT > </TD ><TD >Scaling/rotation</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(2,2))' / point '(2.0,0)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >#</TT > </TD ><TD >Point or box of intersection</TD ><TD ><TT CLASS="LITERAL" >box '((1,-1),(-1,1))' # box '((1,1),(-2,-2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >#</TT > </TD ><TD >Number of points in path or polygon</TD ><TD ><TT CLASS="LITERAL" ># path '((1,0),(0,1),(-1,0))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >@-@</TT > </TD ><TD >Length or circumference</TD ><TD ><TT CLASS="LITERAL" >@-@ path '((0,0),(1,0))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >@@</TT > </TD ><TD >Center</TD ><TD ><TT CLASS="LITERAL" >@@ circle '((0,0),10)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >##</TT > </TD ><TD >Closest point to first operand on second operand</TD ><TD ><TT CLASS="LITERAL" >point '(0,0)' ## lseg '((2,0),(0,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><-></TT > </TD ><TD >Distance between</TD ><TD ><TT CLASS="LITERAL" >circle '((0,0),1)' <-> circle '((5,0),1)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >&&</TT > </TD ><TD >Overlaps? (One point in common makes this true.)</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(1,1))' && box '((0,0),(2,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><<</TT > </TD ><TD >Is strictly left of?</TD ><TD ><TT CLASS="LITERAL" >circle '((0,0),1)' << circle '((5,0),1)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >>></TT > </TD ><TD >Is strictly right of?</TD ><TD ><TT CLASS="LITERAL" >circle '((5,0),1)' >> circle '((0,0),1)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >&<</TT > </TD ><TD >Does not extend to the right of?</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(1,1))' &< box '((0,0),(2,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >&></TT > </TD ><TD >Does not extend to the left of?</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(3,3))' &> box '((0,0),(2,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><<|</TT > </TD ><TD >Is strictly below?</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(3,3))' <<| box '((3,4),(5,5))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >|>></TT > </TD ><TD >Is strictly above?</TD ><TD ><TT CLASS="LITERAL" >box '((3,4),(5,5))' |>> box '((0,0),(3,3))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >&<|</TT > </TD ><TD >Does not extend above?</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(1,1))' &<| box '((0,0),(2,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >|&></TT > </TD ><TD >Does not extend below?</TD ><TD ><TT CLASS="LITERAL" >box '((0,0),(3,3))' |&> box '((0,0),(2,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><^</TT > </TD ><TD >Is below (allows touching)?</TD ><TD ><TT CLASS="LITERAL" >circle '((0,0),1)' <^ circle '((0,5),1)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >>^</TT > </TD ><TD >Is above (allows touching)?</TD ><TD ><TT CLASS="LITERAL" >circle '((0,5),1)' >^ circle '((0,0),1)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >?#</TT > </TD ><TD >Intersects?</TD ><TD ><TT CLASS="LITERAL" >lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >?-</TT > </TD ><TD >Is horizontal?</TD ><TD ><TT CLASS="LITERAL" >?- lseg '((-1,0),(1,0))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >?-</TT > </TD ><TD >Are horizontally aligned?</TD ><TD ><TT CLASS="LITERAL" >point '(1,0)' ?- point '(0,0)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >?|</TT > </TD ><TD >Is vertical?</TD ><TD ><TT CLASS="LITERAL" >?| lseg '((-1,0),(1,0))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >?|</TT > </TD ><TD >Are vertically aligned?</TD ><TD ><TT CLASS="LITERAL" >point '(0,1)' ?| point '(0,0)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >?-|</TT > </TD ><TD >Is perpendicular?</TD ><TD ><TT CLASS="LITERAL" >lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >?||</TT > </TD ><TD >Are parallel?</TD ><TD ><TT CLASS="LITERAL" >lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >@></TT > </TD ><TD >Contains?</TD ><TD ><TT CLASS="LITERAL" >circle '((0,0),2)' @> point '(1,1)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><@</TT > </TD ><TD >Contained in or on?</TD ><TD ><TT CLASS="LITERAL" >point '(1,1)' <@ circle '((0,0),2)'</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" >~=</TT > </TD ><TD >Same as?</TD ><TD ><TT CLASS="LITERAL" >polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))'</TT ></TD ></TR ></TBODY ></TABLE ></DIV ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > Before <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > 8.2, the containment operators <TT CLASS="LITERAL" >@></TT > and <TT CLASS="LITERAL" ><@</TT > were respectively called <TT CLASS="LITERAL" >~</TT > and <TT CLASS="LITERAL" >@</TT >. These names are still available, but are deprecated and will eventually be removed. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="TABLE" ><A NAME="FUNCTIONS-GEOMETRY-FUNC-TABLE" ></A ><P ><B >Table 9-32. Geometric Functions</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><COL><THEAD ><TR ><TH >Function</TH ><TH >Return Type</TH ><TH >Description</TH ><TH >Example</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >area(<TT CLASS="REPLACEABLE" ><I >object</I ></TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >double precision</TT ></TD ><TD >area</TD ><TD ><TT CLASS="LITERAL" >area(box '((0,0),(1,1))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >center(<TT CLASS="REPLACEABLE" ><I >object</I ></TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >point</TT ></TD ><TD >center</TD ><TD ><TT CLASS="LITERAL" >center(box '((0,0),(1,2))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >diameter(<TT CLASS="TYPE" >circle</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >double precision</TT ></TD ><TD >diameter of circle</TD ><TD ><TT CLASS="LITERAL" >diameter(circle '((0,0),2.0)')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >height(<TT CLASS="TYPE" >box</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >double precision</TT ></TD ><TD >vertical size of box</TD ><TD ><TT CLASS="LITERAL" >height(box '((0,0),(1,1))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >isclosed(<TT CLASS="TYPE" >path</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >boolean</TT ></TD ><TD >a closed path?</TD ><TD ><TT CLASS="LITERAL" >isclosed(path '((0,0),(1,1),(2,0))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >isopen(<TT CLASS="TYPE" >path</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >boolean</TT ></TD ><TD >an open path?</TD ><TD ><TT CLASS="LITERAL" >isopen(path '[(0,0),(1,1),(2,0)]')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >length(<TT CLASS="REPLACEABLE" ><I >object</I ></TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >double precision</TT ></TD ><TD >length</TD ><TD ><TT CLASS="LITERAL" >length(path '((-1,0),(1,0))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >npoints(<TT CLASS="TYPE" >path</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >int</TT ></TD ><TD >number of points</TD ><TD ><TT CLASS="LITERAL" >npoints(path '[(0,0),(1,1),(2,0)]')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >npoints(<TT CLASS="TYPE" >polygon</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >int</TT ></TD ><TD >number of points</TD ><TD ><TT CLASS="LITERAL" >npoints(polygon '((1,1),(0,0))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >pclose(<TT CLASS="TYPE" >path</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >path</TT ></TD ><TD >convert path to closed</TD ><TD ><TT CLASS="LITERAL" >pclose(path '[(0,0),(1,1),(2,0)]')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >popen(<TT CLASS="TYPE" >path</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >path</TT ></TD ><TD >convert path to open</TD ><TD ><TT CLASS="LITERAL" >popen(path '((0,0),(1,1),(2,0))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >radius(<TT CLASS="TYPE" >circle</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >double precision</TT ></TD ><TD >radius of circle</TD ><TD ><TT CLASS="LITERAL" >radius(circle '((0,0),2.0)')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >width(<TT CLASS="TYPE" >box</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >double precision</TT ></TD ><TD >horizontal size of box</TD ><TD ><TT CLASS="LITERAL" >width(box '((0,0),(1,1))')</TT ></TD ></TR ></TBODY ></TABLE ></DIV ><DIV CLASS="TABLE" ><A NAME="FUNCTIONS-GEOMETRY-CONV-TABLE" ></A ><P ><B >Table 9-33. Geometric Type Conversion Functions</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><COL><THEAD ><TR ><TH >Function</TH ><TH >Return Type</TH ><TH >Description</TH ><TH >Example</TH ></TR ></THEAD ><TBODY ><TR ><TD > <TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >box(<TT CLASS="TYPE" >circle</TT >)</CODE ></TT > </TD ><TD ><TT CLASS="TYPE" >box</TT ></TD ><TD >circle to box</TD ><TD ><TT CLASS="LITERAL" >box(circle '((0,0),2.0)')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >box(<TT CLASS="TYPE" >point</TT >, <TT CLASS="TYPE" >point</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >box</TT ></TD ><TD >points to box</TD ><TD ><TT CLASS="LITERAL" >box(point '(0,0)', point '(1,1)')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >box(<TT CLASS="TYPE" >polygon</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >box</TT ></TD ><TD >polygon to box</TD ><TD ><TT CLASS="LITERAL" >box(polygon '((0,0),(1,1),(2,0))')</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >circle(<TT CLASS="TYPE" >box</TT >)</CODE ></TT > </TD ><TD ><TT CLASS="TYPE" >circle</TT ></TD ><TD >box to circle</TD ><TD ><TT CLASS="LITERAL" >circle(box '((0,0),(1,1))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >circle(<TT CLASS="TYPE" >point</TT >, <TT CLASS="TYPE" >double precision</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >circle</TT ></TD ><TD >center and radius to circle</TD ><TD ><TT CLASS="LITERAL" >circle(point '(0,0)', 2.0)</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >circle(<TT CLASS="TYPE" >polygon</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >circle</TT ></TD ><TD >polygon to circle</TD ><TD ><TT CLASS="LITERAL" >circle(polygon '((0,0),(1,1),(2,0))')</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >lseg(<TT CLASS="TYPE" >box</TT >)</CODE ></TT > </TD ><TD ><TT CLASS="TYPE" >lseg</TT ></TD ><TD >box diagonal to line segment</TD ><TD ><TT CLASS="LITERAL" >lseg(box '((-1,0),(1,0))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >lseg(<TT CLASS="TYPE" >point</TT >, <TT CLASS="TYPE" >point</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >lseg</TT ></TD ><TD >points to line segment</TD ><TD ><TT CLASS="LITERAL" >lseg(point '(-1,0)', point '(1,0)')</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >path(<TT CLASS="TYPE" >polygon</TT >)</CODE ></TT > </TD ><TD ><TT CLASS="TYPE" >path</TT ></TD ><TD >polygon to path</TD ><TD ><TT CLASS="LITERAL" >path(polygon '((0,0),(1,1),(2,0))')</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >point</CODE >(<TT CLASS="TYPE" >double precision</TT >, <TT CLASS="TYPE" >double precision</TT >)</TT > </TD ><TD ><TT CLASS="TYPE" >point</TT ></TD ><TD >construct point</TD ><TD ><TT CLASS="LITERAL" >point(23.4, -44.5)</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >point(<TT CLASS="TYPE" >box</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >point</TT ></TD ><TD >center of box</TD ><TD ><TT CLASS="LITERAL" >point(box '((-1,0),(1,0))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >point(<TT CLASS="TYPE" >circle</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >point</TT ></TD ><TD >center of circle</TD ><TD ><TT CLASS="LITERAL" >point(circle '((0,0),2.0)')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >point(<TT CLASS="TYPE" >lseg</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >point</TT ></TD ><TD >center of line segment</TD ><TD ><TT CLASS="LITERAL" >point(lseg '((-1,0),(1,0))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >point(<TT CLASS="TYPE" >polygon</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >point</TT ></TD ><TD >center of polygon</TD ><TD ><TT CLASS="LITERAL" >point(polygon '((0,0),(1,1),(2,0))')</TT ></TD ></TR ><TR ><TD > <TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >polygon(<TT CLASS="TYPE" >box</TT >)</CODE ></TT > </TD ><TD ><TT CLASS="TYPE" >polygon</TT ></TD ><TD >box to 4-point polygon</TD ><TD ><TT CLASS="LITERAL" >polygon(box '((0,0),(1,1))')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >polygon(<TT CLASS="TYPE" >circle</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >polygon</TT ></TD ><TD >circle to 12-point polygon</TD ><TD ><TT CLASS="LITERAL" >polygon(circle '((0,0),2.0)')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >polygon(<TT CLASS="REPLACEABLE" ><I >npts</I ></TT >, <TT CLASS="TYPE" >circle</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >polygon</TT ></TD ><TD >circle to <TT CLASS="REPLACEABLE" ><I >npts</I ></TT >-point polygon</TD ><TD ><TT CLASS="LITERAL" >polygon(12, circle '((0,0),2.0)')</TT ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" ><CODE CLASS="FUNCTION" >polygon(<TT CLASS="TYPE" >path</TT >)</CODE ></TT ></TD ><TD ><TT CLASS="TYPE" >polygon</TT ></TD ><TD >path to polygon</TD ><TD ><TT CLASS="LITERAL" >polygon(path '((0,0),(1,1),(2,0))')</TT ></TD ></TR ></TBODY ></TABLE ></DIV ><P > It is possible to access the two component numbers of a <TT CLASS="TYPE" >point</TT > as though the point were an array with indexes 0 and 1. For example, if <TT CLASS="LITERAL" >t.p</TT > is a <TT CLASS="TYPE" >point</TT > column then <TT CLASS="LITERAL" >SELECT p[0] FROM t</TT > retrieves the X coordinate and <TT CLASS="LITERAL" >UPDATE t SET p[1] = ...</TT > changes the Y coordinate. In the same way, a value of type <TT CLASS="TYPE" >box</TT > or <TT CLASS="TYPE" >lseg</TT > can be treated as an array of two <TT CLASS="TYPE" >point</TT > values. </P ><P > The <CODE CLASS="FUNCTION" >area</CODE > function works for the types <TT CLASS="TYPE" >box</TT >, <TT CLASS="TYPE" >circle</TT >, and <TT CLASS="TYPE" >path</TT >. The <CODE CLASS="FUNCTION" >area</CODE > function only works on the <TT CLASS="TYPE" >path</TT > data type if the points in the <TT CLASS="TYPE" >path</TT > are non-intersecting. For example, the <TT CLASS="TYPE" >path</TT > <TT CLASS="LITERAL" >'((0,0),(0,1),(2,1),(2,2),(1,2),(1,0),(0,0))'::PATH</TT > will not work; however, the following visually identical <TT CLASS="TYPE" >path</TT > <TT CLASS="LITERAL" >'((0,0),(0,1),(1,1),(1,2),(2,2),(2,1),(1,1),(1,0),(0,0))'::PATH</TT > will work. If the concept of an intersecting versus non-intersecting <TT CLASS="TYPE" >path</TT > is confusing, draw both of the above <TT CLASS="TYPE" >path</TT >s side by side on a piece of graph paper. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="functions-enum.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="functions-net.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Enum Support Functions</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="functions.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Network Address Functions and Operators</TD ></TR ></TABLE ></DIV ></BODY ></HTML >