Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@V state element (aka $ in ABOP) isn't rendering out correctly #27

Closed
heckj opened this issue Jan 8, 2022 · 5 comments · Fixed by #30
Closed

@V state element (aka $ in ABOP) isn't rendering out correctly #27

heckj opened this issue Jan 8, 2022 · 5 comments · Fixed by #30
Assignees
Labels
bug Something isn't working

Comments

@heckj
Copy link
Owner

heckj commented Jan 8, 2022

Fundamentally, the example trees rendered with the L-systems taken directly from The Algorithmic Beauty of Plants aren't resulting the same visualizations as described in the book. They're close, but there's complication - I think - around a specific symbol and what it's doing: @V in the implementation research paper, and $ in the book itself.

As an example, compare the results for the following sympodial and monopodial trees:
lindenmayer2
original2
lindenmayer1
original1

I suspect part of the core of this issue is that what I'm doing to create the rotations for the $ symbol is resulting in a rotation that is far too vertically oriented.

I thought perhaps I had confused basic transforms and headings, but in reviewing the relevant code (https://github.com/heckj/Lindenmayer/blob/main/Sources/Lindenmayer/SceneKitRenderer.swift#L181-L214), I seem to have accounted for the corrected heading.

Since I've been mentally confusing directions, I suspect that I need to add a debugging view (#26), as well as potentially tests, to generate the relevant objects and then interrogate them to verify rotations, translations, etc.

@heckj heckj self-assigned this Jan 8, 2022
@heckj heckj added the bug Something isn't working label Jan 8, 2022
@heckj
Copy link
Owner Author

heckj commented Jan 17, 2022

It's still not 100% to what the results from the book show, but it's notably better - so committing this as the fix for the @V symbol.
Screen Shot 2022-01-17 at 1 13 04 PM
Screen Shot 2022-01-17 at 1 12 01 PM

@heckj heckj closed this as completed in #30 Jan 17, 2022
@heckj
Copy link
Owner Author

heckj commented Jan 18, 2022

well darnit. The fix is notably improved, but needs more work. While iterating on a debugging view of the Sympodial trees, it appears to be over-rotating just slightly, meaning that something in the calculated angle that is applied to "roll vertical" is incorrect.

State 119 of the basic sympodial structured tree at 4 iterations illustrates this:

The starting point is:
Screen Shot 2022-01-18 at 2 31 15 PM

And after application of the "rollUpToVertical" (position 120), the state is:
Screen Shot 2022-01-18 at 2 32 55 PM

@heckj heckj reopened this Jan 18, 2022
@heckj
Copy link
Owner Author

heckj commented Jan 19, 2022

Initial value:

simd_float4x4(
    simd_float4(-1.1513867, -0.12829041, 2.2153668, 0.0),
    simd_float4(2.173691, 0.43699712, 1.155033, 0.0),
    simd_float4(-0.44651538, 2.458165, -0.08971556, 0.0),
    simd_float4(4.4409075, 13.833499, 8.220964, 1.0),
)

After transforms applied:

simd_float4x4(
    simd_float4(-1.0507754, -0.5739607, 2.194639, 0.0),
    simd_float4(2.173691, 0.43699712, 1.155033, 0.0),
    simd_float4(-0.64879775, 2.3936589, 0.315371, 0.0),
    simd_float4(4.4409075, 13.833499, 8.220964, 1.0),
)

@heckj
Copy link
Owner Author

heckj commented Jan 22, 2022

fully resolved. example with sympodial trees
Screen Shot 2022-01-22 at 1 53 34 PM

and monopodial trees
Screen Shot 2022-01-22 at 1 52 40 PM

@heckj
Copy link
Owner Author

heckj commented Jan 22, 2022

fully resolved by #32

@heckj heckj closed this as completed Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant