Ok, some math following:

we'll start with a simplified case, mapping a line to a circle in 2D space.

suppose we have a line given by a point o_ and a directlional vector y_
which we conveniently normailse to have a length of 1: |y_|=1. The equation
for the line is then

x1_ = o_ + a * y_. (1)

We also have a circle (in polar coordinates) given by an angle phi (in
radians [0..2pi] and a radius R (which will also have a length of 1). A
point x_' on the circle is thus given by (phi1,1).

The line touches the circle at a coordinate phi0, which in the first case
we'll set to 0, see attached d1.gif.

Because the R=1, the length of the circle segment between the touching point
and x_' is equal to phi.

According to (1), because our directional vector is normalised, the distance
of x_ on the line to the touching point is equal to a.

So, if you can compute a, you can compute phi:

phi = a (2).


Now, let's suppose that R<>1. (2) then changes to

phi = a/R. (3)


Furthermore, let's suppose the line does not touch the sphere at phi0=0.
Then:

phi = phi0 + a/R.


For the 3D case, we'll have two angles (phi, delta). If your plane is
aligned in (x,y) direction, calculate the distance of the point you want to
map in x and y coordinates relative to the touching point (dx, dy).

Then,

phi = phi0 + x/R. (4)
delta = delta0 + y/R. (5)

Assuming you know the radius of the sphere and you know that the sphere
touches your plane, you can simplify the calculation of phi0 and delta0 by
transforming the coordinates of the touching point (x0,y0,z0):

phi0 = arctan(y0/x0)
delta0 = arccos(z0/R)

To transform the point in polar coordinates back to cartesian (xs,ys,zs):

xs = R * cos(phi)sin(delta)
ys = R * sin(phi)sin(delta)
zs = R * cos(delta)

so the complete mapping equations are:

xs = R * cos(arctan(y0/x0)+ x/R) * sin(arccos(z0/R) + y/R)
ys = R * sin(arctan(y0/x0)+ x/R)* sin(arccos(z0/R) + y/R)
zs = R * cos(arccos(z0/R) + y/R)

with x0,y0,z0 the coordinates of your touching point and x,y the coordinates
on the plane relative to the touching point. phi0 and delta0 are constant
while the plane remains the same.

This was written before my first coffee, so no warranties given ;). But it
should be reasonably close, anyway.

Max


begin 600 d1.gif
M1TE&.#EA!`&X`/<``````````````````````````````````("`@)*2DJ2D
MI+:VMLC(R-O;V^WM[?___S,``$T``&8``(```)D``+,``,P``.8``/\``/\=
M'?\Z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?2%'DS)TR;.E.>[/E`)D^@"8<2/>H2*4NA1C$R;:K4(-2H
M4:=2=<I4Y-.K':UR!>KUJ\:G9,66#&N6)MJT;-.N;8OR+=RY2N72[7HW[UV[
L>B_R[0OX;&"P@PM3_6M8(>+$C!DN;DP1LN2=DV-6ODSR\63-F#M[GA@0`#L=
`
end

This e-mail and any attachment is for authorised use by the intended recipient(s) 
only.  It may contain proprietary material, confidential information and/or be subject 
to legal privilege.  It should not be copied, disclosed to, retained or used by, any 
other party.  If you are not an intended recipient then please promptly delete this 
e-mail and any attachment and all copies and inform the sender.  Thank you.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to