after12am / eisenscript

A programming language designed for generating awesome structures.
https://after12am.github.io/eisenscript-docs/
MIT License
46 stars 5 forks source link

mirroring not implemented #73

Closed kronpano closed 3 years ago

kronpano commented 4 years ago

Mirroring in Structure synth is fx, fy, fz which mirrors respectively on the x,y and z axis This allows something like 2 *{fx} which gives you the object AND the x-axis mirrored object.

At the moment this can be achieved using the matrix but 2 things: {m -1 0 0 0 1 0 0 0 1} is quite a bit to write as opposed to fx AND the matrix operator doesn't support multiples 2 *{m .. correctly

Example 2 * {m -1 0 0 0 1 0 0 0 1 h 120}{x 3 s 2}box creates a blue box at x -3 - it is blue because it applied the m and h operator twice to the original red box - it should (to be a real L-system) apply the m operator to the original red box once - creating a green one at x -3 and then apply the m operator on that and create a blue one at x 3

1 * {m -1 0 0 0 1 0 0 0 1 h 120}{x 3 s 2}box creates a green box at x -3 because m and h have been applied only once

So having fx, fy, fz would be really cool and if they - and the m operator - worked with multiples that would be even better.

after12am commented 4 years ago

https://github.com/after12am/eisenscript/issues/78#issuecomment-612590302

Ok, thank you. But this looks like a bit difficult. Maybe it takes time.

kronpano commented 4 years ago

Hi there,

saw that there are another batch of fixes and changes - looking good!!!

Any chance of getting the mirror operator in (fx, fy, fz) or matrix operator fixed ? If you can use 2 * {m -1 0 0 0 1 0 0 0 1} then that can be used for mirroring but at the moment this command results in one cube with the normal inside out ( or that's what it looks like).

Cheers

after12am commented 4 years ago

@kronpano I'm not sure how to implement it, but I tried it. How is this? Is it as you expected?

https://after12am.github.io/eisenscript-editor/#B/q1ZIq1CoUDBUqFVIyq8AAA==

kronpano commented 4 years ago

Hmm, not really the biggest problem is not that the normals inverted but that it doens't work with multiples 2 * {fx} 1 * {x 5 } box should (according to the original StructureSynth) produce two boxes one a x=5 and one mirrored (and possibly normals inverted) at x= -5 2 * { fy} 2 * {fx } 1 * {x 1 y 3} box should produce 4 boxes

You code seems to only ever produce one visible box - even though the developer tools say 'Build done. Created 4 objects.' but I can't see them??? Then again - it could just be me. Same happens with the matrix operation but I think there might just be a problem with objects being created BUT not being visible because of inverted normals (e.g. one-sided materials - just a guess)??

kronpano commented 4 years ago

Somehow it seem to work - but why can't I see more than one cube ?? Just tried that one skyship and that seems to work fine but not the basic boxes????

The skyship produced by eisenscript is exactly the one produced by StructureSynth - if the mystery of the missing boxes can be solved you have I think pretty much done it - proper StructureSynth in a browser!!!!

after12am commented 4 years ago

skyship

Amazing😳 Super coooooooooool!!! 😳😳😳

after12am commented 4 years ago

@kronpano Thank you for the detailed explanation. How about this?

https://after12am.github.io/eisenscript-editor/#B/M1LQUqhWSKtUqFUwgjArgExDMLMCSFcqGAP5SfkVAA==

192_168_11_5_9000_examples_

Default_es__-_Structure_Synth

kronpano commented 4 years ago

Looking GOOD!!!!

I guess after the holidays I need to have a look at all the changes you have made. Looks like you have pretty much implemented everything StructureSynth offers.

Need to get my head around all of it and see if I can get the BrowserSynth stuff somehow in. Looking forward to playing with it!!

after12am commented 4 years ago

Sound great. Thanks for your support!

after12am commented 3 years ago

If something is wrong, please reopen.