mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
51 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b079fb9877 | ||
|
608fba03ab | ||
|
a626c346b4 | ||
|
1955914e73 | ||
|
a3e117be2c | ||
|
459e7b77ab | ||
|
2fc4884b88 | ||
|
1f02c1903a | ||
|
6ecfaf3ab6 | ||
|
89ecea11d2 | ||
|
c4e1d8c918 | ||
|
b776f4ee07 | ||
|
90e61140aa | ||
|
19a49b8e74 | ||
|
fd29020f87 | ||
|
c4ca00a26f | ||
|
507ead3c5a | ||
|
77003e1894 | ||
|
4931fcd8a9 | ||
|
1c96596ae7 | ||
|
bb368e271e | ||
|
04ecb233f2 | ||
|
dbfb0666b2 | ||
|
c74b60ab81 | ||
|
3d41db2138 | ||
|
43764346a1 | ||
|
3c61e8f7e0 | ||
|
da9cb57f57 | ||
|
60490a5c19 | ||
|
2b5fcf89b2 | ||
|
99ee8eb9d3 | ||
|
b9a5469aa1 | ||
|
c004c09c9e | ||
|
f15afeb84b | ||
|
488b78ed3c | ||
|
6faa1bd160 | ||
|
00be1552ed | ||
|
a2bacd54f4 | ||
|
d2abb6d844 | ||
|
e697b85307 | ||
|
9967602647 | ||
|
e1a92d9ef0 | ||
|
730b9ecc2d | ||
|
336e2cdeda | ||
|
e5021ff47f | ||
|
9735948819 | ||
|
660a8938a3 | ||
|
642ddd1253 | ||
|
03fc07c28b | ||
|
2e84f455db | ||
|
2d7f390051 |
@@ -661,8 +661,10 @@ endif()
|
||||
if (CAN_USE_GLES2)
|
||||
if (USE_GLES2)
|
||||
add_definitions (-DHAVE_GLES2_EXT)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
|
||||
if (NOT IOS)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
|
||||
|
@@ -173,8 +173,17 @@ static Standard_Real ComputeTolReached(const Handle(Adaptor3d_Curve)& c3d,
|
||||
{
|
||||
Standard_Real t = IntToReal(i) / IntToReal(nbp);
|
||||
Standard_Real u = first * (1.0 - t) + last * t;
|
||||
gp_Pnt Pc3d = c3d->Value(u);
|
||||
gp_Pnt Pcons = cons.Value(u);
|
||||
gp_Pnt Pc3d, Pcons;
|
||||
try
|
||||
{
|
||||
Pc3d = c3d->Value(u);
|
||||
Pcons = cons.Value(u);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
d2 = Precision::Infinite();
|
||||
break;
|
||||
}
|
||||
if (Precision::IsInfinite(Pcons.X()) ||
|
||||
Precision::IsInfinite(Pcons.Y()) ||
|
||||
Precision::IsInfinite(Pcons.Z()))
|
||||
|
@@ -91,7 +91,7 @@ static void ComputeTrsf2d(const Handle(TheWLine)& theline,
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Parameters(const ApproxInt_TheMultiLine& Line,
|
||||
void ApproxInt_Approx::Parameters(const ApproxInt_TheMultiLine& Line,
|
||||
const Standard_Integer firstP,
|
||||
const Standard_Integer lastP,
|
||||
const Approx_ParametrizationType Par,
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#include <Precision.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <GeomInt_WLApprox.hxx>
|
||||
#include <GeomInt_TheMultiLineOfWLApprox.hxx>
|
||||
|
||||
// (Sqrt(5.0) - 1.0) / 4.0
|
||||
//static const Standard_Real aSinCoeff = 0.30901699437494742410229341718282;
|
||||
@@ -88,6 +90,94 @@ static Standard_Real EvalCurv(const Standard_Real dim,
|
||||
return curv;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BuildCurvature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ApproxInt_KnotTools::BuildCurvature(
|
||||
const NCollection_LocalArray<Standard_Real>& theCoords,
|
||||
const Standard_Integer theDim,
|
||||
const math_Vector& thePars,
|
||||
TColStd_Array1OfReal& theCurv,
|
||||
Standard_Real& theMaxCurv)
|
||||
{
|
||||
// Arrays are allocated for max theDim = 7: 1 3d curve + 2 2d curves.
|
||||
Standard_Real Val[21], Par[3], Res[21];
|
||||
Standard_Integer i, j, m, ic;
|
||||
Standard_Integer dim = theDim;
|
||||
//
|
||||
theMaxCurv = 0.;
|
||||
if (theCurv.Length() < 3)
|
||||
{
|
||||
theCurv.Init(0.);
|
||||
return;
|
||||
}
|
||||
i = theCurv.Lower();
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i + j;
|
||||
ic = (k - theCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for (m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[0], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
theCurv(i) = EvalCurv(dim, &Res[dim], &Res[2 * dim]);
|
||||
//
|
||||
if (theCurv(i) > theMaxCurv)
|
||||
{
|
||||
theMaxCurv = theCurv(i);
|
||||
}
|
||||
//
|
||||
for (i = theCurv.Lower() + 1; i < theCurv.Upper(); ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i + j - 1;
|
||||
ic = (k - theCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for (m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[1], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
theCurv(i) = EvalCurv(dim, &Res[dim], &Res[2 * dim]);
|
||||
if (theCurv(i) > theMaxCurv)
|
||||
{
|
||||
theMaxCurv = theCurv(i);
|
||||
}
|
||||
}
|
||||
//
|
||||
i = theCurv.Upper();
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i + j - 2;
|
||||
ic = (k - theCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for (m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[2], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
theCurv(i) = EvalCurv(dim, &Res[dim], &Res[2 * dim]);
|
||||
if (theCurv(i) > theMaxCurv)
|
||||
{
|
||||
theMaxCurv = theCurv(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeKnotInds
|
||||
//purpose :
|
||||
@@ -100,75 +190,10 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
|
||||
//I: Create discrete curvature.
|
||||
NCollection_Sequence<Standard_Integer> aFeatureInds;
|
||||
TColStd_Array1OfReal aCurv(thePars.Lower(), thePars.Upper());
|
||||
// Arrays are allocated for max theDim = 7: 1 3d curve + 2 2d curves.
|
||||
Standard_Real Val[21], Par[3], Res[21];
|
||||
Standard_Integer i, j, m, ic;
|
||||
Standard_Real aMaxCurv = 0.;
|
||||
Standard_Integer dim = theDim;
|
||||
//
|
||||
i = aCurv.Lower();
|
||||
for(j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i+j;
|
||||
ic = (k - aCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for(m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[0], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
aCurv(i) = EvalCurv(dim, &Res[dim], &Res[2*dim]);
|
||||
//
|
||||
if(aCurv(i) > aMaxCurv)
|
||||
{
|
||||
aMaxCurv = aCurv(i);
|
||||
}
|
||||
//
|
||||
for(i = aCurv.Lower()+1; i < aCurv.Upper(); ++i)
|
||||
{
|
||||
for(j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i+j-1;
|
||||
ic = (k - aCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for(m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[1], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
aCurv(i) = EvalCurv(dim, &Res[dim], &Res[2*dim]);
|
||||
if(aCurv(i) > aMaxCurv)
|
||||
{
|
||||
aMaxCurv = aCurv(i);
|
||||
}
|
||||
}
|
||||
//
|
||||
i = aCurv.Upper();
|
||||
for(j = 0; j < 3; ++j)
|
||||
{
|
||||
Standard_Integer k = i+j-2;
|
||||
ic = (k - aCurv.Lower()) * dim;
|
||||
Standard_Integer l = dim*j;
|
||||
for(m = 0; m < dim; ++m)
|
||||
{
|
||||
Val[l + m] = theCoords[ic + m];
|
||||
}
|
||||
Par[j] = thePars(k);
|
||||
}
|
||||
PLib::EvalLagrange(Par[2], 2, 2, dim, *Val, *Par, *Res);
|
||||
//
|
||||
aCurv(i) = EvalCurv(dim, &Res[dim], &Res[2*dim]);
|
||||
if(aCurv(i) > aMaxCurv)
|
||||
{
|
||||
aMaxCurv = aCurv(i);
|
||||
}
|
||||
|
||||
BuildCurvature(theCoords, theDim, thePars, aCurv, aMaxCurv);
|
||||
//
|
||||
Standard_Integer i, j, dim = theDim;
|
||||
#ifdef APPROXINT_KNOTTOOLS_DEBUG
|
||||
std::cout << "Discrete curvature array is" << std::endl;
|
||||
for(i = aCurv.Lower(); i <= aCurv.Upper(); ++i)
|
||||
@@ -627,3 +652,172 @@ void ApproxInt_KnotTools::BuildKnots(const TColgp_Array1OfPnt& thePntsXYZ,
|
||||
#endif
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MaxParamRatio
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Real MaxParamRatio(const math_Vector& thePars)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Real aMaxRatio = 0.;
|
||||
//
|
||||
for (i = thePars.Lower() + 1; i < thePars.Upper(); ++i)
|
||||
{
|
||||
Standard_Real aRat = (thePars(i + 1) - thePars(i)) / (thePars(i) - thePars(i - 1));
|
||||
if (aRat < 1.)
|
||||
aRat = 1. / aRat;
|
||||
|
||||
aMaxRatio = Max(aMaxRatio, aRat);
|
||||
}
|
||||
return aMaxRatio;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DefineParType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Approx_ParametrizationType ApproxInt_KnotTools::DefineParType(
|
||||
const Handle(IntPatch_WLine)& theWL,
|
||||
const Standard_Integer theFpar, const Standard_Integer theLpar,
|
||||
const Standard_Boolean theApproxXYZ,
|
||||
const Standard_Boolean theApproxU1V1,
|
||||
const Standard_Boolean theApproxU2V2
|
||||
)
|
||||
{
|
||||
if (theLpar - theFpar == 1)
|
||||
return Approx_IsoParametric;
|
||||
|
||||
const Standard_Integer nbp3d = theApproxXYZ ? 1 : 0,
|
||||
nbp2d = (theApproxU1V1 ? 1 : 0) + (theApproxU2V2 ? 1 : 0);
|
||||
|
||||
GeomInt_TheMultiLineOfWLApprox aTestLine(theWL, nbp3d, nbp2d, theApproxU1V1, theApproxU2V2,
|
||||
0., 0., 0., 0., 0., 0., 0., theApproxU1V1, theFpar, theLpar);
|
||||
|
||||
TColgp_Array1OfPnt aTabPnt3d(1, Max(1, nbp3d));
|
||||
TColgp_Array1OfPnt2d aTabPnt2d(1, Max(1, nbp2d));
|
||||
TColgp_Array1OfPnt aPntXYZ(theFpar, theLpar);
|
||||
TColgp_Array1OfPnt2d aPntU1V1(theFpar, theLpar);
|
||||
TColgp_Array1OfPnt2d aPntU2V2(theFpar, theLpar);
|
||||
|
||||
Standard_Integer i, j;
|
||||
|
||||
for (i = theFpar; i <= theLpar; ++i)
|
||||
{
|
||||
if (nbp3d != 0 && nbp2d != 0) aTestLine.Value(i, aTabPnt3d, aTabPnt2d);
|
||||
else if (nbp2d != 0) aTestLine.Value(i, aTabPnt2d);
|
||||
else if (nbp3d != 0) aTestLine.Value(i, aTabPnt3d);
|
||||
//
|
||||
if (nbp3d > 0)
|
||||
{
|
||||
aPntXYZ(i) = aTabPnt3d(1);
|
||||
}
|
||||
if (nbp2d > 1)
|
||||
{
|
||||
aPntU1V1(i) = aTabPnt2d(1);
|
||||
aPntU2V2(i) = aTabPnt2d(2);
|
||||
}
|
||||
else if (nbp2d > 0)
|
||||
{
|
||||
if (theApproxU1V1)
|
||||
{
|
||||
aPntU1V1(i) = aTabPnt2d(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPntU2V2(i) = aTabPnt2d(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer aDim = 0;
|
||||
|
||||
if (theApproxXYZ)
|
||||
aDim += 3;
|
||||
if (theApproxU1V1)
|
||||
aDim += 2;
|
||||
if (theApproxU2V2)
|
||||
aDim += 2;
|
||||
|
||||
Standard_Integer aLength = theLpar - theFpar + 1;
|
||||
NCollection_LocalArray<Standard_Real> aCoords(aLength * aDim);
|
||||
for (i = theFpar; i <= theLpar; ++i)
|
||||
{
|
||||
j = (i - theFpar) * aDim;
|
||||
if (theApproxXYZ)
|
||||
{
|
||||
aCoords[j] = aPntXYZ.Value(i).X();
|
||||
++j;
|
||||
aCoords[j] = aPntXYZ.Value(i).Y();
|
||||
++j;
|
||||
aCoords[j] = aPntXYZ.Value(i).Z();
|
||||
++j;
|
||||
}
|
||||
if (theApproxU1V1)
|
||||
{
|
||||
aCoords[j] = aPntU1V1.Value(i).X();
|
||||
++j;
|
||||
aCoords[j] = aPntU1V1.Value(i).Y();
|
||||
++j;
|
||||
}
|
||||
if (theApproxU2V2)
|
||||
{
|
||||
aCoords[j] = aPntU2V2.Value(i).X();
|
||||
++j;
|
||||
aCoords[j] = aPntU2V2.Value(i).Y();
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
//Analysis of curvature
|
||||
const Standard_Real aCritRat = 500.;
|
||||
const Standard_Real aCritParRat = 100.;
|
||||
math_Vector aPars(theFpar, theLpar);
|
||||
Approx_ParametrizationType aParType = Approx_ChordLength;
|
||||
GeomInt_WLApprox::Parameters(aTestLine, theFpar, theLpar, aParType, aPars);
|
||||
TColStd_Array1OfReal aCurv(aPars.Lower(), aPars.Upper());
|
||||
Standard_Real aMaxCurv = 0.;
|
||||
BuildCurvature(aCoords, aDim, aPars, aCurv, aMaxCurv);
|
||||
|
||||
if (aMaxCurv < Precision::PConfusion()
|
||||
|| Precision::IsPositiveInfinite(aMaxCurv))
|
||||
{
|
||||
//Linear case
|
||||
return aParType;
|
||||
}
|
||||
|
||||
Standard_Real aMidCurv = 0.;
|
||||
Standard_Real eps = Epsilon(1.);
|
||||
j = 0;
|
||||
for (i = aCurv.Lower(); i <= aCurv.Upper(); ++i)
|
||||
{
|
||||
if (aMaxCurv - aCurv(i) < eps)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
++j;
|
||||
aMidCurv += aCurv(i);
|
||||
}
|
||||
|
||||
if (j > 1)
|
||||
{
|
||||
aMidCurv /= j;
|
||||
}
|
||||
|
||||
if (aMidCurv <= eps)
|
||||
return aParType;
|
||||
|
||||
Standard_Real aRat = aMaxCurv / aMidCurv;
|
||||
|
||||
if (aRat > aCritRat)
|
||||
{
|
||||
if(aRat > 5.*aCritRat)
|
||||
aParType = Approx_Centripetal;
|
||||
else
|
||||
{
|
||||
Standard_Real aParRat = MaxParamRatio(aPars);
|
||||
if (aParRat > aCritParRat)
|
||||
aParType = Approx_Centripetal;
|
||||
}
|
||||
}
|
||||
|
||||
return aParType;
|
||||
}
|
||||
|
@@ -38,12 +38,15 @@
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <NCollection_LocalArray.hxx>
|
||||
#include <Approx_ParametrizationType.hxx>
|
||||
|
||||
class math_Vector;
|
||||
template <class A> class NCollection_Sequence;
|
||||
template <class A> class NCollection_List;
|
||||
template <class A> class NCollection_Vector;
|
||||
|
||||
class IntPatch_WLine;
|
||||
|
||||
// Corresponds for debug information output.
|
||||
// Debug information is also printed when OCCT_DEBUG defined.
|
||||
//#define APPROXINT_KNOTTOOLS_DEBUG
|
||||
@@ -84,6 +87,22 @@ public:
|
||||
const Standard_Integer theMinNbPnts,
|
||||
NCollection_Vector<Standard_Integer>& theKnots);
|
||||
|
||||
//! Builds discrete curvature
|
||||
Standard_EXPORT static void BuildCurvature(
|
||||
const NCollection_LocalArray<Standard_Real>& theCoords,
|
||||
const Standard_Integer theDim,
|
||||
const math_Vector& thePars,
|
||||
TColStd_Array1OfReal& theCurv,
|
||||
Standard_Real& theMaxCurv);
|
||||
|
||||
//! Defines preferable parametrization type for theWL
|
||||
Standard_EXPORT static Approx_ParametrizationType DefineParType(const Handle(IntPatch_WLine)& theWL,
|
||||
const Standard_Integer theFpar, const Standard_Integer theLpar,
|
||||
const Standard_Boolean theApproxXYZ,
|
||||
const Standard_Boolean theApproxU1V1,
|
||||
const Standard_Boolean theApproxU2V2);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//! Compute indices of knots:
|
||||
|
@@ -284,6 +284,35 @@ void BOPAlgo_PaveFiller::PerformFF(const Message_ProgressRange& theRange)
|
||||
// Post-processing options
|
||||
Standard_Boolean bSplitCurve = Standard_False;
|
||||
//
|
||||
// Collect all pairs of Edge/Edge interferences to check if
|
||||
// some faces have to be moved to obtain more precise intersection
|
||||
NCollection_DataMap<BOPDS_Pair, TColStd_ListOfInteger, BOPDS_PairMapHasher> aEEMap;
|
||||
const BOPDS_VectorOfInterfEE& aVEEs = myDS->InterfEE();
|
||||
for (Standard_Integer iEE = 0; iEE < aVEEs.Size(); ++iEE)
|
||||
{
|
||||
const BOPDS_Interf& aEE = aVEEs(iEE);
|
||||
if (!aEE.HasIndexNew())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Standard_Integer nE1, nE2;
|
||||
aEE.Indices(nE1, nE2);
|
||||
|
||||
const Standard_Integer nVN = aEE.IndexNew();
|
||||
|
||||
BOPDS_Pair aPair(nE1, nE2);
|
||||
TColStd_ListOfInteger* pPoints = aEEMap.ChangeSeek(aPair);
|
||||
if (pPoints)
|
||||
{
|
||||
pPoints->Append(nVN);
|
||||
}
|
||||
else
|
||||
{
|
||||
pPoints = aEEMap.Bound(BOPDS_Pair(nE1, nE2), TColStd_ListOfInteger());
|
||||
pPoints->Append(nVN);
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare the pairs of faces for intersection
|
||||
BOPAlgo_VectorOfFaceFace aVFaceFace;
|
||||
myIterator->Initialize(TopAbs_FACE, TopAbs_FACE);
|
||||
@@ -312,15 +341,87 @@ void BOPAlgo_PaveFiller::PerformFF(const Message_ProgressRange& theRange)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there is an intersection between edges of the faces.
|
||||
// If there is an intersection, check if there is a shift between the edges
|
||||
// (intersection point is on some distance from the edges), and move one of
|
||||
// the faces to the point of exact edges intersection. This should allow
|
||||
// obtaining more precise intersection curves between the faces
|
||||
// (at least the curves should reach the boundary).
|
||||
// Note, that currently this check considers only closed edges (seam edges).
|
||||
TopoDS_Face aFShifted1 = aF1, aFShifted2 = aF2;
|
||||
// Keep shift value to use it as the tolerance for intersection curves
|
||||
Standard_Real aShiftValue = 0.;
|
||||
|
||||
if (aBAS1.GetType() != GeomAbs_Plane ||
|
||||
aBAS2.GetType() != GeomAbs_Plane) {
|
||||
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (TopExp_Explorer aExp1(aF1, TopAbs_EDGE); !isFound && aExp1.More(); aExp1.Next())
|
||||
{
|
||||
const TopoDS_Edge& aE1 = TopoDS::Edge(aExp1.Current());
|
||||
const Standard_Integer nE1 = myDS->Index(aE1);
|
||||
|
||||
for (TopExp_Explorer aExp2(aF2, TopAbs_EDGE); !isFound && aExp2.More(); aExp2.Next())
|
||||
{
|
||||
const TopoDS_Edge& aE2 = TopoDS::Edge(aExp2.Current());
|
||||
const Standard_Integer nE2 = myDS->Index(aE2);
|
||||
|
||||
Standard_Boolean bIsClosed1 = BRep_Tool::IsClosed(aE1, aF1);
|
||||
Standard_Boolean bIsClosed2 = BRep_Tool::IsClosed(aE2, aF2);
|
||||
if (!bIsClosed1 && !bIsClosed2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const TColStd_ListOfInteger* pPoints = aEEMap.Seek(BOPDS_Pair(nE1, nE2));
|
||||
if (!pPoints)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (TColStd_ListOfInteger::Iterator itEEP(*pPoints); itEEP.More(); itEEP.Next())
|
||||
{
|
||||
const Standard_Integer& nVN = itEEP.Value();
|
||||
const TopoDS_Vertex& aVN = TopoDS::Vertex(myDS->Shape(nVN));
|
||||
const gp_Pnt& aPnt = BRep_Tool::Pnt(aVN);
|
||||
|
||||
// Compute points exactly on the edges
|
||||
GeomAPI_ProjectPointOnCurve& aProjPC1 = myContext->ProjPC(aE1);
|
||||
GeomAPI_ProjectPointOnCurve& aProjPC2 = myContext->ProjPC(aE2);
|
||||
aProjPC1.Perform(aPnt);
|
||||
aProjPC2.Perform(aPnt);
|
||||
if (!aProjPC1.NbPoints() && !aProjPC2.NbPoints())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
gp_Pnt aP1 = aProjPC1.NbPoints() > 0 ? aProjPC1.NearestPoint() : aPnt;
|
||||
gp_Pnt aP2 = aProjPC2.NbPoints() > 0 ? aProjPC2.NearestPoint() : aPnt;
|
||||
|
||||
Standard_Real aShiftDist = aP1.Distance(aP2);
|
||||
if (aShiftDist > BRep_Tool::Tolerance(aVN))
|
||||
{
|
||||
// Move one of the faces to the point of exact intersection of edges
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTranslation(bIsClosed1 ? gp_Vec(aP1, aP2) : gp_Vec(aP2, aP1));
|
||||
TopLoc_Location aLoc(aTrsf);
|
||||
(bIsClosed1 ? &aFShifted1 : &aFShifted2)->Move(aLoc);
|
||||
aShiftValue = aShiftDist;
|
||||
isFound = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Appended();
|
||||
//
|
||||
aFaceFace.SetRunParallel (myRunParallel);
|
||||
aFaceFace.SetIndices(nF1, nF2);
|
||||
aFaceFace.SetFaces(aF1, aF2);
|
||||
aFaceFace.SetFaces(aFShifted1, aFShifted2);
|
||||
aFaceFace.SetBoxes (myDS->ShapeInfo (nF1).Box(), myDS->ShapeInfo (nF2).Box());
|
||||
// compute minimal tolerance for the curves
|
||||
Standard_Real aTolFF = ToleranceFF(aBAS1, aBAS2);
|
||||
// Note: in case of faces with closed edges it should not be less than value of the shift
|
||||
Standard_Real aTolFF = Max(aShiftValue, ToleranceFF(aBAS1, aBAS2));
|
||||
aFaceFace.SetTolFF(aTolFF);
|
||||
//
|
||||
IntSurf_ListOfPntOn2S aListOfPnts;
|
||||
|
@@ -340,7 +340,7 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
|
||||
|
||||
if(Only2d && Only3d) {
|
||||
BRepLib_MakeEdge MKed(GeomAdaptor::MakeCurve(hcur->Curve()),
|
||||
Ufin, Udeb);
|
||||
Udeb, Ufin);
|
||||
prj = MKed.Edge();
|
||||
BB.UpdateEdge(TopoDS::Edge(prj),
|
||||
PCur2d,
|
||||
|
@@ -106,6 +106,11 @@ public:
|
||||
|
||||
Standard_EXPORT const AppParCurves_MultiBSpCurve& Value (const Standard_Integer Index) const;
|
||||
|
||||
Standard_EXPORT static void Parameters(const BRepApprox_TheMultiLineOfApprox& Line,
|
||||
const Standard_Integer firstP,
|
||||
const Standard_Integer lastP,
|
||||
const Approx_ParametrizationType Par,
|
||||
math_Vector& TheParameters);
|
||||
|
||||
|
||||
|
||||
|
@@ -82,7 +82,7 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
|
||||
|
||||
BRepAdaptor_Curve Curv(E);
|
||||
Handle(BRepAdaptor_Curve) HC = new BRepAdaptor_Curve(Curv);
|
||||
myExtCS.Perform(HC->Curve(), U1, U2);
|
||||
myExtCS.Perform(*HC, U1, U2);
|
||||
|
||||
if(!myExtCS.IsDone())
|
||||
return;
|
||||
|
@@ -1978,6 +1978,12 @@ public:
|
||||
return aDeriv.Transformed(mySurfaceTrsf);
|
||||
}
|
||||
|
||||
gp_Dir Normal()
|
||||
{
|
||||
gp_Dir aNormal = mySurfaceProps.Normal();
|
||||
return aNormal.Transformed(mySurfaceTrsf);
|
||||
}
|
||||
|
||||
// Calculate principal curvatures, which consist of minimal and maximal normal curvatures and
|
||||
// the directions on the tangent plane (principal direction) where the extremums are reached
|
||||
void Curvature(gp_Dir& thePrincipalDir1, Standard_Real& theCurvature1,
|
||||
@@ -2016,32 +2022,63 @@ private:
|
||||
//purpose : check the angle at the border between two squares.
|
||||
// Two shares should have a shared front edge.
|
||||
//=======================================================================
|
||||
static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
|
||||
const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2,
|
||||
const Standard_Real theAngleTol)
|
||||
GeomAbs_Shape BRepLib::ContinuityOfFaces(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const Standard_Real theAngleTol)
|
||||
{
|
||||
Standard_Boolean isSeam = F1.IsEqual(F2);
|
||||
Standard_Boolean isSeam = theFace1.IsEqual(theFace2);
|
||||
|
||||
TopoDS_Edge E = Ed;
|
||||
TopoDS_Edge anEdgeInFace1, anEdgeInFace2;
|
||||
Handle(Geom2d_Curve) aCurve1, aCurve2;
|
||||
|
||||
Standard_Real aFirst, aLast;
|
||||
|
||||
if (!theFace1.IsSame (theFace2) &&
|
||||
BRep_Tool::IsClosed (theEdge, theFace1) &&
|
||||
BRep_Tool::IsClosed (theEdge, theFace2))
|
||||
{
|
||||
//Find the edge in the face 1: this edge will have correct orientation
|
||||
TopoDS_Face aFace1 = theFace1;
|
||||
aFace1.Orientation (TopAbs_FORWARD);
|
||||
TopExp_Explorer anExplo (aFace1, TopAbs_EDGE);
|
||||
for (; anExplo.More(); anExplo.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
|
||||
if (anEdge.IsSame (theEdge))
|
||||
{
|
||||
anEdgeInFace1 = anEdge;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (anEdgeInFace1.IsNull())
|
||||
return GeomAbs_C0;
|
||||
|
||||
aCurve1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace1, aFirst, aLast);
|
||||
TopoDS_Face aFace2 = theFace2;
|
||||
aFace2.Orientation (TopAbs_FORWARD);
|
||||
anEdgeInFace2 = anEdgeInFace1;
|
||||
anEdgeInFace2.Reverse();
|
||||
aCurve2 = BRep_Tool::CurveOnSurface (anEdgeInFace2, aFace2, aFirst, aLast);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Obtaining of pcurves of edge on two faces.
|
||||
anEdgeInFace1 = anEdgeInFace2 = theEdge;
|
||||
aCurve1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, theFace1, aFirst, aLast);
|
||||
//For the case of seam edge
|
||||
if (theFace1.IsSame(theFace2))
|
||||
anEdgeInFace2.Reverse();
|
||||
aCurve2 = BRep_Tool::CurveOnSurface (anEdgeInFace2, theFace2, aFirst, aLast);
|
||||
}
|
||||
|
||||
// Check if pcurves exist on both faces of edge
|
||||
Standard_Real aFirst,aLast;
|
||||
E.Orientation(TopAbs_FORWARD);
|
||||
Handle(Geom2d_Curve) aCurve1 = BRep_Tool::CurveOnSurface(E, F1, aFirst, aLast);
|
||||
if(aCurve1.IsNull())
|
||||
return GeomAbs_C0;
|
||||
|
||||
if (isSeam)
|
||||
E.Orientation(TopAbs_REVERSED);
|
||||
Handle(Geom2d_Curve) aCurve2 = BRep_Tool::CurveOnSurface(E, F2, aFirst, aLast);
|
||||
if(aCurve2.IsNull())
|
||||
if (aCurve1.IsNull() || aCurve2.IsNull())
|
||||
return GeomAbs_C0;
|
||||
|
||||
TopLoc_Location aLoc1, aLoc2;
|
||||
Handle(Geom_Surface) aSurface1 = BRep_Tool::Surface(F1, aLoc1);
|
||||
Handle(Geom_Surface) aSurface1 = BRep_Tool::Surface (theFace1, aLoc1);
|
||||
const gp_Trsf& aSurf1Trsf = aLoc1.Transformation();
|
||||
Handle(Geom_Surface) aSurface2 = BRep_Tool::Surface(F2, aLoc2);
|
||||
Handle(Geom_Surface) aSurface2 = BRep_Tool::Surface (theFace2, aLoc2);
|
||||
const gp_Trsf& aSurf2Trsf = aLoc2.Transformation();
|
||||
|
||||
if (aSurface1->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
|
||||
@@ -2058,11 +2095,11 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
|
||||
return GeomAbs_CN;
|
||||
}
|
||||
|
||||
SurfaceProperties aSP1(aSurface1, aSurf1Trsf, aCurve1, F1.Orientation() == TopAbs_REVERSED);
|
||||
SurfaceProperties aSP2(aSurface2, aSurf2Trsf, aCurve2, F2.Orientation() == TopAbs_REVERSED);
|
||||
SurfaceProperties aSP1(aSurface1, aSurf1Trsf, aCurve1, theFace1.Orientation() == TopAbs_REVERSED);
|
||||
SurfaceProperties aSP2(aSurface2, aSurf2Trsf, aCurve2, theFace2.Orientation() == TopAbs_REVERSED);
|
||||
|
||||
Standard_Real f, l, eps;
|
||||
BRep_Tool::Range(E,f,l);
|
||||
BRep_Tool::Range (theEdge,f,l);
|
||||
Extrema_LocateExtPC ext;
|
||||
Handle(BRepAdaptor_Curve) aHC2;
|
||||
|
||||
@@ -2073,7 +2110,6 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
|
||||
const Standard_Real anAngleTol2 = theAngleTol * theAngleTol;
|
||||
|
||||
gp_Vec aDer1, aDer2;
|
||||
gp_Vec aNorm1;
|
||||
Standard_Real aSqLen1, aSqLen2;
|
||||
gp_Dir aCrvDir1[2], aCrvDir2[2];
|
||||
Standard_Real aCrvLen1[2], aCrvLen2[2];
|
||||
@@ -2101,13 +2137,26 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
|
||||
aDer2 = aSP2.Derivative();
|
||||
aSqLen2 = aDer2.SquareMagnitude();
|
||||
Standard_Boolean isSmoothSuspect = (aDer1.CrossSquareMagnitude(aDer2) <= anAngleTol2 * aSqLen1 * aSqLen2);
|
||||
if (isSmoothSuspect)
|
||||
{
|
||||
gp_Dir aNormal1 = aSP1.Normal();
|
||||
if (theFace1.Orientation() == TopAbs_REVERSED)
|
||||
aNormal1.Reverse();
|
||||
gp_Dir aNormal2 = aSP2.Normal();
|
||||
if (theFace2.Orientation() == TopAbs_REVERSED)
|
||||
aNormal2.Reverse();
|
||||
|
||||
if (aNormal1 * aNormal2 < 0.)
|
||||
return GeomAbs_C0;
|
||||
}
|
||||
|
||||
if (!isSmoothSuspect)
|
||||
{
|
||||
// Refine by projection
|
||||
if (aHC2.IsNull())
|
||||
{
|
||||
// adaptor for pcurve on the second surface
|
||||
aHC2 = new BRepAdaptor_Curve (E, F2);
|
||||
aHC2 = new BRepAdaptor_Curve (anEdgeInFace2, theFace2);
|
||||
ext.Initialize(*aHC2, f, l, Precision::PConfusion());
|
||||
}
|
||||
ext.Perform(aSP1.Value(), u);
|
||||
@@ -2303,9 +2352,8 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
|
||||
BRep_Builder B;
|
||||
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
|
||||
try {
|
||||
GeomAbs_Shape aCont = tgtfaces(E, F1, F2, TolAng);
|
||||
GeomAbs_Shape aCont = ContinuityOfFaces(E, F1, F2, TolAng);
|
||||
B.Continuity(E,F1,F2,aCont);
|
||||
|
||||
}
|
||||
catch(Standard_Failure const&)
|
||||
{
|
||||
@@ -2423,7 +2471,7 @@ Standard_Boolean BRepLib::
|
||||
|
||||
gp_Vec3f aNorm1f, aNorm2f;
|
||||
aPT1->Normal (aFNodF1, aNorm1f);
|
||||
aPT1->Normal (aFNodF2, aNorm2f);
|
||||
aPT2->Normal (aFNodF2, aNorm2f);
|
||||
const gp_XYZ aNorm1 (aNorm1f.x(), aNorm1f.y(), aNorm1f.z());
|
||||
const gp_XYZ aNorm2 (aNorm2f.x(), aNorm2f.y(), aNorm2f.z());
|
||||
const Standard_Real aDot = aNorm1 * aNorm2;
|
||||
|
@@ -202,7 +202,14 @@ public:
|
||||
//! orientation to have matter in the solid. Returns
|
||||
//! False if the solid is unOrientable (open or incoherent)
|
||||
Standard_EXPORT static Standard_Boolean OrientClosedSolid (TopoDS_Solid& solid);
|
||||
|
||||
|
||||
//! Returns the order of continuity between two faces
|
||||
//! connected by an edge
|
||||
Standard_EXPORT static GeomAbs_Shape ContinuityOfFaces(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const Standard_Real theAngleTol);
|
||||
|
||||
//! Encodes the Regularity of edges on a Shape.
|
||||
//! Warning: <TolAng> is an angular tolerance, expressed in Rad.
|
||||
//! Warning: If the edges's regularity are coded before, nothing
|
||||
|
@@ -126,10 +126,12 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
|
||||
const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
|
||||
const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
|
||||
|
||||
// Slightly increase exact resolution so to cover links with approximate
|
||||
// length equal to resolution itself on sub-resolution differences.
|
||||
const Standard_Real aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
|
||||
const Adaptor3d_Surface& aSurface = GetSurface()->Surface();
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance);
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance);
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance) * 1.1;
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance) * 1.1;
|
||||
|
||||
const Standard_Real aDeflectionUV = 1.e-05;
|
||||
myTolerance.first = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
|
||||
|
@@ -45,7 +45,8 @@ namespace
|
||||
void operator()(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
if (aDFace->IsSet(IMeshData_Outdated))
|
||||
if (aDFace->IsSet(IMeshData_Outdated) ||
|
||||
aDFace->GetFace().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -118,7 +119,7 @@ namespace
|
||||
void operator()(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone)
|
||||
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone || aDFace->IsSet(IMeshData_Failure))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -127,12 +128,12 @@ namespace
|
||||
for (Standard_Integer aEdgeIdx = 0; aEdgeIdx < aDWire->EdgesNb() - 1; ++aEdgeIdx)
|
||||
{
|
||||
const IMeshData::IEdgePtr& aDEdge = aDWire->GetEdge (aEdgeIdx);
|
||||
|
||||
|
||||
if (aDEdge->GetPCurve(aDFace.get(), TopAbs_FORWARD) != aDEdge->GetPCurve(aDFace.get(), TopAbs_REVERSED))
|
||||
{
|
||||
if (aDEdge->GetCurve()->ParametersNb() == 2)
|
||||
{
|
||||
if (splitEdge (aDEdge, Abs (getConeStep (aDFace))))
|
||||
if (splitEdge (aDEdge, aDFace, Abs (getConeStep (aDFace))))
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
const Handle (Poly_Triangulation)& aTriangulation =
|
||||
@@ -145,7 +146,7 @@ namespace
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,48 +178,89 @@ namespace
|
||||
}
|
||||
|
||||
//! Splits 3D and all pcurves accordingly using the specified step.
|
||||
Standard_Boolean splitEdge(const IMeshData::IEdgePtr& theDEdge,
|
||||
const Standard_Real theDU) const
|
||||
Standard_Boolean splitEdge(const IMeshData::IEdgePtr& theDEdge,
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const Standard_Real theDU) const
|
||||
{
|
||||
if (!splitCurve<gp_XYZ> (theDEdge->GetCurve (), theDU))
|
||||
TopoDS_Edge aE = theDEdge->GetEdge();
|
||||
const TopoDS_Face& aF = theDFace->GetFace();
|
||||
|
||||
Standard_Real aFParam, aLParam;
|
||||
|
||||
Handle(Geom_Curve) aHC = BRep_Tool::Curve (aE, aFParam, aLParam);
|
||||
|
||||
const IMeshData::IPCurveHandle& aIPC1 = theDEdge->GetPCurve(0);
|
||||
const IMeshData::IPCurveHandle& aIPC2 = theDEdge->GetPCurve(1);
|
||||
|
||||
// Calculate the step by parameter of the curve.
|
||||
const gp_Pnt2d& aFPntOfIPC1 = aIPC1->GetPoint (0);
|
||||
const gp_Pnt2d& aLPntOfIPC1 = aIPC1->GetPoint (aIPC1->ParametersNb() - 1);
|
||||
const Standard_Real aMod = Abs (aFPntOfIPC1.Y() - aLPntOfIPC1.Y());
|
||||
|
||||
if (aMod < gp::Resolution())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
for (Standard_Integer aPCurveIdx = 0; aPCurveIdx < theDEdge->PCurvesNb(); ++aPCurveIdx)
|
||||
const Standard_Real aDT = Abs (aLParam - aFParam) / aMod * theDU;
|
||||
|
||||
if (!splitCurve<gp_Pnt> (aHC, theDEdge->GetCurve(), aDT))
|
||||
{
|
||||
splitCurve<gp_XY> (theDEdge->GetPCurve (aPCurveIdx), theDU);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Define two pcurves of the seam-edge.
|
||||
Handle(Geom2d_Curve) aPC1, aPC2;
|
||||
Standard_Real af, al;
|
||||
|
||||
aE.Orientation (TopAbs_FORWARD);
|
||||
aPC1 = BRep_Tool::CurveOnSurface (aE, aF, af, al);
|
||||
|
||||
aE.Orientation (TopAbs_REVERSED);
|
||||
aPC2 = BRep_Tool::CurveOnSurface (aE, aF, af, al);
|
||||
|
||||
if (aPC1.IsNull() || aPC2.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Select the correct pcurve of the seam-edge.
|
||||
const gp_Pnt2d& aFPntOfPC1 = aPC1->Value (aPC1->FirstParameter());
|
||||
|
||||
if (Abs (aLPntOfIPC1.X() - aFPntOfPC1.X()) > Precision::Confusion())
|
||||
{
|
||||
std::swap (aPC1, aPC2);
|
||||
}
|
||||
|
||||
splitCurve<gp_Pnt2d> (aPC1, aIPC1, aDT);
|
||||
splitCurve<gp_Pnt2d> (aPC2, aIPC2, aDT);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Splits the given curve using the specified step.
|
||||
template<class PointType, class Curve>
|
||||
Standard_Boolean splitCurve(Curve& theCurve, const Standard_Real theDU) const
|
||||
template<class PointType, class GeomCurve, class Curve>
|
||||
Standard_Boolean splitCurve(GeomCurve& theGeomCurve,
|
||||
Curve& theCurve,
|
||||
const Standard_Real theDT) const
|
||||
{
|
||||
Standard_Boolean isUpdated = Standard_False;
|
||||
PointType aDir = theCurve->GetPoint(theCurve->ParametersNb() - 1).Coord() - theCurve->GetPoint(0).Coord();
|
||||
const Standard_Real aModulus = aDir.Modulus();
|
||||
if (aModulus < gp::Resolution())
|
||||
{
|
||||
return isUpdated;
|
||||
}
|
||||
aDir /= aModulus;
|
||||
|
||||
const Standard_Real aLastParam = theCurve->GetParameter(theCurve->ParametersNb() - 1);
|
||||
const Standard_Boolean isReversed = theCurve->GetParameter(0) > aLastParam;
|
||||
const Standard_Real aFirstParam = theCurve->GetParameter (0);
|
||||
const Standard_Real aLastParam = theCurve->GetParameter (theCurve->ParametersNb() - 1);
|
||||
const Standard_Boolean isReversed = aFirstParam > aLastParam;
|
||||
|
||||
for (Standard_Integer aPointIdx = 1; ; ++aPointIdx)
|
||||
{
|
||||
const Standard_Real aCurrParam = theCurve->GetParameter(0) + aPointIdx * theDU * (isReversed ? -1.0 : 1.0);
|
||||
if (( isReversed && (aCurrParam < aLastParam)) ||
|
||||
(!isReversed && !(aCurrParam < aLastParam)))
|
||||
const Standard_Real aCurrParam = aFirstParam + aPointIdx * theDT * (isReversed ? -1.0 : 1.0);
|
||||
if (( isReversed && (aCurrParam - aLastParam < Precision::PConfusion())) ||
|
||||
(!isReversed && !(aCurrParam - aLastParam < - Precision::PConfusion())))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
theCurve->InsertPoint(theCurve->ParametersNb() - 1,
|
||||
theCurve->GetPoint(0).Translated (aDir * aPointIdx * theDU),
|
||||
theCurve->InsertPoint (theCurve->ParametersNb() - 1,
|
||||
theGeomCurve->Value (aCurrParam),
|
||||
aCurrParam);
|
||||
|
||||
isUpdated = Standard_True;
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Section.hxx>
|
||||
#include <BOPAlgo_Splitter.hxx>
|
||||
#include <BOPAlgo_BOP.hxx>
|
||||
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
@@ -107,6 +108,19 @@ namespace {
|
||||
{
|
||||
BRep_Builder().Add (theSOut, theS);
|
||||
}
|
||||
static void AddToContainer (const TopoDS_Shape& theKey,
|
||||
const TopoDS_Shape& theValue,
|
||||
TopTools_DataMapOfShapeListOfShape& theMap)
|
||||
{
|
||||
if (TopTools_ListOfShape* pList = theMap.ChangeSeek (theKey))
|
||||
{
|
||||
pList->Append (theValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
theMap.Bound (theKey, TopTools_ListOfShape())->Append (theValue);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TakeModified
|
||||
@@ -617,7 +631,9 @@ private: //! @name Intersection and post-treatment of edges
|
||||
|
||||
//! Filtering the invalid edges according to currently invalid faces
|
||||
void FilterInvalidEdges (const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
|
||||
const TopTools_IndexedMapOfShape& theMERemoved);
|
||||
const TopTools_IndexedMapOfShape& theMERemoved,
|
||||
const TopTools_IndexedMapOfShape& theMEInside,
|
||||
TopTools_MapOfShape& theMEUseInRebuild);
|
||||
|
||||
private: //! @name Checking faces
|
||||
|
||||
@@ -766,6 +782,7 @@ private: //! @name Checking faces
|
||||
const TopTools_MapOfShape& theVertsToAvoid,
|
||||
const TopTools_MapOfShape& theNewVertsToAvoid,
|
||||
const TopTools_MapOfShape& theMECheckExt,
|
||||
const TopTools_DataMapOfShapeListOfShape* theSSInterfs,
|
||||
TopTools_MapOfShape& theMVBounds,
|
||||
TopTools_DataMapOfShapeListOfShape& theEImages);
|
||||
|
||||
@@ -877,16 +894,18 @@ private:
|
||||
TopTools_IndexedMapOfShape myEdgesToAvoid; //!< Splits of edges to be avoided when building splits of faces
|
||||
TopTools_MapOfShape myLastInvEdges; //!< Edges marked invalid on the current step and to be avoided on the next step
|
||||
TopTools_MapOfShape myModifiedEdges; //!< Edges to be used for building splits
|
||||
TopTools_IndexedMapOfShape myInsideEdges; //!< Edges located fully inside solids built from the splits of offset faces
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape myInvalidFaces; //!< Invalid faces - splits of offset faces consisting of invalid edges
|
||||
TopTools_DataMapOfShapeShape myArtInvalidFaces; //!< Artificially invalid faces - valid faces intentionally marked invalid
|
||||
//! to be rebuilt on the future steps in the situations when invalid edges
|
||||
//! are present, but invalid faces not
|
||||
BRepOffset_DataMapOfShapeIndexedMapOfShape myArtInvalidFaces; //!< Artificially invalid faces - valid faces intentionally marked invalid
|
||||
//! to be rebuilt on the future steps in the situations when invalid edges
|
||||
//! are present, but invalid faces not
|
||||
TopTools_DataMapOfShapeInteger myAlreadyInvFaces; //!< Count number of the same face being marked invalid to avoid infinite
|
||||
//! rebuilding of the same face
|
||||
TopTools_DataMapOfShapeListOfShape myFNewHoles; //!< Images of the hole faces of the original face
|
||||
|
||||
TopTools_DataMapOfShapeListOfShape mySSInterfs; //!< Intersection information, used to collect intersection pairs during rebuild
|
||||
TopTools_DataMapOfShapeListOfShape mySSInterfsArt; //!< Intersection information, used to collect intersection pairs during rebuild
|
||||
NCollection_DataMap <TopoDS_Shape,
|
||||
BRepOffset_DataMapOfShapeMapOfShape,
|
||||
TopTools_ShapeMapHasher> myIntersectionPairs; //!< All possible intersection pairs, used to avoid some of the intersections
|
||||
@@ -1004,6 +1023,7 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfExtendedFaces (const Message_Prog
|
||||
myInvalidEdges.Clear();
|
||||
myInvertedEdges.Clear();
|
||||
mySSInterfs.Clear();
|
||||
mySSInterfsArt.Clear();
|
||||
myIntersectionPairs.Clear();
|
||||
mySolids.Nullify();
|
||||
myFacesToRebuild.Clear();
|
||||
@@ -1299,9 +1319,8 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
|
||||
//
|
||||
if (bArtificialCase)
|
||||
{
|
||||
TopTools_IndexedMapOfShape aMEInv;
|
||||
// make the face invalid
|
||||
myArtInvalidFaces.Bind (aF, aCE);
|
||||
TopTools_IndexedMapOfShape aMEInv;
|
||||
//
|
||||
*pLFIm = aLFImages;
|
||||
TopTools_ListIteratorOfListOfShape aItLFIm (aLFImages);
|
||||
@@ -1324,6 +1343,7 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
|
||||
}
|
||||
}
|
||||
//
|
||||
myArtInvalidFaces.Bind (aF, aMEInv);
|
||||
aDMFMIE.Bind (aF, aMEInv);
|
||||
aLFDone.Append (aF);
|
||||
//
|
||||
@@ -1519,9 +1539,8 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
|
||||
RemoveInvalidSplitsFromValid (aDMFMVIE);
|
||||
//
|
||||
// remove inside faces
|
||||
TopTools_IndexedMapOfShape aMEInside;
|
||||
RemoveInsideFaces (anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles,
|
||||
aMERemoved, aMEInside, aPSOuter.Next (5.));
|
||||
aMERemoved, myInsideEdges, aPSOuter.Next (5.));
|
||||
//
|
||||
// make compound of valid splits
|
||||
TopoDS_Compound aCFIm;
|
||||
@@ -1546,7 +1565,7 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
|
||||
FilterEdgesImages (aCFIm);
|
||||
//
|
||||
// filter invalid faces
|
||||
FilterInvalidFaces (aDMEF, aMEInside);
|
||||
FilterInvalidFaces (aDMEF, aMERemoved.Extent() ? myInsideEdges : aMERemoved);
|
||||
aNb = myInvalidFaces.Extent();
|
||||
if (!aNb)
|
||||
{
|
||||
@@ -1572,7 +1591,10 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
|
||||
#endif
|
||||
//
|
||||
// filter invalid edges
|
||||
FilterInvalidEdges (aDMFMIE, aMERemoved);
|
||||
TopTools_MapOfShape aMEUseInRebuild;
|
||||
FilterInvalidEdges (aDMFMIE, aMERemoved,
|
||||
aMERemoved.Extent() ? myInsideEdges : aMERemoved,
|
||||
aMEUseInRebuild);
|
||||
//
|
||||
// Check additionally validity of edges originated from vertices.
|
||||
CheckEdgesCreatedByVertex();
|
||||
@@ -1594,8 +1616,11 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
|
||||
for (i = 1; i <= aNb; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aE = myInvalidEdges (i);
|
||||
myEdgesToAvoid.Add (aE);
|
||||
myLastInvEdges.Add (aE);
|
||||
if (!aMEUseInRebuild.Contains(aE))
|
||||
{
|
||||
myEdgesToAvoid.Add (aE);
|
||||
}
|
||||
}
|
||||
//
|
||||
aNb = myInvalidFaces.Extent();
|
||||
@@ -1793,11 +1818,10 @@ Standard_Boolean BRepOffset_BuildOffsetFaces::CheckIfArtificial (const TopoDS_Sh
|
||||
{
|
||||
const TopoDS_Edge& aE = TopoDS::Edge (aItLE.Value());
|
||||
//
|
||||
if (myOEImages.IsBound (aE))
|
||||
if (const TopTools_ListOfShape* pLEIm = myOEImages.Seek (aE))
|
||||
{
|
||||
Standard_Boolean bChecked = Standard_False;
|
||||
const TopTools_ListOfShape& aLEIm = myOEImages.Find (aE);
|
||||
TopTools_ListIteratorOfListOfShape aItLEIm (aLEIm);
|
||||
TopTools_ListIteratorOfListOfShape aItLEIm (*pLEIm);
|
||||
for (; aItLEIm.More(); aItLEIm.Next())
|
||||
{
|
||||
const TopoDS_Edge& aEIm = TopoDS::Edge (aItLEIm.Value());
|
||||
@@ -4165,6 +4189,7 @@ void BRepOffset_BuildOffsetFaces::RemoveInsideFaces (const TopTools_ListOfShape&
|
||||
RemoveInvalidSplits (aMFToRem, aMV, theMERemoved);
|
||||
//
|
||||
// Get inside faces from the removed ones comparing them with boundary edges
|
||||
theMEInside.Clear();
|
||||
aNb = theMERemoved.Extent();
|
||||
for (i = 1; i <= aNb; ++i)
|
||||
{
|
||||
@@ -4189,6 +4214,28 @@ void BRepOffset_BuildOffsetFaces::RemoveInsideFaces (const TopTools_ListOfShape&
|
||||
void BRepOffset_BuildOffsetFaces::ShapesConnections (const TopTools_DataMapOfShapeShape& theDMFOr,
|
||||
BOPAlgo_Builder& theBuilder)
|
||||
{
|
||||
// Make connexity blocks from invalid edges to use the whole block
|
||||
// to which the edge is connected instead of the single edge.
|
||||
TopoDS_Compound aCEInv;
|
||||
BRep_Builder().MakeCompound(aCEInv);
|
||||
for (Standard_Integer i = 1; i <= myInvalidEdges.Extent(); ++i)
|
||||
{
|
||||
AddToContainer (myInvalidEdges(i), aCEInv);
|
||||
}
|
||||
|
||||
TopTools_ListOfShape aLCB;
|
||||
BOPTools_AlgoTools::MakeConnexityBlocks (aCEInv, TopAbs_VERTEX, TopAbs_EDGE, aLCB);
|
||||
|
||||
// Binding from the edge to the block
|
||||
TopTools_DataMapOfShapeShape aECBMap;
|
||||
for (TopTools_ListOfShape::Iterator itCB(aLCB); itCB.More(); itCB.Next())
|
||||
{
|
||||
for (TopoDS_Iterator itE(itCB.Value()); itE.More(); itE.Next())
|
||||
{
|
||||
aECBMap.Bind(itE.Value(), itCB.Value());
|
||||
}
|
||||
}
|
||||
|
||||
// update invalid edges with images and keep connection to original edge
|
||||
TopTools_DataMapOfShapeListOfShape aDMEOr;
|
||||
Standard_Integer aNb = myInvalidEdges.Extent();
|
||||
@@ -4206,13 +4253,7 @@ void BRepOffset_BuildOffsetFaces::ShapesConnections (const TopTools_DataMapOfSha
|
||||
for (; aItLEIm.More(); aItLEIm.Next())
|
||||
{
|
||||
const TopoDS_Shape& aEIm = aItLEIm.Value();
|
||||
//
|
||||
TopTools_ListOfShape* pLEOr = aDMEOr.ChangeSeek (aEIm);
|
||||
if (!pLEOr)
|
||||
{
|
||||
pLEOr = aDMEOr.Bound (aEIm, TopTools_ListOfShape());
|
||||
}
|
||||
AppendToList (*pLEOr, aEInv);
|
||||
AddToContainer (aEIm, aEInv, aDMEOr);
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -4365,6 +4406,121 @@ void BRepOffset_BuildOffsetFaces::ShapesConnections (const TopTools_DataMapOfSha
|
||||
AppendToList (*pLF, aFOp);
|
||||
}
|
||||
}
|
||||
|
||||
// Treatment for the artificial case - check if one of the faces is artificially invalid
|
||||
for (Standard_Integer iF = 0; iF < 2; ++iF)
|
||||
{
|
||||
const TopoDS_Shape& aFArt = !iF ? *pF1 : *pF2;
|
||||
const TopoDS_Shape& aFOpposite = !iF ? *pF2 : *pF1;
|
||||
|
||||
if (!myArtInvalidFaces.IsBound (aFArt))
|
||||
continue;
|
||||
|
||||
if (myInvalidFaces.Contains (aFOpposite) && !myArtInvalidFaces.IsBound (aFOpposite))
|
||||
continue;
|
||||
|
||||
// Collect own invalid edges of the face and the invalid edges connected to those
|
||||
// own invalid edges to be avoided in the check for intersection.
|
||||
TopTools_IndexedMapOfShape aMEAvoid;
|
||||
if (const TopTools_IndexedMapOfShape* pFEInv = myArtInvalidFaces.Seek (aFOpposite))
|
||||
{
|
||||
for (Standard_Integer iE = 1; iE <= pFEInv->Extent(); ++iE)
|
||||
{
|
||||
if (const TopoDS_Shape* pCB = aECBMap.Seek (pFEInv->FindKey(iE)))
|
||||
{
|
||||
TopExp::MapShapes (*pCB, TopAbs_EDGE, aMEAvoid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (const TopTools_ListOfShape* pLFIm = myOFImages.Seek (aFOpposite))
|
||||
{
|
||||
for (TopTools_ListOfShape::Iterator itLFIm (*pLFIm); itLFIm.More(); itLFIm.Next())
|
||||
{
|
||||
for (TopExp_Explorer expE (itLFIm.Value(), TopAbs_EDGE); expE.More(); expE.Next())
|
||||
{
|
||||
if (const TopoDS_Shape* pCB = aECBMap.Seek (expE.Current()))
|
||||
{
|
||||
TopExp::MapShapes (*pCB, TopAbs_EDGE, aMEAvoid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TopoDS_Shape& aFArtIm = !iF ? aFIm1 : aFIm2;
|
||||
const TopoDS_Shape& aFOppositeIm = !iF ? aFIm2 : aFIm1;
|
||||
|
||||
// Check if there are any intersections between edges of artificially
|
||||
// invalid face and opposite face
|
||||
const Standard_Integer nFOp = pDS->Index (aFOppositeIm);
|
||||
|
||||
for (TopExp_Explorer expE (aFArtIm, TopAbs_EDGE); expE.More(); expE.Next())
|
||||
{
|
||||
const TopoDS_Shape& aE = expE.Current();
|
||||
if (!myInvalidEdges.Contains (aE) || myInvertedEdges.Contains (aE) || aMEAvoid.Contains (aE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const Standard_Integer nE = pDS->Index (aE);
|
||||
if (nE < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pDS->HasInterf(nE, nFOp))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TopTools_ListOfShape aLV;
|
||||
const BOPDS_VectorOfInterfEF& aEFs = pDS->InterfEF();
|
||||
for (Standard_Integer iEF = 0; iEF < aEFs.Size(); ++iEF)
|
||||
{
|
||||
const BOPDS_InterfEF& aEF = aEFs (iEF);
|
||||
if (aEF.Contains (nE) && aEF.Contains(nFOp))
|
||||
{
|
||||
if (aEF.CommonPart().Type() == TopAbs_VERTEX)
|
||||
aLV.Append (pDS->Shape (aEF.IndexNew()));
|
||||
}
|
||||
}
|
||||
|
||||
if (aLV.IsEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make sure that there is an opposite intersection exists, i.e. some of the edges
|
||||
// of the opposite face intersect the artificially invalid face.
|
||||
const Standard_Integer nFArt = pDS->Index (aFArtIm);
|
||||
TopExp_Explorer expEOp (aFOppositeIm, TopAbs_EDGE);
|
||||
for (; expEOp.More(); expEOp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aEOp = expEOp.Current();
|
||||
const Standard_Integer nEOp = pDS->Index (aEOp);
|
||||
if (pDS->HasInterf(nEOp, nFArt))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!expEOp.More())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Intersection is present - add connection between offset faces.
|
||||
AddToContainer (aFArt, aFOpposite, mySSInterfsArt);
|
||||
|
||||
// Add connection between edge and opposite face
|
||||
AddToContainer (aE, aFOpposite, mySSInterfsArt);
|
||||
|
||||
// Along with the opposite face, save the intersection vertices to
|
||||
// be used for trimming the intersection edge in the rebuilding process
|
||||
for (TopTools_ListOfShape::Iterator itLV (aLV); itLV.More(); itLV.Next())
|
||||
{
|
||||
// Add connection to intersection vertex
|
||||
AddToContainer (aE, itLV.Value(), mySSInterfsArt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4960,7 +5116,9 @@ void BRepOffset_BuildOffsetFaces::CheckEdgesCreatedByVertex()
|
||||
//purpose : Filtering the invalid edges according to currently invalid faces
|
||||
//=======================================================================
|
||||
void BRepOffset_BuildOffsetFaces::FilterInvalidEdges (const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
|
||||
const TopTools_IndexedMapOfShape& theMERemoved)
|
||||
const TopTools_IndexedMapOfShape& theMERemoved,
|
||||
const TopTools_IndexedMapOfShape& theMEInside,
|
||||
TopTools_MapOfShape& theMEUseInRebuild)
|
||||
{
|
||||
TopoDS_Compound aCEInv;
|
||||
TopTools_IndexedMapOfShape aMEInv;
|
||||
@@ -5023,14 +5181,16 @@ void BRepOffset_BuildOffsetFaces::FilterInvalidEdges (const BRepOffset_DataMapOf
|
||||
const TopoDS_Shape& aF = myInvalidFaces.FindKey (i);
|
||||
if (myArtInvalidFaces.IsBound (aF))
|
||||
{
|
||||
const TopTools_IndexedMapOfShape& aMIE = theDMFMIE.Find (aF);
|
||||
const Standard_Integer aNbIE = aMIE.Extent();
|
||||
for (Standard_Integer iE = 1; iE <= aNbIE; ++iE)
|
||||
if (const TopTools_IndexedMapOfShape* aMIE = theDMFMIE.Seek (aF))
|
||||
{
|
||||
const TopoDS_Shape& aE = aMIE (iE);
|
||||
if (aMEInv.Contains (aE) && !aMEInvToAvoid.Contains (aE))
|
||||
const Standard_Integer aNbIE = aMIE->Extent();
|
||||
for (Standard_Integer iE = 1; iE <= aNbIE; ++iE)
|
||||
{
|
||||
aReallyInvEdges.Add (aE);
|
||||
const TopoDS_Shape& aE = aMIE->FindKey (iE);
|
||||
if (aMEInv.Contains (aE) && !aMEInvToAvoid.Contains (aE))
|
||||
{
|
||||
aReallyInvEdges.Add (aE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5053,8 +5213,46 @@ void BRepOffset_BuildOffsetFaces::FilterInvalidEdges (const BRepOffset_DataMapOf
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
myInvalidEdges = aReallyInvEdges;
|
||||
|
||||
// Check if any of the currently invalid edges may be used for
|
||||
// rebuilding splits of invalid faces.
|
||||
// For that the edge should be inside and not connected to invalid
|
||||
// boundary edges of the same origin.
|
||||
|
||||
aNb = myInvalidEdges.Extent();
|
||||
for (i = 1; i <= aNb; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aE = myInvalidEdges (i);
|
||||
if (!theMEInside.Contains (aE) || !myValidEdges.Contains (aE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const TopTools_ListOfShape* pEOrigins = myOEOrigins.Seek (aE);
|
||||
if (!pEOrigins)
|
||||
{
|
||||
theMEUseInRebuild.Add (aE);
|
||||
continue;
|
||||
}
|
||||
|
||||
Standard_Boolean bHasInvOutside = Standard_False;
|
||||
for (TopTools_ListOfShape::Iterator itEOr (*pEOrigins); !bHasInvOutside && itEOr.More(); itEOr.Next())
|
||||
{
|
||||
if (const TopTools_ListOfShape* pEIms = myOEImages.Seek (itEOr.Value()))
|
||||
{
|
||||
for (TopTools_ListOfShape::Iterator itEIms (*pEIms); !bHasInvOutside && itEIms.More(); itEIms.Next())
|
||||
{
|
||||
bHasInvOutside = myInvalidEdges.Contains (itEIms.Value()) && !theMEInside.Contains (itEIms.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!bHasInvOutside)
|
||||
{
|
||||
theMEUseInRebuild.Add (aE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -5116,7 +5314,7 @@ void BRepOffset_BuildOffsetFaces::FindFacesToRebuild()
|
||||
aDMFLV.Bind (aF, aLVAvoid);
|
||||
}
|
||||
//
|
||||
const TopTools_ListOfShape* pLF = mySSInterfs.Seek (aF);
|
||||
const TopTools_ListOfShape* pLF = !myArtInvalidFaces.IsBound(aF) ? mySSInterfs.Seek (aF) : mySSInterfsArt.Seek(aF);
|
||||
if (pLF)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape aItLFE (*pLF);
|
||||
@@ -5275,7 +5473,7 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
|
||||
TopTools_DataMapOfShapeShape aDMFImF;
|
||||
TopoDS_Compound aCFArt;
|
||||
BRep_Builder().MakeCompound (aCFArt);
|
||||
TopTools_DataMapIteratorOfDataMapOfShapeShape aItM (myArtInvalidFaces);
|
||||
BRepOffset_DataMapOfShapeIndexedMapOfShape::Iterator aItM (myArtInvalidFaces);
|
||||
for (; aItM.More(); aItM.Next())
|
||||
{
|
||||
const TopoDS_Shape& aF = aItM.Key();
|
||||
@@ -5597,9 +5795,13 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopTools_ListOfShape& aLFImi = myOFImages.FindFromKey (aFi);
|
||||
const TopTools_ListOfShape* aLFImi = myOFImages.Seek (aFi);
|
||||
if (!aLFImi)
|
||||
continue;
|
||||
//
|
||||
TopTools_ListOfShape& aLFEi = aFLE.ChangeFromKey (aFi);
|
||||
TopTools_ListOfShape* aLFEi = aFLE.ChangeSeek (aFi);
|
||||
if (!aLFEi)
|
||||
continue;
|
||||
//
|
||||
TopTools_ListOfShape& aLFDone = aMDone.ChangeFind (aFi);
|
||||
//
|
||||
@@ -5618,20 +5820,42 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
|
||||
if (pInterFi && !pInterFi->Contains (aFj))
|
||||
continue;
|
||||
|
||||
const TopTools_ListOfShape& aLFImj = myOFImages.FindFromKey (aFj);
|
||||
const TopTools_ListOfShape* aLFImj = myOFImages.Seek(aFj);
|
||||
if (!aLFImj)
|
||||
continue;
|
||||
//
|
||||
TopTools_ListOfShape& aLFEj = aFLE.ChangeFromKey (aFj);
|
||||
TopTools_ListOfShape* aLFEj = aFLE.ChangeSeek (aFj);
|
||||
if (!aLFEj)
|
||||
continue;
|
||||
|
||||
//
|
||||
// if there are some common edges between faces
|
||||
// we should use these edges and do not intersect again.
|
||||
TopTools_ListOfShape aLEC;
|
||||
FindCommonParts (aLFImi, aLFImj, aLEC);
|
||||
FindCommonParts (*aLFImi, *aLFImj, aLEC);
|
||||
//
|
||||
if (aLEC.Extent())
|
||||
{
|
||||
// no need to intersect if we have common edges between faces
|
||||
Standard_Boolean bForceUse = aMFIntExt.Contains (aFi) || aMFIntExt.Contains (aFj);
|
||||
ProcessCommonEdges (aLEC, aME, aMEInfETrim, aMAllInvs, bForceUse, aMECV, aMECheckExt, aDMEETrim, aLFEi, aLFEj, aMEToInt);
|
||||
ProcessCommonEdges (aLEC, aME, aMEInfETrim, aMAllInvs, bForceUse, aMECV, aMECheckExt, aDMEETrim, *aLFEi, *aLFEj, aMEToInt);
|
||||
|
||||
// Add common vertices not belonging to the common edges for trimming the intersection edges
|
||||
TopTools_IndexedMapOfShape aMVOnCE;
|
||||
for (TopTools_ListOfShape::Iterator itE (aLEC); itE.More(); itE.Next())
|
||||
{
|
||||
TopExp::MapShapes (itE.Value(), TopAbs_VERTEX, aMVOnCE);
|
||||
}
|
||||
|
||||
TopTools_ListOfShape aLEV;
|
||||
FindCommonParts (*aLFImi, *aLFImj, aLEV, TopAbs_VERTEX);
|
||||
for (TopTools_ListOfShape::Iterator itV (aLEV); itV.More(); itV.Next())
|
||||
{
|
||||
if (!aMVOnCE.Contains (itV.Value()))
|
||||
{
|
||||
aMECV.Add (itV.Value());
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -5657,7 +5881,7 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
|
||||
{
|
||||
// use intersection line obtained on the previous steps
|
||||
// plus, find new origins for these lines
|
||||
UpdateIntersectedFaces (aFInv, aFi, aFj, aLFInv, aLFImi, aLFImj, aLFEi, aLFEj, aMEToInt);
|
||||
UpdateIntersectedFaces (aFInv, aFi, aFj, aLFInv, *aLFImi, *aLFImj, *aLFEi, *aLFEj, aMEToInt);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
@@ -5669,13 +5893,14 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
|
||||
aLFDone.Append (aFj);
|
||||
aMDone.ChangeFind (aFj).Append (aFi);
|
||||
//
|
||||
IntersectFaces (aFInv, aFi, aFj, aLFInv, aLFImi, aLFImj, aLFEi, aLFEj, aMECV, aMEToInt);
|
||||
IntersectFaces (aFInv, aFi, aFj, aLFInv, *aLFImi, *aLFImj, *aLFEi, *aLFEj, aMECV, aMEToInt);
|
||||
}
|
||||
}
|
||||
//
|
||||
// intersect and trim edges for this chain
|
||||
IntersectAndTrimEdges (aMFInt, aMEToInt, aDMEETrim, aME, aMECV,
|
||||
aMVInv, aMVRInv, aMECheckExt, aMVBounds, aEImages);
|
||||
aMVInv, aMVRInv, aMECheckExt, bArtificial ? &mySSInterfsArt : 0,
|
||||
aMVBounds, aEImages);
|
||||
//
|
||||
Standard_Integer iE, aNbEToInt = aMEToInt.Extent();
|
||||
for (iE = 1; iE <= aNbEToInt; ++iE)
|
||||
@@ -5956,12 +6181,8 @@ void BRepOffset_BuildOffsetFaces::FindFacesForIntersection (const TopoDS_Shape&
|
||||
}
|
||||
}
|
||||
//
|
||||
if (theArtCase)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//
|
||||
const TopTools_ListOfShape* pLFInv = mySSInterfs.Seek (theFInv);
|
||||
const TopTools_DataMapOfShapeListOfShape& aSSInterfsMap = theArtCase ? mySSInterfsArt : mySSInterfs;
|
||||
const TopTools_ListOfShape* pLFInv = aSSInterfsMap.Seek (theFInv);
|
||||
if (!pLFInv)
|
||||
{
|
||||
return;
|
||||
@@ -5985,7 +6206,7 @@ void BRepOffset_BuildOffsetFaces::FindFacesForIntersection (const TopoDS_Shape&
|
||||
for (i = 1; i <= aNbE; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aS = theME (i);
|
||||
const TopTools_ListOfShape* pLF = mySSInterfs.Seek (aS);
|
||||
const TopTools_ListOfShape* pLF = aSSInterfsMap.Seek (aS);
|
||||
if (!pLF)
|
||||
{
|
||||
continue;
|
||||
@@ -6002,30 +6223,33 @@ void BRepOffset_BuildOffsetFaces::FindFacesForIntersection (const TopoDS_Shape&
|
||||
//
|
||||
// check if the face has some connection to already added for intersection faces
|
||||
const TopTools_ListOfShape& aLFIm = myOFImages.FindFromKey (aF);
|
||||
TopTools_ListIteratorOfListOfShape aItLFIm (aLFIm);
|
||||
for (; aItLFIm.More(); aItLFIm.Next())
|
||||
if (!theArtCase)
|
||||
{
|
||||
const TopoDS_Shape& aFIm = aItLFIm.Value();
|
||||
TopExp_Explorer aExp (aFIm, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next())
|
||||
TopTools_ListIteratorOfListOfShape aItLFIm (aLFIm);
|
||||
for (; aItLFIm.More(); aItLFIm.Next())
|
||||
{
|
||||
if (aMShapes.Contains (aExp.Current()))
|
||||
const TopoDS_Shape& aFIm = aItLFIm.Value();
|
||||
TopExp_Explorer aExp (aFIm, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next())
|
||||
{
|
||||
if (aMShapes.Contains (aExp.Current()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aExp.More())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aExp.More())
|
||||
if (!aItLFIm.More())
|
||||
{
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!aItLFIm.More())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aMFToAdd.Add (aF);
|
||||
aItLFIm.Initialize (aLFIm);
|
||||
TopTools_ListIteratorOfListOfShape aItLFIm (aLFIm);
|
||||
for (; aItLFIm.More(); aItLFIm.Next())
|
||||
{
|
||||
const TopoDS_Shape& aFIm = aItLFIm.Value();
|
||||
@@ -6423,6 +6647,7 @@ void BRepOffset_BuildOffsetFaces::IntersectAndTrimEdges (const TopTools_IndexedM
|
||||
const TopTools_MapOfShape& theVertsToAvoid,
|
||||
const TopTools_MapOfShape& theNewVertsToAvoid,
|
||||
const TopTools_MapOfShape& theMECheckExt,
|
||||
const TopTools_DataMapOfShapeListOfShape* theSSInterfs,
|
||||
TopTools_MapOfShape& theMVBounds,
|
||||
TopTools_DataMapOfShapeListOfShape& theEImages)
|
||||
{
|
||||
@@ -6468,30 +6693,39 @@ void BRepOffset_BuildOffsetFaces::IntersectAndTrimEdges (const TopTools_IndexedM
|
||||
aNb = theMSInv.Extent();
|
||||
for (i = 1; i <= aNb; ++i)
|
||||
{
|
||||
const TopoDS_Shape& aV = theMSInv (i);
|
||||
if (aV.ShapeType() != TopAbs_VERTEX)
|
||||
const TopoDS_Shape& aS = theMSInv(i);
|
||||
// edge case
|
||||
if (theSSInterfs)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//
|
||||
TopTools_ListOfShape* pLVE = aDMVE.ChangeSeek (aV);
|
||||
if (!pLVE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aIt.Initialize (*pLVE);
|
||||
for (; aIt.More(); aIt.Next())
|
||||
{
|
||||
const TopoDS_Shape& aE = aIt.Value();
|
||||
//
|
||||
aExp.Init (aE, TopAbs_VERTEX);
|
||||
for (; aExp.More(); aExp.Next())
|
||||
if (const TopTools_ListOfShape* pLV = theSSInterfs->Seek (aS))
|
||||
{
|
||||
const TopoDS_Shape& aV1 = aExp.Current();
|
||||
if (!theVertsToAvoid.Contains (aV1) && aMFence.Add (aV1))
|
||||
// Add vertices from intersection info to trim section edges of artificial faces
|
||||
for (TopTools_ListOfShape::Iterator itLV (*pLV); itLV.More(); itLV.Next())
|
||||
{
|
||||
aLArgs.Append (aV1);
|
||||
if (itLV.Value().ShapeType() == TopAbs_VERTEX)
|
||||
{
|
||||
aLArgs.Append (itLV.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// vertex case
|
||||
if (const TopTools_ListOfShape* pLVE = aDMVE.ChangeSeek(aS))
|
||||
{
|
||||
aIt.Initialize(*pLVE);
|
||||
for (; aIt.More(); aIt.Next())
|
||||
{
|
||||
const TopoDS_Shape& aE = aIt.Value();
|
||||
//
|
||||
aExp.Init(aE, TopAbs_VERTEX);
|
||||
for (; aExp.More(); aExp.Next())
|
||||
{
|
||||
const TopoDS_Shape& aV1 = aExp.Current();
|
||||
if (!theVertsToAvoid.Contains(aV1) && aMFence.Add(aV1))
|
||||
{
|
||||
aLArgs.Append(aV1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7137,9 +7371,19 @@ void BRepOffset_BuildOffsetFaces::UpdateValidEdges (const TopTools_IndexedDataMa
|
||||
TopExp::MapShapes (aItSpIm.Value(), TopAbs_EDGE, aNewEdges);
|
||||
}
|
||||
}
|
||||
|
||||
TopoDS_Compound anInsideEdges;
|
||||
BRep_Builder().MakeCompound (anInsideEdges);
|
||||
for (Standard_Integer iE = 1; iE <= myInsideEdges.Extent(); ++iE)
|
||||
{
|
||||
BRep_Builder().Add (anInsideEdges, myInsideEdges (iE));
|
||||
}
|
||||
|
||||
//
|
||||
// Rebuild the map of edges to avoid, using the intersection results
|
||||
TopTools_IndexedMapOfShape aMEAvoid;
|
||||
TopoDS_Compound aCEAvoid;
|
||||
BRep_Builder().MakeCompound (aCEAvoid);
|
||||
// GF's data structure
|
||||
const BOPDS_PDS& pDS = aGF.PDS();
|
||||
|
||||
@@ -7175,7 +7419,7 @@ void BRepOffset_BuildOffsetFaces::UpdateValidEdges (const TopTools_IndexedDataMa
|
||||
if (bKeep)
|
||||
{
|
||||
// keep the original edge
|
||||
aMEAvoid.Add (aE);
|
||||
AddToContainer (aE, aMEAvoid);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7184,9 +7428,41 @@ void BRepOffset_BuildOffsetFaces::UpdateValidEdges (const TopTools_IndexedDataMa
|
||||
{
|
||||
const TopoDS_Shape& aEIm = aItLEIm.Value();
|
||||
if (!aNewEdges.Contains (aEIm))
|
||||
aMEAvoid.Add (aEIm);
|
||||
{
|
||||
AddToContainer(aEIm, aCEAvoid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean isCut = Standard_False;
|
||||
if (aCEAvoid.NbChildren() > 0)
|
||||
{
|
||||
// Perform intersection with the small subset of the edges to make
|
||||
// it possible to use the inside edges for building new splits.
|
||||
BOPAlgo_BOP aBOP;
|
||||
aBOP.AddArgument (aCEAvoid);
|
||||
aBOP.AddTool (anInsideEdges);
|
||||
aBOP.SetOperation (BOPAlgo_CUT);
|
||||
aBOP.Perform();
|
||||
isCut = !aBOP.HasErrors();
|
||||
|
||||
if (isCut)
|
||||
{
|
||||
for (TopoDS_Iterator itCE (aCEAvoid); itCE.More(); itCE.Next())
|
||||
{
|
||||
if (!aBOP.IsDeleted (itCE.Value()))
|
||||
{
|
||||
aMEAvoid.Add (itCE.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCut)
|
||||
{
|
||||
TopExp::MapShapes (aCEAvoid, TopAbs_EDGE, aMEAvoid);
|
||||
}
|
||||
|
||||
myEdgesToAvoid = aMEAvoid;
|
||||
}
|
||||
|
||||
|
@@ -132,7 +132,7 @@ static int TranslateFrom (const BinObjMgt_Persistent& theSource,
|
||||
TopAbs_Orientation anOrient = CharToOrientation (aCharOrient);
|
||||
|
||||
theResult.TShape (theShapeSet->Shape (aShapeID).TShape());//TShape
|
||||
theResult.Location (theShapeSet->Locations().Location (aLocID)); //Location
|
||||
theResult.Location (theShapeSet->Locations().Location (aLocID), Standard_False); //Location
|
||||
theResult.Orientation (anOrient);//Orientation
|
||||
return 0;
|
||||
}
|
||||
|
@@ -89,139 +89,173 @@ static void D22d(const Standard_Address C, const Standard_Real U,
|
||||
void CPnts_UniformDeflection::Perform()
|
||||
{
|
||||
gp_Pnt P, P1, P2;
|
||||
// gp_Vec V1, V2, VV1, VV2, VV;
|
||||
gp_Vec V1, V2, VV;
|
||||
Standard_Real Un1;
|
||||
Standard_Real NormD1, NormD2;
|
||||
|
||||
myIPoint = -1;
|
||||
myNbPoints = -1;
|
||||
|
||||
while ( (myNbPoints<2) && (!myFinish) ) {
|
||||
|
||||
myNbPoints = myNbPoints + 1;
|
||||
|
||||
const Standard_Real anEspilon = Epsilon(myFirstParam);
|
||||
|
||||
while ( (myNbPoints<2) && (!myFinish) )
|
||||
{
|
||||
++myNbPoints;
|
||||
myParams[myNbPoints] = myFirstParam;
|
||||
|
||||
if (my3d)
|
||||
{
|
||||
D23d(myCurve, myFirstParam, myPoints[myNbPoints], V1, V2);
|
||||
}
|
||||
else
|
||||
{
|
||||
D22d(myCurve, myFirstParam, myPoints[myNbPoints], V1, V2);
|
||||
P = myPoints[myNbPoints] ;
|
||||
}
|
||||
P = myPoints[myNbPoints];
|
||||
NormD1 = V1.Magnitude();
|
||||
if (NormD1 < myTolCur || V2.Magnitude() < myTolCur) {
|
||||
if (NormD1 < myTolCur || V2.Magnitude() < myTolCur)
|
||||
{
|
||||
// singularity on the tangent or null curvature
|
||||
myDu = Min(myDwmax, 1.5 * myDu);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
NormD2 = V2.CrossMagnitude(V1);
|
||||
if (NormD2 / NormD1 < myDeflection) { // collinearity of derivatives
|
||||
myDu = Min(myDwmax, 1.5 * myDu);
|
||||
if (NormD2 / NormD1 < myDeflection)
|
||||
{
|
||||
// collinearity of derivatives
|
||||
myDu = Min(myDwmax, 1.5 * myDu);
|
||||
}
|
||||
else {
|
||||
myDu = Sqrt(8.* myDeflection * NormD1 / NormD2 );
|
||||
myDu = Min(Max(myDu, myTolCur), myDwmax);
|
||||
else
|
||||
{
|
||||
myDu = Sqrt(8.* myDeflection * NormD1 / NormD2);
|
||||
myDu = Min(Max(myDu, myTolCur), myDwmax);
|
||||
}
|
||||
}
|
||||
|
||||
// check if the arrow is observed if WithControl
|
||||
|
||||
if (myControl) {
|
||||
if (myControl)
|
||||
{
|
||||
myDu = Min(myDu, myLastParam-myFirstParam);
|
||||
if (my3d) {
|
||||
|
||||
D03d(myCurve, myFirstParam + myDu,P);
|
||||
D03d(myCurve, myFirstParam + (myDu / 2.0),P1);
|
||||
if (my3d)
|
||||
{
|
||||
D03d(myCurve, myFirstParam + myDu,P);
|
||||
D03d(myCurve, myFirstParam + (myDu / 2.0), P1);
|
||||
}
|
||||
else {
|
||||
|
||||
D02d(myCurve, myFirstParam + myDu,P);
|
||||
D02d(myCurve, myFirstParam + (myDu / 2.0),P1);
|
||||
else
|
||||
{
|
||||
D02d(myCurve, myFirstParam + myDu,P);
|
||||
D02d(myCurve, myFirstParam + (myDu / 2.0), P1);
|
||||
}
|
||||
V1= gp_Vec(myPoints[myNbPoints], P);
|
||||
NormD1 = V1.Magnitude();
|
||||
if (NormD1 >= myDeflection) {
|
||||
V2 = gp_Vec(myPoints[myNbPoints], P1);
|
||||
NormD2 = V2.CrossMagnitude(V1) / NormD1;
|
||||
|
||||
// passing of arrow starting from which the redivision is done is arbitrary
|
||||
// probably it will be necessary to readjust it (differentiate the first point
|
||||
// from the others) this test does not work on the points of inflexion
|
||||
|
||||
if (NormD2 > myDeflection / 5.0) {
|
||||
NormD2 = Max(NormD2, 1.1 * myDeflection);
|
||||
myDu = myDu * Sqrt(myDeflection / NormD2);
|
||||
myDu = Min(Max(myDu, myTolCur), myDwmax);
|
||||
}
|
||||
if (NormD1 >= myDeflection)
|
||||
{
|
||||
V2 = gp_Vec(myPoints[myNbPoints], P1);
|
||||
NormD2 = V2.CrossMagnitude(V1) / NormD1;
|
||||
|
||||
// passing of arrow starting from which the redivision is done is arbitrary
|
||||
// probably it will be necessary to readjust it (differentiate the first point
|
||||
// from the others) this test does not work on the points of inflexion
|
||||
if (NormD2 > myDeflection / 5.0)
|
||||
{
|
||||
NormD2 = Max(NormD2, 1.1 * myDeflection);
|
||||
myDu = myDu * Sqrt(myDeflection / NormD2);
|
||||
myDu = Min(Max(myDu, myTolCur), myDwmax);
|
||||
}
|
||||
}
|
||||
}
|
||||
myFirstParam = myFirstParam + myDu;
|
||||
myFinish = (myLastParam - myFirstParam < myTolCur) || (myDu == 0.);
|
||||
myFirstParam += myDu;
|
||||
myFinish = myLastParam - myFirstParam < myTolCur ||
|
||||
Abs(myDu) < myTolCur ||
|
||||
// to avoid less than double precision endless increment
|
||||
myDu < anEspilon;
|
||||
}
|
||||
if (myFinish) {
|
||||
if (myFinish)
|
||||
{
|
||||
// the last point is corrected if control
|
||||
if (myControl && (myNbPoints == 1) ) {
|
||||
if (myControl && (myNbPoints == 1) )
|
||||
{
|
||||
Un1 = myParams[0];
|
||||
if (myLastParam - Un1 < 0.33*(myLastParam-myFirstParam)) {
|
||||
myFirstParam = (myLastParam + Un1) / 2.0;
|
||||
myParams[0]= myFirstParam;
|
||||
myParams[1]= myLastParam;
|
||||
if (my3d) {
|
||||
D03d(myCurve, myParams[0], myPoints[0]);
|
||||
D03d(myCurve, myParams[1], myPoints[1]);
|
||||
}
|
||||
else {
|
||||
D02d(myCurve, myParams[0], myPoints[0]);
|
||||
if (myLastParam - Un1 < 0.33*(myLastParam-myFirstParam))
|
||||
{
|
||||
myFirstParam = (myLastParam + Un1) / 2.0;
|
||||
myParams[0] = myFirstParam;
|
||||
myParams[1] = myLastParam;
|
||||
if (my3d)
|
||||
{
|
||||
D03d(myCurve, myParams[0], myPoints[0]);
|
||||
D03d(myCurve, myParams[1], myPoints[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
D02d(myCurve, myParams[0], myPoints[0]);
|
||||
D02d(myCurve, myParams[1], myPoints[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (my3d) {
|
||||
D23d(myCurve, myLastParam, P1, V1, V2);
|
||||
}
|
||||
else {
|
||||
D22d(myCurve, myLastParam, P1, V1, V2);
|
||||
}
|
||||
P = myPoints[0] ;
|
||||
VV = gp_Vec(P1, P);
|
||||
NormD1 = VV.Magnitude();
|
||||
if ( NormD1 < myDeflection) {
|
||||
myParams[1]= myLastParam;
|
||||
myPoints[1]= P1 ;
|
||||
}
|
||||
else {
|
||||
myFirstParam = (myLastParam * (myParams[1] - Un1) + Un1 * myDu)
|
||||
/(myFirstParam -Un1);
|
||||
if (my3d)
|
||||
D03d(myCurve, myFirstParam, P2);
|
||||
else
|
||||
D02d(myCurve, myFirstParam, P2);
|
||||
|
||||
if ((VV.CrossMagnitude(gp_Vec(P2, P)) / NormD1 < myDeflection) &&
|
||||
(Un1 >= myLastParam - myDwmax) ) {
|
||||
// point n is removed
|
||||
myParams[1]= myLastParam;
|
||||
myPoints[1] = P1 ;
|
||||
}
|
||||
else {
|
||||
myParams[1]=myFirstParam;
|
||||
myPoints[1] = P2 ;
|
||||
myParams[2]=myLastParam;
|
||||
myPoints[2] = P1 ;
|
||||
myNbPoints = myNbPoints +1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (my3d)
|
||||
{
|
||||
D23d(myCurve, myLastParam, P1, V1, V2);
|
||||
}
|
||||
else
|
||||
{
|
||||
D22d(myCurve, myLastParam, P1, V1, V2);
|
||||
}
|
||||
P = myPoints[0];
|
||||
VV = gp_Vec(P1, P);
|
||||
NormD1 = VV.Magnitude();
|
||||
if (NormD1 < myDeflection)
|
||||
{
|
||||
myParams[1] = myLastParam;
|
||||
myPoints[1] = P1;
|
||||
}
|
||||
else
|
||||
{
|
||||
myFirstParam = (myLastParam * (myParams[1] - Un1) + Un1 * myDu) / (myFirstParam - Un1);
|
||||
if (my3d)
|
||||
{
|
||||
D03d(myCurve, myFirstParam, P2);
|
||||
}
|
||||
else
|
||||
{
|
||||
D02d(myCurve, myFirstParam, P2);
|
||||
}
|
||||
if ((VV.CrossMagnitude(gp_Vec(P2, P)) / NormD1 < myDeflection) &&
|
||||
(Un1 >= myLastParam - myDwmax) )
|
||||
{
|
||||
// point n is removed
|
||||
myParams[1] = myLastParam;
|
||||
myPoints[1] = P1;
|
||||
}
|
||||
else
|
||||
{
|
||||
myParams[1] = myFirstParam;
|
||||
myPoints[1] = P2;
|
||||
myParams[2] = myLastParam;
|
||||
myPoints[2] = P1;
|
||||
++myNbPoints;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
myNbPoints = myNbPoints +1 ;
|
||||
if (myNbPoints >= 3) myNbPoints = 2;
|
||||
myParams[myNbPoints]= myLastParam;
|
||||
if (my3d) {
|
||||
D03d(myCurve, myLastParam, myPoints[myNbPoints]);
|
||||
}
|
||||
else {
|
||||
D02d(myCurve, myLastParam, myPoints[myNbPoints]);
|
||||
}
|
||||
else
|
||||
{
|
||||
++myNbPoints;
|
||||
if (myNbPoints >= 3)
|
||||
{
|
||||
myNbPoints = 2;
|
||||
}
|
||||
myParams[myNbPoints] = myLastParam;
|
||||
if (my3d)
|
||||
{
|
||||
D03d(myCurve, myLastParam, myPoints[myNbPoints]);
|
||||
}
|
||||
else
|
||||
{
|
||||
D02d(myCurve, myLastParam, myPoints[myNbPoints]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -139,12 +139,12 @@ ChFiDS_TypeOfConcavity ChFi3d::DefineConnectType(const TopoDS_Edge& E,
|
||||
//function : IsTangentFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const GeomAbs_Shape Order)
|
||||
Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const GeomAbs_Shape theOrder)
|
||||
{
|
||||
if (Order == GeomAbs_G1 && BRep_Tool::Continuity(theEdge, theFace1, theFace2) != GeomAbs_C0)
|
||||
if (theOrder == GeomAbs_G1 && BRep_Tool::Continuity(theEdge, theFace1, theFace2) != GeomAbs_C0)
|
||||
return Standard_True;
|
||||
|
||||
Standard_Real TolC0 = Max(0.001, 1.5*BRep_Tool::Tolerance(theEdge));
|
||||
@@ -152,15 +152,46 @@ Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
|
||||
Standard_Real aFirst;
|
||||
Standard_Real aLast;
|
||||
|
||||
// Obtaining of pcurves of edge on two faces.
|
||||
const Handle(Geom2d_Curve) aC2d1 = BRep_Tool::CurveOnSurface
|
||||
(theEdge, theFace1, aFirst, aLast);
|
||||
//For the case of seam edge
|
||||
TopoDS_Edge EE = theEdge;
|
||||
if (theFace1.IsSame(theFace2))
|
||||
EE.Reverse();
|
||||
const Handle(Geom2d_Curve) aC2d2 = BRep_Tool::CurveOnSurface
|
||||
(EE, theFace2, aFirst, aLast);
|
||||
Handle(Geom2d_Curve) aC2d1, aC2d2;
|
||||
|
||||
if (!theFace1.IsSame (theFace2) &&
|
||||
BRep_Tool::IsClosed (theEdge, theFace1) &&
|
||||
BRep_Tool::IsClosed (theEdge, theFace2))
|
||||
{
|
||||
//Find the edge in the face 1: this edge will have correct orientation
|
||||
TopoDS_Edge anEdgeInFace1;
|
||||
TopoDS_Face aFace1 = theFace1;
|
||||
aFace1.Orientation (TopAbs_FORWARD);
|
||||
TopExp_Explorer anExplo (aFace1, TopAbs_EDGE);
|
||||
for (; anExplo.More(); anExplo.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
|
||||
if (anEdge.IsSame (theEdge))
|
||||
{
|
||||
anEdgeInFace1 = anEdge;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (anEdgeInFace1.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
aC2d1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace1, aFirst, aLast);
|
||||
TopoDS_Face aFace2 = theFace2;
|
||||
aFace2.Orientation (TopAbs_FORWARD);
|
||||
anEdgeInFace1.Reverse();
|
||||
aC2d2 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace2, aFirst, aLast);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Obtaining of pcurves of edge on two faces.
|
||||
aC2d1 = BRep_Tool::CurveOnSurface (theEdge, theFace1, aFirst, aLast);
|
||||
//For the case of seam edge
|
||||
TopoDS_Edge EE = theEdge;
|
||||
if (theFace1.IsSame(theFace2))
|
||||
EE.Reverse();
|
||||
aC2d2 = BRep_Tool::CurveOnSurface (EE, theFace2, aFirst, aLast);
|
||||
}
|
||||
|
||||
if (aC2d1.IsNull() || aC2d2.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
@@ -191,15 +222,19 @@ Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
|
||||
if (i == aNbSamples) aPar = aLast;
|
||||
|
||||
LocalAnalysis_SurfaceContinuity aCont(aC2d1, aC2d2, aPar,
|
||||
aSurf1, aSurf2, Order,
|
||||
aSurf1, aSurf2, theOrder,
|
||||
0.001, TolC0, 0.1, 0.1, 0.1);
|
||||
if (!aCont.IsDone())
|
||||
{
|
||||
if (theOrder == GeomAbs_C2 &&
|
||||
aCont.StatusError() == LocalAnalysis_NullSecondDerivative)
|
||||
continue;
|
||||
|
||||
nbNotDone++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Order == GeomAbs_G1)
|
||||
if (theOrder == GeomAbs_G1)
|
||||
{
|
||||
if (!aCont.IsG1())
|
||||
return Standard_False;
|
||||
|
@@ -819,10 +819,13 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
|
||||
if(fd1->IndexOfS1() == fd2->IndexOfS1()) {
|
||||
jf1 = 1; jf2 = 1;
|
||||
face = TopoDS::Face(DStr.Shape(fd1->Index(jf1)));
|
||||
if (face.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL face");
|
||||
OrSave1 = cd1->Orientation(jf1);
|
||||
Or = OrFace1 = face.Orientation();
|
||||
OrSave2 = cd2->Orientation(jf2);
|
||||
OrFace2 = DStr.Shape(fd2->Index(jf2)).Orientation();
|
||||
const TopoDS_Shape& shape2 = DStr.Shape(fd2->Index(jf2));
|
||||
if (shape2.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL shape");
|
||||
OrFace2 = shape2.Orientation();
|
||||
visavis = Standard_True;
|
||||
sameside = ChFi3d::SameSide(Or,OrSave1,OrSave2,OrFace1,OrFace2);
|
||||
// The parameters of the other side are not used for orientation. This would raise problems
|
||||
@@ -840,10 +843,13 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
|
||||
if(fd1->IndexOfS2() == fd2->IndexOfS1()) {
|
||||
jf1 = 2; jf2 = 1;
|
||||
face = TopoDS::Face(DStr.Shape(fd1->Index(jf1)));
|
||||
if (face.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL face");
|
||||
OrSave1 = cd1->Orientation(jf1);
|
||||
Or = OrFace1 = face.Orientation();
|
||||
OrSave2 = cd2->Orientation(jf2);
|
||||
OrFace2 = DStr.Shape(fd2->Index(jf2)).Orientation();
|
||||
const TopoDS_Shape& shape2 = DStr.Shape(fd2->Index(jf2));
|
||||
if (shape2.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL shape");
|
||||
OrFace2 = shape2.Orientation();
|
||||
visavis = Standard_True;
|
||||
sameside = ChFi3d::SameSide(Or,OrSave1,OrSave2,OrFace1,OrFace2);
|
||||
// The parameters of the other side are not used for orientation. This would raise problems
|
||||
@@ -873,10 +879,13 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
|
||||
if(fd1->IndexOfS1() == fd2->IndexOfS2()) {
|
||||
jf1 = 1; jf2 = 2;
|
||||
face = TopoDS::Face(DStr.Shape(fd1->Index(jf1)));
|
||||
if (face.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL face");
|
||||
OrSave1 = cd1->Orientation(jf1);
|
||||
Or = OrFace1 = face.Orientation();
|
||||
OrSave2 = cd2->Orientation(jf2);
|
||||
OrFace2 = DStr.Shape(fd2->Index(jf2)).Orientation();
|
||||
const TopoDS_Shape& shape2 = DStr.Shape(fd2->Index(jf2));
|
||||
if (shape2.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL shape");
|
||||
OrFace2 = shape2.Orientation();
|
||||
visavis = Standard_True;
|
||||
sameside = ChFi3d::SameSide(Or,OrSave1,OrSave2,OrFace1,OrFace2);
|
||||
// The parameters of the other side are not used for orientation.
|
||||
@@ -906,10 +915,13 @@ Standard_Boolean ChFi3d_IsInFront(TopOpeBRepDS_DataStructure& DStr,
|
||||
if(fd1->IndexOfS2() == fd2->IndexOfS2()) {
|
||||
jf1 = 2; jf2 = 2;
|
||||
face = TopoDS::Face(DStr.Shape(fd1->Index(jf1)));
|
||||
if (face.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL face");
|
||||
OrSave1 = cd1->Orientation(jf1);
|
||||
Or = OrFace1 = face.Orientation();
|
||||
OrSave2 = cd2->Orientation(jf2);
|
||||
OrFace2 = DStr.Shape(fd2->Index(jf2)).Orientation();
|
||||
const TopoDS_Shape& shape2 = DStr.Shape(fd2->Index(jf2));
|
||||
if (shape2.IsNull()) throw Standard_NullObject("ChFi3d_IsInFront : Trying to check orientation of NULL shape");
|
||||
OrFace2 = shape2.Orientation();
|
||||
visavis = Standard_True;
|
||||
sameside = ChFi3d::SameSide(Or,OrSave1,OrSave2,OrFace1,OrFace2);
|
||||
// The parameters of the other side are not used for orientation.
|
||||
|
@@ -1684,6 +1684,13 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
|
||||
}
|
||||
if (compoint1 && compoint2) {
|
||||
SeqFil.Remove(num);
|
||||
num = ChFi3d_IndexOfSurfData(Vtx,stripe,sens);
|
||||
if (isfirst) {
|
||||
num1=num+1;
|
||||
}
|
||||
else {
|
||||
num1=num-1;
|
||||
}
|
||||
reg1=Standard_False; reg2=Standard_False;
|
||||
}
|
||||
}
|
||||
@@ -2036,6 +2043,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
|
||||
if ((possible1 && possible2) || (!possible1 && !possible2) || (nbarete > 4)) {
|
||||
while (!trouve) {
|
||||
nb++;
|
||||
if (nb>=nn) throw Standard_Failure("IntersectionAtEnd : the max number of faces reached");
|
||||
if (nb!=1) F3=Face[nb-2];
|
||||
Face[nb-1]=F3;
|
||||
if (CV1.Arc().IsSame(edgelibre1))
|
||||
@@ -2153,6 +2161,9 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
|
||||
F=Face[nb-1];
|
||||
if (!prolface[nb-1]) faceprol[nb-1]=F;
|
||||
}
|
||||
|
||||
if (F.IsNull()) throw Standard_NullObject("IntersectionAtEnd : Trying to intersect with NULL face");
|
||||
|
||||
Sfacemoins1=BRep_Tool::Surface(F);
|
||||
Handle(Geom_Curve) cint;
|
||||
Handle(Geom2d_Curve) C2dint1, C2dint2,cface,cfacemoins1;
|
||||
|
@@ -436,15 +436,6 @@ void Cocoa_Window::InvalidateContent (const Handle(Aspect_DisplayConnection)& )
|
||||
return;
|
||||
}
|
||||
|
||||
if ([NSThread isMainThread])
|
||||
{
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
[myHView setNeedsDisplay];
|
||||
#else
|
||||
[myHView setNeedsDisplay: YES];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
[myHView performSelectorOnMainThread: @selector(invalidateContentOcct:)
|
||||
withObject: NULL
|
||||
|
@@ -610,6 +610,9 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
const Bnd_Range aRange(theUt21, theUt22);
|
||||
Bnd_Range aProjRng1;
|
||||
|
||||
// Precision of the calculation depends on circles radii
|
||||
const Standard_Real aPrecision = Max(Epsilon(myC[0]->Circle().Radius()), Epsilon(myC[1]->Circle().Radius()));
|
||||
|
||||
// Project arc of the 1st circle between points theUt11 and theUt12 to the
|
||||
// 2nd circle. It is necessary to chose correct arc from two possible ones.
|
||||
|
||||
@@ -671,7 +674,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
// myIsParallel = TRUE and only the least distance will be returned.
|
||||
//4. Arcs are not parallel. Then several (or single) extremas will be returned.
|
||||
|
||||
if (aRng.Delta() > Precision::Angular())
|
||||
if (aRng.Delta() > Precision::Confusion())
|
||||
{
|
||||
Standard_Real aPar = 0.0;
|
||||
aRng.GetIntermediatePoint(0.5, aPar);
|
||||
@@ -686,7 +689,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
aMinSqD = Min(aMinSqD, ExtPCir.SquareDistance(anExtID));
|
||||
}
|
||||
|
||||
if (aMinSqD <= aMinSquareDist + 10.* Epsilon(1. + aMinSqD))
|
||||
if (aMinSqD <= aMinSquareDist + (1. + aMinSqD) * aPrecision)
|
||||
{
|
||||
ClearSolutions();
|
||||
mySqDist.Append(aMinSqD);
|
||||
@@ -711,7 +714,6 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Nearer solution can be found
|
||||
}
|
||||
else if (!aRng.IsVoid())
|
||||
@@ -787,7 +789,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
|
||||
imin = k;
|
||||
}
|
||||
}
|
||||
if (aDmin <= aMinSquareDist + 10.* Epsilon(1. + aDmin))
|
||||
if (aDmin <= aMinSquareDist + (1. + aDmin) * aPrecision)
|
||||
{
|
||||
if (imin == 0)
|
||||
{
|
||||
|
@@ -163,7 +163,6 @@ static Standard_Real ProjPOnC(const Pnt& theP,
|
||||
if (aD < aDist)
|
||||
aDist = aD;
|
||||
}
|
||||
aDist = sqrt(aDist);
|
||||
}
|
||||
return aDist;
|
||||
}
|
||||
@@ -340,10 +339,20 @@ void Extrema_GenExtCC::Perform()
|
||||
aNbInter[1] = anIntervals2->Length() - 1;
|
||||
}
|
||||
}
|
||||
if (C1.IsClosed() && aNbInter[0] == 1)
|
||||
{
|
||||
ChangeIntervals(anIntervals1, 3);
|
||||
aNbInter[0] = anIntervals1->Length() - 1;
|
||||
}
|
||||
if (C2.IsClosed() && aNbInter[1] == 1)
|
||||
{
|
||||
ChangeIntervals(anIntervals2, 3);
|
||||
aNbInter[1] = anIntervals2->Length() - 1;
|
||||
}
|
||||
|
||||
// Lipchitz constant computation.
|
||||
const Standard_Real aMaxLC = 10000.;
|
||||
Standard_Real aLC = 9.0; // Default value.
|
||||
Standard_Real aLC = 100.0; // Default value.
|
||||
const Standard_Real aMaxDer1 = 1.0 / C1.Resolution(1.0);
|
||||
const Standard_Real aMaxDer2 = 1.0 / C2.Resolution(1.0);
|
||||
Standard_Real aMaxDer = Max(aMaxDer1, aMaxDer2) * Sqrt(2.0);
|
||||
@@ -383,6 +392,43 @@ void Extrema_GenExtCC::Perform()
|
||||
}
|
||||
|
||||
Extrema_GlobOptFuncCCC2 aFunc (C1, C2);
|
||||
if (aLC < aMaxLC || aMaxDer > aMaxLC)
|
||||
{
|
||||
//Estimation of Lipschitz constant by gradient of optimization function
|
||||
//using sampling in parameter space.
|
||||
math_Vector aT(1, 2), aG(1, 2);
|
||||
Standard_Real aF, aMaxG = 0.;
|
||||
Standard_Real t1, t2, dt1, dt2;
|
||||
Standard_Integer n1 = 21, n2 = 21, i1, i2;
|
||||
dt1 = (C1.LastParameter() - C1.FirstParameter()) / (n1 - 1);
|
||||
dt2 = (C2.LastParameter() - C2.FirstParameter()) / (n2 - 1);
|
||||
for (i1 = 1, t1 = C1.FirstParameter(); i1 <= n1; ++i1, t1 += dt1)
|
||||
{
|
||||
aT(1) = t1;
|
||||
for (i2 = 1, t2 = C2.FirstParameter(); i2 <= n2; ++i2, t2 += dt2)
|
||||
{
|
||||
aT(2) = t2;
|
||||
aFunc.Values(aT, aF, aG);
|
||||
Standard_Real aMod = aG(1)*aG(1) + aG(2)*aG(2);
|
||||
aMaxG = Max(aMaxG, aMod);
|
||||
}
|
||||
}
|
||||
aMaxG = Sqrt(aMaxG);
|
||||
if (aMaxG > aMaxDer)
|
||||
{
|
||||
aLC = Min(aMaxG, aMaxLC);
|
||||
isConstLockedFlag = Standard_True;
|
||||
}
|
||||
if (aMaxG > 100. * aMaxLC)
|
||||
{
|
||||
aLC = 100. * aMaxLC;
|
||||
isConstLockedFlag = Standard_True;
|
||||
}
|
||||
else if (aMaxG < 0.1 * aMaxDer)
|
||||
{
|
||||
isConstLockedFlag = Standard_True;
|
||||
}
|
||||
}
|
||||
math_GlobOptMin aFinder(&aFunc, myLowBorder, myUppBorder, aLC);
|
||||
aFinder.SetLipConstState(isConstLockedFlag);
|
||||
aFinder.SetContinuity(aContinuity == GeomAbs_C2 ? 2 : 1);
|
||||
@@ -518,7 +564,6 @@ void Extrema_GenExtCC::Perform()
|
||||
aVec(2) = (aCurrent.Y() + aNext.Y()) * 0.5;
|
||||
|
||||
aFunc.Value(aVec, aVal);
|
||||
|
||||
if (Abs(aVal - aF) < Precision::Confusion())
|
||||
{
|
||||
// It seems the parallel segment is found.
|
||||
|
@@ -45,7 +45,7 @@ static Standard_Boolean _Value(const Adaptor3d_Curve& C1,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
F = C2.Value(v).Distance(C1.Value(u));
|
||||
F = C2.Value(v).SquareDistance(C1.Value(u));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ static Standard_Boolean _Value(const Adaptor2d_Curve2d& C1,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
F = C2.Value(v).Distance(C1.Value(u));
|
||||
F = C2.Value(v).SquareDistance(C1.Value(u));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -91,13 +91,14 @@ static Standard_Boolean _Gradient(const Adaptor3d_Curve& C1,
|
||||
|
||||
C1.D1(X(1), C1D0, C1D1);
|
||||
C2.D1(X(2), C2D0, C2D1);
|
||||
|
||||
|
||||
G(1) = - (C2D0.X() - C1D0.X()) * C1D1.X()
|
||||
- (C2D0.Y() - C1D0.Y()) * C1D1.Y()
|
||||
- (C2D0.Z() - C1D0.Z()) * C1D1.Z();
|
||||
G(2) = (C2D0.X() - C1D0.X()) * C2D1.X()
|
||||
+ (C2D0.Y() - C1D0.Y()) * C2D1.Y()
|
||||
+ (C2D0.Z() - C1D0.Z()) * C2D1.Z();
|
||||
G *= 2.;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -123,8 +124,11 @@ static Standard_Boolean _Gradient(const Adaptor2d_Curve2d& C1,
|
||||
|
||||
G(1) = - (C2D0.X() - C1D0.X()) * C1D1.X()
|
||||
- (C2D0.Y() - C1D0.Y()) * C1D1.Y();
|
||||
|
||||
G(2) = (C2D0.X() - C1D0.X()) * C2D1.X()
|
||||
+ (C2D0.Y() - C1D0.Y()) * C2D1.Y();
|
||||
G *= 2.;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -168,6 +172,7 @@ static Standard_Boolean _Hessian (const Adaptor3d_Curve& C1,
|
||||
+ (C2D0.X() - C1D0.X()) * C2D2.X()
|
||||
+ (C2D0.Y() - C1D0.Y()) * C2D2.Y()
|
||||
+ (C2D0.Z() - C1D0.Z()) * C2D2.Z();
|
||||
H *= 2.;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -206,10 +211,11 @@ static Standard_Boolean _Hessian (const Adaptor2d_Curve2d& C1,
|
||||
+ C2D1.Y() * C2D1.Y()
|
||||
+ (C2D0.X() - C1D0.X()) * C2D2.X()
|
||||
+ (C2D0.Y() - C1D0.Y()) * C2D2.Y();
|
||||
H *= 2.;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// C0
|
||||
//C0
|
||||
|
||||
//=======================================================================
|
||||
//function : Extrema_GlobOptFuncCCC0
|
||||
@@ -417,6 +423,5 @@ Standard_Boolean Extrema_GlobOptFuncCCC2::Values(const math_Vector& X,Standard_R
|
||||
else
|
||||
isHessianComputed = _Hessian(*myC1_2d, *myC2_2d, X, H);
|
||||
|
||||
|
||||
return (Value(X, F) && Gradient(X, G) && isHessianComputed);
|
||||
}
|
||||
|
@@ -103,9 +103,11 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
|
||||
{
|
||||
throw Standard_ProgramError ("Font_FTFont, Light and Normal hinting styles are mutually exclusive");
|
||||
}
|
||||
#ifdef HAVE_FREETYPE
|
||||
setLoadFlag (FT_LOAD_TARGET_LIGHT, (theParams.FontHinting & Font_Hinting_Light) != 0);
|
||||
setLoadFlag (FT_LOAD_NO_HINTING, (theParams.FontHinting & Font_Hinting_Normal) == 0
|
||||
&& (theParams.FontHinting & Font_Hinting_Light) == 0);
|
||||
#endif
|
||||
|
||||
// manage native / autohinting
|
||||
if ((theParams.FontHinting & Font_Hinting_ForceAutohint) != 0
|
||||
@@ -113,8 +115,10 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
|
||||
{
|
||||
throw Standard_ProgramError ("Font_FTFont, ForceAutohint and NoAutohint are mutually exclusive");
|
||||
}
|
||||
#ifdef HAVE_FREETYPE
|
||||
setLoadFlag (FT_LOAD_FORCE_AUTOHINT, (theParams.FontHinting & Font_Hinting_ForceAutohint) != 0);
|
||||
setLoadFlag (FT_LOAD_NO_AUTOHINT, (theParams.FontHinting & Font_Hinting_NoAutohint) != 0);
|
||||
#endif
|
||||
|
||||
if (!myFTLib->IsValid())
|
||||
{
|
||||
|
@@ -132,7 +132,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
if (SecondCurve->Degree() < Deg) { SecondCurve->IncreaseDegree(Deg); }
|
||||
|
||||
// Declarationd
|
||||
Standard_Real L1, L2, U_de_raccord;
|
||||
Standard_Real L1, L2;
|
||||
Standard_Integer ii, jj;
|
||||
Standard_Real Ratio=1, Ratio1, Ratio2, Delta1, Delta2;
|
||||
Standard_Integer NbP1 = FirstCurve->NbPoles(), NbP2 = SecondCurve->NbPoles();
|
||||
@@ -159,7 +159,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
Delta1 = 0;
|
||||
Ratio2 = 1/Ratio;
|
||||
Delta2 = Ratio2*SecondCurve->Knot(1) - FirstCurve->Knot(NbK1);
|
||||
U_de_raccord = FirstCurve->LastParameter();
|
||||
}
|
||||
else {
|
||||
// On ne bouge pas la seconde courbe
|
||||
@@ -167,12 +166,11 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
Delta1 = Ratio1*FirstCurve->Knot(NbK1) - SecondCurve->Knot(1);
|
||||
Ratio2 = 1;
|
||||
Delta2 = 0;
|
||||
U_de_raccord = SecondCurve->FirstParameter();
|
||||
}
|
||||
|
||||
// Les Noeuds
|
||||
Standard_Real eps;
|
||||
for (ii=1; ii<NbK1; ii++) {
|
||||
for (ii=1; ii<=NbK1; ii++) {
|
||||
Noeuds(ii) = Ratio1*FirstCurve->Knot(ii) - Delta1;
|
||||
if(ii > 1) {
|
||||
eps = Epsilon (Abs(Noeuds(ii-1)));
|
||||
@@ -183,11 +181,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
|
||||
}
|
||||
Mults(ii) = FirstCurve->Multiplicity(ii);
|
||||
}
|
||||
Noeuds(NbK1) = U_de_raccord;
|
||||
eps = Epsilon (Abs(Noeuds(NbK1-1)));
|
||||
if(Noeuds(NbK1) - Noeuds(NbK1-1) <= eps) {
|
||||
Noeuds(NbK1) += eps;
|
||||
}
|
||||
Mults(NbK1) = FirstCurve->Degree();
|
||||
for (ii=2, jj=NbK1+1; ii<=NbK2; ii++, jj++) {
|
||||
Noeuds(jj) = Ratio2*SecondCurve->Knot(ii) - Delta2;
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <Adaptor3d_TopolTool.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
@@ -82,7 +83,7 @@ void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
|
||||
|
||||
Standard_Real TolArc = Tol;
|
||||
Standard_Real TolTang = Tol;
|
||||
Standard_Real UVMaxStep = 0.001;
|
||||
Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
|
||||
Standard_Real Deflection = 0.1;
|
||||
|
||||
myIntersector.SetTolerances(TolArc,TolTang,UVMaxStep,Deflection);
|
||||
@@ -184,3 +185,4 @@ void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
|
||||
StdFail_NotDone_Raise_if(!myIntersector.IsDone(),"GeomInt_IntSS::LineOnS2");
|
||||
return slineS2(Index);
|
||||
}
|
||||
|
||||
|
@@ -106,7 +106,6 @@ public:
|
||||
|
||||
Standard_EXPORT static Handle(Geom2d_BSplineCurve) MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine, const Standard_Integer ideb, const Standard_Integer ifin, const Standard_Boolean onFirst);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <IntRes2d_IntersectionSegment.hxx>
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <ApproxInt_KnotTools.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : AdjustUPeriodic
|
||||
@@ -623,12 +624,31 @@ void GeomInt_IntSS::MakeCurve(const Standard_Integer Index,
|
||||
ifprm = (Standard_Integer)fprm;
|
||||
ilprm = (Standard_Integer)lprm;
|
||||
}
|
||||
//-- lbr :
|
||||
//-- Si une des surfaces est un plan , on approxime en 2d
|
||||
//-- sur cette surface et on remonte les points 2d en 3d.
|
||||
|
||||
Standard_Boolean anApprox = myApprox;
|
||||
Standard_Boolean anApprox1 = myApprox1;
|
||||
Standard_Boolean anApprox2 = myApprox2;
|
||||
GeomAbs_SurfaceType typs1, typs2;
|
||||
typs1 = myHS1->GetType();
|
||||
typs2 = myHS2->GetType();
|
||||
|
||||
if (typs1 == GeomAbs_Plane) {
|
||||
anApprox = Standard_False;
|
||||
anApprox1 = Standard_True;
|
||||
}
|
||||
else if (typs2 == GeomAbs_Plane) {
|
||||
anApprox = Standard_False;
|
||||
anApprox2 = Standard_True;
|
||||
}
|
||||
|
||||
Approx_ParametrizationType aParType = ApproxInt_KnotTools::DefineParType(WL, ifprm, ilprm,
|
||||
anApprox, anApprox1, anApprox2);
|
||||
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, myHS1 != myHS2, aParType);
|
||||
|
||||
//-- lbr :
|
||||
//-- Si une des surfaces est un plan , on approxime en 2d
|
||||
//-- sur cette surface et on remonte les points 2d en 3d.
|
||||
//
|
||||
if(typs1 == GeomAbs_Plane) {
|
||||
theapp3d.Perform(myHS1, myHS2, WL, Standard_False,
|
||||
@@ -646,12 +666,7 @@ void GeomInt_IntSS::MakeCurve(const Standard_Integer Index,
|
||||
if ((typs1==GeomAbs_BezierSurface || typs1==GeomAbs_BSplineSurface) &&
|
||||
(typs2==GeomAbs_BezierSurface || typs2==GeomAbs_BSplineSurface)) {
|
||||
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_True);
|
||||
//Standard_Boolean bUseSurfaces;
|
||||
//bUseSurfaces=NotUseSurfacesForApprox(myFace1, myFace2, WL, ifprm, ilprm);
|
||||
//if (bUseSurfaces) {
|
||||
//theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, Standard_False);
|
||||
//}
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_True, aParType);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
@@ -96,7 +96,11 @@ public:
|
||||
|
||||
Standard_EXPORT const AppParCurves_MultiBSpCurve& Value (const Standard_Integer Index) const;
|
||||
|
||||
|
||||
Standard_EXPORT static void Parameters(const GeomInt_TheMultiLineOfWLApprox& Line,
|
||||
const Standard_Integer firstP,
|
||||
const Standard_Integer lastP,
|
||||
const Approx_ParametrizationType Par,
|
||||
math_Vector& TheParameters);
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -1545,7 +1545,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
aProgramSrc->SetPBR (theIsPBR);
|
||||
aProgramSrc->SetPBR (theIsPBR); // should be set before defaultGlslVersion()
|
||||
|
||||
TCollection_AsciiString aSrcVert, aSrcVertExtraFunc, aSrcVertExtraMain;
|
||||
TCollection_AsciiString aSrcFrag, aSrcFragGetVertColor, aSrcFragExtraMain;
|
||||
@@ -1976,6 +1976,8 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
||||
{
|
||||
Standard_ASSERT_RAISE (theIndex >= 0 && theIndex <= 2,"");
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
aProgramSrc->SetPBR (true); // should be set before defaultGlslVersion()
|
||||
|
||||
Graphic3d_ShaderObject::ShaderVariableList aUniforms, aStageInOuts;
|
||||
|
||||
TCollection_AsciiString aSrcVert = TCollection_AsciiString()
|
||||
@@ -2022,7 +2024,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
||||
aProgramSrc->SetNbLightsMax (0);
|
||||
aProgramSrc->SetNbShadowMaps (0);
|
||||
aProgramSrc->SetNbClipPlanesMax (0);
|
||||
aProgramSrc->SetPBR (true);
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
|
||||
return aProgramSrc;
|
||||
|
@@ -214,9 +214,9 @@ Handle(Image_PixMap) Graphic3d_TextureRoot::GetImage (const Handle(Image_Support
|
||||
void Graphic3d_TextureRoot::convertToCompatible (const Handle(Image_SupportedFormats)& theSupported,
|
||||
const Handle(Image_PixMap)& theImage)
|
||||
{
|
||||
if (theSupported.IsNull()
|
||||
|| theSupported->IsSupported (theImage->Format())
|
||||
|| theImage.IsNull())
|
||||
if (theImage.IsNull()
|
||||
|| theSupported.IsNull()
|
||||
|| theSupported->IsSupported (theImage->Format()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -388,9 +388,6 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer Nelarg=(Poly1.NbSegments()/20);
|
||||
if(Nelarg<2) Nelarg=2;
|
||||
|
||||
for(Standard_Integer sp=1; sp <= Nbsp; sp++) {
|
||||
if(TriIndex[sp]>0) {
|
||||
const Intf_SectionPoint& SPnt = InterPP.PntValue(TriIndex[sp]);
|
||||
@@ -401,20 +398,7 @@ void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
|
||||
if(Abs(SegIndex1-SegIndex2)>1) {
|
||||
|
||||
EIP.Perform(Poly1,Poly1,SegIndex1,SegIndex2,ParamOn1,ParamOn2);
|
||||
if(EIP.NbRoots()==0) {
|
||||
//-- All neighbor segments are removed
|
||||
for(Standard_Integer k=sp+1;k<=Nbsp;k++) {
|
||||
Standard_Integer kk=TriIndex[k];
|
||||
// --- avoid negative indices as well as in outer done
|
||||
if( kk > 0 ) {
|
||||
if( Abs(SegIndex1-PtrSegIndex1[kk])< Nelarg
|
||||
&& Abs(SegIndex2-PtrSegIndex2[kk])< Nelarg) {
|
||||
TriIndex[k]=-k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(EIP.NbRoots()>=1) {
|
||||
if(EIP.NbRoots()>=1) {
|
||||
//--------------------------------------------------------------------
|
||||
//-- It is checked if the found point is a root
|
||||
//--------------------------------------------------------------------
|
||||
|
@@ -29,7 +29,7 @@
|
||||
//function : AddPointIntoLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static inline void AddPointIntoLine(Handle(IntSurf_LineOn2S) theLine,
|
||||
static inline void AddPointIntoLine(Handle(IntSurf_LineOn2S)& theLine,
|
||||
const Standard_Real* const theArrPeriods,
|
||||
IntSurf_PntOn2S &thePoint,
|
||||
IntPatch_Point* theVertex = 0)
|
||||
@@ -252,6 +252,69 @@ void IntPatch_ALineToWLine::SetTolOpenDomain(const Standard_Real aTol)
|
||||
return myTolOpenDomain;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CorrectEndPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntPatch_ALineToWLine::CorrectEndPoint(Handle(IntSurf_LineOn2S)& theLine,
|
||||
const Standard_Integer theIndex) const
|
||||
{
|
||||
const Standard_Real aTol = 1.e-5;
|
||||
const Standard_Real aSqTol = 1.e-10;
|
||||
|
||||
//Perform linear extrapolation from two previous points
|
||||
Standard_Integer anIndFirst, anIndSecond;
|
||||
if (theIndex == 1)
|
||||
{
|
||||
anIndFirst = 3;
|
||||
anIndSecond = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
anIndFirst = theIndex - 2;
|
||||
anIndSecond = theIndex - 1;
|
||||
}
|
||||
IntSurf_PntOn2S aPntOn2S = theLine->Value(theIndex);
|
||||
|
||||
for (Standard_Integer ii = 1; ii <= 2; ii++)
|
||||
{
|
||||
Standard_Boolean anIsOnFirst = (ii == 1);
|
||||
|
||||
const IntSurf_Quadric& aQuad = (ii == 1)? myQuad1 : myQuad2;
|
||||
if (aQuad.TypeQuadric() == GeomAbs_Cone)
|
||||
{
|
||||
const gp_Cone aCone = aQuad.Cone();
|
||||
const gp_Pnt anApex = aCone.Apex();
|
||||
if (anApex.SquareDistance (aPntOn2S.Value()) > aSqTol)
|
||||
continue;
|
||||
}
|
||||
else if (aQuad.TypeQuadric() == GeomAbs_Sphere)
|
||||
{
|
||||
Standard_Real aU, aV;
|
||||
aPntOn2S.ParametersOnSurface(anIsOnFirst, aU, aV);
|
||||
if (Abs(aV - M_PI/2) > aTol &&
|
||||
Abs(aV + M_PI/2) > aTol)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
gp_Pnt2d PrevPrevP2d = theLine->Value(anIndFirst).ValueOnSurface(anIsOnFirst);
|
||||
gp_Pnt2d PrevP2d = theLine->Value (anIndSecond).ValueOnSurface(anIsOnFirst);
|
||||
gp_Dir2d aDir = gp_Vec2d(PrevPrevP2d, PrevP2d);
|
||||
Standard_Real aX0 = PrevPrevP2d.X(), aY0 = PrevPrevP2d.Y();
|
||||
Standard_Real aXend, aYend;
|
||||
aPntOn2S.ParametersOnSurface(anIsOnFirst, aXend, aYend);
|
||||
|
||||
if (Abs(aDir.Y()) < gp::Resolution())
|
||||
continue;
|
||||
|
||||
Standard_Real aNewXend = aDir.X()/aDir.Y() * (aYend - aY0) + aX0;
|
||||
|
||||
theLine->SetUV (theIndex, anIsOnFirst, aNewXend, aYend);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSectionRadius
|
||||
//purpose :
|
||||
@@ -331,24 +394,27 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
#if 0
|
||||
//To draw ALine as a wire DRAW-object use the following code.
|
||||
{
|
||||
static int zzz = 0;
|
||||
zzz++;
|
||||
static int ind = 0;
|
||||
ind++;
|
||||
|
||||
bool flShow = /*(zzz == 1)*/false;
|
||||
bool flShow = true;
|
||||
|
||||
if (flShow)
|
||||
{
|
||||
std::cout << " +++ DUMP ALine (begin) +++++" << std::endl;
|
||||
Standard_Integer aI = 0;
|
||||
const Standard_Real aStep = (theLPar - theFPar) / 9999.0;
|
||||
for (Standard_Real aPrm = theFPar; aPrm < theLPar; aPrm += aStep)
|
||||
const Standard_Integer NbSamples = 20;
|
||||
const Standard_Real aStep = (theLPar - theFPar) / NbSamples;
|
||||
char* name = new char[100];
|
||||
|
||||
for (Standard_Integer ii = 0; ii <= NbSamples; ii++)
|
||||
{
|
||||
Standard_Real aPrm = theFPar + ii * aStep;
|
||||
const gp_Pnt aPP(theALine->Value(aPrm));
|
||||
std::cout << "vertex v" << ++aI << " " << aPP.X() << " " << aPP.Y() << " " << aPP.Z() << std::endl;
|
||||
}
|
||||
std::cout << "vertex v" << ii << " " << aPP.X() << " " << aPP.Y() << " " << aPP.Z() << std::endl;
|
||||
|
||||
gp_Pnt aPP(theALine->Value(theLPar));
|
||||
std::cout << "vertex v" << ++aI << " " << aPP.X() << " " << aPP.Y() << " " << aPP.Z() << std::endl;
|
||||
sprintf(name, "p%d_%d", ii, ind);
|
||||
Draw::Set(name, aPP);
|
||||
}
|
||||
std::cout << " --- DUMP ALine (end) -----" << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -435,6 +501,8 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
|
||||
Standard_Integer aNewVertID = 0;
|
||||
aLinOn2S = new IntSurf_LineOn2S;
|
||||
Standard_Boolean anIsFirstDegenerated = Standard_False,
|
||||
anIsLastDegenerated = Standard_False;
|
||||
|
||||
const Standard_Real aStepMin = 0.1*aStep, aStepMax = 10.0*aStep;
|
||||
|
||||
@@ -467,6 +535,9 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
{
|
||||
// We cannot compute 2D-parameters of
|
||||
// aPOn2S correctly.
|
||||
|
||||
if (anIsLastDegenerated) //the current last point is wrong
|
||||
aLinOn2S->RemovePoint (aLinOn2S->NbPoints());
|
||||
|
||||
isPointValid = Standard_False;
|
||||
}
|
||||
@@ -591,6 +662,27 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
AddPointIntoLine(aLinOn2S, anArrPeriods, aPOn2S);
|
||||
aPrevLPoint = aPOn2S;
|
||||
}
|
||||
else
|
||||
{
|
||||
//add point, set correxponding status: to be corrected later
|
||||
Standard_Boolean ToAdd = Standard_False;
|
||||
if (aLinOn2S->NbPoints() == 0)
|
||||
{
|
||||
anIsFirstDegenerated = Standard_True;
|
||||
ToAdd = Standard_True;
|
||||
}
|
||||
else if (aLinOn2S->NbPoints() > 1)
|
||||
{
|
||||
anIsLastDegenerated = Standard_True;
|
||||
ToAdd = Standard_True;
|
||||
}
|
||||
|
||||
if (ToAdd)
|
||||
{
|
||||
AddPointIntoLine(aLinOn2S, anArrPeriods, aPOn2S);
|
||||
aPrevLPoint = aPOn2S;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -630,6 +722,15 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
|
||||
aPrePointExist = IsPoleOrSeam(myS1, myS2, aPrefIso, aLinOn2S, aVtx,
|
||||
anArrPeriods, aTol, aSingularSurfaceID);
|
||||
if (aPrePointExist == IntPatch_SPntPole ||
|
||||
aPrePointExist == IntPatch_SPntPoleSeamU)
|
||||
{
|
||||
//set correxponding status: to be corrected later
|
||||
if (aLinOn2S->NbPoints() == 1)
|
||||
anIsFirstDegenerated = Standard_True;
|
||||
else
|
||||
anIsLastDegenerated = Standard_True;
|
||||
}
|
||||
|
||||
const Standard_Real aCurVertParam = aVtx.ParameterOnLine();
|
||||
if(aPrePointExist != IntPatch_SPntNone)
|
||||
@@ -702,6 +803,15 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
|
||||
continue;
|
||||
}
|
||||
|
||||
//Correct first and last points if needed
|
||||
if (aLinOn2S->NbPoints() >= 3)
|
||||
{
|
||||
if (anIsFirstDegenerated)
|
||||
CorrectEndPoint (aLinOn2S, 1);
|
||||
if (anIsLastDegenerated)
|
||||
CorrectEndPoint (aLinOn2S, aLinOn2S->NbPoints());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
//-- W L i n e c r e a t i o n ---
|
||||
//-----------------------------------------------------------------
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <IntPatch_SequenceOfLine.hxx>
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
#include <IntSurf_LineOn2S.hxx>
|
||||
|
||||
class IntPatch_ALine;
|
||||
class IntSurf_PntOn2S;
|
||||
@@ -90,6 +91,13 @@ protected:
|
||||
//! This check is made for cone and sphere only.
|
||||
Standard_EXPORT Standard_Real GetSectionRadius(const gp_Pnt& thePnt3d) const;
|
||||
|
||||
//! Corrects the U-parameter of an end point (first or last) of the line
|
||||
//! if this end point is a pole.
|
||||
//! The line must contain at least 3 points.
|
||||
//! This is made for cone and sphere only.
|
||||
Standard_EXPORT void CorrectEndPoint(Handle(IntSurf_LineOn2S)& theLine,
|
||||
const Standard_Integer theIndex) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <ProjLib.hxx>
|
||||
|
||||
|
||||
//======================================================================
|
||||
// function: SequenceOfLine
|
||||
//======================================================================
|
||||
@@ -125,7 +126,7 @@ void IntPatch_Intersection::SetTolerances(const Standard_Real TolArc,
|
||||
if(myTolArc>0.5) myTolArc=0.5;
|
||||
if(myTolTang>0.5) myTolTang=0.5;
|
||||
if(myFleche<1.0e-3) myFleche=1e-3;
|
||||
if(myUVMaxStep<1.0e-3) myUVMaxStep=1e-3;
|
||||
//if(myUVMaxStep<1.0e-3) myUVMaxStep=1e-3;
|
||||
if(myFleche>10) myFleche=10;
|
||||
if(myUVMaxStep>0.5) myUVMaxStep=0.5;
|
||||
}
|
||||
@@ -1023,7 +1024,6 @@ void IntPatch_Intersection::Perform(const Handle(Adaptor3d_Surface)& theS1,
|
||||
myFleche = 0.01;
|
||||
if(myUVMaxStep <= Precision::PConfusion())
|
||||
myUVMaxStep = 0.01;
|
||||
|
||||
done = Standard_False;
|
||||
spnt.Clear();
|
||||
slin.Clear();
|
||||
@@ -1254,15 +1254,16 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_Surface)& t
|
||||
const GeomAbs_SurfaceType typs2)
|
||||
{
|
||||
IntPatch_PrmPrmIntersection interpp;
|
||||
//
|
||||
if(!theD1->DomainIsInfinite() && !theD2->DomainIsInfinite())
|
||||
{
|
||||
Standard_Boolean ClearFlag = Standard_True;
|
||||
if(!ListOfPnts.IsEmpty())
|
||||
{
|
||||
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep, ListOfPnts);
|
||||
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche, myUVMaxStep, ListOfPnts);
|
||||
ClearFlag = Standard_False;
|
||||
}
|
||||
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep,ClearFlag);
|
||||
interpp.Perform(theS1,theD1,theS2,theD2,TolTang,TolArc,myFleche, myUVMaxStep,ClearFlag);
|
||||
}
|
||||
else if((theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite()))
|
||||
{
|
||||
@@ -1275,7 +1276,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_Surface)& t
|
||||
const Standard_Real AP = Max(MU, MV);
|
||||
Handle(Adaptor3d_Surface) SS;
|
||||
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS1, AP, SS);
|
||||
interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
|
||||
interpp.Perform(SS,theD1,theS2,theD2,TolTang,TolArc,myFleche, myUVMaxStep);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1285,7 +1286,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_Surface)& t
|
||||
const Standard_Real AP = Max(MU, MV);
|
||||
Handle(Adaptor3d_Surface) SS;
|
||||
FUN_TrimInfSurf(pMinXYZ, pMaxXYZ, theS2, AP, SS);
|
||||
interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche,myUVMaxStep);
|
||||
interpp.Perform(theS1, theD1, SS, theD2,TolTang, TolArc,myFleche, myUVMaxStep);
|
||||
}
|
||||
}//(theD1->DomainIsInfinite()) ^ (theD2->DomainIsInfinite())
|
||||
else
|
||||
@@ -1324,7 +1325,7 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_Surface)& t
|
||||
Handle(Adaptor3d_Surface) nS1 = theS1;
|
||||
Handle(Adaptor3d_Surface) nS2 = theS2;
|
||||
FUN_TrimBothSurf(theS1,typs1,theS2,typs2,1.e+8,nS1,nS2);
|
||||
interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche,myUVMaxStep);
|
||||
interpp.Perform(nS1,theD1,nS2,theD2,TolTang,TolArc,myFleche, myUVMaxStep);
|
||||
}// 'NON - COLLINEAR LINES'
|
||||
}// both domains are infinite
|
||||
|
||||
@@ -1791,3 +1792,134 @@ void IntPatch_Intersection::Dump(const Standard_Integer /*Mode*/,
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckSingularPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntPatch_Intersection::CheckSingularPoints(
|
||||
const Handle(Adaptor3d_Surface)& theS1,
|
||||
const Handle(Adaptor3d_TopolTool)& theD1,
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
Standard_Real& theDist)
|
||||
{
|
||||
theDist = Precision::Infinite();
|
||||
Standard_Boolean isSingular = Standard_False;
|
||||
if (theS1 == theS2)
|
||||
{
|
||||
return isSingular;
|
||||
}
|
||||
//
|
||||
const Standard_Integer aNbBndPnts = 5;
|
||||
const Standard_Real aTol = Precision::Confusion();
|
||||
Standard_Integer i;
|
||||
theD1->Init();
|
||||
Standard_Boolean isU = Standard_True;
|
||||
for (; theD1->More(); theD1->Next())
|
||||
{
|
||||
Handle(Adaptor2d_Curve2d) aBnd = theD1->Value();
|
||||
Standard_Real pinf = aBnd->FirstParameter(), psup = aBnd->LastParameter();
|
||||
if (Precision::IsNegativeInfinite(pinf) || Precision::IsPositiveInfinite(psup))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Standard_Real t, dt = (psup - pinf) / (aNbBndPnts - 1);
|
||||
gp_Pnt2d aP1;
|
||||
gp_Vec2d aDir;
|
||||
aBnd->D1((pinf + psup) / 2., aP1, aDir);
|
||||
if (Abs(aDir.X()) > Abs(aDir.Y()))
|
||||
isU = Standard_True;
|
||||
else
|
||||
isU = Standard_False;
|
||||
gp_Pnt aPP1;
|
||||
gp_Vec aDU, aDV;
|
||||
Standard_Real aD1NormMax = 0.;
|
||||
gp_XYZ aPmid(0., 0., 0.);
|
||||
Standard_Integer aNb = 0;
|
||||
for (t = pinf; t <= psup; t += dt)
|
||||
{
|
||||
aP1 = aBnd->Value(t);
|
||||
theS1->D1(aP1.X(), aP1.Y(), aPP1, aDU, aDV);
|
||||
if (isU)
|
||||
aD1NormMax = Max(aD1NormMax, aDU.Magnitude());
|
||||
else
|
||||
aD1NormMax = Max(aD1NormMax, aDV.Magnitude());
|
||||
|
||||
aPmid += aPP1.XYZ();
|
||||
aNb++;
|
||||
|
||||
if (aD1NormMax > aTol)
|
||||
break;
|
||||
}
|
||||
|
||||
if (aD1NormMax <= aTol)
|
||||
{
|
||||
//Singular point aPP1;
|
||||
aPmid /= aNb;
|
||||
aPP1.SetXYZ(aPmid);
|
||||
Standard_Real aTolU = Precision::PConfusion(), aTolV = Precision::PConfusion();
|
||||
Extrema_ExtPS aProj(aPP1, *theS2.get(), aTolU, aTolV, Extrema_ExtFlag_MIN);
|
||||
|
||||
if (aProj.IsDone())
|
||||
{
|
||||
Standard_Integer aNbExt = aProj.NbExt();
|
||||
for (i = 1; i <= aNbExt; ++i)
|
||||
{
|
||||
theDist = Min(theDist, aProj.SquareDistance(i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!Precision::IsInfinite(theDist))
|
||||
{
|
||||
theDist = Sqrt(theDist);
|
||||
isSingular = Standard_True;
|
||||
}
|
||||
|
||||
return isSingular;
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DefineUVMaxStep
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real IntPatch_Intersection::DefineUVMaxStep(
|
||||
const Handle(Adaptor3d_Surface)& theS1,
|
||||
const Handle(Adaptor3d_TopolTool)& theD1,
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
const Handle(Adaptor3d_TopolTool)& theD2)
|
||||
{
|
||||
Standard_Real anUVMaxStep = 0.001;
|
||||
Standard_Real aDistToSing1 = Precision::Infinite();
|
||||
Standard_Real aDistToSing2 = Precision::Infinite();
|
||||
const Standard_Real aTolMin = Precision::Confusion(), aTolMax = 1.e-5;
|
||||
if (theS1 != theS2)
|
||||
{
|
||||
Standard_Boolean isSing1 = CheckSingularPoints(theS1, theD1, theS2, aDistToSing1);
|
||||
if (isSing1)
|
||||
{
|
||||
if (aDistToSing1 > aTolMin && aDistToSing1 < aTolMax)
|
||||
{
|
||||
anUVMaxStep = 0.0001;
|
||||
}
|
||||
else
|
||||
{
|
||||
isSing1 = Standard_False;
|
||||
}
|
||||
}
|
||||
if (!isSing1)
|
||||
{
|
||||
Standard_Boolean isSing2 = CheckSingularPoints(theS2, theD2, theS1, aDistToSing2);
|
||||
if (isSing2)
|
||||
{
|
||||
if (aDistToSing2 > aTolMin && aDistToSing2 < aTolMax)
|
||||
{
|
||||
anUVMaxStep = 0.0001;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return anUVMaxStep;
|
||||
}
|
||||
|
||||
|
@@ -133,7 +133,21 @@ public:
|
||||
//! Mode for more accurate dumps.
|
||||
Standard_EXPORT void Dump (const Standard_Integer Mode, const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_TopolTool)& D1, const Handle(Adaptor3d_Surface)& S2, const Handle(Adaptor3d_TopolTool)& D2) const;
|
||||
|
||||
//! Checks if surface theS1 has degenerated boundary (dS/du or dS/dv = 0) and
|
||||
//! calculates minimal distance between corresponding singular points and surface theS2
|
||||
//! If singular point exists the method returns "true" and stores minimal distance in theDist.
|
||||
Standard_EXPORT static Standard_Boolean CheckSingularPoints(
|
||||
const Handle(Adaptor3d_Surface)& theS1,
|
||||
const Handle(Adaptor3d_TopolTool)& theD1,
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
Standard_Real& theDist);
|
||||
|
||||
//! Calculates recommended value for myUVMaxStep depending on surfaces and their domains
|
||||
Standard_EXPORT static Standard_Real DefineUVMaxStep(
|
||||
const Handle(Adaptor3d_Surface)& theS1,
|
||||
const Handle(Adaptor3d_TopolTool)& theD1,
|
||||
const Handle(Adaptor3d_Surface)& theS2,
|
||||
const Handle(Adaptor3d_TopolTool)& theD2);
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -2386,6 +2386,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_Surface)& Surf
|
||||
//Try to extend the intersection line to the boundary,
|
||||
//if it is possibly
|
||||
PW.PutToBoundary(Surf1, Surf2);
|
||||
//
|
||||
if (PW.NbPoints() < 3)
|
||||
continue;
|
||||
|
||||
const Standard_Integer aMinNbPoints = 40;
|
||||
if(PW.NbPoints() < aMinNbPoints)
|
||||
|
@@ -649,8 +649,11 @@ void IntPatch_RstInt::PutVertexOnLine (const Handle(IntPatch_Line)& L,
|
||||
IntCS.ParameterOnSurface(U2,V2);
|
||||
gp_Pnt anOldPnt, aNewPnt;
|
||||
OtherSurf->D0(U,V, anOldPnt);
|
||||
OtherSurf->D0(U2,V2, aNewPnt);
|
||||
if (anOldPnt.SquareDistance(aNewPnt) < Precision::SquareConfusion())
|
||||
OtherSurf->D0(U2,V2, aNewPnt);
|
||||
//if (anOldPnt.SquareDistance(aNewPnt) < Precision::SquareConfusion())
|
||||
Standard_Real aTolConf = Max(Precision::Confusion(), edgeTol);
|
||||
|
||||
if (anOldPnt.SquareDistance(aNewPnt) < aTolConf * aTolConf)
|
||||
{
|
||||
U2 = U;
|
||||
V2 = V;
|
||||
|
@@ -471,8 +471,7 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
|
||||
|
||||
//----------------------------------------------------
|
||||
//-- On detecte les points confondus dans la LineOn2S
|
||||
Standard_Real dmini = Precision::Confusion();
|
||||
dmini*=dmini;
|
||||
Standard_Real dmini = Precision::SquareConfusion();
|
||||
for(i=2; (i<=nbponline) && (nbponline > 2); i++) {
|
||||
const IntSurf_PntOn2S& aPnt1=curv->Value(i-1);
|
||||
const IntSurf_PntOn2S& aPnt2=curv->Value(i);
|
||||
@@ -516,7 +515,20 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
|
||||
|
||||
IntSurf_PntOn2S POn2S = svtx.Value(i).PntOn2S();
|
||||
RecadreMemePeriode(POn2S,curv->Value(1),U1Period(),V1Period(),U2Period(),V2Period());
|
||||
curv->Value(1,POn2S);
|
||||
if (myCreationWay == IntPatch_WLImpImp)
|
||||
{
|
||||
//Adjust first point of curve to corresponding vertex the following way:
|
||||
//set 3D point as the point of the vertex and 2D points as the points of the point on curve.
|
||||
curv->SetPoint (1, POn2S.Value());
|
||||
Standard_Real mu1,mv1,mu2,mv2;
|
||||
curv->Value(1).Parameters(mu1,mv1,mu2,mv2);
|
||||
svtx.ChangeValue(i).SetParameter(1);
|
||||
svtx.ChangeValue(i).SetParameters(mu1,mv1,mu2,mv2);
|
||||
}
|
||||
else
|
||||
{
|
||||
curv->Value(1,POn2S);
|
||||
}
|
||||
|
||||
//--curv->Value(1,svtx.Value(i).PntOn2S());
|
||||
svtx.ChangeValue(i).SetParameter(1.0);
|
||||
@@ -551,6 +563,9 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
|
||||
//---------------------------------------------------------
|
||||
Standard_Boolean Substitution = Standard_False;
|
||||
//-- for(k=indicevertexonline+1; !Substitution && k>=indicevertexonline-1;k--) { avant le 9 oct 97
|
||||
Standard_Real mu1,mv1,mu2,mv2;
|
||||
curv->Value(indicevertexonline).Parameters(mu1,mv1,mu2,mv2);
|
||||
|
||||
for(k=indicevertexonline+1; k>=indicevertexonline-1;k--) {
|
||||
if(k>0 && k<=nbponline) {
|
||||
if(CompareVertexAndPoint(P,curv->Value(k).Value(),vTol)) {
|
||||
@@ -560,9 +575,21 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
|
||||
//-------------------------------------------------------
|
||||
IntSurf_PntOn2S POn2S = svtx.Value(i).PntOn2S();
|
||||
RecadreMemePeriode(POn2S,curv->Value(k),U1Period(),V1Period(),U2Period(),V2Period());
|
||||
curv->Value(k,POn2S);
|
||||
Standard_Real mu1,mv1,mu2,mv2;
|
||||
POn2S.Parameters(mu1,mv1,mu2,mv2);
|
||||
|
||||
if (myCreationWay == IntPatch_WLImpImp)
|
||||
{
|
||||
//Adjust a point of curve to corresponding vertex the following way:
|
||||
//set 3D point as the point of the vertex and 2D points as the points
|
||||
//of the point on curve with index <indicevertexonline>
|
||||
curv->SetPoint (k, POn2S.Value());
|
||||
curv->SetUV (k, Standard_True, mu1, mv1);
|
||||
curv->SetUV (k, Standard_False, mu2, mv2);
|
||||
}
|
||||
else
|
||||
{
|
||||
curv->Value(k,POn2S);
|
||||
POn2S.Parameters(mu1,mv1,mu2,mv2);
|
||||
}
|
||||
svtx.ChangeValue(i).SetParameter(k);
|
||||
svtx.ChangeValue(i).SetParameters(mu1,mv1,mu2,mv2);
|
||||
Substitution = Standard_True;
|
||||
|
@@ -62,9 +62,14 @@ public:
|
||||
//! Replaces the point of range Index in the line.
|
||||
void Value (const Standard_Integer Index, const IntSurf_PntOn2S& P);
|
||||
|
||||
//! Sets the 3D point of the Index-th PntOn2S
|
||||
Standard_EXPORT void SetPoint(const Standard_Integer Index, const gp_Pnt& thePnt);
|
||||
|
||||
//! Sets the parametric coordinates on one of the surfaces
|
||||
//! of the point of range Index in the line.
|
||||
Standard_EXPORT void SetUV(const Standard_Integer Index, const Standard_Boolean OnFirst, const Standard_Real U, const Standard_Real V);
|
||||
Standard_EXPORT void SetUV(const Standard_Integer Index,
|
||||
const Standard_Boolean OnFirst,
|
||||
const Standard_Real U, const Standard_Real V);
|
||||
|
||||
void Clear();
|
||||
|
||||
|
@@ -38,6 +38,12 @@ inline void IntSurf_LineOn2S::Value(const Standard_Integer Index,
|
||||
mySeq(Index) = P;
|
||||
}
|
||||
|
||||
inline void IntSurf_LineOn2S::SetPoint(const Standard_Integer Index,
|
||||
const gp_Pnt& thePnt)
|
||||
{
|
||||
mySeq(Index).SetValue (thePnt);
|
||||
}
|
||||
|
||||
inline void IntSurf_LineOn2S::Clear ()
|
||||
{
|
||||
mySeq.Clear();
|
||||
|
@@ -55,6 +55,7 @@
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <ApproxInt_KnotTools.hxx>
|
||||
|
||||
static
|
||||
void Parameters(const Handle(GeomAdaptor_Surface)&,
|
||||
@@ -502,7 +503,7 @@ void IntTools_FaceFace::Perform (const TopoDS_Face& aF1,
|
||||
Tolerances(myHS1, myHS2, TolTang);
|
||||
|
||||
{
|
||||
const Standard_Real UVMaxStep = 0.001;
|
||||
const Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
|
||||
const Standard_Real Deflection = 0.1;
|
||||
myIntersector.SetTolerances(TolArc, TolTang, UVMaxStep, Deflection);
|
||||
}
|
||||
@@ -1164,22 +1165,6 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
tol2d = myTolApprox;
|
||||
}
|
||||
|
||||
if(myHS1 == myHS2) {
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_False, aParType);
|
||||
rejectSurface = Standard_True;
|
||||
}
|
||||
else {
|
||||
if(reApprox && !rejectSurface)
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_False, aParType);
|
||||
else {
|
||||
Standard_Integer iDegMax, iDegMin, iNbIter;
|
||||
//
|
||||
ApproxParameters(myHS1, myHS2, iDegMin, iDegMax, iNbIter);
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax,
|
||||
iNbIter, 30, Standard_True, aParType);
|
||||
}
|
||||
}
|
||||
//
|
||||
Standard_Real aReachedTol = Precision::Confusion();
|
||||
bIsDecomposited = IntTools_WLineTool::
|
||||
DecompositionOfWLine(WL,
|
||||
@@ -1191,7 +1176,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
bAvoidLineConstructor,
|
||||
myTol,
|
||||
aSeqOfL,
|
||||
aReachedTol,
|
||||
aReachedTol, // obsolete parameter
|
||||
myContext);
|
||||
//
|
||||
aNbSeqOfL=aSeqOfL.Length();
|
||||
@@ -1199,7 +1184,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
Standard_Real aTolC = 0.;
|
||||
if (bIsDecomposited) {
|
||||
nbiter=aNbSeqOfL;
|
||||
aTolC = aReachedTol;
|
||||
aTolC = Precision::Confusion();
|
||||
}
|
||||
else {
|
||||
nbiter=1;
|
||||
@@ -1227,6 +1212,35 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
|
||||
ilprm = (Standard_Integer)lprm;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean anApprox = myApprox;
|
||||
if (typs1 == GeomAbs_Plane) {
|
||||
anApprox = Standard_False;
|
||||
anApprox1 = Standard_True;
|
||||
}
|
||||
else if (typs2 == GeomAbs_Plane) {
|
||||
anApprox = Standard_False;
|
||||
anApprox2 = Standard_True;
|
||||
}
|
||||
|
||||
aParType = ApproxInt_KnotTools::DefineParType(WL, ifprm, ilprm,
|
||||
anApprox, anApprox1, anApprox2);
|
||||
if (myHS1 == myHS2) {
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_False, aParType);
|
||||
rejectSurface = Standard_True;
|
||||
}
|
||||
else {
|
||||
if (reApprox && !rejectSurface)
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, 4, 8, 0, 30, Standard_False, aParType);
|
||||
else {
|
||||
Standard_Integer iDegMax, iDegMin, iNbIter;
|
||||
//
|
||||
ApproxParameters(myHS1, myHS2, iDegMin, iDegMax, iNbIter);
|
||||
theapp3d.SetParameters(myTolApprox, tol2d, iDegMin, iDegMax,
|
||||
iNbIter, 30, Standard_True, aParType);
|
||||
}
|
||||
}
|
||||
|
||||
//-- lbr :
|
||||
//-- Si une des surfaces est un plan , on approxime en 2d
|
||||
//-- sur cette surface et on remonte les points 2d en 3d.
|
||||
@@ -1892,6 +1906,7 @@ Handle(Geom_Curve) MakeBSpline (const Handle(IntPatch_WLine)& WL,
|
||||
enlarge=Standard_True;
|
||||
}
|
||||
//
|
||||
|
||||
if(!isuperiodic && enlarge) {
|
||||
|
||||
if(!Precision::IsInfinite(theumin) &&
|
||||
@@ -1907,6 +1922,7 @@ Handle(Geom_Curve) MakeBSpline (const Handle(IntPatch_WLine)& WL,
|
||||
else
|
||||
theumax = usup;
|
||||
}
|
||||
|
||||
//
|
||||
if(!isvperiodic && enlarge) {
|
||||
if(!Precision::IsInfinite(thevmin) &&
|
||||
@@ -1924,6 +1940,7 @@ Handle(Geom_Curve) MakeBSpline (const Handle(IntPatch_WLine)& WL,
|
||||
thevmax = vsup;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if(isuperiodic || isvperiodic) {
|
||||
Standard_Boolean correct = Standard_False;
|
||||
|
@@ -228,203 +228,6 @@ Standard_Boolean IntTools_WLineTool::NotUseSurfacesForApprox(const TopoDS_Face&
|
||||
|
||||
/////////////////////// DecompositionOfWLine ////////////////////////////
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckTangentZonesExist
|
||||
//purpose : static subfunction in ComputeTangentZones
|
||||
//=======================================================================
|
||||
static
|
||||
Standard_Boolean CheckTangentZonesExist(const Handle(GeomAdaptor_Surface)& theSurface1,
|
||||
const Handle(GeomAdaptor_Surface)& theSurface2)
|
||||
{
|
||||
if ( ( theSurface1->GetType() != GeomAbs_Torus ) ||
|
||||
( theSurface2->GetType() != GeomAbs_Torus ) )
|
||||
return Standard_False;
|
||||
|
||||
gp_Torus aTor1 = theSurface1->Torus();
|
||||
gp_Torus aTor2 = theSurface2->Torus();
|
||||
|
||||
if ( aTor1.Location().Distance( aTor2.Location() ) > Precision::Confusion() )
|
||||
return Standard_False;
|
||||
|
||||
if ( ( fabs( aTor1.MajorRadius() - aTor2.MajorRadius() ) > Precision::Confusion() ) ||
|
||||
( fabs( aTor1.MinorRadius() - aTor2.MinorRadius() ) > Precision::Confusion() ) )
|
||||
return Standard_False;
|
||||
|
||||
if ( ( aTor1.MajorRadius() < aTor1.MinorRadius() ) ||
|
||||
( aTor2.MajorRadius() < aTor2.MinorRadius() ) )
|
||||
return Standard_False;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeTangentZones
|
||||
//purpose : static subfunction in DecompositionOfWLine
|
||||
//=======================================================================
|
||||
static
|
||||
Standard_Integer ComputeTangentZones( const Handle(GeomAdaptor_Surface)& theSurface1,
|
||||
const Handle(GeomAdaptor_Surface)& theSurface2,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
Handle(TColgp_HArray1OfPnt2d)& theResultOnS1,
|
||||
Handle(TColgp_HArray1OfPnt2d)& theResultOnS2,
|
||||
Handle(TColStd_HArray1OfReal)& theResultRadius,
|
||||
const Handle(IntTools_Context)& aContext)
|
||||
{
|
||||
Standard_Integer aResult = 0;
|
||||
if ( !CheckTangentZonesExist( theSurface1, theSurface2 ) )
|
||||
return aResult;
|
||||
|
||||
|
||||
TColgp_SequenceOfPnt2d aSeqResultS1, aSeqResultS2;
|
||||
TColStd_SequenceOfReal aSeqResultRad;
|
||||
|
||||
gp_Torus aTor1 = theSurface1->Torus();
|
||||
gp_Torus aTor2 = theSurface2->Torus();
|
||||
|
||||
gp_Ax2 anax1( aTor1.Location(), aTor1.Axis().Direction() );
|
||||
gp_Ax2 anax2( aTor2.Location(), aTor2.Axis().Direction() );
|
||||
Standard_Integer j = 0;
|
||||
|
||||
for ( j = 0; j < 2; j++ ) {
|
||||
Standard_Real aCoef = ( j == 0 ) ? -1 : 1;
|
||||
Standard_Real aRadius1 = fabs(aTor1.MajorRadius() + aCoef * aTor1.MinorRadius());
|
||||
Standard_Real aRadius2 = fabs(aTor2.MajorRadius() + aCoef * aTor2.MinorRadius());
|
||||
|
||||
gp_Circ aCircle1( anax1, aRadius1 );
|
||||
gp_Circ aCircle2( anax2, aRadius2 );
|
||||
|
||||
// roughly compute radius of tangent zone for perpendicular case
|
||||
Standard_Real aCriteria = Precision::Confusion() * 0.5;
|
||||
|
||||
Standard_Real aT1 = aCriteria;
|
||||
Standard_Real aT2 = aCriteria;
|
||||
if ( j == 0 ) {
|
||||
// internal tangency
|
||||
Standard_Real aR = ( aRadius1 > aTor2.MinorRadius() ) ? aRadius1 : aTor2.MinorRadius();
|
||||
//aT1 = aCriteria * aCriteria + aR * aR - ( aR - aCriteria ) * ( aR - aCriteria );
|
||||
aT1 = 2. * aR * aCriteria;
|
||||
aT2 = aT1;
|
||||
}
|
||||
else {
|
||||
// external tangency
|
||||
Standard_Real aRb = ( aRadius1 > aTor2.MinorRadius() ) ? aRadius1 : aTor2.MinorRadius();
|
||||
Standard_Real aRm = ( aRadius1 < aTor2.MinorRadius() ) ? aRadius1 : aTor2.MinorRadius();
|
||||
Standard_Real aDelta = aRb - aCriteria;
|
||||
aDelta *= aDelta;
|
||||
aDelta -= aRm * aRm;
|
||||
aDelta /= 2. * (aRb - aRm);
|
||||
aDelta -= 0.5 * (aRb - aRm);
|
||||
|
||||
aT1 = 2. * aRm * (aRm - aDelta);
|
||||
aT2 = aT1;
|
||||
}
|
||||
aCriteria = ( aT1 > aT2) ? aT1 : aT2;
|
||||
if ( aCriteria > 0 )
|
||||
aCriteria = sqrt( aCriteria );
|
||||
|
||||
if ( aCriteria > 0.5 * aTor1.MinorRadius() ) {
|
||||
// too big zone -> drop to minimum
|
||||
aCriteria = Precision::Confusion();
|
||||
}
|
||||
|
||||
GeomAdaptor_Curve aC1( new Geom_Circle(aCircle1) );
|
||||
GeomAdaptor_Curve aC2( new Geom_Circle(aCircle2) );
|
||||
Extrema_ExtCC anExtrema(aC1, aC2, 0, 2. * M_PI, 0, 2. * M_PI,
|
||||
Precision::PConfusion(), Precision::PConfusion());
|
||||
|
||||
if ( anExtrema.IsDone() ) {
|
||||
|
||||
Standard_Integer i = 0;
|
||||
for ( i = 1; i <= anExtrema.NbExt(); i++ ) {
|
||||
if ( anExtrema.SquareDistance(i) > aCriteria * aCriteria )
|
||||
continue;
|
||||
|
||||
Extrema_POnCurv P1, P2;
|
||||
anExtrema.Points( i, P1, P2 );
|
||||
|
||||
Standard_Boolean bFoundResult = Standard_True;
|
||||
gp_Pnt2d pr1, pr2;
|
||||
|
||||
Standard_Integer surfit = 0;
|
||||
for ( surfit = 0; surfit < 2; surfit++ ) {
|
||||
GeomAPI_ProjectPointOnSurf& aProjector =
|
||||
(surfit == 0) ? aContext->ProjPS(theFace1) : aContext->ProjPS(theFace2);
|
||||
|
||||
gp_Pnt aP3d = (surfit == 0) ? P1.Value() : P2.Value();
|
||||
aProjector.Perform(aP3d);
|
||||
|
||||
if(!aProjector.IsDone())
|
||||
bFoundResult = Standard_False;
|
||||
else {
|
||||
if(aProjector.LowerDistance() > aCriteria) {
|
||||
bFoundResult = Standard_False;
|
||||
}
|
||||
else {
|
||||
Standard_Real foundU = 0, foundV = 0;
|
||||
aProjector.LowerDistanceParameters(foundU, foundV);
|
||||
if ( surfit == 0 )
|
||||
pr1 = gp_Pnt2d( foundU, foundV );
|
||||
else
|
||||
pr2 = gp_Pnt2d( foundU, foundV );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( bFoundResult ) {
|
||||
aSeqResultS1.Append( pr1 );
|
||||
aSeqResultS2.Append( pr2 );
|
||||
aSeqResultRad.Append( aCriteria );
|
||||
|
||||
// torus is u and v periodic
|
||||
const Standard_Real twoPI = M_PI + M_PI;
|
||||
Standard_Real arr1tmp[2] = {pr1.X(), pr1.Y()};
|
||||
Standard_Real arr2tmp[2] = {pr2.X(), pr2.Y()};
|
||||
|
||||
// iteration on period bounds
|
||||
for ( Standard_Integer k1 = 0; k1 < 2; k1++ ) {
|
||||
Standard_Real aBound = ( k1 == 0 ) ? 0 : twoPI;
|
||||
Standard_Real aShift = ( k1 == 0 ) ? twoPI : -twoPI;
|
||||
|
||||
// iteration on surfaces
|
||||
for ( Standard_Integer k2 = 0; k2 < 2; k2++ ) {
|
||||
Standard_Real* arr1 = ( k2 == 0 ) ? arr1tmp : arr2tmp;
|
||||
Standard_Real* arr2 = ( k2 != 0 ) ? arr1tmp : arr2tmp;
|
||||
TColgp_SequenceOfPnt2d& aSeqS1 = ( k2 == 0 ) ? aSeqResultS1 : aSeqResultS2;
|
||||
TColgp_SequenceOfPnt2d& aSeqS2 = ( k2 != 0 ) ? aSeqResultS1 : aSeqResultS2;
|
||||
|
||||
if (fabs(arr1[0] - aBound) < Precision::PConfusion()) {
|
||||
aSeqS1.Append( gp_Pnt2d( arr1[0] + aShift, arr1[1] ) );
|
||||
aSeqS2.Append( gp_Pnt2d( arr2[0], arr2[1] ) );
|
||||
aSeqResultRad.Append( aCriteria );
|
||||
}
|
||||
if (fabs(arr1[1] - aBound) < Precision::PConfusion()) {
|
||||
aSeqS1.Append( gp_Pnt2d( arr1[0], arr1[1] + aShift) );
|
||||
aSeqS2.Append( gp_Pnt2d( arr2[0], arr2[1] ) );
|
||||
aSeqResultRad.Append( aCriteria );
|
||||
}
|
||||
}
|
||||
} //
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
aResult = aSeqResultRad.Length();
|
||||
|
||||
if ( aResult > 0 ) {
|
||||
theResultOnS1 = new TColgp_HArray1OfPnt2d( 1, aResult );
|
||||
theResultOnS2 = new TColgp_HArray1OfPnt2d( 1, aResult );
|
||||
theResultRadius = new TColStd_HArray1OfReal( 1, aResult );
|
||||
|
||||
for ( Standard_Integer i = 1 ; i <= aResult; i++ ) {
|
||||
theResultOnS1->SetValue( i, aSeqResultS1.Value(i) );
|
||||
theResultOnS2->SetValue( i, aSeqResultS2.Value(i) );
|
||||
theResultRadius->SetValue( i, aSeqResultRad.Value(i) );
|
||||
}
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsPointOnBoundary
|
||||
//purpose : static subfunction in DecompositionOfWLine
|
||||
@@ -456,27 +259,6 @@ Standard_Boolean IsPointOnBoundary(const Standard_Real theParameter,
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsInsideTanZone
|
||||
//purpose : Check if point is inside a radial tangent zone.
|
||||
// static subfunction in DecompositionOfWLine and FindPoint
|
||||
//=======================================================================
|
||||
static
|
||||
Standard_Boolean IsInsideTanZone(const gp_Pnt2d& thePoint,
|
||||
const gp_Pnt2d& theTanZoneCenter,
|
||||
const Standard_Real theZoneRadius,
|
||||
Handle(GeomAdaptor_Surface) theGASurface)
|
||||
{
|
||||
Standard_Real aUResolution = theGASurface->UResolution( theZoneRadius );
|
||||
Standard_Real aVResolution = theGASurface->VResolution( theZoneRadius );
|
||||
Standard_Real aRadiusSQR = ( aUResolution < aVResolution ) ? aUResolution : aVResolution;
|
||||
aRadiusSQR *= aRadiusSQR;
|
||||
if ( thePoint.SquareDistance( theTanZoneCenter ) <= aRadiusSQR )
|
||||
return Standard_True;
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AdjustByNeighbour
|
||||
//purpose : static subfunction in DecompositionOfWLine
|
||||
@@ -651,72 +433,6 @@ Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindPoint
|
||||
//purpose : Find point on the boundary of radial tangent zone
|
||||
// static subfunction in DecompositionOfWLine
|
||||
//=======================================================================
|
||||
static
|
||||
Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
|
||||
const gp_Pnt2d& theLastPoint,
|
||||
const Standard_Real theUmin,
|
||||
const Standard_Real theUmax,
|
||||
const Standard_Real theVmin,
|
||||
const Standard_Real theVmax,
|
||||
const gp_Pnt2d& theTanZoneCenter,
|
||||
const Standard_Real theZoneRadius,
|
||||
Handle(GeomAdaptor_Surface) theGASurface,
|
||||
gp_Pnt2d& theNewPoint) {
|
||||
theNewPoint = theLastPoint;
|
||||
|
||||
if ( !IsInsideTanZone( theLastPoint, theTanZoneCenter, theZoneRadius, theGASurface) )
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real aUResolution = theGASurface->UResolution( theZoneRadius );
|
||||
Standard_Real aVResolution = theGASurface->VResolution( theZoneRadius );
|
||||
|
||||
Standard_Real aRadius = ( aUResolution < aVResolution ) ? aUResolution : aVResolution;
|
||||
gp_Ax22d anAxis( theTanZoneCenter, gp_Dir2d(1, 0), gp_Dir2d(0, 1) );
|
||||
gp_Circ2d aCircle( anAxis, aRadius );
|
||||
|
||||
//
|
||||
gp_Vec2d aDir( theLastPoint.XY() - theFirstPoint.XY() );
|
||||
Standard_Real aLength = aDir.Magnitude();
|
||||
if ( aLength <= gp::Resolution() )
|
||||
return Standard_False;
|
||||
gp_Lin2d aLine( theFirstPoint, aDir );
|
||||
|
||||
//
|
||||
Handle(Geom2d_Line) aCLine = new Geom2d_Line( aLine );
|
||||
Handle(Geom2d_TrimmedCurve) aC1 = new Geom2d_TrimmedCurve( aCLine, 0, aLength );
|
||||
Handle(Geom2d_Circle) aC2 = new Geom2d_Circle( aCircle );
|
||||
|
||||
Standard_Real aTol = aRadius * 0.001;
|
||||
aTol = ( aTol < Precision::PConfusion() ) ? Precision::PConfusion() : aTol;
|
||||
|
||||
Geom2dAPI_InterCurveCurve anIntersector;
|
||||
anIntersector.Init( aC1, aC2, aTol );
|
||||
|
||||
if ( anIntersector.NbPoints() == 0 )
|
||||
return Standard_False;
|
||||
|
||||
Standard_Boolean aFound = Standard_False;
|
||||
Standard_Real aMinDist = aLength * aLength;
|
||||
Standard_Integer i = 0;
|
||||
for ( i = 1; i <= anIntersector.NbPoints(); i++ ) {
|
||||
gp_Pnt2d aPInt = anIntersector.Point( i );
|
||||
if ( aPInt.SquareDistance( theFirstPoint ) < aMinDist ) {
|
||||
if ( ( aPInt.X() >= theUmin ) && ( aPInt.X() <= theUmax ) &&
|
||||
( aPInt.Y() >= theVmin ) && ( aPInt.Y() <= theVmax ) ) {
|
||||
theNewPoint = aPInt;
|
||||
aFound = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aFound;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DecompositionOfWLine
|
||||
//purpose :
|
||||
@@ -731,7 +447,7 @@ Standard_Boolean IntTools_WLineTool::
|
||||
const Standard_Boolean theAvoidLConstructor,
|
||||
const Standard_Real theTol,
|
||||
IntPatch_SequenceOfLine& theNewLines,
|
||||
Standard_Real& theReachedTol3d,
|
||||
Standard_Real& /*theReachedTol3d*/,
|
||||
const Handle(IntTools_Context)& aContext)
|
||||
{
|
||||
Standard_Boolean bRet, bAvoidLineConstructor;
|
||||
@@ -757,13 +473,7 @@ Standard_Boolean IntTools_WLineTool::
|
||||
TColStd_Array1OfListOfInteger anArrayOfLines(1, aNbPnts);
|
||||
TColStd_Array1OfInteger anArrayOfLineType(1, aNbPnts);
|
||||
TColStd_ListOfInteger aListOfPointIndex;
|
||||
|
||||
Handle(TColgp_HArray1OfPnt2d) aTanZoneS1;
|
||||
Handle(TColgp_HArray1OfPnt2d) aTanZoneS2;
|
||||
Handle(TColStd_HArray1OfReal) aTanZoneRadius;
|
||||
Standard_Integer aNbZone = ComputeTangentZones( theSurface1, theSurface2, theFace1, theFace2,
|
||||
aTanZoneS1, aTanZoneS2, aTanZoneRadius, aContext);
|
||||
|
||||
|
||||
//
|
||||
nblines=0;
|
||||
aTol=Precision::Confusion();
|
||||
@@ -834,24 +544,6 @@ Standard_Boolean IntTools_WLineTool::
|
||||
bIsCurrentPointOnBoundary = Standard_True;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// check if a point belong to a tangent zone. Begin
|
||||
Standard_Integer zIt = 0;
|
||||
for ( zIt = 1; zIt <= aNbZone; zIt++ ) {
|
||||
gp_Pnt2d aPZone = (i == 0) ? aTanZoneS1->Value(zIt) : aTanZoneS2->Value(zIt);
|
||||
Standard_Real aZoneRadius = aTanZoneRadius->Value(zIt);
|
||||
|
||||
if ( IsInsideTanZone(gp_Pnt2d( U, V ), aPZone, aZoneRadius, aGASurface ) ) {
|
||||
// set boundary flag to split the curve by a tangent zone
|
||||
bIsPointOnBoundary = Standard_True;
|
||||
bIsCurrentPointOnBoundary = Standard_True;
|
||||
if ( theReachedTol3d < aZoneRadius ) {
|
||||
theReachedTol3d = aZoneRadius;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}//for(j = 0; j < 2; j++) {
|
||||
|
||||
if(bIsCurrentPointOnBoundary){
|
||||
@@ -930,7 +622,7 @@ Standard_Boolean IntTools_WLineTool::
|
||||
Standard_Integer nbboundaries = 0;
|
||||
|
||||
Standard_Boolean bIsNearBoundary = Standard_False;
|
||||
Standard_Integer aZoneIndex = 0;
|
||||
//Standard_Integer aZoneIndex = 0;
|
||||
Standard_Integer bIsUBoundary = Standard_False; // use if nbboundaries == 1
|
||||
Standard_Integer bIsFirstBoundary = Standard_False; // use if nbboundaries == 1
|
||||
|
||||
@@ -980,32 +672,6 @@ Standard_Boolean IntTools_WLineTool::
|
||||
}
|
||||
}
|
||||
|
||||
// check if a point belong to a tangent zone. Begin
|
||||
for ( Standard_Integer zIt = 1; zIt <= aNbZone; zIt++ ) {
|
||||
gp_Pnt2d aPZone = (surfit == 0) ? aTanZoneS1->Value(zIt) : aTanZoneS2->Value(zIt);
|
||||
Standard_Real aZoneRadius = aTanZoneRadius->Value(zIt);
|
||||
|
||||
Standard_Integer aneighbourpointindex1 = (j == 0) ? iFirst : iLast;
|
||||
const IntSurf_PntOn2S& aNeighbourPoint = theWLine->Point(aneighbourpointindex1);
|
||||
Standard_Real nU1, nV1;
|
||||
|
||||
if(surfit == 0)
|
||||
aNeighbourPoint.ParametersOnS1(nU1, nV1);
|
||||
else
|
||||
aNeighbourPoint.ParametersOnS2(nU1, nV1);
|
||||
gp_Pnt2d ap1(nU1, nV1);
|
||||
gp_Pnt2d ap2 = AdjustByNeighbour( ap1, gp_Pnt2d( U, V ), aGASurface );
|
||||
|
||||
|
||||
if ( IsInsideTanZone( ap2, aPZone, aZoneRadius, aGASurface ) ) {
|
||||
aZoneIndex = zIt;
|
||||
bIsNearBoundary = Standard_True;
|
||||
if ( theReachedTol3d < aZoneRadius ) {
|
||||
theReachedTol3d = aZoneRadius;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check if a point belong to a tangent zone. End
|
||||
Standard_Boolean bComputeLineEnd = Standard_False;
|
||||
|
||||
if(nbboundaries == 2) {
|
||||
@@ -1144,20 +810,7 @@ Standard_Boolean IntTools_WLineTool::
|
||||
gp_Pnt2d ap1(nU1, nV1);
|
||||
gp_Pnt2d ap2;
|
||||
|
||||
|
||||
if ( aZoneIndex ) {
|
||||
// exclude point from a tangent zone
|
||||
anewpoint = AdjustByNeighbour( ap1, anewpoint, aGASurface );
|
||||
gp_Pnt2d aPZone = (surfit == 0) ? aTanZoneS1->Value(aZoneIndex) : aTanZoneS2->Value(aZoneIndex);
|
||||
Standard_Real aZoneRadius = aTanZoneRadius->Value(aZoneIndex);
|
||||
|
||||
if ( FindPoint(ap1, anewpoint, umin, umax, vmin, vmax,
|
||||
aPZone, aZoneRadius, aGASurface, ap2) ) {
|
||||
anewpoint = ap2;
|
||||
found = Standard_True;
|
||||
}
|
||||
}
|
||||
else if ( aGASurface->IsUPeriodic() || aGASurface->IsVPeriodic() ) {
|
||||
if ( aGASurface->IsUPeriodic() || aGASurface->IsVPeriodic() ) {
|
||||
// re-compute point near boundary if shifted on a period
|
||||
ap2 = AdjustByNeighbour( ap1, anewpoint, aGASurface );
|
||||
|
||||
|
@@ -46,8 +46,8 @@ public:
|
||||
const Standard_Boolean theAvoidLConstructor,
|
||||
const Standard_Real theTol,
|
||||
IntPatch_SequenceOfLine& theNewLines,
|
||||
Standard_Real& theReachedTol3d,
|
||||
Standard_Real& /*theReachedTol3d*/, // obsolete parameter
|
||||
const Handle(IntTools_Context)& );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -22,6 +22,14 @@
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
static void CutVectorByTolerances (gp_Vec2d& theVector,
|
||||
const math_Vector& theTolerance)
|
||||
{
|
||||
if (Abs(theVector.X()) < theTolerance(1))
|
||||
theVector.SetX (0.);
|
||||
if (Abs(theVector.Y()) < theTolerance(2))
|
||||
theVector.SetY (0.);
|
||||
}
|
||||
|
||||
// _______________________________________________
|
||||
//
|
||||
@@ -392,8 +400,15 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
|
||||
|
||||
//Normalizing factor. If it is less than 1.0 then the range will be expanded.
|
||||
//This is no good for computation. Therefore, it is limited.
|
||||
const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um : Max(mySRangeU.Delta(), 1.0);
|
||||
const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm : Max(mySRangeV.Delta(), 1.0);
|
||||
//Do not limit this factor in case of highly anisotropic parametrization
|
||||
//(parametric space is considerably larger in one direction than another).
|
||||
const Standard_Boolean isHighlyAnisotropic = Max(tolu, tolv) > 1000. * Min(tolu, tolv);
|
||||
const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um
|
||||
: (isHighlyAnisotropic ? mySRangeU.Delta()
|
||||
: Max(mySRangeU.Delta(), 1.0));
|
||||
const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm
|
||||
: (isHighlyAnisotropic ? mySRangeV.Delta()
|
||||
: Max(mySRangeV.Delta(), 1.0));
|
||||
|
||||
Up/=deltau; UV1/=deltau;
|
||||
Vp/=deltav; UV2/=deltav;
|
||||
@@ -771,8 +786,13 @@ void IntWalk_IWalking::TestArretCadre
|
||||
Line->Value(j).ParametersOnS1(Uc,Vc);
|
||||
}
|
||||
|
||||
Scal = (Up-wd1[i].ustart) * (Uc-wd1[i].ustart) +
|
||||
(Vp-wd1[i].vstart) * (Vc-wd1[i].vstart);
|
||||
gp_Vec2d aVec1 (Up-wd1[i].ustart, Vp-wd1[i].vstart),
|
||||
aVec2 (Uc-wd1[i].ustart, Vc-wd1[i].vstart);
|
||||
CutVectorByTolerances (aVec1, tolerance);
|
||||
CutVectorByTolerances (aVec2, tolerance);
|
||||
|
||||
Scal = aVec1 * aVec2;
|
||||
|
||||
// if a stop point is found: stop the line on this point.
|
||||
if (Scal < 0) {
|
||||
Line->Cut(j); nbp= Line->NbPoints();
|
||||
@@ -791,8 +811,14 @@ void IntWalk_IWalking::TestArretCadre
|
||||
}
|
||||
else if (nbMultiplicities[i] > 0) {
|
||||
for (Standard_Integer k = N+1; k <= N + nbMultiplicities[i]; k++) {
|
||||
Scal = (Up-Umult(k)) * (Uc-Umult(k)) +
|
||||
(Vp-Vmult(k)) * (Vc-Vmult(k));
|
||||
|
||||
aVec1.SetCoord (Up-Umult(k), Vp-Vmult(k)),
|
||||
aVec2.SetCoord (Uc-Umult(k), Vc-Vmult(k));
|
||||
CutVectorByTolerances (aVec1, tolerance);
|
||||
CutVectorByTolerances (aVec2, tolerance);
|
||||
|
||||
Scal = aVec1 * aVec2;
|
||||
|
||||
if (Scal < 0) {
|
||||
Line->Cut(j); nbp= Line->NbPoints();
|
||||
Irang=i;
|
||||
@@ -847,11 +873,13 @@ void IntWalk_IWalking::TestArretCadre
|
||||
// now the last point of the line and the last calculated point are compated.
|
||||
// there will be no need to "Cut"
|
||||
|
||||
Scal = (Up-wd1[i].ustart) * (UV(1)-wd1[i].ustart) +
|
||||
// (Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart);
|
||||
// modified by NIZHNY-MKK Fri Oct 27 12:29:41 2000
|
||||
(Vp-wd1[i].vstart) * (UV(2)-wd1[i].vstart);
|
||||
|
||||
gp_Vec2d aVec1 (Up-wd1[i].ustart, Vp-wd1[i].vstart),
|
||||
aVec2 (UV(1)-wd1[i].ustart, UV(2)-wd1[i].vstart);
|
||||
CutVectorByTolerances (aVec1, tolerance);
|
||||
CutVectorByTolerances (aVec2, tolerance);
|
||||
|
||||
Scal = aVec1 * aVec2;
|
||||
|
||||
if (Scal < 0) {
|
||||
Irang = i;
|
||||
UV(1) = wd1[Irang].ustart;
|
||||
@@ -867,8 +895,14 @@ void IntWalk_IWalking::TestArretCadre
|
||||
}
|
||||
else if (nbMultiplicities[i] > 0) {
|
||||
for (Standard_Integer j = N+1; j <= N+nbMultiplicities[i]; j++) {
|
||||
Scal = (Up-Umult(j)) * (UV(1)-Umult(j)) +
|
||||
(Vp-Vmult(j)) * (UV(2)-Vmult(j));
|
||||
|
||||
aVec1.SetCoord (Up-Umult(j), Vp-Vmult(j));
|
||||
aVec2.SetCoord (UV(1)-Umult(j), UV(2)-Vmult(j));
|
||||
CutVectorByTolerances (aVec1, tolerance);
|
||||
CutVectorByTolerances (aVec2, tolerance);
|
||||
|
||||
Scal = aVec1 * aVec2;
|
||||
|
||||
if (Scal < 0) {
|
||||
Irang=i;
|
||||
UV(1) = wd1[Irang].ustart;
|
||||
|
@@ -2316,10 +2316,65 @@ Standard_Boolean IntWalk_PWalking::HandleSingleSingularPoint(const Handle(Adapto
|
||||
if (anInt.IsEmpty())
|
||||
continue;
|
||||
|
||||
anInt.Point().Parameters(thePnt(1), thePnt(2), thePnt(3), thePnt(4));
|
||||
|
||||
Standard_Real aPars[4];
|
||||
anInt.Point().Parameters(aPars[0], aPars[1], aPars[2], aPars[3]);
|
||||
Handle(Adaptor3d_Surface) aSurfs[2] = { theASurf1, theASurf2 };
|
||||
//Local resolutions
|
||||
Standard_Real aTol2 = the3DTol * the3DTol;
|
||||
gp_Pnt aP;
|
||||
gp_Vec aDU, aDV;
|
||||
gp_Pnt aPInt;
|
||||
Standard_Integer k;
|
||||
for (k = 0; k < 2; ++k)
|
||||
{
|
||||
Standard_Integer iu, iv;
|
||||
iu = 2*k;
|
||||
iv = iu + 1;
|
||||
aSurfs[k]->D1(aPars[iu], aPars[iv], aPInt, aDU, aDV);
|
||||
Standard_Real aMod = aDU.Magnitude();
|
||||
if (aMod > Precision::Confusion())
|
||||
{
|
||||
Standard_Real aTolU = the3DTol / aMod;
|
||||
if (Abs(aLowBorder[iu] - aPars[iu]) < aTolU)
|
||||
{
|
||||
aP = aSurfs[k]->Value(aLowBorder[iu], aPars[iv]);
|
||||
if (aPInt.SquareDistance(aP) < aTol2)
|
||||
aPars[iu] = aLowBorder[iu];
|
||||
}
|
||||
else if (Abs(aUppBorder[iu] - aPars[iu]) < aTolU)
|
||||
{
|
||||
aP = aSurfs[k]->Value(aUppBorder[iu], aPars[iv]);
|
||||
if (aPInt.SquareDistance(aP) < aTol2)
|
||||
aPars[iu] = aUppBorder[iu];
|
||||
}
|
||||
}
|
||||
aMod = aDV.Magnitude();
|
||||
if (aMod > Precision::Confusion())
|
||||
{
|
||||
Standard_Real aTolV = the3DTol / aMod;
|
||||
if (Abs(aLowBorder[iv] - aPars[iv]) < aTolV)
|
||||
{
|
||||
aP = aSurfs[k]->Value(aPars[iu], aLowBorder[iv]);
|
||||
if (aPInt.SquareDistance(aP) < aTol2)
|
||||
aPars[iv] = aLowBorder[iv];
|
||||
}
|
||||
else if (Abs(aUppBorder[iv] - aPars[iv]) < aTolV)
|
||||
{
|
||||
aP = aSurfs[k]->Value(aPars[iu], aUppBorder[iv]);
|
||||
if (aPInt.SquareDistance(aP) < aTol2)
|
||||
aPars[iv] = aUppBorder[iv];
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
//
|
||||
Standard_Integer j;
|
||||
for (j = 1; j <= 4; ++j)
|
||||
{
|
||||
thePnt(j) = aPars[j - 1];
|
||||
}
|
||||
Standard_Boolean isInDomain = Standard_True;
|
||||
for (Standard_Integer j = 1; isInDomain && (j <= 4); ++j)
|
||||
for (j = 1; isInDomain && (j <= 4); ++j)
|
||||
{
|
||||
if ((thePnt(j) - aLowBorder[j - 1] + Precision::PConfusion())*
|
||||
(thePnt(j) - aUppBorder[j - 1] - Precision::PConfusion()) > 0.0)
|
||||
@@ -2461,13 +2516,13 @@ Standard_Boolean IntWalk_PWalking::
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (aPInd == 1)
|
||||
{
|
||||
// After insertion, we will obtain
|
||||
// two coincident points in the line.
|
||||
// Therefore, insertion is forbidden.
|
||||
return isOK;
|
||||
}
|
||||
//else if (aPInd == 1)
|
||||
//{
|
||||
// // After insertion, we will obtain
|
||||
// // two coincident points in the line.
|
||||
// // Therefore, insertion is forbidden.
|
||||
// return isOK;
|
||||
//}
|
||||
}
|
||||
|
||||
for (++aPInd; aPInd <= aNbPnts; aPInd++)
|
||||
@@ -2493,6 +2548,12 @@ Standard_Boolean IntWalk_PWalking::
|
||||
RemoveAPoint(1);
|
||||
}
|
||||
|
||||
aP1.SetXYZ(line->Value(1).Value().XYZ());
|
||||
if (aP1.SquareDistance(aPInt) <= Precision::SquareConfusion())
|
||||
{
|
||||
RemoveAPoint(1);
|
||||
}
|
||||
|
||||
line->InsertBefore(1, anIP);
|
||||
isOK = Standard_True;
|
||||
}
|
||||
@@ -2511,13 +2572,13 @@ Standard_Boolean IntWalk_PWalking::
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (aPInd == aNbPnts)
|
||||
{
|
||||
// After insertion, we will obtain
|
||||
// two coincident points in the line.
|
||||
// Therefore, insertion is forbidden.
|
||||
return isOK;
|
||||
}
|
||||
//else if (aPInd == aNbPnts)
|
||||
//{
|
||||
// // After insertion, we will obtain
|
||||
// // two coincident points in the line.
|
||||
// // Therefore, insertion is forbidden.
|
||||
// return isOK;
|
||||
//}
|
||||
}
|
||||
|
||||
for (--aPInd; aPInd > 0; aPInd--)
|
||||
@@ -2543,7 +2604,14 @@ Standard_Boolean IntWalk_PWalking::
|
||||
RemoveAPoint(aNbPnts);
|
||||
}
|
||||
|
||||
Standard_Integer aNbPnts = line->NbPoints();
|
||||
aP1.SetXYZ(line->Value(aNbPnts).Value().XYZ());
|
||||
if (aP1.SquareDistance(aPInt) <= Precision::SquareConfusion())
|
||||
{
|
||||
RemoveAPoint(aNbPnts);
|
||||
}
|
||||
line->Add(anIP);
|
||||
|
||||
isOK = Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -1295,6 +1295,10 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
|
||||
Standard_Real aTolV[2];
|
||||
aTolV[0] =BRep_Tool::Tolerance(theVertices[0]);
|
||||
aTolV[1] =BRep_Tool::Tolerance(theVertices[1]);
|
||||
Standard_Real ext = 16.; // = 4 * 4 - to avoid creating microedges, area around vertices is increased
|
||||
// up to 4 vertex tolerance. Such approach is usual for other topological
|
||||
// algorithms, for example, Boolean Operations.
|
||||
Standard_Real aTolVExt[2] = { ext * aTolV[0] * aTolV[0], ext * aTolV[1] * aTolV[1] };
|
||||
|
||||
BRepAdaptor_Curve2d thePCurve(theEdge, theFace);
|
||||
Bnd_Box2d theBox;
|
||||
@@ -1304,6 +1308,9 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
|
||||
Standard_Real aFpar, aLpar;
|
||||
const Handle(Geom_Curve)& theCurve = BRep_Tool::Curve(theEdge, thePar[0], thePar[1]);
|
||||
GeomAdaptor_Curve theGAcurve(theCurve, thePar[0], thePar[1]);
|
||||
Standard_Real aTolV2d[2] = { theGAcurve.Resolution(aTolV[0]), theGAcurve.Resolution(aTolV[1]) };
|
||||
aTolV2d[0] = Max(aTolV2d[0], Precision::PConfusion());
|
||||
aTolV2d[1] = Max(aTolV2d[1], Precision::PConfusion());
|
||||
Standard_Real aDistMax = Precision::Confusion() * Precision::Confusion();
|
||||
TopExp_Explorer Explo(theFace, TopAbs_EDGE);
|
||||
for (; Explo.More(); Explo.Next())
|
||||
@@ -1330,6 +1337,23 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
|
||||
isOverlapped = Standard_True;
|
||||
return;
|
||||
}
|
||||
// Check extremity distances
|
||||
Standard_Real dists[4];
|
||||
gp_Pnt aP11, aP12, aP21, aP22;
|
||||
anExtrema.TrimmedSquareDistances(dists[0], dists[1], dists[2], dists[3],
|
||||
aP11, aP12, aP21, aP22);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
if (i < 2)
|
||||
j = 0;
|
||||
else
|
||||
j = 1;
|
||||
if (dists[i] < aTolVExt[j] / ext)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 1; i <= aNbExt; i++)
|
||||
{
|
||||
Standard_Real aDist = anExtrema.SquareDistance(i);
|
||||
@@ -1342,7 +1366,7 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
|
||||
Standard_Real anIntPar = aPOnC2.Parameter();
|
||||
for (j = 0; j < 2; j++) //try to find intersection on an extremity of "theEdge"
|
||||
{
|
||||
if (Abs(theIntPar - thePar[j]) <= Precision::PConfusion())
|
||||
if (Abs(theIntPar - thePar[j]) <= aTolV2d[j])
|
||||
break;
|
||||
}
|
||||
//intersection found in the middle of the edge
|
||||
@@ -1351,10 +1375,10 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
|
||||
gp_Pnt aPoint = aCurve->Value(anIntPar);
|
||||
gp_Pnt aPointInt = theCurve->Value(theIntPar);
|
||||
|
||||
if (aPointInt.SquareDistance(thePnt[0]) > aTolV[0] * aTolV[0] &&
|
||||
aPointInt.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1] &&
|
||||
aPoint.SquareDistance(thePnt[0]) > aTolV[0] * aTolV[0] &&
|
||||
aPoint.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1])
|
||||
if (aPointInt.SquareDistance(thePnt[0]) > aTolVExt[0] &&
|
||||
aPointInt.SquareDistance(thePnt[1]) > aTolVExt[1] &&
|
||||
aPoint.SquareDistance(thePnt[0]) > aTolVExt[0] &&
|
||||
aPoint.SquareDistance(thePnt[1]) > aTolVExt[1])
|
||||
{
|
||||
SplitPars.Append(theIntPar);
|
||||
if( aDist > aDistMax)
|
||||
|
@@ -67,7 +67,9 @@
|
||||
|
||||
#if !defined(HAVE_EGL)
|
||||
#if defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(HAVE_GLES2) || defined(OCCT_UWP)
|
||||
#define HAVE_EGL
|
||||
#if !defined(__APPLE__)
|
||||
#define HAVE_EGL // EAGL is used instead of EGL
|
||||
#endif
|
||||
#elif !defined(_WIN32) && !defined(__APPLE__) && !defined(HAVE_XLIB)
|
||||
#define HAVE_EGL
|
||||
#endif
|
||||
|
@@ -52,7 +52,17 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
|
||||
#if !defined(HAVE_EGL)
|
||||
#if defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(HAVE_GLES2) || defined(OCCT_UWP)
|
||||
#if !defined(__APPLE__)
|
||||
#define HAVE_EGL // EAGL is used instead of EGL
|
||||
#endif
|
||||
#elif !defined(_WIN32) && !defined(__APPLE__) && !defined(HAVE_XLIB)
|
||||
#define HAVE_EGL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EGL)
|
||||
#include <EGL/egl.h>
|
||||
#ifndef EGL_OPENGL_ES3_BIT
|
||||
#define EGL_OPENGL_ES3_BIT 0x00000040
|
||||
@@ -63,7 +73,7 @@ namespace
|
||||
{
|
||||
static const Handle(OpenGl_Context) TheNullGlCtx;
|
||||
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
|
||||
#if defined(HAVE_EGL)
|
||||
//! Wrapper over eglChooseConfig() called with preferred defaults.
|
||||
static EGLConfig chooseEglSurfConfig (EGLDisplay theDisplay)
|
||||
{
|
||||
@@ -155,7 +165,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
|
||||
myMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator())
|
||||
{
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
|
||||
#if defined(HAVE_EGL)
|
||||
myEglDisplay = (Aspect_Display )EGL_NO_DISPLAY;
|
||||
myEglContext = (Aspect_RenderingContext )EGL_NO_CONTEXT;
|
||||
#endif
|
||||
@@ -250,7 +260,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
|
||||
aWindow->GetGlContext()->forcedRelease();
|
||||
}
|
||||
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
|
||||
#if defined(HAVE_EGL)
|
||||
if (myIsOwnContext)
|
||||
{
|
||||
if (myEglContext != (Aspect_RenderingContext )EGL_NO_CONTEXT)
|
||||
@@ -285,7 +295,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
|
||||
Standard_Boolean OpenGl_GraphicDriver::InitContext()
|
||||
{
|
||||
ReleaseContext();
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
|
||||
#if defined(HAVE_EGL)
|
||||
|
||||
#if defined(HAVE_XLIB)
|
||||
if (myDisplayConnection.IsNull())
|
||||
@@ -369,7 +379,7 @@ Standard_Boolean OpenGl_GraphicDriver::InitEglContext (Aspect_Display t
|
||||
void* theEglConfig)
|
||||
{
|
||||
ReleaseContext();
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
|
||||
#if defined(HAVE_EGL)
|
||||
#if defined(HAVE_XLIB)
|
||||
if (myDisplayConnection.IsNull())
|
||||
{
|
||||
@@ -420,7 +430,7 @@ void OpenGl_GraphicDriver::chooseVisualInfo()
|
||||
|
||||
XVisualInfo* aVisInfo = NULL;
|
||||
Aspect_FBConfig anFBConfig = NULL;
|
||||
#if defined(HAVE_EGL) || defined(HAVE_GLES2)
|
||||
#if defined(HAVE_EGL)
|
||||
XVisualInfo aVisInfoTmp;
|
||||
memset (&aVisInfoTmp, 0, sizeof(aVisInfoTmp));
|
||||
aVisInfoTmp.screen = DefaultScreen (aDisp);
|
||||
|
@@ -264,11 +264,20 @@ OpenGl_Window::~OpenGl_Window()
|
||||
void OpenGl_Window::Resize()
|
||||
{
|
||||
// If the size is not changed - do nothing
|
||||
Standard_Integer aWidthPt = 0;
|
||||
Standard_Integer aHeightPt = 0;
|
||||
myPlatformWindow->Size (aWidthPt, aHeightPt);
|
||||
if (myWidthPt == aWidthPt
|
||||
&& myHeightPt == aHeightPt)
|
||||
Graphic3d_Vec2i aWinSize;
|
||||
myPlatformWindow->Size (aWinSize.x(), aWinSize.y());
|
||||
if (myPlatformWindow->IsVirtual())
|
||||
{
|
||||
if (myWidth == aWinSize.x()
|
||||
&& myHeight == aWinSize.y())
|
||||
{
|
||||
return;
|
||||
}
|
||||
myWidth = aWinSize.x();
|
||||
myHeight = aWinSize.y();
|
||||
}
|
||||
else if (myWidthPt == aWinSize.x()
|
||||
&& myHeightPt == aWinSize.y())
|
||||
{
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
return;
|
||||
@@ -293,8 +302,8 @@ void OpenGl_Window::Resize()
|
||||
#endif
|
||||
}
|
||||
|
||||
myWidthPt = aWidthPt;
|
||||
myHeightPt = aHeightPt;
|
||||
myWidthPt = aWinSize.x();
|
||||
myHeightPt = aWinSize.y();
|
||||
|
||||
Init();
|
||||
}
|
||||
@@ -356,35 +365,39 @@ void OpenGl_Window::Init()
|
||||
aDefFbo->BindBuffer (myGlContext);
|
||||
aDefFbo.Nullify();
|
||||
#else
|
||||
NSOpenGLContext* aGLCtx = myGlContext->myGContext;
|
||||
Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
NSView* aView = [aGLCtx view];
|
||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
NSRect aBounds = [aView bounds];
|
||||
|
||||
// we should call this method each time when window is resized
|
||||
[aGLCtx update];
|
||||
|
||||
if ([aView respondsToSelector: @selector(convertSizeToBacking:)])
|
||||
if (!myPlatformWindow->IsVirtual())
|
||||
{
|
||||
NSSize aRes = [aView convertSizeToBacking: aBounds.size];
|
||||
myWidth = Standard_Integer(aRes.width);
|
||||
myHeight = Standard_Integer(aRes.height);
|
||||
NSOpenGLContext* aGLCtx = myGlContext->myGContext;
|
||||
Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
NSView* aView = [aGLCtx view];
|
||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
NSRect aBounds = [aView bounds];
|
||||
|
||||
// we should call this method each time when window is resized
|
||||
[aGLCtx update];
|
||||
|
||||
if ([aView respondsToSelector: @selector(convertSizeToBacking:)])
|
||||
{
|
||||
NSSize aRes = [aView convertSizeToBacking: aBounds.size];
|
||||
myWidth = Standard_Integer(aRes.width);
|
||||
myHeight = Standard_Integer(aRes.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
myWidth = Standard_Integer(aBounds.size.width);
|
||||
myHeight = Standard_Integer(aBounds.size.height);
|
||||
}
|
||||
myWidthPt = Standard_Integer(aBounds.size.width);
|
||||
myHeightPt = Standard_Integer(aBounds.size.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
myWidth = Standard_Integer(aBounds.size.width);
|
||||
myHeight = Standard_Integer(aBounds.size.height);
|
||||
}
|
||||
myWidthPt = Standard_Integer(aBounds.size.width);
|
||||
myHeightPt = Standard_Integer(aBounds.size.height);
|
||||
#endif
|
||||
|
||||
::glDisable (GL_DITHER);
|
||||
::glDisable (GL_SCISSOR_TEST);
|
||||
::glViewport (0, 0, myWidth, myHeight);
|
||||
const Standard_Integer aViewport[4] = { 0, 0, myWidth, myHeight };
|
||||
myGlContext->ResizeViewport (aViewport);
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
::glDrawBuffer (GL_BACK);
|
||||
myGlContext->SetDrawBuffer (GL_BACK);
|
||||
if (myGlContext->core11ffp != NULL)
|
||||
{
|
||||
::glMatrixMode (GL_MODELVIEW);
|
||||
|
@@ -14,8 +14,17 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <ProjLib.hxx>
|
||||
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2d_Parabola.hxx>
|
||||
#include <Geom2d_Hyperbola.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
@@ -33,22 +42,13 @@
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <ProjLib.hxx>
|
||||
#include <ProjLib_Cone.hxx>
|
||||
#include <ProjLib_Cylinder.hxx>
|
||||
#include <ProjLib_Plane.hxx>
|
||||
#include <ProjLib_Sphere.hxx>
|
||||
#include <ProjLib_Torus.hxx>
|
||||
#include <ProjLib_ProjectedCurve.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2d_Parabola.hxx>
|
||||
#include <Geom2d_Hyperbola.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Project
|
||||
|
@@ -37,141 +37,77 @@ class gp_Cylinder;
|
||||
class gp_Cone;
|
||||
class gp_Sphere;
|
||||
class gp_Torus;
|
||||
class ProjLib_ProjectOnPlane;
|
||||
class ProjLib_ProjectOnSurface;
|
||||
class ProjLib_ComputeApprox;
|
||||
class ProjLib_ComputeApproxOnPolarSurface;
|
||||
class ProjLib_ProjectedCurve;
|
||||
class ProjLib_HProjectedCurve;
|
||||
class ProjLib_CompProjectedCurve;
|
||||
class ProjLib_HCompProjectedCurve;
|
||||
class ProjLib_PrjResolve;
|
||||
class ProjLib_PrjFunc;
|
||||
class ProjLib_Projector;
|
||||
class ProjLib_Plane;
|
||||
class ProjLib_Cylinder;
|
||||
class ProjLib_Cone;
|
||||
class ProjLib_Sphere;
|
||||
class ProjLib_Torus;
|
||||
|
||||
//! The projLib package first provides projection of
|
||||
//! curves on a plane along a given Direction. The
|
||||
//! result will be a 3D curve.
|
||||
//! The ProjLib package provides projection of curves
|
||||
//! on surfaces to compute the curve in the parametric
|
||||
//! space.
|
||||
//! The ProjLib package first provides projection of curves on a plane along a given Direction.
|
||||
//! The result will be a 3D curve.
|
||||
//!
|
||||
//! The ProjLib package provides projection of curves on surfaces to compute the curve in the parametric space.
|
||||
//! It is assumed that the curve is on the surface.
|
||||
//!
|
||||
//! It provides :
|
||||
//! It provides:
|
||||
//!
|
||||
//! * Package methods to handle the easiest cases :
|
||||
//! * Package methods to handle the easiest cases:
|
||||
//! - Line, Circle, Ellipse, Parabola, Hyperbola on plane.
|
||||
//! - Line, Circle on cylinder.
|
||||
//! - Line, Circle on cone.
|
||||
//!
|
||||
//! - Line, Circle, Ellipse, Parabola, Hyperbola on plane.
|
||||
//! * Classes to handle the general cases:
|
||||
//! - Plane.
|
||||
//! - Cylinder.
|
||||
//! - Cone.
|
||||
//! - Sphere.
|
||||
//! - Torus.
|
||||
//!
|
||||
//! - Line, Circle on cylinder.
|
||||
//!
|
||||
//! - Line, Circle on cone.
|
||||
//!
|
||||
//! * Classes to handle the general cases :
|
||||
//!
|
||||
//! - Plane.
|
||||
//!
|
||||
//! - Cylinder.
|
||||
//!
|
||||
//! - Cone.
|
||||
//!
|
||||
//! - Sphere.
|
||||
//!
|
||||
//! - Torus.
|
||||
//!
|
||||
//! * A generic class to handle a Curve from Adaptor3d
|
||||
//! on a Surface from Adaptor3d.
|
||||
//! * A generic class to handle a Adaptor3d_Curve on a Adaptor3d_Surface.
|
||||
class ProjLib
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Pnt2d Project (const gp_Pln& Pl, const gp_Pnt& P);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Lin2d Project (const gp_Pln& Pl, const gp_Lin& L);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Circ2d Project (const gp_Pln& Pl, const gp_Circ& C);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Elips2d Project (const gp_Pln& Pl, const gp_Elips& E);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Parab2d Project (const gp_Pln& Pl, const gp_Parab& P);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Hypr2d Project (const gp_Pln& Pl, const gp_Hypr& H);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Pnt2d Project (const gp_Cylinder& Cy, const gp_Pnt& P);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Lin2d Project (const gp_Cylinder& Cy, const gp_Lin& L);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Lin2d Project (const gp_Cylinder& Cy, const gp_Circ& Ci);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Pnt2d Project (const gp_Cone& Co, const gp_Pnt& P);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Lin2d Project (const gp_Cone& Co, const gp_Lin& L);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Lin2d Project (const gp_Cone& Co, const gp_Circ& Ci);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Pnt2d Project (const gp_Sphere& Sp, const gp_Pnt& P);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Lin2d Project (const gp_Sphere& Sp, const gp_Circ& Ci);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Pnt2d Project (const gp_Torus& To, const gp_Pnt& P);
|
||||
|
||||
|
||||
Standard_EXPORT static gp_Lin2d Project (const gp_Torus& To, const gp_Circ& Ci);
|
||||
|
||||
//! Make empty P-Curve <aC> of relevant to <PC> type
|
||||
Standard_EXPORT static void MakePCurveOfType (const ProjLib_ProjectedCurve& PC,
|
||||
Handle(Geom2d_Curve)& aC);
|
||||
|
||||
//! Returns "true" if surface is analytical, that is it can be
|
||||
//! Plane, Cylinder, Cone, Sphere, Torus.
|
||||
//! For all other types of surface method returns "false".
|
||||
Standard_EXPORT static Standard_Boolean IsAnaSurf
|
||||
(const Handle(Adaptor3d_Surface)& theAS);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class ProjLib_ProjectOnPlane;
|
||||
friend class ProjLib_ProjectOnSurface;
|
||||
friend class ProjLib_ComputeApprox;
|
||||
friend class ProjLib_ComputeApproxOnPolarSurface;
|
||||
friend class ProjLib_ProjectedCurve;
|
||||
friend class ProjLib_HProjectedCurve;
|
||||
friend class ProjLib_CompProjectedCurve;
|
||||
friend class ProjLib_HCompProjectedCurve;
|
||||
friend class ProjLib_PrjResolve;
|
||||
friend class ProjLib_PrjFunc;
|
||||
friend class ProjLib_Projector;
|
||||
friend class ProjLib_Plane;
|
||||
friend class ProjLib_Cylinder;
|
||||
friend class ProjLib_Cone;
|
||||
friend class ProjLib_Sphere;
|
||||
friend class ProjLib_Torus;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _ProjLib_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -199,9 +199,12 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void GetTrimmedResult(const Handle(Geom_Curve)& theProjCurve);
|
||||
|
||||
Standard_Boolean BuildParabolaByApex(Handle(Geom_Curve)& theGeomParabolaPtr);
|
||||
Standard_Boolean BuildHyperbolaByApex(Handle(Geom_Curve)& theGeomParabolaPtr);
|
||||
|
||||
|
||||
void BuildByApprox(const Standard_Real theLimitParameter);
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -4049,6 +4049,165 @@ static Standard_Integer QANullifyShape(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void CheckAx3Dir(gp_Ax3& theAxis, const gp_Dir& theDir)
|
||||
{
|
||||
Standard_Boolean bDirect = theAxis.Direct();
|
||||
theAxis.SetDirection (theDir);
|
||||
if (bDirect != theAxis.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
if (!theDir.IsEqual(theAxis.Direction(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: main dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckAx3DirX(gp_Ax3& theAxis, const gp_Dir& theDir)
|
||||
{
|
||||
Standard_Boolean bDirect = theAxis.Direct();
|
||||
theAxis.SetXDirection (theDir);
|
||||
if (bDirect != theAxis.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
gp_Dir aGoodY = theAxis.Direction().Crossed(theDir);
|
||||
if (theAxis.Direct())
|
||||
{
|
||||
if (!aGoodY.IsEqual(theAxis.YDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: X dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!aGoodY.IsOpposite(theAxis.YDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: X dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckAx3DirY(gp_Ax3& theAxis, const gp_Dir& theDir)
|
||||
{
|
||||
Standard_Boolean bDirect = theAxis.Direct();
|
||||
theAxis.SetYDirection (theDir);
|
||||
if (bDirect != theAxis.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
gp_Dir aGoodX = theAxis.Direction().Crossed(theDir);
|
||||
if (theAxis.Direct())
|
||||
{
|
||||
if (!aGoodX.IsOpposite(theAxis.XDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: Y dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!aGoodX.IsEqual(theAxis.XDirection(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: Y dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckAx3Ax1(gp_Ax3& theAx, const gp_Ax1& theAx0)
|
||||
{
|
||||
Standard_Boolean bDirect = theAx.Direct();
|
||||
theAx.SetAxis (theAx0);
|
||||
if (bDirect != theAx.Direct())
|
||||
{
|
||||
std::cout << "Error: coordinate system is reversed\n";
|
||||
}
|
||||
if (!theAx0.Direction().IsEqual(theAx.Direction(), Precision::Angular()))
|
||||
{
|
||||
std::cout << "Error: main dir was not set properly\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Standard_Integer OCC29406 (Draw_Interpretor&, Standard_Integer, const char**)
|
||||
{
|
||||
// Main (Z) direction
|
||||
{
|
||||
// gp_Ax3::SetDirection() test
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4, anAx5, anAx6;
|
||||
anAx3.ZReverse();
|
||||
anAx4.ZReverse();
|
||||
CheckAx3Dir(anAx1, gp::DX());
|
||||
CheckAx3Dir(anAx2, -gp::DX());
|
||||
CheckAx3Dir(anAx3, gp::DX());
|
||||
CheckAx3Dir(anAx4, -gp::DX());
|
||||
// gp_Ax3::SetAxis() test
|
||||
gp_Ax1 anAx0_1 (gp::Origin(), gp::DX());
|
||||
gp_Ax1 anAx0_2 (gp::Origin(), -gp::DX());
|
||||
CheckAx3Ax1(anAx5, anAx0_1);
|
||||
CheckAx3Ax1(anAx6, anAx0_2);
|
||||
}
|
||||
// X direction
|
||||
{
|
||||
// gp_Ax3::SetXDirection() test
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4;
|
||||
anAx3.XReverse();
|
||||
anAx4.XReverse();
|
||||
CheckAx3DirX(anAx1, gp::DZ());
|
||||
CheckAx3DirX(anAx2, -gp::DZ());
|
||||
CheckAx3DirX(anAx3, gp::DZ());
|
||||
CheckAx3DirX(anAx4, -gp::DZ());
|
||||
}
|
||||
// Y direction
|
||||
{
|
||||
// gp_Ax3::SetYDirection() test
|
||||
gp_Ax3 anAx1, anAx2, anAx3, anAx4;
|
||||
anAx3.YReverse();
|
||||
anAx4.YReverse();
|
||||
CheckAx3DirY(anAx1, gp::DZ());
|
||||
CheckAx3DirY(anAx2, -gp::DZ());
|
||||
CheckAx3DirY(anAx3, gp::DZ());
|
||||
CheckAx3DirY(anAx4, -gp::DZ());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <BRepCheck_Analyzer.hxx>
|
||||
#include <GCPnts_UniformDeflection.hxx>
|
||||
static Standard_Integer OCC32744(Draw_Interpretor& theDi, Standard_Integer theNbArgs, const char** theArgVec)
|
||||
{
|
||||
if (theNbArgs != 2)
|
||||
{
|
||||
theDi << "Syntax error: wrong number of arguments!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
const TopoDS_Shape& aShape = DBRep::Get(theArgVec[1]);
|
||||
if (aShape.IsNull())
|
||||
{
|
||||
theDi << " Null Shape is not allowed here\n";
|
||||
return 1;
|
||||
}
|
||||
else if (aShape.ShapeType() != TopAbs_EDGE)
|
||||
{
|
||||
theDi << " Shape type must be EDGE\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aShape);
|
||||
BRepCheck_Analyzer analyzer(anEdge);
|
||||
if (analyzer.IsValid())
|
||||
{
|
||||
Standard_Real firstParam = 0., lastParam = 0.;
|
||||
Handle(Geom_Curve) pCurve = BRep_Tool::Curve(anEdge, firstParam, lastParam);
|
||||
GeomAdaptor_Curve curveAdaptor(pCurve, firstParam, lastParam);
|
||||
GCPnts_UniformDeflection uniformAbs(curveAdaptor, 0.001, firstParam, lastParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
const char *group = "QABugs";
|
||||
|
||||
@@ -4131,5 +4290,14 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
"Nullify shape. Usage: QANullifyShape shape",
|
||||
__FILE__, QANullifyShape, group);
|
||||
|
||||
theCommands.Add ("OCC29406",
|
||||
"Tests the case when newly set axis for gp_Ax3 is parallel to one of current axis",
|
||||
__FILE__, OCC29406, group);
|
||||
|
||||
theCommands.Add("OCC32744",
|
||||
"Tests avoid Endless loop in GCPnts_UniformDeflection",
|
||||
__FILE__,
|
||||
OCC32744, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -297,6 +297,7 @@ bool RWGltf_TriangulationReader::readDracoBuffer (const Handle(RWGltf_GltfLatePr
|
||||
myCoordSysConverter.TransformPosition (anXYZ.ChangeCoord());
|
||||
setNodePosition (theDestMesh, THE_LOWER_NODE_INDEX + aVertIter, anXYZ);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RWGltf_GltfArrayType_Normal:
|
||||
{
|
||||
|
@@ -1411,37 +1411,32 @@ Standard_Boolean STEPCAFControl_Writer::WriteNames (const Handle(XSControl_WorkS
|
||||
|
||||
// get name
|
||||
Handle(TCollection_HAsciiString) hName = new TCollection_HAsciiString;
|
||||
if ( ! GetLabelName (L, hName) ) continue;
|
||||
// Handle(TDataStd_Name) N;
|
||||
// if ( ! L.FindAttribute ( TDataStd_Name::GetID(), N ) ) continue;
|
||||
// TCollection_ExtendedString name = N->Get();
|
||||
// if ( name.Length() <=0 ) continue;
|
||||
if (GetLabelName (L, hName))
|
||||
{
|
||||
// find target STEP entity for the current shape
|
||||
if ( ! myLabels.IsBound ( L ) ) continue; // not recorded as translated, skip
|
||||
TopoDS_Shape S = myLabels.Find ( L );
|
||||
|
||||
// find target STEP entity for the current shape
|
||||
// TopoDS_Shape S;
|
||||
// if ( ! XCAFDoc_ShapeTool::GetShape ( L, S ) ) continue;
|
||||
if ( ! myLabels.IsBound ( L ) ) continue; // not recorded as translated, skip
|
||||
TopoDS_Shape S = myLabels.Find ( L );
|
||||
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) SDR;
|
||||
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
|
||||
if ( ! FP->FindTypedTransient ( mapper, STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation), SDR ) ) {
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) SDR;
|
||||
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
|
||||
if ( ! FP->FindTypedTransient ( mapper, STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation), SDR ) ) {
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "Warning: Cannot find SDR for " << S.TShape()->DynamicType()->Name() << std::endl;
|
||||
std::cout << "Warning: Cannot find SDR for " << S.TShape()->DynamicType()->Name() << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
// set the name to the PRODUCT
|
||||
Handle(StepRepr_PropertyDefinition) PropD = SDR->Definition().PropertyDefinition();
|
||||
if ( PropD.IsNull() ) continue;
|
||||
Handle(StepBasic_ProductDefinition) PD = PropD->Definition().ProductDefinition();
|
||||
if ( PD.IsNull() ) continue;
|
||||
Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
|
||||
|
||||
Prod->SetId ( hName );
|
||||
Prod->SetName ( hName );
|
||||
}
|
||||
|
||||
// set the name to the PRODUCT
|
||||
Handle(StepRepr_PropertyDefinition) PropD = SDR->Definition().PropertyDefinition();
|
||||
if ( PropD.IsNull() ) continue;
|
||||
Handle(StepBasic_ProductDefinition) PD = PropD->Definition().ProductDefinition();
|
||||
if ( PD.IsNull() ) continue;
|
||||
Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
|
||||
|
||||
Prod->SetId ( hName );
|
||||
Prod->SetName ( hName );
|
||||
|
||||
// write names for components of assemblies
|
||||
if ( XCAFDoc_ShapeTool::IsAssembly ( L ) ) {
|
||||
TDF_LabelSequence seq;
|
||||
@@ -1453,14 +1448,14 @@ Standard_Boolean STEPCAFControl_Writer::WriteNames (const Handle(XSControl_WorkS
|
||||
TDF_Label Lref;
|
||||
if ( ! XCAFDoc_ShapeTool::GetReferredShape ( lab, Lref ) ||
|
||||
! myLabels.IsBound ( Lref ) ) continue;
|
||||
S = myLabels.Find ( Lref );
|
||||
TopoDS_Shape S = myLabels.Find ( Lref );
|
||||
S.Move ( XCAFDoc_ShapeTool::GetLocation ( lab ) );
|
||||
|
||||
hName = new TCollection_HAsciiString;
|
||||
if ( ! GetLabelName (lab, hName) ) continue;
|
||||
|
||||
// find the target CDSR corresponding to a shape
|
||||
mapper = TransferBRep::ShapeMapper ( FP, S );
|
||||
Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
|
||||
Handle(Transfer_Binder) binder = FP->Find ( mapper );
|
||||
Handle(StepShape_ContextDependentShapeRepresentation) CDSR;
|
||||
if ( ! FP->FindTypedTransient (mapper,STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation), CDSR) )
|
||||
|
@@ -284,6 +284,11 @@ Handle(Transfer_Binder) STEPControl_ActorRead::Transfer
|
||||
{
|
||||
// [BEGIN] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() );
|
||||
if (!aStepModel->IsInitializedUnit())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
aStepModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
Interface_EntityIterator anEntIt = aStepModel->Header();
|
||||
for ( anEntIt.Start(); anEntIt.More(); anEntIt.Next() ) {
|
||||
DeclareAndCast( HeaderSection_FileName, aFileNameEntity, anEntIt.Value() );
|
||||
@@ -1614,7 +1619,6 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (start.IsNull()) return NullResult();
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
|
||||
Message_Messenger::StreamBuffer sout = TP->Messenger()->SendInfo();
|
||||
#ifdef TRANSLOG
|
||||
|
@@ -1243,8 +1243,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) newItems =
|
||||
new StepRepr_HArray1OfRepresentationItem(1, oldItems->Length() + 1);
|
||||
Standard_Integer el = 1;
|
||||
for (Standard_Integer i = 1; i <= oldItems->Length(); i++)
|
||||
newItems->SetValue( el++, oldItems->Value(i) );
|
||||
for (Standard_Integer i = 1; i <= oldItems->Length(); i++)
|
||||
newItems->SetValue(el++, oldItems->Value(i));
|
||||
newItems->SetValue( el, items->Value( items->Length() ) );
|
||||
shapeRep->SetItems(newItems);
|
||||
}
|
||||
@@ -1278,7 +1278,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
return resbind;
|
||||
} else return FP->Find(start);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferCompound
|
||||
@@ -1383,11 +1383,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
|
||||
Handle(Transfer_SimpleBinderOfTransient) bx =
|
||||
Handle(Transfer_SimpleBinderOfTransient)::DownCast(bnd);
|
||||
if ( !bx.IsNull() ) {
|
||||
// Single SDR is created for a non-manifold group (ssv: 12.11.2010)
|
||||
if (!isManifold && i > 1)
|
||||
break;
|
||||
else
|
||||
binder->AddResult( TransientResult( bx->Result() ) );
|
||||
binder->AddResult( TransientResult( bx->Result() ) );
|
||||
}
|
||||
bnd = bnd->NextResult();
|
||||
}
|
||||
@@ -1466,15 +1462,16 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
|
||||
// if shape itself not yet translated, do it now
|
||||
//:abv 20.05.02: see comment in TransferShape(): added "! iasdr ||"
|
||||
Handle(Transfer_Binder) resprod = TransientResult(sdr); //KA - OCC7141(skl 10.11.2004)
|
||||
bool isJustTransferred = false;
|
||||
if ( ! iasdr || resbind.IsNull() ) {
|
||||
resbind = TransferShape(mapper, sdr, FP, shapeGroup, isManifold, theProgress);
|
||||
Handle(Transfer_Binder) resbind1 = TransferShape(mapper, sdr, FP, shapeGroup, isManifold, theProgress);
|
||||
if (resbind1.IsNull() || sdr->UsedRepresentation().IsNull())
|
||||
return Handle(Transfer_Binder)();
|
||||
resbind = resbind1;
|
||||
Handle(Transfer_Binder) oldbind = FP->Find ( mapper );
|
||||
if ( ! oldbind.IsNull() && !resbind.IsNull()) resbind->AddResult ( oldbind );
|
||||
FP->Bind (mapper,resbind);
|
||||
resprod=resbind; //KA - OCC7141(skl 10.11.2004)
|
||||
isJustTransferred = true;
|
||||
}
|
||||
if (resprod.IsNull())
|
||||
return resprod;
|
||||
|
||||
// A new resbind may have been produced
|
||||
// DeclareAndCast(Transfer_SimpleBinderOfTransient,restrans,resbind);
|
||||
@@ -1498,20 +1495,28 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
|
||||
//KA: we need only the current subshape in resprod, since the binder is copied
|
||||
// in Transfershape which calls Transfersubshape [ OCC7141(skl 10.11.2004) ]
|
||||
if ( ! iasdr ) {
|
||||
resprod->AddResult ( TransientResult ( SDRTool.SDRValue() ) );
|
||||
resbind->AddResult ( TransientResult ( SDRTool.SDRValue() ) ); //KA - OCC7141(skl 10.11.2004)
|
||||
resprod->AddResult (TransientResult (sdr));
|
||||
if (resprod != resbind)
|
||||
resbind->AddResult (TransientResult (sdr)); //KA - OCC7141(skl 10.11.2004)
|
||||
roots->Append ( myContext.GetRootsForPart ( SDRTool ) );
|
||||
}
|
||||
for ( Standard_Integer i=1; i <= roots->Length(); i++ ) {
|
||||
resprod->AddResult ( TransientResult ( roots->Value(i) ) );
|
||||
resbind->AddResult ( TransientResult ( roots->Value(i) ) ); //KA - OCC7141(skl 10.11.2004)
|
||||
if (resprod != resbind)
|
||||
resbind->AddResult (TransientResult (roots->Value(i))); //KA - OCC7141(skl 10.11.2004)
|
||||
}
|
||||
if (isJustTransferred)
|
||||
{
|
||||
// We make CDSR of the current shape preceding CDSR of any subshapes,
|
||||
// therefore add resbind at the end.
|
||||
resprod->AddResult (resbind);
|
||||
FP->Bind (mapper, resprod);
|
||||
}
|
||||
|
||||
myContext.NextIndex();
|
||||
|
||||
//FP->Bind (mapper,resprod); //KA - OCC7141(skl 10.11.2004)
|
||||
|
||||
// abv 16.10.00: bind CDSR (et al) to located shape in order to be able to track instances
|
||||
if ( mapper != start ) {
|
||||
if (mapper != start && aLoc.Form() != gp_Identity) {
|
||||
Handle(Transfer_Binder) bnd = FP->Find ( start );
|
||||
for ( Standard_Integer j=1; j <= roots->Length(); j++ )
|
||||
if ( bnd.IsNull() ) bnd = TransientResult ( roots->Value(j) );
|
||||
|
@@ -543,7 +543,11 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsSphere (const gp_Pnt& theCen
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const gp_Pnt aPntOnSphere (myAxis.Location().XYZ() + myAxis.Direction().XYZ() * aDepth);
|
||||
const gp_Vec aNormal (aPntOnSphere.XYZ() - theCenter.XYZ());
|
||||
thePickResult.SetDepth (aDepth);
|
||||
thePickResult.SetPickedPoint (aPntOnSphere);
|
||||
thePickResult.SetSurfaceNormal (aNormal);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -576,7 +580,22 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsCylinder (const Standard_Rea
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const gp_Pnt aPntOnCylinder = aLoc.XYZ() + aRayDir.XYZ() * aDepth;
|
||||
thePickResult.SetDepth (aDepth);
|
||||
thePickResult.SetPickedPoint (aPntOnCylinder.Transformed (theTrsf));
|
||||
if (Abs (aPntOnCylinder.Z()) < Precision::Confusion())
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (-gp::DZ().Transformed (theTrsf));
|
||||
}
|
||||
else if (Abs (aPntOnCylinder.Z() - theHeight) < Precision::Confusion())
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (gp::DZ().Transformed (theTrsf));
|
||||
}
|
||||
else
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (gp_Vec (aPntOnCylinder.X(), aPntOnCylinder.Y(), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -753,20 +753,24 @@ Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCylinder (const Standard_
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point || mySelectionType == SelectMgr_SelectionType_Box,
|
||||
"Error! SelectMgr_RectangularFrustum::Overlaps() should be called after selection frustum initialization");
|
||||
Standard_Real aTimeEnter = 0.0, aTimeLeave = 0.0;
|
||||
Standard_Real aTimes[2] = { 0.0, 0.0 };
|
||||
const gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
const gp_Pnt aLoc = myNearPickedPnt.Transformed (aTrsfInv);
|
||||
const gp_Dir aRayDir = myViewRayDir .Transformed (aTrsfInv);
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir, aTimeEnter, aTimeLeave))
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir, aTimes[0], aTimes[1]))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
thePickResult.SetDepth (aTimeEnter * myScale);
|
||||
|
||||
Standard_Integer aResTime = 0;
|
||||
thePickResult.SetDepth (aTimes[aResTime] * myScale);
|
||||
if (theClipRange.IsClipped (thePickResult.Depth()))
|
||||
{
|
||||
thePickResult.SetDepth (aTimeLeave * myScale);
|
||||
aResTime = 1;
|
||||
thePickResult.SetDepth (aTimes[aResTime] * myScale);
|
||||
}
|
||||
const gp_Pnt aPntOnCylinder (aLoc.XYZ() + aRayDir.XYZ() * thePickResult.Depth());
|
||||
|
||||
const gp_Pnt aPntOnCylinder = aLoc.XYZ() + aRayDir.XYZ() * aTimes[aResTime];
|
||||
if (Abs (aPntOnCylinder.Z()) < Precision::Confusion())
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (-gp::DZ().Transformed (theTrsf));
|
||||
@@ -779,7 +783,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCylinder (const Standard_
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (gp_Vec (aPntOnCylinder.X(), aPntOnCylinder.Y(), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
thePickResult.SetPickedPoint (aPntOnCylinder);
|
||||
thePickResult.SetPickedPoint (aPntOnCylinder.Transformed (theTrsf));
|
||||
return !theClipRange.IsClipped (thePickResult.Depth());
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <BRepTopAdaptor_TopolTool.hxx>
|
||||
#include <GC_MakeCircle.hxx>
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <GCE2d_MakeLine.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2dConvert.hxx>
|
||||
@@ -46,6 +47,7 @@
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <GeomConvert_ApproxSurface.hxx>
|
||||
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
|
||||
#include <GeomLib_IsPlanarSurface.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
@@ -102,6 +104,19 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ShapeUpgrade_UnifySameDomain,Standard_Transient)
|
||||
|
||||
static Standard_Boolean IsOnSingularity(const TopTools_ListOfShape& theEdgeList)
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape anItl (theEdgeList);
|
||||
for (; anItl.More(); anItl.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anItl.Value());
|
||||
if (BRep_Tool::Degenerated (anEdge))
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
static void SplitWire (const TopoDS_Wire& theWire,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopTools_IndexedMapOfShape& theVmap,
|
||||
@@ -1212,7 +1227,31 @@ static Standard_Boolean GetNormalToSurface(const TopoDS_Face& theFace,
|
||||
{
|
||||
Standard_Real f, l;
|
||||
// get 2d curve to get point in 2d
|
||||
const Handle(Geom2d_Curve)& aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, f, l);
|
||||
Handle(Geom2d_Curve) aC2d;
|
||||
if (BRep_Tool::IsClosed(theEdge, theFace))
|
||||
{
|
||||
//Find the edge in the face: it will have correct orientation
|
||||
TopoDS_Edge anEdgeInFace;
|
||||
TopoDS_Face aFace = theFace;
|
||||
aFace.Orientation (TopAbs_FORWARD);
|
||||
TopExp_Explorer anExplo (aFace, TopAbs_EDGE);
|
||||
for (; anExplo.More(); anExplo.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
|
||||
if (anEdge.IsSame (theEdge))
|
||||
{
|
||||
anEdgeInFace = anEdge;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (anEdgeInFace.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
aC2d = BRep_Tool::CurveOnSurface (anEdgeInFace, aFace, f, l);
|
||||
}
|
||||
else
|
||||
aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, f, l);
|
||||
|
||||
if (aC2d.IsNull()) {
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -1576,9 +1615,6 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
if (isFound)
|
||||
continue;
|
||||
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (aFirstEdge, aFace, aFirst, aLast);
|
||||
|
||||
aFaceSeq.Append (aFace);
|
||||
}
|
||||
|
||||
@@ -1623,6 +1659,9 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
|
||||
if (aPCurveSeq.IsEmpty()) {
|
||||
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
||||
if (aCopyPCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
aCopyPCurve = (Handle(Geom2d_TrimmedCurve)::DownCast(aCopyPCurve))->BasisCurve();
|
||||
|
||||
aPCurveSeq.Append(aCopyPCurve);
|
||||
aFirstsSeq.Append(aFirst);
|
||||
aLastsSeq.Append(aLast);
|
||||
@@ -1697,6 +1736,9 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
else
|
||||
{
|
||||
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
|
||||
if (aCopyPCurve->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
aCopyPCurve = (Handle(Geom2d_TrimmedCurve)::DownCast(aCopyPCurve))->BasisCurve();
|
||||
|
||||
aPCurveSeq.Append(aCopyPCurve);
|
||||
aFirstsSeq.Append(aFirst);
|
||||
aLastsSeq.Append(aLast);
|
||||
@@ -1817,57 +1859,53 @@ void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape&
|
||||
}
|
||||
}
|
||||
|
||||
//Reparametrize 3d curve if needed
|
||||
//Reparametrize pcurves if needed
|
||||
if (!ResPCurves.IsEmpty())
|
||||
{
|
||||
if (Abs (aFirst3d - ResFirsts(1)) > aMaxTol ||
|
||||
Abs (aLast3d - ResLasts(1)) > aMaxTol)
|
||||
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
{
|
||||
GeomAdaptor_Curve aGAcurve (aCurve);
|
||||
GeomAbs_CurveType aType = aGAcurve.GetType();
|
||||
if (aType == GeomAbs_Line)
|
||||
if (Abs (aFirst3d - ResFirsts(ii)) > aMaxTol ||
|
||||
Abs (aLast3d - ResLasts(ii)) > aMaxTol)
|
||||
{
|
||||
gp_Lin aLin = aGAcurve.Line();
|
||||
gp_Dir aDir = aLin.Direction();
|
||||
gp_Pnt aPnt = aGAcurve.Value (aFirst3d);
|
||||
gp_Vec anOffset = -aDir;
|
||||
anOffset *= ResFirsts(1);
|
||||
aPnt.Translate (anOffset);
|
||||
Handle(Geom_Line) aLine = new Geom_Line (aPnt, aDir);
|
||||
aBuilder.UpdateEdge (theEdge, aLine, aTolEdge);
|
||||
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
|
||||
}
|
||||
else if (aType == GeomAbs_Circle)
|
||||
{
|
||||
gp_Circ aCirc = aGAcurve.Circle();
|
||||
Standard_Real aRadius = aCirc.Radius();
|
||||
gp_Ax2 aPosition = aCirc.Position();
|
||||
gp_Ax1 anAxis = aPosition.Axis();
|
||||
Standard_Real anOffset = aFirst3d - ResFirsts(1);
|
||||
aPosition.Rotate (anAxis, anOffset);
|
||||
Handle(Geom_Circle) aCircle = new Geom_Circle (aPosition, aRadius);
|
||||
aBuilder.UpdateEdge (theEdge, aCircle, aTolEdge);
|
||||
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
|
||||
}
|
||||
else //general case
|
||||
{
|
||||
for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
Geom2dAdaptor_Curve aGAcurve (ResPCurves(ii));
|
||||
GeomAbs_CurveType aType = aGAcurve.GetType();
|
||||
if (aType == GeomAbs_Line)
|
||||
{
|
||||
if (Abs (aFirst3d - ResFirsts(ii)) > Precision::Confusion() ||
|
||||
Abs (aLast3d - ResLasts(ii)) > Precision::Confusion())
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) aTrPCurve =
|
||||
new Geom2d_TrimmedCurve (ResPCurves(ii), ResFirsts(ii), ResLasts(ii));
|
||||
Handle(Geom2d_BSplineCurve) aBSplinePCurve = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
||||
TColStd_Array1OfReal aKnots (1, aBSplinePCurve->NbKnots());
|
||||
aBSplinePCurve->Knots (aKnots);
|
||||
BSplCLib::Reparametrize (aFirst3d, aLast3d, aKnots);
|
||||
aBSplinePCurve->SetKnots (aKnots);
|
||||
ResPCurves(ii) = aBSplinePCurve;
|
||||
}
|
||||
gp_Lin2d aLin2d = aGAcurve.Line();
|
||||
gp_Dir2d aDir2d = aLin2d.Direction();
|
||||
gp_Pnt2d aPnt2d = aGAcurve.Value(ResFirsts(ii));
|
||||
gp_Vec2d anOffset = -aDir2d;
|
||||
anOffset *= aFirst3d;
|
||||
aPnt2d.Translate (anOffset);
|
||||
Handle(Geom2d_Line) aNewLine2d = new Geom2d_Line (aPnt2d, aDir2d);
|
||||
ResPCurves(ii) = aNewLine2d;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aType == GeomAbs_Circle)
|
||||
{
|
||||
gp_Circ2d aCirc2d = aGAcurve.Circle();
|
||||
Standard_Real aRadius = aCirc2d.Radius();
|
||||
gp_Ax22d aPosition = aCirc2d.Position();
|
||||
gp_Pnt2d aLocation = aCirc2d.Location();
|
||||
Standard_Real anOffset = ResFirsts(ii) - aFirst3d;
|
||||
aPosition.Rotate (aLocation, anOffset);
|
||||
Handle(Geom2d_Circle) aNewCircle2d = new Geom2d_Circle (aPosition, aRadius);
|
||||
ResPCurves(ii) = aNewCircle2d;
|
||||
}
|
||||
else //general case
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) aTrPCurve =
|
||||
new Geom2d_TrimmedCurve (ResPCurves(ii), ResFirsts(ii), ResLasts(ii));
|
||||
Handle(Geom2d_BSplineCurve) aBSplinePCurve = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
|
||||
TColStd_Array1OfReal aKnots (1, aBSplinePCurve->NbKnots());
|
||||
aBSplinePCurve->Knots (aKnots);
|
||||
BSplCLib::Reparametrize (aFirst3d, aLast3d, aKnots);
|
||||
aBSplinePCurve->SetKnots (aKnots);
|
||||
ResPCurves(ii) = aBSplinePCurve;
|
||||
}
|
||||
ResFirsts(ii) = aFirst3d;
|
||||
ResLasts(ii) = aLast3d;
|
||||
} //if ranges > aMaxTol
|
||||
} //for (Standard_Integer ii = 1; ii <= ResPCurves.Length(); ii++)
|
||||
}
|
||||
|
||||
for (Standard_Integer j = 1; j <= ResPCurves.Length(); j++)
|
||||
@@ -2032,8 +2070,22 @@ Standard_Boolean ShapeUpgrade_UnifySameDomain::MergeSubSeq(const TopTools_Sequen
|
||||
TopoDS_Vertex V[2];
|
||||
V[0] = sae.FirstVertex(FE);
|
||||
V[1] = sae.LastVertex(TopoDS::Edge(theChain.Last()));
|
||||
Standard_Boolean isClosed = V[0].IsSame(V[1]);
|
||||
if (!isClosed)
|
||||
{
|
||||
// additionally check the points for equality to make a final decision about closedness of the result curve
|
||||
gp_Pnt aP0 = BRep_Tool::Pnt(V[0]);
|
||||
gp_Pnt aP1 = BRep_Tool::Pnt(V[1]);
|
||||
Standard_Real aTol = Max(BRep_Tool::Tolerance(V[0]), BRep_Tool::Tolerance(V[1]));
|
||||
if (aP0.SquareDistance(aP1) < aTol * aTol)
|
||||
{
|
||||
isClosed = Standard_True;
|
||||
V[1] = V[0];
|
||||
V[1].Reverse();
|
||||
}
|
||||
}
|
||||
TopoDS_Edge E;
|
||||
if (V[0].IsSame(V[1])) {
|
||||
if (isClosed) {
|
||||
// closed chain
|
||||
BRepAdaptor_Curve adef(FE);
|
||||
Handle(Geom_Circle) Cir1;
|
||||
@@ -2965,29 +3017,107 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
TopTools_IndexedDataMapOfShapeListOfShape VEmap;
|
||||
for (Standard_Integer ind = 1; ind <= edges.Length(); ind++)
|
||||
TopExp::MapShapesAndUniqueAncestors(edges(ind), TopAbs_VERTEX, TopAbs_EDGE, VEmap);
|
||||
|
||||
//Try to find seam edge and an edge that is not seam but has 2 pcurves on the surface
|
||||
Standard_Boolean SeamFound = Standard_False;
|
||||
TopoDS_Edge EdgeWith2pcurves;
|
||||
for (Standard_Integer ii = 1; ii <= faces.Length(); ii++)
|
||||
{
|
||||
const TopoDS_Face& face_ii = TopoDS::Face(faces(ii));
|
||||
TopoDS_Wire anOuterWire = BRepTools::OuterWire(face_ii);
|
||||
TopoDS_Iterator itw(anOuterWire);
|
||||
for (; itw.More(); itw.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(itw.Value());
|
||||
if (BRep_Tool::IsClosed (anEdge, face_ii))
|
||||
{
|
||||
if (BRepTools::IsReallyClosed(anEdge, face_ii))
|
||||
SeamFound = Standard_True;
|
||||
else
|
||||
EdgeWith2pcurves = anEdge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean aIsEdgeWith2pcurvesSmooth = Standard_False;
|
||||
if (myConcatBSplines && !EdgeWith2pcurves.IsNull() && !SeamFound)
|
||||
{
|
||||
const TopTools_ListOfShape& aFaceList = theGMapEdgeFaces.FindFromKey (EdgeWith2pcurves);
|
||||
const TopoDS_Face& aFace1 = TopoDS::Face (aFaceList.First());
|
||||
const TopoDS_Face& aFace2 = TopoDS::Face (aFaceList.Last());
|
||||
GeomAbs_Shape anOrderOfCont = BRepLib::ContinuityOfFaces (EdgeWith2pcurves,
|
||||
aFace1, aFace2,
|
||||
myAngTol);
|
||||
aIsEdgeWith2pcurvesSmooth = (anOrderOfCont >= GeomAbs_G1);
|
||||
}
|
||||
|
||||
if (aIsEdgeWith2pcurvesSmooth)
|
||||
{
|
||||
Handle(Geom2d_Curve) aPC1, aPC2;
|
||||
Standard_Real aFirst, aLast;
|
||||
aPC1 = BRep_Tool::CurveOnSurface (EdgeWith2pcurves, F_RefFace, aFirst, aLast);
|
||||
EdgeWith2pcurves.Reverse();
|
||||
aPC2 = BRep_Tool::CurveOnSurface (EdgeWith2pcurves, F_RefFace, aFirst, aLast);
|
||||
gp_Pnt2d aPnt1 = aPC1->Value (aFirst);
|
||||
gp_Pnt2d aPnt2 = aPC2->Value (aFirst);
|
||||
Standard_Boolean anIsUclosed = (Abs(aPnt1.X() - aPnt2.X()) > Abs(aPnt1.Y() - aPnt2.Y()));
|
||||
Standard_Boolean aToMakeUPeriodic = Standard_False, aToMakeVPeriodic = Standard_False;
|
||||
if (anIsUclosed && Uperiod == 0.)
|
||||
aToMakeUPeriodic = Standard_True;
|
||||
if (!anIsUclosed && Vperiod == 0.)
|
||||
aToMakeVPeriodic = Standard_True;
|
||||
|
||||
if (aToMakeUPeriodic || aToMakeVPeriodic)
|
||||
{
|
||||
Handle(Geom_BSplineSurface) aBSplineSurface = Handle(Geom_BSplineSurface)::DownCast(aBaseSurface);
|
||||
if (aBSplineSurface.IsNull())
|
||||
{
|
||||
Standard_Real aTol = 1.e-4;
|
||||
GeomAbs_Shape aUCont = GeomAbs_C1, aVCont = GeomAbs_C1;
|
||||
Standard_Integer degU = 14, degV = 14;
|
||||
Standard_Integer nmax = 16;
|
||||
Standard_Integer aPrec = 1;
|
||||
GeomConvert_ApproxSurface Approximator(aBaseSurface,aTol,aUCont,aVCont,degU,degV,nmax,aPrec);
|
||||
aBSplineSurface = Approximator.Surface();
|
||||
}
|
||||
|
||||
if (aToMakeUPeriodic)
|
||||
{
|
||||
aBSplineSurface->SetUPeriodic();
|
||||
Uperiod = aBSplineSurface->UPeriod();
|
||||
}
|
||||
if (aToMakeVPeriodic)
|
||||
{
|
||||
aBSplineSurface->SetVPeriodic();
|
||||
Vperiod = aBSplineSurface->VPeriod();
|
||||
}
|
||||
|
||||
//Update ref face and pcurves if the surface changed
|
||||
if (aBSplineSurface != aBaseSurface)
|
||||
{
|
||||
TopoDS_Face OldRefFace = RefFace;
|
||||
Handle(Geom2d_Curve) NullPCurve;
|
||||
RefFace.Nullify();
|
||||
BB.MakeFace(RefFace, aBSplineSurface, aBaseLocation, 0.);
|
||||
for (Standard_Integer ii = 1; ii <= edges.Length(); ii++)
|
||||
{
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(edges(ii));
|
||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (anEdge, OldRefFace, aFirst, aLast);
|
||||
if (MapEdgesWithTemporaryPCurves.Contains(anEdge))
|
||||
BB.UpdateEdge(anEdge, NullPCurve, OldRefFace, 0.);
|
||||
BB.UpdateEdge(anEdge, aPCurve, RefFace, 0.);
|
||||
}
|
||||
F_RefFace = RefFace;
|
||||
F_RefFace.Orientation(TopAbs_FORWARD);
|
||||
}
|
||||
}
|
||||
} //if (myConcatBSplines && !EdgeWith2pcurves.IsNull() && !SeamFound)
|
||||
|
||||
//Perform relocating to new U-origin
|
||||
//Define boundaries in 2d space of RefFace
|
||||
if (Uperiod != 0.)
|
||||
{
|
||||
//try to find a real seam edge - if it exists, do nothing
|
||||
Standard_Boolean SeamFound = Standard_False;
|
||||
for (Standard_Integer ii = 1; ii <= faces.Length(); ii++)
|
||||
{
|
||||
const TopoDS_Face& face_ii = TopoDS::Face(faces(ii));
|
||||
TopoDS_Wire anOuterWire = BRepTools::OuterWire(face_ii);
|
||||
TopoDS_Iterator itw(anOuterWire);
|
||||
for (; itw.More(); itw.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(itw.Value());
|
||||
if (BRepTools::IsReallyClosed(anEdge, face_ii))
|
||||
{
|
||||
SeamFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if seam edge exists, do nothing
|
||||
if (!SeamFound)
|
||||
{
|
||||
//try to find the origin of U in 2d space
|
||||
@@ -3189,6 +3319,10 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
if (NextEdge.IsNull())
|
||||
{
|
||||
Standard_Boolean EndOfWire = Standard_False;
|
||||
|
||||
Standard_Boolean anIsOnSingularity = IsOnSingularity (Elist);
|
||||
if (!anIsOnSingularity && Elist.Extent() > 1)
|
||||
SplittingVertices.Add (CurVertex);
|
||||
|
||||
TopTools_ListOfShape TmpElist, TrueElist;
|
||||
//<TrueElist> will be the list of candidates to become <NextEdge>
|
||||
@@ -3208,7 +3342,6 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
|
||||
else
|
||||
{
|
||||
//we must choose the closest direction - the biggest angle
|
||||
SplittingVertices.Add (CurVertex);
|
||||
Standard_Real MaxAngle = RealFirst();
|
||||
TopoDS_Edge TrueEdge;
|
||||
Handle(Geom2d_Curve) CurPCurve = BRep_Tool::CurveOnSurface(CurEdge, F_RefFace, fpar, lpar);
|
||||
|
@@ -155,13 +155,22 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Registers this callback object in the current error handler (if found).
|
||||
void RegisterCallback();
|
||||
#if defined(OCC_CONVERT_SIGNALS)
|
||||
Standard_EXPORT
|
||||
#endif
|
||||
void RegisterCallback();
|
||||
|
||||
//! Unregisters this callback object from the error handler.
|
||||
void UnregisterCallback();
|
||||
#if defined(OCC_CONVERT_SIGNALS)
|
||||
Standard_EXPORT
|
||||
#endif
|
||||
void UnregisterCallback();
|
||||
|
||||
//! Destructor
|
||||
virtual ~Callback();
|
||||
#if defined(OCC_CONVERT_SIGNALS)
|
||||
Standard_EXPORT
|
||||
#endif
|
||||
virtual ~Callback();
|
||||
|
||||
//! The callback function to perform necessary callback action.
|
||||
//! Called by the exception handler when it is being destroyed but
|
||||
@@ -171,7 +180,10 @@ public:
|
||||
protected:
|
||||
|
||||
//! Empty constructor
|
||||
Callback();
|
||||
#if defined(OCC_CONVERT_SIGNALS)
|
||||
Standard_EXPORT
|
||||
#endif
|
||||
Callback();
|
||||
|
||||
private:
|
||||
Standard_Address myHandler;
|
||||
|
@@ -16,22 +16,17 @@
|
||||
|
||||
#include <Standard_TypeDef.hxx>
|
||||
|
||||
// ===============================================
|
||||
// Methods from Standard_Entity class which are redefined:
|
||||
// - IsEqual
|
||||
// ===============================================
|
||||
|
||||
#ifndef __QNX__ // same as Standard_Size
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// IsEqual : Returns Standard_True if two time values are equal
|
||||
// ------------------------------------------------------------------
|
||||
inline Standard_Boolean IsEqual (const Standard_Time theOne,
|
||||
const Standard_Time theTwo)
|
||||
template<typename TheTimeType>
|
||||
typename opencascade::std::enable_if<opencascade::std::is_same<TheTimeType, Standard_Time>::value
|
||||
&& !opencascade::std::is_same<Standard_Size, Standard_Time>::value
|
||||
&& !opencascade::std::is_same<Standard_Integer, Standard_Time>::value,
|
||||
Standard_Boolean>::type
|
||||
IsEqual (const TheTimeType theOne, const TheTimeType theTwo)
|
||||
{
|
||||
return theOne == theTwo;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -35,7 +35,7 @@
|
||||
// Primary definitions
|
||||
#define OCC_VERSION_MAJOR 7
|
||||
#define OCC_VERSION_MINOR 6
|
||||
#define OCC_VERSION_MAINTENANCE 0
|
||||
#define OCC_VERSION_MAINTENANCE 3
|
||||
|
||||
//! This macro must be commented in official release, and set to non-empty
|
||||
//! string in other situations, to identify specifics of the version, e.g.:
|
||||
@@ -47,7 +47,7 @@
|
||||
// Derived (manually): version as real and string (major.minor)
|
||||
#define OCC_VERSION 7.6
|
||||
#define OCC_VERSION_STRING "7.6"
|
||||
#define OCC_VERSION_COMPLETE "7.6.0"
|
||||
#define OCC_VERSION_COMPLETE "7.6.3"
|
||||
|
||||
//! Derived: extended version as string ("major.minor.maintenance.dev")
|
||||
#ifdef OCC_VERSION_DEVELOPMENT
|
||||
|
@@ -280,11 +280,11 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
&TopoDS::Face (aSubfacesMap.FindKey (2))
|
||||
};
|
||||
|
||||
TopLoc_Location aLocSurf;
|
||||
TopLoc_Location aLocSurf[2];
|
||||
const Handle(Geom_Surface)* aSurfaces[2] =
|
||||
{
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf)
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf[0]),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf[1])
|
||||
};
|
||||
|
||||
Standard_Integer aConIndex = 0;
|
||||
@@ -308,7 +308,7 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
const Standard_Real aRad1 = aCone.RefRadius();
|
||||
const Standard_Real aHeight = (aRad1 != 0.0)
|
||||
? aRad1 / Abs (Tan (aCone.SemiAngle()))
|
||||
: aCone.Location().Distance (aGeomPln->Location());
|
||||
: aCone.Location().Distance (aGeomPln->Location().Transformed (aLocSurf[aConIndex == 0 ? 1 : 0]));
|
||||
const Standard_Real aRad2 = (aRad1 != 0.0) ? 0.0 : Tan (aCone.SemiAngle()) * aHeight;
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCone.Position(), gp_Ax3());
|
||||
@@ -326,18 +326,19 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
&TopoDS::Face (aSubfacesMap.FindKey (3))
|
||||
};
|
||||
|
||||
TopLoc_Location aLocSurf;
|
||||
TopLoc_Location aLocSurf[3];
|
||||
const Handle(Geom_Surface)* aSurfaces[3] =
|
||||
{
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf),
|
||||
&BRep_Tool::Surface (*aFaces[2], aLocSurf)
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf[0]),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf[1]),
|
||||
&BRep_Tool::Surface (*aFaces[2], aLocSurf[2])
|
||||
};
|
||||
|
||||
Standard_Integer aConIndex = -1, aNbPlanes = 0;
|
||||
Handle(Geom_ConicalSurface) aGeomCone;
|
||||
Handle(Geom_CylindricalSurface) aGeomCyl;
|
||||
Handle(Geom_Plane) aGeomPlanes[2];
|
||||
const TopLoc_Location* aGeomPlanesLoc[2];
|
||||
for (Standard_Integer aSurfIter = 0; aSurfIter < 3; ++aSurfIter)
|
||||
{
|
||||
const Handle(Geom_Surface)& aSurf = *aSurfaces[aSurfIter];
|
||||
@@ -361,6 +362,7 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
aGeomPlanes[aNbPlanes] = Handle(Geom_Plane)::DownCast (aSurf);
|
||||
if (!aGeomPlanes[aNbPlanes].IsNull())
|
||||
{
|
||||
aGeomPlanesLoc[aNbPlanes] = &aLocSurf[aSurfIter];
|
||||
++aNbPlanes;
|
||||
}
|
||||
}
|
||||
@@ -375,7 +377,8 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
{
|
||||
const gp_Cone aCone = BRepAdaptor_Surface (*aFaces[aConIndex]).Cone();
|
||||
const Standard_Real aRad1 = aCone.RefRadius();
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Distance (aGeomPlanes[1]->Location());
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Transformed (*aGeomPlanesLoc[0])
|
||||
.Distance (aGeomPlanes[1]->Location().Transformed (*aGeomPlanesLoc[1]));
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCone.Position(), gp_Ax3());
|
||||
const Standard_Real aTriangleHeight = (aCone.SemiAngle() > 0.0)
|
||||
@@ -398,7 +401,8 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
{
|
||||
const gp_Cylinder aCyl = BRepAdaptor_Surface (*aFaces[aConIndex]).Cylinder();
|
||||
const Standard_Real aRad = aCyl.Radius();
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Distance (aGeomPlanes[1]->Location());
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Transformed (*aGeomPlanesLoc[0])
|
||||
.Distance (aGeomPlanes[1]->Location().Transformed (*aGeomPlanesLoc[1]));
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCyl.Position(), gp_Ax3());
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad, aRad, aHeight, aTrsf);
|
||||
@@ -410,7 +414,7 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
|
||||
for (Standard_Integer aShIndex = 1; aShIndex <= aSubfacesMap.Extent(); ++aShIndex)
|
||||
{
|
||||
ComputeSensitive (aSubfacesMap (aShIndex), theOwner,
|
||||
ComputeSensitive (aSubfacesMap.FindKey (aShIndex), theOwner,
|
||||
theSelection,
|
||||
theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
|
||||
}
|
||||
|
@@ -128,7 +128,7 @@ void TNaming_CopyShape::Translate( const TopoDS_Shape& aShape,
|
||||
}
|
||||
|
||||
aResult.Orientation(aShape.Orientation());
|
||||
aResult.Location(TNaming_CopyShape::Translate(aShape.Location(), aMap));
|
||||
aResult.Location(TNaming_CopyShape::Translate(aShape.Location(), aMap), false);
|
||||
TrTool->UpdateShape(aShape,aResult);
|
||||
// #ifdef OCCT_DEBUG
|
||||
// if(fShar) {
|
||||
|
@@ -196,7 +196,7 @@ void ViewerTest_EventManager::handleViewRedraw (const Handle(AIS_InteractiveCont
|
||||
&& (!aRedrawer.IsStarted() || aRedrawer.IsPaused()))
|
||||
{
|
||||
myIsTmpContRedraw = true;
|
||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) && !defined(__APPLE__)
|
||||
aRedrawer.Start (theView, 60.0);
|
||||
#endif
|
||||
}
|
||||
@@ -210,7 +210,7 @@ void ViewerTest_EventManager::handleViewRedraw (const Handle(AIS_InteractiveCont
|
||||
else if (myIsTmpContRedraw)
|
||||
{
|
||||
myIsTmpContRedraw = false;
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
ViewerTest_ContinuousRedrawer& aRedrawer = ViewerTest_ContinuousRedrawer::Instance();
|
||||
aRedrawer.Pause();
|
||||
#endif
|
||||
|
@@ -325,7 +325,7 @@ static int doTranslate (const XmlMNaming_Shape1& thePShape,
|
||||
return 1;
|
||||
theResult.TShape (theShapeSet.Shape(aShapeId).TShape());
|
||||
theResult.Orientation (thePShape.Orientation());
|
||||
theResult.Location (theShapeSet.Locations().Location (thePShape.LocId()));
|
||||
theResult.Location (theShapeSet.Locations().Location (thePShape.LocId()), false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -348,37 +348,45 @@ inline gp_Ax2 gp_Ax3::Ax2()const
|
||||
// function : SetAxis
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
inline void gp_Ax3::SetAxis (const gp_Ax1& theA1)
|
||||
inline void gp_Ax3::SetAxis(const gp_Ax1& theA1)
|
||||
{
|
||||
Standard_Boolean isDirect = Direct();
|
||||
axis = theA1;
|
||||
vxdir = axis.Direction().CrossCrossed (vxdir, axis.Direction());
|
||||
if (isDirect)
|
||||
{
|
||||
vydir = axis.Direction().Crossed (vxdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
vydir = vxdir.Crossed (axis.Direction());
|
||||
}
|
||||
axis.SetLocation(theA1.Location());
|
||||
SetDirection(theA1.Direction());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDirection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
inline void gp_Ax3::SetDirection (const gp_Dir& theV)
|
||||
inline void gp_Ax3::SetDirection(const gp_Dir& theV)
|
||||
{
|
||||
Standard_Boolean isDirect = Direct();
|
||||
axis.SetDirection (theV);
|
||||
vxdir = theV.CrossCrossed (vxdir, theV);
|
||||
if (isDirect)
|
||||
Standard_Real aDot = theV.Dot(vxdir);
|
||||
if(1. - Abs(aDot) <= Precision::Angular())
|
||||
{
|
||||
vydir = theV.Crossed (vxdir);
|
||||
if(aDot > 0)
|
||||
{
|
||||
vxdir = vydir;
|
||||
vydir = axis.Direction();
|
||||
}
|
||||
else
|
||||
{
|
||||
vxdir = axis.Direction();
|
||||
}
|
||||
axis.SetDirection(theV);
|
||||
}
|
||||
else
|
||||
{
|
||||
vydir = vxdir.Crossed (theV);
|
||||
{
|
||||
Standard_Boolean direct = Direct();
|
||||
axis.SetDirection (theV);
|
||||
vxdir = theV.CrossCrossed (vxdir, theV);
|
||||
if (direct)
|
||||
{
|
||||
vydir = theV.Crossed (vxdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
vydir = vxdir.Crossed (theV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,15 +396,32 @@ inline void gp_Ax3::SetDirection (const gp_Dir& theV)
|
||||
// =======================================================================
|
||||
inline void gp_Ax3::SetXDirection (const gp_Dir& theVx)
|
||||
{
|
||||
Standard_Boolean isDirect = Direct();
|
||||
vxdir = axis.Direction().CrossCrossed (theVx, axis.Direction());
|
||||
if (isDirect)
|
||||
Standard_Real aDot = theVx.Dot(axis.Direction());
|
||||
if (1. - Abs(aDot) <= Precision::Angular())
|
||||
{
|
||||
vydir = axis.Direction().Crossed (vxdir);
|
||||
if (aDot > 0)
|
||||
{
|
||||
axis.SetDirection(vxdir);
|
||||
vydir = -vydir;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis.SetDirection(vxdir);
|
||||
}
|
||||
vxdir = theVx;
|
||||
}
|
||||
else
|
||||
{
|
||||
vydir = vxdir.Crossed (axis.Direction());
|
||||
Standard_Boolean direct = Direct();
|
||||
vxdir = axis.Direction().CrossCrossed(theVx, axis.Direction());
|
||||
if (direct)
|
||||
{
|
||||
vydir = axis.Direction().Crossed(vxdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
vydir = vxdir.Crossed(axis.Direction());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,12 +431,29 @@ inline void gp_Ax3::SetXDirection (const gp_Dir& theVx)
|
||||
// =======================================================================
|
||||
inline void gp_Ax3::SetYDirection (const gp_Dir& theVy)
|
||||
{
|
||||
Standard_Boolean isDirect = Direct();
|
||||
vxdir = theVy.Crossed (axis.Direction());
|
||||
vydir = (axis.Direction()).Crossed (vxdir);
|
||||
if (!isDirect)
|
||||
Standard_Real aDot = theVy.Dot(axis.Direction());
|
||||
if (1. - Abs(aDot) <= Precision::Angular())
|
||||
{
|
||||
vxdir.Reverse();
|
||||
if (aDot > 0)
|
||||
{
|
||||
axis.SetDirection(vydir);
|
||||
vxdir = -vxdir;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis.SetDirection(vydir);
|
||||
}
|
||||
vydir = theVy;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Boolean isDirect = Direct();
|
||||
vxdir = theVy.Crossed(axis.Direction());
|
||||
vydir = (axis.Direction()).Crossed(vxdir);
|
||||
if (!isDirect)
|
||||
{
|
||||
vxdir.Reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,27 +27,37 @@ CommitCommand D0
|
||||
SaveAs D0 ${docname}
|
||||
Close D0
|
||||
|
||||
set whole_time [lindex [time {
|
||||
Open ${docname} D1
|
||||
Close D1
|
||||
} 20] 0]
|
||||
# Computes the elapsed time of open and close document with a given arguments (as text).
|
||||
# It launches 10 iteration, 10 actions in each. Returns time of average time of the minimum-time iteration.
|
||||
proc action_time args {
|
||||
global docname
|
||||
set min_time 1000000
|
||||
for {set iter 0} {$iter < 10} {incr iter} {
|
||||
set iter_time [lindex [time {
|
||||
Open ${docname} D {*}$args
|
||||
Close D
|
||||
} 10] 0]
|
||||
puts "Iteration time $iter_time mcs"
|
||||
if {$iter_time < $min_time} {
|
||||
set min_time $iter_time
|
||||
}
|
||||
}
|
||||
|
||||
return $min_time
|
||||
}
|
||||
|
||||
set whole_time [action_time]
|
||||
puts "Whole document open time $whole_time mcs"
|
||||
|
||||
set quater_time [lindex [time {
|
||||
Open ${docname} D2 -read0:2
|
||||
Close D2
|
||||
} 20] 0]
|
||||
set quater_time [action_time -read0:2]
|
||||
puts "Quater of document open time $quater_time mcs"
|
||||
|
||||
# Check that open of quater of the document is at least twice faster than open of whole.
|
||||
if { [expr $quater_time * 2] > $whole_time } {
|
||||
# Check that open of quater of the document is significantly faster than open of whole.
|
||||
if { [expr $quater_time * 1.5] > $whole_time } {
|
||||
puts "Error : loading of quater of the document content too slow relatively to the whole document load"
|
||||
}
|
||||
|
||||
set four_quaters_time [lindex [time {
|
||||
Open ${docname} D3 -read0:1 -read0:2 -read0:3 -read0:4
|
||||
Close D3
|
||||
} 20] 0]
|
||||
set four_quaters_time [action_time -read0:1 -read0:2 -read0:3 -read0:4]
|
||||
puts "Four quaters of document open time $four_quaters_time mcs"
|
||||
|
||||
# Check that open of four quaters of the document is not too much slower than opening of the whole document.
|
||||
@@ -69,6 +79,7 @@ if {![catch {Attributes D4 0:1:1:13}] || ![catch {Attributes D4 0:1:3:14}] || ![
|
||||
puts "Error : loading of document skipping arrays and sub-trees contains invalid attributes list"
|
||||
}
|
||||
|
||||
# check for appending arrays to the document from the file
|
||||
set append_arrays_time [lindex [time {
|
||||
Open ${docname} D4 -append -readTDataStd_IntegerArray -read0:2 -read0:3
|
||||
}] 0]
|
||||
|
7
tests/bugs/fclasses/bug29406
Normal file
7
tests/bugs/fclasses/bug29406
Normal file
@@ -0,0 +1,7 @@
|
||||
puts "============"
|
||||
puts "0029406: Foundation Classes - gp_Ax3 fails setting direction"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
pload QAcommands
|
||||
OCC29406
|
24
tests/bugs/heal/bug29382_2
Normal file
24
tests/bugs/heal/bug29382_2
Normal file
@@ -0,0 +1,24 @@
|
||||
puts "================================================================================"
|
||||
puts "OCC29382: ShapeUpgrade_UnifySameDomain algorithm incorrectly processes the shape"
|
||||
puts "================================================================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug29382_Group_3.brep] a
|
||||
|
||||
unifysamedom result a +b
|
||||
|
||||
checkshape result
|
||||
checkshape a
|
||||
|
||||
checknbshapes result -solid 3 -shell 3 -face 16 -wire 16 -edge 30 -vertex 18
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 1.8066863810061599e-05} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
explode result
|
||||
checkprops result_1 -v 4.41996e-06
|
||||
checkprops result_2 -v 1.30453e-06
|
||||
checkprops result_3 -v 1.16532e-06
|
24
tests/bugs/heal/bug29382_3
Normal file
24
tests/bugs/heal/bug29382_3
Normal file
@@ -0,0 +1,24 @@
|
||||
puts "================================================================================"
|
||||
puts "OCC29382: ShapeUpgrade_UnifySameDomain algorithm incorrectly processes the shape"
|
||||
puts "================================================================================"
|
||||
puts ""
|
||||
|
||||
beziercurve a 5 0 0 0 1 0 0 2 2 0 0 0.5 0 0 0 0
|
||||
mkedge a a
|
||||
wire a a
|
||||
mkplane a a
|
||||
prism a a 0 0 1
|
||||
box b -0.3 -0.2 0 1 0.4 1
|
||||
bcommon shape a b
|
||||
|
||||
unifysamedom result shape +b
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 9 -vertex 5
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 6.e-6} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
20
tests/bugs/heal/bug32719
Normal file
20
tests/bugs/heal/bug32719
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "============================================================"
|
||||
puts "OCC32719: UnifySameDomain result has incorrect triangulation"
|
||||
puts "============================================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32719.brep] a
|
||||
|
||||
unifysamedom result a
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -t -solid 4 -shell 4 -face 20 -wire 20 -edge 32 -vertex 16
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 6.e-6} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -s 0.0222593 -v 5.17261e-05
|
23
tests/bugs/heal/bug32814_1
Normal file
23
tests/bugs/heal/bug32814_1
Normal file
@@ -0,0 +1,23 @@
|
||||
puts "=============================================="
|
||||
puts "OCC32814: Unifysamedom produces invalid result"
|
||||
puts "=============================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32814_1.brep] s
|
||||
|
||||
unifysamedom result s -a 1e-4
|
||||
|
||||
checkshape result
|
||||
bopargcheck result
|
||||
|
||||
checknbshapes result -t -face 7 -wire 13 -edge 70 -vertex 64
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 1.e-7} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -s 5.54082e+06
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
23
tests/bugs/heal/bug32814_2
Normal file
23
tests/bugs/heal/bug32814_2
Normal file
@@ -0,0 +1,23 @@
|
||||
puts "=============================================="
|
||||
puts "OCC32814: Unifysamedom produces invalid result"
|
||||
puts "=============================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32814_2.brep] s
|
||||
|
||||
unifysamedom result s
|
||||
|
||||
checkshape result
|
||||
bopargcheck result
|
||||
|
||||
checknbshapes result -t -solid 1 -shell 1 -face 78 -wire 110 -edge 220 -vertex 136
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 2.e-7} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -s 1.61456e+06 -v 3e+07
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
36
tests/bugs/heal/bug33028
Normal file
36
tests/bugs/heal/bug33028
Normal file
@@ -0,0 +1,36 @@
|
||||
puts "========================"
|
||||
puts " OCC33028: Standard_ConstructionError while using ShapeUpgrade_UnifySameDomain"
|
||||
puts "========================"
|
||||
puts ""
|
||||
|
||||
stepread [locate_data_file bug33028_kalip.stp] s *
|
||||
|
||||
set nbsBefore "
|
||||
Number of shapes in shape
|
||||
VERTEX : 543
|
||||
EDGE : 819
|
||||
WIRE : 359
|
||||
FACE : 289
|
||||
SHELL : 2
|
||||
SOLID : 2
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 2015
|
||||
"
|
||||
checknbshapes s_1 -ref ${nbsBefore} -t -m "result before attempt to simplify the model"
|
||||
|
||||
unifysamedom result s_1
|
||||
|
||||
set nbsAfter "
|
||||
Number of shapes in shape
|
||||
VERTEX : 515
|
||||
EDGE : 805
|
||||
WIRE : 359
|
||||
FACE : 289
|
||||
SHELL : 2
|
||||
SOLID : 2
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 1973
|
||||
"
|
||||
checknbshapes result -ref ${nbsAfter} -t -m "result after attempt to simplify the model"
|
11
tests/bugs/mesh/bug32692_1
Normal file
11
tests/bugs/mesh/bug32692_1
Normal file
@@ -0,0 +1,11 @@
|
||||
puts "========="
|
||||
puts "OCC32692: Crash when the input shape has some invalid topology"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
puts "REQUIRED ALL: Meshing statuses: SelfIntersectingWire Failure"
|
||||
|
||||
restore [locate_data_file bug32692.brep] s
|
||||
incmesh s 0.01 -parallel
|
||||
|
||||
checktrinfo s -nod 7511 -tri 7625 -empty 9 -face 309
|
11
tests/bugs/mesh/bug32692_2
Normal file
11
tests/bugs/mesh/bug32692_2
Normal file
@@ -0,0 +1,11 @@
|
||||
puts "========="
|
||||
puts "OCC32692: Crash when the input shape has some invalid topology"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
puts "REQUIRED ALL: Meshing statuses: Reused"
|
||||
|
||||
restore [locate_data_file bug32692_broken_mesh.brep] s
|
||||
incmesh s 0.01 -parallel
|
||||
|
||||
checktrinfo s -nod 3 -tri 1 -face 1
|
14
tests/bugs/mesh/bug32692_3
Normal file
14
tests/bugs/mesh/bug32692_3
Normal file
@@ -0,0 +1,14 @@
|
||||
puts "========="
|
||||
puts "OCC32692: Crash when the input shape has some invalid topology"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
puts "REQUIRED ALL: Meshing statuses: OpenWire Failure Outdated"
|
||||
|
||||
pload MODELING
|
||||
cylinder c 0 0 0 10
|
||||
mkface f c
|
||||
|
||||
incmesh f 0.01 -parallel
|
||||
|
||||
checktrinfo f -nod 0 -tri 0 -face 1
|
9
tests/bugs/mesh/bug32767
Normal file
9
tests/bugs/mesh/bug32767
Normal file
@@ -0,0 +1,9 @@
|
||||
puts "================"
|
||||
puts "0032767: Mesh - incorrect splitting of edges of seams leading to hang \[since OCCT 7.4.0\] "
|
||||
puts "================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32767.brep] s
|
||||
tclean s
|
||||
incmesh s 0.01
|
||||
checktrinfo s -tri 3220 -nod 1770 -defl 0.018398669654253779 -tol_abs_defl 1e-6
|
17
tests/bugs/mesh/bug33060
Normal file
17
tests/bugs/mesh/bug33060
Normal file
@@ -0,0 +1,17 @@
|
||||
puts "========"
|
||||
puts "0033060: Mesh - Sub-precisional links provoke f a i l u r e on face"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug33060.brep] result
|
||||
|
||||
tclean result
|
||||
|
||||
checkview -display result -3d -path ${imagedir}/${test_image}.png
|
||||
|
||||
set log [tricheck result]
|
||||
if { [llength $log] != 0 } {
|
||||
puts "Error : Invalid mesh"
|
||||
} else {
|
||||
puts "Mesh is OK"
|
||||
}
|
@@ -13,7 +13,7 @@ set info [extrema r3 r4]
|
||||
|
||||
if {[regexp "ext_1" $info]} {
|
||||
set dist [lindex [length ext_1] end]
|
||||
if { $dist > 4.0e-13 } {
|
||||
if { $dist > 5.0e-11 } {
|
||||
puts "Error: Extrema distance is too big"
|
||||
}
|
||||
} else {
|
||||
|
@@ -10,8 +10,11 @@ bsplinecurve r1 2 5 1 3 2 1 3 1 4 1 5 3 2 5 3 1 3 7 3 1 4 8 3 1 4 8 3 1 5 9 3 1
|
||||
bsplinecurve r2 2 5 2 3 2.5 1 3 1 3.5 1 4 3 -1 2 3 1 1 11 3 1 3 9 3 1 3 9 3 1 3 9 3 1 5 7 3 1 7 4 3 1
|
||||
set info [extrema r1 r2]
|
||||
|
||||
if { [llength $info] != 1 } {
|
||||
puts "Error : Extrema is wrong"
|
||||
if {[regexp "ext_1" $info]} {
|
||||
set dist [lindex [length ext_1] end]
|
||||
if { $dist > 1.0e-8 } {
|
||||
puts "Error: Extrema distance is too big"
|
||||
}
|
||||
} else {
|
||||
puts "OK: Extrema is valid"
|
||||
puts "Error: Extrema is not found"
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ puts ""
|
||||
#################################################
|
||||
# BrepExrtrema_DistShapeShape bad performance on OCCT 6.7.0
|
||||
#################################################
|
||||
cpulimit 100
|
||||
cpulimit 500
|
||||
restore [locate_data_file bug27665_wircmpd.brep] w
|
||||
explode w
|
||||
|
||||
|
@@ -3,8 +3,6 @@ puts "0029807: Impossible to cut cone from prism"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
puts "TODO OCC29922 ALL: Error: Degenerated edge is not found"
|
||||
|
||||
restore [locate_data_file bug29807-obj.brep] b1
|
||||
restore [locate_data_file bug29807-tool.brep] b2
|
||||
|
||||
|
@@ -3,9 +3,6 @@ puts "0029807: Impossible to cut cone from prism"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
puts "TODO OCC29860 ALL: Error : is WRONG because number of WIRE entities in shape \"result\" is 10"
|
||||
puts "TODO OCC29860 ALL: Error : is WRONG because number of FACE entities in shape \"result\" is 10"
|
||||
|
||||
restore [locate_data_file bug29807-obj.brep] b1
|
||||
restore [locate_data_file bug29807-tool.brep] b2
|
||||
|
||||
|
26
tests/bugs/modalg_7/bug32066
Normal file
26
tests/bugs/modalg_7/bug32066
Normal file
@@ -0,0 +1,26 @@
|
||||
puts "======================================================="
|
||||
puts "0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation"
|
||||
puts "======================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32066_solid.brep] s
|
||||
|
||||
restore [locate_data_file bug32066_hole_2547.brep] h1
|
||||
restore [locate_data_file bug32066_hole_2562.brep] h2
|
||||
restore [locate_data_file bug32066_hole_2563.brep] h3
|
||||
restore [locate_data_file bug32066_hole_2564.brep] h4
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
baddobjects s
|
||||
baddtools h1 h2 h3 h4
|
||||
bfillds
|
||||
|
||||
bbop r 2
|
||||
|
||||
checkshape r
|
||||
|
||||
checknbshapes r -wire 73 -face 65 -shell 1 -solid 1 -t
|
||||
checkprops r -s 3.45489e+07 -v 1.54742e+08
|
||||
|
||||
checkview -display r -2d -path ${imagedir}/${test_image}.png
|
9
tests/bugs/modalg_7/bug32744
Normal file
9
tests/bugs/modalg_7/bug32744
Normal file
@@ -0,0 +1,9 @@
|
||||
puts "================================================="
|
||||
puts "0032744: Modeling Algorithms -Endless loop in GCPnts_UniformDeflection"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
pload QAcommands
|
||||
# test execution time must be within the cpulimit
|
||||
restore [locate_data_file bug32744.brep] s
|
||||
OCC32744 s
|
25
tests/bugs/modalg_7/bug32874_1
Normal file
25
tests/bugs/modalg_7/bug32874_1
Normal file
@@ -0,0 +1,25 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set distExpected 10
|
||||
circle c1 0 0 0 100
|
||||
circle c2 0 0 0 100+$distExpected
|
||||
|
||||
set nbSteps 72
|
||||
for {set i 1} {$i < $nbSteps} {incr i} {
|
||||
trim cc1 c1 0 2.*pi/$nbSteps*$i
|
||||
trim cc2 c2 0 2.*pi/$nbSteps*$i
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
29
tests/bugs/modalg_7/bug32874_2
Normal file
29
tests/bugs/modalg_7/bug32874_2
Normal file
@@ -0,0 +1,29 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set distExpected 3.5
|
||||
circle c1 0 0 0 100
|
||||
circle c2 0 0 0 100+$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
30
tests/bugs/modalg_7/bug32874_3
Normal file
30
tests/bugs/modalg_7/bug32874_3
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set radius 0.001
|
||||
set distExpected 0.00001
|
||||
circle c1 0 0 0 $radius
|
||||
circle c2 0 0 0 $radius+$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
30
tests/bugs/modalg_7/bug32874_4
Normal file
30
tests/bugs/modalg_7/bug32874_4
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set radius 0.001
|
||||
set distExpected 1000.0
|
||||
circle c1 0 0 0 $radius
|
||||
circle c2 0 0 0 $radius+$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
30
tests/bugs/modalg_7/bug32874_5
Normal file
30
tests/bugs/modalg_7/bug32874_5
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "================================================="
|
||||
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
set radius 1000.0
|
||||
set distExpected 1.e-5
|
||||
circle c1 0 0 0 $radius
|
||||
circle c2 0 0 0 $radius-$distExpected
|
||||
|
||||
set start {0.0 0.5*pi pi 1.5*pi 2.0*pi}
|
||||
set delta {pi/4.0 pi/3.0 pi/2.0 0.55*pi 0.99*pi pi 1.1*pi}
|
||||
|
||||
foreach f $start {
|
||||
foreach d $delta {
|
||||
trim cc1 c1 $f $f+$d
|
||||
trim cc2 c2 $f $f+$d
|
||||
|
||||
set extr [extrema cc1 cc2]
|
||||
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
|
||||
if {[expr abs($dist - $distExpected)] < 1.e-7} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "Error: wrong distance $dist instead of $distExpected expected"
|
||||
}
|
||||
} else {
|
||||
puts "Error: non-parallel curves"
|
||||
}
|
||||
}
|
||||
}
|
35
tests/bugs/modalg_8/bug32721
Normal file
35
tests/bugs/modalg_8/bug32721
Normal file
@@ -0,0 +1,35 @@
|
||||
puts "======================================================"
|
||||
puts "OCC32721: BOP wrong results on a cone and an extrusion"
|
||||
puts "======================================================"
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32721.brep] prism
|
||||
pcone cone 6 0 10
|
||||
|
||||
bop cone prism
|
||||
bopfuse r1
|
||||
bopcommon r2
|
||||
bopcut r3
|
||||
boptuc r4
|
||||
|
||||
checkshape r1
|
||||
checknbshapes r1 -t -vertex 8 -edge 17 -wire 8 -face 8 -shell 1 -solid 1
|
||||
checkshape r2
|
||||
checknbshapes r2 -t -vertex 3 -edge 7 -wire 4 -face 4 -shell 1 -solid 1
|
||||
checkshape r3
|
||||
checknbshapes r3 -t -vertex 4 -edge 10 -wire 4 -face 4 -shell 1 -solid 1
|
||||
checkshape r4
|
||||
checknbshapes r4 -t -vertex 7 -edge 14 -wire 8 -face 8 -shell 2 -solid 2
|
||||
|
||||
set tolres [checkmaxtol r1]
|
||||
|
||||
if { ${tolres} > 0.0002} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops r1 -s 388.634 -v 406.357
|
||||
checkprops r2 -s 57.8605 -v 22.8116
|
||||
checkprops r3 -s 358.735 -v 354.179
|
||||
checkprops r4 -s 87.7592 -v 29.3659
|
||||
|
||||
checkview -display r1 -2d -path ${imagedir}/${test_image}.png
|
21
tests/bugs/modalg_8/bug32864
Normal file
21
tests/bugs/modalg_8/bug32864
Normal file
@@ -0,0 +1,21 @@
|
||||
puts "========================================================================="
|
||||
puts "OCC32864: Normal projection of a wire on a cylinder produces wrong result"
|
||||
puts "========================================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32864.brep] a
|
||||
explode a
|
||||
|
||||
nproject result a_2 a_1
|
||||
|
||||
checkshape result
|
||||
|
||||
checknbshapes result -t -edge 8 -vertex 16
|
||||
|
||||
set tolres [checkmaxtol result]
|
||||
|
||||
if { ${tolres} > 0.0001} {
|
||||
puts "Error: bad tolerance of result"
|
||||
}
|
||||
|
||||
checkprops result -l 37.1616
|
18
tests/bugs/modalg_8/bug32915
Normal file
18
tests/bugs/modalg_8/bug32915
Normal file
@@ -0,0 +1,18 @@
|
||||
puts "================================================="
|
||||
puts "0032915: Geom2dAPI_InterCurveCurve, The algorithm lost an intersection point."
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
restore [locate_data_file bug32915.brep] e
|
||||
mkcurve c3d e
|
||||
plane p 0 0 1
|
||||
project c2d c3d p
|
||||
|
||||
set inter [2dintersect c2d]
|
||||
if {[regexp -all "Intersection point" $inter] != 29} {
|
||||
puts "Error: Wrong number of self-intersections (expected 29 points)."
|
||||
}
|
||||
|
||||
v2d
|
||||
2dfit
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
44
tests/bugs/modalg_8/bug32929
Normal file
44
tests/bugs/modalg_8/bug32929
Normal file
@@ -0,0 +1,44 @@
|
||||
puts "============"
|
||||
puts "OCC32929: Modeling Algorithms - Crash in PerformIntersectionAtEnd after deletion of surfdata (fillet)"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
# Load & prepare data.
|
||||
restore [locate_data_file bug32929.brep] b
|
||||
explode b E
|
||||
|
||||
# Make screenshot before filleting.
|
||||
smallview
|
||||
donly b b_8
|
||||
fit
|
||||
xwd $imagedir/${test_image}_1.png
|
||||
|
||||
# Make fillet.
|
||||
blend result b 1 b_8
|
||||
|
||||
# Make screenshot after filleting.
|
||||
donly result
|
||||
fit
|
||||
xwd $imagedir/${test_image}_2.png
|
||||
|
||||
# Check mass.
|
||||
checkprops result -s 13435.4
|
||||
|
||||
# Check validity of result.
|
||||
checkshape result
|
||||
|
||||
# Check content.
|
||||
set nbshapes_expected "
|
||||
Number of shapes in shape
|
||||
VERTEX : 25
|
||||
EDGE : 40
|
||||
WIRE : 17
|
||||
FACE : 17
|
||||
SHELL : 1
|
||||
SOLID : 1
|
||||
COMPSOLID : 0
|
||||
COMPOUND : 1
|
||||
SHAPE : 102
|
||||
"
|
||||
|
||||
checknbshapes result -ref ${nbshapes_expected} -t -m "Result of ChFi3d_ChBuilder algorithm"
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user