Skip to content

Error handling instead of assertions #123

@finnbear

Description

@finnbear

#115 (comment): Removing the assert functions from the API. They should likely be only available for testing I suppose. Wouldn't really want to offer functions that crash the program knowingly. We should convert those to proper errors. Maybe use thiserror to ease this a bit.

My thoughts:

  • When possible, inputs should be checked (at least debug_assert! but an error may be preferable), instead of creating an invalid BVH or ray.
    • Decide whether AABB's must have volume. If so, ensure they do.
    • Ensuring numbers are within valid ranges (especially not NaN)
  • Panics should be avoided
  • Essential panics should be documented
  • As an additional debugging tool, there could be a way to export BVH AABB's and ray(s) as a 3D model (.PLY seems easiest), which could be examined in 3D software.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions