kskelm@happy.colorado.edu (05/02/91)
I am currently writing a texture mapping program. There is one thing I am having a problem with: After computing the intersection of a ray with a plane (all objects are rectangles), I have a point in 3-space, (X,Y,Z). I also know the locations of all vertices in the rectangle, and I currently generate a vector from the first vertex to the first (our local X' axis) and a vector from the first vertex to the third (our local Y' axis). My problem comes once I know the (X,Y,Z) coordinates of the point of intersection; I want to find out how far along the X' axis and how far along the Y' axis (relative to the first vertex) the point (A) in question is. Currently, I am using the vector formula | X' (dot) A | ||proj X'|| = -------------- A || A || for the X' axis, and substitute Y' for X' for the Y' axis. P1----------------------> X' |\ | \ | \ | o A = point in question V Y' This works for X' and Y' axes that coincide with the normal X and Y axes, but when X' and Y' are rotated, results go to hell; the texture is reflected along the angle BY which X' and Y' are rotated! Can anyone suggest a formula that is NOT position dependant???? Please? Thanks for your help, Kevin Kelm. +------------------------------------------------------------+ | /// Kevin "Visionary will be done RSN" Kelm | | /// kskelm@happy.colorado.edu | | \\\/// "Reality is subjective-- if you can make your own, | | \XX/ then who's crazy? That's entertainment software!"-me | | C code run. Run, code, run--PLEASE! | +------------------------------------------------------------+