diff --git a/src/test/regress/expected/polygon.out b/src/test/regress/expected/polygon.out
index b252902..66ff51d 100644
--- a/src/test/regress/expected/polygon.out
+++ b/src/test/regress/expected/polygon.out
@@ -1,28 +1,28 @@
 --
 -- POLYGON
 --
 -- polygon logic
 --
 -- 3	      o
---	      |
+--		      |
 -- 2	    + |
---	   /  |
--- 1	  # o +
---       /    |
+--		   /  |
+-- 1	  #   +
+--       /  o |
 -- 0	#-----o-+
 --
---	0 1 2 3 4
+--		0 1 2 3 4
 --
 CREATE TABLE POLYGON_TBL(f1 polygon);
-INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)');
-INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)');
+INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,2.0),(0.0,0.0),(4.0,0.0)');
+INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,3.0),(1.0,1.0),(3.0,0.0)');
 -- degenerate polygons
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)');
 -- bad polygon input strings
 INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
 ERROR:  invalid input syntax for type polygon: "0.0"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
                                             ^
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0');
 ERROR:  invalid input syntax for type polygon: "(0.0 0.0"
@@ -36,157 +36,170 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
 ERROR:  invalid input syntax for type polygon: "(0,1,2,3"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
                                             ^
 INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
 ERROR:  invalid input syntax for type polygon: "asdf"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
                                             ^
 SELECT '' AS four, * FROM POLYGON_TBL;
  four |         f1          
 ------+---------------------
-      | ((2,0),(2,4),(0,0))
-      | ((3,1),(3,3),(1,0))
+      | ((2,2),(0,0),(4,0))
+      | ((3,3),(1,1),(3,0))
       | ((0,0))
       | ((0,1),(0,1))
 (4 rows)
 
 -- overlap
 SELECT '' AS three, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 && '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  three |         f1          
 -------+---------------------
-       | ((2,0),(2,4),(0,0))
-       | ((3,1),(3,3),(1,0))
+       | ((2,2),(0,0),(4,0))
+       | ((3,3),(1,1),(3,0))
 (2 rows)
 
 -- left overlap
 SELECT '' AS four, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 &< '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  four |         f1          
 ------+---------------------
-      | ((2,0),(2,4),(0,0))
-      | ((3,1),(3,3),(1,0))
+      | ((3,3),(1,1),(3,0))
       | ((0,0))
       | ((0,1),(0,1))
-(4 rows)
+(3 rows)
 
 -- right overlap
 SELECT '' AS two, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 &> '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  two |         f1          
 -----+---------------------
-     | ((3,1),(3,3),(1,0))
+     | ((3,3),(1,1),(3,0))
 (1 row)
 
 -- left of
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 << '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  one |      f1       
 -----+---------------
      | ((0,0))
      | ((0,1),(0,1))
 (2 rows)
 
 -- right of
 SELECT '' AS zero, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 >> '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  zero | f1 
 ------+----
 (0 rows)
 
 -- contained
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 <@ polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  one |         f1          
 -----+---------------------
-     | ((3,1),(3,3),(1,0))
+     | ((3,3),(1,1),(3,0))
 (1 row)
 
 -- same
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 ~= polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  one |         f1          
 -----+---------------------
-     | ((3,1),(3,3),(1,0))
+     | ((3,3),(1,1),(3,0))
 (1 row)
 
 -- contains
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 @> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
  one |         f1          
 -----+---------------------
-     | ((3,1),(3,3),(1,0))
+     | ((3,3),(1,1),(3,0))
 (1 row)
 
 --
 -- polygon logic
 --
 -- 3	      o
---	      |
--- 2	    + |
---	   /  |
+--		     /|
+-- 2		+ |
+--		   /  |
 -- 1	  / o +
 --       /    |
 -- 0	+-----o-+
 --
---	0 1 2 3 4
+--		0 1 2 3 4
 --
 -- left of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' << polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
  false 
 -------
  f
 (1 row)
 
 -- left overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' << polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS true;
  true 
 ------
  f
 (1 row)
 
 -- right overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' &> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
  false 
 -------
  f
 (1 row)
 
 -- right of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' >> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' >> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
  false 
 -------
  f
 (1 row)
 
 -- contained in
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' <@ polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
  false 
 -------
  f
 (1 row)
 
 -- contains
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' @> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
  false 
 -------
  f
 (1 row)
 
+-- same
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' ~= polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
+ false 
+-------
+ f
+(1 row)
+
+-- overlap
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' && polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS true;
+ true 
+------
+ t
+(1 row)
+
 --     +------------------------+
 --     |    *---*               1
 --     |  + |   |
 --     |  2 *---*
 --     +------------------------+
 --                              3
 --     endpoints '+' is ofr one polygon, '*' - for another
 --     Edges 1-2, 2-3 are not shown on picture
 SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon @> '((2,1),(2,3),(3,3),(3,1))'::polygon AS "false";
  false 
@@ -226,34 +239,20 @@ SELECT '((1,1),(1,4),(5,4),(5,3),(2,3),(2,2),(5,2),(5,1))'::polygon @> '((3,2),(
 --     |    |    |
 --     |    *----*
 --     |         |
 --     +---------+
 SELECT '((0,0),(0,3),(3,3),(3,0))'::polygon @> '((2,1),(2,2),(3,2),(3,1))'::polygon AS "true";
  true 
 ------
  t
 (1 row)
 
--- same
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
- false 
--------
- f
-(1 row)
-
--- overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' && polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
- true 
-------
- t
-(1 row)
-
 --     +--------------------+
 --     |    *---*       	1
 --     |  + |   |
 --     |  2 *---*
 --     +--------------------+
 --                      	3
 --     Edges 1-2, 2-3 are not shown on picture
 SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon && '((2,1),(2,3),(3,3),(3,1))'::polygon AS "true";
  true 
 ------
diff --git a/src/test/regress/sql/polygon.sql b/src/test/regress/sql/polygon.sql
index 2dad566..1468b66 100644
--- a/src/test/regress/sql/polygon.sql
+++ b/src/test/regress/sql/polygon.sql
@@ -1,32 +1,32 @@
 --
 -- POLYGON
 --
 -- polygon logic
 --
 -- 3	      o
---	      |
+--		      |
 -- 2	    + |
---	   /  |
--- 1	  # o +
---       /    |
+--		   /  |
+-- 1	  #   +
+--       /  o |
 -- 0	#-----o-+
 --
---	0 1 2 3 4
+--		0 1 2 3 4
 --
 
 CREATE TABLE POLYGON_TBL(f1 polygon);
 
 
-INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)');
+INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,2.0),(0.0,0.0),(4.0,0.0)');
 
-INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)');
+INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,3.0),(1.0,1.0),(3.0,0.0)');
 
 -- degenerate polygons
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)');
 
 -- bad polygon input strings
 INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0');
@@ -36,87 +36,93 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
 
 
 SELECT '' AS four, * FROM POLYGON_TBL;
 
 -- overlap
 SELECT '' AS three, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 && '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 -- left overlap
 SELECT '' AS four, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 &< '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 -- right overlap
 SELECT '' AS two, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 &> '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 -- left of
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 << '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 -- right of
 SELECT '' AS zero, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 >> '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 -- contained
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 <@ polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 -- same
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 ~= polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 -- contains
 SELECT '' AS one, p.*
    FROM POLYGON_TBL p
-   WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
+   WHERE p.f1 @> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)';
 
 --
 -- polygon logic
 --
 -- 3	      o
---	      |
--- 2	    + |
---	   /  |
+--		     /|
+-- 2		+ |
+--		   /  |
 -- 1	  / o +
 --       /    |
 -- 0	+-----o-+
 --
---	0 1 2 3 4
+--		0 1 2 3 4
 --
 -- left of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' << polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
 
 -- left overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' << polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS true;
 
 -- right overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' &> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
 
 -- right of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' >> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' >> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
 
 -- contained in
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' <@ polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
 
 -- contains
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' @> polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
+
+-- same
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' ~= polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS false;
+
+-- overlap
+SELECT polygon '(2.0,2.0),(0.0,0.0),(4.0,0.0)' && polygon '(3.0,3.0),(1.0,1.0),(3.0,0.0)' AS true;
 
 --     +------------------------+
 --     |    *---*               1
 --     |  + |   |
 --     |  2 *---*
 --     +------------------------+
 --                              3
 --     endpoints '+' is ofr one polygon, '*' - for another
 --     Edges 1-2, 2-3 are not shown on picture
 SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon @> '((2,1),(2,3),(3,3),(3,1))'::polygon AS "false";
@@ -141,26 +147,20 @@ SELECT '((1,1),(1,4),(5,4),(5,3),(2,3),(2,2),(5,2),(5,1))'::polygon @> '((3,2),(
 
 --     +---------+
 --     |         |
 --     |    *----*
 --     |    |    |
 --     |    *----*
 --     |         |
 --     +---------+
 SELECT '((0,0),(0,3),(3,3),(3,0))'::polygon @> '((2,1),(2,2),(3,2),(3,1))'::polygon AS "true";
 
--- same
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-
--- overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' && polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
-
 --     +--------------------+
 --     |    *---*       	1
 --     |  + |   |
 --     |  2 *---*
 --     +--------------------+
 --                      	3
 --     Edges 1-2, 2-3 are not shown on picture
 SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon && '((2,1),(2,3),(3,3),(3,1))'::polygon AS "true";
 
 --     +--+ *--*
