- #1
LMHmedchem
- 20
- 0
I have posted this in University linear algebra, but it is possible there is a simple answer for this and the the problem belongs in some other forum. I apologize if that is the case.
I am starting with 3 points in 3 space, along with the centroid of the full data set. The data is in principle components so the centroid is at the origin (within floating point variance). I am rotating that data to new coordinates according to the following method.
I create 3 vectors by taking the difference between each point and the centroid using, the standard formula for creating a vector between two points.
vx = xdest - xsrc
vy = ydest - ysrc
vz = zdest - zsrc
...
vn = ndest - nsrc
Below, "point 1" refers to the point in the original coordinates and "point A" refers to the same point in the rotated coordinate system.
To generate the rotated coordinates:
1. Call the origin point O, 0,0,0
2. Place the point 1 vector along the x-axis with the tail of the vector at the origin and the tip at the magnitude of the vector between the centroid and point 1. This forms vector OA where the y and z values of point A are arbitrarily set to 0 and the x-axis value is |OA|.
3. Place the point 2 vector in the xy-plane. This forms the vector OB with the tail at the origin and point B with x,y coordinates determined as,
Bx = Ox + d*cos(AOB)
By = Oy + d*sin(AOB)
where Ox, Oy is the tail of the vector at the origin, d is the magnitude of OB, and AOB is the angle between OA and OB (angle determined from vectors placed in the original coordinates). Since point B is arbitrarily in the xy plane, the z coordinate value is set to 0.0.
4. Place the point 3 vector with the tail at the origin and the tip at point C. This point will have some values of x,y, and z. Since there will be two possible solutions for the z value of point C, we will keep this right handed and assign the z coordinate as positive.
Where I am stuck is how I am to determine the x,y,z coordinates of the point C.
Here is a specific example from my data.
point 1 becomes vector OA (from origin to point A)
vector OA is along the x-axis (y=0, z=0)
call the tip of vector OA point A
vector magnitude = 5.95911
coordinates: 5.95911, 0, 0
point 2 becomes vector OB (from origin to point B)
vector OB is in the xy plane (z=0)
call the tip of vector OB point B
vector magnitude = 2.90191
angle AOB = 148.77 (degrees), 2.59652 (radians)
coordinates: -2.4814, 5.4179, 0
point 3 becomes vector OC (from origin to point C)
I know the following about vector OC,
1. magnitude = 5.85867
2. angle AOC = 3.31715 (degrees), 0.0578952 (radians)
3. angle BOC = 152.013 (degrees), 2.65313 (radians)
4. The plane of angle AOB intersects with the plane of angle AOC along OA (the x-axis). The angle at which these planes intersect is 12.7435 (degrees), 0.2224160332 (radians).
It seems as if there should be more then enough information here, but I haven't found a formula and I can't seem to quite parse it out. I have not found the 3d equivalent of the formula used to calculate the x and y values for point B.
Since I know the angle at which the AOB and AOC planes intersect, my thought was to use the formulas used to determine x,y for point B to place a point in the xz plane and set y = 0. This would give me a new vector OD, with the magnitude of OC and the correct x and z coordinates for OC (I think).
Since AOB is in the xy plane and the new vector AOD is in the xz plane, the angle of the AOB AOD plane intersection is 90 degrees. This would meant that the angle between the vector OC (the vector I am solving for) and OD would be the difference between 90 (AOB AOD plane intersection angle) and the AOB AOC plane intersection angle. That would be angle COD = 90 - 12.7435 = 77.2565 (degrees), 1.348380294 (radians).
It seem like I should be able to use that information to determine the y-axis value as,
Cy = Oy + dOC*sin(COD), COD in radians
meaning that the y-axis value of point C would be 0 + the magnitude of OC times the sine of the angle COD.
I guess I am trying to swing the vector OD in the xz plane to the known plane intersection angle. I'm not sure if this changes the just the y-axis value or if I also need to calculate a new x, or if I am thinking about this in any way that is at all reasonable.
My guess is that there is a straightforward formula for this and I just don't know the proper search terms to find it. I would like a clearer understating of the relationships here as well. Formulas are nice, but you can get in plenty of trouble applying them if you don't fully understand the theory.
Thanks for the help if you have time. Please let me know if there is anything that needs to be clarified. I could post data for a 3d R plot if that would help. Let me know.
LMHmedchem
I am starting with 3 points in 3 space, along with the centroid of the full data set. The data is in principle components so the centroid is at the origin (within floating point variance). I am rotating that data to new coordinates according to the following method.
I create 3 vectors by taking the difference between each point and the centroid using, the standard formula for creating a vector between two points.
vx = xdest - xsrc
vy = ydest - ysrc
vz = zdest - zsrc
...
vn = ndest - nsrc
Below, "point 1" refers to the point in the original coordinates and "point A" refers to the same point in the rotated coordinate system.
To generate the rotated coordinates:
1. Call the origin point O, 0,0,0
2. Place the point 1 vector along the x-axis with the tail of the vector at the origin and the tip at the magnitude of the vector between the centroid and point 1. This forms vector OA where the y and z values of point A are arbitrarily set to 0 and the x-axis value is |OA|.
3. Place the point 2 vector in the xy-plane. This forms the vector OB with the tail at the origin and point B with x,y coordinates determined as,
Bx = Ox + d*cos(AOB)
By = Oy + d*sin(AOB)
where Ox, Oy is the tail of the vector at the origin, d is the magnitude of OB, and AOB is the angle between OA and OB (angle determined from vectors placed in the original coordinates). Since point B is arbitrarily in the xy plane, the z coordinate value is set to 0.0.
4. Place the point 3 vector with the tail at the origin and the tip at point C. This point will have some values of x,y, and z. Since there will be two possible solutions for the z value of point C, we will keep this right handed and assign the z coordinate as positive.
Where I am stuck is how I am to determine the x,y,z coordinates of the point C.
Here is a specific example from my data.
Code:
[B]row[/B] [B]x[/B] [B]y[/B] [B]z[/B]
centroid 0.00000012977 0.00000001496 -0.00000001033
point_1 -5.63359 1.92305 0.274911
point_2 -2.87059 -0.492249 0.178748
point_3 -5.63085 1.57711 0.360911
point 1 becomes vector OA (from origin to point A)
vector OA is along the x-axis (y=0, z=0)
call the tip of vector OA point A
vector magnitude = 5.95911
coordinates: 5.95911, 0, 0
point 2 becomes vector OB (from origin to point B)
vector OB is in the xy plane (z=0)
call the tip of vector OB point B
vector magnitude = 2.90191
angle AOB = 148.77 (degrees), 2.59652 (radians)
coordinates: -2.4814, 5.4179, 0
point 3 becomes vector OC (from origin to point C)
I know the following about vector OC,
1. magnitude = 5.85867
2. angle AOC = 3.31715 (degrees), 0.0578952 (radians)
3. angle BOC = 152.013 (degrees), 2.65313 (radians)
4. The plane of angle AOB intersects with the plane of angle AOC along OA (the x-axis). The angle at which these planes intersect is 12.7435 (degrees), 0.2224160332 (radians).
It seems as if there should be more then enough information here, but I haven't found a formula and I can't seem to quite parse it out. I have not found the 3d equivalent of the formula used to calculate the x and y values for point B.
Since I know the angle at which the AOB and AOC planes intersect, my thought was to use the formulas used to determine x,y for point B to place a point in the xz plane and set y = 0. This would give me a new vector OD, with the magnitude of OC and the correct x and z coordinates for OC (I think).
Since AOB is in the xy plane and the new vector AOD is in the xz plane, the angle of the AOB AOD plane intersection is 90 degrees. This would meant that the angle between the vector OC (the vector I am solving for) and OD would be the difference between 90 (AOB AOD plane intersection angle) and the AOB AOC plane intersection angle. That would be angle COD = 90 - 12.7435 = 77.2565 (degrees), 1.348380294 (radians).
It seem like I should be able to use that information to determine the y-axis value as,
Cy = Oy + dOC*sin(COD), COD in radians
meaning that the y-axis value of point C would be 0 + the magnitude of OC times the sine of the angle COD.
I guess I am trying to swing the vector OD in the xz plane to the known plane intersection angle. I'm not sure if this changes the just the y-axis value or if I also need to calculate a new x, or if I am thinking about this in any way that is at all reasonable.
My guess is that there is a straightforward formula for this and I just don't know the proper search terms to find it. I would like a clearer understating of the relationships here as well. Formulas are nice, but you can get in plenty of trouble applying them if you don't fully understand the theory.
Thanks for the help if you have time. Please let me know if there is anything that needs to be clarified. I could post data for a 3d R plot if that would help. Let me know.
LMHmedchem
Last edited: