mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
967da23643 |
@@ -309,6 +309,74 @@ Handle(Geom_Surface) BRepOffset::CollapseSingularities (const Handle(Geom_Surfac
|
||||
}
|
||||
}
|
||||
|
||||
if (aPoles.RowLength() > 2 && aPoles.ColLength() > 2)
|
||||
{
|
||||
// Check if the adjacent sides of the surfaces are collapsed, i.e. if normal is
|
||||
// is impossible to compute in the 'corners'
|
||||
// If such corner is found, move the pole outside a bit, to make the 'corner' more obvious
|
||||
|
||||
// We are dealing with four points:
|
||||
// (UMin, VMin), (UMin, VMax), (UMax, VMin), (UMax, VMax)
|
||||
// or (1, 1), (1, NbVPoles), (NbUPoles, 1), (NbUPoles, NbUPoles)
|
||||
|
||||
Handle(Geom_Surface)& aSurf = aCopy.IsNull() ? aBSpline : aCopy;
|
||||
|
||||
Standard_Real anU[2], aV[2];
|
||||
aBSpline->Bounds (anU[0], anU[1], aV[0], aV[1]);
|
||||
|
||||
Standard_Integer aCornerPoleUIndex[2] = { aPoles.LowerRow(), aPoles.UpperRow() };
|
||||
Standard_Integer aCornerPoleVIndex[2] = { aPoles.LowerCol(), aPoles.UpperCol() };
|
||||
|
||||
Standard_Integer aPoleInsideUIndex[2] = { aCornerPoleUIndex[0] + 1, aCornerPoleUIndex[1] - 1 };
|
||||
Standard_Integer aPoleInsideVIndex[2] = { aCornerPoleVIndex[0] + 1, aCornerPoleVIndex[1] - 1 };
|
||||
|
||||
for (int iU = 0; iU < 2; ++iU)
|
||||
{
|
||||
for (int iV = 0; iV < 2; ++iV)
|
||||
{
|
||||
gp_Pnt aP;
|
||||
gp_Vec aDU, aDV;
|
||||
aSurf->D1 (anU[iU], aV[iV], aP, aDU, aDV);
|
||||
|
||||
gp_Vec aSNorm = aDU ^ aDV;
|
||||
if (aSNorm.SquareMagnitude() < thePrecision * thePrecision)
|
||||
{
|
||||
if (aCopy.IsNull())
|
||||
{
|
||||
aCopy = Handle (Geom_BSplineSurface)::DownCast (theSurface->Copy());
|
||||
aSurf = aCopy;
|
||||
}
|
||||
|
||||
// Move the pole outside surface
|
||||
|
||||
// Get the nearest pole inside
|
||||
gp_Pnt aPInside = aPoles.Value (aPoleInsideUIndex[iU], aPoleInsideVIndex[iV]);
|
||||
gp_Vec aVecOutside (aPInside, aP);
|
||||
|
||||
aDU.Rotate (gp_Ax1 (aP, aDU ^ aVecOutside), M_PI_2);
|
||||
aDV.Rotate (gp_Ax1 (aP, aDV ^ aVecOutside), M_PI_2);
|
||||
|
||||
aVecOutside = (aDU + aDV).Normalized();
|
||||
|
||||
int k = 1;
|
||||
while (aSNorm.SquareMagnitude() < thePrecision * thePrecision && k <= 1024)
|
||||
{
|
||||
k *= 2;
|
||||
aP.Translate (k * Precision::Confusion() * aVecOutside);
|
||||
aCopy->SetPole (aCornerPoleUIndex[iU], aCornerPoleVIndex[iV], aP);
|
||||
|
||||
aCopy->D1 (anU[iU], aV[iV], aP, aDU, aDV);
|
||||
gp_Vec aN1 = aDU ^ aDV;
|
||||
|
||||
//if (aN1 * aSNorm < 0.0)
|
||||
// break;
|
||||
aSNorm = aN1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! aCopy.IsNull())
|
||||
return aCopy;
|
||||
}
|
||||
|
@@ -78,13 +78,11 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& A2 = thePINod.ChangeValue(TD->Node2)->Indices();
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& A3 = thePINod.ChangeValue(TD->Node3)->Indices();
|
||||
|
||||
bool notFound = true;
|
||||
{
|
||||
n1 = TD->Node1;
|
||||
n2 = TD->Node2;
|
||||
newSeg = Standard_False;
|
||||
if (A1.NdSg == 0 && A2.NdSg == 0) {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
A1.NdSg = myNbPISeg;
|
||||
@@ -109,7 +107,6 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
}
|
||||
}
|
||||
if (find == 0) {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
|
||||
@@ -118,7 +115,6 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
else aSegIndices->Conex2 = i;
|
||||
}
|
||||
else {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
A1.NdSg = myNbPISeg;
|
||||
@@ -149,13 +145,11 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
}
|
||||
}
|
||||
|
||||
if (notFound)
|
||||
{
|
||||
n1 = TD->Node2;
|
||||
n2 = TD->Node3;
|
||||
newSeg = Standard_False;
|
||||
if (A2.NdSg == 0 && A3.NdSg == 0) {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
A2.NdSg = myNbPISeg;
|
||||
@@ -180,7 +174,6 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
}
|
||||
}
|
||||
if (find == 0) {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
|
||||
@@ -189,7 +182,6 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
else aSegIndices->Conex2 = i;
|
||||
}
|
||||
else {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
A2.NdSg = myNbPISeg;
|
||||
@@ -220,13 +212,11 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
}
|
||||
}
|
||||
|
||||
if (notFound)
|
||||
{
|
||||
n1 = TD->Node3;
|
||||
n2 = TD->Node1;
|
||||
newSeg = Standard_False;
|
||||
if (A3.NdSg == 0 && A1.NdSg == 0) {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
A3.NdSg = myNbPISeg;
|
||||
@@ -251,7 +241,6 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
}
|
||||
}
|
||||
if (find == 0) {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
if (icsv == 1) aSegIndices->NxtSg1 = myNbPISeg;
|
||||
@@ -260,7 +249,6 @@ void HLRAlgo_PolyInternalData::UpdateLinks (HLRAlgo_Array1OfTData& theTData,
|
||||
else aSegIndices->Conex2 = i;
|
||||
}
|
||||
else {
|
||||
notFound = false;
|
||||
newSeg = Standard_True;
|
||||
myNbPISeg++;
|
||||
A3.NdSg = myNbPISeg;
|
||||
|
Reference in New Issue
Block a user