Source code for reslumen.geometry.shapes

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Benjamin Vial
# License: MIT
from __future__ import annotations

from dataclasses import dataclass
from typing import Protocol


[docs] class Shape(Protocol): """Protocol for geometric objects."""
[docs] def volume(self) -> float: """Return the volume in cubic meters.""" return
@dataclass(slots=True)
[docs] class Box: """Axis-aligned rectangular box."""
[docs] width: float
[docs] height: float
[docs] depth: float
[docs] def volume(self) -> float: return self.width * self.height * self.depth
[docs] class Test: """Test for geometric objects."""
[docs] def test(self) -> float: """Return the tests.""" return