Re: what do the operator * exactly ?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: what do the operator * exactly ?
Дата
Msg-id 20020530000306.A9107@svana.org
обсуждение исходный текст
Ответ на what do the operator * exactly ?  (molinet <molinet@ibp.u-psud.fr>)
Список 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 по дате отправления:

Предыдущее
От: molinet
Дата:
Сообщение: what do the operator * exactly ?
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: what do the operator * exactly ?