after12am / eisenscript

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

Possible to implement squashed spheres and other THREE primitives? #43

Closed kronpano closed 4 years ago

kronpano commented 7 years ago

I am using the original version of Structure Synth quite a bit and would be very interested in trying to bring it to web browsers and possibly extend it - torus, cylinders and other THREE primitives and possibly squashed spheres. Also there are quite a few lighting options in THREE.js

My problem is, I have worked with javascript but I am not sure about the process to get it all to work together. Is there a bit more of a description of the workflow and the tools needed?

Sorry if this is a bit of a newbie question but I haven't used some of the tools needed.

kronpano commented 7 years ago

OK, I got it to work - looking forward to playing with it - and hopefully extending it.

Squashed spheres work fine. Just tested: {y -8 ry -20}all rule all{ 10 * {s 1.2 1 1 z 1} sphere 10 * {s 1.2 1.2 1 z -1} sphere 10 * {s 1.2 1.2 1 y 0.6} sphere 10 * {s 0.8 1 1 y -1} sphere } results in image

Also got some Torus to work.

Problem: if I move to the later version of three.js which contains cones and cylinders jQuery.js comes up with some error - need to investigate.

Like it a lot so far!!

kronpano commented 7 years ago

Well, I guess it would all be a lot easier if I knew what I was doing. Managed to get it to work with the new version of three.js and a three tutorial file - so I can spin it around and zoom in. The eisen script is just showing a couple of different primitives

all rule all{ 10 * {s 1.2 1 1 rx 5 z 4} 1 * {s 4} sphere 10 * {s 1.2 rx 5 z -1.5} 1 * {s 2} torus 10 * {s 1.2 y 1.3} pyra3 // 3 sided pyramid from cone 10 * {s 0.8 1 1.1 y -2.5} 1 * {s 4} sphere 10 * {s 1.2 rz 5 x 1.6} pyra4 // 4 sided pyramid from cone 10 * {s 1.2 rz 5 y 0.18 x -1.8} cone // well, a cone }

So definitely more playing needed!!! It looks promising - I also read somewhere about CSG using three.js - this is the one thing I have been missing a long time since leaving POV ray and I think it would work well with Structure Synth to create basic shapes. image

after12am commented 7 years ago

great works!

possibly extend it - torus, cylinders and other THREE primitives and possibly squashed spheres.

Yes, I can support these primitives. But I want to write test codes for avoiding degration befor supporting these.

after12am commented 7 years ago

I am not sure about the process to get it all to work together. Is there a bit more of a description of the workflow and the tools needed?

I am sorry for my poor documentation. It needs to reorganize and expand the documentation.

after12am commented 7 years ago

added cylinder, triangle, line primitives. #58

after12am commented 7 years ago

I can support squashed spheres, but I think it is not basic primitive. So if uses squash, you would do as following.

rule squash {
  { s 1 .2 1 } box
}
squash
after12am commented 4 years ago

What shape is good with squash? Is this ok?

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

after12am commented 4 years ago

If the issue hasn't been fixed, please reopen issue.