1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0029866: Intersector returns two overlapped curves as a result

Since now a new WLine is not created if its start point lies in another earlier computed WLine. It allows avoiding creation of duplicate WLines in the intersection result.

<!break>

1. Methods IsOutSurf1Box(...), IsOutSurf2Box(...), IsOutBox(...) for classes IntSurf_LineOn2S and IntPatch_RLine have been created.
This commit is contained in:
nbv
2018-07-03 18:14:30 +03:00
committed by bugmaster
parent 8ff2e494f5
commit 92a55b01af
15 changed files with 448 additions and 137 deletions

View File

@@ -686,13 +686,9 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
NbPointDep=seqpdep.Length();
//
if (NbPointDep || NbPointIns) {
IntPatch_TheIWalking iwalk(TolTang,Fleche,Pas);
if (!reversed) {
iwalk.Perform(seqpdep,seqpins,Func,Surf2);
}
else {
iwalk.Perform(seqpdep,seqpins,Func,Surf1,Standard_True);
}
IntPatch_TheIWalking iwalk(TolTang, Fleche, Pas);
iwalk.Perform(seqpdep, seqpins, Func, reversed ? Surf1 : Surf2, reversed);
if(!iwalk.IsDone()) {
return;
}

View File

@@ -20,6 +20,8 @@
#include <IntPatch_Line.hxx>
#include <Standard_Type.hxx>
class gp_Pnt;
class gp_Pnt2d;
class IntSurf_PntOn2S;
class IntSurf_LineOn2S;
class IntPatch_Point;
@@ -67,6 +69,17 @@ public:
//! Returns set of intersection points
Standard_EXPORT virtual Handle(IntSurf_LineOn2S) Curve() const = 0;
//! Returns TRUE if P1 is out of the box built from
//! the points on 1st surface
Standard_EXPORT virtual Standard_Boolean IsOutSurf1Box(const gp_Pnt2d& P1) const = 0;
//! Returns TRUE if P2 is out of the box built from
//! the points on 2nd surface
Standard_EXPORT virtual Standard_Boolean IsOutSurf2Box(const gp_Pnt2d& P2) const = 0;
//! Returns TRUE if P is out of the box built from 3D-points.
Standard_EXPORT virtual Standard_Boolean IsOutBox(const gp_Pnt& P) const = 0;
//! Returns the radius of curvature of
//! the intersection line in given point.
//! Returns negative value if computation is not possible.
@@ -75,7 +88,6 @@ public:
const Handle(Adaptor3d_HSurface)& theS2,
const IntSurf_PntOn2S& theUVPoint);
DEFINE_STANDARD_RTTIEXT(IntPatch_PointLine,IntPatch_Line)
protected:

View File

@@ -25,10 +25,10 @@
#include <Standard_Integer.hxx>
#include <IntPatch_SequenceOfPoint.hxx>
#include <IntPatch_PointLine.hxx>
#include <IntSurf_TypeTrans.hxx>
#include <IntSurf_LineOn2S.hxx>
#include <IntSurf_Situation.hxx>
#include <IntSurf_TypeTrans.hxx>
class Adaptor2d_HCurve2d;
class IntSurf_LineOn2S;
class Standard_DomainError;
class Standard_OutOfRange;
class IntPatch_Point;
@@ -152,6 +152,26 @@ public:
//! Returns set of intersection points
virtual Handle(IntSurf_LineOn2S) Curve() const Standard_OVERRIDE;
//! Returns TRUE if theP is out of the box built from
//! the points on 1st surface
virtual Standard_Boolean IsOutSurf1Box(const gp_Pnt2d& theP) const Standard_OVERRIDE
{
return curv->IsOutSurf1Box(theP);
}
//! Returns TRUE if theP is out of the box built from
//! the points on 2nd surface
virtual Standard_Boolean IsOutSurf2Box(const gp_Pnt2d& theP) const Standard_OVERRIDE
{
return curv->IsOutSurf2Box(theP);
}
//! Returns TRUE if theP is out of the box built from 3D-points.
virtual Standard_Boolean IsOutBox(const gp_Pnt& theP) const Standard_OVERRIDE
{
return curv->IsOutBox(theP);
}
//! Removes vertices from the line (i.e. cleans svtx member)
virtual void ClearVertexes() Standard_OVERRIDE
{

View File

@@ -49,6 +49,7 @@ class Adaptor3d_HSurfaceTool;
class IntPatch_TheSurfFunction;
class IntPatch_TheIWLineOfTheIWalking;
class IntSurf_PntOn2S;
class math_FunctionSetRoot;
class IntPatch_TheIWalking
{
@@ -150,6 +151,12 @@ protected:
//! Clears up internal containers
Standard_EXPORT void Clear();
//! Returns TRUE if thePOn2S is in one of existing lines.
Standard_EXPORT Standard_Boolean IsPointOnLine(const IntSurf_PntOn2S& thePOn2S,
const math_Vector& theInfBounds,
const math_Vector& theSupBounds,
math_FunctionSetRoot& theSolver,
IntPatch_TheSurfFunction& theFunc);

View File

@@ -46,9 +46,6 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
{
typ = IntPatch_Walking;
curv = Line;
Buv1.SetWhole();
Buv2.SetWhole();
Bxyz.SetWhole();
u1period=v1period=u2period=v2period=0.0;
}
@@ -63,9 +60,6 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
{
typ = IntPatch_Walking;
curv = Line;
Buv1.SetWhole();
Buv2.SetWhole();
Bxyz.SetWhole();
u1period=v1period=u2period=v2period=0.0;
}
@@ -78,9 +72,6 @@ IntPatch_WLine::IntPatch_WLine (const Handle(IntSurf_LineOn2S)& Line,
{
typ = IntPatch_Walking;
curv = Line;
Buv1.SetWhole();
Buv2.SetWhole();
Bxyz.SetWhole();
u1period=v1period=u2period=v2period=0.0;
}
@@ -947,87 +938,6 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
}
Standard_Boolean IntPatch_WLine::IsOutSurf1Box(const gp_Pnt2d& P1uv) {
if(Buv1.IsWhole()) {
Standard_Integer n=NbPnts();
Standard_Real pu1,pu2,pv1,pv2;
Buv1.SetVoid();
for(Standard_Integer i=1;i<=n;i++) {
curv->Value(i).Parameters(pu1,pv1,pu2,pv2);
Buv1.Add(gp_Pnt2d(pu1,pv1));
}
Buv1.Get(pu1,pv1,pu2,pv2);
pu2-=pu1;
pv2-=pv1;
if(pu2>pv2) {
Buv1.Enlarge(pu2*0.01);
}
else {
Buv1.Enlarge(pv2*0.01);
}
}
Standard_Boolean out=Buv1.IsOut(P1uv);
return(out);
}
Standard_Boolean IntPatch_WLine::IsOutSurf2Box(const gp_Pnt2d& P2uv) {
if(Buv2.IsWhole()) {
Standard_Integer n=NbPnts();
Standard_Real pu1,pu2,pv1,pv2;
Buv2.SetVoid();
for(Standard_Integer i=1;i<=n;i++) {
curv->Value(i).Parameters(pu1,pv1,pu2,pv2);
Buv2.Add(gp_Pnt2d(pu2,pv2));
}
Buv2.Get(pu1,pv1,pu2,pv2);
pu2-=pu1;
pv2-=pv1;
if(pu2>pv2) {
Buv2.Enlarge(pu2*0.01);
}
else {
Buv2.Enlarge(pv2*0.01);
}
}
Standard_Boolean out=Buv2.IsOut(P2uv);
return(out);
}
Standard_Boolean IntPatch_WLine::IsOutBox(const gp_Pnt& Pxyz) {
if(Bxyz.IsWhole()) {
Standard_Integer n=NbPnts();
Bxyz.SetVoid();
for(Standard_Integer i=1;i<=n;i++) {
gp_Pnt P=curv->Value(i).Value();
Bxyz.Add(P);
}
Standard_Real x0,y0,z0,x1,y1,z1;
Bxyz.Get(x0,y0,z0,x1,y1,z1);
x1-=x0; y1-=y0; z1-=z0;
if(x1>y1) {
if(x1>z1) {
Bxyz.Enlarge(x1*0.01);
}
else {
Bxyz.Enlarge(z1*0.01);
}
}
else {
if(y1>z1) {
Bxyz.Enlarge(y1*0.01);
}
else {
Bxyz.Enlarge(z1*0.01);
}
}
}
Standard_Boolean out=Bxyz.IsOut(Pxyz);
return(out);
}
Standard_Boolean IntPatch_WLine::HasArcOnS1() const {
return(hasArcOnS1);
}

View File

@@ -23,13 +23,11 @@
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <IntPatch_SequenceOfPoint.hxx>
#include <Bnd_Box2d.hxx>
#include <Bnd_Box.hxx>
#include <Standard_Real.hxx>
#include <IntPatch_PointLine.hxx>
#include <IntSurf_TypeTrans.hxx>
#include <IntSurf_LineOn2S.hxx>
#include <IntSurf_Situation.hxx>
class IntSurf_LineOn2S;
#include <IntSurf_TypeTrans.hxx>
class Adaptor2d_HCurve2d;
class Standard_OutOfRange;
class Standard_DomainError;
@@ -129,12 +127,26 @@ public:
//! Returns set of intersection points
Standard_EXPORT virtual Handle(IntSurf_LineOn2S) Curve() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean IsOutSurf1Box (const gp_Pnt2d& P1);
//! Returns TRUE if theP is out of the box built from
//! the points on 1st surface
Standard_Boolean IsOutSurf1Box (const gp_Pnt2d& theP) const Standard_OVERRIDE
{
return curv->IsOutSurf1Box(theP);
}
Standard_EXPORT Standard_Boolean IsOutSurf2Box (const gp_Pnt2d& P1);
Standard_EXPORT Standard_Boolean IsOutBox (const gp_Pnt& P);
//! Returns TRUE if theP is out of the box built from
//! the points on 2nd surface
Standard_Boolean IsOutSurf2Box(const gp_Pnt2d& theP) const Standard_OVERRIDE
{
return curv->IsOutSurf2Box(theP);
}
//! Returns TRUE if theP is out of the box built from 3D-points.
Standard_Boolean IsOutBox(const gp_Pnt& theP) const Standard_OVERRIDE
{
return curv->IsOutBox(theP);
}
Standard_EXPORT void SetPeriod (const Standard_Real pu1, const Standard_Real pv1, const Standard_Real pu2, const Standard_Real pv2);
Standard_EXPORT Standard_Real U1Period() const;
@@ -200,9 +212,6 @@ private:
Standard_Integer indf;
Standard_Integer indl;
IntPatch_SequenceOfPoint svtx;
Bnd_Box2d Buv1;
Bnd_Box2d Buv2;
Bnd_Box Bxyz;
Standard_Real u1period;
Standard_Real v1period;
Standard_Real u2period;