How to remove degenerated edge(s) from face manually

Hi All,

"Manually" means we don't use API ShapeFix_Wire, but use the method listed as follows:

1. Using ShapeExtend_WireData & BRep_Tool::Degenerated to find and remove degenerated edges from the raw wire, and get a new wire.
2. Using BRepTools_ReShape to replace the raw wire with the new wire. Call "Apply(rawFace)" to get the new face.

In fact, we catch none exceptions during last two procedures, I think it means the oprations are successful. But when we try to render the new face, the triangulation is always failed.

Any suggestion is welcome. Thanks in advanced.

-Cauchy Ding

Evgeny Lodyzhehsky's picture

Dear Cauchy Ding.

It is possible to remove everything you want but prior to let me get to know:
-Why did you decided to remove degenerated edges from a face?
-Did you check the face with checkshape /BRepCheck_Analyzer/?

Thanks in advance.

Cauchy Ding's picture

Dear Lodyzhensky Evgeny Nicolaich,

Thank you for your prompt reply.
After calling BRepCheck_Analyzer, I find the new face is unorientable ( IsUnorientable() return true), but the sub shapes such as wires, edges , vertex are valid. Using ShapeFix_Face to fix the orientable property but failed.
In fact, the new wire and raw wire are both orientable FORWARD.

I want to remove degenerated edges, because I think those degenerated edges are of Small Edges, and in my opinion(maybe wrong :)) they are defects of the shape.
BTW: In OCC, the easiest way to create a face which contains a degenerated edge is to use the loft surface (BRepOffsetAPI_ThruSections). The surface is constructed by one wire and one vertex.

Evgeny Lodyzhehsky's picture

Dear Cauchy Ding.

1. The case when IsUnorientable() returns true, mean that there are problems with orientation of some Wire on the Face.
- Please check whether the orientations of each Edge from the Wire is correct.
The Edges of the Wire taking into account their orientations must make up closed contur, all vertices are shared between neighboured edges.
- Please check whether the orientation of the Wire is correct.

2. Degenereated edges have no 3D-curve, so they have zero length.Degenereated edges have 2D-curve. The parametric range of the curve depends on surface to which degenerated edge belongs to.
In order to display a Face in shading mode you triangulate the shape using some algo. This algo uses 2D representation of the Face (and thus degenereated edges too). To check the fact above, try to have a look on a spherical face in shading mode. (The spherical face has two degenerated edges on its poles).
Generaly the existence or absence of degenerated edges depends on type of parametric representation of a surface and nothing more. For e.g degenerated edges are nonsense for planes and degenerated edges must be definetely removed from planes. On the other hand degenerated edges are important for cones, spheres, revolutions, ... - suraces (judge by their representations in Open CASCADE).

Cauchy Ding's picture

Dear Lodyzhensky Evgeny Nicolaich,

I am really appreciated for your kind and patience. Thank you very much. Your detailed explanation gives me clear description of degenerated edge. Thank you.

-Cauchy Ding