i don't understand this message. please help

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

i don't understand this message. please help

Baxsie
OpenSCAD must be able to detect this condition, since there is an error shown.

Marius, you seem to have a solution very quickly.

Couldn't OpenSCAD correct the winding order automatically to avoid the error?

| Brent A. Crosby

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

Giles Bathgate-2
On 17 April 2011 16:55, Brent Crosby <[hidden email]> wrote:
> OpenSCAD must be able to detect this condition, since there is an error
> shown.
> Marius, you seem to have a solution very quickly.
> Couldn't OpenSCAD correct the winding order automatically to avoid the
> error?

The "winding order" generally determines whether the facet is facing
outwards or inwards. clockwise means facing inwards and anticlockwize
means facing outwards or vice versa...so as I understand its not
possible to detect which way you want the facet to be facing
automagically.

For example if your polyhedron is convex (all faces curving out or
bulging outward) you might want all the faces to have anticlockwise
winding order. If your polyhedron is concave (some faces curving in or
hollowed inward) you would want most of the faces to have
anticlockwise winding, but the inwards facing faces would have to have
clockwise winding.

Maybe this is detectable, but I don't think its trivial.

Regards

Giles Bathgate

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

kintel
Administrator
In reply to this post by Baxsie
On Apr 17, 2011, at 17:55 PM, Brent Crosby wrote:

> OpenSCAD must be able to detect this condition, since there is an error shown.
>
> Couldn't OpenSCAD correct the winding order automatically to avoid the error?
>
The error message comes from the underlying CGAL library, which cannot handle mixed counter and counterclockwise polygons.
We could make sure to always feed CGAL with correct data, but it would require us do do a topological analysis of the incoming data and to automatically flip any wrongly defined polygons. Doable but not trivial.
..unless there is something in CGAL which I don't know about which could do this for us..

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

Stuart Young
On 18 April 2011 04:49, Marius Kintel <[hidden email]> wrote:
> On Apr 17, 2011, at 17:55 PM, Brent Crosby wrote:
>
>> OpenSCAD must be able to detect this condition, since there is an error shown.
>>
>> Couldn't OpenSCAD correct the winding order automatically to avoid the error?
>>
> The error message comes from the underlying CGAL library, which cannot handle mixed counter and counterclockwise polygons.
> We could make sure to always feed CGAL with correct data, but it would require us do do a topological analysis of the incoming data and to automatically flip any wrongly defined polygons. Doable but not trivial.
> ..unless there is something in CGAL which I don't know about which could do this for us..

Perhaps instead we could we parse that error, and give something a bit
more meaningful?

Specifically, I'm thinking that pointing out the most likely issue
here is wrongly defined polygons, and showing the user which ones are
wrongly defined. IMO, visually on the object would be best, with color
coding to match each error - so you can figure out which error relates
to each poly.

Sure it'd be nice to have an option to automatically correct things,
but the bigger problem is that the user doesn't understand the error,
or where the error is.

Note: This also brings up the idea that if a 'Compile and Render'
fails, having a fall-back to the 'Compile' option while showing
appropriate error messages. This of course would have to be clearly
shown as an error, so that the user knows it didn't succeed and that
they need to correct something to get it to work, otherwise they may
just assume the Render worked.

--
Stuart Young (aka Cefiar)

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

kintel
Administrator
On Apr 18, 2011, at 02:11 AM, Stuart Young wrote:
>
> Perhaps instead we could we parse that error, and give something a bit
> more meaningful?
>
I definitely agree.
I also like the concept of visual compile errors.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

M.Rule
In reply to this post by Stuart Young
so I think an algorithm to check for triangle winding might go
something like this :

-- initialize an empty set of edges
-- for each triangle
-- -- for each edge (A,B),
-- -- -- if (A,B) is in the set of edges, do nothing and move to the next edge
-- -- -- if (B,A) is in the set of edges, we have winding conflict :
-- -- -- -- either complain about winding number for this specific
triangle ( give a more specific error ) or
-- -- -- -- reverse the winding of this facet and try again,
highlighting the piece perhaps
-- -- -- if neither of the above happened :
-- -- -- -- add (A,B) to the pool of edges


On Sun, Apr 17, 2011 at 8:11 PM, Stuart Young <[hidden email]> wrote:

> On 18 April 2011 04:49, Marius Kintel <[hidden email]> wrote:
>> On Apr 17, 2011, at 17:55 PM, Brent Crosby wrote:
>>
>>> OpenSCAD must be able to detect this condition, since there is an error shown.
>>>
>>> Couldn't OpenSCAD correct the winding order automatically to avoid the error?
>>>
>> The error message comes from the underlying CGAL library, which cannot handle mixed counter and counterclockwise polygons.
>> We could make sure to always feed CGAL with correct data, but it would require us do do a topological analysis of the incoming data and to automatically flip any wrongly defined polygons. Doable but not trivial.
>> ..unless there is something in CGAL which I don't know about which could do this for us..
>
> Perhaps instead we could we parse that error, and give something a bit
> more meaningful?
>
> Specifically, I'm thinking that pointing out the most likely issue
> here is wrongly defined polygons, and showing the user which ones are
> wrongly defined. IMO, visually on the object would be best, with color
> coding to match each error - so you can figure out which error relates
> to each poly.
>
> Sure it'd be nice to have an option to automatically correct things,
> but the bigger problem is that the user doesn't understand the error,
> or where the error is.
>
> Note: This also brings up the idea that if a 'Compile and Render'
> fails, having a fall-back to the 'Compile' option while showing
> appropriate error messages. This of course would have to be clearly
> shown as an error, so that the user knows it didn't succeed and that
> they need to correct something to get it to work, otherwise they may
> just assume the Render worked.
>
> --
> Stuart Young (aka Cefiar)
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

Giles Bathgate-2
In reply to this post by Stuart Young
On 18 April 2011 01:11, Stuart Young <[hidden email]> wrote:
> Specifically, I'm thinking that pointing out the most likely issue
> here is wrongly defined polygons, and showing the user which ones are
> wrongly defined. IMO, visually on the object would be best, with color
> coding to match each error - so you can figure out which error relates
> to each poly.

"When you select 'Thrown together' from the view menu and compile the
design (not compile and render!) you will see a preview with the
mis-oriented polygons highlighted."

>From http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids
Or are you suggesting something better and more advanced?

Regards

Giles Bathgate

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

Giles Bathgate-2
In reply to this post by Giles Bathgate-2
On 17 April 2011 18:15, Giles Bathgate <[hidden email]> wrote:
> If your polyhedron is concave (some faces curving in or
> hollowed inward) you would want most of the faces to have
> anticlockwise winding, but the inwards facing faces would have to have
> clockwise winding.

I think I was wrong about this, here is a good test case:

polyhedron(points=[[15,-15,0],[-15,-15,0],[0,15,0],[0,0,20],[0,0,10]],triangles=[[0,2,1],[1,2,3],[0,1,3],[0,3,4],[0,4,2],[2,4,3]]);

Its a pyramid with one concave face. I think they all have clockwise winding.

Regards

Giles Bathgate

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

Stuart Young
In reply to this post by Giles Bathgate-2
On 18 April 2011 17:37, Giles Bathgate <[hidden email]> wrote:

> On 18 April 2011 01:11, Stuart Young <[hidden email]> wrote:
>> Specifically, I'm thinking that pointing out the most likely issue
>> here is wrongly defined polygons, and showing the user which ones are
>> wrongly defined. IMO, visually on the object would be best, with color
>> coding to match each error - so you can figure out which error relates
>> to each poly.
>
> "When you select 'Thrown together' from the view menu and compile the
> design (not compile and render!) you will see a preview with the
> mis-oriented polygons highlighted."
>
> >From http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids
> Or are you suggesting something better and more advanced?

Enhanced mainly.

Just wondering if perhaps once such an error is encountered (eg: in a
render and compile), the user could be presented with a popup dialog
asking them if they want to use a thrown together view to debug the
issue. The dialog would only appear after the render/compile is
complete, and only if errors that can be debugged by using thrown
together mode would help (such as winding errors). If they answer no,
they keep the current render, whereas if they answer 'yes' then it
switches mode to 'thrown together'.

Also, could it be possible to highlight the code that has the issue in
the editor, to show where the problem is? If you could highlight the
actual triplets that are wrongly wound in the code, it'd make it a lot
easier to associate the problem with the visualisation to the
associated code to correct it.

Lastly, if you have more than one problem (eg: many different polygons
with winding errors), it might be useful highlighting them differently
(color, cross-hatching, another pattern, etc), so they can be
identified from each other. This would be nice, especially with many
groups of polygons, but not essential.

--
Stuart Young (aka Cefiar)

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

kintel
Administrator
Stuart,

I added some notes to TODO.txt based on your input:
https://github.com/openscad/openscad/raw/master/doc/TODO.txt

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

Stuart Young
On 18 April 2011 21:10, Marius Kintel <[hidden email]> wrote:
> I added some notes to TODO.txt based on your input:
> https://github.com/openscad/openscad/raw/master/doc/TODO.txt

Looks good. Ta!

--
Stuart Young (aka Cefiar)

Reply | Threaded
Open this post in threaded view
|

Re: i don't understand this message. please help

Whosawhatsis
In reply to this post by M.Rule
Perhaps my brain hasn't booted up yet, but if you want two facets to
have the same winding order and they share an edge, shouldn't the
points on that edge be listed in the opposite order on for the two
facets? For example, (A, B, C) would have the same winding order as
(B, A, D), but not (A, B, D).

On Sun, Apr 17, 2011 at 5:26 PM, M.Rule <[hidden email]> wrote:

> so I think an algorithm to check for triangle winding might go
> something like this :
>
> -- initialize an empty set of edges
> -- for each triangle
> -- -- for each edge (A,B),
> -- -- -- if (A,B) is in the set of edges, do nothing and move to the next edge
> -- -- -- if (B,A) is in the set of edges, we have winding conflict :
> -- -- -- -- either complain about winding number for this specific
> triangle ( give a more specific error ) or
> -- -- -- -- reverse the winding of this facet and try again,
> highlighting the piece perhaps
> -- -- -- if neither of the above happened :
> -- -- -- -- add (A,B) to the pool of edges
>
>
> On Sun, Apr 17, 2011 at 8:11 PM, Stuart Young <[hidden email]> wrote:
>> On 18 April 2011 04:49, Marius Kintel <[hidden email]> wrote:
>>> On Apr 17, 2011, at 17:55 PM, Brent Crosby wrote:
>>>
>>>> OpenSCAD must be able to detect this condition, since there is an error shown.
>>>>
>>>> Couldn't OpenSCAD correct the winding order automatically to avoid the error?
>>>>
>>> The error message comes from the underlying CGAL library, which cannot handle mixed counter and counterclockwise polygons.
>>> We could make sure to always feed CGAL with correct data, but it would require us do do a topological analysis of the incoming data and to automatically flip any wrongly defined polygons. Doable but not trivial.
>>> ..unless there is something in CGAL which I don't know about which could do this for us..
>>
>> Perhaps instead we could we parse that error, and give something a bit
>> more meaningful?
>>
>> Specifically, I'm thinking that pointing out the most likely issue
>> here is wrongly defined polygons, and showing the user which ones are
>> wrongly defined. IMO, visually on the object would be best, with color
>> coding to match each error - so you can figure out which error relates
>> to each poly.
>>
>> Sure it'd be nice to have an option to automatically correct things,
>> but the bigger problem is that the user doesn't understand the error,
>> or where the error is.
>>
>> Note: This also brings up the idea that if a 'Compile and Render'
>> fails, having a fall-back to the 'Compile' option while showing
>> appropriate error messages. This of course would have to be clearly
>> shown as an error, so that the user knows it didn't succeed and that
>> they need to correct something to get it to work, otherwise they may
>> just assume the Render worked.
>>
>> --
>> Stuart Young (aka Cefiar)
>> _______________________________________________
>> OpenSCAD mailing list
>> [hidden email]
>> http://rocklinux.net/mailman/listinfo/openscad
>>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>