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

Fix double tap tangential hit bug, update variable names. #168

Closed cgyurgyik closed 4 years ago

cgyurgyik commented 4 years ago

Description

Type of change

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

    TEST(SphericalCoordinateTraversal, TangentialHitNoDoubleIntersectionWithSameVoxel) {
        const BoundVec3 sphere_center(0.0, 0.0, 0.0);
        const double sphere_max_radius = 10.0;
        const std::size_t num_radial_sections = 4;
        const std::size_t num_polar_sections = 1;
        const std::size_t num_azimuthal_sections = 1;
        const svr::SphereBound max_bound = {.radial=sphere_max_radius, .polar=TAU, .azimuthal=TAU};
        const svr::SphericalVoxelGrid grid(MIN_BOUND, max_bound, num_radial_sections, num_polar_sections,
                                           num_azimuthal_sections, sphere_center);
        const BoundVec3 ray_origin(-2.5, 0.0, 10.0);
        const FreeVec3 ray_direction(0.0, 0.0, -1.0);
        const Ray ray(ray_origin, ray_direction);
        const double t_begin = 0.0;
        const double t_end = 30.0;
        const auto actual_voxels = walkSphericalVolume(ray, grid, t_begin, t_end);
        const std::vector<int> expected_radial_voxels = {1, 2, 3, 2, 1};
        const std::vector<int> expected_theta_voxels = {0, 0, 0, 0, 0};
        const std::vector<int> expected_phi_voxels = {0, 0, 0, 0, 0};
        expectEqualVoxels(actual_voxels, expected_radial_voxels, expected_theta_voxels, expected_phi_voxels);
    }

Similar test for Cython code.

Checklist: