Assignment 1 Voxelization
- Objective: voxelize the given figure
//Returns 1 if triangle and ray intersect, 0 otherwise
Detail: fundamentals of computer graphics, CH4.3
function:numSurfaceIntersection
//Number of intersections with surface made by a ray originating at voxel and cast in direction.
for every triangle in triangle list:
check ray,triangle intersection
if intersect:
numhits +=1
return numHits
function: main loop
for every grid:
update the voxel poistion(the position where the ray happens)
get the number of surface intersection.
if it's an odd number;
g_voxelGrid->m_insideArray = true // update the array list
save the output.
personal understanding: Given a fixed ray, if the starts inside the model, then the number of intersection must be a odd number. Bear this in mind.