mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024422: Wrong result done by FaceClassifier algorithm
Control of out of boundaries by finding circle-point extrema.
This commit is contained in:
parent
6bf1bdbd22
commit
73cd8a8afd
@ -41,10 +41,10 @@
|
|||||||
#include <IntRes2d_IntersectionPoint.hxx>
|
#include <IntRes2d_IntersectionPoint.hxx>
|
||||||
|
|
||||||
static
|
static
|
||||||
void RefineTolerance(const TopoDS_Face& aF,
|
void RefineTolerance(const TopoDS_Face& aF,
|
||||||
const BRepAdaptor_Curve2d& aC,
|
const BRepAdaptor_Curve2d& aC,
|
||||||
const Standard_Real aT,
|
const Standard_Real aT,
|
||||||
Standard_Real& aTolZ);
|
Standard_Real& aTolZ);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : BRepClass_Intersector
|
//function : BRepClass_Intersector
|
||||||
@ -60,16 +60,16 @@ BRepClass_Intersector::BRepClass_Intersector()
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
||||||
const Standard_Real P,
|
const Standard_Real P,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const BRepClass_Edge& E)
|
const BRepClass_Edge& E)
|
||||||
{
|
{
|
||||||
Standard_Real deb, fin, aTolZ;
|
Standard_Real deb = 0.0, fin = 0.0, aTolZ = Tol;
|
||||||
Handle(Geom2d_Curve) aC2D;
|
Handle(Geom2d_Curve) aC2D;
|
||||||
//
|
//
|
||||||
aTolZ=Tol;
|
|
||||||
const TopoDS_Edge& EE = E.Edge();
|
const TopoDS_Edge& EE = E.Edge();
|
||||||
const TopoDS_Face& F = E.Face();
|
const TopoDS_Face& F = E.Face();
|
||||||
|
|
||||||
//
|
//
|
||||||
aC2D=BRep_Tool::CurveOnSurface(EE, F, deb, fin);
|
aC2D=BRep_Tool::CurveOnSurface(EE, F, deb, fin);
|
||||||
if (aC2D.IsNull()) {
|
if (aC2D.IsNull()) {
|
||||||
@ -84,24 +84,30 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
|||||||
//
|
//
|
||||||
// Case of "ON": direct check of belonging to edge
|
// Case of "ON": direct check of belonging to edge
|
||||||
// taking into account the tolerance
|
// taking into account the tolerance
|
||||||
Extrema_ExtPC2d theExtPC2d(L.Location(), C);
|
Extrema_ExtPC2d anExtPC2d(L.Location(), C);
|
||||||
Standard_Real MinDist = RealLast(), aDist;
|
Standard_Real MinDist = RealLast(), aDist;
|
||||||
Standard_Integer MinInd = 0, i;
|
Standard_Integer MinInd = 0, i;
|
||||||
if (theExtPC2d.IsDone()) {
|
if (anExtPC2d.IsDone())
|
||||||
for (i = 1; i <= theExtPC2d.NbExt(); ++i) {
|
{
|
||||||
aDist = theExtPC2d.SquareDistance(i);
|
const Standard_Integer aNbPnts = anExtPC2d.NbExt();
|
||||||
if (aDist < MinDist) {
|
for (i = 1; i <= aNbPnts; ++i)
|
||||||
MinDist = aDist;
|
{
|
||||||
MinInd = i;
|
aDist = anExtPC2d.SquareDistance(i);
|
||||||
|
|
||||||
|
if (aDist < MinDist)
|
||||||
|
{
|
||||||
|
MinDist = aDist;
|
||||||
|
MinInd = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MinInd) {
|
if (MinInd) {
|
||||||
MinDist = sqrt(MinDist);
|
MinDist = sqrt(MinDist);
|
||||||
}
|
}
|
||||||
if (MinDist <= aTolZ) {
|
if (MinDist <= aTolZ) {
|
||||||
gp_Pnt2d pnt_exact = (theExtPC2d.Point(MinInd)).Value();
|
gp_Pnt2d pnt_exact = (anExtPC2d.Point(MinInd)).Value();
|
||||||
Standard_Real par = (theExtPC2d.Point(MinInd)).Parameter();
|
Standard_Real par = (anExtPC2d.Point(MinInd)).Parameter();
|
||||||
//
|
//
|
||||||
RefineTolerance(F, C, par, aTolZ);
|
RefineTolerance(F, C, par, aTolZ);
|
||||||
//
|
//
|
||||||
@ -109,16 +115,16 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
|||||||
IntRes2d_Transition tr_on_lin(IntRes2d_Head);
|
IntRes2d_Transition tr_on_lin(IntRes2d_Head);
|
||||||
IntRes2d_Position pos_on_curve = IntRes2d_Middle;
|
IntRes2d_Position pos_on_curve = IntRes2d_Middle;
|
||||||
if (Abs(par - deb) <= Precision::Confusion()) {
|
if (Abs(par - deb) <= Precision::Confusion()) {
|
||||||
pos_on_curve = IntRes2d_Head;
|
pos_on_curve = IntRes2d_Head;
|
||||||
}
|
}
|
||||||
else if (Abs(par - fin) <= Precision::Confusion()) {
|
else if (Abs(par - fin) <= Precision::Confusion()) {
|
||||||
pos_on_curve = IntRes2d_End;
|
pos_on_curve = IntRes2d_End;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
IntRes2d_Transition tr_on_curve(pos_on_curve);
|
IntRes2d_Transition tr_on_curve(pos_on_curve);
|
||||||
IntRes2d_IntersectionPoint pnt_inter(pnt_exact, 0., par,
|
IntRes2d_IntersectionPoint pnt_inter(pnt_exact, 0., par,
|
||||||
tr_on_lin, tr_on_curve,
|
tr_on_lin, tr_on_curve,
|
||||||
Standard_False);
|
Standard_False);
|
||||||
//
|
//
|
||||||
Append(pnt_inter);
|
Append(pnt_inter);
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
@ -144,16 +150,16 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
|||||||
// temporary periodic domain
|
// temporary periodic domain
|
||||||
if (C.Curve()->IsPeriodic()) {
|
if (C.Curve()->IsPeriodic()) {
|
||||||
DE.SetEquivalentParameters(C.FirstParameter(),
|
DE.SetEquivalentParameters(C.FirstParameter(),
|
||||||
C.FirstParameter() +
|
C.FirstParameter() +
|
||||||
C.Curve()->LastParameter() -
|
C.Curve()->LastParameter() -
|
||||||
C.Curve()->FirstParameter());
|
C.Curve()->FirstParameter());
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Geom2d_Line) GL= new Geom2d_Line(L);
|
Handle(Geom2d_Line) GL= new Geom2d_Line(L);
|
||||||
Geom2dAdaptor_Curve CGA(GL);
|
Geom2dAdaptor_Curve CGA(GL);
|
||||||
Geom2dInt_GInter Inter(CGA,DL,C,DE,
|
Geom2dInt_GInter Inter(CGA,DL,C,DE,
|
||||||
Precision::PConfusion(),
|
Precision::PConfusion(),
|
||||||
Precision::PIntersection());
|
Precision::PIntersection());
|
||||||
//
|
//
|
||||||
SetValues(Inter);
|
SetValues(Inter);
|
||||||
}
|
}
|
||||||
@ -163,14 +169,14 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BRepClass_Intersector::LocalGeometry(const BRepClass_Edge& E,
|
void BRepClass_Intersector::LocalGeometry(const BRepClass_Edge& E,
|
||||||
const Standard_Real U,
|
const Standard_Real U,
|
||||||
gp_Dir2d& Tang,
|
gp_Dir2d& Tang,
|
||||||
gp_Dir2d& Norm,
|
gp_Dir2d& Norm,
|
||||||
Standard_Real& C) const
|
Standard_Real& C) const
|
||||||
{
|
{
|
||||||
Standard_Real f,l;
|
Standard_Real f,l;
|
||||||
Geom2dLProp_CLProps2d Prop(BRep_Tool::CurveOnSurface(E.Edge(),E.Face(),f,l),
|
Geom2dLProp_CLProps2d Prop(BRep_Tool::CurveOnSurface(E.Edge(),E.Face(),f,l),
|
||||||
U,2,Precision::PConfusion());
|
U,2,Precision::PConfusion());
|
||||||
Prop.Tangent(Tang);
|
Prop.Tangent(Tang);
|
||||||
C = Prop.Curvature();
|
C = Prop.Curvature();
|
||||||
if (C > Precision::PConfusion())
|
if (C > Precision::PConfusion())
|
||||||
@ -184,9 +190,9 @@ void BRepClass_Intersector::LocalGeometry(const BRepClass_Edge& E,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void RefineTolerance(const TopoDS_Face& aF,
|
void RefineTolerance(const TopoDS_Face& aF,
|
||||||
const BRepAdaptor_Curve2d& aC,
|
const BRepAdaptor_Curve2d& aC,
|
||||||
const Standard_Real aT,
|
const Standard_Real aT,
|
||||||
Standard_Real& aTolZ)
|
Standard_Real& aTolZ)
|
||||||
{
|
{
|
||||||
GeomAbs_SurfaceType aTypeS;
|
GeomAbs_SurfaceType aTypeS;
|
||||||
//
|
//
|
||||||
|
@ -60,7 +60,7 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine,
|
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine,
|
||||||
const GeomAbs_JoinType Join)
|
const GeomAbs_JoinType Join)
|
||||||
{
|
{
|
||||||
Init(Spine, Join);
|
Init(Spine, Join);
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
||||||
const GeomAbs_JoinType Join)
|
const GeomAbs_JoinType Join)
|
||||||
{
|
{
|
||||||
myFace = Spine;
|
myFace = Spine;
|
||||||
myIsInitialized = Standard_True;
|
myIsInitialized = Standard_True;
|
||||||
@ -89,7 +89,7 @@ void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
|
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
|
||||||
const GeomAbs_JoinType Join)
|
const GeomAbs_JoinType Join)
|
||||||
{
|
{
|
||||||
myWires.Append(Spine);
|
myWires.Append(Spine);
|
||||||
myIsInitialized = Standard_True;
|
myIsInitialized = Standard_True;
|
||||||
@ -124,10 +124,10 @@ void BRepOffsetAPI_MakeOffset::AddWire(const TopoDS_Wire& Spine)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static void BuildDomains(TopoDS_Face& myFace,
|
static void BuildDomains(TopoDS_Face& myFace,
|
||||||
TopTools_ListOfShape& WorkWires,
|
TopTools_ListOfShape& WorkWires,
|
||||||
BRepFill_ListOfOffsetWire& myAlgos,
|
BRepFill_ListOfOffsetWire& myAlgos,
|
||||||
GeomAbs_JoinType myJoin,
|
GeomAbs_JoinType myJoin,
|
||||||
Standard_Boolean isPositive)
|
Standard_Boolean isPositive)
|
||||||
{
|
{
|
||||||
BRepAlgo_FaceRestrictor FR;
|
BRepAlgo_FaceRestrictor FR;
|
||||||
TopoDS_Vertex VF,VL;
|
TopoDS_Vertex VF,VL;
|
||||||
@ -146,14 +146,14 @@ static void BuildDomains(TopoDS_Face& myFace,
|
|||||||
if (anExp.More()) {
|
if (anExp.More()) {
|
||||||
aWire2 = anExp.Current();
|
aWire2 = anExp.Current();
|
||||||
if ((aWire1.Orientation() == aWire2.Orientation() && isPositive) ||
|
if ((aWire1.Orientation() == aWire2.Orientation() && isPositive) ||
|
||||||
(aWire1.Orientation() == TopAbs::Complement(aWire2.Orientation()) && !isPositive)) {
|
(aWire1.Orientation() == TopAbs::Complement(aWire2.Orientation()) && !isPositive)) {
|
||||||
TopTools_ListOfShape LWires;
|
TopTools_ListOfShape LWires;
|
||||||
TopTools_ListIteratorOfListOfShape itl;
|
TopTools_ListIteratorOfListOfShape itl;
|
||||||
for (itl.Initialize(WorkWires); itl.More(); itl.Next()) {
|
for (itl.Initialize(WorkWires); itl.More(); itl.Next()) {
|
||||||
const TopoDS_Shape& W = itl.Value();
|
const TopoDS_Shape& W = itl.Value();
|
||||||
LWires.Append(W.Reversed());
|
LWires.Append(W.Reversed());
|
||||||
}
|
}
|
||||||
WorkWires = LWires;
|
WorkWires = LWires;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Modified by Sergey KHROMOV - Thu Apr 26 16:04:44 2001 End
|
// Modified by Sergey KHROMOV - Thu Apr 26 16:04:44 2001 End
|
||||||
@ -227,21 +227,21 @@ static void BuildDomains(TopoDS_Face& myFace,
|
|||||||
Standard_Real Dist2Min = Precision::Infinite();
|
Standard_Real Dist2Min = Precision::Infinite();
|
||||||
Standard_Real Found = Standard_False;
|
Standard_Real Found = Standard_False;
|
||||||
for (Standard_Integer ie = 1; ie <= ExtPS.NbExt(); ie++) {
|
for (Standard_Integer ie = 1; ie <= ExtPS.NbExt(); ie++) {
|
||||||
Standard_Real X,Y;
|
Standard_Real X,Y;
|
||||||
if (ExtPS.SquareDistance(ie) < Dist2Min) {
|
if (ExtPS.SquareDistance(ie) < Dist2Min) {
|
||||||
Dist2Min = ExtPS.SquareDistance(ie);
|
Dist2Min = ExtPS.SquareDistance(ie);
|
||||||
Found = Standard_True;
|
Found = Standard_True;
|
||||||
ExtPS.Point(ie).Parameter(X,Y);
|
ExtPS.Point(ie).Parameter(X,Y);
|
||||||
PV.SetCoord(X,Y);
|
PV.SetCoord(X,Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( Found && (CL.Perform(PV) == TopAbs_IN)) {
|
if ( Found && (CL.Perform(PV) == TopAbs_IN)) {
|
||||||
// The face that contains a wire is found and it is removed from the list
|
// The face that contains a wire is found and it is removed from the list
|
||||||
B.Add(F,W);
|
B.Add(F,W);
|
||||||
LOW.Remove(itW);
|
LOW.Remove(itW);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itW.Next();
|
itW.Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,13 +260,13 @@ static void BuildDomains(TopoDS_Face& myFace,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepOffsetAPI_MakeOffset::Perform( const Standard_Real Offset,
|
void BRepOffsetAPI_MakeOffset::Perform( const Standard_Real Offset,
|
||||||
const Standard_Real Alt)
|
const Standard_Real Alt)
|
||||||
{
|
{
|
||||||
StdFail_NotDone_Raise_if ( !myIsInitialized,
|
StdFail_NotDone_Raise_if ( !myIsInitialized,
|
||||||
"BRepOffsetAPI_MakeOffset : Perform without Init");
|
"BRepOffsetAPI_MakeOffset : Perform without Init");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Standard_Integer i = 1;
|
Standard_Integer i = 1;
|
||||||
BRepFill_ListIteratorOfListOfOffsetWire itOW;
|
BRepFill_ListIteratorOfListOfOffsetWire itOW;
|
||||||
TopoDS_Compound Res;
|
TopoDS_Compound Res;
|
||||||
@ -275,53 +275,53 @@ void BRepOffsetAPI_MakeOffset::Perform( const Standard_Real Offset,
|
|||||||
myLastIsLeft = (Offset <= 0);
|
myLastIsLeft = (Offset <= 0);
|
||||||
|
|
||||||
if( Offset <= 0. )
|
if( Offset <= 0. )
|
||||||
{
|
{
|
||||||
if( myLeft.IsEmpty() )
|
if( myLeft.IsEmpty() )
|
||||||
{
|
{
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 Begin
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 Begin
|
||||||
BuildDomains(myFace,myWires,myLeft,myJoin, Standard_False);
|
BuildDomains(myFace,myWires,myLeft,myJoin, Standard_False);
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 End
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 End
|
||||||
}
|
}
|
||||||
|
|
||||||
for (itOW.Initialize(myLeft); itOW.More(); itOW.Next())
|
for (itOW.Initialize(myLeft); itOW.More(); itOW.Next())
|
||||||
{
|
{
|
||||||
BRepFill_OffsetWire& Algo = itOW.Value();
|
BRepFill_OffsetWire& Algo = itOW.Value();
|
||||||
Algo.Perform(Abs(Offset),Alt);
|
Algo.Perform(Abs(Offset),Alt);
|
||||||
if (Algo.IsDone() && !Algo.Shape().IsNull())
|
if (Algo.IsDone() && !Algo.Shape().IsNull())
|
||||||
{
|
{
|
||||||
B.Add(Res,Algo.Shape());
|
B.Add(Res,Algo.Shape());
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
myShape = Algo.Shape();
|
myShape = Algo.Shape();
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (myRight.IsEmpty())
|
if (myRight.IsEmpty())
|
||||||
{
|
{
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:28 2001 Begin
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:28 2001 Begin
|
||||||
BuildDomains(myFace,myWires,myRight,myJoin, Standard_True);
|
BuildDomains(myFace,myWires,myRight,myJoin, Standard_True);
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:35 2001 End
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:35 2001 End
|
||||||
}
|
}
|
||||||
|
|
||||||
for(itOW.Initialize(myRight); itOW.More(); itOW.Next())
|
for(itOW.Initialize(myRight); itOW.More(); itOW.Next())
|
||||||
{
|
{
|
||||||
BRepFill_OffsetWire& Algo = itOW.Value();
|
BRepFill_OffsetWire& Algo = itOW.Value();
|
||||||
Algo.Perform(Offset,Alt);
|
Algo.Perform(Offset,Alt);
|
||||||
|
|
||||||
if (Algo.IsDone() && !Algo.Shape().IsNull())
|
if (Algo.IsDone() && !Algo.Shape().IsNull())
|
||||||
{
|
{
|
||||||
B.Add(Res,Algo.Shape());
|
B.Add(Res,Algo.Shape());
|
||||||
|
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
myShape = Algo.Shape();
|
myShape = Algo.Shape();
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( i > 2 )
|
if( i > 2 )
|
||||||
myShape = Res;
|
myShape = Res;
|
||||||
@ -330,16 +330,16 @@ void BRepOffsetAPI_MakeOffset::Perform( const Standard_Real Offset,
|
|||||||
NotDone();
|
NotDone();
|
||||||
else
|
else
|
||||||
Done();
|
Done();
|
||||||
}
|
}
|
||||||
catch(...) //Every exception was caught.
|
catch(...) //Every exception was caught.
|
||||||
{
|
{
|
||||||
cout<<"An exception was caught in BRepOffsetAPI_MakeOffset::Perform : ";
|
cout<<"An exception was caught in BRepOffsetAPI_MakeOffset::Perform : ";
|
||||||
Standard_ConstructionError::Caught()->Print(cout);
|
Standard_ConstructionError::Caught()->Print(cout);
|
||||||
cout<<endl;
|
cout<<endl;
|
||||||
NotDone();
|
NotDone();
|
||||||
myShape.Nullify();
|
myShape.Nullify();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Build
|
//function : Build
|
||||||
@ -358,7 +358,7 @@ void BRepOffsetAPI_MakeOffset::Build()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffset::Generated
|
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffset::Generated
|
||||||
(const TopoDS_Shape& S)
|
(const TopoDS_Shape& S)
|
||||||
{
|
{
|
||||||
myGenerated.Clear();
|
myGenerated.Clear();
|
||||||
BRepFill_ListIteratorOfListOfOffsetWire itOW;
|
BRepFill_ListIteratorOfListOfOffsetWire itOW;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -34,19 +34,19 @@ Extrema_ExtPElC2d::Extrema_ExtPElC2d () { myDone = Standard_False; }
|
|||||||
|
|
||||||
Extrema_ExtPElC2d::Extrema_ExtPElC2d
|
Extrema_ExtPElC2d::Extrema_ExtPElC2d
|
||||||
(const gp_Pnt2d& P,
|
(const gp_Pnt2d& P,
|
||||||
const gp_Lin2d& L,
|
const gp_Lin2d& L,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
Perform(P, L, Tol, Uinf, Usup);
|
Perform(P, L, Tol, Uinf, Usup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
||||||
const gp_Lin2d& L,
|
const gp_Lin2d& L,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
myDone = Standard_True;
|
myDone = Standard_True;
|
||||||
gp_Pnt2d OR, MyP;
|
gp_Pnt2d OR, MyP;
|
||||||
@ -57,13 +57,13 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
gp_Vec2d V(OR, P);
|
gp_Vec2d V(OR, P);
|
||||||
Standard_Real Mydist = V1.Dot(V);
|
Standard_Real Mydist = V1.Dot(V);
|
||||||
if ((Mydist >= Uinf -Tol) &&
|
if ((Mydist >= Uinf -Tol) &&
|
||||||
(Mydist <= Usup+ Tol)){
|
(Mydist <= Usup+ Tol)){
|
||||||
myNbExt = 1;
|
myNbExt = 1;
|
||||||
MyP = OR.Translated(Mydist*V1);
|
MyP = OR.Translated(Mydist*V1);
|
||||||
Extrema_POnCurv2d MyPOnCurve(Mydist, MyP);
|
Extrema_POnCurv2d MyPOnCurve(Mydist, MyP);
|
||||||
mySqDist[0] = P.SquareDistance(MyP);
|
mySqDist[0] = P.SquareDistance(MyP);
|
||||||
myPoint[0] = MyPOnCurve;
|
myPoint[0] = MyPOnCurve;
|
||||||
myIsMin[0] = Standard_True;
|
myIsMin[0] = Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,30 +71,32 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
|
|
||||||
Extrema_ExtPElC2d::Extrema_ExtPElC2d
|
Extrema_ExtPElC2d::Extrema_ExtPElC2d
|
||||||
(const gp_Pnt2d& P,
|
(const gp_Pnt2d& P,
|
||||||
const gp_Circ2d& C,
|
const gp_Circ2d& C,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
Perform(P, C, Tol, Uinf, Usup);
|
Perform(P, C, Tol, Uinf, Usup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
||||||
const gp_Circ2d& C,
|
const gp_Circ2d& C,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
Standard_Real radius, U1, U2;
|
// gp_Pnt2d OC, P1, P2, OL;
|
||||||
// gp_Pnt2d OC, P1, P2, OL;
|
gp_Pnt2d OC(C.Location());
|
||||||
gp_Pnt2d OC, P1, P2;
|
|
||||||
OC = C.Location();
|
|
||||||
myNbExt = 0;
|
myNbExt = 0;
|
||||||
|
|
||||||
if (OC.IsEqual(P, Precision::Confusion())) {
|
if (OC.IsEqual(P, Precision::Confusion())) {
|
||||||
myDone = Standard_False;
|
myDone = Standard_False;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
Standard_Real radius, U1, U2;
|
||||||
|
gp_Pnt2d P1, P2;
|
||||||
|
|
||||||
myDone = Standard_True;
|
myDone = Standard_True;
|
||||||
gp_Dir2d V(gp_Vec2d(P, OC));
|
gp_Dir2d V(gp_Vec2d(P, OC));
|
||||||
radius = C.Radius();
|
radius = C.Radius();
|
||||||
@ -105,10 +107,20 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
Standard_Real myuinf = Uinf;
|
Standard_Real myuinf = Uinf;
|
||||||
ElCLib::AdjustPeriodic(Uinf, Uinf+2*M_PI, Precision::PConfusion(), myuinf, U1);
|
ElCLib::AdjustPeriodic(Uinf, Uinf+2*M_PI, Precision::PConfusion(), myuinf, U1);
|
||||||
ElCLib::AdjustPeriodic(Uinf, Uinf+2*M_PI, Precision::PConfusion(), myuinf, U2);
|
ElCLib::AdjustPeriodic(Uinf, Uinf+2*M_PI, Precision::PConfusion(), myuinf, U2);
|
||||||
if (((U1-2*M_PI-Uinf) < Tol) && ((U1-2*M_PI-Uinf) > -Tol)) U1 = Uinf;
|
if (((U1-2*M_PI-Uinf) < Tol) && ((U1-2*M_PI-Uinf) > -Tol))
|
||||||
if (((U2-2*M_PI-Uinf) < Tol) && ((U2-2*M_PI-Uinf) > -Tol)) U2 = Uinf;
|
{
|
||||||
|
U1 = Uinf;
|
||||||
|
P1 = OC.XY() + radius * (cos(U1) * C.XAxis().Direction().XY() + sin(U1) * C.YAxis().Direction().XY());
|
||||||
|
}
|
||||||
|
|
||||||
if (((Uinf-U1) < Tol) && ((U1-Usup) < Tol)) {
|
if (((U2-2*M_PI-Uinf) < Tol) && ((U2-2*M_PI-Uinf) > -Tol))
|
||||||
|
{
|
||||||
|
U2 = Uinf;
|
||||||
|
P2 = OC.XY() + radius * (cos(U2) * C.XAxis().Direction().XY() + sin(U2) * C.YAxis().Direction().XY());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((Uinf-U1) < Tol) && ((U1-Usup) < Tol))
|
||||||
|
{
|
||||||
Extrema_POnCurv2d MyPOnCurve(U1, P1);
|
Extrema_POnCurv2d MyPOnCurve(U1, P1);
|
||||||
mySqDist[0] = P.SquareDistance(P1);
|
mySqDist[0] = P.SquareDistance(P1);
|
||||||
myPoint[0] = MyPOnCurve;
|
myPoint[0] = MyPOnCurve;
|
||||||
@ -116,7 +128,8 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
myNbExt++;
|
myNbExt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((Uinf-U2) < Tol) && ((U2-Usup) < Tol)) {
|
if (((Uinf-U2) < Tol) && ((U2-Usup) < Tol))
|
||||||
|
{
|
||||||
Extrema_POnCurv2d MyPOnCurve(U2, P2);
|
Extrema_POnCurv2d MyPOnCurve(U2, P2);
|
||||||
mySqDist[myNbExt] = P.SquareDistance(P2);
|
mySqDist[myNbExt] = P.SquareDistance(P2);
|
||||||
myPoint[myNbExt] = MyPOnCurve;
|
myPoint[myNbExt] = MyPOnCurve;
|
||||||
@ -130,10 +143,10 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
|
|
||||||
|
|
||||||
Extrema_ExtPElC2d::Extrema_ExtPElC2d (const gp_Pnt2d& P,
|
Extrema_ExtPElC2d::Extrema_ExtPElC2d (const gp_Pnt2d& P,
|
||||||
const gp_Elips2d& E,
|
const gp_Elips2d& E,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
Perform(P, E, Tol, Uinf, Usup);
|
Perform(P, E, Tol, Uinf, Usup);
|
||||||
}
|
}
|
||||||
@ -141,12 +154,12 @@ Extrema_ExtPElC2d::Extrema_ExtPElC2d (const gp_Pnt2d& P,
|
|||||||
|
|
||||||
|
|
||||||
void Extrema_ExtPElC2d::Perform (const gp_Pnt2d& P,
|
void Extrema_ExtPElC2d::Perform (const gp_Pnt2d& P,
|
||||||
const gp_Elips2d& E,
|
const gp_Elips2d& E,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
// gp_Pnt2d OR, P1, P2;
|
// gp_Pnt2d OR, P1, P2;
|
||||||
gp_Pnt2d OR;
|
gp_Pnt2d OR;
|
||||||
OR = E.Location();
|
OR = E.Location();
|
||||||
|
|
||||||
@ -156,8 +169,8 @@ void Extrema_ExtPElC2d::Perform (const gp_Pnt2d& P,
|
|||||||
gp_Vec2d V(OR,P);
|
gp_Vec2d V(OR,P);
|
||||||
|
|
||||||
if (OR.IsEqual(P, Precision::Confusion()) &&
|
if (OR.IsEqual(P, Precision::Confusion()) &&
|
||||||
(Abs(A-B) <= Tol)) {
|
(Abs(A-B) <= Tol)) {
|
||||||
myDone = Standard_False;
|
myDone = Standard_False;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Standard_Real X = V.Dot(gp_Vec2d(E.XAxis().Direction()));
|
Standard_Real X = V.Dot(gp_Vec2d(E.XAxis().Direction()));
|
||||||
@ -184,20 +197,20 @@ void Extrema_ExtPElC2d::Perform (const gp_Pnt2d& P,
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
Extrema_ExtPElC2d::Extrema_ExtPElC2d (const gp_Pnt2d& P,
|
Extrema_ExtPElC2d::Extrema_ExtPElC2d (const gp_Pnt2d& P,
|
||||||
const gp_Hypr2d& C,
|
const gp_Hypr2d& C,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
Perform(P, C, Tol, Uinf, Usup);
|
Perform(P, C, Tol, Uinf, Usup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
||||||
const gp_Hypr2d& H,
|
const gp_Hypr2d& H,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
gp_Pnt2d O = H.Location();
|
gp_Pnt2d O = H.Location();
|
||||||
myDone = Standard_False;
|
myDone = Standard_False;
|
||||||
@ -223,21 +236,21 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
if (Vs > 0.) {
|
if (Vs > 0.) {
|
||||||
Us = Log(Vs);
|
Us = Log(Vs);
|
||||||
if ((Us >= Uinf) && (Us <= Usup)) {
|
if ((Us >= Uinf) && (Us <= Usup)) {
|
||||||
Cu = ElCLib::Value(Us,H);
|
Cu = ElCLib::Value(Us,H);
|
||||||
DejaEnr = Standard_False;
|
DejaEnr = Standard_False;
|
||||||
for (NoExt = 0; NoExt < myNbExt; NoExt++) {
|
for (NoExt = 0; NoExt < myNbExt; NoExt++) {
|
||||||
if (TbExt[NoExt].SquareDistance(Cu) < Tol2) {
|
if (TbExt[NoExt].SquareDistance(Cu) < Tol2) {
|
||||||
DejaEnr = Standard_True;
|
DejaEnr = Standard_True;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!DejaEnr) {
|
if (!DejaEnr) {
|
||||||
TbExt[myNbExt] = Cu;
|
TbExt[myNbExt] = Cu;
|
||||||
mySqDist[myNbExt] = Cu.SquareDistance(P);
|
mySqDist[myNbExt] = Cu.SquareDistance(P);
|
||||||
myIsMin[myNbExt] = (NoSol == 0);
|
myIsMin[myNbExt] = (NoSol == 0);
|
||||||
myPoint[myNbExt] = Extrema_POnCurv2d(Us,Cu);
|
myPoint[myNbExt] = Extrema_POnCurv2d(Us,Cu);
|
||||||
myNbExt++;
|
myNbExt++;
|
||||||
}
|
}
|
||||||
} // if ((Us >= Uinf) && (Us <= Usup))
|
} // if ((Us >= Uinf) && (Us <= Usup))
|
||||||
} // if (Vs > 0.)
|
} // if (Vs > 0.)
|
||||||
} // for (Standard_Integer NoSol = 1; ...
|
} // for (Standard_Integer NoSol = 1; ...
|
||||||
@ -247,20 +260,20 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
Extrema_ExtPElC2d::Extrema_ExtPElC2d (const gp_Pnt2d& P,
|
Extrema_ExtPElC2d::Extrema_ExtPElC2d (const gp_Pnt2d& P,
|
||||||
const gp_Parab2d& C,
|
const gp_Parab2d& C,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
Perform(P, C, Tol, Uinf, Usup);
|
Perform(P, C, Tol, Uinf, Usup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
||||||
const gp_Parab2d& C,
|
const gp_Parab2d& C,
|
||||||
const Standard_Real Tol,
|
const Standard_Real Tol,
|
||||||
const Standard_Real Uinf,
|
const Standard_Real Uinf,
|
||||||
const Standard_Real Usup)
|
const Standard_Real Usup)
|
||||||
{
|
{
|
||||||
myDone = Standard_False;
|
myDone = Standard_False;
|
||||||
myNbExt = 0;
|
myNbExt = 0;
|
||||||
@ -286,17 +299,17 @@ void Extrema_ExtPElC2d::Perform(const gp_Pnt2d& P,
|
|||||||
Cu = ElCLib::Value(Us,C);
|
Cu = ElCLib::Value(Us,C);
|
||||||
DejaEnr = Standard_False;
|
DejaEnr = Standard_False;
|
||||||
for (NoExt = 0; NoExt < myNbExt; NoExt++) {
|
for (NoExt = 0; NoExt < myNbExt; NoExt++) {
|
||||||
if (TbExt[NoExt].SquareDistance(Cu) < Tol2) {
|
if (TbExt[NoExt].SquareDistance(Cu) < Tol2) {
|
||||||
DejaEnr = Standard_True;
|
DejaEnr = Standard_True;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!DejaEnr) {
|
if (!DejaEnr) {
|
||||||
TbExt[myNbExt] = Cu;
|
TbExt[myNbExt] = Cu;
|
||||||
mySqDist[myNbExt] = Cu.SquareDistance(P);
|
mySqDist[myNbExt] = Cu.SquareDistance(P);
|
||||||
myIsMin[myNbExt] = (NoSol == 0);
|
myIsMin[myNbExt] = (NoSol == 0);
|
||||||
myPoint[myNbExt] = Extrema_POnCurv2d(Us,Cu);
|
myPoint[myNbExt] = Extrema_POnCurv2d(Us,Cu);
|
||||||
myNbExt++;
|
myNbExt++;
|
||||||
}
|
}
|
||||||
} // if ((Us >= Uinf) && (Us <= Usup))
|
} // if ((Us >= Uinf) && (Us <= Usup))
|
||||||
} // for (Standard_Integer NoSol = 1; ...
|
} // for (Standard_Integer NoSol = 1; ...
|
||||||
|
27
tests/bugs/modalg_5/bug24422
Normal file
27
tests/bugs/modalg_5/bug24422
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "OCC24422"
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Wrong result done by FaceClassifier algorythm
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug24422_Compound.brep] b
|
||||||
|
explode b f
|
||||||
|
copy b_1 f
|
||||||
|
|
||||||
|
point p 115.945392440981 106 230.000108990528
|
||||||
|
point p_proj 230.00010899052799 1925.9453924409811
|
||||||
|
set info [b2dclassify f p_proj]
|
||||||
|
|
||||||
|
if { [regexp "The point is OUT of shape" $info] != 1 } {
|
||||||
|
puts "Error : point should be ON shape"
|
||||||
|
} else {
|
||||||
|
puts "OK: point is OUT of shape"
|
||||||
|
}
|
||||||
|
|
||||||
|
axo
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user