Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70f5a87

Browse files
committed
Small patch that adds some documentation for the area() function.
Specifically, point out that intersecting points in a path will yield(most likely), unexpected results. Visually these are identical paths,but mathematically they're not the same. Ex: area | plan------+------------------------------------------------------------------------------------------ -0 | ((0,0),(0,1),(2,1),(2,2),(1,2),(1,0),(0,0)) 2 | ((0,0),(0,1),(1,1),(1,2),(2,2),(2,1),(1,1),(1,0),(0,0))The current algorithm for area(PATH) is very quick, but only handlesnon-intersecting paths. I'm going to work on two other functions forthe PATH data type that determines if a PATH is intersecting or not,and a function that returns the area() for an intersecting PATH. Theintersecting area() function will be considerably slower (I think it'sgoing to be O(n!) or worse instead of the current O(n), but that comeswith the territory).Sean Chittenden
1 parente8d9d68 commit70f5a87

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.205 2004/05/26 18:35:31 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.206 2004/06/02 21:34:49 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -5971,6 +5971,22 @@ SELECT TIMESTAMP 'now';
59715971
as an array of two <type>point</> values.
59725972
</para>
59735973

5974+
<para>
5975+
The <function>area</function> function works for the types
5976+
<type>box</type>, <type>circle</type>, and <type>path</type>.
5977+
The <function>area</function> function only works on the
5978+
<type>path</type> data type if the points in the
5979+
<type>path</type> are non-intersecting. For example, the
5980+
<type>path</type>
5981+
<literal>'((0,0),(0,1),(2,1),(2,2),(1,2),(1,0),(0,0))'::PATH</literal>
5982+
won't work, however, the following visually identical
5983+
<type>path</type>
5984+
<literal>'((0,0),(0,1),(1,1),(1,2),(2,2),(2,1),(1,1),(1,0),(0,0))'::PATH</literal>
5985+
will work. If the concept of an intersecting versus
5986+
non-intersecting <type>path</type> is confusing, draw both of the
5987+
above <type>path</type>s side by side on a piece of graph paper.
5988+
</para>
5989+
59745990
</sect1>
59755991

59765992

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp