1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

Compare commits

...

15 Commits

Author SHA1 Message Date
jfa
f73afb8591 0033828: Modeling Algorithms, GCPnts_QuasiUniformDeflection returns very different results under small change in deflection 2024-09-23 13:54:08 +01:00
akaftasev
b20ae1d3f5 0033515: Modeling Algorithm - BRepExtrema_DistShapeShape poduces wrong result
Changed redundant square operation
2023-11-06 14:54:33 +00:00
anv
a6120daa43 0033407: Shape Healing - Exception on fixshape call
Added proper processing of singularities for a surface of revolution on a line.
2023-06-22 03:36:59 +01:00
mzernova
166845748b Minor improvement to manipulator aspect (SIE01-4) 2023-04-21 14:41:51 +01:00
ifv
add0ad5770 0032882: Modeling Data - Extrema curve/curve cannot find all solutions (OCCT 7.5 backport)
Extrema/Extrema_GenExtCC.gxx - estimation of Lipchitz constant is improved
Extrema_GlobOptFuncCC.cxx - function value is changed

LocOpe/LocOpe_WiresOnShape.cxx - small correction to fix regression

lowalgos/extcc/bug32882 - new test case is added

some test were updated according new behavior of extrema algo
2023-01-24 17:03:54 +03:00
mzernova
0c07e09857 SENR-22-107 "Visualization - Isoparametric lines rendered out of a face" 2022-12-07 10:14:52 +00:00
mzernova
ebfeb74383 Implemented new methods to adjust the Manipulator presentation.
Also the sizes of the different elements from the manipulator now accessible.
Added SetMouse method. This makes the manipulator to move to the mouse.
Added methods to change the selection sensitivity.
2022-11-29 12:58:25 +03:00
ifv
316d3693a4 0033179: Modeling Algorithms - Crash in in ShapeFix_Shape with the attached object, when healing for fixing SameParameterFlag
BSplCLib_2.cxx - method MergeBSplineKnots is modified in order to have always not empty result.
Geom2dConvert.cxx - in static function MultNumandDenom tolerance for comparing knots is decreased.
2022-11-18 10:13:16 +03:00
oan
ea5f35f4e5 0033060: [Regression to 7.4.0] Mesh - Sub-precisional links provoke failure on face
Slightly increase exact resolution so to cover links with approximate length equal to resolution itself on sub-resolution differences.
2022-07-08 23:45:24 +03:00
emv
d2c640053d 0032644: Modeling Algorithms - Empty result of section operation
Use distance criteria additionally to parameter criteria when verifying the extrema solution to belong to the edge boundary.
Refactor the BRepExtrema_DistanceSS class to remove the excessive methods with mirrored parameters.
2021-10-29 09:46:40 +03:00
oan
dd79df67d7 0032471: Mesh - Deflection of the triangulation is not recomputed for planar face
Remove Poly_TriangulationParameters and API related to Poly_Triangulation in order to keep binary compatibility of dynamic libraries.
2021-10-13 12:33:35 +03:00
ifv
5c331e6954 0032607: Modeling Algorithms - BOPAlgo_BOP returns incomplete result
IntPatch/IntPatch_ImpPrmIntersection.cxx - decreasing step for some conditions
2021-10-12 08:55:04 +03:00
gka
4d1bf2f6fd #32471 Mesh - Deflection of the triangulation is not recomputed for planar face
Correction fix for CR32741 to provide binary compatibility with Products 750
2021-10-11 12:50:19 +03:00
ifv
219a259720 0032569: Modeling Algorithm - Section not found
IntPatch/IntPatch_WLineTool.cxx - adding control of maximal ratio of distances between 3 sequential points.
2021-09-20 15:44:32 +03:00
oan
eebe21ba81 0032471: Mesh - Deflection of the triangulation is not recomputed for planar face
Method EstimateDeflection has been added to BRepLib in order to check and update value of deflection provided by Poly_Triangulation;
Introduction of Poly_TriangulationParameters intended to keep info about initial parameters of mesh stored by Poly_Triangulation;
BRepMesh stores user-specified parameters to Poly_Triangulation via Poly_TriangulationParameters;
Prefer initial parameters of mesh generator stored in Poly_Triangulation during check of mesh consistency.
2021-07-29 13:31:20 +03:00
68 changed files with 1523 additions and 1127 deletions

View File

@@ -84,8 +84,10 @@ namespace
//! Main constructor.
ManipSensCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
const gp_Circ& theCircle,
const Standard_Real theU1,
const Standard_Real theU2,
const Standard_Integer theNbPnts)
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False, theNbPnts),
: Select3D_SensitiveCircle (theOwnerId, theCircle, theU1, theU2, Standard_False, theNbPnts),
ManipSensRotation (theCircle.Position().Direction()) {}
//! Checks whether the circle overlaps current selecting volume
@@ -153,15 +155,20 @@ void AIS_Manipulator::init()
aDraggerMaterial.SetAmbientColor (Quantity_NOC_BLACK);
aDraggerMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
aDraggerMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aDraggerMaterial.SetMaterialType(Graphic3d_MATERIAL_ASPECT);
aDraggerMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
myDraggerHighlight = new Prs3d_ShadingAspect();
myDraggerHighlight->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
myDraggerHighlight->SetMaterial(aDraggerMaterial);
myDraggerHighlight->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
myDraggerHighlight->SetMaterial (aDraggerMaterial);
myDraggerHighlight->SetTransparency(0.5);
myDraggerHighlight->SetTransparency (0.5);
SetSize (100);
myTranslatorSensitivity = 15;
myRotatorSensitivity = 15;
myScalerSensitivity = 15;
myDraggerSensitivity = 10;
setSize (100.0f);
SetZLayer (Graphic3d_ZLayerId_Topmost);
}
@@ -228,7 +235,8 @@ AIS_Manipulator::AIS_Manipulator()
myHasStartedTransformation (Standard_False),
myStartPosition (gp::XOY()),
myStartPick (0.0, 0.0, 0.0),
myPrevState (0.0)
myPrevState (0.0),
myIndent (0.2f)
{
SetInfiniteState();
SetMutable (Standard_True);
@@ -249,7 +257,8 @@ AIS_Manipulator::AIS_Manipulator (const gp_Ax2& thePosition)
myHasStartedTransformation (Standard_False),
myStartPosition (gp::XOY()),
myStartPick (0.0, 0.0, 0.0),
myPrevState (0.0)
myPrevState (0.0),
myIndent (0.2f)
{
SetInfiniteState();
SetMutable (Standard_True);
@@ -299,6 +308,99 @@ void AIS_Manipulator::SetPart (const AIS_ManipulatorMode theMode, const Standard
}
}
//=======================================================================
//function : SetArcAngle
//purpose :
//=======================================================================
void AIS_Manipulator::SetArcAngle (const Standard_ShortReal theStartAngle,
const Standard_ShortReal theFinishAngle)
{
myAxes[0].SetArcAngle (-theFinishAngle, -theStartAngle);
myAxes[1].SetArcAngle (theStartAngle, theFinishAngle);
myAxes[2].SetArcAngle (theStartAngle, theFinishAngle);
SetToUpdate();
}
//=======================================================================
//function : SetAxisRadius
//purpose :
//=======================================================================
void AIS_Manipulator::SetAxisRadius (const Standard_ShortReal theValue)
{
myAxisRadius = theValue;
SetToUpdate();
}
//=======================================================================
//function : SetDiskThickness
//purpose :
//=======================================================================
void AIS_Manipulator::SetDiskThickness (const Standard_ShortReal theDiskThickness)
{
myDiskThickness = theDiskThickness;
SetToUpdate();
}
//=======================================================================
//function : SetInnerRadius
//purpose :
//=======================================================================
void AIS_Manipulator::SetInnerRadius (const Standard_ShortReal theInnerRadius)
{
myInnerRadius = theInnerRadius;
SetToUpdate();
}
//=======================================================================
//function : SetArrowLengthFactor
//purpose :
//=======================================================================
void AIS_Manipulator::SetArrowLengthFactor (const Standard_ShortReal theArrowLengthFactor)
{
myLength = theArrowLengthFactor;
SetToUpdate();
}
//=======================================================================
//function : SetArrowHeadLength
//purpose :
//=======================================================================
void AIS_Manipulator::SetArrowHeadLength (const Standard_ShortReal theArrowHeadLength)
{
myArrowHeadLength = theArrowHeadLength;
SetToUpdate();
}
//=======================================================================
//function : SetArrowHeadRadius
//purpose :
//=======================================================================
void AIS_Manipulator::SetArrowHeadRadius (const Standard_ShortReal theArrowHeadRadius)
{
myArrowHeadRadius = theArrowHeadRadius;
SetToUpdate();
}
//=======================================================================
//function : SetDragPlaneSize
//purpose :
//=======================================================================
void AIS_Manipulator::SetDragPlaneSize(const Standard_ShortReal theDragPlaneSize)
{
myDragPlaneSize = theDragPlaneSize;
SetToUpdate();
}
//=======================================================================
//function : SetBoxSize
//purpose :
//=======================================================================
void AIS_Manipulator::SetBoxSize (const Standard_ShortReal theBoxSize)
{
myBoxSize = theBoxSize;
SetToUpdate();
}
//=======================================================================
//function : EnableMode
//purpose :
@@ -350,7 +452,7 @@ void AIS_Manipulator::adjustSize (const Bnd_Box& theBox)
Standard_Real aYSize = aYmax - aYmin;
Standard_Real aZSize = aZmax - aZmin;
SetSize ((Standard_ShortReal) (Max (aXSize, Max (aYSize, aZSize)) * 0.5));
setSize ((Standard_ShortReal) (Max (aXSize, Max (aYSize, aZSize)) * 0.5));
}
//=======================================================================
@@ -639,6 +741,51 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
return Standard_False;
}
//=======================================================================
//function : SetMouse
//purpose :
//=======================================================================
void AIS_Manipulator::SetMouse (const Standard_Integer theX, const Standard_Integer theY, const Handle(V3d_View)& theView)
{
if (!IsAttached())
{
return;
}
Graphic3d_Vec3d anInputPoint, aProj;
theView->ConvertWithProj (theX, theY, anInputPoint.x(), anInputPoint.y(), anInputPoint.z(), aProj.x(), aProj.y(), aProj.z());
const gp_Lin anInputLine(gp_Pnt(anInputPoint.x(), anInputPoint.y(), anInputPoint.z()), gp_Dir(aProj.x(), aProj.y(), aProj.z()));
gp_Pnt aStartPnt(anInputPoint.x(), anInputPoint.y(), anInputPoint.z());
Standard_Real aD1 = anInputLine.Distance (myPosition.Location());
Standard_Real aD2 = myPosition.Location().Distance (aStartPnt);
Standard_Real aDist = Sqrt (aD2 * aD2 - aD1* aD1);
gp_Pnt aResPnt = aStartPnt.XYZ() + anInputLine.Direction().XYZ() * aDist;
gp_Trsf aTrsf;
aTrsf.SetTranslation (myPosition.Location(), aResPnt);
myStartTrsfs.Clear();
Handle(AIS_ManipulatorObjectSequence) anObjects = Objects();
for (AIS_ManipulatorObjectSequence::Iterator anObjIter(*anObjects); anObjIter.More(); anObjIter.Next())
{
myStartTrsfs.Append (anObjIter.Value()->LocalTransformation());
}
myStartPosition = myPosition;
myHasStartedTransformation = true;
Transform (aTrsf);
gp_Pnt aPos = myStartPosition.Location().Transformed (aTrsf);
gp_Dir aVDir = myStartPosition.Direction().Transformed (aTrsf);
gp_Dir aXDir = myStartPosition.XDirection().Transformed (aTrsf);
SetPosition (gp_Ax2(aPos, aVDir, aXDir));
StopTransform();
}
//=======================================================================
//function : ProcessDragging
//purpose :
@@ -839,15 +986,30 @@ void AIS_Manipulator::updateTransformation()
}
//=======================================================================
//function : SetSize
//function : setSize
//purpose :
//=======================================================================
void AIS_Manipulator::SetSize (const Standard_ShortReal theSideLength)
void AIS_Manipulator::setSize (const Standard_ShortReal theSideLength)
{
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
if (myIndent > theSideLength * 0.1f)
{
myAxes[anIt].SetSize (theSideLength);
myLength = theSideLength * 0.7f;
myBoxSize = theSideLength * 0.15f;
myDiskThickness = theSideLength * 0.05f;
myIndent = theSideLength * 0.05f;
}
else // use pre-set value of predent
{
Standard_ShortReal aLength = theSideLength - 2 * myIndent;
myLength = aLength * 0.8f;
myBoxSize = aLength * 0.15f;
myDiskThickness = aLength * 0.05f;
}
myInnerRadius = myIndent * 2 + myBoxSize + myLength;
myDragPlaneSize = myInnerRadius * 0.5f;
myAxisRadius = myBoxSize / 4.0f;
myArrowHeadLength = myLength * 0.25f;
myArrowHeadRadius = myAxisRadius * 1.5f,
SetToUpdate();
}
@@ -858,11 +1020,7 @@ void AIS_Manipulator::SetSize (const Standard_ShortReal theSideLength)
//=======================================================================
void AIS_Manipulator::SetGap (const Standard_ShortReal theValue)
{
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{
myAxes[anIt].SetIndent (theValue);
}
myIndent = theValue;
SetToUpdate();
}
@@ -983,7 +1141,7 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
anAspect->SetTransparency (myDrawer->ShadingAspect()->Transparency());
// Display center
myCenter.Init (myAxes[0].AxisRadius() * 2.0f, gp::Origin());
myCenter.Init (myAxisRadius * 1.5f, gp::Origin());
aGroup = thePrs->NewGroup ();
aGroup->SetPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (myCenter.Array());
@@ -996,7 +1154,7 @@ void AIS_Manipulator::Compute (const Handle(PrsMgr_PresentationManager3d)& thePr
Handle(Prs3d_ShadingAspect) anAspectAx = new Prs3d_ShadingAspect (new Graphic3d_AspectFillArea3d(*anAspect->Aspect()));
anAspectAx->SetColor (myAxes[anIt].Color());
aGroup->SetGroupPrimitivesAspect (anAspectAx->Aspect());
myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx);
myAxes[anIt].Compute (thePrsMgr, thePrs, anAspectAx, this);
myAxes[anIt].SetTransformPersistence (TransformPersistence());
}
@@ -1142,7 +1300,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
}
// define sensitivity by line
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
aLine->SetSensitivityFactor (15);
aLine->SetSensitivityFactor (myTranslatorSensitivity);
theSelection->Add (aLine);
// enlarge sensitivity by triangulation
@@ -1166,9 +1324,10 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Rotation, 9);
}
// define sensitivity by circle
const gp_Circ aGeomCircle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, anAxis.FacettesNumber());
aCircle->SetSensitivityFactor (15);
const Standard_ShortReal aSensCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
const gp_Circ aGeomCircle (gp_Ax2(gp::Origin(), anAxis.ReferenceAxis().Direction()), aSensCircleRadius);
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, myAxes[anIt].StartAngle(), myAxes[anIt].EndAngle(), anAxis.FacettesNumber());
aCircle->SetSensitivityFactor (myRotatorSensitivity);
theSelection->Add (aCircle);
// enlarge sensitivity by triangulation
Handle(Select3D_SensitiveTriangulation) aTri = new ManipSensTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
@@ -1190,7 +1349,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
}
// define sensitivity by point
Handle(Select3D_SensitivePoint) aPnt = new Select3D_SensitivePoint (anOwner, myAxes[anIt].ScalerCubePosition());
aPnt->SetSensitivityFactor (15);
aPnt->SetSensitivityFactor (myScalerSensitivity);
theSelection->Add (aPnt);
// enlarge sensitivity by triangulation
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
@@ -1212,21 +1371,20 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
}
// define sensitivity by two crossed lines
gp_Pnt aP1, aP2;
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
gp_Pnt aP1 = myAxes[((anIt + 1) % 3)].Position().Direction().XYZ() * myDragPlaneSize;
gp_Pnt aP2 = myAxes[((anIt + 2) % 3)].Position().Direction().XYZ() * myDragPlaneSize;
const gp_Pnt aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
aLine1->SetSensitivityFactor(10);
theSelection->Add(aLine1);
aLine1->SetSensitivityFactor (myDraggerSensitivity);
theSelection->Add (aLine1);
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
aLine2->SetSensitivityFactor(10);
theSelection->Add(aLine2);
aLine2->SetSensitivityFactor (myDraggerSensitivity);
theSelection->Add (aLine2);
// enlarge sensitivity by triangulation
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
theSelection->Add(aTri);
theSelection->Add (aTri);
}
}
}
@@ -1239,15 +1397,14 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
void AIS_Manipulator::Disk::Init (const Standard_ShortReal theInnerRadius,
const Standard_ShortReal theOuterRadius,
const gp_Ax1& thePosition,
const Standard_ShortReal theStartAngle,
const Standard_ShortReal theEndAngle,
const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb)
{
myPosition = thePosition;
myInnerRad = theInnerRadius;
myOuterRad = theOuterRadius;
Prs3d_ToolDisk aTool (theInnerRadius, theOuterRadius, theSlicesNb, theStacksNb);
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
aTool.SetAngleRange (theStartAngle, theEndAngle);
gp_Ax3 aSystem (thePosition.Location(), thePosition.Direction());
gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3());
myArray = aTool.CreateTriangulation (aTrsf);
@@ -1351,18 +1508,39 @@ void AIS_Manipulator::Cube::addTriangle (const Standard_Integer theIndex,
//function : Init
//purpose :
//=======================================================================
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theRadius,
void AIS_Manipulator::Sector::Init (const Standard_ShortReal theSize,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection,
const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb)
const gp_Dir& theXDirection)
{
Prs3d_ToolSector aTool(theRadius, theSlicesNb, theStacksNb);
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
gp_Ax3 aSystem (thePosition.Location(), thePosition.Direction(), theXDirection);
gp_Trsf aTrsf;
aTrsf.SetTransformation(aSystem, gp_Ax3());
myArray = aTool.CreateTriangulation (aTrsf);
myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
aTrsf.SetTransformation (aSystem, gp_Ax3());
myArray = new Graphic3d_ArrayOfTriangles(4, 6, Graphic3d_ArrayFlags_VertexNormal);
myTriangulation = new Poly_Triangulation(4, 2, Standard_False);
TColgp_Array1OfPnt& aNodes = myTriangulation->ChangeNodes();
Poly_Array1OfTriangle& aTriangles = myTriangulation->ChangeTriangles();
gp_Dir aNormal = gp_Dir(0.0, 0.0, -1.0).Transformed(aTrsf);
gp_Pnt aV1 = gp_Pnt (0.0, 0.0, 0.0).Transformed (aTrsf);
gp_Pnt aV2 = gp_Pnt (0.0, theSize, 0.0).Transformed (aTrsf);
gp_Pnt aV3 = gp_Pnt (theSize, theSize, 0.0).Transformed (aTrsf);
gp_Pnt aV4 = gp_Pnt (theSize, 0.0, 0.0).Transformed (aTrsf);
myArray->AddVertex (aV1, aNormal);
myArray->AddVertex (aV2, aNormal);
myArray->AddVertex (aV3, aNormal);
myArray->AddVertex (aV4, aNormal);
myArray->AddTriangleEdges (3, 1, 2);
myArray->AddTriangleEdges (1, 3, 4);
aNodes.SetValue (1, aV1);
aNodes.SetValue (2, aV2);
aNodes.SetValue (3, aV3);
aNodes.SetValue (4, aV4);
aTriangles.SetValue (1, Poly_Triangle(3, 1, 2));
aTriangles.SetValue (2, Poly_Triangle(1, 3, 4));
}
//=======================================================================
@@ -1377,17 +1555,12 @@ AIS_Manipulator::Axis::Axis (const gp_Ax1& theAxis,
myPosition (theAxis),
myColor (theColor),
myHasTranslation (Standard_True),
myLength (theLength),
myAxisRadius (0.5f),
myHasScaling (Standard_True),
myBoxSize (2.0f),
myHasRotation (Standard_True),
myInnerRadius (myLength + myBoxSize),
myDiskThickness (myBoxSize * 0.5f),
myIndent (0.2f),
myHasDragging(Standard_True),
myFacettesNumber (20),
myCircleRadius (myLength + myBoxSize + myBoxSize * 0.5f * 0.5f)
myStartAngle (0.0f),
myEndAngle (2.0f * Standard_ShortReal(M_PI)),
myHasDragging (Standard_True),
myFacettesNumber (20)
{
//
}
@@ -1397,22 +1570,26 @@ AIS_Manipulator::Axis::Axis (const gp_Ax1& theAxis,
//function : Compute
//purpose :
//=======================================================================
void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect)
const Handle(Prs3d_ShadingAspect)& theAspect,
const Handle(AIS_Manipulator)& theManipulator)
{
const Standard_ShortReal aLenght = theManipulator->ArrowLengthFactor();
const Standard_ShortReal anIndent = theManipulator->Gap();
if (myHasTranslation)
{
const Standard_Real anArrowLength = 0.25 * myLength;
const Standard_Real aCylinderLength = myLength - anArrowLength;
const Standard_ShortReal anArrowHeadLength = theManipulator->ArrowHeadLength();
const Standard_ShortReal anAxisRadius = theManipulator->AxisRadius();
const Standard_Real aCylinderLength = aLenght - anArrowHeadLength + anAxisRadius;
myArrowTipPos = gp_Pnt (0.0, 0.0, 0.0).Translated (myReferenceAxis.Direction().XYZ() * aCylinderLength);
myTriangleArray = Prs3d_Arrow::DrawShaded (gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
myAxisRadius,
myLength,
myAxisRadius * 1.5,
anArrowLength,
anAxisRadius,
aLenght,
theManipulator->ArrowHeadRadius(),
anArrowHeadLength,
myFacettesNumber);
myTranslatorGroup = thePrs->NewGroup();
myTranslatorGroup->SetClosed (true);
@@ -1436,8 +1613,8 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
if (myHasScaling)
{
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
myCubePos = myReferenceAxis.Direction().XYZ() * (aLenght + anIndent);
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), theManipulator->BoxSize());
myScalerGroup = thePrs->NewGroup();
myScalerGroup->SetClosed (true);
@@ -1461,8 +1638,12 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
if (myHasRotation)
{
myCircleRadius = myInnerRadius + myIndent * 2 + myDiskThickness * 0.5f;
myCircle.Init (myInnerRadius + myIndent * 2, myInnerRadius + myDiskThickness + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), myFacettesNumber * 2);
const Standard_ShortReal anInnerRadius = theManipulator->InnerRadius();
myCircle.Init (anInnerRadius + anIndent * 2,
anInnerRadius + theManipulator->DiskThickness() + anIndent * 2,
gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
myStartAngle, myEndAngle,
myFacettesNumber * 2);
myRotatorGroup = thePrs->NewGroup ();
myRotatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myRotatorGroup->AddPrimitiveArray (myCircle.Array());
@@ -1492,7 +1673,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
else
aXDirection = gp::DX();
mySector.Init(myInnerRadius + myIndent * 2, gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), aXDirection, myFacettesNumber * 2);
mySector.Init (theManipulator->DragPlaneSize(), gp_Ax1(gp::Origin(), myReferenceAxis.Direction()), aXDirection);
myDraggerGroup = thePrs->NewGroup();
Handle(Graphic3d_AspectFillArea3d) aFillArea = new Graphic3d_AspectFillArea3d();

View File

@@ -208,6 +208,9 @@ public:
Standard_EXPORT Standard_Boolean ObjectTransformation (const Standard_Integer theX, const Standard_Integer theY,
const Handle(V3d_View)& theView, gp_Trsf& theTrsf);
//! Moves the manipulator and objests to the location of the mouse.
Standard_EXPORT void SetMouse (const Standard_Integer theX, const Standard_Integer theY, const Handle(V3d_View)& theView);
//! Make inactive the current selected manipulator part and reset current axis index and current mode.
//! After its call HasActiveMode() returns false.
//! @sa HasActiveMode()
@@ -278,14 +281,75 @@ public: //! @name Setters for parameters
//! Sets position of the manipulator object.
Standard_EXPORT void SetPosition (const gp_Ax2& thePosition);
Standard_ShortReal Size() const { return myAxes[0].Size(); }
//! Sets size (length of side of the manipulator cubic bounding box.
Standard_EXPORT void SetSize (const Standard_ShortReal theSideLength);
//! Gets gaps between translator, scaler and rotator sub-presentations.
Standard_ShortReal Gap() const { return myIndent; }
//! Sets gaps between translator, scaler and rotator sub-presentations.
Standard_EXPORT void SetGap (const Standard_ShortReal theValue);
//! Sets the angular size of the rotation disk.
Standard_EXPORT void SetArcAngle (const Standard_ShortReal theStartAngle, const Standard_ShortReal theFinishAngle);
//! Gets the thickness of the translation axis.
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
//! Sets the thickness of the translation axis.
Standard_EXPORT void SetAxisRadius (const Standard_ShortReal theValue);
//! Gets thickness of the rotation disk.
Standard_ShortReal DiskThickness() const { return myDiskThickness; }
//! Sets thickness of the rotation disk.
Standard_EXPORT void SetDiskThickness (const Standard_ShortReal theDiskThickness);
//! Gets inner radius of the rotation disk.
Standard_ShortReal InnerRadius() const { return myInnerRadius; }
//! Sets inner radius of the rotation disk.
Standard_EXPORT void SetInnerRadius (const Standard_ShortReal theInnerRadius);
//! Gets length of the translation axis.
Standard_ShortReal ArrowLengthFactor() const { return myLength; }
//! Sets length of the translation axis.
Standard_EXPORT void SetArrowLengthFactor (const Standard_ShortReal theArrowLengthFactor);
//! Gets length of the arrow tip of the translation axis.
Standard_ShortReal ArrowHeadLength() const { return myArrowHeadLength; }
//! Sets length of the arrow tip of the translation axis.
Standard_EXPORT void SetArrowHeadLength (const Standard_ShortReal theArrowHeadLength);
//! Gets radius of the head of the translation arrow axis.
Standard_ShortReal ArrowHeadRadius() const { return myArrowHeadRadius; }
//! Sets radius of the head of the translation arrow axis.
Standard_EXPORT void SetArrowHeadRadius (const Standard_ShortReal theValue);
//! Gets size of drag plane.
Standard_ShortReal DragPlaneSize() const { return myDragPlaneSize; }
//! Sets size of drag plane.
Standard_EXPORT void SetDragPlaneSize (const Standard_ShortReal theDragPlaneSize);
//! Gets size of the scaling box.
Standard_ShortReal BoxSize() const { return myBoxSize; }
//! Sets size of the scaling box.
Standard_EXPORT void SetBoxSize (const Standard_ShortReal theBoxSize);
//! Sets the sensitivity of the translation part.
void SetTranslatorSensitivity (const Standard_Integer theSensitivity) { myTranslatorSensitivity = theSensitivity; }
//! Sets the sensitivity of the rotation part.
void SetRotatorSensitivity (const Standard_Integer theSensitivity) { myRotatorSensitivity = theSensitivity; }
//! Sets the sensitivity of the scale part.
void SetScalerSensitivity (const Standard_Integer theSensitivity) { myScalerSensitivity = theSensitivity; }
//! Sets the sensitivity of the dragging part.
void SetDraggerSensitivity (const Standard_Integer theSensitivity) { myDraggerSensitivity = theSensitivity; }
public:
//! Behavior settings to be applied when performing transformation:
@@ -359,6 +423,8 @@ protected:
Standard_EXPORT void adjustSize (const Bnd_Box& theBox);
Standard_EXPORT void setSize (const Standard_ShortReal theSideLength);
Standard_EXPORT void setTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
//! Redefines local transformation management method to inform user of inproper use.
@@ -398,24 +464,18 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
public:
Disk()
: Quadric(),
myInnerRad(0.0f),
myOuterRad(1.0f)
: Quadric()
{ }
~Disk() { }
void Init (const Standard_ShortReal theInnerRadius,
const Standard_ShortReal theOuterRadius,
const gp_Ax1& thePosition,
const Standard_Integer theSlicesNb = 20,
const Standard_Integer theStacksNb = 20);
protected:
gp_Ax1 myPosition;
Standard_ShortReal myInnerRad;
Standard_ShortReal myOuterRad;
const gp_Ax1& thePosition,
const Standard_ShortReal theStartAngle,
const Standard_ShortReal theEndAngle,
const Standard_Integer theSlicesNb = 20,
const Standard_Integer theStacksNb = 20);
};
class Sphere : public Quadric
@@ -472,11 +532,9 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
~Sector() { }
void Init(const Standard_ShortReal theRadius,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection,
const Standard_Integer theSlicesNb = 5,
const Standard_Integer theStacksNb = 5);
void Init (const Standard_ShortReal theSize,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection);
protected:
@@ -499,7 +557,8 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect);
const Handle(Prs3d_ShadingAspect)& theAspect,
const Handle(AIS_Manipulator)& theManipulator);
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
@@ -567,16 +626,20 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
void SetScaling (const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
void SetDragging(const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; }
void SetDragging (const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; }
void SetArcAngle (const Standard_ShortReal theStartAngle, const Standard_ShortReal theEndAngle)
{
myStartAngle = theStartAngle;
myEndAngle = theEndAngle;
}
Standard_ShortReal StartAngle() const { return myStartAngle; }
Standard_ShortReal EndAngle() const { return myEndAngle; }
Quantity_Color Color() const { return myColor; }
Standard_ShortReal AxisLength() const { return myLength; }
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
void SetAxisRadius (const Standard_ShortReal theValue) { myAxisRadius = theValue; }
const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const { return myHighlightTranslator; }
const Handle(Prs3d_Presentation)& RotatorHighlightPrs() const { return myHighlightRotator; }
@@ -595,32 +658,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; }
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
Standard_ShortReal Size() const { return myLength + myBoxSize + myDiskThickness + myIndent * 2.0f; }
gp_Pnt ScalerCenter (const gp_Pnt& theLocation) const { return theLocation.XYZ() + myPosition.Direction().XYZ() * (myLength + myIndent + myBoxSize * 0.5f); }
void SetSize (const Standard_ShortReal theValue)
{
if (myIndent > theValue * 0.1f)
{
myLength = theValue * 0.7f;
myBoxSize = theValue * 0.15f;
myDiskThickness = theValue * 0.05f;
myIndent = theValue * 0.05f;
}
else // use pre-set value of predent
{
Standard_ShortReal aLength = theValue - 2 * myIndent;
myLength = aLength * 0.8f;
myBoxSize = aLength * 0.15f;
myDiskThickness = aLength * 0.05f;
}
myInnerRadius = myIndent * 2 + myBoxSize + myLength;
myAxisRadius = myBoxSize / 4.0f;
}
Standard_Integer FacettesNumber() const { return myFacettesNumber; }
public:
@@ -628,30 +665,23 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
const Sector& DraggerSector() const { return mySector; }
const Disk& RotatorDisk() const { return myCircle; }
float RotatorDiskRadius() const { return myCircleRadius; }
const Cube& ScalerCube() const { return myCube; }
const gp_Pnt& ScalerCubePosition() const { return myCubePos; }
protected:
gp_Ax1 myReferenceAxis; //!< Returns reference axis assignment.
gp_Ax1 myPosition; //!< Position of the axis including local transformation.
gp_Ax1 myPosition; //!< Position of the axis including local transformation.
Quantity_Color myColor;
Standard_Boolean myHasTranslation;
Standard_ShortReal myLength; //!< Length of translation axis.
Standard_ShortReal myAxisRadius;
Standard_Boolean myHasScaling;
Standard_ShortReal myBoxSize; //!< Size of scaling cube.
Standard_Boolean myHasRotation;
Standard_ShortReal myInnerRadius; //!< Radius of rotation circle.
Standard_ShortReal myDiskThickness;
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
Standard_Boolean myHasDragging;
Standard_ShortReal myStartAngle; //!< Start angle of the arc.
Standard_ShortReal myEndAngle; //!< End angle of the arc.
protected:
Standard_Integer myFacettesNumber;
@@ -659,7 +689,6 @@ protected: //! @name Auxiliary classes to fill presentation with proper primitiv
gp_Pnt myArrowTipPos;
Sector mySector;
Disk myCircle;
float myCircleRadius;
Cube myCube;
gp_Pnt myCubePos;
@@ -683,6 +712,24 @@ protected:
Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator.
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
Standard_ShortReal myLength; //!< Length of translation axis.
Standard_ShortReal myArrowHeadLength; //!< Length of the arrow tip.
Standard_ShortReal myAxisRadius; //!< Radius of axis.
Standard_ShortReal myArrowHeadRadius; //!< Radius of the arrow tip.
Standard_ShortReal myBoxSize; //!< Size of scaling cube.
Standard_ShortReal myInnerRadius; //!< Radius of rotation circle.
Standard_ShortReal myDiskThickness; //!< Thickness of the rotating disc.
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
Standard_ShortReal myDragPlaneSize; //!< Size of the plane to drag.
Standard_Integer myTranslatorSensitivity;
Standard_Integer myRotatorSensitivity;
Standard_Integer myScalerSensitivity;
Standard_Integer myDraggerSensitivity;
Standard_Integer myCurrentIndex; //!< Index of active axis.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.

View File

@@ -88,10 +88,10 @@ static void MIN_SOLUTION (const BRepExtrema_SeqOfSolution& SeqSol1,
{
const Standard_Real dst1 = SeqSol1.Value(i).Dist();
if (fabs(dst1 - DstRef) < Eps)
{
{
seqSol1.Append(SeqSol1.Value(i));
seqSol2.Append(SeqSol2.Value(i));
}
}
}
}
@@ -506,38 +506,70 @@ static void PERFORM_C0(const TopoDS_Edge &S1, const TopoDS_Edge &S2,
}
}
/*********************************************************************************/
void BRepExtrema_DistanceSS::Perform(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
//=======================================================================
//function : isOnBoundary
//purpose : Checks in 3d if the extrema point belongs to edge boundary
//=======================================================================
static Standard_Boolean isOnBoundary(const TopoDS_Edge& theEdge,
const gp_Pnt& theSol,
const Standard_Real theParam,
const Standard_Real thePTol = Precision::PConfusion())
{
SeqSolShape1.Clear();
SeqSolShape2.Clear();
for (TopoDS_Iterator it(theEdge); it.More(); it.Next())
{
const TopoDS_Vertex& aV = TopoDS::Vertex (it.Value());
Standard_Real aVParam = BRep_Tool::Parameter(aV, theEdge);
if (Abs (aVParam - theParam) < thePTol &&
BRep_Tool::Pnt (aV).Distance (theSol) < BRep_Tool::Tolerance (aV))
{
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepExtrema_DistanceSS::Perform(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2,
const Bnd_Box& theBox1, const Bnd_Box& theBox2)
{
mySeqSolShape1.Clear();
mySeqSolShape2.Clear();
myModif=Standard_False;
switch (S1.ShapeType())
Standard_Real aBBDist = theBox1.Distance (theBox2);
if (aBBDist - myDstRef > myEps)
{
// The Box-Box distance is greater than the start distance.
// The solution cannot be improved further.
return;
}
switch (theS1.ShapeType())
{
case TopAbs_VERTEX :
{
TopoDS_Vertex V1 = TopoDS::Vertex(S1);
switch (S2.ShapeType())
TopoDS_Vertex aV1 = TopoDS::Vertex (theS1);
switch (theS2.ShapeType())
{
case TopAbs_VERTEX :
{
TopoDS_Vertex V2 = TopoDS::Vertex(S2);
Perform( V1, V2 );
TopoDS_Vertex aV2 = TopoDS::Vertex (theS2);
Perform (aV1, aV2, mySeqSolShape1, mySeqSolShape2);
break;
}
case TopAbs_EDGE :
{
TopoDS_Edge E2 = TopoDS::Edge(S2);
Perform( V1, E2, B1, B2 );
TopoDS_Edge aE2 = TopoDS::Edge (theS2);
Perform (aV1, aE2, mySeqSolShape1, mySeqSolShape2);
break;
}
case TopAbs_FACE :
{
TopoDS_Face F2 = TopoDS::Face(S2);
Perform( V1, F2, B1, B2 );
TopoDS_Face aF2 = TopoDS::Face (theS2);
Perform (aV1, aF2, mySeqSolShape1, mySeqSolShape2);
break;
}
default:
@@ -545,41 +577,40 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Shape& S1, const TopoDS_Shape&
}
break;
}
case TopAbs_EDGE :
{
TopoDS_Edge E1 = TopoDS::Edge(S1);
switch (S2.ShapeType())
TopoDS_Edge aE1 = TopoDS::Edge (theS1);
switch (theS2.ShapeType())
{
case TopAbs_VERTEX :
{
TopoDS_Vertex V2 = TopoDS::Vertex(S2);
Perform( E1, V2, B1, B2 );
TopoDS_Vertex aV2 = TopoDS::Vertex (theS2);
Perform (aV2, aE1, mySeqSolShape2, mySeqSolShape1);
break;
}
case TopAbs_EDGE :
{
TopoDS_Edge E2 = TopoDS::Edge(S2);
TopoDS_Edge aE2 = TopoDS::Edge (theS2);
TopoDS_Edge aTrimEdge;
Standard_Boolean bIsTrim1 = Standard_False;
Standard_Boolean bIsTrim2 = Standard_False;
TRIM_INFINIT_EDGE( E1, E2, aTrimEdge, bIsTrim1, bIsTrim2 );
TRIM_INFINIT_EDGE (aE1, aE2, aTrimEdge, bIsTrim1, bIsTrim2);
if (bIsTrim1)
E1 = aTrimEdge;
aE1 = aTrimEdge;
if (bIsTrim2)
E2 = aTrimEdge;
Perform( E1, E2, B1, B2 );
aE2 = aTrimEdge;
Perform (aE1, aE2, mySeqSolShape1, mySeqSolShape2);
break;
}
case TopAbs_FACE :
{
TopoDS_Face F2 = TopoDS::Face(S2);
TopoDS_Face aF2 = TopoDS::Face (theS2);
TopoDS_Face aTrimFace;
Standard_Boolean bIsInfinit;
TRIM_INFINIT_FACE( E1, F2, aTrimFace, bIsInfinit );
TRIM_INFINIT_FACE (aE1, aF2, aTrimFace, bIsInfinit);
if (bIsInfinit)
F2 = aTrimFace;
Perform( E1, F2, B1, B2 );
aF2 = aTrimFace;
Perform (aE1, aF2, mySeqSolShape1, mySeqSolShape2);
break;
}
default:
@@ -587,33 +618,32 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Shape& S1, const TopoDS_Shape&
}
break;
}
case TopAbs_FACE :
{
TopoDS_Face F1 = TopoDS::Face(S1);
switch (S2.ShapeType())
TopoDS_Face aF1 = TopoDS::Face (theS1);
switch (theS2.ShapeType())
{
case TopAbs_VERTEX :
{
TopoDS_Vertex V2 = TopoDS::Vertex(S2);
Perform( F1, V2, B1, B2 );
TopoDS_Vertex aV2 = TopoDS::Vertex (theS2);
Perform (aV2, aF1, mySeqSolShape2, mySeqSolShape1);
break;
}
case TopAbs_EDGE :
{
TopoDS_Edge E2 = TopoDS::Edge(S2);
TopoDS_Edge aE2 = TopoDS::Edge (theS2);
TopoDS_Face aTrimFace;
Standard_Boolean bIsInfinit;
TRIM_INFINIT_FACE( F1, E2, aTrimFace, bIsInfinit );
TRIM_INFINIT_FACE (aF1, aE2, aTrimFace, bIsInfinit);
if (bIsInfinit)
F1 = aTrimFace;
Perform( F1, E2, B1, B2 );
aF1 = aTrimFace;
Perform (aE2, aF1, mySeqSolShape2, mySeqSolShape1);
break;
}
case TopAbs_FACE :
{
TopoDS_Face F2 = TopoDS::Face(S2);
Perform( F1, F2, B1, B2 );
TopoDS_Face aF2 = TopoDS::Face (theS2);
Perform (aF1, aF2, mySeqSolShape1, mySeqSolShape2);
break;
}
default:
@@ -626,38 +656,44 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Shape& S1, const TopoDS_Shape&
}
}
/*********************************************************************************/
void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Vertex& S2)
//=======================================================================
//function : Perform
//purpose : Vertex-Vertex
//=======================================================================
void BRepExtrema_DistanceSS::Perform (const TopoDS_Vertex& theS1,
const TopoDS_Vertex& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2)
{
const gp_Pnt P1 = BRep_Tool::Pnt(S1);
const gp_Pnt P2 = BRep_Tool::Pnt(S2);
const gp_Pnt aP1 = BRep_Tool::Pnt (theS1);
const gp_Pnt aP2 = BRep_Tool::Pnt (theS2);
const Standard_Real Dst = P1.Distance(P2);
const Standard_Real Dst = aP1.Distance(aP2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
if (myDstRef > Dst)
myDstRef=Dst;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dst,P1,BRepExtrema_IsVertex,S1);
const BRepExtrema_SolutionElem Sol2(Dst,P2,BRepExtrema_IsVertex,S2);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
const BRepExtrema_SolutionElem Sol1 (Dst, aP1, BRepExtrema_IsVertex, theS1);
const BRepExtrema_SolutionElem Sol2 (Dst, aP2, BRepExtrema_IsVertex, theS2);
theSeqSolShape1.Append (Sol1);
theSeqSolShape2.Append (Sol2);
}
}
/*********************************************************************************/
void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Edge& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
//=======================================================================
//function : Perform
//purpose : Vertex-Edge
//=======================================================================
void BRepExtrema_DistanceSS::Perform (const TopoDS_Vertex& theS1,
const TopoDS_Edge& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2)
{
if (BRep_Tool::Degenerated(S2))
if (BRep_Tool::Degenerated(theS2))
return;
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPC Ext(S1,S2);
BRepExtrema_ExtPC Ext(theS1, theS2);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
@@ -673,10 +709,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Edge&
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
Standard_Real Udeb,Ufin;
BRep_Tool::Range(S2,Udeb,Ufin);
gp_Pnt Pt,P1=BRep_Tool::Pnt(S1);
gp_Pnt Pt, P1 = BRep_Tool::Pnt(theS1);
const Standard_Real epsP=Precision::PConfusion();
for (i = 1; i <= NbExtrema; i++)
@@ -684,19 +717,19 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Edge&
if (fabs(Dstmin-sqrt(Ext.SquareDistance(i)))<myEps)
{
Pt=Ext.Point(i);
if (TRI_SOLUTION(SeqSolShape2,Pt))
if (TRI_SOLUTION(theSeqSolShape2, Pt))
{
// Check if the parameter does not correspond to a vertex
const Standard_Real t = Ext.Parameter(i);
if ( (fabs(t-Udeb)>=epsP) && (fabs(t-Ufin)>epsP) )
if (!isOnBoundary(theS2, Pt, t, epsP))
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,P1,BRepExtrema_IsVertex,S1);
const BRepExtrema_SolutionElem Sol2(Dstmin,Pt,BRepExtrema_IsOnEdge,S2,t);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
const BRepExtrema_SolutionElem Sol1(Dstmin, P1, BRepExtrema_IsVertex, theS1);
const BRepExtrema_SolutionElem Sol2(Dstmin, Pt, BRepExtrema_IsOnEdge, theS2, t);
theSeqSolShape1.Append(Sol1);
theSeqSolShape2.Append(Sol2);
}
}
}
@@ -704,18 +737,17 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Edge&
}
}
}
}
void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1,const TopoDS_Vertex& S2,
const Bnd_Box& B1,const Bnd_Box& B2)
//=======================================================================
//function : Perform
//purpose : Vertex-Face
//=======================================================================
void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& theS1,
const TopoDS_Face& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2)
{
if (BRep_Tool::Degenerated(S1))
return;
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPC Ext(S2,S1);
BRepExtrema_ExtPF Ext (theS1, theS2, myFlag, myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
@@ -730,89 +762,32 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1,const TopoDS_Vertex&
}
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
Standard_Real Udeb,Ufin;
BRep_Tool::Range(S1,Udeb,Ufin);
gp_Pnt Pt, P2 = BRep_Tool::Pnt(S2);
const Standard_Real epsP=Precision::PConfusion();
for (i = 1; i <= NbExtrema; i++)
{
if (fabs(Dstmin-sqrt(Ext.SquareDistance(i)))<myEps)
{
Pt=Ext.Point(i);
if (TRI_SOLUTION(SeqSolShape1,Pt))
{
// Check if the parameter does not correspond to a vertex
const Standard_Real t = Ext.Parameter(i);
if ( (fabs(t-Udeb)>=epsP) && (fabs(t-Ufin)>epsP) )
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,Pt,BRepExtrema_IsOnEdge,S1,t);
const BRepExtrema_SolutionElem Sol2(Dstmin,P2,BRepExtrema_IsVertex,S2);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
}
}
}
}
}
}
}
}
/*********************************************************************************/
void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
{
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S1,S2,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
// Search minimum distance Dstmin
Standard_Integer i;
Standard_Real Dstmin = Ext.SquareDistance(1);
for (i = 2; i <= NbExtrema; i++)
{
const Standard_Real sDst = Ext.SquareDistance(i);
if (sDst<Dstmin)
Dstmin=sDst;
}
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
Standard_Real U,V;
gp_Pnt Pt,P1=BRep_Tool::Pnt(S1);
gp_Pnt Pt, P1 = BRep_Tool::Pnt(theS1);
BRepClass_FaceClassifier classifier;
const Standard_Real tol = BRep_Tool::Tolerance(S2);
const Standard_Real tol = BRep_Tool::Tolerance(theS2);
for (i = 1; i <= NbExtrema; i++)
{
if (fabs(Dstmin-sqrt(Ext.SquareDistance(i)))<myEps)
{
Pt=Ext.Point(i);
if (TRI_SOLUTION(SeqSolShape2,Pt))
if (TRI_SOLUTION(theSeqSolShape2, Pt))
{
// Check if the parameter does not correspond to a vertex
Ext.Parameter(i,U,V);
const gp_Pnt2d PUV(U,V);
classifier.Perform(S2,PUV,tol);
classifier.Perform(theS2, PUV, tol);
if (classifier.State()==TopAbs_IN)
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,P1,BRepExtrema_IsVertex,S1);
const BRepExtrema_SolutionElem Sol2(Dstmin,Pt,BRepExtrema_IsInFace,S2,U,V);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
const BRepExtrema_SolutionElem Sol1(Dstmin, P1, BRepExtrema_IsVertex, theS1);
const BRepExtrema_SolutionElem Sol2(Dstmin, Pt, BRepExtrema_IsInFace, theS2, U, V);
theSeqSolShape1.Append(Sol1);
theSeqSolShape2.Append(Sol2);
}
}
}
@@ -820,78 +795,22 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
}
}
}
}
void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
//=======================================================================
//function : Perform
//purpose : Edge-Edge
//=======================================================================
void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1,
const TopoDS_Edge& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2)
{
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S2,S1,myFlag,myAlgo);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
// Search minimum distance Dstmin
Standard_Integer i;
Standard_Real Dstmin = Ext.SquareDistance(1);
for (i = 2; i <= NbExtrema; i++)
{
const Standard_Real sDst = Ext.SquareDistance(i);
if (sDst<Dstmin)
Dstmin=sDst;
}
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
Standard_Real U,V;
gp_Pnt Pt,P2=BRep_Tool::Pnt(S2);
BRepClass_FaceClassifier classifier;
const Standard_Real tol = BRep_Tool::Tolerance(S1);
for (i = 1; i <= NbExtrema; i++)
{
if (fabs(Dstmin-sqrt(Ext.SquareDistance(i)))<myEps)
{
Pt=Ext.Point(i);
if (TRI_SOLUTION(SeqSolShape1,Pt))
{
// Check if the parameter does not correspond to a vertex
Ext.Parameter(i,U,V);
const gp_Pnt2d PUV(U,V);
classifier.Perform(S1,PUV,tol);
if (classifier.State()==TopAbs_IN)
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,Pt,BRepExtrema_IsInFace,S1,U,V);
const BRepExtrema_SolutionElem Sol2(Dstmin,P2,BRepExtrema_IsVertex,S2);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
}
}
}
}
}
}
}
}
/*********************************************************************************/
void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Edge& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
{
if (BRep_Tool::Degenerated(S1) || BRep_Tool::Degenerated(S2))
if (BRep_Tool::Degenerated(theS1) || BRep_Tool::Degenerated(theS2))
return;
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
const Standard_Real DstRef = myDstRef;
BRepExtrema_ExtCC Ext(S1,S2);
BRepExtrema_ExtCC Ext(theS1, theS2);
const Standard_Integer NbExtrema = Ext.IsDone()? (Ext.IsParallel()? 0 : Ext.NbExt()) : 0;
if ( NbExtrema > 0 )
{
@@ -907,10 +826,6 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Edge& S
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
Standard_Real Udeb1,Ufin1,Udeb2,Ufin2;
BRep_Tool::Range(S1,Udeb1,Ufin1);
BRep_Tool::Range(S2,Udeb2,Ufin2);
gp_Pnt Pt1,Pt2;
const Standard_Real epsP=Precision::PConfusion();
@@ -920,20 +835,21 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Edge& S
{
Pt1=Ext.PointOnE1(i);
Pt2=Ext.PointOnE2(i);
if (TRI_SOLUTION(SeqSolShape1,Pt1) || TRI_SOLUTION(SeqSolShape2,Pt2))
if (TRI_SOLUTION(theSeqSolShape1, Pt1) || TRI_SOLUTION(theSeqSolShape2, Pt2))
{
// Check if the parameters do not correspond to a vertex
const Standard_Real t1 = Ext.ParameterOnE1(i);
const Standard_Real t2 = Ext.ParameterOnE2(i);
if ((fabs(t1-Udeb1)>=epsP)&&(fabs(t1-Ufin1)>epsP)&&(fabs(t2-Udeb2)>=epsP)&&(fabs(t2-Ufin2)>epsP))
if (!isOnBoundary (theS1, Pt1, t1, epsP) && !isOnBoundary (theS2, Pt2, t2, epsP))
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,Pt1,BRepExtrema_IsOnEdge,S1,t1);
const BRepExtrema_SolutionElem Sol2(Dstmin,Pt2,BRepExtrema_IsOnEdge,S2,t2);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
const BRepExtrema_SolutionElem Sol1(Dstmin, Pt1, BRepExtrema_IsOnEdge, theS1, t1);
const BRepExtrema_SolutionElem Sol2(Dstmin, Pt2, BRepExtrema_IsOnEdge, theS2, t2);
theSeqSolShape1.Append(Sol1);
theSeqSolShape2.Append(Sol2);
}
}
}
@@ -944,7 +860,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Edge& S
BRepExtrema_SeqOfSolution SeqSolution1;
BRepExtrema_SeqOfSolution SeqSolution2;
PERFORM_C0(S1, S2, SeqSolution1, SeqSolution2, DstRef, myDstRef, myEps);
PERFORM_C0(theS1, theS2, SeqSolution1, SeqSolution2, DstRef, myDstRef, myEps);
BRepExtrema_SeqOfSolution seqSol1;
BRepExtrema_SeqOfSolution seqSol2;
@@ -954,27 +870,26 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Edge& S
if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty())
{
SeqSolShape1.Append(seqSol1);
SeqSolShape2.Append(seqSol2);
theSeqSolShape1.Append(seqSol1);
theSeqSolShape2.Append(seqSol2);
myModif = Standard_True;
}
}
}
/*********************************************************************************/
void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
//=======================================================================
//function : Perform
//purpose : Edge-Face
//=======================================================================
void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1, const TopoDS_Face& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2)
{
if (BRep_Tool::Degenerated(S1))
if (BRep_Tool::Degenerated(theS1))
return;
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepClass_FaceClassifier classifier;
BRepExtrema_ExtCF Ext(S1,S2);
BRepExtrema_ExtCF Ext(theS1, theS2);
const Standard_Integer NbExtrema = Ext.IsDone()? (Ext.IsParallel()? 0 : Ext.NbExt()) : 0;
if ( NbExtrema > 0 )
{
@@ -990,9 +905,8 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
Standard_Real Udeb,Ufin,U,V;
BRep_Tool::Range(S1,Udeb,Ufin);
const Standard_Real tol=BRep_Tool::Tolerance(S2);
Standard_Real U,V;
const Standard_Real tol = BRep_Tool::Tolerance(theS2);
gp_Pnt Pt1,Pt2;
const Standard_Real epsP=Precision::PConfusion();
@@ -1003,24 +917,24 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
{
Pt1=Ext.PointOnEdge(i);
Pt2=Ext.PointOnFace(i);
if (TRI_SOLUTION(SeqSolShape1,Pt1) || TRI_SOLUTION(SeqSolShape2,Pt2))
if (TRI_SOLUTION(theSeqSolShape1, Pt1) || TRI_SOLUTION(theSeqSolShape2, Pt2))
{
// Check if the parameter does not correspond to a vertex
const Standard_Real t1 = Ext.ParameterOnEdge(i);
if ((fabs(t1-Udeb)>=epsP)&&(fabs(t1-Ufin)>epsP))
if (!isOnBoundary (theS1, Pt1, t1, epsP))
{
Ext.ParameterOnFace(i,U,V);
const gp_Pnt2d PUV(U,V);
classifier.Perform(S2,PUV,tol);
classifier.Perform(theS2, PUV, tol);
if (classifier.State()==TopAbs_IN)
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,Pt1,BRepExtrema_IsOnEdge,S1,t1);
const BRepExtrema_SolutionElem Sol2(Dstmin,Pt2,BRepExtrema_IsInFace,S2,U,V);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
const BRepExtrema_SolutionElem Sol1(Dstmin, Pt1, BRepExtrema_IsOnEdge, theS1, t1);
const BRepExtrema_SolutionElem Sol2(Dstmin, Pt2, BRepExtrema_IsInFace, theS2, U, V);
theSeqSolShape1.Append(Sol1);
theSeqSolShape2.Append(Sol2);
}
}
}
@@ -1030,7 +944,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
}
Standard_Real aFirst, aLast;
Handle(Geom_Curve) pCurv = BRep_Tool::Curve(S1, aFirst, aLast);
Handle(Geom_Curve) pCurv = BRep_Tool::Curve(theS1, aFirst, aLast);
if (pCurv->Continuity() == GeomAbs_C0)
{
BRepExtrema_SeqOfSolution SeqSolution1;
@@ -1044,7 +958,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
gp_Pnt Pt;
Standard_Real U,V;
const Standard_Real tol = BRep_Tool::Tolerance(S2);
const Standard_Real tol = BRep_Tool::Tolerance(theS2);
Standard_Integer i;
for (i = 1; i <= arrInter.Length(); i++)
@@ -1053,7 +967,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
gp_Pnt aPnt = aAdaptorCurve.Value(aParameter);
TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(aPnt);
BRepExtrema_ExtPF ExtPF(V1,S2);
BRepExtrema_ExtPF ExtPF(V1, theS2);
const Standard_Integer NbExtremaPF = ExtPF.IsDone()? ExtPF.NbExt() : 0;
if (NbExtremaPF > 0 )
{
@@ -1077,14 +991,14 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
// Check if the parameter does not correspond to a vertex
ExtPF.Parameter(ii,U,V);
const gp_Pnt2d PUV(U,V);
classifier.Perform(S2,PUV,tol);
classifier.Perform(theS2, PUV, tol);
if (classifier.State()==TopAbs_IN)
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,aPnt,BRepExtrema_IsOnEdge,S1,aParameter);
const BRepExtrema_SolutionElem Sol2(Dstmin,ExtPF.Point(ii),BRepExtrema_IsInFace,S2,U,V);
const BRepExtrema_SolutionElem Sol1(Dstmin, aPnt, BRepExtrema_IsOnEdge, theS1, aParameter);
const BRepExtrema_SolutionElem Sol2(Dstmin, ExtPF.Point(ii), BRepExtrema_IsInFace, theS2, U, V);
SeqSolution1.Append(Sol1);
SeqSolution2.Append(Sol2);
}
@@ -1101,167 +1015,22 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Edge& S1, const TopoDS_Face& S
if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty())
{
SeqSolShape1.Append(seqSol1);
SeqSolShape2.Append(seqSol2);
theSeqSolShape1.Append(seqSol1);
theSeqSolShape2.Append(seqSol2);
}
}
}
}
void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Edge& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
//=======================================================================
//function : Perform
//purpose : Face-Face
//=======================================================================
void BRepExtrema_DistanceSS::Perform (const TopoDS_Face& theS1,
const TopoDS_Face& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2)
{
if (BRep_Tool::Degenerated(S2))
return;
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepClass_FaceClassifier classifier;
BRepExtrema_ExtCF Ext(S2,S1);
const Standard_Integer NbExtrema = Ext.IsDone()? (Ext.IsParallel()? 0 : Ext.NbExt()) : 0;
if ( NbExtrema > 0 )
{
// Search minimum distance Dstmin
Standard_Integer i;
Standard_Real Dstmin = Ext.SquareDistance(1);
for (i = 2; i <= NbExtrema; i++)
{
const Standard_Real sDst = Ext.SquareDistance(i);
if (sDst<Dstmin)
Dstmin=sDst;
}
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
Standard_Real Udeb,Ufin,U,V;
BRep_Tool::Range(S2,Udeb,Ufin);
const Standard_Real tol=BRep_Tool::Tolerance(S1);
gp_Pnt Pt1,Pt2;
const Standard_Real epsP=Precision::PConfusion();
for (i = 1; i <= NbExtrema; i++)
{
if (fabs(Dstmin-sqrt(Ext.SquareDistance(i)))<myEps)
{
Pt1=Ext.PointOnEdge(i);
Pt2=Ext.PointOnFace(i);
if (TRI_SOLUTION(SeqSolShape1,Pt1) || TRI_SOLUTION(SeqSolShape2,Pt2))
{
// Check if the parameter does not correspond to a vertex
const Standard_Real t1 = Ext.ParameterOnEdge(i);
if ((fabs(t1-Udeb)>=epsP)&&(fabs(t1-Ufin)>epsP))
{
Ext.ParameterOnFace(i,U,V);
const gp_Pnt2d PUV(U,V);
classifier.Perform(S1,PUV,tol);
if (classifier.State()==TopAbs_IN)
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol2(Dstmin,Pt1,BRepExtrema_IsOnEdge,S2,t1);
const BRepExtrema_SolutionElem Sol1(Dstmin,Pt2,BRepExtrema_IsInFace,S1,U,V);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
}
}
}
}
}
}
}
Standard_Real aFirst, aLast;
Handle(Geom_Curve) pCurv = BRep_Tool::Curve(S2, aFirst, aLast);
if (pCurv->Continuity() == GeomAbs_C0)
{
BRepExtrema_SeqOfSolution SeqSolution1;
BRepExtrema_SeqOfSolution SeqSolution2;
GeomAdaptor_Curve aAdaptorCurve(pCurv, aFirst, aLast);
const Standard_Integer nbIntervals = aAdaptorCurve.NbIntervals(GeomAbs_C1);
TColStd_Array1OfReal arrInter(1,1+nbIntervals);
aAdaptorCurve.Intervals(arrInter, GeomAbs_C1);
gp_Pnt Pt;
Standard_Real U,V;
const Standard_Real tol = BRep_Tool::Tolerance(S1);
Standard_Integer i;
for (i = 1; i <= arrInter.Length(); i++)
{
const Standard_Real aParameter = arrInter(i);
gp_Pnt aPnt = aAdaptorCurve.Value(aParameter);
TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(aPnt);
BRepExtrema_ExtPF ExtPF(V1,S1);
const Standard_Integer NbExtremaPF = ExtPF.IsDone()? ExtPF.NbExt() : 0;
if (NbExtremaPF > 0 )
{
// Search minimum distance Dstmin
Standard_Integer ii;
Standard_Real Dstmin = ExtPF.SquareDistance(1);
for (ii = 2; ii <= NbExtremaPF; ii++)
{
const Standard_Real sDst = ExtPF.SquareDistance(ii);
if (sDst<Dstmin)
Dstmin=sDst;
}
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
for (ii = 1; ii <= NbExtremaPF; ii++)
{
if (fabs(Dstmin-sqrt(ExtPF.SquareDistance(ii)))<myEps)
{
// Check if the parameter does not correspond to a vertex
ExtPF.Parameter(ii,U,V);
const gp_Pnt2d PUV(U,V);
classifier.Perform(S1,PUV,tol);
if (classifier.State()==TopAbs_IN)
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol2(Dstmin,aPnt,BRepExtrema_IsOnEdge,S2,aParameter);
const BRepExtrema_SolutionElem Sol1(Dstmin,ExtPF.Point(ii),BRepExtrema_IsInFace,S1,U,V);
SeqSolution1.Append(Sol1);
SeqSolution2.Append(Sol2);
}
}
}
}
}
}
BRepExtrema_SeqOfSolution seqSol1;
BRepExtrema_SeqOfSolution seqSol2;
if (SeqSolution1.Length() > 0 && SeqSolution2.Length() > 0)
MIN_SOLUTION(SeqSolution1, SeqSolution2, myDstRef, myEps, seqSol1, seqSol2);
if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty())
{
SeqSolShape1.Append(seqSol1);
SeqSolShape2.Append(seqSol2);
}
}
}
}
/*********************************************************************************/
void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Face& S2,
const Bnd_Box& B1, const Bnd_Box& B2)
{
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtFF Ext(S1,S2);
BRepExtrema_ExtFF Ext(theS1, theS2);
const Standard_Integer NbExtrema = Ext.IsDone()? (Ext.IsParallel()? 0 : Ext.NbExt()) : 0;
if ( NbExtrema > 0 )
{
@@ -1277,8 +1046,8 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Face& S
Dstmin = sqrt(Dstmin);
if ((Dstmin < myDstRef - myEps) || (fabs(Dstmin-myDstRef) < myEps))
{
const Standard_Real tol1=BRep_Tool::Tolerance(S1);
const Standard_Real tol2=BRep_Tool::Tolerance(S2);
const Standard_Real tol1 = BRep_Tool::Tolerance(theS1);
const Standard_Real tol2 = BRep_Tool::Tolerance(theS2);
gp_Pnt Pt1,Pt2;
gp_Pnt2d PUV;
@@ -1291,26 +1060,26 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Face& S
{
Pt1=Ext.PointOnFace1(i);
Pt2=Ext.PointOnFace2(i);
if (TRI_SOLUTION(SeqSolShape1,Pt1) || TRI_SOLUTION(SeqSolShape2,Pt2))
if (TRI_SOLUTION(theSeqSolShape1, Pt1) || TRI_SOLUTION(theSeqSolShape2, Pt2))
{
// Check if the parameter does not correspond to a vertex
Ext.ParameterOnFace1(i,U1,V1);
PUV.SetCoord(U1,V1);
classifier.Perform(S1,PUV,tol1);
classifier.Perform(theS1, PUV, tol1);
if (classifier.State()==TopAbs_IN)
{
Ext.ParameterOnFace2(i,U2,V2);
PUV.SetCoord(U2,V2);
classifier.Perform(S2,PUV,tol2);
classifier.Perform(theS2, PUV, tol2);
if (classifier.State()==TopAbs_IN)
{
if (myDstRef > Dstmin)
myDstRef=Dstmin;
myModif=Standard_True;
const BRepExtrema_SolutionElem Sol1(Dstmin,Pt1,BRepExtrema_IsInFace,S1,U1,V1);
const BRepExtrema_SolutionElem Sol2(Dstmin,Pt2,BRepExtrema_IsInFace,S2,U2,V2);
SeqSolShape1.Append(Sol1);
SeqSolShape2.Append(Sol2);
const BRepExtrema_SolutionElem Sol1(Dstmin, Pt1, BRepExtrema_IsInFace, theS1, U1, V1);
const BRepExtrema_SolutionElem Sol2(Dstmin, Pt2, BRepExtrema_IsInFace, theS2, U2, V2);
theSeqSolShape1.Append(Sol1);
theSeqSolShape2.Append(Sol2);
}
}
}
@@ -1319,6 +1088,3 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Face& S
}
}
}
}
/*********************************************************************************/

View File

@@ -26,111 +26,139 @@ class TopoDS_Vertex;
class TopoDS_Edge;
class TopoDS_Face;
//! This class allows to compute minimum distance between two shapes <br>
//! (face edge vertex) and is used in DistShapeShape class. <br>
//! This class allows to compute minimum distance between two brep shapes
//! (face edge vertex) and is used in DistShapeShape class.
class BRepExtrema_DistanceSS
{
public:
public:
DEFINE_STANDARD_ALLOC
//! computes the distance between two Shapes ( face edge vertex). <br>
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A)
public: //! @name Constructor from two shapes
//! Computes the distance between two Shapes (face edge vertex).
//! @param theS1 - First shape
//! @param theS2 - Second shape
//! @param theBox1 - Bounding box of first shape
//! @param theBox2 - Bounding box of second shape
//! @param theDstRef - Initial distance between the shapes to start with
//! @param theDeflection - Maximum deviation of extreme distances from the minimum
//! one (default is Precision::Confusion()).
//! @param theExtFlag - Specifies which extrema solutions to look for
//! (default is MINMAX, applied only to point-face extrema)
//! @param theExtAlgo - Specifies which extrema algorithm is to be used
//! (default is Grad algo, applied only to point-face extrema)
BRepExtrema_DistanceSS(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2,
const Bnd_Box& theBox1, const Bnd_Box& theBox2,
const Standard_Real theDstRef,
const Standard_Real theDeflection = Precision::Confusion(),
const Extrema_ExtFlag theExtFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo theExtAlgo = Extrema_ExtAlgo_Grad)
:
myDstRef(theDstRef),
myModif(Standard_False),
myEps(theDeflection),
myFlag(theExtFlag),
myAlgo(theExtAlgo)
{
Perform(S1, S2, B1, B2);
Perform(theS1, theS2, theBox1, theBox2);
}
//! computes the distance between two Shapes ( face edge vertex). <br>
//! Parameter theDeflection is used to specify a maximum deviation <br>
//! of extreme distances from the minimum one. <br>
//! Default value is Precision::Confusion(). <br>
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef, const Standard_Real aDeflection,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A)
public: //! @name Setting the options for the algorithm
//! Sets the deflection - maximum deviation of extreme distances from the minimum one.
//! Default value is Precision::Confusion().
void SetDeflection (const Standard_Real theDeflection)
{
Perform(S1, S2, B1, B2);
myEps = theDeflection;
}
//! True if the distance has been computed <br>
//! Sets the flag controlling what type of search to perform.
//! Default value is MinMax. This option is applied to only Point-Face extrema search.
void SetFlag(const Extrema_ExtFlag theExtFlag)
{
myFlag = theExtFlag;
}
//! Sets the algorithm to be used for the extrema search - Grad or Tree.
//! Default value is Grad. This option is applied to only Point-Face extrema search.
void SetAlgo(const Extrema_ExtAlgo theExtAlgo)
{
myAlgo = theExtAlgo;
}
public: //! @name Results
//! Returns true if the distance has been computed, false otherwise.
Standard_Boolean IsDone() const
{
return myModif;
}
//! returns the distance value <br>
//! Returns the distance value.
Standard_Real DistValue() const
{
return myDstRef;
}
//! returns the list of solutions on the first shape <br>
//! Returns the list of solutions on the first shape.
const BRepExtrema_SeqOfSolution& Seq1Value() const
{
return SeqSolShape1;
return mySeqSolShape1;
}
//! returns the list of solutions on the second shape <br>
//! Returns the list of solutions on the second shape.
const BRepExtrema_SeqOfSolution& Seq2Value() const
{
return SeqSolShape2;
}
//! sets the flag controlling minimum and maximum search
void SetFlag(const Extrema_ExtFlag F)
{
myFlag = F;
}
//! sets the flag controlling ...
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
return mySeqSolShape2;
}
private:
private: //! @name private methods performing the search
//! computes the distance between two Shapes ( face edge vertex) <br>
Standard_EXPORT void Perform(const TopoDS_Shape& S1,const TopoDS_Shape& S2,const Bnd_Box& B1,const Bnd_Box& B2);
//! Computes the distance between two Shapes (face edge vertex).
//! General method to sort out the shape types and call the specific method.
Standard_EXPORT void Perform(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2,
const Bnd_Box& theBox1, const Bnd_Box& theBox2);
//! computes the distance between two vertices <br>
void Perform(const TopoDS_Vertex& S1,const TopoDS_Vertex& S2);
//! computes the minimum distance between a vertex and an edge <br>
void Perform(const TopoDS_Vertex& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2);
//! computes the minimum distance between a vertex and a face <br>
void Perform(const TopoDS_Vertex& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2);
//! Computes the distance between two vertices.
void Perform(const TopoDS_Vertex& S1, const TopoDS_Vertex& S2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2);
//! computes the minimum distance between an edge and a vertex <br>
void Perform(const TopoDS_Edge& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2);
/*{
Perform(S2, S1, B2, B1);
}*/
//! computes the minimum distance between two edges <br>
void Perform(const TopoDS_Edge& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2);
//! computes the minimum distance an edge and a face <br>
void Perform(const TopoDS_Edge& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2);
//! Computes the minimum distance between a vertex and an edge.
void Perform(const TopoDS_Vertex& theS1, const TopoDS_Edge& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2);
//! computes the minimum distance betwwen a face and a vertex <br>
void Perform(const TopoDS_Face& S1,const TopoDS_Vertex& S2,const Bnd_Box& B1,const Bnd_Box& B2);
/*{
Perform(S2, S1, B2, B1);
}*/
//! computes the minimum distance between a face and an edge <br>
void Perform(const TopoDS_Face& S1,const TopoDS_Edge& S2,const Bnd_Box& B1,const Bnd_Box& B2);
/*{
Perform(S2, S1, B2, B1);
}*/
//! computes the minimum distance between two faces <br>
void Perform(const TopoDS_Face& S1,const TopoDS_Face& S2,const Bnd_Box& B1,const Bnd_Box& B2);
//! Computes the minimum distance between a vertex and a face.
void Perform(const TopoDS_Vertex& theS1, const TopoDS_Face& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2);
BRepExtrema_SeqOfSolution SeqSolShape1;
BRepExtrema_SeqOfSolution SeqSolShape2;
Standard_Real myDstRef;
Standard_Boolean myModif;
Standard_Real myEps;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
//! Computes the minimum distance between two edges.
void Perform(const TopoDS_Edge& theS1, const TopoDS_Edge& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2);
//! Computes the minimum distance between an edge and a face.
void Perform(const TopoDS_Edge& theS1, const TopoDS_Face& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2);
//! Computes the minimum distance between two faces.
void Perform(const TopoDS_Face& theS1, const TopoDS_Face& theS2,
BRepExtrema_SeqOfSolution& theSeqSolShape1,
BRepExtrema_SeqOfSolution& theSeqSolShape2);
private: //! @name Fields
BRepExtrema_SeqOfSolution mySeqSolShape1; //!< Solutions on the first shape
BRepExtrema_SeqOfSolution mySeqSolShape2; //!< Solutions on the second shape
Standard_Real myDstRef; //!< The minimal distance found
Standard_Boolean myModif; //!< Flag indicating whether the solution was improved or not
Standard_Real myEps; //!< Deflection
Extrema_ExtFlag myFlag; //!< Extrema flag indicating what solutions to look for
Extrema_ExtAlgo myAlgo; //!< Extrema algo to be used to look for solutions
};
#endif

View File

@@ -2458,6 +2458,174 @@ Standard_Boolean BRepLib::
return aRetVal;
}
//=======================================================================
//function : UpdateDeflection
//purpose :
//=======================================================================
namespace
{
//! Tool to estimate deflection of the given UV point
//! with regard to its representation in 3D space.
struct EvalDeflection
{
BRepAdaptor_Surface Surface;
//! Initializes tool with the given face.
EvalDeflection (const TopoDS_Face& theFace)
: Surface (theFace)
{
}
//! Evaluates deflection of the given 2d point from its 3d representation.
Standard_Real Eval (const gp_Pnt2d& thePoint2d, const gp_Pnt& thePoint3d)
{
gp_Pnt aPnt;
Surface.D0 (thePoint2d.X (), thePoint2d.Y (), aPnt);
return (thePoint3d.XYZ () - aPnt.XYZ ()).SquareModulus ();
}
};
//! Represents link of triangulation.
struct Link
{
Standard_Integer Node[2];
//! Constructor
Link (const Standard_Integer theNode1, const Standard_Integer theNode2)
{
Node[0] = theNode1;
Node[1] = theNode2;
}
//! Computes a hash code for the this link
Standard_Integer HashCode (const Standard_Integer theUpperBound) const
{
return ::HashCode (Node[0] + Node[1], theUpperBound);
}
//! Returns true if this link has the same nodes as the other.
Standard_Boolean IsEqual (const Link& theOther) const
{
return ((Node[0] == theOther.Node[0] && Node[1] == theOther.Node[1]) ||
(Node[0] == theOther.Node[1] && Node[1] == theOther.Node[0]));
}
//! Alias for IsEqual.
Standard_Boolean operator ==(const Link& theOther) const
{
return IsEqual (theOther);
}
};
//! Computes a hash code for the given link
inline Standard_Integer HashCode (const Link& theLink, const Standard_Integer theUpperBound)
{
return theLink.HashCode (theUpperBound);
}
}
void BRepLib::UpdateDeflection (const TopoDS_Shape& theShape)
{
TopExp_Explorer anExpFace (theShape, TopAbs_FACE);
for (; anExpFace.More(); anExpFace.Next())
{
const TopoDS_Face& aFace = TopoDS::Face (anExpFace.Current());
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aFace);
if (aSurf.IsNull())
{
continue;
}
TopLoc_Location aLoc;
const Handle(Poly_Triangulation)& aPT = BRep_Tool::Triangulation (aFace, aLoc);
if (aPT.IsNull() || !aPT->HasUVNodes())
{
continue;
}
// Collect all nodes of degenerative edges and skip elements
// build upon them due to huge distortions introduced by passage
// from UV space to 3D.
NCollection_Map<Standard_Integer> aDegNodes;
TopExp_Explorer anExpEdge (aFace, TopAbs_EDGE);
for (; anExpEdge.More(); anExpEdge.Next())
{
const TopoDS_Edge& aEdge = TopoDS::Edge (anExpEdge.Current());
if (BRep_Tool::Degenerated (aEdge))
{
const Handle(Poly_PolygonOnTriangulation)& aPolygon = BRep_Tool::PolygonOnTriangulation (aEdge, aPT, aLoc);
if (aPolygon.IsNull ())
{
continue;
}
for (Standard_Integer aNodeIt = aPolygon->Nodes().Lower(); aNodeIt <= aPolygon->Nodes().Upper(); ++aNodeIt)
{
aDegNodes.Add (aPolygon->Nodes().Value (aNodeIt));
}
}
}
EvalDeflection aTool (aFace);
NCollection_Map<Link> aLinks;
Standard_Real aSqDeflection = 0.;
const gp_Trsf& aTrsf = aLoc.Transformation();
for (Standard_Integer aTriIt = 1; aTriIt <= aPT->NbTriangles(); ++aTriIt)
{
const Poly_Triangle& aTriangle = aPT->Triangle (aTriIt);
int aNode[3];
aTriangle.Get (aNode[0], aNode[1], aNode[2]);
if (aDegNodes.Contains (aNode[0]) ||
aDegNodes.Contains (aNode[1]) ||
aDegNodes.Contains (aNode[2]))
{
continue;
}
const gp_Pnt aP3d[3] = {
aPT->Node (aNode[0]).Transformed (aTrsf),
aPT->Node (aNode[1]).Transformed (aTrsf),
aPT->Node (aNode[2]).Transformed (aTrsf)
};
const gp_Pnt2d aP2d[3] = {
aPT->UVNode (aNode[0]),
aPT->UVNode (aNode[1]),
aPT->UVNode (aNode[2])
};
// Check midpoint of triangle.
const gp_Pnt aMid3d_t = (aP3d[0].XYZ() + aP3d[1].XYZ() + aP3d[2].XYZ()) / 3.;
const gp_Pnt2d aMid2d_t = (aP2d[0].XY () + aP2d[1].XY () + aP2d[2].XY ()) / 3.;
aSqDeflection = Max (aSqDeflection, aTool.Eval (aMid2d_t, aMid3d_t));
for (Standard_Integer i = 0; i < 3; ++i)
{
const Standard_Integer j = (i + 1) % 3;
const Link aLink (aNode[i], aNode[j]);
if (!aLinks.Add (aLink))
{
// Do not estimate boundary links due to high distortions at the edge.
const gp_Pnt& aP3d1 = aP3d[i];
const gp_Pnt& aP3d2 = aP3d[j];
const gp_Pnt2d& aP2d1 = aP2d[i];
const gp_Pnt2d& aP2d2 = aP2d[j];
const gp_Pnt aMid3d_l = (aP3d1.XYZ() + aP3d2.XYZ()) / 2.;
const gp_Pnt2d aMid2d_l = (aP2d1.XY () + aP2d2.XY ()) / 2.;
aSqDeflection = Max (aSqDeflection, aTool.Eval (aMid2d_l, aMid3d_l));
}
}
}
aPT->Deflection (Sqrt (aSqDeflection));
}
}
//=======================================================================
//function : SortFaces
//purpose :

View File

@@ -250,6 +250,10 @@ public:
//! Returns TRUE if any correction is done.
Standard_EXPORT static Standard_Boolean EnsureNormalConsistency (const TopoDS_Shape& S, const Standard_Real theAngTol = 0.001, const Standard_Boolean ForceComputeNormals = Standard_False);
//! Updates value of deflection in Poly_Triangulation of faces
//! by the maximum deviation measured on existing triangulation.
Standard_EXPORT static void UpdateDeflection (const TopoDS_Shape& S);
//! Calculates the bounding sphere around the set of vertexes from the theLV list.
//! Returns the center (theNewCenter) and the radius (theNewTol) of this sphere.
//! This can be used to construct the new vertex which covers the given set of

View File

@@ -243,7 +243,6 @@ void BRepMesh_BaseMeshAlgo::commitSurfaceTriangulation()
collectNodes(aTriangulation);
aTriangulation->Deflection(myDFace->GetDeflection());
BRepMesh_ShapeTool::AddInFace(myDFace->GetFace(), aTriangulation);
}

View File

@@ -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);

View File

@@ -19,6 +19,7 @@
#include <IMeshData_Edge.hxx>
#include <IMeshData_PCurve.hxx>
#include <OSD_Parallel.hxx>
#include <BRepLib.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_ModelPostProcessor, IMeshTools_ModelAlgo)
@@ -157,6 +158,34 @@ namespace
Handle(IMeshData_Model) myModel;
};
//! Estimates and updates deflection of triangulations for corresponding faces.
class DeflectionEstimator
{
public:
//! Constructor
DeflectionEstimator (const Handle(IMeshData_Model)& theModel)
: myModel(theModel)
{
}
//! Main functor.
void operator()(const Standard_Integer theFaceIndex) const
{
const IMeshData::IFaceHandle& aDFace = myModel->GetFace (theFaceIndex);
if (aDFace->IsSet (IMeshData_Failure) ||
aDFace->IsSet (IMeshData_Reused))
{
return;
}
BRepLib::UpdateDeflection (aDFace->GetFace());
}
private:
Handle(IMeshData_Model) myModel;
};
}
//=======================================================================
@@ -181,7 +210,7 @@ BRepMesh_ModelPostProcessor::~BRepMesh_ModelPostProcessor()
//=======================================================================
Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& /*theParameters*/,
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange)
{
(void )theRange;
@@ -191,6 +220,10 @@ Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
}
// TODO: Force single threaded solution due to data races on edges sharing the same TShape
OSD_Parallel::For(0, theModel->EdgesNb(), PolygonCommitter(theModel), Standard_True/*!theParameters.InParallel*/);
OSD_Parallel::For (0, theModel->EdgesNb(), PolygonCommitter (theModel), Standard_True/*!theParameters.InParallel*/);
// Estimate deflection here due to BRepLib::EstimateDeflection requires
// existence of both Poly_Triangulation and Poly_PolygonOnTriangulation.
OSD_Parallel::For (0, theModel->FacesNb(), DeflectionEstimator (theModel), !theParameters.InParallel);
return Standard_True;
}

View File

@@ -1234,5 +1234,20 @@ void BSplCLib::MergeBSplineKnots
}
NumPoles = index - degree - 1 ;
}
else
{
degree = Degree1 + Degree2;
num_knots = 2;
NewKnots =
new TColStd_HArray1OfReal(1, num_knots);
NewKnots->ChangeArray1()(1) = StartValue;
NewKnots->ChangeArray1()(num_knots) = EndValue;
NewMults =
new TColStd_HArray1OfInteger(1, num_knots);
NewMults->ChangeArray1()(1) = degree + 1;
NewMults->ChangeArray1()(num_knots) = degree + 1;
NumPoles = BSplCLib::NbPoles(degree, Standard_False, NewMults->Array1());
}
}

View File

@@ -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.
@@ -582,7 +627,7 @@ void Extrema_GenExtCC::Perform()
{
Standard_Real aDist1 = ProjPOnC(C1.Value(aT1[iT]), anExtPC2);
Standard_Real aDist2 = ProjPOnC(C2.Value(aT2[iT]), anExtPC1);
isParallel = (Abs(Min(aDist1, aDist2) - aF) < Precision::Confusion());
isParallel = (Abs(Min(aDist1, aDist2) - aF * aF) < Precision::Confusion());
}
}

View File

@@ -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);
}

View File

@@ -371,29 +371,54 @@ void QuasiFleche (const TheCurve& C,
Vdelta = Vfin;
}
// square length of chord
Standard_Real Norme = gp_Vec (Pdeb, Pdelta).SquareMagnitude();
Standard_Real theFleche = 0;
Standard_Boolean flecheok = Standard_False;
if (Norme > Eps)
if (Norme > Eps && Norme > 16. * Deflection2)
{
// Evaluation de la fleche par interpolation . Voir IntWalk_IWalking_5.gxx
Standard_Real N1 = Vdeb.SquareMagnitude();
Standard_Real N2 = Vdelta.SquareMagnitude();
if (N1 > Eps && N2 > Eps)
{
// square distance between ends of two normalized vectors [0; 4]
Standard_Real Normediff = (Vdeb.Normalized().XYZ() - Vdelta.Normalized().XYZ()).SquareModulus();
if (Normediff > Eps)
{
theFleche = Normediff * Norme / 64.;
// So, fleche <= (Norme / 16), independently of Vdeb and Vdelta.
// And if (Norme / 16) < Deflection2, this approach gives
// fleche < Deflection2 independently of real curve.
// That is why we exclude case Norme < (16. * Deflection2)
flecheok = Standard_True;
}
}
}
if (!flecheok)
gp_Pnt Pmid ((Pdeb.XYZ() + Pdelta.XYZ()) * 0.5);
gp_Pnt Pverif (Value (C, Udeb + Udelta * 0.5));
Standard_Real FlecheMidMid = Pmid.SquareDistance (Pverif);
if (flecheok)
{
gp_Pnt Pmid ((Pdeb.XYZ() + Pdelta.XYZ()) * 0.5);
gp_Pnt Pverif (Value(C, Udeb + Udelta * 0.5));
theFleche = Pmid.SquareDistance (Pverif);
// Algorithm, evaluating "fleche" by interpolation,
// can give false-positive result.
// So we check also distance between Pmid and Pverif (FlecheMidMid).
// But FlecheMidMid gives worse result in case of non-uniform parameterisation.
// Maximum FlecheMidMid, that seems reasonable, is (chord/2)^2 + Deflection2
// .---------------.Pverif .
// | | | Deflection
// ._______. ______. .
// Pdeb Pmid Pdelta
if (FlecheMidMid > Norme/4. + Deflection2)
{
theFleche = FlecheMidMid;
}
}
else
{
theFleche = FlecheMidMid;
}
if (theFleche < Deflection2)

View File

@@ -519,7 +519,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
Handle(TColStd_HArray1OfReal) resKnots;
Handle(TColStd_HArray1OfInteger) resMults;
Standard_Real start_value,end_value;
Standard_Real tolerance=Precision::Confusion();
Standard_Integer resNbPoles,degree,
ii,jj,
aStatus;
@@ -531,6 +530,7 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
BS->KnotSequence(BSFlatKnots);
start_value = BSKnots(1);
end_value = BSKnots(BS->NbKnots());
Standard_Real tolerance = 10.*Epsilon(Abs(end_value));
a->Knots(aKnots);
a->Poles(aPoles);

View File

@@ -80,6 +80,10 @@ static
const Standard_Real theToler2D,
const Standard_Real thePeriod);
static
Standard_Real GetLocalStep(const Handle(Adaptor3d_HSurface)& theSurf,
const Standard_Real theStep);
//=======================================================================
//function : IsSeamOrPole
//purpose :
@@ -479,6 +483,81 @@ void Recadre(const Standard_Boolean ,
}
pt.SetParameters(U1,V1,U2,V2);
}
//=======================================================================
//function : GetLocalStep
//purpose :
//=======================================================================
Standard_Real GetLocalStep(const Handle(Adaptor3d_HSurface)& theSurf,
const Standard_Real theStep)
{
Standard_Real aLocalStep = theStep;
if (theSurf->UContinuity() > GeomAbs_C0 && theSurf->VContinuity() > GeomAbs_C0)
{
GeomAbs_SurfaceType aSType = theSurf->GetType();
if (aSType == GeomAbs_BezierSurface || aSType == GeomAbs_BSplineSurface)
{
Standard_Real aMinRes = Precision::Infinite();
Standard_Integer aMaxDeg = 0;
const Standard_Real aLimRes = 1.e-10;
aMinRes = Min(theSurf->UResolution(Precision::Confusion()),
theSurf->VResolution(Precision::Confusion()));
aMaxDeg = Max(theSurf->UDegree(), theSurf->VDegree());
if (aMinRes < aLimRes && aMaxDeg > 3)
{
aLocalStep = 0.0001;
}
}
}
if (theSurf->UContinuity() == GeomAbs_C0)
{
Standard_Integer aNbInt = theSurf->NbUIntervals(GeomAbs_C1);
if (aNbInt > 1)
{
TColStd_Array1OfReal anInts(1, aNbInt + 1);
theSurf->UIntervals(anInts, GeomAbs_C1);
Standard_Integer i;
Standard_Real aMinInt = Precision::Infinite();
for (i = 1; i <= aNbInt; ++i)
{
aMinInt = Min(aMinInt, anInts(i + 1) - anInts(i));
}
aMinInt /= theSurf->LastUParameter() - theSurf->FirstUParameter();
if (aMinInt < 0.002)
{
aLocalStep = 0.0001;
}
}
}
if (theSurf->VContinuity() == GeomAbs_C0)
{
Standard_Integer aNbInt = theSurf->NbVIntervals(GeomAbs_C1);
if (aNbInt > 1)
{
TColStd_Array1OfReal anInts(1, aNbInt + 1);
theSurf->VIntervals(anInts, GeomAbs_C1);
Standard_Integer i;
Standard_Real aMinInt = Precision::Infinite();
for (i = 1; i <= aNbInt; ++i)
{
aMinInt = Min(aMinInt, anInts(i + 1) - anInts(i));
}
aMinInt /= theSurf->LastVParameter() - theSurf->FirstVParameter();
if (aMinInt < 0.002)
{
aLocalStep = 0.0001;
}
}
}
aLocalStep = Min(theStep, aLocalStep);
return aLocalStep;
}
//=======================================================================
//function : Perform
@@ -584,6 +663,13 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}
break;
}
//
Standard_Real aLocalPas = Pas;
if (reversed)
aLocalPas = GetLocalStep(Surf1, Pas);
else
aLocalPas = GetLocalStep(Surf2, Pas);
//
Func.SetImplicitSurface(Quad);
Func.Set(IntSurf_QuadricTool::Tolerance(Quad));
@@ -686,7 +772,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
NbPointDep=seqpdep.Length();
//
if (NbPointDep || NbPointIns) {
IntPatch_TheIWalking iwalk(TolTang, Fleche, Pas);
IntPatch_TheIWalking iwalk(TolTang, Fleche, aLocalPas);
iwalk.Perform(seqpdep, seqpins, Func, reversed ? Surf1 : Surf2, reversed);
if(!iwalk.IsDone()) {

View File

@@ -390,6 +390,23 @@ static const Standard_Integer aNbSingleBezier = 30;
// purpose : Check and delete points using tube criteria.
// Static subfunction in ComputePurgedWLine.
//=========================================================================
static Standard_Boolean IsSurfPlaneLike(const Handle(Adaptor3d_HSurface) &theS)
{
if (theS->GetType() == GeomAbs_Plane)
{
return Standard_True;
}
if (theS->GetType() == GeomAbs_BSplineSurface)
{
if (theS->UDegree() == 1 && theS->VDegree() == 1)
{
return Standard_True;
}
}
return Standard_False;
}
static Handle(IntPatch_WLine)
DeleteByTube(const Handle(IntPatch_WLine) &theWLine,
const Handle(Adaptor3d_HSurface) &theS1,
@@ -419,6 +436,7 @@ static Handle(IntPatch_WLine)
gp_Vec2d aBase2dVec2(UonS2[1] - UonS2[0], VonS2[1] - VonS2[0]);
gp_Pnt aBase3dPnt = theWLine->Point(1).Value();
gp_Vec aBase3dVec(theWLine->Point(1).Value(), theWLine->Point(2).Value());
Standard_Real aPrevStep = aBase3dVec.SquareMagnitude();
// Choose base tolerance and scale it to pipe algorithm.
const Standard_Real aBaseTolerance = Precision::Approximation();
@@ -431,6 +449,8 @@ static Handle(IntPatch_WLine)
Standard_Real aTol3d = aBaseTolerance * aBaseTolerance;
const Standard_Real aLimitCoeff = 0.99 * 0.99;
const Standard_Real aMaxSqrRatio = 15. * 15.;
Standard_Boolean isPlanePlane = IsSurfPlaneLike(theS1) && IsSurfPlaneLike(theS2);
for(i = 3; i <= theWLine->NbPnts(); i++)
{
Standard_Boolean isDeleteState = Standard_False;
@@ -466,14 +486,27 @@ static Handle(IntPatch_WLine)
if (Min(aStepOnS1, aStepOnS2) >= aLimitCoeff * Max(aStepOnS1, aStepOnS2))
{
// Set hash flag to "Delete" state.
isDeleteState = Standard_True;
aNewPointsHash.SetValue(i - 1, 1);
Standard_Real aCurrStep = aBase3dPnt.SquareDistance(aPnt3d);
Standard_Real aSqrRatio = 0.;
if (!isPlanePlane)
{
aSqrRatio = aPrevStep / aCurrStep;
if (aSqrRatio < 1.)
{
aSqrRatio = 1. / aSqrRatio;
}
}
if (aSqrRatio < aMaxSqrRatio)
{
isDeleteState = Standard_True;
aNewPointsHash.SetValue(i - 1, 1);
// Change middle point.
UonS1[1] = UonS1[2];
UonS2[1] = UonS2[2];
VonS1[1] = VonS1[2];
VonS2[1] = VonS2[2];
// Change middle point.
UonS1[1] = UonS1[2];
UonS2[1] = UonS2[2];
VonS1[1] = VonS1[2];
VonS2[1] = VonS2[2];
}
}
}

View File

@@ -1190,7 +1190,7 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
bAvoidLineConstructor,
myTol,
aSeqOfL,
aReachedTol,
aReachedTol, // obsolete parameter
myContext);
//
aNbSeqOfL=aSeqOfL.Length();
@@ -1198,7 +1198,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;

View File

@@ -229,203 +229,6 @@ Standard_Boolean IntTools_WLineTool::NotUseSurfacesForApprox(const TopoDS_Face&
/////////////////////// DecompositionOfWLine ////////////////////////////
//=======================================================================
//function : CheckTangentZonesExist
//purpose : static subfunction in ComputeTangentZones
//=======================================================================
static
Standard_Boolean CheckTangentZonesExist(const Handle(GeomAdaptor_HSurface)& theSurface1,
const Handle(GeomAdaptor_HSurface)& 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_HSurface)& theSurface1,
const Handle(GeomAdaptor_HSurface)& 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
@@ -457,27 +260,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_HSurface) 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
@@ -652,72 +434,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_HSurface) 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 :
@@ -732,7 +448,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;
@@ -758,13 +474,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();
@@ -835,24 +545,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){
@@ -931,7 +623,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
@@ -981,32 +673,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) {
@@ -1145,20 +811,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 );

View File

@@ -48,8 +48,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

View File

@@ -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)

View File

@@ -32,11 +32,13 @@
#include <Bnd_Box.hxx>
#include <BndLib_Add3dCurve.hxx>
#include <ElSLib.hxx>
#include <Extrema_ExtElC.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BoundedSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Line.hxx>
#include <Geom_OffsetSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
@@ -218,44 +220,72 @@ void ShapeAnalysis_Surface::ComputeSingularities()
}
else if ((mySurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) ||
(mySurf->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) || //:b2 abv 18 Feb 98
(mySurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface)))) { //rln S4135
(mySurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface))))
{
Handle(Geom_SurfaceOfRevolution) aSoR = Handle(Geom_SurfaceOfRevolution)::DownCast(mySurf);
if (mySurf->IsKind(STANDARD_TYPE(Geom_OffsetSurface)))
{
aSoR = Handle(Geom_SurfaceOfRevolution)::DownCast((Handle(Geom_OffsetSurface)::DownCast(mySurf))->BasisSurface());
}
if (!aSoR.IsNull() &&
aSoR->BasisCurve()->IsKind(STANDARD_TYPE(Geom_Line)))
{
const gp_Lin aLine(aSoR->Axis());
Extrema_ExtElC anExtrema(aLine, (Handle(Geom_Line)::DownCast(aSoR->BasisCurve()))->Lin(), Precision::Angular());
if (anExtrema.IsDone() &&
anExtrema.NbExt() == 1)
{
Extrema_POnCurv anExPnts[2];
anExtrema.Points(1, anExPnts[0], anExPnts[1]);
myPreci[0] = 0;
myP3d[0] = anExPnts[1].Value();
myFirstP2d[0].SetCoord(su1, anExPnts[1].Parameter());
myLastP2d[0].SetCoord(su2, anExPnts[1].Parameter());
myFirstPar[0] = su1;
myLastPar[0] = su2;
myUIsoDeg[0] = Standard_False;
myNbDeg = 1;
}
}
else
{
//rln S4135 //:r3
myP3d[0] = myAdSur->Value(su1, 0.5 * (sv1 + sv2));
myFirstP2d[0].SetCoord(su1, sv2);
myLastP2d[0].SetCoord(su1, sv1);
//rln S4135 //:r3
myP3d[0] = myAdSur->Value(su1, 0.5 * (sv1 + sv2));
myFirstP2d[0].SetCoord(su1, sv2);
myLastP2d[0].SetCoord(su1, sv1);
myP3d[1] = myAdSur->Value(su2, 0.5 * (sv1 + sv2));
myFirstP2d[1].SetCoord(su2, sv1);
myLastP2d[1].SetCoord(su2, sv2);
myP3d[1] = myAdSur->Value(su2, 0.5 * (sv1 + sv2));
myFirstP2d[1].SetCoord(su2, sv1);
myLastP2d[1].SetCoord(su2, sv2);
myP3d[2] = myAdSur->Value(0.5 * (su1 + su2), sv1);
myFirstP2d[2].SetCoord(su1, sv1);
myLastP2d[2].SetCoord(su2, sv1);
myP3d[2] = myAdSur->Value(0.5 * (su1 + su2), sv1);
myFirstP2d[2].SetCoord(su1, sv1);
myLastP2d[2].SetCoord(su2, sv1);
myP3d[3] = myAdSur->Value(0.5 * (su1 + su2), sv2);
myFirstP2d[3].SetCoord(su2, sv2);
myLastP2d[3].SetCoord(su1, sv2);
myP3d[3] = myAdSur->Value(0.5 * (su1 + su2), sv2);
myFirstP2d[3].SetCoord(su2, sv2);
myLastP2d[3].SetCoord(su1, sv2);
myFirstPar[0] = myFirstPar[1] = sv1;
myLastPar[0] = myLastPar[1] = sv2;
myUIsoDeg[0] = myUIsoDeg[1] = Standard_True;
myFirstPar[0] = myFirstPar[1] = sv1;
myLastPar[0] = myLastPar[1] = sv2;
myUIsoDeg[0] = myUIsoDeg[1] = Standard_True;
myFirstPar[2] = myFirstPar[3] = su1;
myLastPar[2] = myLastPar[3] = su2;
myUIsoDeg[2] = myUIsoDeg[3] = Standard_False;
myFirstPar[2] = myFirstPar[3] = su1;
myLastPar[2] = myLastPar[3] = su2;
myUIsoDeg[2] = myUIsoDeg[3] = Standard_False;
gp_Pnt Corner1 = myAdSur->Value(su1, sv1);
gp_Pnt Corner2 = myAdSur->Value(su1, sv2);
gp_Pnt Corner3 = myAdSur->Value(su2, sv1);
gp_Pnt Corner4 = myAdSur->Value(su2, sv2);
gp_Pnt Corner1 = myAdSur->Value(su1, sv1);
gp_Pnt Corner2 = myAdSur->Value(su1, sv2);
gp_Pnt Corner3 = myAdSur->Value(su2, sv1);
gp_Pnt Corner4 = myAdSur->Value(su2, sv2);
myPreci[0] = Max(Corner1.Distance(Corner2), Max(myP3d[0].Distance(Corner1), myP3d[0].Distance(Corner2)));
myPreci[1] = Max(Corner3.Distance(Corner4), Max(myP3d[1].Distance(Corner3), myP3d[1].Distance(Corner4)));
myPreci[2] = Max(Corner1.Distance(Corner3), Max(myP3d[2].Distance(Corner1), myP3d[2].Distance(Corner3)));
myPreci[3] = Max(Corner2.Distance(Corner4), Max(myP3d[3].Distance(Corner2), myP3d[3].Distance(Corner4)));
myPreci[0] = Max(Corner1.Distance(Corner2), Max(myP3d[0].Distance(Corner1), myP3d[0].Distance(Corner2)));
myPreci[1] = Max(Corner3.Distance(Corner4), Max(myP3d[1].Distance(Corner3), myP3d[1].Distance(Corner4)));
myPreci[2] = Max(Corner1.Distance(Corner3), Max(myP3d[2].Distance(Corner1), myP3d[2].Distance(Corner3)));
myPreci[3] = Max(Corner2.Distance(Corner4), Max(myP3d[3].Distance(Corner2), myP3d[3].Distance(Corner4)));
myNbDeg = 4;
myNbDeg = 4;
}
}
SortSingularities();
}

View File

@@ -394,12 +394,12 @@ void StdPrs_Isolines::addOnSurface (const Handle(BRepAdaptor_HSurface)& theSurfa
Prs3d_NListOfSequenceOfPnt& theVPolylines)
{
// Choose a deflection for sampling edge uv curves.
Standard_Real aUVLimit = theDrawer->MaximalParameterValue();
Standard_Real aUmin = Max (theSurface->FirstUParameter(), -aUVLimit);
Standard_Real aUmax = Min (theSurface->LastUParameter(), aUVLimit);
Standard_Real aVmin = Max (theSurface->FirstVParameter(), -aUVLimit);
Standard_Real aVmax = Min (theSurface->LastVParameter(), aUVLimit);
Standard_Real aSamplerDeflection = Max (aUmax - aUmin, aVmax - aVmin) * theDrawer->DeviationCoefficient();
const Standard_Real aUVLimit = theDrawer->MaximalParameterValue();
const Standard_Real aUmin = Max (theSurface->FirstUParameter(), -aUVLimit);
const Standard_Real aUmax = Min (theSurface->LastUParameter(), aUVLimit);
const Standard_Real aVmin = Max (theSurface->FirstVParameter(), -aUVLimit);
const Standard_Real aVmax = Min (theSurface->LastVParameter(), aUVLimit);
const Standard_Real aSamplerDeflection = Max (aUmax - aUmin, aVmax - aVmin) * theDrawer->DeviationCoefficient();
Standard_Real aHatchingTolerance = RealLast();
try
@@ -562,12 +562,10 @@ void StdPrs_Isolines::addOnSurface (const Handle(BRepAdaptor_HSurface)& theSurfa
Standard_Real aSegmentP1 = aHatcher.Start (anI, aJ);
Standard_Real aSegmentP2 = aHatcher.End (anI, aJ);
if (!aBSurface.IsNull())
if (aBSurface.IsNull())
{
aBSurfaceCurve.Load (isIsoU ? aBSurface->UIso (anIsoParam) : aBSurface->VIso (anIsoParam));
findLimits (aBSurfaceCurve, aUVLimit, aSegmentP1, aSegmentP2);
aCanonicalCurve.Load (isIsoU ? GeomAbs_IsoU : GeomAbs_IsoV, anIsoParam, aSegmentP1, aSegmentP2);
findLimits (aCanonicalCurve, aUVLimit, aSegmentP1, aSegmentP2);
if (aSegmentP2 - aSegmentP1 <= Precision::Confusion())
{
continue;
@@ -575,17 +573,23 @@ void StdPrs_Isolines::addOnSurface (const Handle(BRepAdaptor_HSurface)& theSurfa
}
else
{
aCanonicalCurve.Load (isIsoU ? GeomAbs_IsoU : GeomAbs_IsoV, anIsoParam, aSegmentP1, aSegmentP2);
findLimits (aCanonicalCurve, aUVLimit, aSegmentP1, aSegmentP2);
if (isIsoU)
{
aBSurfaceCurve.Load (aBSurface->UIso (anIsoParam), aVmin, aVmax);
}
else
{
aBSurfaceCurve.Load (aBSurface->VIso (anIsoParam), aUmin, aUmax);
}
findLimits (aBSurfaceCurve, aUVLimit, aSegmentP1, aSegmentP2);
if (aSegmentP2 - aSegmentP1 <= Precision::Confusion())
{
continue;
}
}
Adaptor3d_Curve* aCurve = aBSurface.IsNull() ? (Adaptor3d_Curve*) &aCanonicalCurve
: (Adaptor3d_Curve*) &aBSurfaceCurve;
Adaptor3d_Curve* aCurve = aBSurface.IsNull()
? (Adaptor3d_Curve*) &aCanonicalCurve
: (Adaptor3d_Curve*) &aBSurfaceCurve;
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
StdPrs_DeflectionCurve::Add (Handle(Prs3d_Presentation)(),

View File

@@ -12859,9 +12859,17 @@ static int VManipulator (Draw_Interpretor& theDi,
aCmd.AddOption ("followDragging", "... {0|1} - set following dragging transform");
aCmd.AddOption ("gap", "... value - set gap between sub-parts");
aCmd.AddOption ("part", "... axis mode {0|1} - set visual part");
aCmd.AddOption ("parts", "... all axes mode {0|1} - set visual part");
aCmd.AddOption ("parts", "... all mode {0|1} - set visual part");
aCmd.AddOption ("angle", "... startAngle endAngle - set arc angle");
aCmd.AddOption ("axisrad", "... radius - set axis radius");
aCmd.AddOption ("arrheadrad", "... radius - set arrow head radius");
aCmd.AddOption ("diskthickness", "... value - set disk thickness");
aCmd.AddOption ("innerrad", "... radius - set axis radius");
aCmd.AddOption ("arrlen", "... len - set axis lenght");
aCmd.AddOption ("arrheadlen", "... len - set length of the arrow tip");
aCmd.AddOption ("dragplanesize", "... size - set size of the drag plane");
aCmd.AddOption ("boxsize", "... size - set size os scaling box");
aCmd.AddOption ("pos", "... x y z [nx ny nz [xx xy xz]] - set position of manipulator");
aCmd.AddOption ("size", "... size - set size of manipulator");
aCmd.AddOption ("zoomable", "... {0|1} - set zoom persistence");
aCmd.Parse (theArgsNb, theArgVec);
@@ -12978,7 +12986,94 @@ static int VManipulator (Draw_Interpretor& theDi,
return 1;
}
aManipulator->SetPart(static_cast<AIS_ManipulatorMode>(aMode), aOnOff);
aManipulator->SetPart (static_cast<AIS_ManipulatorMode>(aMode), aOnOff);
}
if (aCmd.HasOption ("angle", 2, Standard_True))
{
Standard_Integer aStartAngle = aCmd.ArgInt ("angle", 0);
Standard_Integer anEndAngle = aCmd.ArgInt ("angle", 1);
aManipulator->SetArcAngle (Standard_ShortReal (aStartAngle * M_PI / 180.0f),
Standard_ShortReal (anEndAngle * M_PI / 180.0f));
}
if (aCmd.HasOption ("axisrad", 1, Standard_True))
{
Standard_ShortReal aRadius = aCmd.ArgFloat ("axisrad", 0);
if (aRadius <= 0 )
{
Message::SendFail ("Syntax error: radius value should be positive");
return 1;
}
aManipulator->SetAxisRadius (aRadius);
}
if (aCmd.HasOption("arrheadrad", 1, Standard_True))
{
Standard_ShortReal aRadius = aCmd.ArgFloat ("arrheadrad", 0);
if (aRadius <= 0)
{
Message::SendFail("Syntax error: radius value should be positive");
return 1;
}
aManipulator->SetArrowHeadRadius (aRadius);
}
if (aCmd.HasOption("diskthickness", 1, Standard_True))
{
Standard_ShortReal aDiskThickness = aCmd.ArgFloat ("diskthickness", 0);
if (aDiskThickness <= 0)
{
Message::SendFail ("Syntax error: disk thickness value should be positive");
return 1;
}
aManipulator->SetDiskThickness (aDiskThickness);
}
if (aCmd.HasOption("innerrad", 1, Standard_True))
{
Standard_ShortReal anInnerRadius = aCmd.ArgFloat ("innerrad", 0);
if (anInnerRadius <= 0)
{
Message::SendFail ("Syntax error: disk thickness value should be positive");
return 1;
}
aManipulator->SetInnerRadius (anInnerRadius);
}
if (aCmd.HasOption ("arrlen", 1, Standard_True))
{
Standard_ShortReal anArrowLength = aCmd.ArgFloat ("arrlen", 0);
if (anArrowLength <= 0)
{
Message::SendFail ("Syntax error: arrow lenght value should be positive");
return 1;
}
aManipulator->SetArrowLengthFactor (anArrowLength);
}
if (aCmd.HasOption ("arrheadlen", 1, Standard_True))
{
Standard_ShortReal anArrowHeadLength = aCmd.ArgFloat ("arrheadlen", 0);
if (anArrowHeadLength <= 0)
{
Message::SendFail ("Syntax error: arrow head lenght value should be positive");
return 1;
}
aManipulator->SetArrowHeadLength (anArrowHeadLength);
}
if (aCmd.HasOption ("dragplanesize", 1, Standard_True))
{
Standard_ShortReal aDragPlaneSize = aCmd.ArgFloat ("dragplanesize", 0);
if (aDragPlaneSize <= 0)
{
Message::SendFail ("Syntax error: drag plane size should be positive");
return 1;
}
aManipulator->SetDragPlaneSize (aDragPlaneSize);
}
if (aCmd.HasOption ("boxsize", 1, Standard_True))
{
Standard_ShortReal aBoxSize = aCmd.ArgFloat ("boxsize", 0);
if (aBoxSize <= 0)
{
Message::SendFail ("Syntax error: box size should be positive");
return 1;
}
aManipulator->SetBoxSize (aBoxSize);
}
if (aCmd.HasOption ("pos", 3, Standard_True))
{
@@ -12988,18 +13083,13 @@ static int VManipulator (Draw_Interpretor& theDi,
aManipulator->SetPosition (gp_Ax2 (aLocation, aVDir, aXDir));
}
if (aCmd.HasOption ("size", 1, Standard_True))
{
aManipulator->SetSize (aCmd.ArgFloat ("size"));
}
if (aCmd.HasOption ("zoomable", 1, Standard_True))
{
aManipulator->SetZoomPersistence (!aCmd.ArgBool ("zoomable"));
if (ViewerTest::GetAISContext()->IsDisplayed (aManipulator))
{
ViewerTest::GetAISContext()->Remove (aManipulator, Standard_False);
ViewerTest::GetAISContext()->Display (aManipulator, Standard_False);
ViewerTest::GetAISContext()->Redisplay (aManipulator, Standard_False);
}
}
@@ -14929,9 +15019,18 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"\n '-followDragging {0|1}' - set following dragging transform"
"\n '-gap value' - set gap between sub-parts"
"\n '-part axis mode {0|1}' - set visual part"
"\n '-parts axis mode {0|1}' - set visual part"
"\n '-parts mode {0|1}' - set visual part"
"\n '-angle startAngle endAngle' - set arc angle"
"\n '-axisrad radius' - set axis radius"
"\n '-arrheadrad radius' - set arrow head radius"
"\n '-diskthickness value' - set disk thickness"
"\n '-innerrad radius' - set axis radius"
"\n '-arrlen len' - set axis lenght"
"\n '-arrheadlen len' - set length of the arrow tip"
"\n '-dragplanesize size' - set size of the drag plane"
"\n '-boxsize size' - set size os scaling box"
"\n '-pos x y z [nx ny nz [xx xy xz]' - set position of manipulator"
"\n '-size value' - set size of manipulator"
//"\n '-size value' - set size of manipulator"
"\n '-zoomable {0|1}' - set zoom persistence",
__FILE__, VManipulator, group);

View File

@@ -268,7 +268,7 @@ unifysamedom r res
incmesh r 0.1
trinfo r
checktrinfo r -defl 0.1 -tol_abs_defl 0.01 -tol_rel_defl 0.01
checktrinfo r -defl 0.049761016978299343 -tol_abs_defl 0.01 -tol_rel_defl 0.01
vinit
vsetdispmode 1

View File

@@ -14,6 +14,6 @@ vdisplay result
vsetdispmode result 1
vfit
checktrinfo result -tri 2711 -nod 2611
checktrinfo result -tri 2709 -nod 2610
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -20,7 +20,7 @@ regexp {([0-9]+) triangles} $trinfo_r str nbtri_r
# check deflections
checktrinfo s -tri -defl 0.001 -tol_abs_defl 1e-6
checktrinfo s -tri -defl 0.00072921907260989653 -tol_abs_defl 1e-6
checktrinfo r -tri -max_defl 0.001 -tol_abs_defl 1e-6
# compare number of triangles, allow twice more

View File

@@ -10,4 +10,4 @@ restore [locate_data_file bug23105_f372.brep] result
checkshape result
incmesh result 0.1
checktrinfo result -tri -defl 0.1 -tol_abs_defl 1e-6
checktrinfo result -tri -defl 1.6315061764065284 -tol_abs_defl 1e-6

View File

@@ -12,7 +12,7 @@ vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri 323820 -nod 161951 -defl 0.00096399964870812682
checktrinfo result -tri 323820 -nod 161951 -defl 0.01006437767331419 -tol_abs_defl 1e-6
set log [tricheck result]
if { [llength $log] != 0 } {

View File

@@ -14,7 +14,7 @@ incmesh f 1
trinfo f
checktrinfo f -tri 20 -nod 21 -defl 0.3345840532742983 -tol_abs_defl 1.e-3 -tol_rel_defl 0.01
checktrinfo f -tri 20 -nod 21 -defl 0.70238336519888955 -tol_abs_defl 1.e-3 -tol_rel_defl 0.01
vinit
vdisplay f

View File

@@ -10,7 +10,7 @@ restore [locate_data_file bug24938_27773.brep] result
tclean result
incmesh result 1.5 -relative
checktrinfo result -tri 8 -nod 10 -defl 3.1950444624834377e-05
checktrinfo result -tri 8 -nod 10 -defl 3.3489133970888776e-05 -tol_abs_defl 1e-6
vinit
vsetdispmode 1

View File

@@ -14,7 +14,7 @@ vviewparams -scale 1.81755 -proj 0.88572 0.104526 0.452299 -up -0.0339444 0.9862
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri 957 -nod 558 -defl 50.000000020000009
checktrinfo result -tri 957 -nod 558 -defl 1.1088499641289298 -tol_abs_defl 1e-6
set log [tricheck result]
if { [llength $log] != 0 } {

View File

@@ -11,7 +11,7 @@ renamevar a_1 result
incmesh result 0.0001 -a 30 -force_face_def -parallel
checktrinfo result -tri 13854 -nod 9190 -defl 0.00012495021746395917
checktrinfo result -tri 13854 -nod 9190 -defl 0.00028360162213471898 -tol_abs_defl 1e-6
vinit
vsetdispmode 1

View File

@@ -10,10 +10,10 @@ puts "===> meshing segment of sphere"
psphere a 100 -45 45 180
puts ""
puts "incmesh first time"
set t1 [expr [lindex [time {incmesh a 0.003}] 0]/1000000]
set t1 [expr [lindex [time {incmesh a 0.003 -a 1}] 0]/1000000]
puts "spent $t1 sec"
puts ""
puts "incmesh second time"
set t2 [expr [lindex [time {incmesh a 0.003}] 0]/1000000]
set t2 [expr [lindex [time {incmesh a 0.003 -a 1}] 0]/1000000]
puts "spent $t2 sec"
if {$t2 != 0} {puts "Error: second time must be quicker"}

View File

@@ -8,11 +8,11 @@ puts "===> meshing full sphere"
psphere a 100
puts ""
puts "incmesh first time"
set t3 [expr [lindex [time {incmesh a 0.015}] 0]/1000000]
set t3 [expr [lindex [time {incmesh a 0.015 -a 1}] 0]/1000000]
puts "spent $t3 sec"
puts ""
puts "incmesh second time"
set t4 [expr [lindex [time {incmesh a 0.015}] 0]/1000000]
set t4 [expr [lindex [time {incmesh a 0.015 -a 1}] 0]/1000000]
puts "spent $t4 sec"
if {$t4 != 0} {puts "Error: second time must be quicker"}
puts ""

View File

@@ -15,5 +15,5 @@ fit
isos a 0
triangles a
checktrinfo a -tri 2971 -nod 1592 -defl 0.091190343620839553 -tol_rel_defl 0.05 -tol_rel_tri 0.05 -tol_rel_nod 0.05
checktrinfo a -tri 2971 -nod 1592 -defl 0.25443792426360728 -tol_rel_defl 0.05 -tol_rel_tri 0.05 -tol_rel_nod 0.05
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -15,7 +15,7 @@ incmesh f 0.01 -a 90
isos f 0
triangles f
checktrinfo f -tri 2220 -nod 1232 -defl 0.0093553610383019445
checktrinfo f -tri 2220 -nod 1232 -defl 0.0099011902071009586 -tol_abs_defl 1e-6
smallview +X+Y
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -14,7 +14,7 @@ vdisplay result
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri 3006 -nod 4360 -defl 10
checktrinfo result -tri 3006 -nod 4360 -defl 3.0544822246414993 -tol_abs_defl 1e-6
set log [tricheck result]
if { [llength $log] != 0 } {

View File

@@ -7,7 +7,7 @@ restore [locate_data_file bug29149.brep] result
tclean result
incmesh result 0.1
checktrinfo result -tri 7998 -nod 4931 -defl 1.2277233425620309
checktrinfo result -tri 7998 -nod 4931 -defl 1.9852316024615062 -tol_abs_defl 1e-6
# Reduce shape tolerance in order to hard check of mesh quality
settolerance result 1.0e-7

View File

@@ -14,7 +14,7 @@ vviewparams -scale 67.9853 -proj 0.680425 -0.732509 -0.0212714 -up -0.0316277 -0
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri 8 -nod 10 -defl 6.8481042509220045e-05
checktrinfo result -tri 8 -nod 10 -defl 0.16816650423537197 -tol_abs_defl 1e-6
set log [tricheck result]
if { [llength $log] != 0 } {

View File

@@ -16,6 +16,6 @@ if { [llength $log] != 0 } {
puts "Mesh is OK"
}
checktrinfo result -tri 148 -nod 103 -defl 0.27179801813852145
checktrinfo result -tri 148 -nod 103 -defl 0.34778084099529977 -tol_abs_defl 1e-6
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -25,6 +25,6 @@ if { [llength $log] != 0 } {
puts "Mesh is OK"
}
checktrinfo result -tri 1013 -nod 578 -defl 0.1
checktrinfo result -tri 1013 -nod 578 -defl 0.1164052220738387 -tol_abs_defl 1e-6
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -15,7 +15,7 @@ if { [llength $log1] != 0 } {
puts "Mesh is OK"
}
checktrinfo result -tri 2 -nod 4 -defl 0.0
checktrinfo result -tri 2 -nod 4 -defl 5.5579174982152475 -tol_abs_defl 1e-6
tclean result
incmesh result 0.01
@@ -27,7 +27,7 @@ if { [llength $log2] != 0 } {
puts "Mesh is OK"
}
checktrinfo result -tri 78200 -nod 39103 -defl 0.035123046705520911
checktrinfo result -tri 78200 -nod 39103 -defl 5.8003351598212323 -tol_abs_defl 1e-6
don result
isos result 0

View File

@@ -12,6 +12,6 @@ vdisplay result
vviewparams -scale 8.46292 -proj 0.653203 -0.644806 0.396926 -up -0.0109833 0.51609 0.856464 -at 347.559 1026.89 219.262 -eye 2080.75 -684.022 1272.45
tricheck result
checktrinfo result -tri 11826 -nod 7310 -defl 7.6167024939147652
checktrinfo result -tri 11826 -nod 7310 -defl 8.4394056682382157 -tol_abs_defl 1e-6
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -19,7 +19,7 @@ nurbsconvert result result
incmesh result 0.15 -a 20
tricheck result
checktrinfo result -tri 191 -nod 146 -defl 0.0362596 -tol_abs_defl 1.0e-6
checktrinfo result -tri 191 -nod 146 -defl 0.052300780129031083 -tol_abs_defl 1.0e-6
vinit

View File

@@ -12,6 +12,6 @@ vdisplay result
vfit
tricheck result
checktrinfo result -tri 3424 -nod 1801 -max_defl 0.52
checktrinfo result -tri 3424 -nod 1801 -max_defl 0.55846824898476011 -tol_abs_defl 1.0e-6
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -15,7 +15,7 @@ vdefaults -autoTriang 0
tclean result
incmesh result 0.004 -a 14
checktrinfo result -tri 70560 -nod 39946 -defl 0.22962869401103247
checktrinfo result -tri 70560 -nod 39946 -defl 0.24607185555570676 -tol_abs_defl 1e-6
vdisplay result -redisplay
vfit
@@ -23,7 +23,7 @@ checkview -screenshot -3d -path ${imagedir}/${test_image}_default.png
tclean result
incmesh result 0.004 -a 14 -force_face_def
checktrinfo result -tri 292560 -nod 150946 -defl 0.04579460790575135
checktrinfo result -tri 292560 -nod 150946 -defl 0.16388671063364907 -tol_abs_defl 1e-6
vdisplay result -redisplay
vfit

17
tests/bugs/mesh/bug32471 Normal file
View File

@@ -0,0 +1,17 @@
puts "======="
puts "0032471: Mesh - Deflection of the triangulation is not recomputed for planar face"
puts "======="
puts ""
restore [locate_data_file bug32471.brep] result
incmesh result 0.01
checktrinfo result -tri 2 -nod 4 -defl 0 -tol_rel_defl 1e-7
vinit
vdefaults -autoTriang 0
vsetdispmode 1
vdisplay result
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

17
tests/bugs/mesh/bug33060 Normal file
View File

@@ -0,0 +1,17 @@
puts "========"
puts "0033060: Mesh - Sub-precisional links provoke failure 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"
}

View File

@@ -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 {

View File

@@ -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"
}

View File

@@ -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

View File

@@ -0,0 +1,22 @@
puts "================================================="
puts "OCC32644: Modeling Algorithms - Empty result of section operation"
puts "================================================="
puts ""
restore [locate_data_file bug32644_face.brep] f
restore [locate_data_file bug32644_wire.brep] w
bclearobjects
bcleartools
baddobjects f
baddtools w
bfillds
bbop result 4
checkprops result -l 2.06
checksection result -r 2
checknbshapes result -edge 2
bsplit rsplit
checkshape rsplit
checknbshapes rsplit -face 2

View File

@@ -0,0 +1,14 @@
puts "================================"
puts " 0033515: Modeling Algorithm - BRepExtrema_DistShapeShape poduces wrong result"
puts "================================"
restore [locate_data_file bug33515_w1.brep] w1
restore [locate_data_file bug33515_w2.brep] w2
distmini d w1 w2
set dist [dval d_val]
if { $dist < 3.e-10 } {
puts "OK: Extrema is valid"
} else {
puts "Error: Extrema distance is too big"
}

View File

@@ -14,5 +14,5 @@ tclean result
set Deflection 1.
catch {incmesh result ${Deflection} }
checktrinfo result -tri 52956 -nod 46525 -defl 1.0 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checktrinfo result -tri 52956 -nod 46525 -defl 1.2592398118022043 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -15,7 +15,7 @@ tclean result
set Deflection 0.1
catch {incmesh result ${Deflection} }
checktrinfo result -tri 4204 -nod 4206 -defl 1.9388020580310417e-07 -tol_rel_defl 0.1 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checktrinfo result -tri 4204 -nod 4206 -defl 2.3419011146460291e-07 -tol_rel_defl 0.1 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checkprops result -s 275.426
checknbshapes result -vertex 964 -edge 964 -wire 1 -face 1 -shell 1 -solid 0 -compsolid 0 -compound 0 -shape 1931

View File

@@ -19,7 +19,7 @@ tclean result
set Deflection 0.001
incmesh result ${Deflection}
checktrinfo result -tri 375392 -nod 190670 -defl 0.0092442421472206764 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checktrinfo result -tri 375392 -nod 190670 -defl 0.080199363667810539 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
vinit
vdisplay result

View File

@@ -19,5 +19,5 @@ isos result 0
triangles result
fit
checktrinfo result -tri 10924 -nod 7869
checktrinfo result -tri 10929 -nod 7874
checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png

View File

@@ -10,7 +10,7 @@ bsplinesurf s 2 12 0.0 3 0.1 1 0.2 1 0.3 1 0.4 1 0.5 1 0.525 1 0.55 1 0.575 1 0.
mkface result s
incmesh result 1
checktrinfo result -max_defl 1
checktrinfo result -max_defl 2.4039063417856825 -tol_abs_defl 1e-6
vdisplay result
vsetdispmode 1

View File

@@ -0,0 +1,35 @@
puts "==========================================================="
puts "0033828: Modeling Data - GCPnts_QuasiUniformDeflection"
puts "returns very different results under small change in deflection"
puts "==========================================================="
proc check_crvpoints {cc deflection nb_expected} {
upvar ${cc} ${cc}
set str1 "Nb points +: +(\[-0-9.+eE\]+)\n"
set str2 "Max defl: +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
set info [crvpoints r ${cc} ${deflection}]
regexp "${str1}${str2}" ${info} full Nb dmax ufmax ulmax i
if { ${Nb} != ${nb_expected} } {
puts "Error : bad value of Nb points = ${Nb}, expected ${nb_expected}"
}
if { ${dmax} > ${deflection} } {
puts "Error : bad value of maximum deflection = ${dmax}, expected < ${deflection}"
}
}
bsplinecurve cu 3 7 0 4 0.17 2 0.33 2 0.5 2 0.67 2 0.83 2 1 4 0.163 0.233 0 1 0.158 0.204 0 1 0.139 0.180 0 1 0.086 0.159 0 1 0.055 0.163 0 1 0.009 0.196 0 1 -0.004 0.225 0 1 0.002 0.281 0 1 0.019 0.307 0 1 0.070 0.332 0 1 0.101 0.331 0 1 0.149 0.301 0 1 0.164 0.274 0 1 0.163 0.246 0 1
check_crvpoints cu .5 2
check_crvpoints cu .1 3
check_crvpoints cu .05 5
check_crvpoints cu .025 5
check_crvpoints cu .007 9
check_crvpoints cu .005 17
check_crvpoints cu .0005 33
check_crvpoints cu .0003 65
check_crvpoints cu .0002 65
check_crvpoints cu .0001 73

View File

@@ -6,6 +6,10 @@ vinit
BUC60857
vfit
sewing BUC60857_BLUE 1e-7 BUC60857_BLUE
sewing BUC60857_RED 1e-7 BUC60857_RED
sewing BUC60857_GREEN 1e-7 BUC60857_GREEN
set Property_BLUE [sprops BUC60857_BLUE]
set area_BLUE [lindex ${Property_BLUE} 2]

View File

@@ -18,11 +18,12 @@ mkcurve c2 e2
set info [extrema c1 c2]
# Check result
regexp {Extrema 1 is point : +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $info full x y z
# Point check
set good_x 0.0
set good_y 0.070710562195021642
set good_z -0.65305318986891325
checkreal "Intersection point x:" ${x} ${good_x} 0.01 0.01
checkreal "Intersection point y:" ${y} ${good_y} 0.01 0.01
checkreal "Intersection point z:" ${z} ${good_z} 0.01 0.01
if {[regexp "ext_1" $info]} {
set dist [lindex [length ext_1] end]
if { $dist > 1.0e-10 } {
puts "Error: Extrema distance is too big"
}
} else {
puts "Error: Extrema is not found"
}

View File

@@ -0,0 +1,36 @@
puts "========"
puts "OCC32882: Modeling Data - Extrema curve/curve cannot find all solutions"
puts "========"
puts ""
# Read input
restore [locate_data_file bug32882.brep] cc
explode cc
# Extract geometry from topology
mkcurve c1 cc_1
mkcurve c2 cc_2
mkcurve c3 cc_3
# Run extrema c1/c3
set info [extrema c1 c3]
# Check number of solution
if { [llength $info] != 3 } {
puts "Error: Invalid extrema number in extrema c1-c3 output"
}
# Check result
checklength ext_1 -l 2.929642751e-14 -eps .01
checklength ext_2 -l 3.480934286e-14 -eps .01
checklength ext_3 -l 2.929642751054232-14 -eps .01
# Run extrema c3/c2
set info [extrema c3 c2]
# Check number of solutions
if { [llength $info] != 2 } {
puts "Error: Invalid extrema number in extrema c3-c2 output"
}
checklength ext_1 -l 5.684341886e-14 -eps .01
checklength ext_2 -l 2.929642751e-14 -eps .01

View File

@@ -9,7 +9,7 @@ dchrono t restart
incmesh result 0.1
dchrono t stop counter MeshBug23795
checktrinfo result -tri 10992 -nod 11016 -defl 0.1
checktrinfo result -tri 10992 -nod 11016 -defl 0.99900001814148409 -tol_abs_defl 1e-6
vinit
vdefaults -autoTriang 0

View File

@@ -11,7 +11,7 @@ dchrono t restart
incmesh a_1 0.01 1
dchrono t stop counter incmesh
checktrinfo a_1 -tri 743149 -nod 372395 -defl 0.081028355715069861
checktrinfo a_1 -tri 743149 -nod 372395 -defl 0.069482224632795617 -tol_abs_defl 1e-6
set log [tricheck a_1]
if { [llength $log] != 0 } {

View File

@@ -11,7 +11,7 @@ dchrono t restart
incmesh a_1 0.1 1
dchrono t stop counter incmesh
checktrinfo a_1 -tri 182273 -nod 91484 -defl 0.11671770612283024
checktrinfo a_1 -tri 182273 -nod 91484 -defl 0.24900556935704937 -tol_abs_defl 1e-6
set log [tricheck a_1]
if { [llength $log] != 0 } {

View File

@@ -11,7 +11,7 @@ dchrono t restart
incmesh a_1 1.0 1
dchrono t stop counter incmesh
checktrinfo a_1 -tri 73119 -nod 36828 -defl 1.0
checktrinfo a_1 -tri 73119 -nod 36828 -defl 1.2783003174746328 -tol_abs_defl 1e-6
set log [tricheck a_1]
if { [llength $log] != 0 } {

View File

@@ -16,4 +16,4 @@ dchrono h
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo a -tri 217070 -nod 108740 -defl 0.098772787476728782
checktrinfo a -tri 217070 -nod 108740 -defl 0.29573935005082458 -tol_abs_defl 1e-6

View File

@@ -25,7 +25,7 @@ regexp { deflection +([-0-9.+eE]+)} $tri_info full def
set ref_tri 7857
set ref_nod 7859
set ref_def 1e-5
set ref_def 1.5252689837551246e-12
set tol_rel 0.01
# Computes deviation of the value from specified one