Is this render correct?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is this render correct?

Endre
Hi,

I have a polygon.
I make an offset and translate the copy of the polygon, than I make a hull for both.

hull() {
    polygon(paths = [[0, 1, 2, 3]], points = [[0, -0.2250000000], [0, 0.7350000000], [0.9000000000, 0.5250000000], [0.9000000000, -0.1350000000]]);
    translate(v = [0, 0, 0.1000000000]) {
        offset(r = 0.1000000000) {
            polygon(paths = [[0, 1, 2, 3]], points = [[0, -0.2250000000], [0, 0.7350000000], [0.9000000000, 0.5250000000], [0.9000000000, -0.1350000000]]);
       }
    }
}

It is rendered into a simple 2d, offsetted and translated polygon.
render

Preview is also interesting. It is like the offsetted polygon is extruded.


I wouldn't expect these results.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is this render correct?

Ronaldo
You are right, it is odd. There is nothing wrong with your code. The render of polygons is the correct answer to your code. In preview, OpenSCAD have the vice of representing polygons extruded by one unit. But it is just a representation; polygons still have no volume.

BTW, you don't so much zeros to represent numbers. Internally they are double floats.

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

Re: Is this render correct?

MichaelAtOz
Administrator
It is also better to use larger numbers, ATM OpenSCAD can have issues at such small dimensions.
Work 10x or 100x larger, then if needed scale down the end result.

Admin - PM me if you need anything,
or if I've done something stupid...

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.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is this render correct?

Endre
Thanks for the hints!
Sorry for the many zeros in my code, it is SolidPython generated.
I have tried to do it with an about 100 times upscale, but I stiil don't get the result what I expect.
I have removed the offset() from the code to make it even simpler:


hull() {
    polygon(paths = [[0, 1, 2, 3]], points = [[0, -22.50000000], [0, 73.50000000], [90.00000000, 52.50000000], [90.00000000, -13.50000000]]);
    translate(v = [0, 0, 100.00000000]) {
        polygon(paths = [[0, 1, 2, 3]], points = [[0, -22.50000000], [0, 73.50000000], [90.00000000, 52.50000000], [90.00000000, -13.50000000]]);
    }
}

The result is, both in preview and render,  simply the 2d base polygon. For this I'd expect a 3d solid object, which would be identical with the base polygon, extruded along the z axis.

I have tried to achieved the same with linear_extrude():

linear_extrude(height=100) {
    polygon(paths = [[0, 1, 2, 3]], points = [[0, -22.50000000], [0, 73.50000000], [90.00000000, 52.50000000], [90.00000000, -13.50000000]]);
}

It is working.

Can it be that the hull() function doesn't work with Z translated 2d polygons?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is this render correct?

Endre
hull() is working if I create thin solids from the polygons:

hull() {
    linear_extrude(height=5) {
        polygon(paths = [[0, 1, 2, 3]], points = [[0, -22.50000000], [0, 73.50000000], [90.00000000, 52.50000000], [90.00000000, -13.50000000]]);
    }
    translate(v = [0, 0, 100.00000000]) {
        linear_extrude(height=5) {
            offset(r=10) {
                polygon(paths = [[0, 1, 2, 3]], points = [[0, -22.50000000], [0, 73.50000000], [90.00000000, 52.50000000], [90.00000000, -13.50000000]]);
            }
        }
    }
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is this render correct?

nophead
Hull can work on 2D shapes or on 3D shapes. It doesn't work on a mixture of both or a 2D shape with a Z offset. In fact you should never apply Z offsets to 2D objects. Think of them living in a flat 2D world. Extrude is needed to bring them into the 3D world.

OpenSCAD should ignore Z for 2D objects but it actually does inconsistent things with it.

On 21 March 2017 at 10:51, Endre <[hidden email]> wrote:
hull() is working if I create thin solids from the polygons:

hull() {
    linear_extrude(height=5) {
        polygon(paths = [[0, 1, 2, 3]], points = [[0, -22.50000000], [0,
73.50000000], [90.00000000, 52.50000000], [90.00000000, -13.50000000]]);
    }
    translate(v = [0, 0, 100.00000000]) {
        linear_extrude(height=5) {
            offset(r=10) {
                polygon(paths = [[0, 1, 2, 3]], points = [[0, -22.50000000],
[0, 73.50000000], [90.00000000, 52.50000000], [90.00000000, -13.50000000]]);
            }
        }
    }
}



--
View this message in context: http://forum.openscad.org/Is-this-render-correct-tp20968p20978.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


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