Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1cc3464

Browse files
committed
Doc: improve description of geometric multiplication/division.
David Johnston reminded me that the per-point calculations being done by these operators are equivalent to complex multiplication/division. (Once I would've recognized that immediately, but it's been too long since I did any of that sort of math.) Also put in a footnote mentioning that "rotation" of a box doesn't do what you might expect, as I'd griped about in the referenced thread. Discussion: https://postgr.es/m/158110996889.1089.4224139874633222837@wrigleys.postgresql.org
1 parent 48107e3 commit 1cc3464

File tree

1 file changed

+17
-29
lines changed

1 file changed

+17
-29
lines changed

doc/src/sgml/func.sgml

+17-29
Original file line numberDiff line numberDiff line change
@@ -9506,21 +9506,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
95069506
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
95079507
<?br?>
95089508
Multiplies each point of the first argument by the second
9509-
<type>point</type><footnote><para>For this purpose, the
9510-
product of two points
9511-
(<replaceable>x1</replaceable>,<replaceable>y1</replaceable>) and
9512-
(<replaceable>x2</replaceable>,<replaceable>y2</replaceable>) is
9513-
defined as
9514-
(<replaceable>x1</replaceable>*<replaceable>x2</replaceable> -
9515-
<replaceable>y1</replaceable>*<replaceable>y2</replaceable>,
9516-
<replaceable>x1</replaceable>*<replaceable>y2</replaceable> +
9517-
<replaceable>y1</replaceable>*<replaceable>x2</replaceable>).</para></footnote>.
9518-
Interpreting the <type>point</type> as a vector, this is equivalent to
9509+
<type>point</type> (treating a point as being a complex number
9510+
represented by real and imaginary parts, and performing standard
9511+
complex multiplication). If one interprets
9512+
the second <type>point</type> as a vector, this is equivalent to
95199513
scaling the object's size and distance from the origin by the length
95209514
of the vector, and rotating it counterclockwise around the origin by
95219515
the vector's angle from the <replaceable>x</replaceable> axis.
9522-
Available for <type>point</type>, <type>box</type>, <type>path</type>,
9523-
<type>circle</type>.
9516+
Available for <type>point</type>, <type>box</type>,<footnote
9517+
id="functions-geometry-rotation-fn"><para><quote>Rotating</quote> a
9518+
box with these operators only moves its corner points: the box is
9519+
still considered to have sides parallel to the axes. Hence the box's
9520+
size is not preserved, as a true rotation would do.</para></footnote>
9521+
<type>path</type>, <type>circle</type>.
95249522
<?br?>
95259523
<literal>path '((0,0),(1,0),(1,1))' * point '(3.0,0)'</literal>
95269524
<returnvalue>((0,0),(3,0),(3,3))</returnvalue>
@@ -9535,26 +9533,16 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
95359533
<replaceable>geometric_type</replaceable> <literal>/</literal> <type>point</type>
95369534
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
95379535
<?br?>
9538-
Divides each point of the first argument by the
9539-
second <type>point</type><footnote><para>For this purpose, the
9540-
quotient of two points
9541-
(<replaceable>x1</replaceable>,<replaceable>y1</replaceable>) and
9542-
(<replaceable>x2</replaceable>,<replaceable>y2</replaceable>) is
9543-
defined as
9544-
((<replaceable>x1</replaceable>*<replaceable>x2</replaceable> +
9545-
<replaceable>y1</replaceable>*<replaceable>y2</replaceable>) /
9546-
<replaceable>L</replaceable>,
9547-
(<replaceable>y1</replaceable>*<replaceable>x2</replaceable> -
9548-
<replaceable>x1</replaceable>*<replaceable>y2</replaceable>) /
9549-
<replaceable>L</replaceable>),
9550-
where <replaceable>L</replaceable> =
9551-
<replaceable>x2</replaceable>*<replaceable>x2</replaceable> +
9552-
<replaceable>y2</replaceable>*<replaceable>y2</replaceable>.</para></footnote>.
9553-
Interpreting the <type>point</type> as a vector, this is equivalent to
9536+
Divides each point of the first argument by the second
9537+
<type>point</type> (treating a point as being a complex number
9538+
represented by real and imaginary parts, and performing standard
9539+
complex division). If one interprets
9540+
the second <type>point</type> as a vector, this is equivalent to
95549541
scaling the object's size and distance from the origin down by the
95559542
length of the vector, and rotating it clockwise around the origin by
95569543
the vector's angle from the <replaceable>x</replaceable> axis.
9557-
Available for <type>point</type>, <type>box</type>, <type>path</type>,
9544+
Available for <type>point</type>, <type>box</type>,<footnoteref
9545+
linkend="functions-geometry-rotation-fn"/> <type>path</type>,
95589546
<type>circle</type>.
95599547
<?br?>
95609548
<literal>path '((0,0),(1,0),(1,1))' / point '(2.0,0)'</literal>

0 commit comments

Comments
 (0)