Refactor comparison operations in geometry nodes

- Introduced a new `compare_node` function to streamline comparison operations across various geometry nodes.
- Replaced instances of mathematical comparison nodes with the new `compare_node` function in multiple files, enhancing code readability and maintainability.
- Updated related logic in cutout, depth surface, and image processing groups to utilize the new comparison method.
- Ensured consistent handling of boolean logic through the introduction of a `boolean_node` function for combining boolean inputs.
This commit is contained in:
2026-09-16 21:42:02 +08:00
parent c62ec2cd48
commit 78bbff6351
19 changed files with 282 additions and 200 deletions

View File

@@ -78,6 +78,19 @@ def test_depth_alpha_culls_faces_without_double_multiplication():
assert len(evaluated(obj)[1]) == 384
def test_alpha_cut_keeps_the_ring_sharing_the_face_centre_contour():
"""Faces are judged at their centre, so the ring straddling the sky stays."""
alpha = np.ones((64, 128))
alpha[:, 64:] = 0
obj, _ = panorama(3.0, alpha, subdivide=4)
points, faces, _ = evaluated(obj)
plain, _ = panorama(3.0, 1.0, subdivide=4)
_, full, _ = evaluated(plain)
# Judging faces by their corners would drop one more ring of the half sphere.
assert len(faces) == len(full) // 2
np.testing.assert_allclose(np.linalg.norm(points, axis=1), 3, atol=1e-5)
def test_invalid_depth_does_not_bleed_into_alpha_boundary():
alpha = np.ones((64, 128))
alpha[:, 64:] = 0