Hi Brian,

I have a series of 3d points that all lie on a plane in an xyz coordinate
system.  The plane passes through the origin.  Using n, the normal vector
to
the plane, I compute a = (0,0,1) x n and b = n x a to give a new abn
coordinate system.

Does anyone know how to I can use Java 3d to transform the 3d points in
the
xyz coordinate system to points in the new abn coordinate system?
Your problem definition is not very precise =:) How do you want the point
(0,0,0) to be transformed? Should (0,0,0) in xyz should be transformed to
(0,0,0) in nab, which means your origin is the same in both coordinate
systems?!

Assume a vector representing your point, thus vec(p) = vec(0P), where P is
your point and 0 the origin!

You have to project this vector onto the axis of your "plane" coordinate
system. Thus

lambda = vec(p) * vec(a) mu = vec(p) * vec(b) nue = vec(p) * vec(n)

Remarks:

* is scalar product, thus vec(a) * vec(b) = a_x * b_x + a_y * b_y + a_z *
b_z is a scalar (number)

Here we made the assumption that a,b and n are normalized, thus have length
1. If this is not true, normalize a,b and n first, or instead divide
lambda, mu, nue with the length of vec(a) or vec(b) or vec(n) respectively.
F.e. if vec(a) is not length 1 do :
lambda = (vec(p) * vec(a)) / length(vec(a))

Thus lambda, mu and nue are the new coordinates you are looking for! Nue
(component in normal direction) should be zero, since all your points lie
within the plane!

------------------------

2nd possibility:

Image 3 basis vectors a,b,n. Thus the matrix

 / a_x  b_x  n_x \
A=| a_y  b_y  n_y  |
 \ a_z  b_z  n_z /

transforms from basis a,b,n to standard cartesian basis. Image vec(example)
=(1,0,0) in abn-basis. Matrix A applied to vec(example) is A*vec(example) =
(a_x, a_y, a_z). (a_x, a_y, a_z) in standard cartesian coordinates is
equivalent to (1,0,0) in abn-basis. This matrix transforms from basis a,b,n
to standard cartesian basis.

We want the other direction: from standard cartesian coordinates to abn.
Therefore we take the inverse of A = inverse(A). Since abn is an orthogonal
basis, A is also orthogonal. The inverse of an orthognal matrix is just the
transposed Matrix (swap all entries, so that a_i,j = a_j,i). inverse(A)
=transpose(A)

So just setup the matrix B=transpose(A)

 / a_x  a_y  a_z \
B=| b_x  b_y  b_z  |
 \ n_x  n_y  n_z /


If you apply B to your vector p, you obtain:


/ lambda \
| mu     |  = B*p
\ nue    /
F.e. I calculate the first component lambda, which is

lambda = B_1,1 * p_x + B_1,2 * p_y + B_1,3 * p_z
      = a_x   * p_x + a_y   * p_y + a_z   * p_z
      = vec(a)*vec(p)

as said in the first part! Appropiate for mu and nue!

Greetinx and have phun

Martin

===========================================================================
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