Source code for py3dtiles.tileset.bounding_volume

from __future__ import annotations

from abc import abstractmethod
from typing import TYPE_CHECKING, Any, Generic, TypeVar

import numpy as np
import numpy.typing as npt

from py3dtiles.typing import (
    BoundingVolumeBoxDictType,
    BoundingVolumeRegionDictType,
    BoundingVolumeSphereDictType,
)

from .root_property import RootProperty

if TYPE_CHECKING:
    from typing_extensions import Self

    from py3dtiles.tileset import Tile

_BoundingVolumeJsonDictT = TypeVar(
    "_BoundingVolumeJsonDictT",
    BoundingVolumeBoxDictType,
    BoundingVolumeRegionDictType,
    BoundingVolumeSphereDictType,
)


[docs] class BoundingVolume( RootProperty[_BoundingVolumeJsonDictT], Generic[_BoundingVolumeJsonDictT] ): """ Abstract class used as interface for box, region and sphere """ def __init__(self) -> None: super().__init__()
[docs] @classmethod @abstractmethod def from_dict(cls, bounding_volume_dict: _BoundingVolumeJsonDictT) -> Self: ...
[docs] @abstractmethod def get_center(self) -> npt.NDArray[np.float64]: ...
[docs] @abstractmethod def translate(self, offset: npt.NDArray[np.float64]) -> None: ...
[docs] @abstractmethod def transform(self, transform: npt.NDArray[np.float64]) -> None: ...
[docs] @abstractmethod def add(self, other: BoundingVolume[Any]) -> None: ...
[docs] @abstractmethod def sync_with_children(self, owner: Tile) -> None: ...
[docs] @abstractmethod def to_dict(self) -> _BoundingVolumeJsonDictT: ...