mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
# cosmetics
This commit is contained in:
@@ -80,18 +80,6 @@ namespace
|
|||||||
for (int NoU = 1; NoU <= theNbSamples; NoU++, U += PasU)
|
for (int NoU = 1; NoU <= theNbSamples; NoU++, U += PasU)
|
||||||
theParams->SetValue (NoU, U);
|
theParams->SetValue (NoU, U);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : fillSqDist
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
//static void fillSqDist (Extrema_POnSurfParams& theParams,
|
|
||||||
// const gp_Pnt& thePoint)
|
|
||||||
//{
|
|
||||||
// if (theParams.GetSqrDistance() < -0.5)
|
|
||||||
// theParams.SetSqrDistance (theParams.Value().SquareDistance (thePoint));
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -252,7 +240,7 @@ void Extrema_GenExtPS::Perform (const gp_Pnt& thePoint,
|
|||||||
const Standard_Real theVMax)
|
const Standard_Real theVMax)
|
||||||
{
|
{
|
||||||
myIsDone = Standard_False;
|
myIsDone = Standard_False;
|
||||||
myPoint = BVH_Vec3d (thePoint.X(), thePoint.Y(), thePoint.Z());
|
myPoint = thePoint;
|
||||||
myF.SetPoint (thePoint, myTarget);
|
myF.SetPoint (thePoint, myTarget);
|
||||||
mySolutions.clear();
|
mySolutions.clear();
|
||||||
|
|
||||||
@@ -282,6 +270,8 @@ void Extrema_GenExtPS::Perform (const gp_Pnt& thePoint,
|
|||||||
{
|
{
|
||||||
for (int iV = 0; iV <= myNbVSamples + 1; ++iV)
|
for (int iV = 0; iV <= myNbVSamples + 1; ++iV)
|
||||||
{
|
{
|
||||||
|
myPoints->ChangeValue (iU, iV).SetSqrDistance (-1.);
|
||||||
|
|
||||||
if (iU <= myNbUSamples && iV <= myNbVSamples)
|
if (iU <= myNbUSamples && iV <= myNbVSamples)
|
||||||
myFacePntParams->ChangeValue (iU, iV).SetSqrDistance (-1.);
|
myFacePntParams->ChangeValue (iU, iV).SetSqrDistance (-1.);
|
||||||
|
|
||||||
@@ -295,21 +285,6 @@ void Extrema_GenExtPS::Perform (const gp_Pnt& thePoint,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myTarget == Extrema_ExtFlag_MAX || myTarget == Extrema_ExtFlag_MINMAX)
|
|
||||||
{
|
|
||||||
for (int iV = 0; iV <= myNbVSamples + 1; ++iV)
|
|
||||||
{
|
|
||||||
myPoints->ChangeValue (0, iV).SetSqrDistance (-0.1);
|
|
||||||
myPoints->ChangeValue (myNbUSamples + 1, iV).SetSqrDistance (-0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int iU = 1; iU <= myNbUSamples; ++iU)
|
|
||||||
{
|
|
||||||
myPoints->ChangeValue (iU, 0).SetSqrDistance (-0.1);
|
|
||||||
myPoints->ChangeValue (iU, myNbVSamples + 1).SetSqrDistance (-0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myTarget == Extrema_ExtFlag_MIN || myTarget == Extrema_ExtFlag_MINMAX)
|
if (myTarget == Extrema_ExtFlag_MIN || myTarget == Extrema_ExtFlag_MINMAX)
|
||||||
{
|
{
|
||||||
// Fill boundary with RealLast square distance.
|
// Fill boundary with RealLast square distance.
|
||||||
@@ -328,6 +303,15 @@ void Extrema_GenExtPS::Perform (const gp_Pnt& thePoint,
|
|||||||
|
|
||||||
if (myTarget == Extrema_ExtFlag_MINMAX)
|
if (myTarget == Extrema_ExtFlag_MINMAX)
|
||||||
{
|
{
|
||||||
|
for (int iU = 1; iU <= myNbUSamples; ++iU)
|
||||||
|
{
|
||||||
|
for (int iV = 1; iV <= myNbVSamples; ++iV)
|
||||||
|
{
|
||||||
|
Extrema_POnSurfParams& aParam = myPoints->ChangeValue (iU, iV);
|
||||||
|
aParam.SetSqrDistance (aParam.Value().SquareDistance (thePoint));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Perform standard solution search (no tree)
|
// Perform standard solution search (no tree)
|
||||||
for (Standard_Integer iTarget = 0; iTarget < 2; ++iTarget)
|
for (Standard_Integer iTarget = 0; iTarget < 2; ++iTarget)
|
||||||
{
|
{
|
||||||
@@ -384,8 +368,6 @@ void Extrema_GenExtPS::BuildGrid()
|
|||||||
}
|
}
|
||||||
|
|
||||||
myPoints = new Extrema_HArray2OfPOnSurfParams (0, myNbUSamples + 1, 0, myNbVSamples + 1);
|
myPoints = new Extrema_HArray2OfPOnSurfParams (0, myNbUSamples + 1, 0, myNbVSamples + 1);
|
||||||
gp_Pnt aPoint (myPoint.x(), myPoint.y(), myPoint.z());
|
|
||||||
|
|
||||||
for (int iU = 1; iU <= myNbUSamples; iU++)
|
for (int iU = 1; iU <= myNbUSamples; iU++)
|
||||||
: myumin(0.0),
|
: myumin(0.0),
|
||||||
myusup(0.0),
|
myusup(0.0),
|
||||||
@@ -405,7 +387,6 @@ void Extrema_GenExtPS::BuildGrid()
|
|||||||
Extrema_POnSurfParams aParam (U, V, aP);
|
Extrema_POnSurfParams aParam (U, V, aP);
|
||||||
aParam.SetElementType (Extrema_Node);
|
aParam.SetElementType (Extrema_Node);
|
||||||
aParam.SetIndices (iU, iV);
|
aParam.SetIndices (iU, iV);
|
||||||
aParam.SetSqrDistance (aP.SquareDistance (aPoint));
|
|
||||||
myPoints->SetValue (iU, iV, aParam);
|
myPoints->SetValue (iU, iV, aParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,7 +413,7 @@ void Extrema_GenExtPS::BuildTree()
|
|||||||
// Builder for low-level BVH sets
|
// Builder for low-level BVH sets
|
||||||
opencascade::handle<BVH_LinearBuilder<Standard_Real, 3> > aLBuilder = new BVH_LinearBuilder<Standard_Real, 3>();
|
opencascade::handle<BVH_LinearBuilder<Standard_Real, 3> > aLBuilder = new BVH_LinearBuilder<Standard_Real, 3>();
|
||||||
|
|
||||||
myBVHBoxSet = new BVH_IndexedBoxSet<Standard_Real, 3, Extrema_GenExtPS_LocalizedSurf> (
|
myBVHBoxSet = new BVH_IndexedBoxSet<Standard_Real, 3, Extrema_GenExtPS_LocalizedGrid> (
|
||||||
new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle));
|
new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle));
|
||||||
|
|
||||||
// create hierarchy of BVH trees
|
// create hierarchy of BVH trees
|
||||||
@@ -462,24 +443,8 @@ void Extrema_GenExtPS::BuildTree()
|
|||||||
aGridSet->Add (Extrema_GenExtPS_GridCell (iU, iV), BVH_Box<Standard_Real, 3>());
|
aGridSet->Add (Extrema_GenExtPS_GridCell (iU, iV), BVH_Box<Standard_Real, 3>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
myBVHBoxSet->Add (Extrema_GenExtPS_LocalizedGrid (U1, U2, V1, V2, aGridSet), BVH_Box<Standard_Real, 3>());
|
||||||
V1 = V2 + 1;
|
V1 = V2 + 1;
|
||||||
|
|
||||||
Extrema_GenExtPS_GridCell aMinCell = aGridSet->Element (0);
|
|
||||||
Extrema_GenExtPS_GridCell aMaxCell = aGridSet->Element (aGridSet->Size() - 1);
|
|
||||||
|
|
||||||
Standard_Integer aUCoeff = (aMaxCell.UIndex < myNbUSamples) ? 1 : 0;
|
|
||||||
Standard_Integer aVCoeff = (aMaxCell.VIndex < myNbVSamples) ? 1 : 0;
|
|
||||||
|
|
||||||
const Extrema_POnSurf& aPMin = myPoints->Value (aMinCell.UIndex, aMinCell.VIndex);
|
|
||||||
const Extrema_POnSurf& aPMax = myPoints->Value (aMaxCell.UIndex + aUCoeff, aMaxCell.VIndex + aVCoeff);
|
|
||||||
|
|
||||||
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
|
||||||
aPMin.Parameter (aUMin, aVMin);
|
|
||||||
aPMax.Parameter (aUMax, aVMax);
|
|
||||||
|
|
||||||
myBVHBoxSet->Add (
|
|
||||||
Extrema_GenExtPS_LocalizedSurf (aUMin, aUMax, aVMin, aVMax, aGridSet),
|
|
||||||
BVH_Box<Standard_Real, 3>());
|
|
||||||
}
|
}
|
||||||
U1 = U2 + 1;
|
U1 = U2 + 1;
|
||||||
V1 = 1;
|
V1 = 1;
|
||||||
@@ -492,7 +457,7 @@ void Extrema_GenExtPS::BuildTree()
|
|||||||
const Standard_Integer aNbSets = myBVHBoxSet->Size();
|
const Standard_Integer aNbSets = myBVHBoxSet->Size();
|
||||||
for (Standard_Integer iSet = 0; iSet < aNbSets; ++iSet)
|
for (Standard_Integer iSet = 0; iSet < aNbSets; ++iSet)
|
||||||
{
|
{
|
||||||
Extrema_GenExtPS_LocalizedSurf aGridSet = myBVHBoxSet->Element (iSet);
|
Extrema_GenExtPS_LocalizedGrid aGridSet = myBVHBoxSet->Element (iSet);
|
||||||
|
|
||||||
// Box of the set
|
// Box of the set
|
||||||
Bnd_Box aSetBox;
|
Bnd_Box aSetBox;
|
||||||
@@ -638,8 +603,8 @@ Standard_Boolean Extrema_GenExtPS::RejectNode (const BVH_Vec3d& theCMin,
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
theDistance = (myTarget == Extrema_ExtFlag_MIN) ?
|
theDistance = (myTarget == Extrema_ExtFlag_MIN) ?
|
||||||
BVH_Tools<Standard_Real, 3>::PointBoxSquareDistance (myPoint, theCMin, theCMax) :
|
BVH_Tools<Standard_Real, 3>::PointBoxSquareDistance (BVH_Vec3d (myPoint.X(), myPoint.Y(), myPoint.Z()), theCMin, theCMax) :
|
||||||
BVH_Tools<Standard_Real, 3>::PointBoxMaxSquareDistance (myPoint, theCMin, theCMax);
|
BVH_Tools<Standard_Real, 3>::PointBoxMaxSquareDistance (BVH_Vec3d (myPoint.X(), myPoint.Y(), myPoint.Z()), theCMin, theCMax);
|
||||||
|
|
||||||
return RejectMetric (theDistance);
|
return RejectMetric (theDistance);
|
||||||
}
|
}
|
||||||
@@ -688,11 +653,33 @@ Standard_Boolean Extrema_GenExtPS::Accept (const Standard_Integer theIndex,
|
|||||||
{
|
{
|
||||||
if (myBVHSet == NULL)
|
if (myBVHSet == NULL)
|
||||||
{
|
{
|
||||||
Extrema_GenExtPS_LocalizedSurf aGridSet = myBVHBoxSet->Element (theIndex);
|
Extrema_GenExtPS_LocalizedGrid aGridSet = myBVHBoxSet->Element (theIndex);
|
||||||
if ((aGridSet.UMax < myLocUMin || aGridSet.UMin > myLocUMax) &&
|
|
||||||
(aGridSet.VMax < myLocVMin || aGridSet.VMin > myLocVMax))
|
Standard_Integer aUCoeff = (aGridSet.IdUMax < myNbUSamples) ? 1 : 0;
|
||||||
|
Standard_Integer aVCoeff = (aGridSet.IdVMax < myNbVSamples) ? 1 : 0;
|
||||||
|
|
||||||
|
const Extrema_POnSurf& aPMin = myPoints->Value (aGridSet.IdUMin, aGridSet.IdVMin);
|
||||||
|
const Extrema_POnSurf& aPMax = myPoints->Value (aGridSet.IdUMax + aUCoeff, aGridSet.IdVMax + aVCoeff);
|
||||||
|
|
||||||
|
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
||||||
|
aPMin.Parameter (aUMin, aVMin);
|
||||||
|
aPMax.Parameter (aUMax, aVMax);
|
||||||
|
|
||||||
|
if ((aUMax < myLocUMin || aUMin > myLocUMax) &&
|
||||||
|
(aVMax < myLocVMin || aVMin > myLocVMax))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Standard_Integer idUMin = Max (1, aGridSet.IdUMin - 1), idUMax = Min (myNbUSamples, aGridSet.IdUMax + 1);
|
||||||
|
Standard_Integer idVMin = Max (1, aGridSet.IdVMin - 1), idVMax = Min (myNbVSamples, aGridSet.IdVMax + 1);
|
||||||
|
for (Standard_Integer iU = idUMin; iU <= idUMax; ++iU)
|
||||||
|
{
|
||||||
|
for (Standard_Integer iV = idVMin; iV <= idVMax; ++iV)
|
||||||
|
{
|
||||||
|
Extrema_POnSurfParams& aParam = myPoints->ChangeValue (iU, iV);
|
||||||
|
aParam.SetSqrDistance (aParam.Value().SquareDistance (myPoint));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
aGridSet.CellBoxSet->Build();
|
aGridSet.CellBoxSet->Build();
|
||||||
// Set low-level BVH set for inner selection
|
// Set low-level BVH set for inner selection
|
||||||
SetBVHSet (aGridSet.CellBoxSet.get());
|
SetBVHSet (aGridSet.CellBoxSet.get());
|
||||||
@@ -717,8 +704,8 @@ Standard_Boolean Extrema_GenExtPS::FindSolution (const Standard_Integer theNU,
|
|||||||
const Extrema_ExtFlag theTarget)
|
const Extrema_ExtFlag theTarget)
|
||||||
{
|
{
|
||||||
// Fill corner points with square distance to myPoint
|
// Fill corner points with square distance to myPoint
|
||||||
Extrema_POnSurfParams& aParam00 = myPoints->ChangeValue (theNU, theNV);
|
const Extrema_POnSurfParams& aParam00 = myPoints->Value (theNU, theNV);
|
||||||
Extrema_POnSurfParams& aParam11 = myPoints->ChangeValue (theNU + 1, theNV + 1);
|
const Extrema_POnSurfParams& aParam11 = myPoints->Value (theNU + 1, theNV + 1);
|
||||||
|
|
||||||
{
|
{
|
||||||
Standard_Real U1, U2, V1, V2;
|
Standard_Real U1, U2, V1, V2;
|
||||||
@@ -729,15 +716,13 @@ Standard_Boolean Extrema_GenExtPS::FindSolution (const Standard_Integer theNU,
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
gp_Pnt aPoint (myPoint.x(), myPoint.y(), myPoint.z());
|
|
||||||
|
|
||||||
Standard_Boolean isFound = Standard_False;
|
Standard_Boolean isFound = Standard_False;
|
||||||
if (theTarget == Extrema_ExtFlag_MIN &&
|
if (theTarget == Extrema_ExtFlag_MIN &&
|
||||||
theNU != myNbUSamples && theNV != myNbVSamples)
|
theNU != myNbUSamples && theNV != myNbVSamples)
|
||||||
{
|
{
|
||||||
// Find minimum
|
// Find minimum
|
||||||
|
|
||||||
const Extrema_POnSurfParams& aParam = ComputeFaceParameters (theNU, theNV, aPoint);
|
const Extrema_POnSurfParams& aParam = ComputeFaceParameters (theNU, theNV);
|
||||||
|
|
||||||
Standard_Boolean isMin = Standard_False;
|
Standard_Boolean isMin = Standard_False;
|
||||||
Extrema_ElementType anElemType = aParam.GetElementType();
|
Extrema_ElementType anElemType = aParam.GetElementType();
|
||||||
@@ -773,7 +758,7 @@ Standard_Boolean Extrema_GenExtPS::FindSolution (const Standard_Integer theNU,
|
|||||||
(anElemType == Extrema_Node && (iU == 1 || iU == myNbUSamples)))
|
(anElemType == Extrema_Node && (iU == 1 || iU == myNbUSamples)))
|
||||||
{
|
{
|
||||||
// Check the down face.
|
// Check the down face.
|
||||||
const Extrema_POnSurfParams &aDownParam = ComputeFaceParameters (theNU, theNV - 1, aPoint);
|
const Extrema_POnSurfParams &aDownParam = ComputeFaceParameters (theNU, theNV - 1);
|
||||||
|
|
||||||
if (aDownParam.GetElementType() == anElemType)
|
if (aDownParam.GetElementType() == anElemType)
|
||||||
{
|
{
|
||||||
@@ -786,7 +771,7 @@ Standard_Boolean Extrema_GenExtPS::FindSolution (const Standard_Integer theNU,
|
|||||||
(anElemType == Extrema_Node && (iV == 1 || iV == myNbVSamples)))
|
(anElemType == Extrema_Node && (iV == 1 || iV == myNbVSamples)))
|
||||||
{
|
{
|
||||||
// Check the right face.
|
// Check the right face.
|
||||||
const Extrema_POnSurfParams &aRightParam = ComputeFaceParameters (theNU - 1, theNV, aPoint);
|
const Extrema_POnSurfParams &aRightParam = ComputeFaceParameters (theNU - 1, theNV);
|
||||||
|
|
||||||
if (aRightParam.GetElementType() == anElemType)
|
if (aRightParam.GetElementType() == anElemType)
|
||||||
{
|
{
|
||||||
@@ -802,9 +787,9 @@ Standard_Boolean Extrema_GenExtPS::FindSolution (const Standard_Integer theNU,
|
|||||||
isMin = Standard_True;
|
isMin = Standard_True;
|
||||||
|
|
||||||
const Extrema_POnSurfParams *anOtherParam[3] = {
|
const Extrema_POnSurfParams *anOtherParam[3] = {
|
||||||
&ComputeFaceParameters (theNU, theNV - 1, aPoint), // Down
|
&ComputeFaceParameters (theNU, theNV - 1), // Down
|
||||||
&ComputeFaceParameters (theNU - 1, theNV - 1, aPoint), // Lower-left
|
&ComputeFaceParameters (theNU - 1, theNV - 1), // Lower-left
|
||||||
&ComputeFaceParameters (theNU - 1, theNV, aPoint) }; // Left
|
&ComputeFaceParameters (theNU - 1, theNV) }; // Left
|
||||||
|
|
||||||
for (int i = 0; i < 3 && isMin; i++)
|
for (int i = 0; i < 3 && isMin; i++)
|
||||||
{
|
{
|
||||||
@@ -833,26 +818,14 @@ Standard_Boolean Extrema_GenExtPS::FindSolution (const Standard_Integer theNU,
|
|||||||
if (theTarget == Extrema_ExtFlag_MAX)
|
if (theTarget == Extrema_ExtFlag_MAX)
|
||||||
{
|
{
|
||||||
// Find maximum
|
// Find maximum
|
||||||
Extrema_POnSurfParams &aParam1 = myPoints->ChangeValue (theNU - 1, theNV - 1);
|
const Extrema_POnSurfParams &aParam1 = myPoints->Value (theNU - 1, theNV - 1);
|
||||||
Extrema_POnSurfParams &aParam2 = myPoints->ChangeValue (theNU - 1, theNV);
|
const Extrema_POnSurfParams &aParam2 = myPoints->Value (theNU - 1, theNV);
|
||||||
Extrema_POnSurfParams &aParam3 = myPoints->ChangeValue (theNU - 1, theNV + 1);
|
const Extrema_POnSurfParams &aParam3 = myPoints->Value (theNU - 1, theNV + 1);
|
||||||
Extrema_POnSurfParams &aParam4 = myPoints->ChangeValue (theNU, theNV - 1);
|
const Extrema_POnSurfParams &aParam4 = myPoints->Value (theNU, theNV - 1);
|
||||||
Extrema_POnSurfParams &aParam5 = myPoints->ChangeValue (theNU, theNV + 1);
|
const Extrema_POnSurfParams &aParam5 = myPoints->Value (theNU, theNV + 1);
|
||||||
Extrema_POnSurfParams &aParam6 = myPoints->ChangeValue (theNU + 1, theNV - 1);
|
const Extrema_POnSurfParams &aParam6 = myPoints->Value (theNU + 1, theNV - 1);
|
||||||
Extrema_POnSurfParams &aParam7 = myPoints->ChangeValue (theNU + 1, theNV);
|
const Extrema_POnSurfParams &aParam7 = myPoints->Value (theNU + 1, theNV);
|
||||||
Extrema_POnSurfParams &aParam8 = myPoints->ChangeValue (theNU + 1, theNV + 1);
|
const Extrema_POnSurfParams &aParam8 = myPoints->Value (theNU + 1, theNV + 1);
|
||||||
|
|
||||||
//if (myTarget != Extrema_ExtFlag_MINMAX)
|
|
||||||
//{
|
|
||||||
// fillSqDist (aParam1, aPoint);
|
|
||||||
// fillSqDist (aParam2, aPoint);
|
|
||||||
// fillSqDist (aParam3, aPoint);
|
|
||||||
// fillSqDist (aParam4, aPoint);
|
|
||||||
// fillSqDist (aParam5, aPoint);
|
|
||||||
// fillSqDist (aParam6, aPoint);
|
|
||||||
// fillSqDist (aParam7, aPoint);
|
|
||||||
// fillSqDist (aParam8, aPoint);
|
|
||||||
//}
|
|
||||||
|
|
||||||
Standard_Real aDist = aParam00.GetSqrDistance();
|
Standard_Real aDist = aParam00.GetSqrDistance();
|
||||||
|
|
||||||
@@ -920,9 +893,8 @@ Standard_Boolean Extrema_GenExtPS::FindSolution (const Extrema_POnSurfParams &th
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
const Extrema_POnSurfParams& Extrema_GenExtPS::
|
const Extrema_POnSurfParams& Extrema_GenExtPS::
|
||||||
ComputeEdgeParameters (const Standard_Boolean IsUEdge,
|
ComputeEdgeParameters (const Standard_Boolean IsUEdge,
|
||||||
Extrema_POnSurfParams &theParam0,
|
const Extrema_POnSurfParams& theParam0,
|
||||||
Extrema_POnSurfParams &theParam1,
|
const Extrema_POnSurfParams& theParam1,
|
||||||
const gp_Pnt &thePoint,
|
|
||||||
const Standard_Real theDiffTol)
|
const Standard_Real theDiffTol)
|
||||||
{
|
{
|
||||||
const Handle (Extrema_HArray2OfPOnSurfParams)& anEdgeParamsArr = IsUEdge ? myUEdgePntParams : myVEdgePntParams;
|
const Handle (Extrema_HArray2OfPOnSurfParams)& anEdgeParamsArr = IsUEdge ? myUEdgePntParams : myVEdgePntParams;
|
||||||
@@ -931,9 +903,6 @@ const Extrema_POnSurfParams& Extrema_GenExtPS::
|
|||||||
Extrema_POnSurfParams& anEdgeParams = anEdgeParamsArr->ChangeValue (iU, iV);
|
Extrema_POnSurfParams& anEdgeParams = anEdgeParamsArr->ChangeValue (iU, iV);
|
||||||
if (anEdgeParams.GetSqrDistance() < 0.0)
|
if (anEdgeParams.GetSqrDistance() < 0.0)
|
||||||
{
|
{
|
||||||
//fillSqDist (theParam0, thePoint);
|
|
||||||
//fillSqDist (theParam1, thePoint);
|
|
||||||
|
|
||||||
const Standard_Real aSqrDist01 =
|
const Standard_Real aSqrDist01 =
|
||||||
theParam0.Value().SquareDistance (theParam1.Value());
|
theParam0.Value().SquareDistance (theParam1.Value());
|
||||||
|
|
||||||
@@ -964,7 +933,7 @@ const Extrema_POnSurfParams& Extrema_GenExtPS::
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The shortest distance is inside the edge.
|
// The shortest distance is inside the edge.
|
||||||
gp_XYZ aPoP (thePoint.XYZ().Subtracted (theParam0.Value().XYZ()));
|
gp_XYZ aPoP (myPoint.XYZ().Subtracted (theParam0.Value().XYZ()));
|
||||||
gp_XYZ aPoP1 (theParam1.Value().XYZ().Subtracted (theParam0.Value().XYZ()));
|
gp_XYZ aPoP1 (theParam1.Value().XYZ().Subtracted (theParam0.Value().XYZ()));
|
||||||
Standard_Real aRatio = aPoP.Dot (aPoP1) / aSqrDist01;
|
Standard_Real aRatio = aPoP.Dot (aPoP1) / aSqrDist01;
|
||||||
Standard_Real aU[2];
|
Standard_Real aU[2];
|
||||||
@@ -987,7 +956,7 @@ const Extrema_POnSurfParams& Extrema_GenExtPS::
|
|||||||
|
|
||||||
anEdgeParams.SetParameters (aUPar, aVPar, myS->Value (aUPar, aVPar));
|
anEdgeParams.SetParameters (aUPar, aVPar, myS->Value (aUPar, aVPar));
|
||||||
anEdgeParams.SetElementType (IsUEdge ? Extrema_UIsoEdge : Extrema_VIsoEdge);
|
anEdgeParams.SetElementType (IsUEdge ? Extrema_UIsoEdge : Extrema_VIsoEdge);
|
||||||
anEdgeParams.SetSqrDistance (thePoint.SquareDistance (anEdgeParams.Value()));
|
anEdgeParams.SetSqrDistance (anEdgeParams.Value().SquareDistance (myPoint));
|
||||||
anEdgeParams.SetIndices (iU, iV);
|
anEdgeParams.SetIndices (iU, iV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1002,8 +971,7 @@ const Extrema_POnSurfParams& Extrema_GenExtPS::
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
const Extrema_POnSurfParams& Extrema_GenExtPS::
|
const Extrema_POnSurfParams& Extrema_GenExtPS::
|
||||||
ComputeFaceParameters (const Standard_Integer theU,
|
ComputeFaceParameters (const Standard_Integer theU,
|
||||||
const Standard_Integer theV,
|
const Standard_Integer theV)
|
||||||
const gp_Pnt& thePoint)
|
|
||||||
{
|
{
|
||||||
Extrema_POnSurfParams& aFaceParams = myFacePntParams->ChangeValue (theU, theV);
|
Extrema_POnSurfParams& aFaceParams = myFacePntParams->ChangeValue (theU, theV);
|
||||||
if (aFaceParams.GetSqrDistance() < 0.0)
|
if (aFaceParams.GetSqrDistance() < 0.0)
|
||||||
@@ -1012,28 +980,20 @@ const Extrema_POnSurfParams& Extrema_GenExtPS::
|
|||||||
// No need to set it too small.
|
// No need to set it too small.
|
||||||
const Standard_Real aDiffTol = myTolU + myTolV;
|
const Standard_Real aDiffTol = myTolU + myTolV;
|
||||||
|
|
||||||
Extrema_POnSurfParams& aParam00 = myPoints->ChangeValue (theU, theV);
|
const Extrema_POnSurfParams& aParam00 = myPoints->Value (theU, theV);
|
||||||
Extrema_POnSurfParams& aParam01 = myPoints->ChangeValue (theU, theV + 1);
|
const Extrema_POnSurfParams& aParam01 = myPoints->Value (theU, theV + 1);
|
||||||
Extrema_POnSurfParams& aParam10 = myPoints->ChangeValue (theU + 1, theV);
|
const Extrema_POnSurfParams& aParam10 = myPoints->Value (theU + 1, theV);
|
||||||
Extrema_POnSurfParams& aParam11 = myPoints->ChangeValue (theU + 1, theV + 1);
|
const Extrema_POnSurfParams& aParam11 = myPoints->Value (theU + 1, theV + 1);
|
||||||
|
|
||||||
//if (myTarget != Extrema_ExtFlag_MINMAX)
|
|
||||||
//{
|
|
||||||
// fillSqDist (aParam00, thePoint);
|
|
||||||
// fillSqDist (aParam01, thePoint);
|
|
||||||
// fillSqDist (aParam10, thePoint);
|
|
||||||
// fillSqDist (aParam11, thePoint);
|
|
||||||
//}
|
|
||||||
|
|
||||||
const Extrema_POnSurfParams &aUE0 =
|
const Extrema_POnSurfParams &aUE0 =
|
||||||
ComputeEdgeParameters (Standard_True, aParam00, aParam10, thePoint, aDiffTol);
|
ComputeEdgeParameters (Standard_True, aParam00, aParam10, aDiffTol);
|
||||||
const Extrema_POnSurfParams &aUE1 =
|
const Extrema_POnSurfParams &aUE1 =
|
||||||
ComputeEdgeParameters (Standard_True, aParam01, aParam11, thePoint, aDiffTol);
|
ComputeEdgeParameters (Standard_True, aParam01, aParam11, aDiffTol);
|
||||||
|
|
||||||
const Extrema_POnSurfParams &aVE0 =
|
const Extrema_POnSurfParams &aVE0 =
|
||||||
ComputeEdgeParameters (Standard_False, aParam00, aParam01, thePoint, aDiffTol);
|
ComputeEdgeParameters (Standard_False, aParam00, aParam01, aDiffTol);
|
||||||
const Extrema_POnSurfParams &aVE1 =
|
const Extrema_POnSurfParams &aVE1 =
|
||||||
ComputeEdgeParameters (Standard_False, aParam10, aParam11, thePoint, aDiffTol);
|
ComputeEdgeParameters (Standard_False, aParam10, aParam11, aDiffTol);
|
||||||
|
|
||||||
Standard_Real aSqrDist01 = aUE0.Value().SquareDistance (aUE1.Value());
|
Standard_Real aSqrDist01 = aUE0.Value().SquareDistance (aUE1.Value());
|
||||||
Standard_Real aDiffDist = Abs (aUE0.GetSqrDistance() - aUE1.GetSqrDistance());
|
Standard_Real aDiffDist = Abs (aUE0.GetSqrDistance() - aUE1.GetSqrDistance());
|
||||||
@@ -1087,7 +1047,7 @@ const Extrema_POnSurfParams& Extrema_GenExtPS::
|
|||||||
|
|
||||||
aFaceParams.SetParameters (aUPar, aVPar, myS->Value (aUPar, aVPar));
|
aFaceParams.SetParameters (aUPar, aVPar, myS->Value (aUPar, aVPar));
|
||||||
aFaceParams.SetElementType (Extrema_Face);
|
aFaceParams.SetElementType (Extrema_Face);
|
||||||
aFaceParams.SetSqrDistance (thePoint.SquareDistance (aFaceParams.Value()));
|
aFaceParams.SetSqrDistance (aFaceParams.Value().SquareDistance (myPoint));
|
||||||
aFaceParams.SetIndices (theU, theV);
|
aFaceParams.SetIndices (theU, theV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -267,15 +267,13 @@ protected: //! @name Protected methods performing the job
|
|||||||
//! Compute new edge parameters.
|
//! Compute new edge parameters.
|
||||||
Standard_EXPORT const Extrema_POnSurfParams&
|
Standard_EXPORT const Extrema_POnSurfParams&
|
||||||
ComputeFaceParameters (const Standard_Integer theU,
|
ComputeFaceParameters (const Standard_Integer theU,
|
||||||
const Standard_Integer theV,
|
const Standard_Integer theV);
|
||||||
const gp_Pnt& thePoint);
|
|
||||||
|
|
||||||
//! Compute new edge parameters.
|
//! Compute new edge parameters.
|
||||||
Standard_EXPORT const Extrema_POnSurfParams&
|
Standard_EXPORT const Extrema_POnSurfParams&
|
||||||
ComputeEdgeParameters (const Standard_Boolean IsUEdge,
|
ComputeEdgeParameters (const Standard_Boolean IsUEdge,
|
||||||
Extrema_POnSurfParams& theParam0,
|
const Extrema_POnSurfParams& theParam0,
|
||||||
Extrema_POnSurfParams& theParam1,
|
const Extrema_POnSurfParams& theParam1,
|
||||||
const gp_Pnt& thePoint,
|
|
||||||
const Standard_Real theDiffTol);
|
const Standard_Real theDiffTol);
|
||||||
|
|
||||||
//! Looks for the Min or Max Solution (depending on the given target).
|
//! Looks for the Min or Max Solution (depending on the given target).
|
||||||
@@ -346,31 +344,33 @@ protected: //! @name Auxiliary types
|
|||||||
|
|
||||||
//! Localized parametric space of surface on which the single
|
//! Localized parametric space of surface on which the single
|
||||||
//! BVH tree is built
|
//! BVH tree is built
|
||||||
struct Extrema_GenExtPS_LocalizedSurf
|
struct Extrema_GenExtPS_LocalizedGrid
|
||||||
{
|
{
|
||||||
Standard_Real UMin;
|
Standard_Integer IdUMin;
|
||||||
Standard_Real UMax;
|
Standard_Integer IdUMax;
|
||||||
Standard_Real VMin;
|
Standard_Integer IdVMin;
|
||||||
Standard_Real VMax;
|
Standard_Integer IdVMax;
|
||||||
Handle(Extrema_GenExtPS_GridCellBoxSet) CellBoxSet;
|
Handle(Extrema_GenExtPS_GridCellBoxSet) CellBoxSet;
|
||||||
|
|
||||||
Extrema_GenExtPS_LocalizedSurf ()
|
Extrema_GenExtPS_LocalizedGrid ()
|
||||||
: UMin (0.0), UMax (0.0), VMin (0.0), VMax (0.0), CellBoxSet (NULL)
|
: IdUMin (0), IdUMax (0), IdVMin (0), IdVMax (0), CellBoxSet (NULL)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Extrema_GenExtPS_LocalizedSurf (const Standard_Real theUMin,
|
Extrema_GenExtPS_LocalizedGrid (const Standard_Integer theUMin,
|
||||||
const Standard_Real theUMax,
|
const Standard_Integer theUMax,
|
||||||
const Standard_Real theVMin,
|
const Standard_Integer theVMin,
|
||||||
const Standard_Real theVMax,
|
const Standard_Integer theVMax,
|
||||||
const Handle(Extrema_GenExtPS_GridCellBoxSet)& theCellBoxSet)
|
const Handle(Extrema_GenExtPS_GridCellBoxSet)& theCellBoxSet)
|
||||||
: UMin (theUMin), UMax (theUMax), VMin (theVMin), VMax (theVMax), CellBoxSet (theCellBoxSet)
|
: IdUMin (theUMin), IdUMax (theUMax),
|
||||||
|
IdVMin (theVMin), IdVMax (theVMax),
|
||||||
|
CellBoxSet (theCellBoxSet)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected: //! @name Fields
|
protected: //! @name Fields
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
NCollection_Vec3<Standard_Real> myPoint; //!< Point
|
gp_Pnt myPoint; //!< Point
|
||||||
Adaptor3d_SurfacePtr myS; //!< Surface
|
Adaptor3d_SurfacePtr myS; //!< Surface
|
||||||
Extrema_FuncPSNorm myF; //!< Function
|
Extrema_FuncPSNorm myF; //!< Function
|
||||||
|
|
||||||
@@ -404,7 +404,7 @@ protected: //! @name Fields
|
|||||||
|
|
||||||
Standard_Real mySqDistance; //!< Min/Max found square distance used in BVH tree traverse
|
Standard_Real mySqDistance; //!< Min/Max found square distance used in BVH tree traverse
|
||||||
opencascade::handle
|
opencascade::handle
|
||||||
<BVH_IndexedBoxSet<Standard_Real, 3, Extrema_GenExtPS_LocalizedSurf> > myBVHBoxSet; //!< High-level BVH of BVH organized grid cells
|
<BVH_IndexedBoxSet<Standard_Real, 3, Extrema_GenExtPS_LocalizedGrid> > myBVHBoxSet; //!< High-level BVH of BVH organized grid cells
|
||||||
|
|
||||||
// Results
|
// Results
|
||||||
std::vector <Extrema_GenExtPS_ExtPSResult> mySolutions; //!< Found solutions (sorted first by distance to target point,
|
std::vector <Extrema_GenExtPS_ExtPSResult> mySolutions; //!< Found solutions (sorted first by distance to target point,
|
||||||
|
Reference in New Issue
Block a user