Hi,

I'm looking for a way to take a flat surface and transform it into a

pseudo 3D hemisphere.

I've trying to apply trig functions to every point in the bitmap to

achieve this but can't quite get the formula right. The result is always

a king of 3D octagon rather than a hemisphere. I'm hoping that someone

may be able to tell me where I'm going wrong....

The source points are mapped to a cartesian plane (where the x and y

axis divide the bitmap into four quarters), then each point gets the

following treatment:

double dAngle = atan2(y, x); // [=

atan(y/x)]

double dNewX = x * cos(dAngle);

double dNewY = y * sin(dAngle);

The new point is then mapped back to pixel coordinates and displayed on

screen.

This bit of code moves the point from its original position towards the

origin. Points at the corners of the bitmap move quite far; points near

the origin or the axis hardly move at all.

The "octagon" I get is pretty close to a hemisphere. I feel I'm *almost*

there, but my maths is so rusty I can't see what to try next. Maybe I

need to modify the x and y in the two lines above, but how?

If anyone can help I'd be grateful.

Cheers,

Gil