mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
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
This commit is contained in:
parent
48107e396f
commit
1cc34640ca
@ -9506,21 +9506,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
|||||||
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
|
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
|
||||||
<?br?>
|
<?br?>
|
||||||
Multiplies each point of the first argument by the second
|
Multiplies each point of the first argument by the second
|
||||||
<type>point</type><footnote><para>For this purpose, the
|
<type>point</type> (treating a point as being a complex number
|
||||||
product of two points
|
represented by real and imaginary parts, and performing standard
|
||||||
(<replaceable>x1</replaceable>,<replaceable>y1</replaceable>) and
|
complex multiplication). If one interprets
|
||||||
(<replaceable>x2</replaceable>,<replaceable>y2</replaceable>) is
|
the second <type>point</type> as a vector, this is equivalent to
|
||||||
defined as
|
|
||||||
(<replaceable>x1</replaceable>*<replaceable>x2</replaceable> -
|
|
||||||
<replaceable>y1</replaceable>*<replaceable>y2</replaceable>,
|
|
||||||
<replaceable>x1</replaceable>*<replaceable>y2</replaceable> +
|
|
||||||
<replaceable>y1</replaceable>*<replaceable>x2</replaceable>).</para></footnote>.
|
|
||||||
Interpreting the <type>point</type> as a vector, this is equivalent to
|
|
||||||
scaling the object's size and distance from the origin by the length
|
scaling the object's size and distance from the origin by the length
|
||||||
of the vector, and rotating it counterclockwise around the origin by
|
of the vector, and rotating it counterclockwise around the origin by
|
||||||
the vector's angle from the <replaceable>x</replaceable> axis.
|
the vector's angle from the <replaceable>x</replaceable> axis.
|
||||||
Available for <type>point</type>, <type>box</type>, <type>path</type>,
|
Available for <type>point</type>, <type>box</type>,<footnote
|
||||||
<type>circle</type>.
|
id="functions-geometry-rotation-fn"><para><quote>Rotating</quote> a
|
||||||
|
box with these operators only moves its corner points: the box is
|
||||||
|
still considered to have sides parallel to the axes. Hence the box's
|
||||||
|
size is not preserved, as a true rotation would do.</para></footnote>
|
||||||
|
<type>path</type>, <type>circle</type>.
|
||||||
<?br?>
|
<?br?>
|
||||||
<literal>path '((0,0),(1,0),(1,1))' * point '(3.0,0)'</literal>
|
<literal>path '((0,0),(1,0),(1,1))' * point '(3.0,0)'</literal>
|
||||||
<returnvalue>((0,0),(3,0),(3,3))</returnvalue>
|
<returnvalue>((0,0),(3,0),(3,3))</returnvalue>
|
||||||
@ -9535,26 +9533,16 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
|
|||||||
<replaceable>geometric_type</replaceable> <literal>/</literal> <type>point</type>
|
<replaceable>geometric_type</replaceable> <literal>/</literal> <type>point</type>
|
||||||
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
|
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
|
||||||
<?br?>
|
<?br?>
|
||||||
Divides each point of the first argument by the
|
Divides each point of the first argument by the second
|
||||||
second <type>point</type><footnote><para>For this purpose, the
|
<type>point</type> (treating a point as being a complex number
|
||||||
quotient of two points
|
represented by real and imaginary parts, and performing standard
|
||||||
(<replaceable>x1</replaceable>,<replaceable>y1</replaceable>) and
|
complex division). If one interprets
|
||||||
(<replaceable>x2</replaceable>,<replaceable>y2</replaceable>) is
|
the second <type>point</type> as a vector, this is equivalent to
|
||||||
defined as
|
|
||||||
((<replaceable>x1</replaceable>*<replaceable>x2</replaceable> +
|
|
||||||
<replaceable>y1</replaceable>*<replaceable>y2</replaceable>) /
|
|
||||||
<replaceable>L</replaceable>,
|
|
||||||
(<replaceable>y1</replaceable>*<replaceable>x2</replaceable> -
|
|
||||||
<replaceable>x1</replaceable>*<replaceable>y2</replaceable>) /
|
|
||||||
<replaceable>L</replaceable>),
|
|
||||||
where <replaceable>L</replaceable> =
|
|
||||||
<replaceable>x2</replaceable>*<replaceable>x2</replaceable> +
|
|
||||||
<replaceable>y2</replaceable>*<replaceable>y2</replaceable>.</para></footnote>.
|
|
||||||
Interpreting the <type>point</type> as a vector, this is equivalent to
|
|
||||||
scaling the object's size and distance from the origin down by the
|
scaling the object's size and distance from the origin down by the
|
||||||
length of the vector, and rotating it clockwise around the origin by
|
length of the vector, and rotating it clockwise around the origin by
|
||||||
the vector's angle from the <replaceable>x</replaceable> axis.
|
the vector's angle from the <replaceable>x</replaceable> axis.
|
||||||
Available for <type>point</type>, <type>box</type>, <type>path</type>,
|
Available for <type>point</type>, <type>box</type>,<footnoteref
|
||||||
|
linkend="functions-geometry-rotation-fn"/> <type>path</type>,
|
||||||
<type>circle</type>.
|
<type>circle</type>.
|
||||||
<?br?>
|
<?br?>
|
||||||
<literal>path '((0,0),(1,0),(1,1))' / point '(2.0,0)'</literal>
|
<literal>path '((0,0),(1,0),(1,1))' / point '(2.0,0)'</literal>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user