Jump to content

Rodar uma imagem


jolucab
 Share

Recommended Posts

Ola pessoal!

Tenho uma dúvida. Quem poderá orientar-me como rodar uma imagem em haskell a 90 ou a 180 graus.

A imagem é essa:

type Picture = [string]

p::Picture

p= ["......",

    ".####.",

    ".#..#.",

    ".####.",

    ".#....",

    ".#...."]

Eu quero fazer esta função assim definida : rotate90 :: Picture -> Picture

Logicamente percebo o que fazer, mas não sei como fazer e quero uma ilucidação.

Obrigado

Link to comment
Share on other sites

Acho que o resultado do transpose não será uma rotação. Deve ser necessário ainda inverter as listas.

De qualquer forma, uma rotação de 90º=-270º=3*(-90º). Ou seja, basta aplicar 3 vezes a função que faz uma rotação de -90º para se obter uma rotação de 90º. Obviamente que 180º=-180º=2*(-90º).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.