after12am / eisenscript Goto Github PK
View Code? Open in Web Editor NEWA programming language designed for generating awesome structures.
Home Page: https://after12am.github.io/eisenscript-docs/
License: MIT License
A programming language designed for generating awesome structures.
Home Page: https://after12am.github.io/eisenscript-docs/
License: MIT License
wipe out from core script
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 ?
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.
catch exception raised while parsing eisenscript and then report
./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(
here is a case.
10 * { x 1 a 0.8 } 10 * { y 1 a 0.8 } 10 * { z 1 a 0.8 } box
I want to reduce two color space to one.
https://github.com/after12am/eisenscript/blob/master/src/interpreter.js#L17
this.curr.hex = Color('#ff0000');
this.curr.hsv = _.extend(Color({ hue: 0, saturation: 1, value: 1 }), { computed: false });
Hi there,
made BrowserSynth based on your code but there are a couple of things in your original I don't understand. Are you still around ?
If script arrived terminated condition, do we have to warn?
ui of ghpages is terrible. we have to remake interface of that.
reference
http://gamingjs.com/ice/
http://ui-patterns.com/patterns/CompletenessMeter/examples/17153
http://ui-patterns.com/users/1/collections/account-deletion/screenshots/17012
http://ui-patterns.com/patterns/CopyBox/examples/17039
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.
I wonder that using yeild make it possible to implement stepwise execution like this.
add matrix example correctly works.
{ m 1 0 0 0 1 0 0 0 1 } box
// -> not good
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
make this statement work correctly.
#define varname value
EISEN.compile -> new EISEN.Compile
https://github.com/after12am/eisenscript/blob/master/src/interpreter.js
this.currMatrix = new Matrix4();
this.currHex = Color('#ff0000');
this.currHsv = _.extend(Color({ hue: 0, saturation: 1, value: 1 }), { computed: false });
this.currBlend = { color: null, strength: 0, computed: false };
this.currAlpha = 1;
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:
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:
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 .
var that = this;
โ var scope = this;
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" :(
see pool-structuresynth of flickr.
treat as requirements.
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.
When used LambertMaterial, the color does not correct.
the material color has to be blue.
{ color #00f } box
this is the correct.
for (var i = boxes.length - 1; i >= 0; i--) this.group.remove(boxes[i]);
here is that.
10 * { x 1 color random } 10 * { y 1 color random } 10 * { z 1 color random } box
// -> got a error
set colorpool [scheme]
change image to more cool
we can publish the data representing the three-dimensional shape as stl file format file for 3d printer.
http://ja.wikipedia.org/wiki/Standard_Triangulated_Language
http://lostlinksearch.net/blog/2012/11/javascript%E3%81%A7%E4%BB%BB%E6%84%8F%E3%81%AE%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%82%92%E4%BB%BB%E6%84%8F%E3%81%AE%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%90%8D%E3%81%A7%E3%83%80%E3%82%A6%E3%83%B3/
http://www.hiramine.com/programming/3dmodelfileformat/index.html
http://www.hiramine.com/programming/3dmodelfileformat/objfileformat.html
https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/OBJLoader.js
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).
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
but a tower of nice rectangular boxes in browser synth
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
Just saying
function sprintf(){
var _arg = $.makeArray(arguments), template = _arg.shift(), i;
for(i in _arg){
template = template.replace('%s', _arg[i]);
}
return template;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.