/** * Create a new ray by transforming the supplied one by the given matrix. If * the matrix is <code>null</code>, the original ray is returned. * * @param m matrix to transform the ray by */ public Ray transform(Matrix4 m) { if (m == null) return this; Ray r = new Ray(); r.ox = m.transformPX(ox, oy, oz); r.oy = m.transformPY(ox, oy, oz); r.oz = m.transformPZ(ox, oy, oz); r.dx = m.transformVX(dx, dy, dz); r.dy = m.transformVY(dx, dy, dz); r.dz = m.transformVZ(dx, dy, dz); r.tMin = tMin; r.tMax = tMax; return r; }