Skip to content

Commit 261c7d4

Browse files
committed
Revive line type
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 <alvherre@2ndquadrant.com> Reviewed-by: Jeevan Chalke <jeevan.chalke@enterprisedb.com>
1 parent 0ac5e5a commit 261c7d4

File tree

13 files changed

+503
-153
lines changed

13 files changed

+503
-153
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3051,9 +3051,7 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
30513051
<para>
30523052
Geometric data types represent two-dimensional spatial
30533053
objects. <xref linkend="datatype-geo-table"> shows the geometric
3054-
types available in <productname>PostgreSQL</productname>. The
3055-
most fundamental type, the point, forms the basis for all of the
3056-
other types.
3054+
types available in <productname>PostgreSQL</productname>.
30573055
</para>
30583056

30593057
<table id="datatype-geo-table">
@@ -3063,8 +3061,8 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
30633061
<row>
30643062
<entry>Name</entry>
30653063
<entry>Storage Size</entry>
3066-
<entry>Representation</entry>
30673064
<entry>Description</entry>
3065+
<entry>Representation</entry>
30683066
</row>
30693067
</thead>
30703068
<tbody>
@@ -3077,8 +3075,8 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
30773075
<row>
30783076
<entry><type>line</type></entry>
30793077
<entry>32 bytes</entry>
3080-
<entry>Infinite line (not fully implemented)</entry>
3081-
<entry>((x1,y1),(x2,y2))</entry>
3078+
<entry>Infinite line</entry>
3079+
<entry>{A,B,C}</entry>
30823080
</row>
30833081
<row>
30843082
<entry><type>lseg</type></entry>
@@ -3152,6 +3150,38 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
31523150
</para>
31533151
</sect2>
31543152

3153+
<sect2>
3154+
<title>Lines</title>
3155+
3156+
<indexterm>
3157+
<primary>line</primary>
3158+
</indexterm>
3159+
3160+
<para>
3161+
Lines (<type>line</type>) are represented by the linear equation Ax + By
3162+
+ C = 0, where A and B are not both zero. Values of
3163+
type <type>line</type> is input and output in the following form:
3164+
<synopsis>
3165+
{ <replaceable>A</replaceable>, <replaceable>B</replaceable>, <replaceable>C</replaceable> }
3166+
</synopsis>
3167+
3168+
Alternatively, any of the following forms can be used for input:
3169+
3170+
<synopsis>
3171+
[ ( <replaceable>x1</replaceable> , <replaceable>y1</replaceable> ) , ( <replaceable>x2</replaceable> , <replaceable>y2</replaceable> ) ]
3172+
( ( <replaceable>x1</replaceable> , <replaceable>y1</replaceable> ) , ( <replaceable>x2</replaceable> , <replaceable>y2</replaceable> ) )
3173+
( <replaceable>x1</replaceable> , <replaceable>y1</replaceable> ) , ( <replaceable>x2</replaceable> , <replaceable>y2</replaceable> )
3174+
<replaceable>x1</replaceable> , <replaceable>y1</replaceable> , <replaceable>x2</replaceable> , <replaceable>y2</replaceable>
3175+
</synopsis>
3176+
3177+
where
3178+
<literal>(<replaceable>x1</replaceable>,<replaceable>y1</replaceable>)</literal>
3179+
and
3180+
<literal>(<replaceable>x2</replaceable>,<replaceable>y2</replaceable>)</literal>
3181+
are two (different) points on the line.
3182+
</para>
3183+
</sect2>
3184+
31553185
<sect2>
31563186
<title>Line Segments</title>
31573187

doc/src/sgml/func.sgml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8122,6 +8122,12 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
81228122
<entry>polygon to circle</entry>
81238123
<entry><literal>circle(polygon '((0,0),(1,1),(2,0))')</literal></entry>
81248124
</row>
8125+
<row>
8126+
<entry><literal><function>line(<type>point</type>, <type>point</type>)</function></literal></entry>
8127+
<entry><type>line</type></entry>
8128+
<entry>points to line</entry>
8129+
<entry><literal>line(point '(-1,0)', point '(1,0)')</literal></entry>
8130+
</row>
81258131
<row>
81268132
<entry>
81278133
<indexterm>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy