[OpenSCAD] avoiding assertion violation

nop head nop.head at gmail.com
Wed Jul 17 10:44:05 EDT 2019


>
> I am seeing that people are saying if you have two points X = 0 with
> different Y values that would work, but that seems like a weird case (as
> people mention zero thickness)

No it is not a weird case, it is the normal case to make something without
a hole through the middle.

When you have a single point meeting the Y axis then you end up with a
object with a zero thickness point where its top and bottom surfaces meet.
If you have pairs of adjacent points on the Y axis then you end of with a
normal solid with a non-zero thickness.

On Wed, 17 Jul 2019 at 15:34, Dan Shriver <tabbydan at gmail.com> wrote:

> If you're asking me to post my source here it is:
>
> Notes:
> 1) coshPolygon is corrected to start at 0.0001 not 0 as it was originally
> 2) If you use coshPolygon2 OpenSCAD helpfully spits out a message saying
> not to have points on both sides of the Y axis.  I was suggesting that
> maybe instead of the cryptic exception I got a message saying "Do not have
> any points X=0" would be nice.  I am seeing that people are saying if you
> have two points X = 0 with different Y values that would work, but that
> seems like a weird case (as people mention zero thickness)
> 3) if you make one hypDome things are fine (with coshPolygon starting at
> x=0 as it did originally).  However, multiple overlapping, or overlapping
> another object causes the cryptic exception
>
> ---------------------------------------------
>
> function echoit5(y,x) = echo(y,x) x; //debug
>
> function cosh(x) = (exp(x) + exp(-x))/2;
>
> function coshPolygon(multiplier, power, domain, flip, steps) =
>     let (flipValue = flip ? cosh( ( multiplier *(pow(domain,power))) ) : 0)
>     [ for(i = [0.0001: (domain / steps) : domain]) [i, flipValue - cosh(
>  ( multiplier *(pow(i,power)))  )] ];
>
> function coshPolygon2(multiplier, power, domain, flip, steps) =
>     [ for(i = [-domain: (2 * domain / steps) : domain]) [i, cosh(  (
> multiplier *(pow(i,power)))  )] ];
>
> module hypDome(multiplier = 1, power = 1, domain = 2, flip = true, steps =
> 10, facets = 20) {
>     rotate_extrude($fn = facets) {
>         polygon(echoit5("raw polygon",coshPolygon(multiplier, power,
> domain, flip, steps)));
>     }
> }
>
> scale([8,8,1]) {
> hypDome(1,1,5,true,10, 20);
> }
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <#m_-8618667265926880856_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Wed, Jul 17, 2019 at 10:00 AM Carsten Arnholm <arnholm at arnholm.org>
> wrote:
>
>> On 17.07.2019 15:23, nop head wrote:
>> > How does it differ from the OP's?
>>
>> We might perhaps know if the source is posted.
>>
>> The claim that touching the Y-axis in a single point is causing
>> assertion when used in rotate_extrude can be tested:
>>
>> rotate_extrude(){
>>    polygon([ [0,0],[2,-2], [2,2] ]);
>> }
>>
>> This works fine in OpenSCAD 2019.03.31 and it can be exported
>> successfully to various formats, including OFF (sing1.off, vertices=15
>> faces=28) and STL (sing1.stl, vertices=84 faces=28).
>>
>> The assertion occurs in OpenSCAD if you try to union with a cube:
>>
>> rotate_extrude(){
>>    polygon([ [0,0],[2,-2], [2,2] ]);
>> }
>> cube(1);
>>
>> Or this way, it also gives an assertion
>>
>> import("./sing1.stl");
>> cube(1);
>>
>>
>> Now, if you import the OpenSCAD-generated model into AngelCAD
>> (OFF-version) and union it with a cube as above and save it as test2.off:
>>
>> // AngelCAD code.
>> shape@ main_shape()
>> {
>>     polyhedron p("./sing1.off");
>>     return p + cube(1);
>> }
>>
>> In this case there is no problem, it works fine as shown in enclosed PNG
>> image, and
>>
>> ===
>>
>> $ polyfix test2.off
>>
>> Parameters:
>>    input_file = test2.off
>>
>>
>> polyhedron 0 ================= volume=29.4181, dtol=0.01, atol=1e-06,
>> maxiter=10
>> iteration 0: vertices=20 faces=38
>>               total changes=0
>>               no warnings
>>
>> Summary:
>>               polyhedron 0: vertices=20 faces=38 : no warnings
>>
>> ====
>>
>>
>> Therefore, the problem seen in OpenSCAD is not really in rotate_extrude,
>> but how the model is interpreted when subject to union using CGAL. The
>> same union using Carve works fine as should be expected.
>>
>>
>> Carsten Arnholm
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss at lists.openscad.org
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190717/5f91e9e2/attachment.html>


More information about the Discuss mailing list