Re: what do the operator * exactly ? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: what do the operator * exactly ?
Date
Msg-id 20020530000306.A9107@svana.org
Whole thread Raw
In response to what do the operator * exactly ?  (molinet <molinet@ibp.u-psud.fr>)
List pgsql-general
On Wed, May 29, 2002 at 03:48:22PM +0200, molinet wrote:
> Does somebody can explain me what the operators * and / do exactly?
> for example
> select '(1,1)'::point * '(2,2)':: point ;
> gives
> (0,4)

Well, i imagine it's treating them like complex numbers and multiplying them
giving a rotation/scale conbination.

(1 + 1i) * (2 + 2i) = (0 + 4i)

> select '(1,1)'::point * '(3,3)'::point ;
> gives
> (0,6)

(1 + 1i) * (3 + 3i) = (0 + 6i)

> and what does the / operator ?
> thanks for your response

Does a division probably. It's a bit tricky analytically but if you imagine
that the point (2,2) means to scale by 2*sqrt(2) (the distance from (0,0))
and to rotate by 45 degrees (the angle between the X-axis and the line
joining (0,0) and (2,2)) you're getting there.

HTH,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Canada, Mexico, and Australia form the Axis of Nations That
> Are Actually Quite Nice But Secretly Have Nasty Thoughts About America

pgsql-general by date:

Previous
From: molinet
Date:
Subject: what do the operator * exactly ?
Next
From: Thomas Lockhart
Date:
Subject: Re: what do the operator * exactly ?