Re: [PATCHES] Small doc patch for area() function...

2004-06-02 Thread Bruce Momjian

Doc patch applied.  The geometry diff you attached is related to
negative zeros.  I think you will find geometry_1.out will be a better
match for you. I thought our code now automatically picked the proper
geometry file.  However, I can't find out how that file is used.

---

Sean Chittenden wrote:
 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 handles  
 non-intersecting paths.  I'm going to work on two other functions for  
 the PATH data type that determines if a PATH is intersecting or not,  
 and a function that returns the area() for an intersecting PATH.  The  
 intersecting area() function will be considerably slower (I think it's  
 going to be O(n!) or worse instead of the current O(n), but that comes  
 with the territory).
 
 -sc
 

[ Attachment, skipping... ]

 
 
 
 PS  Right now I'm developing on OS-X and there's a geometry regression 
 test that's returning -0.  FWIW
 
 *** ./expected/geometry.out Fri Oct 31 19:07:07 2003
 --- ./results/geometry.out  Thu May 27 22:16:58 2004
 ***
 *** 117,123 
| (5.1,34.5) | [(1,2),(3,4)] | (3,4)
| (-5,-12)   | [(1,2),(3,4)] | (1,2)
| (10,10)| [(1,2),(3,4)] | (3,4)
 ! | (0,0)  | [(0,0),(6,6)] | (-0,0)
| (-10,0)| [(0,0),(6,6)] | (0,0)
| (-3,4) | [(0,0),(6,6)] | (0.5,0.5)
| (5.1,34.5) | [(0,0),(6,6)] | (6,6)
 --- 117,123 
| (5.1,34.5) | [(1,2),(3,4)] | (3,4)
| (-5,-12)   | [(1,2),(3,4)] | (1,2)
| (10,10)| [(1,2),(3,4)] | (3,4)
 ! | (0,0)  | [(0,0),(6,6)] | (0,0)
| (-10,0)| [(0,0),(6,6)] | (0,0)
| (-3,4) | [(0,0),(6,6)] | (0.5,0.5)
| (5.1,34.5) | [(0,0),(6,6)] | (6,6)
 
 ==
 
 
 
 -- 
 Sean Chittenden

 
 ---(end of broadcast)---
 TIP 7: don't forget to increase your free space map settings

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


[PATCHES] Small doc patch for area() function...

2004-05-27 Thread Sean Chittenden
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 handles  
non-intersecting paths.  I'm going to work on two other functions for  
the PATH data type that determines if a PATH is intersecting or not,  
and a function that returns the area() for an intersecting PATH.  The  
intersecting area() function will be considerably slower (I think it's  
going to be O(n!) or worse instead of the current O(n), but that comes  
with the territory).

-sc
Index: func.sgml
===
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/func.sgml,v
retrieving revision 1.205
diff -u -r1.205 func.sgml
--- func.sgml   26 May 2004 18:35:31 -  1.205
+++ func.sgml   28 May 2004 04:49:43 -
@@ -5971,6 +5971,22 @@
  as an array of two typepoint/ values.
 /para
 
+para
+ The functionarea/function function works for the types
+ typebox/type, typecircle/type, and typepath/type.
+ The functionarea/function function only works on the
+ typepath/type data type if the points in the
+ typepath/type are non-intersecting.  For example, the
+ typepath/type
+ literal'((0,0),(0,1),(2,1),(2,2),(1,2),(1,0),(0,0))'::PATH/literal
+ won't work, however, the following visually identical
+ typepath/type
+ 
literal'((0,0),(0,1),(1,1),(1,2),(2,2),(2,1),(1,1),(1,0),(0,0))'::PATH/literal
+ will work.  If the concept of an intersecting versus
+ non-intersecting typepath/type is confusing, draw both of the
+ above typepath/types side by side on a piece of graph paper.
+/para
+
   /sect1
 
 

PS  Right now I'm developing on OS-X and there's a geometry regression 
test that's returning -0.  FWIW

*** ./expected/geometry.out Fri Oct 31 19:07:07 2003
--- ./results/geometry.out  Thu May 27 22:16:58 2004
***
*** 117,123 
  | (5.1,34.5) | [(1,2),(3,4)] | (3,4)
  | (-5,-12)   | [(1,2),(3,4)] | (1,2)
  | (10,10)| [(1,2),(3,4)] | (3,4)
! | (0,0)  | [(0,0),(6,6)] | (-0,0)
  | (-10,0)| [(0,0),(6,6)] | (0,0)
  | (-3,4) | [(0,0),(6,6)] | (0.5,0.5)
  | (5.1,34.5) | [(0,0),(6,6)] | (6,6)
--- 117,123 
  | (5.1,34.5) | [(1,2),(3,4)] | (3,4)
  | (-5,-12)   | [(1,2),(3,4)] | (1,2)
  | (10,10)| [(1,2),(3,4)] | (3,4)
! | (0,0)  | [(0,0),(6,6)] | (0,0)
  | (-10,0)| [(0,0),(6,6)] | (0,0)
  | (-3,4) | [(0,0),(6,6)] | (0.5,0.5)
  | (5.1,34.5) | [(0,0),(6,6)] | (6,6)
==

--
Sean Chittenden
---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings