#include "rtsCubeSampler.h" vector rtsCubeSampler::Evaluate() { /*This function evaluates the cube with the given parameters and returns a vector of sample normalized sample vectors.*/ //find a valid up vector vector3D u(0.0, 1.0, 0.0); //calculate the side vector vector3D s = u.cross(m_main_vector); //orthogonalize the up vector u = m_main_vector.cross(s); //normalize all three vectors m_main_vector.normalize(); u.normalize(); s.normalize(); //create a vector representing each side of the cube vector3D sides[6]; sides[0] = m_main_vector; sides[1] = (m_main_vector)*(-1); sides[2] = u; sides[3] = u*(-1); sides[4] = s; sides[5] = s*(-1); //calculate the step size along the basis vectors for a side double step = 1.0/((double)m_squared_samples_per_side); //evaluate the cube, storing the result in an STL vector vector result; for(int k=0; k<6; k++) for(int i=0; i= cos(TORADIANS(max_angle))) result.push_back(final_vector); } //return the vector of results return result; }