Skip to content

[BUG] math::Ray ill defined if a component of its direction is zero. #2094

@stolk

Description

@stolk

Environment

Debian Trixie

Describe the bug

When a Ray is created with direction component that is zero, then mInvDir will be ill defined.

To Reproduce

Run unit tests, a ray with direction 1,0,0 will divide by zero.

Expected behavior

No FP exception.

Additional context

[ RUN      ] TestLevelSetRayIntersector.tests

Thread 1 "vdb_test" received signal SIGFPE, Arithmetic exception.
(gdb) up
#1  0x0000555557ec7a60 in openvdb::v12_1::math::Ray<double>::Ray (
    this=0x7fffffffd8f0, eye=..., direction=..., t0=1.0000000000000001e-09, 
    t1=1.7976931348623157e+308)
    at /home/bram/src/openvdb/openvdb/openvdb/../openvdb/math/Ray.h:61
61	        : mEye(eye), mDir(direction), mInvDir(1/mDir), mTimeSpan(t0, t1)
(gdb) print mDir
$1 = {<openvdb::v12_1::math::Tuple<3, double>> = {static size = 3, mm = {1, 0, 
      0}}, <No data fields>}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions