Giter Club home page Giter Club logo

eisenscript's People

Contributors

after12am avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

eisenscript's Issues

Live demo with squashed spheres and torus

simple script:
6 * { ry 60 } r
rule r md 22 {
{x 2}sphere
{ ry 12 rx 12 rz 22 x 1 z -0.4 y -0.4 s 1.1 0.8 1.2} r
}
rule r md 22 {
{z 2 s 0.5}torus
{ ry 22 rx 22 rz 12 x 1 z -0.4 y -0.4 s 0.8 0.8 1.1} r
}

So you can squash spheres and use other primitives like torus and so on.
Scripts so far work a bit different from the eisen script in Structure synth
live demo here - zoom with mousewheel, rotate left click and shift right click.

https://playingwithstuff.000webhostapp.com/play2/

What I found here:
if you use a construct like

6 * { ry 60 } r
rule r md 5 > k {
sphere
{x 2}r
}
rule k md 4 {
box
{y 2}k
}

it goes into r for a depth of 5 once and from then on executes k
So again I think there is a problem in terms of breadth first and recursivity ?

Structure Synth:
image

and Browser Synth:
image

I guess it might not really be your aim to be exactly like Structure Synth.
In that case just tell me and I will stop comparing the two.

error handling

catch exception raised while parsing eisenscript and then report

consider it is need to resolve namespace in matrix.js

./math/matrix.js:// have to change THREE namespace
./math/matrix.js:    var x = new THREE.Vector3();
./math/matrix.js:    var y = new THREE.Vector3();
./math/matrix.js:    var z = new THREE.Vector3();
./math/matrix.js:    var v1 = new THREE.Vector3();
./math/matrix.js:    var v = new THREE.Vector4();
./math/matrix.js:    var v1 = new THREE.Vector3();
./math/matrix.js:    var mRotation = new THREE.Matrix4(),
./math/matrix.js:      mScale = new THREE.Matrix4();
./math/matrix.js:    var x = new THREE.Vector3(),
./math/matrix.js:      y = new THREE.Vector3(),
./math/matrix.js:      z = new THREE.Vector3(),
./math/matrix.js:      matrix = new THREE.Matrix4();
./math/matrix.js:      translation = ( translation instanceof THREE.Vector3 ) ? translation : new THREE.Vector3();
./math/matrix.js:      rotation = ( rotation instanceof THREE.Quaternion ) ? rotation : new THREE.Quaternion();
./math/matrix.js:      scale = ( scale instanceof THREE.Vector3 ) ? scale : new THREE.Vector3();
./math/matrix.js:    var v1 = new THREE.Vector3();
./math/matrix.js:    var ymax = near * Math.tan( THREE.Math.degToRad( fov * 0.5 ) );
./math/matrix.js:    return new THREE.Matrix4(

error in script parsing ?

following script should produce some sort of Beddard's pyramid

crate
rule crate md 3{
{} fbox
{ s 0.5 x 0.9 z 0.9 y -0.9 } crate //1
{ s 0.5 x -0.9 z 0.9 y -0.9 } crate //2
{ s 0.5 x 0.9 z -0.9 y -0.9 } crate //3
{ s 0.5 x -0.9 z -0.9 y -0.9 } crate //4
}
rule fbox{
{} frame
{rx 90} frame
{rz 90}frame
}
rule frame{
{ y 0.46 } ring
{ y -0.46 } ring
}
rule ring {
// front
{ s 1 0.08 0.08 z 5.75 } box
// back
{ s 1 0.08 0.08 z -5.75 } box
// left
{ s 0.08 0.08 1 x -5.75 } box
// right
{ s 0.08 0.08 1 x 5.75 } box
// middle horizontal
{ s 0.08 0.08 1 x 0} box
// middle vertical
{ s 1 0.08 0.08 x 0 } box
}

It does so in Structure Synth but - as far as I can see - here it does not traverse into the crate rule and through number 2,3 and 4 - only number one is executed.

Perhaps an issue with breadth first -not depth?
Not sure where to look for that one.

Structure Synth
image
vs BrowserSynth
image

CSG and render times

This is not an issue but something I think is really good, interesting and to build on.

I used csg.js and ThreeCSG.js to use CSG to create my own frame.

This is what I used to create my frame:
(Take a normal box and take away 3 boxes in the 3 axes that are a bit smaller in two dimensions)

var fbox = new ThreeBSP( new THREE.Mesh( new THREE.BoxGeometry( 1, 1, 1 )));
var cutframe1 =new ThreeBSP(new THREE.Mesh(new THREE.BoxGeometry(1, 0.8, 0.8)));
var cutframe2 =new ThreeBSP(new THREE.Mesh(new THREE.BoxGeometry(0.8,1 , 0.8)));
var cutframe3 =new ThreeBSP(new THREE.Mesh(new THREE.BoxGeometry(0.8, 0.8, 1)));
var csg_result = fbox.subtract(cutframe1).subtract(cutframe2).subtract(cutframe3);
Geometry.CSG = csg_result.toGeometry();

I also added a primitive called csg so I can use it from the script.

Now for the really positive part of using a CSG generated object:

Times using regular box:
objects: 271
render time: 24421ms (24s)

times using CSG frame:
objects: 271
render time: 24478ms (24s)

time using Structure synth frame (12 boxes to make a frame - see script below)
objects: 3241
render time: 286136ms (about 5 minutes)

This is - I think - brilliant !!!!!
A object created using CSG seems to add nearly no time to the rendering !!!

That means offering CSG elements (or letting the user generate their own ones) makes it possible to render structures containing more "complex" primitives without extending render times.

I LIKE THAT A LOT!!!!

script used to test:

set maxobjects 4000

6 * {rz 60 } tower

//tower
rule tower md 16 > end{
{s 5}csg
//frame
{y 4.5 rx 10 s 0.9 } tower
}

rule end md 28{
{s 5}csg
//frame
{y 4.5 rx -2 s 1 } end
}

// strucsynth frame
rule frame{
twotri
{z 4.5 x 4.5 ry 180}twotri
}

rule twotri{
tri
{y 4.5 x 4.5 rz -90 rx 90}tri
}
rule tri{
{z 2.25 s 0.5 0.5 5}box
{x 2.25 s 5 0.5 0.5}box
{y 2.25 s 0.5 5 0.5}box
}

// csg frame
{s 1}csg

Scaling affects rotation ?

Using the following script:

tower
rule tower md 44 {
{s 2 5 3 }box
{y 5 rx 10 rz 10 s 0.95 } tower
}
Produces the following image:
browsereven

Now the only change is to change the scaling in the recursive function call:

tower
rule tower md 44 {
{s 2 5 3 }box
{y 5 rx 10 rz 10 s 0.95 1 1 } tower
}
which then produces the following image:
browseruneven

There are quite a few wobbles when it comes to the rotation and there seem to be points where the box is actually growing - not shrinking - even though the rule is same or smaller.

It leads to an irregular image when all it should do is shrink in the direction of one axis.

This behaviour will be different from the original Structure Synth because there the shearing happened when rotation and scaling was used in the same rule .

Starter tutorial for Noob

In order to use this Eisenscript JS, where is the best way to do it? Is the example included in the ZIP?

I always have issue with JS in regards to "Server" :(

Some sort of rounding errors????

Another regular structure
18 * {ry 12 y -0.9 s 1.3 1 1}box
leads to this:
image
there is this strange step after 14 steps.

Do the same with a smaller angle and it looks OK
18 * {ry 10 y -0.9 s 1.3 1 1}box
image

When the angle gets over 180 there is this jump???
Not really sure.

Possible to implement squashed spheres and other THREE primitives?

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.

wrong color

When used LambertMaterial, the color does not correct.
the material color has to be blue.

{ color #00f } box

random is not working

here is that.

10 * { x 1 color random } 10 * { y 1 color random } 10 * { z 1 color random } box
// -> got a error

publish data has the three-dimensional shape for 3d printer

Strange irregular rotation and shearing of boxes

I published my try-outs here (takes a bit to load and show the structure but it works - well - should work)
The structure is a regular one - the script is

corner
rule ARC maxdepth 66 {
{ z 0.85 rx 4.5 s 0.95 } ARC
box
}
rule corner md 10{
{ s 1 2 1.2 }ARC
{ry 36}corner
}

The problem is if you zoom in (mouse wheel) and look at the structure some arms are regular (1) but if you turn the structure (left click and drag/ right click shifts it) some are quite strange (2).
arms

Not sure why that should happen if the script is just turn and rotate.

One - quite big difference to the original Structure Synth is that boxes are not sheared they stay boxes.

The following script
15 * {rx 10 x 1.1 s 1 1.3 1}box
produces heavily sheared boxes in the original Structure Synth
t2

but a tower of nice rectangular boxes in browser synth
t1

This shearing also means that the structure I published on the website looks quite "rough" whereas in the original Structure Synth - due to the shearing - it is quite smooth
image

Just saying

kick out jquery

function sprintf(){
  var _arg = $.makeArray(arguments), template = _arg.shift(), i;
  for(i in _arg){
    template = template.replace('%s', _arg[i]);
  }
  return template;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.