This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/raytracing/raytracing/ray.py
2021-10-24 19:19:52 +02:00

19 lines
548 B
Python

from dataclasses import dataclass
from typing import ClassVar
from .vector import UnitVector, Vector
@dataclass(frozen=True)
class Ray:
"""This class implements a 2D line with an origin point and a direction."""
origin: Vector
direction: UnitVector
travel: float = 0
# If a beam hits an object before having traveled a minimum distance
# from its origin, the collision is ignored. This prevents infinite
# collision in case the origin of a beam is on the surface of an object
min_travel: ClassVar[float] = 1e-7