mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0023178: Intersection of cylinders fails to produce results
1. Unification of trimmed and not-trimmed cylinders processing (IntPatch_Intersection::GeomGeomPerfomTrimSurf() method has been removed). 2. Interface of IntPatch_ImpImpIntersection::Perform(...) method has been changed. 3. Now, WLine purging is forbidden for Geom-Geom-Intersection. 4. Bnd_Range class has been created. See Bnd_Range.hxx for detail information. 5. Algorithm of AddBoundaryPoint function has been improved in order to obtain intersection points in both boundaries (VFirst and VLast of every surface). 6. Earlier, method Geom2dConvert::ConcatG1(...) increased resulted B-spline degree (in case of not succession of previous iteration). Now increased value has been limited by Geom2d_BSplineCurve::MaxDegree() value (max degree = 25). 7. Algorithm of B-spline closure definition has been changed in the methods Geom2dConvert::C0BSplineToC1BSplineCurve(...) and Geom2dConvert::C0BSplineToArrayOfC1BSplineCurve(...). Creation of test case for this issue. Adjusting test cases according to their new behavior. Small correction in the code according to KGV's remark.
This commit is contained in:
@@ -62,7 +62,14 @@ public:
|
||||
//! When intersection result returns IntPatch_RLine and another
|
||||
//! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
|
||||
//! will always keep both lines even if they are coincided.
|
||||
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Boolean isTheTrimmed = Standard_False, const Standard_Boolean theIsReqToKeepRLine = Standard_False);
|
||||
Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_TopolTool)& D1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
const Handle(Adaptor3d_TopolTool)& D2,
|
||||
const Standard_Real TolArc,
|
||||
const Standard_Real TolTang,
|
||||
const Standard_Boolean theIsReqToKeepRLine =
|
||||
Standard_False);
|
||||
|
||||
//! Returns True if the calculus was succesfull.
|
||||
Standard_Boolean IsDone() const;
|
||||
@@ -71,8 +78,8 @@ public:
|
||||
Standard_Boolean IsEmpty() const;
|
||||
|
||||
//! Returns True if the two patches are considered as
|
||||
//! entierly tangent, i-e every restriction arc of one
|
||||
//! patch is inside the geometric base of the otehr patch.
|
||||
//! entirely tangent, i.e every restriction arc of one
|
||||
//! patch is inside the geometric base of the other patch.
|
||||
Standard_Boolean TangentFaces() const;
|
||||
|
||||
//! Returns True when the TangentFaces returns True and the
|
||||
|
@@ -70,16 +70,7 @@ static void ProcessBounds(const Handle(IntPatch_ALine)&,
|
||||
const Standard_Real);
|
||||
|
||||
|
||||
static Standard_Boolean IntCyCy(const IntSurf_Quadric&,
|
||||
const IntSurf_Quadric&,
|
||||
const Standard_Real,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
Standard_Boolean&,
|
||||
IntPatch_SequenceOfLine&,
|
||||
IntPatch_SequenceOfPoint&);
|
||||
|
||||
static Standard_Boolean IntCyCyTrim(const IntSurf_Quadric& theQuad1,
|
||||
static Standard_Boolean IntCyCy(const IntSurf_Quadric& theQuad1,
|
||||
const IntSurf_Quadric& theQuad2,
|
||||
const Standard_Real theTol3D,
|
||||
const Standard_Real theTol2D,
|
||||
@@ -87,6 +78,8 @@ static Standard_Boolean IntCyCyTrim(const IntSurf_Quadric& theQuad1,
|
||||
const Bnd_Box2d& theUVSurf2,
|
||||
const Standard_Boolean isTheReverse,
|
||||
Standard_Boolean& isTheEmpty,
|
||||
Standard_Boolean& isTheSameSurface,
|
||||
Standard_Boolean& isTheMultiplePoint,
|
||||
IntPatch_SequenceOfLine& theSlin,
|
||||
IntPatch_SequenceOfPoint& theSPnt);
|
||||
|
||||
|
@@ -14,6 +14,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntPatch_WLine.hxx>
|
||||
|
||||
static
|
||||
Standard_Integer SetQuad(const Handle(Adaptor3d_HSurface)& theS,
|
||||
GeomAbs_SurfaceType& theTS,
|
||||
@@ -40,7 +42,7 @@ IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection
|
||||
const Standard_Real TolTang,
|
||||
const Standard_Boolean theIsReqToKeepRLine)
|
||||
{
|
||||
Perform(S1,D1,S2,D2,TolArc,TolTang, Standard_False, theIsReqToKeepRLine);
|
||||
Perform(S1,D1,S2,D2,TolArc,TolTang, theIsReqToKeepRLine);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
@@ -52,13 +54,14 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_TopolTool)& D2,
|
||||
const Standard_Real TolArc,
|
||||
const Standard_Real TolTang,
|
||||
const Standard_Boolean isTheTrimmed,
|
||||
const Standard_Boolean theIsReqToKeepRLine) {
|
||||
const Standard_Boolean theIsReqToKeepRLine)
|
||||
{
|
||||
done = Standard_False;
|
||||
Standard_Boolean isTrimmed = isTheTrimmed;
|
||||
spnt.Clear();
|
||||
slin.Clear();
|
||||
|
||||
Standard_Boolean isPostProcessingRequired = Standard_True;
|
||||
|
||||
empt = Standard_True;
|
||||
tgte = Standard_False;
|
||||
oppo = Standard_False;
|
||||
@@ -149,59 +152,53 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||
case 22:
|
||||
{ // Cylinder/Cylinder
|
||||
Standard_Boolean isDONE = Standard_False;
|
||||
|
||||
if(!isTrimmed)
|
||||
Bnd_Box2d aBox1, aBox2;
|
||||
|
||||
const Standard_Real aU1f = S1->FirstUParameter();
|
||||
Standard_Real aU1l = S1->LastUParameter();
|
||||
const Standard_Real aU2f = S2->FirstUParameter();
|
||||
Standard_Real aU2l = S2->LastUParameter();
|
||||
|
||||
const Standard_Real anUperiod = 2.0*M_PI;
|
||||
|
||||
if(aU1l - aU1f > anUperiod)
|
||||
aU1l = aU1f + anUperiod;
|
||||
|
||||
if(aU2l - aU2f > anUperiod)
|
||||
aU2l = aU2f + anUperiod;
|
||||
|
||||
aBox1.Add(gp_Pnt2d(aU1f, S1->FirstVParameter()));
|
||||
aBox1.Add(gp_Pnt2d(aU1l, S1->LastVParameter()));
|
||||
aBox2.Add(gp_Pnt2d(aU2f, S2->FirstVParameter()));
|
||||
aBox2.Add(gp_Pnt2d(aU2l, S2->LastVParameter()));
|
||||
|
||||
// Resolution is too big if the cylinder radius is
|
||||
// too small. Therefore, we shall bounde its value above.
|
||||
// Here, we use simple constant.
|
||||
const Standard_Real a2DTol = Min(1.0e-4, Min( S1->UResolution(TolTang),
|
||||
S2->UResolution(TolTang)));
|
||||
|
||||
//The bigger range the bigger nunber of points in Walking-line (WLine)
|
||||
//we will be able to add and, consequently, we will obtain more
|
||||
//precise intersection line.
|
||||
//Every point of WLine is determined as function from U1-parameter,
|
||||
//where U1 is U-parameter on 1st quadric.
|
||||
//Therefore, we should use quadric with bigger range as 1st parameter
|
||||
//in IntCyCy() function.
|
||||
//On the other hand, there is no point in reversing in case of
|
||||
//analytical intersection (when result is line, ellipse, point...).
|
||||
//This result is independent of the arguments order.
|
||||
Standard_Boolean isReversed = ((aU2l - aU2f) < (aU1l - aU1f));
|
||||
|
||||
if(isReversed)
|
||||
{
|
||||
isDONE = IntCyCy(quad1, quad2, TolTang, empt,
|
||||
SameSurf, multpoint, slin, spnt);
|
||||
isDONE = IntCyCy(quad2, quad1, TolTang, a2DTol, aBox2, aBox1,
|
||||
Standard_True, empt, SameSurf, multpoint, slin, spnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bnd_Box2d aBox1, aBox2;
|
||||
|
||||
const Standard_Real aU1f = S1->FirstUParameter();
|
||||
Standard_Real aU1l = S1->LastUParameter();
|
||||
const Standard_Real aU2f = S2->FirstUParameter();
|
||||
Standard_Real aU2l = S2->LastUParameter();
|
||||
|
||||
const Standard_Real anUperiod = 2.0*M_PI;
|
||||
|
||||
if(aU1l - aU1f > anUperiod)
|
||||
aU1l = aU1f + anUperiod;
|
||||
|
||||
if(aU2l - aU2f > anUperiod)
|
||||
aU2l = aU2f + anUperiod;
|
||||
|
||||
aBox1.Add(gp_Pnt2d(aU1f, S1->FirstVParameter()));
|
||||
aBox1.Add(gp_Pnt2d(aU1l, S1->LastVParameter()));
|
||||
aBox2.Add(gp_Pnt2d(aU2f, S2->FirstVParameter()));
|
||||
aBox2.Add(gp_Pnt2d(aU2l, S2->LastVParameter()));
|
||||
|
||||
// Resolution is too big if the cylinder radius is
|
||||
// too small. Therefore, we shall bounde its value above.
|
||||
// Here, we use simple constant.
|
||||
const Standard_Real a2DTol = Min(1.0e-4, Min( S1->UResolution(TolTang),
|
||||
S2->UResolution(TolTang)));
|
||||
|
||||
Standard_Boolean isReversed = ((aU2l - aU2f) < (aU1l - aU1f));
|
||||
|
||||
if(isReversed)
|
||||
{
|
||||
isDONE = IntCyCyTrim(quad2, quad1, TolTang, a2DTol, aBox2, aBox1,
|
||||
isReversed, empt, slin, spnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
isDONE = IntCyCyTrim(quad1, quad2, TolTang, a2DTol, aBox1, aBox2,
|
||||
isReversed, empt, slin, spnt);
|
||||
}
|
||||
|
||||
if(!isDONE)
|
||||
{
|
||||
isDONE = IntCyCy(quad1, quad2, TolTang, empt,
|
||||
SameSurf, multpoint, slin, spnt);
|
||||
isTrimmed = Standard_False;
|
||||
}
|
||||
isDONE = IntCyCy(quad1, quad2, TolTang, a2DTol, aBox1, aBox2,
|
||||
Standard_False, empt, SameSurf, multpoint, slin, spnt);
|
||||
}
|
||||
|
||||
if (!isDONE)
|
||||
@@ -210,6 +207,17 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||
}
|
||||
|
||||
bEmpty = empt;
|
||||
if(!slin.IsEmpty())
|
||||
{
|
||||
const Handle(IntPatch_WLine)& aWLine =
|
||||
Handle(IntPatch_WLine)::DownCast(slin.Value(1));
|
||||
|
||||
if(!aWLine.IsNull())
|
||||
{//No geometric solution
|
||||
isPostProcessingRequired = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
//
|
||||
@@ -302,7 +310,7 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||
}
|
||||
//
|
||||
|
||||
if(!isTrimmed)
|
||||
if(isPostProcessingRequired)
|
||||
{
|
||||
if (!SameSurf) {
|
||||
AFunc.SetQuadric(quad2);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -917,18 +917,9 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
|
||||
ListOfPnts.Clear();
|
||||
if(isGeomInt)
|
||||
{
|
||||
if(theD1->DomainIsInfinite() || theD2->DomainIsInfinite())
|
||||
{
|
||||
GeomGeomPerfom( theS1, theD1, theS2, theD2, TolArc,
|
||||
TolTang, ListOfPnts, RestrictLine,
|
||||
typs1, typs2, theIsReqToKeepRLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
GeomGeomPerfomTrimSurf( theS1, theD1, theS2, theD2,
|
||||
TolArc, TolTang, ListOfPnts, RestrictLine,
|
||||
typs1, typs2, theIsReqToKeepRLine);
|
||||
}
|
||||
GeomGeomPerfom( theS1, theD1, theS2, theD2, TolArc,
|
||||
TolTang, ListOfPnts, RestrictLine,
|
||||
typs1, typs2, theIsReqToKeepRLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1182,16 +1173,8 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& theS1,
|
||||
}
|
||||
else if(ts1 == 1)
|
||||
{
|
||||
if(theD1->DomainIsInfinite() || theD2->DomainIsInfinite())
|
||||
{
|
||||
GeomGeomPerfom(theS1, theD1, theS2, theD2, TolArc,
|
||||
TolTang, ListOfPnts, RestrictLine, typs1, typs2, theIsReqToKeepRLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
GeomGeomPerfomTrimSurf(theS1, theD1, theS2, theD2,
|
||||
TolArc, TolTang, ListOfPnts, RestrictLine, typs1, typs2, theIsReqToKeepRLine);
|
||||
}
|
||||
GeomGeomPerfom(theS1, theD1, theS2, theD2, TolArc,
|
||||
TolTang, ListOfPnts, RestrictLine, typs1, typs2, theIsReqToKeepRLine);
|
||||
}
|
||||
|
||||
if(!theIsReqToPostWLProc)
|
||||
@@ -1438,7 +1421,36 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& the
|
||||
slin.Append(wlin);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(line->ArcType() == IntPatch_Walking)
|
||||
{
|
||||
Handle(IntPatch_WLine)::DownCast(line)->EnablePurging(Standard_False);
|
||||
}
|
||||
|
||||
slin.Append(line);
|
||||
}
|
||||
}
|
||||
|
||||
for (Standard_Integer i = 1; i <= interii.NbPnts(); i++)
|
||||
{
|
||||
spnt.Append(interii.Point(i));
|
||||
}
|
||||
|
||||
if((theTyps1 == GeomAbs_Cylinder) && (theTyps2 == GeomAbs_Cylinder))
|
||||
{
|
||||
IntPatch_WLineTool::JoinWLines( slin, spnt, TolTang,
|
||||
theS1->IsUPeriodic()? theS1->UPeriod() : 0.0,
|
||||
theS2->IsUPeriodic()? theS2->UPeriod() : 0.0,
|
||||
theS1->IsVPeriodic()? theS1->VPeriod() : 0.0,
|
||||
theS2->IsVPeriodic()? theS2->VPeriod() : 0.0,
|
||||
theS1->FirstUParameter(),
|
||||
theS1->LastUParameter(),
|
||||
theS1->FirstVParameter(),
|
||||
theS1->LastVParameter(),
|
||||
theS2->FirstUParameter(),
|
||||
theS2->LastUParameter(),
|
||||
theS2->FirstVParameter(),
|
||||
theS2->LastVParameter());
|
||||
}
|
||||
|
||||
if(isQuadSet)
|
||||
@@ -1472,11 +1484,6 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_HSurface)& the
|
||||
theS2->IsVPeriodic()? theS2->VPeriod() : 0.0,
|
||||
aBx1, aBx2);
|
||||
}
|
||||
|
||||
for (Standard_Integer i = 1; i <= interii.NbPnts(); i++)
|
||||
{
|
||||
spnt.Append(interii.Point(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1568,84 +1575,6 @@ void IntPatch_Intersection::
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomGeomPerfomTrimSurf
|
||||
//purpose : This function returns ready walking-line (which is not need
|
||||
// in convertation) as an intersection line between two
|
||||
// trimmed surfaces.
|
||||
//=======================================================================
|
||||
void IntPatch_Intersection::
|
||||
GeomGeomPerfomTrimSurf( const Handle(Adaptor3d_HSurface)& theS1,
|
||||
const Handle(Adaptor3d_TopolTool)& theD1,
|
||||
const Handle(Adaptor3d_HSurface)& theS2,
|
||||
const Handle(Adaptor3d_TopolTool)& theD2,
|
||||
const Standard_Real theTolArc,
|
||||
const Standard_Real theTolTang,
|
||||
IntSurf_ListOfPntOn2S& theListOfPnts,
|
||||
const Standard_Boolean RestrictLine,
|
||||
const GeomAbs_SurfaceType theTyps1,
|
||||
const GeomAbs_SurfaceType theTyps2,
|
||||
const Standard_Boolean theIsReqToKeepRLine)
|
||||
{
|
||||
IntSurf_Quadric Quad1,Quad2;
|
||||
|
||||
if((theTyps1 == GeomAbs_Cylinder) && (theTyps2 == GeomAbs_Cylinder))
|
||||
{
|
||||
IntPatch_ImpImpIntersection anInt;
|
||||
anInt.Perform(theS1, theD1, theS2, theD2, myTolArc,
|
||||
myTolTang, Standard_True, theIsReqToKeepRLine);
|
||||
|
||||
done = anInt.IsDone();
|
||||
|
||||
if(done)
|
||||
{
|
||||
empt = anInt.IsEmpty();
|
||||
if (!empt)
|
||||
{
|
||||
tgte = anInt.TangentFaces();
|
||||
if (tgte)
|
||||
oppo = anInt.OppositeFaces();
|
||||
|
||||
const Standard_Integer aNbLin = anInt.NbLines();
|
||||
const Standard_Integer aNbPts = anInt.NbPnts();
|
||||
|
||||
for(Standard_Integer aLID = 1; aLID <= aNbLin; aLID++)
|
||||
{
|
||||
const Handle(IntPatch_Line)& aLine = anInt.Line(aLID);
|
||||
slin.Append(aLine);
|
||||
}
|
||||
|
||||
for(Standard_Integer aPID = 1; aPID <= aNbPts; aPID++)
|
||||
{
|
||||
const IntPatch_Point& aPoint = anInt.Point(aPID);
|
||||
spnt.Append(aPoint);
|
||||
}
|
||||
|
||||
IntPatch_WLineTool::JoinWLines( slin, spnt, theTolTang,
|
||||
theS1->IsUPeriodic()? theS1->UPeriod() : 0.0,
|
||||
theS2->IsUPeriodic()? theS2->UPeriod() : 0.0,
|
||||
theS1->IsVPeriodic()? theS1->VPeriod() : 0.0,
|
||||
theS2->IsVPeriodic()? theS2->VPeriod() : 0.0,
|
||||
theS1->FirstUParameter(),
|
||||
theS1->LastUParameter(),
|
||||
theS1->FirstVParameter(),
|
||||
theS1->LastVParameter(),
|
||||
theS2->FirstUParameter(),
|
||||
theS2->LastUParameter(),
|
||||
theS2->FirstVParameter(),
|
||||
theS2->LastVParameter());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GeomGeomPerfom(theS1, theD1, theS2, theD2,
|
||||
theTolArc, theTolTang, theListOfPnts,
|
||||
RestrictLine, theTyps1, theTyps2, theIsReqToKeepRLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IntPatch_Intersection::Perform(const Handle(Adaptor3d_HSurface)& S1,
|
||||
const Handle(Adaptor3d_TopolTool)& D1,
|
||||
const Handle(Adaptor3d_HSurface)& S2,
|
||||
|
@@ -167,14 +167,6 @@ private:
|
||||
//! will always keep both lines even if they are coincided.
|
||||
Standard_EXPORT void GeomGeomPerfom (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2, const Standard_Boolean theIsReqToKeepRLine = Standard_False);
|
||||
|
||||
//! Flag theIsReqToKeepRLine has been enterred only for
|
||||
//! compatibility with TopOpeBRep package. It shall be deleted
|
||||
//! after deleting TopOpeBRep.
|
||||
//! When intersection result returns IntPatch_RLine and another
|
||||
//! IntPatch_Line (not restriction) we (in case of theIsReqToKeepRLine==TRUE)
|
||||
//! will always keep both lines even if they are coincided.
|
||||
Standard_EXPORT void GeomGeomPerfomTrimSurf (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Real TolArc, const Standard_Real TolTang, IntSurf_ListOfPntOn2S& LOfPnts, const Standard_Boolean RestrictLine, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2, const Standard_Boolean theIsReqToKeepRLine = Standard_False);
|
||||
|
||||
Standard_EXPORT void GeomParamPerfom (const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& D2, const Standard_Boolean isNotAnalitical, const GeomAbs_SurfaceType typs1, const GeomAbs_SurfaceType typs2);
|
||||
|
||||
|
||||
|
@@ -17,6 +17,9 @@
|
||||
#include <Adaptor3d_TopolTool.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
// It is pure empirical value.
|
||||
const Standard_Real IntPatch_WLineTool::myMaxConcatAngle = M_PI/6;
|
||||
|
||||
//Bit-mask is used for information about
|
||||
//the operation made in
|
||||
//IntPatch_WLineTool::ExtendTwoWlinesToEachOther() method.
|
||||
@@ -830,27 +833,26 @@ static Standard_Boolean IsOutOfDomain(const Bnd_Box2d& theBoxS1,
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckArguments
|
||||
//function : CheckArgumentsToExtend
|
||||
//purpose : Check if extending is possible
|
||||
// (see IntPatch_WLineTool::ExtendTwoWlinesToEachOther)
|
||||
//=======================================================================
|
||||
static Standard_Boolean CheckArguments(const IntSurf_Quadric& theS1,
|
||||
const IntSurf_Quadric& theS2,
|
||||
const IntSurf_PntOn2S& thePtWL1,
|
||||
const IntSurf_PntOn2S& thePtWL2,
|
||||
IntSurf_PntOn2S& theNewPoint,
|
||||
const gp_Vec& theVec1,
|
||||
const gp_Vec& theVec2,
|
||||
const gp_Vec& theVec3,
|
||||
const Bnd_Box2d& theBoxS1,
|
||||
const Bnd_Box2d& theBoxS2,
|
||||
const Standard_Real theToler3D,
|
||||
const Standard_Real theU1Period,
|
||||
const Standard_Real theU2Period,
|
||||
const Standard_Real theV1Period,
|
||||
const Standard_Real theV2Period)
|
||||
Standard_Boolean CheckArgumentsToExtend(const IntSurf_Quadric& theS1,
|
||||
const IntSurf_Quadric& theS2,
|
||||
const IntSurf_PntOn2S& thePtWL1,
|
||||
const IntSurf_PntOn2S& thePtWL2,
|
||||
IntSurf_PntOn2S& theNewPoint,
|
||||
const gp_Vec& theVec1,
|
||||
const gp_Vec& theVec2,
|
||||
const gp_Vec& theVec3,
|
||||
const Bnd_Box2d& theBoxS1,
|
||||
const Bnd_Box2d& theBoxS2,
|
||||
const Standard_Real theToler3D,
|
||||
const Standard_Real theU1Period,
|
||||
const Standard_Real theU2Period,
|
||||
const Standard_Real theV1Period,
|
||||
const Standard_Real theV2Period)
|
||||
{
|
||||
const Standard_Real aMaxAngle = M_PI/6; //30 degree
|
||||
const Standard_Real aSqToler = theToler3D*theToler3D;
|
||||
|
||||
if(theVec3.SquareMagnitude() <= aSqToler)
|
||||
@@ -858,9 +860,9 @@ static Standard_Boolean CheckArguments(const IntSurf_Quadric& theS1,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if((theVec1.Angle(theVec2) > aMaxAngle) ||
|
||||
(theVec1.Angle(theVec3) > aMaxAngle) ||
|
||||
(theVec2.Angle(theVec3) > aMaxAngle))
|
||||
if((theVec1.Angle(theVec2) > IntPatch_WLineTool::myMaxConcatAngle) ||
|
||||
(theVec1.Angle(theVec3) > IntPatch_WLineTool::myMaxConcatAngle) ||
|
||||
(theVec2.Angle(theVec3) > IntPatch_WLineTool::myMaxConcatAngle))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -907,6 +909,20 @@ static Standard_Boolean CheckArguments(const IntSurf_Quadric& theS1,
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckArgumentsToJoin
|
||||
//purpose : Check if joining is possible
|
||||
// (see IntPatch_WLineTool::JoinWLines)
|
||||
//=======================================================================
|
||||
Standard_Boolean CheckArgumentsToJoin(const gp_Vec& theVec1,
|
||||
const gp_Vec& theVec2)
|
||||
{
|
||||
// [0, PI] - range
|
||||
const Standard_Real anAngle = theVec1.Angle(theVec2);
|
||||
|
||||
return (anAngle < IntPatch_WLineTool::myMaxConcatAngle);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtendTwoWLFirstFirst
|
||||
//purpose : Performs extending theWLine1 and theWLine2 through their
|
||||
@@ -932,10 +948,10 @@ static void ExtendTwoWLFirstFirst(const IntSurf_Quadric& theS1,
|
||||
Standard_Boolean &theHasBeenJoined)
|
||||
{
|
||||
IntSurf_PntOn2S aPOn2S;
|
||||
if(!CheckArguments(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
if(!CheckArgumentsToExtend(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1006,10 +1022,10 @@ static void ExtendTwoWLFirstLast(const IntSurf_Quadric& theS1,
|
||||
Standard_Boolean &theHasBeenJoined)
|
||||
{
|
||||
IntSurf_PntOn2S aPOn2S;
|
||||
if(!CheckArguments(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
if(!CheckArgumentsToExtend(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1078,10 +1094,10 @@ static void ExtendTwoWLLastFirst(const IntSurf_Quadric& theS1,
|
||||
Standard_Boolean &theHasBeenJoined)
|
||||
{
|
||||
IntSurf_PntOn2S aPOn2S;
|
||||
if(!CheckArguments(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
if(!CheckArgumentsToExtend(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1146,10 +1162,10 @@ static void ExtendTwoWLLastLast(const IntSurf_Quadric& theS1,
|
||||
Standard_Boolean &theHasBeenJoined)
|
||||
{
|
||||
IntSurf_PntOn2S aPOn2S;
|
||||
if(!CheckArguments(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
if(!CheckArgumentsToExtend(theS1, theS2, thePtWL1, thePtWL2, aPOn2S,
|
||||
theVec1, theVec2, theVec3,
|
||||
theBoxS1, theBoxS2, theToler3D,
|
||||
theU1Period, theU2Period, theV1Period, theV2Period))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1387,10 +1403,19 @@ void IntPatch_WLineTool::JoinWLines(IntPatch_SequenceOfLine& theSlin,
|
||||
{
|
||||
const IntSurf_PntOn2S& aPt1 = aWLine1->Point(2);
|
||||
const IntSurf_PntOn2S& aPt2 = aWLine2->Point(2);
|
||||
if(!IsSeamOrBound(aPt1, aPt2, aPntFWL1, theU1Period, theU2Period,
|
||||
theV1Period, theV2Period, theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1, theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2))
|
||||
Standard_Boolean aCond =
|
||||
CheckArgumentsToJoin(gp_Vec(aPntFWL1.Value(), aPt1.Value()),
|
||||
gp_Vec(aPt2.Value(), aPntFWL2.Value()));
|
||||
|
||||
aCond = aCond && !IsSeamOrBound(aPt1, aPt2, aPntFWL1,
|
||||
theU1Period, theU2Period,
|
||||
theV1Period, theV2Period,
|
||||
theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1,
|
||||
theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2);
|
||||
|
||||
if(aCond)
|
||||
{
|
||||
aWLine1->ClearVertexes();
|
||||
for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
|
||||
@@ -1413,10 +1438,20 @@ void IntPatch_WLineTool::JoinWLines(IntPatch_SequenceOfLine& theSlin,
|
||||
{
|
||||
const IntSurf_PntOn2S& aPt1 = aWLine1->Point(2);
|
||||
const IntSurf_PntOn2S& aPt2 = aWLine2->Point(aNbPntsWL2-1);
|
||||
if(!IsSeamOrBound(aPt1, aPt2, aPntFWL1, theU1Period, theU2Period,
|
||||
theV1Period, theV2Period, theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1, theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2))
|
||||
|
||||
Standard_Boolean aCond =
|
||||
CheckArgumentsToJoin(gp_Vec(aPntFWL1.Value(), aPt1.Value()),
|
||||
gp_Vec(aPt2.Value(), aPntLWL2.Value()));
|
||||
|
||||
aCond = aCond && !IsSeamOrBound(aPt1, aPt2, aPntFWL1,
|
||||
theU1Period, theU2Period,
|
||||
theV1Period, theV2Period,
|
||||
theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1,
|
||||
theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2);
|
||||
|
||||
if(aCond)
|
||||
{
|
||||
aWLine1->ClearVertexes();
|
||||
for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
|
||||
@@ -1439,10 +1474,20 @@ void IntPatch_WLineTool::JoinWLines(IntPatch_SequenceOfLine& theSlin,
|
||||
{
|
||||
const IntSurf_PntOn2S& aPt1 = aWLine1->Point(aNbPntsWL1-1);
|
||||
const IntSurf_PntOn2S& aPt2 = aWLine2->Point(2);
|
||||
if(!IsSeamOrBound(aPt1, aPt2, aPntLWL1, theU1Period, theU2Period,
|
||||
theV1Period, theV2Period, theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1, theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2))
|
||||
|
||||
Standard_Boolean aCond =
|
||||
CheckArgumentsToJoin(gp_Vec(aPt1.Value(), aPntLWL1.Value()),
|
||||
gp_Vec(aPntFWL2.Value(), aPt2.Value()));
|
||||
|
||||
aCond = aCond && !IsSeamOrBound(aPt1, aPt2, aPntLWL1,
|
||||
theU1Period, theU2Period,
|
||||
theV1Period, theV2Period,
|
||||
theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1,
|
||||
theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2);
|
||||
|
||||
if(aCond)
|
||||
{
|
||||
aWLine1->ClearVertexes();
|
||||
for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
|
||||
@@ -1465,10 +1510,20 @@ void IntPatch_WLineTool::JoinWLines(IntPatch_SequenceOfLine& theSlin,
|
||||
{
|
||||
const IntSurf_PntOn2S& aPt1 = aWLine1->Point(aNbPntsWL1-1);
|
||||
const IntSurf_PntOn2S& aPt2 = aWLine2->Point(aNbPntsWL2-1);
|
||||
if(!IsSeamOrBound(aPt1, aPt2, aPntLWL1, theU1Period, theU2Period,
|
||||
theV1Period, theV2Period, theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1, theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2))
|
||||
|
||||
Standard_Boolean aCond =
|
||||
CheckArgumentsToJoin(gp_Vec(aPt1.Value(), aPntLWL1.Value()),
|
||||
gp_Vec(aPntLWL2.Value(), aPt2.Value()));
|
||||
|
||||
aCond = aCond && !IsSeamOrBound(aPt1, aPt2, aPntLWL1,
|
||||
theU1Period, theU2Period,
|
||||
theV1Period, theV2Period,
|
||||
theUfSurf1, theUlSurf1,
|
||||
theVfSurf1, theVlSurf1,
|
||||
theUfSurf2, theUlSurf2,
|
||||
theVfSurf2, theVlSurf2);
|
||||
|
||||
if(aCond)
|
||||
{
|
||||
aWLine1->ClearVertexes();
|
||||
for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
|
||||
|
@@ -96,6 +96,9 @@ public:
|
||||
const Standard_Real theV2Period,
|
||||
const Bnd_Box2d& theBoxS1,
|
||||
const Bnd_Box2d& theBoxS2);
|
||||
|
||||
//! Max angle to concatenate two WLines to avoid result with C0-continuity
|
||||
static const Standard_Real myMaxConcatAngle;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user