from typing import Optional
from fibomat.layout.lattices.lattice_builder_base import LatticeBuilderBase
from fibomat.layout.lattices.lattice import Lattice
from fibomat.linalg import VectorLike, Vector
[docs]class LatticeBuilder(LatticeBuilderBase):
_VectorClass = Vector
[docs] def __init__(self, nu: int, nv: int, u: VectorLike, v: VectorLike, center: Optional[VectorLike] = None):
super().__init__(nu, nv, u, v, center)
[docs] @classmethod
def generate_rect(cls, nu: int, nv: int, du: float, dv: float, center: Optional[VectorLike] = None):
return cls(nu, nv, (float(du), 0), (0, -float(dv)), center)
[docs] def to_lattice(self) -> Lattice:
return Lattice(self._elements)