Wed, 09/25/2002 - 21:16
I want to mesh a brep object for rendering. I use BRepMesh::Mesh(Face,Deflection), and I get "T junction" ie a vertex is on another triangle's edge. Of course this leads in unnaceptable cracks in tesselation for a quality render.
Those bad junction arise only between different TopoDS_Faces : even if I use the same deflection for 2 faces, I don't have the same "tesselation level" (due to different curvatures of the TopoDS_Faces), hence a different number of vertices on the edge hence my bad junctions...
Anyone noticed this problem ? Is there an other (better) meshing algorithm ? is there a way to provide a deflection for edges' curvature of face instead of face's curvature ? Is there a workaround for this problem ?
Thanks in advance,
Eric
Wed, 09/25/2002 - 22:45
Hi Eric,
If you put your faces in a shell, you won't have this problem and everything will be nicely shaded. Of course, your face must be connectable in a shell.
Francois.
Wed, 09/25/2002 - 22:52
thanks, i'll try this...
Wed, 12/11/2002 - 14:29
Hi Francois,
Which tool should be used for creation of shell from faces?
Can you show code which demonstrates how is it possible to collect faces?
Thank you very much.
Wed, 12/11/2002 - 16:57
Hi Vasiliy,
I'm using BRepTools_Sewing, then I took the result and try to upgrade it using ShapeUpgrade_ShellSewing, then I took the result and try to fix problems using ShapeFix_Shape.
Good Luck,
Francois.
Wed, 12/11/2002 - 17:07
Use BRepOffsetAPI_Sewing (or directly BRepAlgo_Sewing) instead of BRepTools_Sewing.
Fri, 12/13/2002 - 16:08
I tried this:
reader.TransferRoot();
Standard_Integer num = reader.NbShapes(); // Number of shapes in scene
// For each shape
for (int i = 1; i <= num; i++)
{
// Get i-th shape
TopoDS_Shape shape = reader.Shape(i);
// Get all the faces of the shape and create sewed shape
BRepOffsetAPI_Sewing sewing(precision, FALSE);
// Create explorer to browse shape
TopExp_Explorer ex;
// For each face
for (ex.Init(shape, TopAbs_FACE); ex.More(); ex.Next())
{
sewing.Add(ex.Current());
}
sewing.Perform();
TopoDS_Shape new_shape = sewing.SewedShape();
BRepMesh::Mesh(new_shape, precision);
// For each face
for (ex.Init(new_shape, TopAbs_FACE); ex.More(); ex.Next())
{
// Get face
TopoDS_Face face = TopoDS::Face(ex.Current());
TopLoc_Location loc;
// Get triagulation of the face
Handle(Poly_Triangulation) facing = BRep_Tool::Triangulation(face, loc);
// Handlimg of triangulation
//
}
}
But it doesn't solve the problem: if precision is small, no changes in geometry. But if precision is large - shape is seriously damaged.
Maybe I used wrong approach for mesh creation?