Two annoyances

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

Two annoyances

jon_bondy
I keep trying to cut the bottom off of this horn (both inside the Horn
module, and when it is called at the bottom) with no joy. Puzzled.

I'm also seeing a log like this:
     Warning: Normalized tree is growing past 200000 elements. Aborting
normalization.
     Normalized CSD tree has 6767 elements

It may be clear to some of you how one tree became > 200000 (or is it
2000000?) while the other tree was a mere 6000.

Jon

---

rch = 0.1;

base = 0;    // height where base ends and sculpture starts
maxA = 360;

module OuterHorn() {
     for (a = [0:1:maxA]) {
         translate([18*sin(a), 18*cos(a), base + a/3])
             sphere(r=2+(maxA-a)/30, $fn = 20);
         };
     }

module InnerHorn() {
     for (a = [0:1:maxA]) {
         translate([18*sin(a), 18*cos(a), base + a/3])
             sphere(r=(maxA-a)/30, $fn = 20);
         };
     }

module Horn() {
     difference() {
         OuterHorn();
         InnerHorn();
         // cut off anything below the base
         translate([-50, -50, -100])
             cube([100, 100, 100]);
         }
     }

difference(){
//    Sculpture();
     Horn();
     // cut off anything below the base
     translate([-50, -50, -100])
         cube([100, 100, 100]);
     }

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

Re: Two annoyances

MichaelAtOz
Administrator
That could be a bug.
If you increase the Edit/Preference/Advanced/TurnOffRenderingAt setting to 400000 it goes away.

Interesting observation, the model (with normalisation) challenges my graphics system, but when Aborting normalization happens it displays easily??
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

MichaelAtOz
Administrator
p.s. Nice horn design, can I use it?
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

jon_bondy
Thanks!  Sure!  Seemed pretty obvious to me... <grin>

On 6/29/2015 6:00 PM, MichaelAtOz wrote:

> p.s. Nice horn design, can I use it?
>
>
>
> -----
> Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
> --
> View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12938.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.6037 / Virus Database: 4365/10124 - Release Date: 06/29/15


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

Re: Two annoyances

jon_bondy
In reply to this post by MichaelAtOz
I increased the TurnOffRenderingAt to 400,000 and the difference still
fails (Windows 64); not sure what you meant by "it goes away".  The
rendering is so slow that it is impossible to use, aborted or not.  And
you can imagine how long F6 would take.  Not the best way to use
OpenSCAD I fear.


On 6/29/2015 5:58 PM, MichaelAtOz wrote:

> That could be a bug.
> If you increase the Edit/Preference/Advanced/TurnOffRenderingAt setting to
> 400000 it goes away.
>
> Interesting observation, the model (with normalisation) challenges my
> graphics system, but when Aborting normalization happens it displays
> easily??
>
>
>
> -----
> Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
> --
> View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12937.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.6037 / Virus Database: 4365/10124 - Release Date: 06/29/15


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

Re: Two annoyances

jon_bondy
In reply to this post by MichaelAtOz
I wonder if the community would benefit from some general purpose
tube/horn facility that was customizable.  I realize that Kit Wallace's
stuff (derived from NopHead) is a bit like that, but not easy to use (at
least for me).

On 6/29/2015 5:58 PM, MichaelAtOz wrote:

> That could be a bug.
> If you increase the Edit/Preference/Advanced/TurnOffRenderingAt setting to
> 400000 it goes away.
>
> Interesting observation, the model (with normalisation) challenges my
> graphics system, but when Aborting normalization happens it displays
> easily??
>
>
>
> -----
> Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
> --
> View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12937.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.6037 / Virus Database: 4365/10124 - Release Date: 06/29/15


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

Re: Two annoyances

MichaelAtOz
Administrator
In reply to this post by jon_bondy
jon_bondy wrote
I increased the TurnOffRenderingAt to 400,000 and the difference still
fails (Windows 64); not sure what you meant by "it goes away".  The
rendering is so slow that it is impossible to use, aborted or not.  And
you can imagine how long F6 would take.  Not the best way to use
OpenSCAD I fear.
Do you still get the Warning msg? If so make the setting bigger.

Ahh! I changed the step number in the for() loops to 3, to cut down on the number of triangles.

I was not getting the warning and the cutting off the base was working OK.
I reduced the setting to 200,000 and got the Warning and the cut did not work.
I changed it back to 400,000 and "it goes away". Win7/64

Your current design uses sphere(), I was just considering using a short cylinder() instead, it will have fewer triangles to deal with.

Yes, OpenSCAD gets difficult with really large numbers of faces...

I wonder if the community would benefit from some general purpose
tube/horn facility that was customizable.  I realize that Kit Wallace's
stuff (derived from NopHead) is a bit like that, but not easy to use (at
least for me).
The more the merrier... :)
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

MichaelAtOz
Administrator
With your original design, I had to go to 3,000,000 for it to work.
OpenSCAD was extreeeeemly unresponsive. Not going to try F6 ;)
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

jon_bondy
Any idea why the difference() is unable to chop off the bottom?

On 6/29/2015 7:01 PM, MichaelAtOz wrote:

> With your original design, I had to go to 3,000,000 for it to work.
> OpenSCAD was extreeeeemly unresponsive. Not going to try F6 ;)
>
>
>
> -----
> Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
> --
> View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12943.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.6037 / Virus Database: 4365/10124 - Release Date: 06/29/15


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

Re: Two annoyances

MichaelAtOz
Administrator
I'm not sure of the what's happening internally when the normalisation is aborted. That may be the bug, or a limitation.?

But when the Warning is not occurring the difference() works properly.
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

MichaelAtOz
Administrator
This post was updated on .
This is a bit more manageable


// based on horns design by Jon Bondy
//  http://forum.openscad.org/Two-annoyances-td12935.html
//
// Modified my MichaelAtOz on the OpenSCAD forum http://forum.openscad.org/
//  My modifications are in the public domain.
//  Fewer faces, a little more responsine in F5 preview

rch = 0.1;

base = 0;    // height where base ends and sculpture starts
maxA = 360;
step=2;
thick=2;
sphereFn=24;

// this could be refined by hull-ing alternat layers.
// Processing intense tho.

module OuterHorn() {
        for (a = [0:step:maxA]) {
                translate([18*sin(a), 18*cos(a), base + a/3])
                        if (a<maxA)
                                cylinder(r=thick+(maxA-a)/30
                                        , h=step+0.1, $fn = sphereFn, center=true);
                        else
                                // this is a hack and needs improvement, works for now
                                intersection() {
                                        translate([0,0,thick*0.9])
                                        cube([thick*2,thick*2,thick*2],center=true);
                                scale([1,1,0.6])
                                        sphere(r=thick, $fn = sphereFn, center=true);
                                }
                };
}

module InnerHorn() {
        for (a = [0:step:maxA]) {
                translate([18*sin(a), 18*cos(a), base + a/3])
                                cylinder(r=(maxA-a)/30, h=step+0.1, $fn = sphereFn, center=true);
        };
}

module Horn() {
        difference() {
                OuterHorn();
                translate([0,0,-0.1])
                        InnerHorn();
        }
}

Horn();


About 4 min for F6 on my old system.
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

Peter Falke
In reply to this post by MichaelAtOz
Here is a way to make a horn by moving a circle along the winded horn path. This uses chain hull.
It has a comparable resolution, but has less than 20000 elements.
Thus it takes 8 sec. for a F5 on my netbook (1ghz). But a F6 is,as of yet, unresponsive.






// extrudepathhullv0_1
// GPLv2
// (c) 2013 TakeItAndRun
//
// v0_1:
//


//*******************************************************
//
// basic definitions
//
//*******************************************************

// circle (and sphere) have $fn facets
$fn=20;

//*******************************************************
//
// definition of path
//
//*******************************************************
// number of steps along path
tstep=40;
// start and end point
tmin=-.1;
tmax=1;

base=0;

// path to extrude along
//function x(t)=[
//    t,
//    t*abs(sin(t)),
//    t*cos(t)
//];

//function x(t)=[
//    (1+3*t)*sin(360*t),
//    (1+3*t)*cos(360*t),
//    10*t
//];

function x(t)=[
    18*sin(360*t),
    18*cos(360*t),
    base + 360*t/3
];

// scale
s_min=0.00001;
function s0(t)=1*(tmax-t)/tmax;
//function s0(t)=1-t/(tmax-tmin);
function s(t)=(abs(s0(t))<=s_min)?s_min:s0(t);
// twist
//function twist(t)=1*360*t/(tmax-tmin);
function twist(t)=0;

// small number to avoid colinear faces
e=0.02;

//*******************************************************
//
// routines
//
//*******************************************************

module extrude_path_hull(tmin=tmin,tmax=tmax,tstep=tstep){
    dt=(tmax-tmin)/tstep;
    for(t=[tmin:dt:tmax]){
//    echo("t:",t,t+dt);
//    echo("x:",x(t),x(t+dt));
//    echo("s0:",s0(t),s0(t+dt));
//    echo("s:",s(t),s(t+dt));
//        color([t/(tmax-tmin),1-t/(tmax-tmin),0 ])
        hull(){
// (I dont call place(t) here as it still produces a 'child' error in version 2013.03.09. Later version will enable recursion here)
        translate(x(t))
            rotate([0,0,a1(t)])
            rotate([0,90-a2(t),0])
            rotate([0,0,twist(t)])
            scale(s(t))
                child();
        translate(x(t+dt))
            rotate([0,0,a1(t+dt)])
            rotate([0,90-a2(t+dt),0])
            rotate([0,0,twist(t+dt)])
            scale(s(t+dt))
                child();
        }
    }

// place the extruded shape at the position x(t) and
// rotate it so that is normal to thepath
    module place(t){
        translate(x(t))
            rotate([0,0,a1(t)])
            rotate([0,90-a2(t),0])
            rotate([0,0,twist(t)])
            scale(s(t))
                child();
    }

// distance between points x(t) and x(t+dt) projected onto the xy-plane
    function dxy(t)=sqrt(
        pow(x(t+dt)[0]-x(t)[0],2)+
        pow(x(t+dt)[1]-x(t)[1],2)
    );

// angle between x-axis and projection of dx(t) onto the xy-plane
    function a1(t)=atan2(x(t+dt)[1]-x(t)[1],x(t+dt)[0]-x(t)[0]);

// angle between xy plane and dx(t) vector
    function a2(t)=atan2(x(t+dt)[2]-x(t)[2],dxy(t));

}

module shape(){
// the shape is linear_extruded by small value e, as hull() can only
// work with objects that are not in the same (xy-) plane, if these objects are 3d-objects
// (it can work with to 2d shapes, but they are by definition in the same (xy-) plane)
// Because of this the extruded object is actually extending at both ends by e/2 over the end of the path
    linear_extrude(height=e,center=true)
        hull(){
            translate(1*[1,0])circle(r=1);
            translate(-1*[1,0])circle(r=1);
        }
}

module shape2outer(){
    cylinder(r=14,h=e);
}
module shape2inner(){
    cylinder(r=12,h=e);
}

//*******************************************************
//
// main program
//
//*******************************************************

difference(){
    extrude_path_hull()shape2outer();
    extrude_path_hull()shape2inner();
            // cut off anything below the base
        translate([-50, -50, -100])
            cube([100, 100, 100]);
}




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

extrudepathhullv0_1 horn.scad (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

Peter Falke
F6 takes 12 min.

2015-06-30 12:22 GMT+02:00 Peter Falke <[hidden email]>:
Here is a way to make a horn by moving a circle along the winded horn path. This uses chain hull.
It has a comparable resolution, but has less than 20000 elements.
Thus it takes 8 sec. for a F5 on my netbook (1ghz). But a F6 is,as of yet, unresponsive.






// extrudepathhullv0_1
// GPLv2
// (c) 2013 TakeItAndRun
//
// v0_1:
//


//*******************************************************
//
// basic definitions
//
//*******************************************************

// circle (and sphere) have $fn facets
$fn=20;

//*******************************************************
//
// definition of path
//
//*******************************************************
// number of steps along path
tstep=40;
// start and end point
tmin=-.1;
tmax=1;

base=0;

// path to extrude along
//function x(t)=[
//    t,
//    t*abs(sin(t)),
//    t*cos(t)
//];

//function x(t)=[
//    (1+3*t)*sin(360*t),
//    (1+3*t)*cos(360*t),
//    10*t
//];

function x(t)=[
    18*sin(360*t),
    18*cos(360*t),
    base + 360*t/3
];

// scale
s_min=0.00001;
function s0(t)=1*(tmax-t)/tmax;
//function s0(t)=1-t/(tmax-tmin);
function s(t)=(abs(s0(t))<=s_min)?s_min:s0(t);
// twist
//function twist(t)=1*360*t/(tmax-tmin);
function twist(t)=0;

// small number to avoid colinear faces
e=0.02;

//*******************************************************
//
// routines
//
//*******************************************************

module extrude_path_hull(tmin=tmin,tmax=tmax,tstep=tstep){
    dt=(tmax-tmin)/tstep;
    for(t=[tmin:dt:tmax]){
//    echo("t:",t,t+dt);
//    echo("x:",x(t),x(t+dt));
//    echo("s0:",s0(t),s0(t+dt));
//    echo("s:",s(t),s(t+dt));
//        color([t/(tmax-tmin),1-t/(tmax-tmin),0 ])
        hull(){
// (I dont call place(t) here as it still produces a 'child' error in version 2013.03.09. Later version will enable recursion here)
        translate(x(t))
            rotate([0,0,a1(t)])
            rotate([0,90-a2(t),0])
            rotate([0,0,twist(t)])
            scale(s(t))
                child();
        translate(x(t+dt))
            rotate([0,0,a1(t+dt)])
            rotate([0,90-a2(t+dt),0])
            rotate([0,0,twist(t+dt)])
            scale(s(t+dt))
                child();
        }
    }

// place the extruded shape at the position x(t) and
// rotate it so that is normal to thepath
    module place(t){
        translate(x(t))
            rotate([0,0,a1(t)])
            rotate([0,90-a2(t),0])
            rotate([0,0,twist(t)])
            scale(s(t))
                child();
    }

// distance between points x(t) and x(t+dt) projected onto the xy-plane
    function dxy(t)=sqrt(
        pow(x(t+dt)[0]-x(t)[0],2)+
        pow(x(t+dt)[1]-x(t)[1],2)
    );

// angle between x-axis and projection of dx(t) onto the xy-plane
    function a1(t)=atan2(x(t+dt)[1]-x(t)[1],x(t+dt)[0]-x(t)[0]);

// angle between xy plane and dx(t) vector
    function a2(t)=atan2(x(t+dt)[2]-x(t)[2],dxy(t));

}

module shape(){
// the shape is linear_extruded by small value e, as hull() can only
// work with objects that are not in the same (xy-) plane, if these objects are 3d-objects
// (it can work with to 2d shapes, but they are by definition in the same (xy-) plane)
// Because of this the extruded object is actually extending at both ends by e/2 over the end of the path
    linear_extrude(height=e,center=true)
        hull(){
            translate(1*[1,0])circle(r=1);
            translate(-1*[1,0])circle(r=1);
        }
}

module shape2outer(){
    cylinder(r=14,h=e);
}
module shape2inner(){
    cylinder(r=12,h=e);
}

//*******************************************************
//
// main program
//
//*******************************************************

difference(){
    extrude_path_hull()shape2outer();
    extrude_path_hull()shape2inner();
            // cut off anything below the base
        translate([-50, -50, -100])
            cube([100, 100, 100]);
}






--
[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: Two annoyances

jon_bondy
In reply to this post by Peter Falke
Peter:

Wow!  Under 1 second for F5 on my machine, and resulting in an object that is easily viewable.  Kudos.

I gather that this is a framework that you use often to create shapes like this?  I saw remnants of other functions that had been commented out.

Your code is copyrighted: may I use it to create shapes?

Thanks again. This group is the greatest!

Jon

On 6/30/2015 6:22 AM, Peter Falke wrote:
Here is a way to make a horn by moving a circle along the winded horn path. This uses chain hull.
It has a comparable resolution, but has less than 20000 elements.
Thus it takes 8 sec. for a F5 on my netbook (1ghz). But a F6 is,as of yet, unresponsive.






// extrudepathhullv0_1
// GPLv2
// (c) 2013 TakeItAndRun
//
// v0_1:
//


//*******************************************************
//
// basic definitions
//
//*******************************************************

// circle (and sphere) have $fn facets
$fn=20;

//*******************************************************
//
// definition of path
//
//*******************************************************
// number of steps along path
tstep=40;
// start and end point
tmin=-.1;
tmax=1;

base=0;

// path to extrude along
//function x(t)=[
//    t,
//    t*abs(sin(t)),
//    t*cos(t)
//];

//function x(t)=[
//    (1+3*t)*sin(360*t),
//    (1+3*t)*cos(360*t),
//    10*t
//];

function x(t)=[
    18*sin(360*t),
    18*cos(360*t),
    base + 360*t/3
];

// scale
s_min=0.00001;
function s0(t)=1*(tmax-t)/tmax;
//function s0(t)=1-t/(tmax-tmin);
function s(t)=(abs(s0(t))<=s_min)?s_min:s0(t);
// twist
//function twist(t)=1*360*t/(tmax-tmin);
function twist(t)=0;

// small number to avoid colinear faces
e=0.02;

//*******************************************************
//
// routines
//
//*******************************************************

module extrude_path_hull(tmin=tmin,tmax=tmax,tstep=tstep){
    dt=(tmax-tmin)/tstep;
    for(t=[tmin:dt:tmax]){
//    echo("t:",t,t+dt);
//    echo("x:",x(t),x(t+dt));
//    echo("s0:",s0(t),s0(t+dt));
//    echo("s:",s(t),s(t+dt));
//        color([t/(tmax-tmin),1-t/(tmax-tmin),0 ])
        hull(){
// (I dont call place(t) here as it still produces a 'child' error in version 2013.03.09. Later version will enable recursion here)
        translate(x(t))
            rotate([0,0,a1(t)])
            rotate([0,90-a2(t),0])
            rotate([0,0,twist(t)])
            scale(s(t))
                child();
        translate(x(t+dt))
            rotate([0,0,a1(t+dt)])
            rotate([0,90-a2(t+dt),0])
            rotate([0,0,twist(t+dt)])
            scale(s(t+dt))
                child();
        }
    }

// place the extruded shape at the position x(t) and
// rotate it so that is normal to thepath
    module place(t){
        translate(x(t))
            rotate([0,0,a1(t)])
            rotate([0,90-a2(t),0])
            rotate([0,0,twist(t)])
            scale(s(t))
                child();
    }

// distance between points x(t) and x(t+dt) projected onto the xy-plane
    function dxy(t)=sqrt(
        pow(x(t+dt)[0]-x(t)[0],2)+
        pow(x(t+dt)[1]-x(t)[1],2)
    );

// angle between x-axis and projection of dx(t) onto the xy-plane
    function a1(t)=atan2(x(t+dt)[1]-x(t)[1],x(t+dt)[0]-x(t)[0]);

// angle between xy plane and dx(t) vector
    function a2(t)=atan2(x(t+dt)[2]-x(t)[2],dxy(t));

}

module shape(){
// the shape is linear_extruded by small value e, as hull() can only
// work with objects that are not in the same (xy-) plane, if these objects are 3d-objects
// (it can work with to 2d shapes, but they are by definition in the same (xy-) plane)
// Because of this the extruded object is actually extending at both ends by e/2 over the end of the path
    linear_extrude(height=e,center=true)
        hull(){
            translate(1*[1,0])circle(r=1);
            translate(-1*[1,0])circle(r=1);
        }
}

module shape2outer(){
    cylinder(r=14,h=e);
}
module shape2inner(){
    cylinder(r=12,h=e);
}

//*******************************************************
//
// main program
//
//*******************************************************

difference(){
    extrude_path_hull()shape2outer();
    extrude_path_hull()shape2inner();
            // cut off anything below the base
        translate([-50, -50, -100])
            cube([100, 100, 100]);
}





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


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6037 / Virus Database: 4365/10128 - Release Date: 06/30/15



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

Re: Two annoyances

Peter Falke
Sure, go right ahead.
As I understood it, it allows just that.

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

Re: Two annoyances

jon_bondy
In reply to this post by MichaelAtOz
Michael:

This approach is working very well for me.  After pulling the sin/cos
function out of your code, I now have a flexible way to create a variety
of horn geometries.  Nice!

After I press F5, the Console says that it has completed the computation
in under a second, but it takes about 5 seconds for the rendering to
take place.  This is mildly annoying, but what is really annoying is
that for the next minute or so, the cursor alters between normal and
hourglass every 5 or 10 seconds.  It is as if it thinks I asked for an
adjustment in the rendered view, but I have not.  Given how long the
rendering takes, this is very time consuming.

I wonder if there is some bug that is not visible with a "normal"
instantaneous render, but is appearing now that the render takes so long.

Imagine that I try to reorient the rendered image by dragging.  I
imagine that a series of renders are thus requested.  It would be nice
if that queue were managed better for the case where the render is
taking more than 0.1 seconds.  I think that all but the first and last
render request should be discarded.

Jon

On 6/30/2015 6:20 AM, MichaelAtOz wrote:

> This is a bit more manageable
>
>
> // based on horns design by Jon Bondy
> //  http://forum.openscad.org/Two-annoyances-td12935.html
> //
> // Modified my MichaelAtOz on the OpenSCAD forum http://forum.openscad.org/
> //  My modifications are in the public domain.
> //  Fewer faces, a little more responsine in F5 preview
>
> rch = 0.1;
>
> base = 0;    // height where base ends and sculpture starts
> maxA = 360;
> step=2;
> thick=2;
> sphereFn=24;
>
> // this could be refined by minkoswki-ing alternat layers.
> // Processing intense tho.
>
> module OuterHorn() {
> for (a = [0:step:maxA]) {
> translate([18*sin(a), 18*cos(a), base + a/3])
> if (a<maxA)
> cylinder(r=thick+(maxA-a)/30
> , h=step+0.1, $fn = sphereFn, center=true);
> else
> // this is a hack and needs improvement, works for now
> intersection() {
> translate([0,0,thick*0.9])
> cube([thick*2,thick*2,thick*2],center=true);
> scale([1,1,0.6])
> sphere(r=thick, $fn = sphereFn, center=true);
> }
> };
> }
>
> module InnerHorn() {
> for (a = [0:step:maxA]) {
> translate([18*sin(a), 18*cos(a), base + a/3])
> cylinder(r=(maxA-a)/30, h=step+0.1, $fn = sphereFn, center=true);
> };
> }
>
> module Horn() {
> difference() {
> OuterHorn();
> translate([0,0,-0.1])
> InnerHorn();
> }
> }
>
> Horn();
>
>
> About 4 min for F6 on my old system.
>
>
>
> -----
> Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
> --
> View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12948.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.6037 / Virus Database: 4365/10128 - Release Date: 06/30/15


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

Re: Two annoyances

jon_bondy
In reply to this post by MichaelAtOz
Michael:

I got cute, and had the horns go up and then down.  This is the result.  
Any hints about how to orient the cylinders so that they are normal to
the path?

Jon

On 6/30/2015 6:20 AM, MichaelAtOz wrote:

> This is a bit more manageable
>
>
> // based on horns design by Jon Bondy
> //  http://forum.openscad.org/Two-annoyances-td12935.html
> //
> // Modified my MichaelAtOz on the OpenSCAD forum http://forum.openscad.org/
> //  My modifications are in the public domain.
> //  Fewer faces, a little more responsine in F5 preview
>
> rch = 0.1;
>
> base = 0;    // height where base ends and sculpture starts
> maxA = 360;
> step=2;
> thick=2;
> sphereFn=24;
>
> // this could be refined by minkoswki-ing alternat layers.
> // Processing intense tho.
>
> module OuterHorn() {
> for (a = [0:step:maxA]) {
> translate([18*sin(a), 18*cos(a), base + a/3])
> if (a<maxA)
> cylinder(r=thick+(maxA-a)/30
> , h=step+0.1, $fn = sphereFn, center=true);
> else
> // this is a hack and needs improvement, works for now
> intersection() {
> translate([0,0,thick*0.9])
> cube([thick*2,thick*2,thick*2],center=true);
> scale([1,1,0.6])
> sphere(r=thick, $fn = sphereFn, center=true);
> }
> };
> }
>
> module InnerHorn() {
> for (a = [0:step:maxA]) {
> translate([18*sin(a), 18*cos(a), base + a/3])
> cylinder(r=(maxA-a)/30, h=step+0.1, $fn = sphereFn, center=true);
> };
> }
>
> module Horn() {
> difference() {
> OuterHorn();
> translate([0,0,-0.1])
> InnerHorn();
> }
> }
>
> Horn();
>
>
> About 4 min for F6 on my old system.
>
>
>
> -----
> Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
>
> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
> --
> View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12948.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.6037 / Virus Database: 4365/10128 - Release Date: 06/30/15

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

horns.PNG (78K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

MichaelAtOz
Administrator
jon_bondy wrote
After I press F5, the Console says that it has completed the computation
in under a second, but it takes about 5 seconds for the rendering to
take place.  This is mildly annoying, but what is really annoying is
that for the next minute or so, the cursor alters between normal and
hourglass every 5 or 10 seconds.  It is as if it thinks I asked for an
adjustment in the rendered view, but I have not.  Given how long the
rendering takes, this is very time consuming.
Yeh, I had noted that too, very annoying. I suspect the refresh is under Qt control.
You need to keep you mouse cursor out of the display window.
That is the display driver latency when a high poly count AFAIK.

I got cute, and had the horns go up and then down.  This is the result.  
Any hints about how to orient the cylinders so that they are normal to
the path?
No sorry, I would have to redo my high school maths, that makes my brain hurt...
Admin - email* me if you need anything, or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Two annoyances

Peter Falke
With my program the shapes are always placed normal to the path.
Just give me the math you used for the path.


2015-07-02 5:00 GMT+02:00 MichaelAtOz <[hidden email]>:
jon_bondy wrote
> After I press F5, the Console says that it has completed the computation
> in under a second, but it takes about 5 seconds for the rendering to
> take place.  This is mildly annoying, but what is really annoying is
> that for the next minute or so, the cursor alters between normal and
> hourglass every 5 or 10 seconds.  It is as if it thinks I asked for an
> adjustment in the rendered view, but I have not.  Given how long the
> rendering takes, this is very time consuming.

Yeh, I had noted that too, very annoying. I suspect the refresh is under Qt
control.
You need to keep you mouse cursor out of the display window.
That is the display driver latency when a high poly count AFAIK.


> I got cute, and had the horns go up and then down.  This is the result.
> Any hints about how to orient the cylinders so that they are normal to
> the path?

No sorry, I would have to redo my high school maths, that makes my brain
hurt...



-----
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
--
View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12974.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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: Two annoyances

jon_bondy
Peter:

As much as I appreciate your approach, it turned out that I needed the approach that subtracted an InnerHorn from the InnerHorn, in order to clean up some other geometry (punching a hole through the base/stand).  I suppose I can try to meld your normals and Michael's cylinders...

Jon

On 7/2/2015 6:18 AM, Peter Falke wrote:
With my program the shapes are always placed normal to the path.
Just give me the math you used for the path.


2015-07-02 5:00 GMT+02:00 MichaelAtOz <[hidden email]>:
jon_bondy wrote
> After I press F5, the Console says that it has completed the computation
> in under a second, but it takes about 5 seconds for the rendering to
> take place.  This is mildly annoying, but what is really annoying is
> that for the next minute or so, the cursor alters between normal and
> hourglass every 5 or 10 seconds.  It is as if it thinks I asked for an
> adjustment in the rendered view, but I have not.  Given how long the
> rendering takes, this is very time consuming.

Yeh, I had noted that too, very annoying. I suspect the refresh is under Qt
control.
You need to keep you mouse cursor out of the display window.
That is the display driver latency when a high poly count AFAIK.


> I got cute, and had the horns go up and then down.  This is the result.
> Any hints about how to orient the cylinders so that they are normal to
> the path?

No sorry, I would have to redo my high school maths, that makes my brain
hurt...



-----
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
--
View this message in context: http://forum.openscad.org/Two-annoyances-tp12935p12974.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6037 / Virus Database: 4365/10143 - Release Date: 07/02/15



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