From 261c7d4b653bc3e44c31fd456d94f292caa50d8f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 9 Oct 2013 01:09:18 -0400 Subject: Revive line type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the input/output format to {A,B,C}, to match the internal representation. Complete the implementations of line_in, line_out, line_recv, line_send. Remove comments and error messages about the line type not being implemented. Add regression tests for existing line operators and functions. Reviewed-by: rui hua <365507506hua@gmail.com> Reviewed-by: Álvaro Herrera Reviewed-by: Jeevan Chalke --- doc/src/sgml/datatype.sgml | 42 ++++++++++++++++++++++++++++++++++++------ doc/src/sgml/func.sgml | 6 ++++++ 2 files changed, 42 insertions(+), 6 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 87668ea0c1c..07f0385d80d 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -3051,9 +3051,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays Geometric data types represent two-dimensional spatial objects. shows the geometric - types available in PostgreSQL. The - most fundamental type, the point, forms the basis for all of the - other types. + types available in PostgreSQL. @@ -3063,8 +3061,8 @@ SELECT person.name, holidays.num_weeks FROM person, holidays Name Storage Size - Representation Description + Representation @@ -3077,8 +3075,8 @@ SELECT person.name, holidays.num_weeks FROM person, holidays line 32 bytes - Infinite line (not fully implemented) - ((x1,y1),(x2,y2)) + Infinite line + {A,B,C} lseg @@ -3152,6 +3150,38 @@ SELECT person.name, holidays.num_weeks FROM person, holidays + + Lines + + + line + + + + Lines (line) are represented by the linear equation Ax + By + + C = 0, where A and B are not both zero. Values of + type line is input and output in the following form: + +{ A, B, C } + + + Alternatively, any of the following forms can be used for input: + + +[ ( x1 , y1 ) , ( x2 , y2 ) ] +( ( x1 , y1 ) , ( x2 , y2 ) ) + ( x1 , y1 ) , ( x2 , y2 ) + x1 , y1 , x2 , y2 + + + where + (x1,y1) + and + (x2,y2) + are two (different) points on the line. + + + Line Segments diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index c3090dd2b9f..be7b00b1f32 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -8122,6 +8122,12 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple polygon to circle circle(polygon '((0,0),(1,1),(2,0))') + + line(point, point) + line + points to line + line(point '(-1,0)', point '(1,0)') + -- cgit v1.2.3