after12am / eisenscript

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

Some sort of rounding errors???? #46

Closed kronpano closed 4 years ago

kronpano commented 7 years ago

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.

after12am commented 7 years ago

well, I got terrible result when I used babylonjs.

localhost_9000_tests_babylonjs_html_ localhost_9000_tests_babylonjs_html_ 2

after12am commented 7 years ago

It might be lighting of renderer causes this problem.

kronpano commented 7 years ago

I will have a look at the object data generated. If that is OK the problem lies somewhere else - true. I guess with all the data available it would even be possible to generate python scripts for Blender and other "exporters". Great work!!!! Will surely check out the progress you made next week. Thanks for all the hard work!!!!

kronpano commented 7 years ago

Did a bit more investigation on this one and I am not sure it is only the renderer. Here is a screen shot like the one I posted first: image

I "extended" the code a bit to export the translate-vector, scale-vector and rotation matrix from the object matrix to a csv file. This can be opened in Sverchok, a Blender add-on and then you can see the data modelled in Blender. Here is the screenshot of that: screensverchokstack

The camera perspective is slightly different but you can see that the data really has that jump on the fourth plate from the bottom - not sure though why and where it comes from.

kronpano commented 7 years ago

You might be right that this is a limitation of three.js In this issue on three.js https://github.com/mrdoob/three.js/issues/3845 they are talking about:

This means that when the matrix is applied to a vector, the rotation is applied first, and the scale is applied second. When the scale is non-uniform, a transform of this form cannot, in general, be decomposed into a scale followed by a pure rotation. What this means is that parents with non-uniform scale need to be avoided. It is OK if (childless) children have non-uniform scale.

I am not 100% that this is the problem but - after playing around a bit more - it looks like it could be.

after12am commented 4 years ago

This looks fixed now. @kronpano Check it out please.

18 * {ry 12 y -0.9 s 1.3 1 1}box

screencapture-192-168-11-5-9000-examples-1586744942556

image

after12am commented 4 years ago

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