Translate field value digit branch helper
This commit is contained in:
parent
b860bd8bb8
commit
78c70c8b7f
8 changed files with 124 additions and 8 deletions
|
|
@ -125,14 +125,22 @@ Completed field value helper entry:
|
|||
|
||||
- `docs/research/translations/shriinivas-fieldvalue-digit-at.md`
|
||||
- Source groups: `Create Decimal`, `Create Segment`, `Seven Segments`,
|
||||
`Delete Segments`, `Digit At`
|
||||
`Delete Segments`, `Next Digit`, `Digit At`
|
||||
- Verification: decimal glyph geometry matches source with sorted max vertex
|
||||
delta `0.0`; segment geometry matches horizontal and vertical source cases
|
||||
with sorted max vertex delta `0.0`; seven-segment chassis geometry matches
|
||||
source with 74 vertices and sorted max vertex delta `0.0`; digit scalar
|
||||
helper matches source behavior across four number/position cases by driving
|
||||
`Mesh Line.Count` with the result; delete-mask scalar helper matches source
|
||||
across 195 digit/segment-position cases with zero mismatches.
|
||||
`Mesh Line.Count` with the result; next-digit branch helper matches source
|
||||
across four cases spanning both sides of `Max Precision`; delete-mask scalar
|
||||
helper matches source across 195 digit/segment-position cases with zero
|
||||
mismatches.
|
||||
|
||||
Boundary note: the full `Field Value` graph is a 176-node composition involving
|
||||
menu switches, capture attributes, sample-index reads, instances, transforms,
|
||||
and delete geometry. Before translating it by hand, test or port upstream's
|
||||
historical `nodes_to_script` converter so VibeGeometry gets a generated first
|
||||
draft to inspect.
|
||||
|
||||
## Extraction Workflow
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,21 @@ Metaphor: if a graph only whispers a number, build a little megaphone around it.
|
|||
The verifier's job is not to be beautiful. It is to make the invisible output
|
||||
hard to lie about.
|
||||
|
||||
## Branch Helpers Are Switchboards
|
||||
|
||||
Some scalar helpers exist only to choose which already-tested value path should
|
||||
feed the next stage. `Next Digit` decides whether to read from the fractional
|
||||
part or the whole part of a number based on `Position < Max Precision`.
|
||||
|
||||
The useful pattern is:
|
||||
|
||||
```text
|
||||
branch condition -> candidate A -> candidate B -> switch -> value output
|
||||
```
|
||||
|
||||
Verify both sides of the branch. If all tests stay on one side, the switchboard
|
||||
has not actually been tested; it has merely sat there looking employed.
|
||||
|
||||
## Glyphs Are Parts
|
||||
|
||||
Display systems are made from small, boring geometry tokens: bars, dots,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
- `Create Segment`
|
||||
- `Seven Segments`
|
||||
- `Delete Segments`
|
||||
- `Next Digit`
|
||||
- `Digit At`
|
||||
- Geometry Script recreation:
|
||||
`examples/geometry_script/shriinivas_fieldvalue.py`
|
||||
|
|
@ -23,6 +24,18 @@ Together they show the first display-system layers: tiny glyph geometry,
|
|||
field-sculpted segment geometry, segment composition, segment visibility masks,
|
||||
and value-only digit extraction.
|
||||
|
||||
## Current Boundary
|
||||
|
||||
The remaining full `Field Value` group has 176 nodes and combines menu switches,
|
||||
capture attributes across multiple domains, sampled fields, instancing,
|
||||
instance transforms, delete-geometry selection, material assignment, and the
|
||||
helpers translated here.
|
||||
|
||||
That graph should not be translated manually as one heroic sweep. The next
|
||||
right move is to port or test the upstream `nodes_to_script` prototype against
|
||||
this graph so the first draft can be generated, inspected, and then cleaned
|
||||
with doctrine instead of hand-copied node by node.
|
||||
|
||||
## Create Decimal Map
|
||||
|
||||
Source group: `Create Decimal`
|
||||
|
|
@ -142,6 +155,34 @@ Mechanism:
|
|||
Metaphor: `Delete Segments` is not a sculptor. It is a stencil card. Given a
|
||||
digit and a slot on the chassis, it punches out the slots that should go dark.
|
||||
|
||||
## Next Digit Map
|
||||
|
||||
Source group: `Next Digit`
|
||||
|
||||
Geometry Script group: `VG Next Digit`
|
||||
|
||||
Inputs:
|
||||
|
||||
- `Whole Part`
|
||||
- `Fraction Part`
|
||||
- `Max Precision`
|
||||
- `Position`
|
||||
|
||||
Output:
|
||||
|
||||
- `Result`
|
||||
|
||||
Mechanism:
|
||||
|
||||
- Compute `Position - Max Precision` for whole-part indexing.
|
||||
- Compare `Position < Max Precision`.
|
||||
- If true, read from `Fraction Part` at `Position`.
|
||||
- If false, read from `Whole Part` at `Position - Max Precision`.
|
||||
|
||||
Metaphor: `Next Digit` is the read head for the display tape. Before the decimal
|
||||
boundary it reads the fractional reel; after that boundary it reads the whole
|
||||
number reel.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
|
@ -166,6 +207,7 @@ Results from Blender 5.1.1:
|
|||
| Digit At `1234.0`, position `1` | 3 | 3 | 0 | accepted |
|
||||
| Digit At `98765.0`, position `2` | 7 | 7 | 0 | accepted |
|
||||
| Digit At `120305.0`, position `3` | 0 | 0 | 0 | accepted |
|
||||
| Next Digit branch cases | 4 cases | 4 cases | 0 mismatches | accepted |
|
||||
| Delete Segments grid | 195 cases | 195 cases | 0 mismatches | accepted |
|
||||
|
||||
## Lessons
|
||||
|
|
@ -190,3 +232,7 @@ Results from Blender 5.1.1:
|
|||
- Dense boolean graphs often hide lookup tables. Translate them into named
|
||||
clauses and verify over the full input grid instead of preserving every source
|
||||
`OR` node as ceremony.
|
||||
- A branch helper deserves tests on both sides of the branch. `Next Digit`
|
||||
verifies positions before and after `Max Precision`, because the interesting
|
||||
behavior is not digit extraction itself but choosing which number part feeds
|
||||
extraction.
|
||||
|
|
|
|||
|
|
@ -75,6 +75,25 @@ def vg_digit_at(number: Float = 0.0, position: Int = 0):
|
|||
)
|
||||
|
||||
|
||||
@tree("VG Next Digit")
|
||||
def vg_next_digit(
|
||||
whole_part: Float = 0.0,
|
||||
fraction_part: Float = 0.0,
|
||||
max_precision: Int = 0,
|
||||
position: Int = 0,
|
||||
):
|
||||
whole_position = math(operation=Math.Operation.SUBTRACT, value=(position, max_precision))
|
||||
use_fraction = math(operation=Math.Operation.LESS_THAN, value=(position, max_precision))
|
||||
whole_digit = vg_digit_at(number=whole_part, position=whole_position)
|
||||
fraction_digit = vg_digit_at(number=fraction_part, position=position)
|
||||
return switch(
|
||||
input_type=Switch.InputType.INT,
|
||||
switch=use_fraction,
|
||||
false=whole_digit,
|
||||
true=fraction_digit,
|
||||
)
|
||||
|
||||
|
||||
@tree("VG Create Segment")
|
||||
def vg_create_segment(
|
||||
x_major: Bool = False,
|
||||
|
|
@ -307,6 +326,7 @@ def _finalize_groups():
|
|||
for name in (
|
||||
"VG Create Decimal",
|
||||
"VG Digit At",
|
||||
"VG Next Digit",
|
||||
"VG Create Segment",
|
||||
"VG Seven Segments",
|
||||
"VG Delete Segments",
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ The completed pie chart translation is
|
|||
The completed field-value helper translation is
|
||||
`docs/research/translations/shriinivas-fieldvalue-digit-at.md`. It covers
|
||||
`Create Decimal`, `Create Segment`, `Seven Segments`, `Delete Segments`, and
|
||||
`Digit At` from `fieldvalue.blend`.
|
||||
`Next Digit`, and `Digit At` from `fieldvalue.blend`.
|
||||
|
||||
`docs/research/procedural-doctrine.md` now stores the current intuitive model
|
||||
for mapping geometric ideas to Geometry Script: curves as rails, fields as
|
||||
|
|
@ -59,8 +59,10 @@ The GameCult fork is intentionally pruned to `main` plus the active
|
|||
`vibegeometry/blender-5-nested-tree-groups` branch. Upstream branch clutter
|
||||
should not be copied forward unless a future patch actually needs it.
|
||||
|
||||
The current next action is to continue `fieldvalue.blend` by inspecting
|
||||
`Next Digit`, `Geometry Nodes Group.002`, and then the full `Field Value` graph.
|
||||
The current next action is to test or port upstream Geometry Script's
|
||||
`nodes_to_script` prototype before attempting the full 176-node `Field Value`
|
||||
translation. `Geometry Nodes Group.002` is a wrapper around the full `Field
|
||||
Value` group rather than an independent helper.
|
||||
|
||||
## Important Invariants
|
||||
|
||||
|
|
|
|||
|
|
@ -15,3 +15,5 @@
|
|||
{"ts": "2026-05-04T13:24:38+00:00", "type": "research", "status": "accepted", "note": "Upstream Geometry Script nodes_to_script branch is a real node-tree-to-script prototype from 2023-03-01. It adds operators/convert_tree.py, which walks a node tree and emits a @tree script text datablock, but it predates Blender 4 interface migration and later main-branch fixes, so VibeGeometry should treat it as a translation assistant candidate to port/test rather than a current drop-in dependency."}
|
||||
{"ts": "2026-05-04T13:30:24+00:00", "type": "implementation", "status": "accepted", "note": "Extended fieldvalue translation with Seven Segments -> VG Seven Segments. Verified against source with 74 vertices and sorted max vertex delta 0.0 in Blender 5.1.1. Doctrine added: chassis groups compose tested parts into a joined assembly while preserving part intent in script."}
|
||||
{"ts": "2026-05-04T13:34:19+00:00", "type": "implementation", "status": "accepted", "note": "Extended fieldvalue translation with Delete Segments -> VG Delete Segments. Verified source and translation across 195 digit/segment-position cases with zero mismatches by driving the boolean output into a Mesh Line count harness. Doctrine added: dense boolean node regions often encode lookup tables and should be translated into named clauses plus full-grid verification."}
|
||||
{"ts": "2026-05-04T13:37:51+00:00", "type": "implementation", "status": "accepted", "note": "Extended fieldvalue translation with Next Digit -> VG Next Digit. Verified four branch cases spanning both sides of Max Precision by driving Result into Mesh Line.Count; all source and translated counts matched."}
|
||||
{"ts": "2026-05-04T13:37:51+00:00", "type": "research", "status": "accepted", "note": "Full fieldvalue Field Value graph is a 176-node composition with menu switches, capture attributes across domains, sample-index reads, instancing, transforms, delete geometry, and material assignment. Manual one-pass translation would be high-risk; next action should test or port upstream Geometry Script nodes_to_script as a generated first-draft tool before attempting the full graph."}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ data_flow:
|
|||
- If state grows faster than understanding, cut it back.
|
||||
|
||||
current_status:
|
||||
summary: VibeGeometry has an initial persistence scaffold plus verified Geometry Script translations for inspected Shriinivas cartesian, pie chart, and field-value helper/chassis/mask graph families.
|
||||
next_action: Continue fieldvalue.blend by inspecting `Next Digit`, `Geometry Nodes Group.002`, and then the full `Field Value` graph.
|
||||
summary: VibeGeometry has an initial persistence scaffold plus verified Geometry Script translations for inspected Shriinivas cartesian, pie chart, and field-value helper/chassis/mask/branch graph families.
|
||||
next_action: Test or port upstream Geometry Script's `nodes_to_script` prototype before attempting the full 176-node `Field Value` translation.
|
||||
remotes:
|
||||
vibegeometry: https://github.com/GameCult/VibeGeometry
|
||||
geometry_script_fork: https://github.com/GameCult/geometry-script
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ CASES = [
|
|||
{"Number": 98765.0, "Position": 2},
|
||||
{"Number": 120305.0, "Position": 3},
|
||||
]
|
||||
NEXT_DIGIT_CASES = [
|
||||
{"Whole Part": 1234.0, "Fraction Part": 5678.0, "Max Precision": 2, "Position": 0},
|
||||
{"Whole Part": 1234.0, "Fraction Part": 5678.0, "Max Precision": 2, "Position": 1},
|
||||
{"Whole Part": 1234.0, "Fraction Part": 5678.0, "Max Precision": 2, "Position": 2},
|
||||
{"Whole Part": 98765.0, "Fraction Part": 4321.0, "Max Precision": 3, "Position": 4},
|
||||
]
|
||||
|
||||
DECIMAL_CASE = {"Vertical Segment Size": 2.4, "radius": 0.18}
|
||||
SEGMENT_CASES = [
|
||||
|
|
@ -272,6 +278,23 @@ def main() -> int:
|
|||
"ok": source_count == translated_count,
|
||||
}
|
||||
)
|
||||
source_next_digit = bpy.data.node_groups["Next Digit"]
|
||||
translated_next_digit = bpy.data.node_groups["VG Next Digit"]
|
||||
for index, inputs in enumerate(NEXT_DIGIT_CASES):
|
||||
source_count = _evaluated_vertex_count(
|
||||
_build_count_wrapper(f"VG Verify Source Next Digit {index}", source_next_digit, inputs)
|
||||
)
|
||||
translated_count = _evaluated_vertex_count(
|
||||
_build_count_wrapper(f"VG Verify Translated Next Digit {index}", translated_next_digit, inputs)
|
||||
)
|
||||
results.append(
|
||||
{
|
||||
"case": {"next_digit": inputs},
|
||||
"source_count": source_count,
|
||||
"translated_count": translated_count,
|
||||
"ok": source_count == translated_count,
|
||||
}
|
||||
)
|
||||
delete_mismatches = []
|
||||
source_delete = bpy.data.node_groups["Delete Segments"]
|
||||
translated_delete = bpy.data.node_groups["VG Delete Segments"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue