Re: what do the operator * exactly ?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: molinet <molinet(at)ibp(dot)u-psud(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: what do the operator * exactly ?
Date: 2002-05-29 14:03:06
Message-ID: 20020530000306.A9107@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Lockhart 2002-05-29 14:11:59 Re: what do the operator * exactly ?
Previous Message Marcia Abade 2002-05-29 13:55:12 Privileges Doubts