I am concerned that there is a cost to using a Boolean operator with a single
operand ...
My model is large and complex (pushing 10,000 lines) and I often use
switches for testing and optional components. I have a lot of:
union-difference-intersection () {
A();
if (switchVariable) B();
}
Would there be a rendering speed cost? (it's slow enough already)
Is there added complexity in the generated STL? (it's big enough already)
I could change to:
if (switchVariable)
union-difference-intersection () { A(); B(); }
} else {
A();
}
... but that would make the code far less readable (it's dense enough
already).
Thanks for any feedback or even musings on this ...
Sent from: http://forum.openscad.org/
I just looked at the source code. The function
GeometryEvaluator::applyToChildren3D
contains the following:
// Only one child -> this is a noop
if (children.size() == 1) return ResultObject(children.front().second);
So I would say that union, intersection and difference with a single shape
argument are optimized to just return the shape.
On 14 June 2018 at 07:56, ClintGoss clint@goss.com wrote:
I am concerned that there is a cost to using a Boolean operator with a
single
operand ...
My model is large and complex (pushing 10,000 lines) and I often use
switches for testing and optional components. I have a lot of:
union-difference-intersection () {
A();
if (switchVariable) B();
}
Would there be a rendering speed cost? (it's slow enough already)
Is there added complexity in the generated STL? (it's big enough already)
I could change to:
if (switchVariable)
union-difference-intersection () { A(); B(); }
} else {
A();
}
... but that would make the code far less readable (it's dense enough
already).
Thanks for any feedback or even musings on this ...
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Thank you so much Doug!
You've not on answered the question, but made me realize that (of course!) I
could simply read the source code (Of Course!). Guess years of using closed
apps will make you forget that.
Sent from: http://forum.openscad.org/
The if() statement, when its test evaluates false, returns an empty object. So you actually are passing two objects. Really, union(), difference(), and intersection() should all have shortcuts for that too.
On Jun 14, 2018, at 6:34 AM, ClintGoss clint@goss.com wrote:
Thank you so much Doug!
You've not on answered the question, but made me realize that (of course!) I
could simply read the source code (Of Course!). Guess years of using closed
apps will make you forget that.
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org