Es werden Posts vom Februar, 2009 angezeigt.

Lens effect

There is a cool new 256b intro at, called ind. It shows a rotating sphere divided into several fields, which flicker in funky colours. This intro is basically based on the lens effect. The lens effect is a distortion that projects all pixels from a square onto a circle surrounding it. How is this done? If we try to imagine how it works, we will perhaps start with the y coordinates of the projection of the topmost line of the square: We notice that the points in the horizontal center are the topmost ones and the elevation declines to the edges, where it becomes zero, i.e. the edges are printed at the same position as in the square. With what mathematical formula can this be achieved? Simple subtraction wouldn't make it a circle. We need a trigonometric function. Which one? Let's figure it out: We use the distance from the horizontal center point as its parameter. If it is 0, the height must have the highest value, and if it is maximal, the height must be 0. A trigo