This is actually a programming assignment, however it's very math involved.
Given a set of points in R3 (x,y,z coordinates plus a weighted value) that are known to be coplanar, I need to draw an appropriately rotated, scaled, and colored plane intersecting the data.
We know how to draw a plane in a 2-dimensional case. We interpolate the data to create a new set of vertices evenly spaced and connect them using polygons until we have a filled grid. We set the 0 component to 0, and just increment in the x and y directions.
What we need to know is how to determine where the points would lie on the 2-dimensional plane (since they are coplanar) and how to either draw the plane in place or how to rotate it from along the coordinate axis into its proper location.
We have no matrix math libraries, so all math needs to be broken down into standard algebra before we can implement (but I should be able to convert from matrix algebra to standard given the correct formula).
Set of coplanar points, (x,y,z).
Can determine plane equation, aX+bY+cZ+d=0. Can get normal vector from this.
Dot product: a (dot) b = |a||b|cos(theta)
The Attempt at a Solution
Have attempted to use dot product with respect to normal vectors (1,0,0) and (0,1,0) to determine rotation axes. Also tried (1,y-y_i,z-z_i) and (x-x_i,1,z-z_i). These don't not appear to give the angles I'm looking for.
The book had a derivation for a rotation about the origin in 2d that gives the transforms
w_1 = xcos(theta) - ysin(theta)
w_2 = xsin(theta) + ycos(theta)
Using a similar derivation (possibly wrong) I arrived at in the 3 dimensional case (rho = p)
w_1 = p (sin(phi_1)cos(phi_2)+cos(phi_1)sin(phi_2) )* (cos(theta_1)cos(theta_2)-sin(theta_1)sin(theta_2))
w_2 = p (sin(phi_1)cos(phi_2)+cos(phi_1)sin(phi_2)) * (sin(theta_1)cos(theta_2)+cos(theta_1)sin(theta_2))
w_3 = p (cos(phi_1)cos(phi_2)-sin(phi1)sin(phi_2)
And assuming these are correct (derived from polar coordinate transformations and summing angles?), I would guess I substitute in for rho? I'm not sure what to substitute though, and I have no idea how to determine the angles.
And after that, I suppose I'd solve for the w's in terms of x,y,z and then just leave one w = to 0 and increment through the other 2 to construct my plane?