f32 Triangle::SampleDir( vec3f &rayDir, const f32 s, const f32 t ) const { return SampleDir( rayDir, SamplePoint( s, t ) ); /*const f32 rayLenSqr = rayDir.Dot(rayDir); const f32 rayLen = std::sqrt(rayLenSqr); rayDir /= rayLen; const f32 costheta = -unitNormal.Dot(rayDir); return costheta / rayLenSqr; */ }
f32 PlanarRectangle::SampleDir( vec3f & rayDir, const f32 u1, const f32 u2 ) const { const vec3f pk = SamplePoint( u1, u2 ); rayDir = pk; const f32 rayLenSq = Dot( rayDir, rayDir ); const f32 rayLen = std::sqrt( rayLenSq ); rayDir /= rayLen; const f32 costheta = Dot( ez, rayDir ); return costheta / rayLenSq; }
virtual void init(Voxel& voxel) { // initialize dsi sample points unsigned int odf_size = voxel.ti.half_vertices_count; for (unsigned int index = 0; index < odf_size; ++index) for (float r = odf_min_radius; r <= odf_max_radius; r += odf_sampling_interval) sample_group.push_back( SamplePoint(index,voxel.ti.vertices[index][0]*r, voxel.ti.vertices[index][1]*r, voxel.ti.vertices[index][2]*r,r*r)); b0_index = SpaceMapping<dsi_range>::getIndex(0,0,0); }