1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +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

@@ -20,9 +20,13 @@
IMPLEMENT_STANDARD_RTTIEXT(IntSurf_LineOn2S,Standard_Transient)
IntSurf_LineOn2S::IntSurf_LineOn2S (const IntSurf_Allocator& theAllocator) :
mySeq (theAllocator)
{}
IntSurf_LineOn2S::
IntSurf_LineOn2S(const IntSurf_Allocator& theAllocator) : mySeq(theAllocator)
{
myBuv1.SetWhole();
myBuv2.SetWhole();
myBxyz.SetWhole();
}
Handle(IntSurf_LineOn2S) IntSurf_LineOn2S::Split (const Standard_Integer Index)
@@ -46,8 +50,124 @@ void IntSurf_LineOn2S::InsertBefore(const Standard_Integer index, const IntSurf_
else {
mySeq.InsertBefore(index,P);
}
if (!myBxyz.IsWhole())
{
myBxyz.Add(P.Value());
}
if (!myBuv1.IsWhole())
{
myBuv1.Add(P.ValueOnSurface(Standard_True));
}
if (!myBuv2.IsWhole())
{
myBuv2.Add(P.ValueOnSurface(Standard_False));
}
}
void IntSurf_LineOn2S::RemovePoint(const Standard_Integer index) {
mySeq.Remove(index);
myBuv1.SetWhole();
myBuv2.SetWhole();
myBxyz.SetWhole();
}
Standard_Boolean IntSurf_LineOn2S::IsOutBox(const gp_Pnt& Pxyz)
{
if (myBxyz.IsWhole())
{
Standard_Integer n = NbPoints();
myBxyz.SetVoid();
for (Standard_Integer i = 1; i <= n; i++)
{
gp_Pnt P = mySeq(i).Value();
myBxyz.Add(P);
}
Standard_Real x0, y0, z0, x1, y1, z1;
myBxyz.Get(x0, y0, z0, x1, y1, z1);
x1 -= x0; y1 -= y0; z1 -= z0;
if (x1>y1)
{
if (x1>z1)
{
myBxyz.Enlarge(x1*0.01);
}
else
{
myBxyz.Enlarge(z1*0.01);
}
}
else
{
if (y1>z1)
{
myBxyz.Enlarge(y1*0.01);
}
else
{
myBxyz.Enlarge(z1*0.01);
}
}
}
Standard_Boolean out = myBxyz.IsOut(Pxyz);
return(out);
}
Standard_Boolean IntSurf_LineOn2S::IsOutSurf1Box(const gp_Pnt2d& P1uv)
{
if (myBuv1.IsWhole())
{
Standard_Integer n = NbPoints();
Standard_Real pu1, pu2, pv1, pv2;
myBuv1.SetVoid();
for (Standard_Integer i = 1; i <= n; i++)
{
mySeq(i).Parameters(pu1, pv1, pu2, pv2);
myBuv1.Add(gp_Pnt2d(pu1, pv1));
}
myBuv1.Get(pu1, pv1, pu2, pv2);
pu2 -= pu1;
pv2 -= pv1;
if (pu2>pv2)
{
myBuv1.Enlarge(pu2*0.01);
}
else
{
myBuv1.Enlarge(pv2*0.01);
}
}
Standard_Boolean out = myBuv1.IsOut(P1uv);
return(out);
}
Standard_Boolean IntSurf_LineOn2S::IsOutSurf2Box(const gp_Pnt2d& P2uv)
{
if (myBuv2.IsWhole())
{
Standard_Integer n = NbPoints();
Standard_Real pu1, pu2, pv1, pv2;
myBuv2.SetVoid();
for (Standard_Integer i = 1; i <= n; i++)
{
mySeq(i).Parameters(pu1, pv1, pu2, pv2);
myBuv2.Add(gp_Pnt2d(pu2, pv2));
}
myBuv2.Get(pu1, pv1, pu2, pv2);
pu2 -= pu1;
pv2 -= pv1;
if (pu2>pv2)
{
myBuv2.Enlarge(pu2*0.01);
}
else
{
myBuv2.Enlarge(pv2*0.01);
}
}
Standard_Boolean out = myBuv2.IsOut(P2uv);
return(out);
}

View File

@@ -20,6 +20,8 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_Box2d.hxx>
#include <IntSurf_SequenceOfPntOn2S.hxx>
#include <Standard_Transient.hxx>
#include <IntSurf_Allocator.hxx>
@@ -71,8 +73,16 @@ public:
Standard_EXPORT void RemovePoint (const Standard_Integer I);
//! Returns TRUE if theP is out of the box built from
//! the points on 1st surface
Standard_EXPORT Standard_Boolean IsOutSurf1Box(const gp_Pnt2d& theP);
//! Returns TRUE if theP is out of the box built from
//! the points on 2nd surface
Standard_EXPORT Standard_Boolean IsOutSurf2Box(const gp_Pnt2d& theP);
//! Returns TRUE if theP is out of the box built from 3D-points.
Standard_EXPORT Standard_Boolean IsOutBox(const gp_Pnt& theP);
DEFINE_STANDARD_RTTIEXT(IntSurf_LineOn2S,Standard_Transient)
@@ -85,7 +95,9 @@ private:
IntSurf_SequenceOfPntOn2S mySeq;
Bnd_Box2d myBuv1;
Bnd_Box2d myBuv2;
Bnd_Box myBxyz;
};

View File

@@ -18,8 +18,21 @@
inline void IntSurf_LineOn2S::Add(const IntSurf_PntOn2S& P) {
mySeq.Append(P);
if (!myBxyz.IsWhole())
{
myBxyz.Add(P.Value());
}
if (!myBuv1.IsWhole())
{
myBuv1.Add(P.ValueOnSurface(Standard_True));
}
if (!myBuv2.IsWhole())
{
myBuv2.Add(P.ValueOnSurface(Standard_False));
}
}
@@ -53,10 +66,22 @@ inline void IntSurf_LineOn2S::SetUV(const Standard_Integer Index,
const Standard_Real V)
{
mySeq(Index).SetValue(OnFirst,U,V);
if (OnFirst && !myBuv1.IsWhole())
{
myBuv1.Add(gp_Pnt2d(U,V));
}
else if (!OnFirst && !myBuv2.IsWhole())
{
myBuv2.Add(gp_Pnt2d(U,V));
}
}
inline void IntSurf_LineOn2S::Clear ()
{
mySeq.Clear();
myBuv1.SetWhole();
myBuv2.SetWhole();
myBxyz.SetWhole();
}