Skip to content

Add F-rep implicit fields to primitive shapes#133

Merged
chemiskyy merged 1 commit into
mainfrom
feature/implicit-lattices
May 11, 2026
Merged

Add F-rep implicit fields to primitive shapes#133
chemiskyy merged 1 commit into
mainfrom
feature/implicit-lattices

Conversation

@chemiskyy

Copy link
Copy Markdown
Member

Box, Sphere, Cylinder, Capsule, Ellipsoid each set _func / _bounds in
init via a per-class _setup_frep_field. SDF formulas verbatim from
PR #116 (fast O(1) closures, no autograd), with center and orientation
baked directly into the field. CAD generate() and pyvista generate_vtk()
overrides untouched — only :meth:generate requires the [cad] extra.

Operators |, &, -, ~ now compose primitives directly: Sphere(...) & Box(...) returns a Shape with a composed implicit field, no CAD or
to_implicit() conversion required.

Tests in tests/shapes/test_primitive_implicit.py: SDF sign at center /
surface / outside, AABB validity, center translation, orientation,
composability.

  Box, Sphere, Cylinder, Capsule, Ellipsoid each set _func / _bounds in
  __init__ via a per-class _setup_frep_field. SDF formulas verbatim from
  PR #116 (fast O(1) closures, no autograd), with center and orientation
  baked directly into the field. CAD generate() and pyvista generate_vtk()
  overrides untouched — only :meth:`generate` requires the [cad] extra.

  Operators |, &, -, ~ now compose primitives directly: `Sphere(...) &
  Box(...)` returns a Shape with a composed implicit field, no CAD or
  to_implicit() conversion required.

  Tests in tests/shapes/test_primitive_implicit.py: SDF sign at center /
  surface / outside, AABB validity, center translation, orientation,
  composability.

@kmarchais kmarchais left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chemiskyy chemiskyy merged commit fa86802 into main May 11, 2026
20 checks passed
@chemiskyy chemiskyy deleted the feature/implicit-lattices branch May 11, 2026 11:01
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.

2 participants