From: rusin@vesuvius.math.niu.edu (Dave Rusin) Newsgroups: sci.math Subject: Re: Repost: Help! Coordinate transformation problem Date: 14 Jun 1997 16:54:52 GMT In article <339ED8D3.41C6@aptnames.austin.ibm.com>, Hal Fulton wrote: > Consider these constraints: > 0 <= x <= 1 > 0 <= y <= 1 > 0 <= z <= 1 > x + y + z = 1 > > We see that the set of possible points (x,y,z) is the triangular > region nestled by the origin in one octant of three-space, the > vertices being the points K(0,0,1), L(0,1,0), and M(1,0,0). > z B > > | | K > K . | /\ > | | / \ > | L | / \ > |_____.__ y |/ \ > / .________._____ A > / > M . M L > / > > x > > Now suppose we pick another coordinate plane with A and B axes > as follows: Origin is point M, positive A axis is in the direction > of L, and so on. Obviously the triangular region lies within this > AB plane, and the AB coordinates of point K would be (I think) > (sqrt(2)/2,sqrt(3)/2). [not quite; see below] > I am trying to find the relatively simple functions that will > transform (x,y,z) to (A,B), that is > A(x,y,z) = ... > B(x,y,z) = ... You want affine functions: A and B will have the form ax+by+cz+d Determine a b c d by stating where the points should go. M: (sqrt(2), 0, 0) -> (0,0) L: (0, sqrt(2), 0) -> (sqrt(2),0) K: (0, 0, sqrt(2)) -> (sqrt(2)/2, w) (Here you know the distance from K to M so 2 = (1/2) + w^2 implies w = sqrt(6)/2.) Similarly I assume you want a rigid motion, so the origin should get sent to some place of distance 1 from M, L, and K. If this point is (x0,y0,z0) then you get 3 equations to determine these three coordinates. I'll save you the trouble: they solve to x0=sqrt(2)/2, y0=sqrt(6)/6. So for the first coordinate function A we have a*sqrt(2) + d = 0, b*sqrt(2) + d = sqrt(2), c*sqrt(2) + d = sqrt(2)/2, and d = sqrt(2)/2. That is, A(x,y,z) = (-1/2)x + (1/2)y + 0 z + sqrt(2)/2 Likewise B(x,y,z) = (-sqrt(3)/6)x+(-sqrt(3)/6)y+(sqrt(3)/3)z+(sqrt(6)/6) if I've done the arithmetic correctly. dave