> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# simulation_framework::evaluator::TimeToCollisionCalculator Class Reference

class [TimeToCollisionCalculator](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/2025-r1/classsimulation__framework_1_1evaluator_1_1TimeToCollisionCalculator.md)

`#include <ttc_calculator.h>`

## Public Member Functions

| Type | Name |
| - | - |
|  std::chrono::milliseconds | **Calculate** (const osi3::GroundTruth \&ground\_truth) const |

## Detailed Description

class [TimeToCollisionCalculator](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/2025-r1/classsimulation__framework_1_1evaluator_1_1TimeToCollisionCalculator.md)

[TimeToCollisionCalculator](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/2025-r1/classsimulation__framework_1_1evaluator_1_1TimeToCollisionCalculator.md) class to calculate the time of Ego to collision with other traffic car based on osi GroundTruth Algorithm explaination:

1. find out the Ego vehicle index within MovingObject list from GroundTruth and compute the BoundingBox
2. find out the nearest with possible colliding traffic vehicle index within MovingObject list from GroundTruth and compute the BoundingBox.
3. calculate the distance between ego and nearest possible colliding traffic vehicle, with consideraion of dimensions of ego and traffic car with approximation using half length from both.
4. check if two bounding boxes are overlapping, if yes return ttc value to 0 (zero) meaning collision happens; if no, go to No.5.
5. calculate current TTC based on velocity difference (2d velocity vector Norm difference) and distance. If velocity difference has a negative value, which means the nearest traffic car is driving faster than ego, ttc value will be returned as std::chrono::milliseconds::max()

The documentation for this class was generated from the following files:

* [ttc\_calculator.h](https://developer.synopsys.com/docs/avxcelerate/avxcelerate-simulation-framework/2025-r1/ttc__calculator_8h_source.md)
* ttc\_calculator.cpp
