## 2D plane -> 3D hemisphere with trig?

### 2D plane -> 3D hemisphere with trig?

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

### 2D plane -> 3D hemisphere with trig?

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

I'd appreciate a little help with this 2D trig problem. See diagram
here:

www.ai-junkie.com/occluded_segment.jpg

Given points A, B, C, D and radius r, what's the best (read fastest)
way to calculate points p1 and p2?

thanks

8. HELP

9. 2D->3D?

13. 2D TIFF->3D