On 02-04-2014 17:06, Fabrízio de Royes Mello wrote:
On 02-04-2014 13:30, Fábio Telles Rodriguez wrote:
Roda aí....
select * from
(select array_to_string(array_agg(CASE WHEN
(power((xx.x-25),2)/130+power((yy.y-25),2)/130)=1 THEN '$' WHEN
(sqrt(power(xx.x-20,2)+power(yy.y-20,2)))<2 THEN '#' WHEN
(sqrt(power(xx.x-20,2)+power(yy.y-30,2)))<2 THEN '#' WHEN
(sqrt(power(xx.x-29,2)+power(yy.y-25,2)))<4 THEN '#' WHEN
(power((xx.x-10),2)/40+power((yy.y-10),2)/40)=1 THEN '$' WHEN
(power((xx.x-10),2)/40+power((yy.y-40),2)/40=1) THEN '$' ELSE ' '
END),' ') as cartoon from
(select generate_series(1,40) as x) as xx,(select
generate_series(1,50) as y) as yy group by xx.x order by xx.x) as co_ord;
Tem a manha de fazer um melhor?
http://feedproxy.google.com/~r/blogspot/rFRqt/~3/oTGb8aK0Qt4/cartoon-in-pg.html
Legal.
Já viu esse?
https://wiki.postgresql.org/wiki/Mandelbrot_set
Na verdade no wiki tem vários exemplos legais:
https://wiki.postgresql.org/wiki/Category:Fun_Snippets
Vou adicionar lá esse que o Telles contribuiu tb... :-)
Att,
--
Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral