recursion crash

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

recursion crash

Peter Falke
This crushes on Win 7 with version 2015.03

module mirror(v){
    children();
    mirror(v)children();
}

mirror([1,0,0])cube();


--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: recursion crash

Greg Frost
That is infinite recursion. Definitely invalid, but I'm not sure it should crash.

On 2 Apr 2015, at 10:11 pm, Peter Falke <[hidden email]> wrote:

This crushes on Win 7 with version 2015.03

module mirror(v){
    children();
    mirror(v)children();
}

mirror([1,0,0])cube();


--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: recursion crash

herdima
In reply to this post by Peter Falke
You redefine the predefined module mirror.
What you want is probably this:
module mirror_duplicate(v){
    children();
    mirror(v) children();
}

mirror_duplicate([1,0,0]) cube();

Am 02.04.2015 um 13:41 schrieb Peter Falke:
This crushes on Win 7 with version 2015.03

module mirror(v){
    children();
    mirror(v)children();
}

mirror([1,0,0])cube();

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: recursion crash

Peter Falke
What I want is:

mirror(v,keep=true)

But, I may not get it. ;)

I posted it only, because it crashes and I think Kintel tries hard to fix OpenSCAD crashing at all.

2015-04-02 14:50 GMT+02:00 Martin Herdieckerhoff <[hidden email]>:
You redefine the predefined module mirror.
What you want is probably this:
module mirror_duplicate(v){
    children();
    mirror(v) children();
}

mirror_duplicate([1,0,0]) cube();

Am 02.04.2015 um 13:41 schrieb Peter Falke:
This crushes on Win 7 with version 2015.03

module mirror(v){
    children();
    mirror(v)children();
}

mirror([1,0,0])cube();

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: recursion crash

Peter Falke
Now, what I want, can be done in user space: redefining mirror, so to accept keep=true.
I'm using multimarix to avoid a recursive definition.
Using the reflection matrix:

\mathbf{A} = \begin{bmatrix} 1 - 2 a^2  & - 2 a b & - 2 a c \\ - 2 a b  & 1 - 2 b^2 & - 2 b c  \\ - 2 a c & - 2 b c & 1 - 2c^2 \end{bmatrix}

If it can be done in user space, this could be an argument not to include it into the core language.
But I still think: it makes it easier for newbies and it makes cde easier to read and write if this is included into OpenSCAD.

module mirror(v,keep=false){
    if(keep)children();
        u=v/norm(v);
        a=u.x;
        b=u.y;
        c=u.z;
    multmatrix(m = [
                [1-2*a*a, -2*a*b, -2*a*c, 0],
                [-2*a*b,1-2*b*b, -2*b*c, 0],
                [-2*a*c, -2*b*c, 1-2*c*c, 0],
                [0, 0, 0,  1]
    ])
        children();
}

mirror([1,1,1],true)cube(1);



2015-04-02 15:32 GMT+02:00 Peter Falke <[hidden email]>:
What I want is:

mirror(v,keep=true)

But, I may not get it. ;)

I posted it only, because it crashes and I think Kintel tries hard to fix OpenSCAD crashing at all.

2015-04-02 14:50 GMT+02:00 Martin Herdieckerhoff <[hidden email]>:
You redefine the predefined module mirror.
What you want is probably this:
module mirror_duplicate(v){
    children();
    mirror(v) children();
}

mirror_duplicate([1,0,0]) cube();

Am 02.04.2015 um 13:41 schrieb Peter Falke:
This crushes on Win 7 with version 2015.03

module mirror(v){
    children();
    mirror(v)children();
}

mirror([1,0,0])cube();

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org