GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


plane code by baldurk
1
 
// pp is a point on the plane, used to figure out the plane normal
// plannrm is the plane normal
// raynrm is the ray vector or direction
// raypnt is the ray origin

float d = -pp.x * plannrm.x - pp.y * plannrm.y - pp.z * plannrm.y;
float dot1 = plannrm ^ raynrm;
float dist = d-(raypnt ^ plannrm);
float dist2 = dist / dot1;

intersect = raypnt + raynrm * dist2;
intersect = Vector(intersect.x, intersect.z, -intersect.y)*90.0f;