Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when scaling minkowski sum #161

Closed
cadr opened this issue Jul 29, 2012 · 4 comments
Closed

Crash when scaling minkowski sum #161

cadr opened this issue Jul 29, 2012 · 4 comments

Comments

@cadr
Copy link

cadr commented Jul 29, 2012

The following code reliably crashes OpenSCAD for me

scale([0, 0, 0.5]) minkowski() {
  cube(5);
  cylinder(h = 5 , r = 1);
}

When I just "compile it", nothing shows on the screen. But when "compile and render (CGAL)", it crashes. From the command line, I get the following - I don't know if this is a CGAL bug or the way OpenSCAD is calling it.

$ /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -o test.dxf minkowski_crash.scad 
CGAL error: precondition violation!
Expression : z != 0
File       : ../libraries/install/include/CGAL/GMP/Gmpq_type.h
Line       : 305
Explanation: 
Refer to the bug-reporting instructions at http://www.cgal.org/bug_report.html
Abort trap: 6

I'm using OpenSCAD 2011.12 and OSX 10.7.4.

@donbright
Copy link
Sponsor Member

disregard my previous post. this is rather odd bug, but the 'new OpenSCAD' does not have the problem.

However, the new openscad has a different problem, related to issue #148.

If you compile this is new openscad, i mean literally from the last few days (july 28 2012) it will not crash, but it will also produce no output.

If you change the '0' in your scale function to '1' it will produce output, and not crash.

The question comes back to the old question, what does 'scale by 0' mean? in some situations the old openscad used to literally transform 'scale by 0' into 'scale by 1' and apparently some people got used to this (printrbot for example). There was a post on this on the mailing list a while back too IIRC.

New openscad doesnt work this way, im not exactly sure if old old openscad would have crashed in the same manner on this code...

but basically,

scale([1, 1, 0.5]) minkowski() {
  cube(5);
  cylinder(h = 5 , r = 1);
}

on new openscad will not crash, and produce output.

Someone needs to decide what 'scale by 0' means in OpenSCAD, and then what to do about the backwards compatability issue, im not sure how many libraries are out there that depend on the old 'scale by 0' being assumed to be 'scale by 1' thing.

Im not sure what will happen on OpenSCAD 2011.12 if you change the scale().. i dont have a copy installed at the moment to test....

@cadr
Copy link
Author

cadr commented Jul 29, 2012

Thanks for that - I definitely meant to scale by 1 instead of zero, and that produces the result I want. I think it would be valid to disallow scaling by zero, and just have OpenSCAD produce an error (rather than crashing). Thanks for your help!

@cadr
Copy link
Author

cadr commented Jul 29, 2012

Don - is this covered in #148? Should I close this one?

@donbright
Copy link
Sponsor Member

Yeah I think its closed. It doesn't crash any more, and it does print a Warning, as you suggested. I guess if there are enough backwards compatability problems, maybe a new issue can be opened. Thank you for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants