Config¶
Configuration module for diffinytrace.
This module provides global configuration options for controlling ray intersection solver behavior, such as tolerance, maximum iterations, damping factor, and whether to display iteration counts. These settings can be adjusted at runtime to tune performance and accuracy.
Example
>>> import diffinytrace.config as config
>>> config.set_tolerance(1e-8)
>>> config.set_show_iteration_count(True)
>>> config.restore_default_settings()
- diffinytrace.config.set_show_iteration_count(flag)[source]¶
Set the option to show the number of iterations for each intersection.
- Parameters:
flag (bool) – True to show the number of iterations, False otherwise.
- diffinytrace.config.get_show_iteration_count()[source]¶
Check if the number of iterations should be shown.
- Returns:
True if the number of iterations should be shown, False otherwise.
- Return type:
bool
- diffinytrace.config.set_tolerance(new_tolerance)[source]¶
Set the tolerance for ray intersection calculations.
- Parameters:
new_tolerance (float) – The new tolerance value (must be > 0).
- Raises:
ValueError – If new_tolerance is not greater than 0.
- diffinytrace.config.get_tolerance()[source]¶
Get the current tolerance for ray intersection calculations.
- Returns:
The current tolerance value.
- Return type:
float
- diffinytrace.config.set_max_iterations(new_max_iterations)[source]¶
Set the maximum number of iterations for the ray intersection solver.
- Parameters:
new_max_iterations (int) – The new maximum number of iterations (must be > 0).
- Raises:
ValueError – If new_max_iterations is not greater than 0.
- diffinytrace.config.get_max_iterations()[source]¶
Get the current maximum number of iterations for the ray intersection solver.
- Returns:
The current maximum number of iterations.
- Return type:
int
- diffinytrace.config.set_damping_factor(new_damping_factor)[source]¶
Set the damping factor for the Newton method used in ray intersections.
- Parameters:
new_damping_factor (float) – The new damping factor (0 < new_damping_factor <= 1).
- Raises:
ValueError – If new_damping_factor is not between 0 and 1 (exclusive of 0, inclusive of 1).