Reversed faces

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

Reversed faces

nophead
Since the problem of reversed polyhedron faces comes up about once a week I was wondering why OpenScad doesn't detect them by default. Isn't it just a matter of checking all the edges of a polyhedron are a pair of opposite direction half edges, or is it more complicated than that?

I suppose if all the faces where reversed it would need some extra test to detect it was completely inside out. Perhaps check all the inward face normals intersect with at least one other face? Again it doesn't seem particularly expensive if done once on construction and cached.

It would be nice if it reported reversed faces and always highlighted them, not just in thrown together mode. If it is simply a matter of checking half edges it could be done for every polyhedron construction and stored in a valid flag. That could issue a warning on every F5 or F6 and also flag that the inside of the polygon should be drawn purple when it is rendered. It would also detect holes and T junctions.

The current situation is doubly confusing because the CGAL exception is only printed once and it can take a cache flush to get the polygon to display after fixing it.

Now that flush clears the font cache and it takes a while to rebuild having to flush the cache is a pain.

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

Re: Reversed faces

MichaelAtOz
Administrator
I seem to recall this was discussed before.
Apart from the purple faces, I never understood what thrown together was for, it just seemed to put noise in the way of finding that issue.

A warning to the console would seem to be called for.

Also the caching causing lack of repeated console messages is problematic, perhaps the cached nodes could carry the error/warning, so it can be repeated to the console. ?

(on rereading nophead's post, I think the above was just +1)

Separate naive question: "suppose if all the faces where reversed", is there ever any valid reason for that?
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

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
|

Re: Reversed faces

nophead
>Separate naive question: "suppose if all the faces where reversed", is there ever any valid reason for that?

Logically it would make a negative volume that isn't a valid object in OpenScad and I think all subsequent CGAL operations fail.

On 11 January 2016 at 11:54, MichaelAtOz <[hidden email]> wrote:
I seem to recall this was discussed before.
Apart from the purple faces, I never understood what thrown together was
for, it just seemed to put noise in the way of finding that issue.

A warning to the console would seem to be called for.

Also the caching causing lack of repeated console messages is problematic,
perhaps the cached nodes could carry the error/warning, so it can be
repeated to the console. ?

(on rereading nophead's post, I think the above was just +1)

Separate naive question: "suppose if all the faces where reversed", is there
ever any valid reason for that?



-----
Newly minted 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!
--
View this message in context: http://forum.openscad.org/Reversed-faces-tp15649p15650.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
Reply | Threaded
Open this post in threaded view
|

Re: Reversed faces

doug.moen
"suppose all the faces were reversed"

In solid modelling systems based on functional representation, such as ImplicitCAD and Antimony, there is a complement operator. For example, complement(cube) is an infinite solid that fills all of space, except for a cube shaped hole. (This is different from a negative object.) In an F-Rep system, difference(a,b) is defined as intersection(a, complement(b)). (By contrast, a negative object cuts a hole in a solid when it is unioned with that solid, by my definition.)

I don't know CGAL very well, but I notice that there is a complement operator. It makes sense to me that complement is implemented by reversing all of the faces in a mesh, and it looks like the code is doing that, but I can't be sure. I'm guessing that a face-reversed solid is a legal CGAL object, an infinite object, different from a negative object.

In F-Rep solid modeling systems, infinite solids and the complement operator are very useful, due to the increased expressive power of F-Rep. You can't export an infinite solid to an STL file, but they are useful for building other objects.

In OpenSCAD, due to the limitations of what you can represent with a mesh, I think this would be a lot less useful, so I am not advocating that we extend OpenSCAD with a complement operation. I'm just providing background information.

On 11 January 2016 at 07:01, nop head <[hidden email]> wrote:
>Separate naive question: "suppose if all the faces where reversed", is there ever any valid reason for that?

Logically it would make a negative volume that isn't a valid object in OpenScad and I think all subsequent CGAL operations fail.

On 11 January 2016 at 11:54, MichaelAtOz <[hidden email]> wrote:
I seem to recall this was discussed before.
Apart from the purple faces, I never understood what thrown together was
for, it just seemed to put noise in the way of finding that issue.

A warning to the console would seem to be called for.

Also the caching causing lack of repeated console messages is problematic,
perhaps the cached nodes could carry the error/warning, so it can be
repeated to the console. ?

(on rereading nophead's post, I think the above was just +1)

Separate naive question: "suppose if all the faces where reversed", is there
ever any valid reason for that?



-----
Newly minted 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!
--
View this message in context: http://forum.openscad.org/Reversed-faces-tp15649p15650.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



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

Re: Reversed faces

kintel
Administrator
In reply to this post by nophead
> On Jan 11, 2016, at 07:01 AM, nop head <[hidden email]> wrote:
>
> >Separate naive question: "suppose if all the faces where reversed", is there ever any valid reason for that?
>
> Logically it would make a negative volume that isn't a valid object in OpenScad and I think all subsequent CGAL operations fail.
>
Also, if you want to build e.g. a hollow cube, you’d build a mesh consisting of two separate volumes: The outer cube and the inner cube, That inner cube will have all its faces reversed.

 -Marius


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

Re: Reversed faces

kintel
Administrator
In reply to this post by nophead
Some related issues:

https://github.com/openscad/openscad/issues/348
https://github.com/openscad/openscad/issues/1042
https://github.com/openscad/openscad/issues/590

Two things:
o We should rewrite our mesh class to support tests and operators like this. This would also be a good step towards repairing imported STLs which CGAL struggles with. We could also look at external libraries with good mesh classes.
o Highlights of reversed faces in preview mode: It should be possible to simply turn this on.

 -Marius


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

Re: Reversed faces

nophead
> o Highlights of reversed faces in preview mode: It should be possible to simply turn this on.
That would stop a lot of questions I think.

On 11 January 2016 at 13:59, Marius Kintel <[hidden email]> wrote:
Some related issues:

https://github.com/openscad/openscad/issues/348
https://github.com/openscad/openscad/issues/1042
https://github.com/openscad/openscad/issues/590

Two things:
o We should rewrite our mesh class to support tests and operators like this. This would also be a good step towards repairing imported STLs which CGAL struggles with. We could also look at external libraries with good mesh classes.
o Highlights of reversed faces in preview mode: It should be possible to simply turn this on.

 -Marius


_______________________________________________
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: Reversed faces

cacb
In reply to this post by kintel
On 2016-01-11 14:53, Marius Kintel wrote:
> Also, if you want to build e.g. a hollow cube, you’d build a mesh
> consisting of two separate volumes: The outer cube and the inner cube,
> That inner cube will have all its faces reversed.

"Reversed faces" is a relative term and therefore somewhat confusing (to
me, anyway). Isn't the absolute and general rule simply that any face
normal should always point away from the material? This definition
should work for any number of internal voids and also the external
surface.

The face normal for a triangle with vertices v[0], v[1] and v[2] could
be defined as the cross product between 2 vectors

vec0, from v[0] to v[1]
vec1, from v[0] to v[2]

face_normal = vec0 x vec1

(quite possibly the other way around....).

Carsten Arnholm





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

Re: Reversed faces

kintel
Administrator
> On Jan 11, 2016, at 10:40 AM, [hidden email] wrote:
> Isn't the absolute and general rule simply that any face normal should always point away from the material? This definition should work for any number of internal voids and also the external surface.
>
“reversed faces” is just used to follow the original topic. In this context it means that the vertex order of the faces is reversed.

 -Marius


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

Re: Reversed faces

nophead
Pointing away from the material is a bit ambiguous for concave polyhedra as a normal pointing outwards could hit another part of the object.

On 11 January 2016 at 15:51, Marius Kintel <[hidden email]> wrote:
> On Jan 11, 2016, at 10:40 AM, [hidden email] wrote:
> Isn't the absolute and general rule simply that any face normal should always point away from the material? This definition should work for any number of internal voids and also the external surface.
>
“reversed faces” is just used to follow the original topic. In this context it means that the vertex order of the faces is reversed.

 -Marius


_______________________________________________
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: Reversed faces

doug.moen
In reply to this post by kintel
From the Admesh library, referenced by https://github.com/openscad/openscad/issues/1042:

A common problem with STL files is that some or all of facets are oriented backwards; i.e. the vertices are listed in a clockwise direction when viewed from outside the part.  Admesh repairs the orientation of facets according to the following algorithm:
1. Generate the neighbors list for all facets.
2. Inspect the first neighbor of the first facet to determine the orientation of its vertices.
3. If the neighboring facet is oriented in the same direction as the first facet, mark the neighbor as checked.  If the neighboring facet is oriented opposite to the first facet, reverse the neighbor, and mark it as checked.
4. Repeat steps 2 and 3 until all facets have been checked.
The above algorithm ensures that all connected facets are oriented in the same direction.  However, if the first facet is backwards, then all facets will be backwards.  The correct orientation for the entire part is determined after the volume has been calculated.  If the volume is negative, then all of the facets must be backwards.  Admesh then reverses all facets to set the correct orientation.

Nop Head's original suggestion is to report if two neighbouring facets have opposite orientations, which matches what Admesh does. And that probably takes care of the most common case where people screw up the arguments to polyhedron and ask for help on the forum. It wouldn't be perfect, but it would be progress.

Detecting whether all faces are backwards looks more complicated and expensive. There's no "local" property you can test, as in the neighbouring facet test. It's a global property of the entire shape.
  • Admesh does this by computing the volume, and testing if it is negative. Computing the volume might be expensive? There's another thread, a pull request for a "probe" function, which adds the ability to compute the volume of a shape, but this computation is said to be very expensive. It requires a convex decomposition, which in itself is expensive.
  • I'm not sure how Admesh deals with a complex object containing an interior void. Then you have an interior mesh, and an exterior mesh, which aren't connected. The interior mesh is expected to have a negative volume, while the exterior mesh is expected to have a positive volume.


On 11 January 2016 at 08:59, Marius Kintel <[hidden email]> wrote:
Some related issues:

https://github.com/openscad/openscad/issues/348
https://github.com/openscad/openscad/issues/1042
https://github.com/openscad/openscad/issues/590

Two things:
o We should rewrite our mesh class to support tests and operators like this. This would also be a good step towards repairing imported STLs which CGAL struggles with. We could also look at external libraries with good mesh classes.
o Highlights of reversed faces in preview mode: It should be possible to simply turn this on.

 -Marius


_______________________________________________
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: Reversed faces

nophead
Does polyhedron currently work if you have an interior hole with a negative volume?

On 11 January 2016 at 16:42, doug moen <[hidden email]> wrote:
From the Admesh library, referenced by https://github.com/openscad/openscad/issues/1042:

A common problem with STL files is that some or all of facets are oriented backwards; i.e. the vertices are listed in a clockwise direction when viewed from outside the part.  Admesh repairs the orientation of facets according to the following algorithm:
1. Generate the neighbors list for all facets.
2. Inspect the first neighbor of the first facet to determine the orientation of its vertices.
3. If the neighboring facet is oriented in the same direction as the first facet, mark the neighbor as checked.  If the neighboring facet is oriented opposite to the first facet, reverse the neighbor, and mark it as checked.
4. Repeat steps 2 and 3 until all facets have been checked.
The above algorithm ensures that all connected facets are oriented in the same direction.  However, if the first facet is backwards, then all facets will be backwards.  The correct orientation for the entire part is determined after the volume has been calculated.  If the volume is negative, then all of the facets must be backwards.  Admesh then reverses all facets to set the correct orientation.

Nop Head's original suggestion is to report if two neighbouring facets have opposite orientations, which matches what Admesh does. And that probably takes care of the most common case where people screw up the arguments to polyhedron and ask for help on the forum. It wouldn't be perfect, but it would be progress.

Detecting whether all faces are backwards looks more complicated and expensive. There's no "local" property you can test, as in the neighbouring facet test. It's a global property of the entire shape.
  • Admesh does this by computing the volume, and testing if it is negative. Computing the volume might be expensive? There's another thread, a pull request for a "probe" function, which adds the ability to compute the volume of a shape, but this computation is said to be very expensive. It requires a convex decomposition, which in itself is expensive.
  • I'm not sure how Admesh deals with a complex object containing an interior void. Then you have an interior mesh, and an exterior mesh, which aren't connected. The interior mesh is expected to have a negative volume, while the exterior mesh is expected to have a positive volume.


On 11 January 2016 at 08:59, Marius Kintel <[hidden email]> wrote:
Some related issues:

https://github.com/openscad/openscad/issues/348
https://github.com/openscad/openscad/issues/1042
https://github.com/openscad/openscad/issues/590

Two things:
o We should rewrite our mesh class to support tests and operators like this. This would also be a good step towards repairing imported STLs which CGAL struggles with. We could also look at external libraries with good mesh classes.
o Highlights of reversed faces in preview mode: It should be possible to simply turn this on.

 -Marius


_______________________________________________
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: Reversed faces

Ronaldo
This post has NOT been accepted by the mailing list yet.

Yes!

intersection(){
  polyhedron(
    points = [ [0,0,0], [0,100,0], [100,0,0], [0,0,100],
               [10,10,10], [10,70,0], [70,10,10], [10,10,70] ],
    faces  = [ [0,2,1], [0,1,3], [1,2,3], [2,0,3],
               [4,6,5], [4,5,7], [5,6,7], [6,4,7] ],
    convexity = 4);

  cube(50);
}

Ronaldo

 

 

 

Em 11/01/2016 14:56, nophead [via OpenSCAD] escreveu:

Does polyhedron currently work if you have an interior hole with a negative volume?

On 11 January 2016 at 16:42, doug moen <[hidden email]> wrote:
From the Admesh library, referenced by https://github.com/openscad/openscad/issues/1042:

A common problem with STL files is that some or all of facets are oriented backwards; i.e. the vertices are listed in a clockwise direction when viewed from outside the part.  Admesh repairs the orientation of facets according to the following algorithm:
1. Generate the neighbors list for all facets.
2. Inspect the first neighbor of the first facet to determine the orientation of its vertices.
3. If the neighboring facet is oriented in the same direction as the first facet, mark the neighbor as checked.  If the neighboring facet is oriented opposite to the first facet, reverse the neighbor, and mark it as checked.
4. Repeat steps 2 and 3 until all facets have been checked.
The above algorithm ensures that all connected facets are oriented in the same direction.  However, if the first facet is backwards, then all facets will be backwards.  The correct orientation for the entire part is determined after the volume has been calculated.  If the volume is negative, then all of the facets must be backwards.  Admesh then reverses all facets to set the correct orientation.

Nop Head's original suggestion is to report if two neighbouring facets have opposite orientations, which matches what Admesh does. And that probably takes care of the most common case where people screw up the arguments to polyhedron and ask for help on the forum. It wouldn't be perfect, but it would be progress.

Detecting whether all faces are backwards looks more complicated and expensive. There's no "local" property you can test, as in the neighbouring facet test. It's a global property of the entire shape.
  • Admesh does this by computing the volume, and testing if it is negative. Computing the volume might be expensive? There's another thread, a pull request for a "probe" function, which adds the ability to compute the volume of a shape, but this computation is said to be very expensive. It requires a convex decomposition, which in itself is expensive.
  • I'm not sure how Admesh deals with a complex object containing an interior void. Then you have an interior mesh, and an exterior mesh, which aren't connected. The interior mesh is expected to have a negative volume, while the exterior mesh is expected to have a positive volume.

On 11 January 2016 at 08:59, Marius Kintel <[hidden email]> wrote:
Some related issues:

https://github.com/openscad/openscad/issues/348
https://github.com/openscad/openscad/issues/1042
https://github.com/openscad/openscad/issues/590

Two things:
o We should rewrite our mesh class to support tests and operators like this. This would also be a good step towards repairing imported STLs which CGAL struggles with. We could also look at external libraries with good mesh classes.
o Highlights of reversed faces in preview mode: It should be possible to simply turn this on.

 -Marius


_______________________________________________
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



If you reply to this email, your message will be added to the discussion below:
http://forum.openscad.org/Reversed-faces-tp15649p15660.html
To start a new topic under OpenSCAD, email [hidden email]
To unsubscribe from OpenSCAD, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Reversed faces

doug.moen
In reply to this post by nophead
I tried and got a CGAL error.

If it doesn't work, then that may be bad news for users of STL -> SCAD file converters. This trick is used for posting OpenSCAD files to Thingiverse, since the thingiverse customizer won't work if your scad file imports an STL file: the imported polyhedron must instead be written as inline code. I haven't used one of these converters: you could write one smart enough to detect interior voids and generate difference() statements.

On 11 January 2016 at 11:55, nop head <[hidden email]> wrote:
Does polyhedron currently work if you have an interior hole with a negative volume?

On 11 January 2016 at 16:42, doug moen <[hidden email]> wrote:
From the Admesh library, referenced by https://github.com/openscad/openscad/issues/1042:

A common problem with STL files is that some or all of facets are oriented backwards; i.e. the vertices are listed in a clockwise direction when viewed from outside the part.  Admesh repairs the orientation of facets according to the following algorithm:
1. Generate the neighbors list for all facets.
2. Inspect the first neighbor of the first facet to determine the orientation of its vertices.
3. If the neighboring facet is oriented in the same direction as the first facet, mark the neighbor as checked.  If the neighboring facet is oriented opposite to the first facet, reverse the neighbor, and mark it as checked.
4. Repeat steps 2 and 3 until all facets have been checked.
The above algorithm ensures that all connected facets are oriented in the same direction.  However, if the first facet is backwards, then all facets will be backwards.  The correct orientation for the entire part is determined after the volume has been calculated.  If the volume is negative, then all of the facets must be backwards.  Admesh then reverses all facets to set the correct orientation.

Nop Head's original suggestion is to report if two neighbouring facets have opposite orientations, which matches what Admesh does. And that probably takes care of the most common case where people screw up the arguments to polyhedron and ask for help on the forum. It wouldn't be perfect, but it would be progress.

Detecting whether all faces are backwards looks more complicated and expensive. There's no "local" property you can test, as in the neighbouring facet test. It's a global property of the entire shape.
  • Admesh does this by computing the volume, and testing if it is negative. Computing the volume might be expensive? There's another thread, a pull request for a "probe" function, which adds the ability to compute the volume of a shape, but this computation is said to be very expensive. It requires a convex decomposition, which in itself is expensive.
  • I'm not sure how Admesh deals with a complex object containing an interior void. Then you have an interior mesh, and an exterior mesh, which aren't connected. The interior mesh is expected to have a negative volume, while the exterior mesh is expected to have a positive volume.


On 11 January 2016 at 08:59, Marius Kintel <[hidden email]> wrote:
Some related issues:

https://github.com/openscad/openscad/issues/348
https://github.com/openscad/openscad/issues/1042
https://github.com/openscad/openscad/issues/590

Two things:
o We should rewrite our mesh class to support tests and operators like this. This would also be a good step towards repairing imported STLs which CGAL struggles with. We could also look at external libraries with good mesh classes.
o Highlights of reversed faces in preview mode: It should be possible to simply turn this on.

 -Marius


_______________________________________________
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



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

Re: Reversed faces

kintel
Administrator
Hm, that should work - we fixed some bugs related to that a while ago.
I’ll give it a spin..

 -Marius

> On Jan 11, 2016, at 12:21 PM, doug moen <[hidden email]> wrote:
>
> I tried and got a CGAL error.
>
> If it doesn't work, then that may be bad news for users of STL -> SCAD file converters. This trick is used for posting OpenSCAD files to Thingiverse, since the thingiverse customizer won't work if your scad file imports an STL file: the imported polyhedron must instead be written as inline code. I haven't used one of these converters: you could write one smart enough to detect interior voids and generate difference() statements.
>
> On 11 January 2016 at 11:55, nop head <[hidden email]> wrote:
> Does polyhedron currently work if you have an interior hole with a negative volume?


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

Re: Reversed faces

cacb
In reply to this post by nophead
On 11. jan. 2016 17:05, nop head wrote:
> Pointing away from the material is a bit ambiguous for concave polyhedra
> as a normal pointing outwards could hit another part of the object.

No it isn't ambiguous. It refers only to the immediate direction of the
non-material wrt. the face as compared to the immediate direction of the
solid material wrt. the same face.

Carsten Arnholm




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

Re: Reversed faces

Neon22
In reply to this post by doug.moen
You can determine the correct orientation at the outset by randomly
sampling faces until you find one whose normal does not collide with any
other faces on the object. I.e. if there is a face whose normal, when
raycast, does not hit any other faces, then that face has the correct
orientation.
In practise sampling some % of faces in the object looking for a single
fail to set the orientation.
Then start the growing/winding procedure with that face.



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

Re: Reversed faces

nophead
>No it isn't ambiguous. It refers only to the immediate direction of the non-material wrt. the face as compared to the immediate direction of the solid material wrt. the same face.

Not ambiguous as a definition but in practice there is no solid material, just faces representing its boundary. So as the previous post says you need to see if the normal intersects another face. I.e. you need to find an outwards normal that doesn't intersect. One that does intersect is ambiguous on a concave object.

On 11 January 2016 at 21:47, Mark Schafer <[hidden email]> wrote:
You can determine the correct orientation at the outset by randomly sampling faces until you find one whose normal does not collide with any other faces on the object. I.e. if there is a face whose normal, when raycast, does not hit any other faces, then that face has the correct orientation.
In practise sampling some % of faces in the object looking for a single fail to set the orientation.
Then start the growing/winding procedure with that face.




_______________________________________________
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: Reversed faces

Greg Frost


On 12 Jan 2016, at 8:49 am, nop head <[hidden email]> wrote:

>No it isn't ambiguous. It refers only to the immediate direction of the non-material wrt. the face as compared to the immediate direction of the solid material wrt. the same face.

Not ambiguous as a definition but in practice there is no solid material, just faces representing its boundary. So as the previous post says you need to see if the normal intersects another face. I.e. you need to find an outwards normal that doesn't intersect. One that does intersect is ambiguous on a concave object.

On 11 January 2016 at 21:47, Mark Schafer <[hidden email]> wrote:
You can determine the correct orientation at the outset by randomly sampling faces until you find one whose normal does not collide with any other faces on the object. I.e. if there is a face whose normal, when raycast, does not hit any other faces, then that face has the correct orientation.
In practise sampling some % of faces in the object looking for a single fail to set the orientation.
Then start the growing/winding procedure with that face

If it intersects an even number of times, you started on the outside. If it intersects an odd number, you are on the inside.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Reversed faces

nophead
Yes if you are careful about intersecting another face at an edge or a vertex or along its plane.

On 12 January 2016 at 09:44, Greg Frost <[hidden email]> wrote:


On 12 Jan 2016, at 8:49 am, nop head <[hidden email]> wrote:

>No it isn't ambiguous. It refers only to the immediate direction of the non-material wrt. the face as compared to the immediate direction of the solid material wrt. the same face.

Not ambiguous as a definition but in practice there is no solid material, just faces representing its boundary. So as the previous post says you need to see if the normal intersects another face. I.e. you need to find an outwards normal that doesn't intersect. One that does intersect is ambiguous on a concave object.

On 11 January 2016 at 21:47, Mark Schafer <[hidden email]> wrote:
You can determine the correct orientation at the outset by randomly sampling faces until you find one whose normal does not collide with any other faces on the object. I.e. if there is a face whose normal, when raycast, does not hit any other faces, then that face has the correct orientation.
In practise sampling some % of faces in the object looking for a single fail to set the orientation.
Then start the growing/winding procedure with that face

If it intersects an even number of times, you started on the outside. If it intersects an odd number, you are on the inside.

_______________________________________________
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
12