Why are 2D shapes previewed as being 3D?

Please Login to Comment

It's no big deal, I'm just curious more than anything.

From the OpenSCAD user manual: "Although infinitely thin, they are rendered with a 1 thickness."

It's just a default thickness used for rendering. If you define a 2D shape, it gets displayed with a 1mm thickness by default, probably for easier visualization.

Probably to keep it simple and fast.

I don't pretend to know the first thing about OpenCSG but I would have thought adding all the extra geometry would make things slower and more complicated.

It's not as if they are even trying to make the shapes look 2D, on a small object a height of 0.5 is quite chunky.

I believe OpenCSG can't render 0 thickness shape. Or maybe it's to prevent having 2D geometry laying around. That would produce a none manifold STL file. OpenSCAD is pretty good at producing manifold STL file, and I think it does everything it can to enforce it.

Note that OpenSCAD won't render anything if you write something like this:

linear_extrude(0) {
    circle(r = 10);

I'm not sure why they chose 1 as default value. They could have chose a smaller value, something like 0.00001, but that would not have changed the number of geometry. That would have just make the side triangles very small.

Actually OpenCSG can indeed render a 0 thickness shape, if you use the polyhedron function to define just one face. For example:

polyhedron( points=[ [10,10,0], [10,-10,0], [-10,-10,0], [-10,10,0] ], faces=[ [0,1,2,3] ]);

That gives you a square of zero thickness. Change one of the Z values above from 0 to something else and you get two connected triangles of zero thickness.

Hu! that sounds like an oversight by the developers.

I'm getting the sense that giving depth to 2D objects was just an arbitrary decision that has never been reviewed.

Me neither and i agree, but i suppose that one type of object makes it simpler for the preview. You can color it with a specific color, when extruded it will return to the basic color. As in:
color("green") import("test.dxf");

I don't think it is a different type of object so far as OpenCSG is concerned, it's all just geometry. As Amatulic points out, above, it is possible to preview and even render a 2D polyhedron().