spherical-volume-rendering / svr-algorithm

A spherical volume rendering algorithm that performs ray casting through a spherical voxel grid.
Other
6 stars 7 forks source link

3-d traversal versus visualization #70

Closed cgyurgyik closed 4 years ago

cgyurgyik commented 4 years ago

Test

function SphericalCoordinateTraversalExample
   min_bound = [-20, -20.0, -20.0];
    max_bound = [20.0, 20.0, 20.0];
    ray_origin = [-13.0, -13.0, -13.0];
    ray_direction = [1.0, 1.5, 1.0];
    sphere_center = [0.0, 0.0, 0.0];
    sphere_max_radius = 10.0;

    num_radial_sections = 4;
    num_angular_sections = 4;
    num_azimuthal_sections = 4;
    t_begin = 0.0;
    t_end = 30.0;
    verbose = true;

    [rVoxels, thetaVoxels, phiVoxels] = sphericalCoordinateTraversal(min_bound, max_bound, ray_origin, ray_direction, ...
    sphere_center, sphere_max_radius, num_radial_sections, num_angular_sections, num_azimuthal_sections, t_begin, t_end, verbose);

    rVoxels
    thetaVoxels
    phiVoxels
end

spherePlot.py code

# max radius of the sphere
max_radius = 10
# number of radial sections
num_rad = 4
# number of angular sections
num_ang = 4
# number of azimuthal sections
num_azi = 4
# sphere center
origin_sphere = np.array([0, 0, 0])
# ray Start
origin_ray = np.array([-13, -13, -13])
# ray direction
ray_dir = np.array([1, 2, 1])
# t_begin
t_begin = 0.0
# t_end
t_end = 30.0

Ok so using the visualization, I've changed the ray direction from what our only test has, which is:

ray_direction = [1.0, 1.0, 1.0];

to

ray_direction = [1.0, 1.5, 1.0];

This produces the following voxels:

Screen Shot 2020-04-01 at 3 23 07 PM

The XY, XZ Plane are pictured as follows:

Screen Shot 2020-04-01 at 3 22 59 PM

The discrepancy:

cgyurgyik commented 4 years ago

Aaaaand it was a typo. Sorry for the alert.