mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0032833: Shape Healing - FixShape needs to be improved
First version
This commit is contained in:
@@ -425,6 +425,16 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
|
|||||||
const Standard_Boolean = Standard_True)
|
const Standard_Boolean = Standard_True)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
gp_Pnt aP;
|
||||||
|
gp_Vec aDU, aDV;
|
||||||
|
Standard_Real um = (thePnt.X() + thePntRef.X()) / 2.;
|
||||||
|
Standard_Real vm = (thePnt.Y() + thePntRef.Y()) / 2.;
|
||||||
|
aFaceSurface.D1(um, vm, aP, aDU, aDV);
|
||||||
|
Standard_Real aMDU = aDU.Magnitude();
|
||||||
|
Standard_Real aMDV = aDV.Magnitude();
|
||||||
|
if (aMDU > Precision::Confusion() && aMDV > Precision::Confusion())
|
||||||
|
return Standard_True; //we are not in singularity
|
||||||
|
|
||||||
Standard_Real dumax = 0.01 * (aFaceSurface.LastUParameter() - aFaceSurface.FirstUParameter());
|
Standard_Real dumax = 0.01 * (aFaceSurface.LastUParameter() - aFaceSurface.FirstUParameter());
|
||||||
Standard_Real dvmax = 0.01 * (aFaceSurface.LastVParameter() - aFaceSurface.FirstVParameter());
|
Standard_Real dvmax = 0.01 * (aFaceSurface.LastVParameter() - aFaceSurface.FirstVParameter());
|
||||||
Standard_Real dumin = Abs(thePnt.X() - thePntRef.X());
|
Standard_Real dumin = Abs(thePnt.X() - thePntRef.X());
|
||||||
@@ -453,17 +463,17 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
|
|||||||
#endif
|
#endif
|
||||||
dumax = aFaceSurface.UResolution(aTol3d);
|
dumax = aFaceSurface.UResolution(aTol3d);
|
||||||
dvmax = aFaceSurface.VResolution(aTol3d);
|
dvmax = aFaceSurface.VResolution(aTol3d);
|
||||||
gp_Pnt aP;
|
//gp_Pnt aP;
|
||||||
gp_Vec aDU, aDV;
|
//gp_Vec aDU, aDV;
|
||||||
Standard_Real um = (thePnt.X() + thePntRef.X()) / 2.;
|
//Standard_Real um = (thePnt.X() + thePntRef.X()) / 2.;
|
||||||
Standard_Real vm = (thePnt.Y() + thePntRef.Y()) / 2.;
|
//Standard_Real vm = (thePnt.Y() + thePntRef.Y()) / 2.;
|
||||||
aFaceSurface.D1(um, vm, aP, aDU, aDV);
|
//aFaceSurface.D1(um, vm, aP, aDU, aDV);
|
||||||
Standard_Real aMDU = aDU.Magnitude();
|
//Standard_Real aMDU = aDU.Magnitude();
|
||||||
if (aMDU > Precision::Confusion())
|
if (aMDU > Precision::Confusion())
|
||||||
{
|
{
|
||||||
dumax = Max((aTol3d / aMDU), dumax);
|
dumax = Max((aTol3d / aMDU), dumax);
|
||||||
}
|
}
|
||||||
Standard_Real aMDV = aDV.Magnitude();
|
//Standard_Real aMDV = aDV.Magnitude();
|
||||||
if (aMDV > Precision::Confusion())
|
if (aMDV > Precision::Confusion())
|
||||||
{
|
{
|
||||||
dvmax = Max((aTol3d / aMDV), dvmax);
|
dvmax = Max((aTol3d / aMDV), dvmax);
|
||||||
|
@@ -54,6 +54,29 @@ static Standard_Real GetNextParamOnPC(const Handle(Geom2d_Curve)& aPC,
|
|||||||
const Standard_Real& tolV,
|
const Standard_Real& tolV,
|
||||||
const Standard_Boolean& reverse);
|
const Standard_Boolean& reverse);
|
||||||
|
|
||||||
|
static Standard_Real LocalUresol (const TopoDS_Vertex& theVertex,
|
||||||
|
const TopoDS_Face& theFace,
|
||||||
|
const gp_Pnt2d& theP2d1,
|
||||||
|
const gp_Pnt2d& theP2d2)
|
||||||
|
{
|
||||||
|
Standard_Real aResol = -1;
|
||||||
|
|
||||||
|
BRepAdaptor_Surface aBAsurf (theFace, Standard_False);
|
||||||
|
if (aBAsurf.GetType() == GeomAbs_Sphere)
|
||||||
|
{
|
||||||
|
Standard_Real aRadius = aBAsurf.Sphere().Radius();
|
||||||
|
Standard_Real aVmid = (theP2d1.Y() + theP2d2.Y())/2.;
|
||||||
|
Standard_Real aLocalRad = aRadius * Cos(aVmid);
|
||||||
|
if (aLocalRad > Precision::Confusion())
|
||||||
|
{
|
||||||
|
Standard_Real aTolVertex = BRep_Tool::Tolerance (theVertex);
|
||||||
|
aResol = aTolVertex / aLocalRad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return aResol;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BRepTools_WireExplorer
|
//function : BRepTools_WireExplorer
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -602,7 +625,11 @@ void BRepTools_WireExplorer::Next()
|
|||||||
Standard_Real d = PRef.SquareDistance(aPEb);
|
Standard_Real d = PRef.SquareDistance(aPEb);
|
||||||
if( d <= Precision::PConfusion() )
|
if( d <= Precision::PConfusion() )
|
||||||
d = 0.;
|
d = 0.;
|
||||||
if( Abs(aPEb.X()-PRef.X()) < myTolU && Abs(aPEb.Y()-PRef.Y()) < myTolV )
|
//jgv
|
||||||
|
Standard_Real aLocalUresol = LocalUresol (myVertex, myFace, PRef, aPEb);
|
||||||
|
aLocalUresol = Max (aLocalUresol, myTolU);
|
||||||
|
/////
|
||||||
|
if( Abs(aPEb.X()-PRef.X()) < aLocalUresol && Abs(aPEb.Y()-PRef.Y()) < myTolV )
|
||||||
{
|
{
|
||||||
if( d <= dmin )
|
if( d <= dmin )
|
||||||
{
|
{
|
||||||
|
@@ -768,11 +768,15 @@ Standard_Boolean ShapeAnalysis_Wire::CheckSmall (const Standard_Integer num,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer num,
|
Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer num,
|
||||||
gp_Pnt2d& p2d1, gp_Pnt2d& p2d2)
|
gp_Pnt2d& p2d1, gp_Pnt2d& p2d2,
|
||||||
|
Standard_Real& theTolerance)
|
||||||
{
|
{
|
||||||
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);
|
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);
|
||||||
if ( ! IsReady() || NbEdges() < 1 ) return Standard_False;
|
if ( ! IsReady() || NbEdges() < 1 ) return Standard_False;
|
||||||
|
|
||||||
|
theTolerance = -1;
|
||||||
|
Standard_Real aTol1 = -1, aTol2 = -1;
|
||||||
|
|
||||||
Standard_Integer n2 = (num > 0)? num : NbEdges();
|
Standard_Integer n2 = (num > 0)? num : NbEdges();
|
||||||
Standard_Integer n1 = (n2 > 1)? n2-1 : NbEdges();
|
Standard_Integer n1 = (n2 > 1)? n2-1 : NbEdges();
|
||||||
Standard_Integer n3 = (n2 < NbEdges())? n2+1 : 1;
|
Standard_Integer n3 = (n2 < NbEdges())? n2+1 : 1;
|
||||||
@@ -838,11 +842,19 @@ Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer nu
|
|||||||
Standard_Boolean forward = ( E2.Orientation() == TopAbs_FORWARD );
|
Standard_Boolean forward = ( E2.Orientation() == TopAbs_FORWARD );
|
||||||
// FIX FEV 1998 : recompute singularity according precision
|
// FIX FEV 1998 : recompute singularity according precision
|
||||||
|
|
||||||
|
//jgv
|
||||||
|
TopoDS_Vertex BeginVertex, EndVertex;
|
||||||
|
gp_Pnt p3d1, p3d2;
|
||||||
|
/////
|
||||||
|
|
||||||
if (p1.Distance(p2) <= precFirst) { // edge DGNR
|
if (p1.Distance(p2) <= precFirst) { // edge DGNR
|
||||||
dgnr = mySurf->DegeneratedValues ( p1, precVtx, p2d1, p2d2, par1, par2, forward ); //smh#9
|
dgnr = mySurf->DegeneratedValues ( p1, precVtx, p2d1, p2d2, par1, par2, forward ); //smh#9
|
||||||
if ( dgnr ) { // abv 24 Feb 00: trj3_as1-ac-214.stp #6065: avoid making closed edge degenerated
|
if ( dgnr ) { // abv 24 Feb 00: trj3_as1-ac-214.stp #6065: avoid making closed edge degenerated
|
||||||
Standard_Real a, b;
|
Standard_Real a, b;
|
||||||
Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E2, a, b );
|
Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E2, a, b );
|
||||||
|
//jgv
|
||||||
|
theTolerance = BRep_Tool::Tolerance (E2);
|
||||||
|
/////
|
||||||
if ( ! C3d.IsNull() ) {
|
if ( ! C3d.IsNull() ) {
|
||||||
gp_Pnt p = C3d->Value ( 0.5 * ( a + b ) );
|
gp_Pnt p = C3d->Value ( 0.5 * ( a + b ) );
|
||||||
if ( p.SquareDistance ( p1 ) > precVtx * precVtx ) dgnr = Standard_False;
|
if ( p.SquareDistance ( p1 ) > precVtx * precVtx ) dgnr = Standard_False;
|
||||||
@@ -908,6 +920,12 @@ Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer nu
|
|||||||
Handle(Geom2d_Curve) c2d;
|
Handle(Geom2d_Curve) c2d;
|
||||||
if ( sae.PCurve ( E1, myFace, c2d, a, b, Standard_True ) ) {
|
if ( sae.PCurve ( E1, myFace, c2d, a, b, Standard_True ) ) {
|
||||||
p2d1 = c2d->Value ( b );
|
p2d1 = c2d->Value ( b );
|
||||||
|
//jgv
|
||||||
|
p3d1 = mySurf->Value (p2d1);
|
||||||
|
BeginVertex = sae.LastVertex(E1);
|
||||||
|
aTol1 = BRep_Tool::Tolerance (BeginVertex);
|
||||||
|
/////
|
||||||
|
|
||||||
//#84 rln gp_Pnt2d p2d = c2d->Value ( b );
|
//#84 rln gp_Pnt2d p2d = c2d->Value ( b );
|
||||||
//#84 rln par1 = ( p2d.XY() - aP2d.XY() ) * theDir2d.XY();
|
//#84 rln par1 = ( p2d.XY() - aP2d.XY() ) * theDir2d.XY();
|
||||||
}
|
}
|
||||||
@@ -915,6 +933,12 @@ Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer nu
|
|||||||
//pdn pcurves (fixing regression in f0 in degenerated case)
|
//pdn pcurves (fixing regression in f0 in degenerated case)
|
||||||
if ( sae.PCurve ( ( dgnr ? E3 : E2 ), myFace, c2d, a, b, Standard_True ) ) {
|
if ( sae.PCurve ( ( dgnr ? E3 : E2 ), myFace, c2d, a, b, Standard_True ) ) {
|
||||||
p2d2 = c2d->Value ( a );
|
p2d2 = c2d->Value ( a );
|
||||||
|
//jgv
|
||||||
|
p3d2 = mySurf->Value (p2d2);
|
||||||
|
EndVertex = sae.FirstVertex (dgnr ? E3 : E2);
|
||||||
|
aTol2 = BRep_Tool::Tolerance (EndVertex);
|
||||||
|
/////
|
||||||
|
|
||||||
//#84 rln gp_Pnt2d p2d = c2d->Value ( a );
|
//#84 rln gp_Pnt2d p2d = c2d->Value ( a );
|
||||||
//#84 rln par2 = ( p2d.XY() - aP2d.XY() ) * theDir2d.XY();
|
//#84 rln par2 = ( p2d.XY() - aP2d.XY() ) * theDir2d.XY();
|
||||||
}
|
}
|
||||||
@@ -928,6 +952,23 @@ Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer nu
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//jgv
|
||||||
|
if (theTolerance == -1)
|
||||||
|
{
|
||||||
|
theTolerance = Max (aTol1, aTol2);
|
||||||
|
if (BeginVertex.IsSame(EndVertex))
|
||||||
|
{
|
||||||
|
if (precVtx > theTolerance)
|
||||||
|
theTolerance = precVtx;
|
||||||
|
/*
|
||||||
|
Standard_Real aDist = p3d1.Distance (p3d2);
|
||||||
|
if (aDist > theTolerance)
|
||||||
|
theTolerance = aDist;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/////
|
||||||
|
|
||||||
//#84 rln 18.03.99 if pcurve is not degenerate anymore, the fix is postponned
|
//#84 rln 18.03.99 if pcurve is not degenerate anymore, the fix is postponned
|
||||||
//to ShapeFix_Wire::FixLacking
|
//to ShapeFix_Wire::FixLacking
|
||||||
if ( ! mySurf->IsDegenerated ( p2d1, p2d2, precVtx, 10. ) ) { //:s1 abv 22 Apr 99: PRO7226 #489490 //smh#9
|
if ( ! mySurf->IsDegenerated ( p2d1, p2d2, precVtx, 10. ) ) { //:s1 abv 22 Apr 99: PRO7226 #489490 //smh#9
|
||||||
@@ -959,7 +1000,8 @@ Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer nu
|
|||||||
Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer num)
|
Standard_Boolean ShapeAnalysis_Wire::CheckDegenerated (const Standard_Integer num)
|
||||||
{
|
{
|
||||||
gp_Pnt2d p2d1, p2d2;
|
gp_Pnt2d p2d1, p2d2;
|
||||||
return CheckDegenerated ( num, p2d1, p2d2 );
|
Standard_Real aTol;
|
||||||
|
return CheckDegenerated (num, p2d1, p2d2, aTol);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -300,7 +300,9 @@ public:
|
|||||||
//! no pcurve
|
//! no pcurve
|
||||||
//! FAIL2: Edge marked as degenerated and has no pcurve
|
//! FAIL2: Edge marked as degenerated and has no pcurve
|
||||||
//! but singularity is not detected
|
//! but singularity is not detected
|
||||||
Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num, gp_Pnt2d& dgnr1, gp_Pnt2d& dgnr2);
|
Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num,
|
||||||
|
gp_Pnt2d& dgnr1, gp_Pnt2d& dgnr2,
|
||||||
|
Standard_Real& theTolerance);
|
||||||
|
|
||||||
//! Checks for degenerated edge between two adjacent ones.
|
//! Checks for degenerated edge between two adjacent ones.
|
||||||
//! Remark : Calls previous function
|
//! Remark : Calls previous function
|
||||||
|
@@ -57,6 +57,7 @@
|
|||||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||||
#include <BRepTools.hxx>
|
#include <BRepTools.hxx>
|
||||||
|
#include <BRepLib.hxx>
|
||||||
#include <Geom2d_BSplineCurve.hxx>
|
#include <Geom2d_BSplineCurve.hxx>
|
||||||
#include <Geom2d_Curve.hxx>
|
#include <Geom2d_Curve.hxx>
|
||||||
#include <Geom2d_Line.hxx>
|
#include <Geom2d_Line.hxx>
|
||||||
@@ -1715,7 +1716,8 @@ Standard_Boolean ShapeFix_Wire::FixDegenerated (const Standard_Integer num)
|
|||||||
|
|
||||||
// analysis
|
// analysis
|
||||||
gp_Pnt2d p2d1, p2d2;
|
gp_Pnt2d p2d1, p2d2;
|
||||||
myAnalyzer->CheckDegenerated ( num, p2d1, p2d2 );
|
Standard_Real aTol;
|
||||||
|
myAnalyzer->CheckDegenerated (num, p2d1, p2d2, aTol);
|
||||||
if ( myAnalyzer->LastCheckStatus ( ShapeExtend_FAIL1 ) ) {
|
if ( myAnalyzer->LastCheckStatus ( ShapeExtend_FAIL1 ) ) {
|
||||||
myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL1 );
|
myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL1 );
|
||||||
}
|
}
|
||||||
@@ -1734,12 +1736,39 @@ Standard_Boolean ShapeFix_Wire::FixDegenerated (const Standard_Integer num)
|
|||||||
gp_Dir2d dir2d ( vect2d );
|
gp_Dir2d dir2d ( vect2d );
|
||||||
Handle(Geom2d_Line) line2d = new Geom2d_Line ( p2d1, dir2d );
|
Handle(Geom2d_Line) line2d = new Geom2d_Line ( p2d1, dir2d );
|
||||||
|
|
||||||
|
//Temporary
|
||||||
|
TopoDS_Face aFace = Face();
|
||||||
|
///////////
|
||||||
|
gp_Pnt2d aP2dMid (0.5*(p2d1.XY() + p2d2.XY()));
|
||||||
|
gp_Pnt aPntMid;
|
||||||
|
gp_Vec aDU, aDV;
|
||||||
|
myAnalyzer->Surface()->TrueAdaptor3d()->D1 (aP2dMid.X(), aP2dMid.Y(), aPntMid, aDU, aDV);
|
||||||
|
Standard_Real aTolMagnitude = Precision::Confusion();
|
||||||
|
Standard_Boolean anIsOnSingularity = (aDU.Magnitude() <= aTolMagnitude ||
|
||||||
|
aDV.Magnitude() <= aTolMagnitude);
|
||||||
|
/*
|
||||||
|
TopoDS_Edge anEdge = WireData()->Edge ((num > 0)? num : NbEdges());
|
||||||
|
Standard_Real aTolEdge = BRep_Tool::Tolerance (anEdge);
|
||||||
|
*/
|
||||||
|
//Standard_Boolean anIsNearSingularity =
|
||||||
|
//myAnalyzer->Surface()->IsDegenerated (aPntMid, Precision::Confusion());
|
||||||
|
Standard_Real aTolDeg = Max (aTol, Precision::Confusion());
|
||||||
|
Standard_Boolean anIsNearSingularity =
|
||||||
|
myAnalyzer->Surface()->IsDegenerated (aPntMid, aTolDeg);
|
||||||
|
anIsOnSingularity |= anIsNearSingularity;
|
||||||
|
|
||||||
TopoDS_Edge degEdge;
|
TopoDS_Edge degEdge;
|
||||||
BRep_Builder B;
|
BRep_Builder B;
|
||||||
B.MakeEdge ( degEdge );
|
B.MakeEdge ( degEdge );
|
||||||
B.Degenerated ( degEdge, Standard_True );
|
|
||||||
B.UpdateEdge ( degEdge, line2d, Face(), ::Precision::Confusion() );
|
B.UpdateEdge ( degEdge, line2d, Face(), ::Precision::Confusion() );
|
||||||
B.Range ( degEdge, Face(), 0., vect2d.Magnitude() );
|
B.Range ( degEdge, Face(), 0., vect2d.Magnitude() );
|
||||||
|
/*
|
||||||
|
if (anIsOnSingularity)
|
||||||
|
B.Degenerated (degEdge, Standard_True);
|
||||||
|
else
|
||||||
|
BRepLib::BuildCurve3d (degEdge);
|
||||||
|
*/
|
||||||
|
B.Degenerated (degEdge, Standard_True);
|
||||||
|
|
||||||
Handle(ShapeExtend_WireData) sbwd = WireData();
|
Handle(ShapeExtend_WireData) sbwd = WireData();
|
||||||
Standard_Integer n2 = ( num >0 ? num : sbwd->NbEdges() );
|
Standard_Integer n2 = ( num >0 ? num : sbwd->NbEdges() );
|
||||||
@@ -3058,12 +3087,90 @@ Standard_Boolean ShapeFix_Wire::FixLacking (const Standard_Integer num,
|
|||||||
// else try to add either degenerated or closed edge
|
// else try to add either degenerated or closed edge
|
||||||
if ( ! doAddLong ) {
|
if ( ! doAddLong ) {
|
||||||
gp_Pnt pV = 0.5 * ( BRep_Tool::Pnt(V1).XYZ() + BRep_Tool::Pnt(V2).XYZ() );
|
gp_Pnt pV = 0.5 * ( BRep_Tool::Pnt(V1).XYZ() + BRep_Tool::Pnt(V2).XYZ() );
|
||||||
gp_Pnt pm = myAnalyzer->Surface()->Value ( 0.5 * ( p2d1.XY() + p2d2.XY() ) );
|
|
||||||
|
|
||||||
Standard_Real dist = pV.Distance ( pm );
|
//Temporary
|
||||||
if ( dist <= tol ) doAddDegen = Standard_True;
|
TopoDS_Face aFace = Face();
|
||||||
else if ( myTopoMode ) doAddClosed = Standard_True;
|
///////////
|
||||||
|
gp_Pnt2d aP2dMid (0.5*(p2d1.XY() + p2d2.XY()));
|
||||||
|
gp_Pnt aPntMid;
|
||||||
|
gp_Vec aDU, aDV;
|
||||||
|
myAnalyzer->Surface()->TrueAdaptor3d()->D1 (aP2dMid.X(), aP2dMid.Y(), aPntMid, aDU, aDV);
|
||||||
|
Standard_Real aTolMagnitude = Precision::Confusion();
|
||||||
|
Standard_Boolean anIsOnSingularity = (aDU.Magnitude() <= aTolMagnitude ||
|
||||||
|
aDV.Magnitude() <= aTolMagnitude);
|
||||||
|
|
||||||
|
////////////////////////////////////
|
||||||
|
Standard_Real aCoeff = 0.9;
|
||||||
|
Standard_Real aUmin = myAnalyzer->Surface()->TrueAdaptor3d()->FirstUParameter();
|
||||||
|
Standard_Real aUmax = myAnalyzer->Surface()->TrueAdaptor3d()->LastUParameter();
|
||||||
|
Standard_Real aVmin = myAnalyzer->Surface()->TrueAdaptor3d()->FirstVParameter();
|
||||||
|
Standard_Real aVmax = myAnalyzer->Surface()->TrueAdaptor3d()->LastVParameter();
|
||||||
|
Standard_Real aDeltaU = Abs (p2d1.X() - p2d2.X());
|
||||||
|
Standard_Real aDeltaV = Abs (p2d1.Y() - p2d2.Y());
|
||||||
|
if (!anIsOnSingularity)
|
||||||
|
{
|
||||||
|
if (aDeltaU > aDeltaV)
|
||||||
|
{
|
||||||
|
anIsOnSingularity = (aDeltaU / (aUmax - aUmin) > aCoeff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
anIsOnSingularity = (aDeltaV / (aVmax - aVmin) > aCoeff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
////////////////////////////////////
|
||||||
|
|
||||||
|
if (!anIsOnSingularity)
|
||||||
|
{
|
||||||
|
Standard_Real aTolDeg = Precision::Confusion();
|
||||||
|
if (V1.IsSame(V2))
|
||||||
|
aTolDeg = BRep_Tool::Tolerance(V1);
|
||||||
|
|
||||||
|
////////////////////////////////////
|
||||||
|
gp_Pnt2d aPP1 = p2d1, aPP2 = p2d2;
|
||||||
|
if (aPP1.X() < aUmin)
|
||||||
|
aPP1.SetX (aUmin);
|
||||||
|
if (aPP1.X() > aUmax)
|
||||||
|
aPP1.SetX (aUmax);
|
||||||
|
if (aPP1.Y() < aVmin)
|
||||||
|
aPP1.SetY (aVmin);
|
||||||
|
if (aPP1.Y() > aVmax)
|
||||||
|
aPP1.SetY (aVmax);
|
||||||
|
|
||||||
|
if (aPP2.X() < aUmin)
|
||||||
|
aPP2.SetX (aUmin);
|
||||||
|
if (aPP2.X() > aUmax)
|
||||||
|
aPP2.SetX (aUmax);
|
||||||
|
if (aPP2.Y() < aVmin)
|
||||||
|
aPP2.SetY (aVmin);
|
||||||
|
if (aPP2.Y() > aVmax)
|
||||||
|
aPP2.SetY (aVmax);
|
||||||
|
|
||||||
|
gp_Pnt2d aPPmid((aPP1.XY() + aPP2.XY())/2);
|
||||||
|
gp_Pnt aP1 = myAnalyzer->Surface()->Value (aPP1);
|
||||||
|
gp_Pnt aP2 = myAnalyzer->Surface()->Value (aPP2);
|
||||||
|
gp_Pnt aPmid = myAnalyzer->Surface()->Value (aPPmid);
|
||||||
|
Standard_Real aDist = Max (aP1.Distance(aP2), Max (aP1.Distance(aPmid), aP2.Distance(aPmid)));
|
||||||
|
aDist *= 1.001;
|
||||||
|
if (aDist > aTolDeg)
|
||||||
|
aTolDeg = aDist;
|
||||||
|
////////////////////////////////////
|
||||||
|
|
||||||
|
anIsOnSingularity = myAnalyzer->Surface()->IsDegenerated (aPntMid, aTolDeg);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real dist = pV.Distance ( aPntMid );
|
||||||
|
//Standard_Boolean anIsDistLessTol = Standard_False;
|
||||||
|
if (dist <= tol)
|
||||||
|
{
|
||||||
|
//anIsDistLessTol = Standard_True;
|
||||||
|
if (anIsOnSingularity)
|
||||||
|
doAddDegen = Standard_True;
|
||||||
|
}
|
||||||
|
else if (myTopoMode)
|
||||||
|
doAddClosed = Standard_True;
|
||||||
else if ( dist <= MaxTolerance() ) { //:r7 abv 12 Apr 99: t3d_opt.stp #14245 after S4136
|
else if ( dist <= MaxTolerance() ) { //:r7 abv 12 Apr 99: t3d_opt.stp #14245 after S4136
|
||||||
|
if (anIsOnSingularity)
|
||||||
doAddDegen = Standard_True;
|
doAddDegen = Standard_True;
|
||||||
doIncrease = Standard_True;
|
doIncrease = Standard_True;
|
||||||
inctol = dist;
|
inctol = dist;
|
||||||
|
Reference in New Issue
Block a user