/* * * intersection d'un plan defini par : * * P(Px, Py, Pz) appartenant au plan * N(Px, Py, Pz) normal au plan * * avec une droite AB definie par l'ensemble des points tel que: * * A + * t B * * on a : * * t=(Nz*Pz+Ny*Py+Nx*Px-Az*Nz-Ay*Ny-Ax*Nx)/(Bz*Nz+By*Ny+Bx*Nx) * */ override public Vector3 intersect(Vector3Pair ray) { double s = ray.direction().z(); if (s == 0) { return(null); } double a = -ray.origin().z() / s; if (a < 0) { return(null); } return(ray.origin().plus(ray.direction().times(a))); }
public double pl_ln_intersect_scale(Vector3Pair line) { // See https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection return((origin().dot(normal()) - normal().dot(line.origin())) / (line.normal().dot(normal()))); }
public override string ToString() { return("LightRay{wavelen=" + _wavelen + ",origin=" + _ray.origin() + ",direction=" + _ray.direction() + '}'); }