Doc: improve description of geometric multiplication/division.
authorTom Lane
Thu, 23 Apr 2020 01:32:38 +0000 (21:32 -0400)
committerTom Lane
Thu, 23 Apr 2020 01:32:46 +0000 (21:32 -0400)
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

doc/src/sgml/func.sgml

index 90a2582dfd1d4fe2dafda5b5ca9b27036532529b..63b870de04898731fccc15d4122d999c79e35c73 100644 (file)
@@ -9506,21 +9506,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
         geometric_type
        
         Multiplies each point of the first argument by the second
-        pointFor this purpose, the
-        product of two points
-        (x1,y1) and
-        (x2,y2) is
-        defined as
-        (x1*x2 -
-        y1*y2,
-        x1*y2 +
-        y1*x2)..
-        Interpreting the point as a vector, this is equivalent to
+        point (treating a point as being a complex number
+        represented by real and imaginary parts, and performing standard
+        complex multiplication).  If one interprets
+        the second point as a vector, this is equivalent to
         scaling the object's size and distance from the origin by the length
         of the vector, and rotating it counterclockwise around the origin by
         the vector's angle from the x axis.
-        Available for pointboxpath,
-        circle.
+        Available for pointbox,
+        id="functions-geometry-rotation-fn">Rotating 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.
+        pathcircle.
        
         path '((0,0),(1,0),(1,1))' * point '(3.0,0)'
         ((0,0),(3,0),(3,3))
@@ -9535,26 +9533,16 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
         geometric_type / point
         geometric_type
        
-        Divides each point of the first argument by the
-        second pointFor this purpose, the
-        quotient of two points
-        (x1,y1) and
-        (x2,y2) is
-        defined as
-        ((x1*x2 +
-        y1*y2) /
-        L,
-        (y1*x2 -
-        x1*y2) /
-        L),
-        where L =
-        x2*x2 +
-        y2*y2..
-        Interpreting the point as a vector, this is equivalent to
+        Divides each point of the first argument by the second
+        point (treating a point as being a complex number
+        represented by real and imaginary parts, and performing standard
+        complex division).  If one interprets
+        the second point as a vector, this is equivalent to
         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
         the vector's angle from the x axis.
-        Available for pointboxpath,
+        Available for pointbox,
+        linkend="functions-geometry-rotation-fn"/> path,
         circle.
        
         path '((0,0),(1,0),(1,1))' / point '(2.0,0)'