Skip to content

Rename Shape.func to field and extend Phase#144

Open
chemiskyy wants to merge 3 commits into
mainfrom
chore/tier2-api
Open

Rename Shape.func to field and extend Phase#144
chemiskyy wants to merge 3 commits into
mainfrom
chore/tier2-api

Conversation

@chemiskyy

Copy link
Copy Markdown
Member

Replace the Shape internal implicit field attribute from _func/func to _field/field across the codebase and update all callers (require_func → require_field, evaluate, mesh paths, implicit ops, primitives). Rename immutable transform APIs on Shape (translate/rotate/scale → translated/rotated/scaled) and update tests accordingly. Enhance Phase with new constructors and features: Phase.from_implicit, Phase.from_grid (grid caching and nearest-neighbour wrapper), a cached grid shortcut, and an immutable rotated() transform (CAD- and field-backed handling) plus an internal _with_cad helper. Minor fix in meshbridge error check to use the new field property. Tests updated and a new test file added to cover Phase constructors and rotations. These changes standardize naming and add Tier-2 Phase functionality while updating tests to match the new API.

chemiskyy added 3 commits June 1, 2026 16:30
Replace the Shape internal implicit field attribute from `_func`/func to `_field`/field across the codebase and update all callers (require_func → require_field, evaluate, mesh paths, implicit ops, primitives). Rename immutable transform APIs on Shape (translate/rotate/scale → translated/rotated/scaled) and update tests accordingly. Enhance Phase with new constructors and features: Phase.from_implicit, Phase.from_grid (grid caching and nearest-neighbour wrapper), a cached grid shortcut, and an immutable rotated() transform (CAD- and field-backed handling) plus an internal _with_cad helper. Minor fix in meshbridge error check to use the new field property. Tests updated and a new test file added to cover Phase constructors and rotations. These changes standardize naming and add Tier-2 Phase functionality while updating tests to match the new API.
Move scipy.spatial.transform.Rotation import to module scope in microgen/phase.py (removing the local import inside Phase) and update tests to import pytest, Tpms, and surface_functions at the top. Also remove several in-test imports and minor whitespace cleanups. These are refactors to satisfy style/static checks and keep imports consistent; behavior is unchanged.
Rename immutable transform APIs to PyVista-style verbs and add optional inplace behavior. translated/scaled/rotated/tiled -> translate/scale/rotate/tile across Phase and Shape; transforms now accept inplace=False (default) to return a new Phase/Shape or inplace=True to mutate. Implement Phase.copy(), _invalidate_derived() and internal _apply_* workers to keep field, CAD, mesh and cached grid coherent. Rotation now accepts scipy.spatial.transform.Rotation (or a 3x3 matrix) and supports a pivot point; scaling uses a computed pivot (center_of_mass/mesh center). Tests and example updated to use the new names and Rotation imports. Notes: tile remains a producer (always returns new), rotations invalidate axis-aligned periodicity, and cached grids are cleared when necessary. Breaking change: public transform method names and signatures changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant