Chiseled Font?

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

Re: Chiseled Font?

nophead
Perhaps the bug has been fixed. I think any arbitrary transform can change the winding order, so it would have to fixed up after multmatrix, mirror and scale.

On Wed, 19 Feb 2020 at 18:52, A. Craig West <[hidden email]> wrote:
Mirror is likely to have the same effect, though. Unless it explicitly reverses the winding order, which would only be required depending on exactly how it is mirrored 

On Wed, 19 Feb 2020, 13:48 Jordan Brown, <[hidden email]> wrote:
On 2/19/2020 9:55 AM, nop head wrote:
Doesn't scale with -1 turn the object inside out because it flips the vertices without fixing the winding order that gets reversed by the flip?



That was my guess, but I didn't see any evidence of it when I flipped a cube and looked at Thrown Together.  But I don't really understand that aspect of the system.

_______________________________________________
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

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

Re: Chiseled Font?

JordanBrown
On 2/19/2020 10:54 AM, nop head wrote:
Perhaps the bug has been fixed. I think any arbitrary transform can change the winding order, so it would have to fixed up after multmatrix, mirror and scale.


The docs on polyhedron say that either order is OK, as long as you're consistent.  (But you might end up with pink objects in Thrown Together.)

Intuitively, I'd think that if a transformation flipped one of the faces, it'd flip all of them.


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

Re: Chiseled Font?

tp3
On 19.02.20 20:04, Jordan Brown wrote:
> The docs on polyhedron say that either order is OK, as long
> as you're consistent.  (But you might end up with pink objects
> in Thrown Together.)

Discussion on IRC not long ago found that statement is wrong.

ciao,
  Torsten.

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

Re: Chiseled Font?

NateTG
In reply to this post by JordanBrown
JordanBrown wrote
> Intuitively, I'd think that if a transformation flipped one of the
> faces, it'd flip all of them.

That's true for rigid transforms.




--
Sent from: http://forum.openscad.org/

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

Re: Chiseled Font?

JordanBrown
In reply to this post by tp3
On 2/19/2020 11:43 AM, Torsten Paul wrote:
On 19.02.20 20:04, Jordan Brown wrote:
The docs on polyhedron say that either order is OK, as long
as you're consistent.  (But you might end up with pink objects
in Thrown Together.)
Discussion on IRC not long ago found that statement is wrong.

Sorry, which statement?  That negative scales are bad, or that either order is OK in a polyhedron?

Regardless, maybe somebody with write access to the manual could fix it, or at least add a "this isn't correct and needs to be rewritten" caution.


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

Re: Chiseled Font?

tp3
On 19.02.20 23:19, Jordan Brown wrote:
> On 2/19/2020 11:43 AM, Torsten Paul wrote:
>> On 19.02.20 20:04, Jordan Brown wrote:
>>> The docs on polyhedron say that either order is OK, as long
>>> as you're consistent.  (But you might end up with pink objects
>>> in Thrown Together.)
>> Discussion on IRC not long ago found that statement is wrong.
>
> Sorry, which statement?  That negative scales are bad, or that
> either order is OK in a polyhedron?

The one I quoted, about face winding order of polyhedrons.

I'm not sure about the scaling issue. I seem to remember
there were issues (and fixes) at least for mirror(). Maybe
also for scale().

> Regardless, maybe somebody with write access to the manual
> could fix it, or at least add a "this isn't correct and needs
> to be rewritten" caution.

It's a wiki, everyone has write access.

ciao,
  Torsten.

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

Re: Chiseled Font?

JordanBrown
On 2/19/2020 2:24 PM, Torsten Paul wrote:
Regardless, maybe somebody with write access to the manual
could fix it, or at least add a "this isn't correct and needs
to be rewritten" caution.
It's a wiki, everyone has write access.

I knew it was a wiki, and I guess the fact that I found that a change was made by an anonymous editor showed that write access was pretty open.

I've changed it from:

All faces must have points ordered in the same direction . OpenSCAD prefers clockwise when looking at each face from outside inwards. The back is viewed from the back, the bottom from the bottom, etc..

to:

All faces must have points ordered clockwise when looking at each face from outside inwards. The back is viewed from the back, the bottom from the bottom, etc..


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

Re: Chiseled Font?

acwest
I think I was in that discussion, and it may well be that the original wording was correct. 
My testing originally seemed to indicate that it mattered, but I later found other issues that explained the difficulties. If work ever slows down a bit I want check it out more thoroughly. In any case, keeping to a consistent ordering is a good idea 

On Wed, 19 Feb 2020, 17:34 Jordan Brown, <[hidden email]> wrote:
On 2/19/2020 2:24 PM, Torsten Paul wrote:
Regardless, maybe somebody with write access to the manual
could fix it, or at least add a "this isn't correct and needs
to be rewritten" caution.
It's a wiki, everyone has write access.

I knew it was a wiki, and I guess the fact that I found that a change was made by an anonymous editor showed that write access was pretty open.

I've changed it from:

All faces must have points ordered in the same direction . OpenSCAD prefers clockwise when looking at each face from outside inwards. The back is viewed from the back, the bottom from the bottom, etc..

to:

All faces must have points ordered clockwise when looking at each face from outside inwards. The back is viewed from the back, the bottom from the bottom, etc..

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Chiseled Font?

JordanBrown
On 2/19/2020 3:12 PM, A. Craig West wrote:
I think I was in that discussion, and it may well be that the original wording was correct. 
My testing originally seemed to indicate that it mattered, but I later found other issues that explained the difficulties. If work ever slows down a bit I want check it out more thoroughly. In any case, keeping to a consistent ordering is a good idea

Can we get an authoritative answer from somebody?


On Wed, 19 Feb 2020, 17:34 Jordan Brown, <[hidden email]> wrote:
On 2/19/2020 2:24 PM, Torsten Paul wrote:
Regardless, maybe somebody with write access to the manual
could fix it, or at least add a "this isn't correct and needs
to be rewritten" caution.
It's a wiki, everyone has write access.

I knew it was a wiki, and I guess the fact that I found that a change was made by an anonymous editor showed that write access was pretty open.

I've changed it from:

All faces must have points ordered in the same direction . OpenSCAD prefers clockwise when looking at each face from outside inwards. The back is viewed from the back, the bottom from the bottom, etc..

to:

All faces must have points ordered clockwise when looking at each face from outside inwards. The back is viewed from the back, the bottom from the bottom, etc..

_______________________________________________
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


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

Re: Chiseled Font?

NateTG
> Can we get an authoritative answer from somebody?

Just checked in 2018.07.21

Reversing the winding order produces a solid purple shape in thrown together
view, but it seems to work normally in unions and intersections.

Honestly, I'm a little surprised that polyhedron doesn't just handle it.
It's not a super challenging thing to have the computer fix as long as the
surface is simply connected and orientable.




--
Sent from: http://forum.openscad.org/

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

Re: Chiseled Font?

Ronaldo
Honestly, I'm a little surprised that polyhedron doesn't just handle it.
It's not a super challenging thing to have the computer fix as long as the
surface is simply connected and orientable.

It is not a simple task to find whether a consistent winding is reversed or not. The only way I have found was to compute the polyhedron volume by:

function polyhedron_volume(v,f) =
  let( crx = [for(fi=f, j=[1:1:len(fi)-2])
                 let( v0=v[fi[0]],
                      v1=v[fi[j]],
                      v2=v[fi[(j+1)%len(fi)]] )
                  (cross(v1-v0, v2-v0)*((v0+v1+v2).x)).x ] )
  -sum(crx)/6;

where sum() computes the sum of the vectors in a list. If polyhedron_volume() is negative, the winding is reversed. It works provided the winding is consistent.

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

Re: Chiseled Font?

Parkinbot
It seems that a consistent wrong orientation is being handled. At least if
you do a Boolean operation on a purple object and a regular one or on two
purple objects you don't get a CGAL error.

The only miracle is indeed that:
scale([1,1,-1])
cube(100);

like other regular (cylinder() or xxx_extrude()) objects aren't display
purple by F12. I guess that F12 just ignores them.  


Ronaldo wrote
>>
>> Honestly, I'm a little surprised that polyhedron doesn't just handle it.
>> It's not a super challenging thing to have the computer fix as long as
>> the
>> surface is simply connected and orientable.
>>





--
Sent from: http://forum.openscad.org/

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

Re: Chiseled Font?

JordanBrown
On 2/20/2020 8:04 AM, Parkinbot wrote:
It seems that a consistent wrong orientation is being handled. At least if you do a Boolean operation on a purple object and a regular one or on two purple objects you don't get a CGAL error. 

The only miracle is indeed that: 
scale([1,1,-1])
cube(100); 

like other regular (cylinder() or xxx_extrude()) objects aren't display
purple by F12. I guess that F12 just ignores them.  

I built a cube with polyhedron() and mirrors and negative scales don't turn it purple.  When I flip one of the faces, it's consistently purple across the various reflections.

It seems like it would be easy enough to fix a polyhedron after an arbitrary scale(); you'd just reverse the winding order of all of the faces if there were an odd number of negative scales.

I expect that you could derive the same information from a transformation matrix, but right now I'm not up to the math to do it.

I've reverted my change to the manual, restoring the "same direction" / "prefers clockwise" version.

Did we ever get an authoritative resolution on the negative scale question?


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

Re: Chiseled Font?

Ronaldo
I expect that you could derive the same information from a transformation matrix, but right now I'm not up to the math to do it.

A 4x4 transformation matrix includes some sort of mirroring if its determinant is less than 0. If the determinant is zero, the transformation is a projection on a lower dimension space and may or may not include a mirroring. It seems that multmatrix doesn't computes the matrix determinant or, at least, ignores if it is zero and does a projection on a lower dimension space but considers it a 3D object!

multmatrix( [ [1,0,0,0], [1,0,0,0],[0,0,-1,0]]) cube(10);
square();

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

Re: Chiseled Font?

Parkinbot
In reply to this post by JordanBrown
An exploit of the sign of the determinant of the multmatrix would be an
explanation.


JordanBrown wrote
> Did we ever get an authoritative resolution on the negative scale
> question?

the ultimate authority is always the compiler ;-)
another place to check is the source code ...
 



--
Sent from: http://forum.openscad.org/

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

Re: Chiseled Font?

JordanBrown
On 2/20/2020 10:03 AM, Parkinbot wrote:
JordanBrown wrote
Did we ever get an authoritative resolution on the negative scale
question?
the ultimate authority is always the compiler ;-) 

Not so much for "sometimes produces bad results" problems.  Better to have somebody (or some documentation) that says "X is expected to work and Y is expected to be unreliable".


another place to check is the source code ... 

Yeah, maybe, if you speak C++ and you understand how the 3D guts all interact.

But, looking at it with my very marginal C++ knowledge, it sure looks like all mirror() does is to set up a transformation matrix.

https://github.com/openscad/openscad/blob/master/src/transform.cc#L171

... which suggests that negative scale and the multmatrix equivalents would be fine.


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

Re: Chiseled Font?

Parkinbot
This post was updated on .
Since all affine operations are converted into multmatrix before being
interpreted by the CSG subsystem there can't be much difference if
mirror([0,0,1]) and scale([1,1,-1]) are mapped to the same expression.

Further
<a href="https://github.com/openscad/openscad/blob/master/src/polyset.cc##L160">https://github.com/openscad/openscad/blob/master/src/polyset.cc##L160
shows that the determinant is used to check inside-outs as proposed by
Ronaldo.




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Chiseled Font?

JordanBrown
On 2/20/2020 2:51 PM, Parkinbot wrote:
Since all affine operations are converted into multmatrix before being
interpreted by the CSG subsystem there can't be much difference if
mirror([0,0,1]) and scale([1,1,-1]) are mapped to the same expression.

Further
<a class="moz-txt-link-freetext" href="https://github.com/openscad/openscad/blob/master/src/polyset.cc##L160">https://github.com/openscad/openscad/blob/master/src/polyset.cc##L160
shows that the determinant is used to check inside-outs as proposed by
Ronaldo. 

Everybody seems to agree that negative scales are OK, so I removed that note from the manual.


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