-1

is there a book or tutorial that show this with simple example?

  • What kind of technology/framework are you using for rendering the cylinder? – micha Dec 21 '12 at 20:29
  • If you don't use OpenGL or DirectX to do it, I can guarantee you, it will not be a *simple* example. – Name Dec 21 '12 at 20:43

1 Answers1

1

I think it is doable.

Java: In standard java one could use BufferedImage, with its getGraphics method yielding a Graphics2D object. And then there are ImageFilters.

For the (non-perspective) math: If one looks straight at a cylinder one sees a width 2*r, which actually is a half-circle pi*r.

actual coordinate:  alpha*r, between -0.5*pi*r and +0.5*pi*r
screen coordinate:  sin(alpha)*r, between -r and +r

Scaled:

screen[x, y] = image[asin(x), y]

On scaling one might interpolate some pixels, taking the average of

image[asin(x-1)+1, y] .. image[asin(x+1)-1, y]
Joop Eggen
  • 107,315
  • 7
  • 83
  • 138