BRepTools::Triangulation() has been extended with a new parameter for checking Poly_Polygon3D presense within free Edges.
StdPrs_WFShape::Add() now performs auto-triangulation in the same way as StdPrs_ShadedShape::Add().
StdSelect_BRepSelectionTool::GetEdgeSensitive() now creates Select3D_SensitiveSegment instead of Select3D_SensitiveCurve for tessellated segment.
Select3D_SensitiveSegment default sensitivity factor has been changed to 3 pixels to match Select3D_SensitiveCurve.
Test case bug23625_1, added workaround for out-of-range crash in HLRBRep_PolyAlgo on re-triangulated shape.
compound sample occ name material sheets scale mass text
compound snowflake lines text drawing
+bounding snowflake -save x1 y1 z1 x2 y2 z2
# display in 3d view
vinit Driver1/Viewer1/View1 w=1024 h=768
vdisplay snowflake lines text
vrenderparams -msaa 8
-vsetcolor snowflake 0 0 0
-vsetcolor lines 0 0 0
-vsetcolor text 0 0 0
+vsetcolor snowflake BLACK
+vsetcolor lines BLACK
+vsetcolor text BLACK
vbackground -color WHITE
vtop
vfit
# add dimension:
# detect vertices extremal in X direction
-bounding snowflake -save x1 y1 z1 x2 y2 z2
plane f1 x1 0 0 1 0 0
plane f2 x2 0 0 1 0 0
mkface f1 f1
}
}
vdimension length -length -shapes $v1 $v2 -plane xoy -value 0.001 -dispunits mm -showunits -flyout 70 -label above -color black -text 5 3d sh
-
-if { [regexp HAVE_GL2PS [dversion]] } {
- puts "You can use command vexport to generate PDF: vexport your_file_path.pdf"
-}
//purpose :
//=======================================================================
-Standard_Boolean BRepTools::Triangulation(const TopoDS_Shape& S,
- const Standard_Real deflec)
+Standard_Boolean BRepTools::Triangulation(const TopoDS_Shape& theShape,
+ const Standard_Real theLinDefl,
+ const Standard_Boolean theToCheckFreeEdges)
{
- TopExp_Explorer exf, exe;
- TopLoc_Location l;
- Handle(Poly_Triangulation) T;
- Handle(Poly_PolygonOnTriangulation) Poly;
-
- for (exf.Init(S, TopAbs_FACE); exf.More(); exf.Next()) {
- const TopoDS_Face& F = TopoDS::Face(exf.Current());
- T = BRep_Tool::Triangulation(F, l);
- if (T.IsNull() || (T->Deflection() > deflec))
+ TopExp_Explorer anEdgeIter;
+ TopLoc_Location aDummyLoc;
+ for (TopExp_Explorer aFaceIter (theShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
+ {
+ const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Current());
+ const Handle(Poly_Triangulation)& aTri = BRep_Tool::Triangulation (aFace, aDummyLoc);
+ if (aTri.IsNull()
+ || aTri->Deflection() > theLinDefl)
+ {
return Standard_False;
- for (exe.Init(F, TopAbs_EDGE); exe.More(); exe.Next()) {
- const TopoDS_Edge& E = TopoDS::Edge(exe.Current());
- Poly = BRep_Tool::PolygonOnTriangulation(E, T, l);
- if (Poly.IsNull()) return Standard_False;
}
+
+ for (anEdgeIter.Init (aFace, TopAbs_EDGE); anEdgeIter.More(); anEdgeIter.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Current());
+ const Handle(Poly_PolygonOnTriangulation)& aPoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTri, aDummyLoc);
+ if (aPoly.IsNull())
+ {
+ return Standard_False;
+ }
+ }
+ }
+ if (!theToCheckFreeEdges)
+ {
+ return Standard_True;
}
+
+ Handle(Poly_Triangulation) anEdgeTri;
+ for (anEdgeIter.Init (theShape, TopAbs_EDGE, TopAbs_FACE); anEdgeIter.More(); anEdgeIter.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Current());
+ const Handle(Poly_Polygon3D)& aPolygon = BRep_Tool::Polygon3D (anEdge, aDummyLoc);
+ if (!aPolygon.IsNull())
+ {
+ if (aPolygon->Deflection() > theLinDefl)
+ {
+ return Standard_False;
+ }
+ }
+ else
+ {
+ const Handle(Poly_PolygonOnTriangulation)& aPoly = BRep_Tool::PolygonOnTriangulation (anEdge, anEdgeTri, aDummyLoc);
+ if (aPoly.IsNull()
+ || anEdgeTri.IsNull()
+ || anEdgeTri->Deflection() > theLinDefl)
+ {
+ return Standard_False;
+ }
+ }
+ }
+
return Standard_True;
}
//! refer to surfaces not belonging to any face of <S>
Standard_EXPORT static void RemoveUnusedPCurves (const TopoDS_Shape& S);
- //! verifies that each face from the shape <S> has got
- //! a triangulation with a deflection <= deflec and
- //! the edges a discretisation on this triangulation.
- Standard_EXPORT static Standard_Boolean Triangulation (const TopoDS_Shape& S, const Standard_Real deflec);
+ //! Verifies that each Face from the shape has got a triangulation with a deflection smaller or equal to specified one
+ //! and the Edges a discretization on this triangulation.
+ //! @param theShape [in] shape to verify
+ //! @param theLinDefl [in] maximum allowed linear deflection
+ //! @param theToCheckFreeEdges [in] if TRUE, then free Edges are required to have 3D polygon
+ //! @return FALSE if input Shape contains Faces without triangulation,
+ //! or that triangulation has worse (greater) deflection than specified one,
+ //! or Edges in Shape lack polygons on triangulation
+ //! or free Edges in Shape lack 3D polygons
+ Standard_EXPORT static Standard_Boolean Triangulation (const TopoDS_Shape& theShape,
+ const Standard_Real theLinDefl,
+ const Standard_Boolean theToCheckFreeEdges = Standard_False);
//! Returns True if the distance between the two
//! vertices is lower than their tolerance.
const gp_Pnt& theLastPnt)
: Select3D_SensitiveEntity (theOwnerId)
{
+ mySFactor = 3;
myStart = theFirstPnt;
myEnd = theLastPnt;
}
return;
}
- // add wireframe presentation for isolated edges and vertices
- wireframeFromShape (thePrs, theShape, theDrawer);
-
// Use automatic re-triangulation with deflection-check logic only if this feature is enable
if (theDrawer->IsAutoTriangulation())
{
StdPrs_ToolTriangulatedShape::Tessellate (theShape, theDrawer);
}
+ // add wireframe presentation for isolated edges and vertices
+ wireframeFromShape (thePrs, theShape, theDrawer);
+
// add special wireframe presentation for faces without triangulation
wireframeNoTriangFacesFromShape (thePrs, theShape, theDrawer);
Standard_Boolean StdPrs_ToolTriangulatedShape::IsTessellated (const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer)
{
- return BRepTools::Triangulation (theShape, Prs3d::GetDeflection (theShape, theDrawer));
+ return BRepTools::Triangulation (theShape, Prs3d::GetDeflection (theShape, theDrawer), true);
}
// =======================================================================
return;
}
+ if (theDrawer->IsAutoTriangulation())
+ {
+ StdPrs_ToolTriangulatedShape::Tessellate (theShape, theDrawer);
+ }
+
// draw triangulation-only edges
if (Handle(Graphic3d_ArrayOfPrimitives) aTriFreeEdges = AddEdgesOnTriangulation (theShape, Standard_True))
{
const Standard_Real theMaxParam)
{
Standard_Integer aPriority = (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority;
-
- if( isAutoTriangulation && !BRepTools::Triangulation (theShape, Precision::Infinite()) )
+ if (isAutoTriangulation
+ && !BRepTools::Triangulation (theShape, Precision::Infinite(), true))
{
BRepMesh_IncrementalMesh aMesher(theShape, theDeflection, Standard_False, theDeviationAngle);
}
if (!aPoints.IsNull()
&& !aPoints->IsEmpty())
{
- theSensitive = new Select3D_SensitiveCurve (theOwner, aPoints);
+ if (aPoints->Length() == 2)
+ {
+ // don't waste memory, create a segment
+ theSensitive = new Select3D_SensitiveSegment (theOwner, aPoints->First(), aPoints->Last());
+ }
+ else
+ {
+ theSensitive = new Select3D_SensitiveCurve (theOwner, aPoints);
+ }
return;
}
puts "============"
-puts "OCC25098"
+puts "0025098: Visualization - Calculation of depth on selection of a wire is not accurate"
puts "============"
puts ""
-####################################################################################
-# Visualization - Calculation of depth on selection of a wire is not accurate
-####################################################################################
proc ParseEntityInfo {theInfoString} {
set aStringArr [split $theInfoString " "]
}
pload VISUALIZATION MODELING
-vinit
+vinit View1
box b 10 10 10
vdisplay b
}
set aWireChildSensitiveType [string trim [lindex $aOut [expr $aWireTypeStringNb + 1]]]
-if {[string equal $aWireChildSensitiveType "Detected Child: Select3D_SensitiveCurve"] == 0} {
+if {[string equal $aWireChildSensitiveType "Detected Child: Select3D_SensitiveSegment"] == 0} {
puts "Wrong type of wire's inner sensitive! Value is: "
puts $aWireChildSensitiveType
- puts "Must be: Detected Child: Select3D_SensitiveCurve"
+ puts "Must be: Detected Child: Select3D_SensitiveSegment"
puts "ERROR"
}
--- /dev/null
+puts "============="
+puts "0031425: Visualization - free Edge has selection sensitivity inconsistent to presentation"
+puts "============="
+
+pload MODELING VISUALIZATION
+circle circ 150 0 200 1 0 0 100
+mkedge e circ
+wire w e
+vclear
+vinit View1
+vdisplay e
+vaspects e -setLineWidth 2
+vfit
+vviewparams -scale 25.38 -proj 0.5 -0.5 0.5 -up -0.4 0.4 0.8 -at 125.128 46.4744 271.346
+checkpoint pick [vmoveto 275 175] {150 31 294} 1.0
+
+vdump $::imagedir/${::casename}.png
proc COMPUTE_HLR {viewname algotype} {
uplevel #0 top
uplevel #0 clear
- uplevel #0 vinit
+ uplevel #0 vinit View1
uplevel #0 vdisplay a
uplevel #0 $viewname
uplevel #0 vcomputehlr a result -algoType $algotype
puts "============"
puts ""
+puts "REQUIRED All: Meshing statuses: SelfIntersectingWire Failure"
+
set viewname "vfront"
-set length 28096.2
+set length 28388
restore [locate_data_file bug23625_a1.brep] a
+
+# workaround bug 0031426 until fix
+vinit View1
+vdefaults -autoTriang 0
+incmesh a 7.6 12
+
COMPUTE_HLR $viewname $algotype
puts ""
set viewname "vfront"
-set length 28990.3
+set length 28991.6
restore [locate_data_file bug23625_a2.brep] a
COMPUTE_HLR $viewname $algotype
-puts "TODO OCC30286 Linux: Error : The length of result shape is 302.441, expected 301.998"
+puts "TODO OCC30286 Linux: Error : The length of result shape is 302.443, expected 301.999"
puts "==========================================="
puts "OCC25813: regression in Hidden Line Removal"
puts ""
set viewname ""
-set length 301.998
+set length 301.999
ptorus a 30 10