mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
21 Commits
CR30010
...
CR30120_tm
Author | SHA1 | Date | |
---|---|---|---|
|
cdc3736aa6 | ||
|
4a056d205b | ||
|
477000eb31 | ||
|
e2a47b0cd2 | ||
|
65bb82f241 | ||
|
2382618330 | ||
|
343f7e4d34 | ||
|
cdcb6655e7 | ||
|
47ba172e98 | ||
|
e121dd4d58 | ||
|
7c5f7e3e04 | ||
|
c16c60a402 | ||
|
170175554f | ||
|
c348746059 | ||
|
b11aef43d4 | ||
|
4a3610588f | ||
|
31e8d3c185 | ||
|
6487fb1c9c | ||
|
94783b5111 | ||
|
39b7b2a465 | ||
|
73a7509fde |
@@ -1608,3 +1608,11 @@ so that related methods have been removed from AIS_InteractiveContext interface:
|
|||||||
|
|
||||||
A set of deprecated methods previously related to Local Context and now redirecting to other methods has been preserved to simplify porting; they will be removed in next release.
|
A set of deprecated methods previously related to Local Context and now redirecting to other methods has been preserved to simplify porting; they will be removed in next release.
|
||||||
|
|
||||||
|
@subsection upgrade_740_geomconvert Changes in behavior of Convert algorithms
|
||||||
|
|
||||||
|
Now methods *GeomConvert::ConcatG1*, *GeomConvert::ConcatC1*, *Geom2dConvert::ConcatG1*, *Geom2dConvert::ConcatC1* modify the input argument representing the flag of closedness.
|
||||||
|
|
||||||
|
@subsection upgrade_740_selection Changes in selection API and picked point calculation algorithm.
|
||||||
|
|
||||||
|
*SelectBasics_PickResult* structure has been extended, so that it now defines 3D point on detected entity in addition to Depth value along picking ray.
|
||||||
|
*SelectMgr_SelectingVolumeManager::Overlap()* methods have been corrected to fill in *SelectBasics_PickResult* structure (depth and 3D point) instead of only depth value, so that custom *Select3D_SensitiveEntity* implementation should be updated accordingly (including *Select3D_SensitiveSet* subclasses).
|
||||||
|
@@ -55,6 +55,68 @@ namespace
|
|||||||
}
|
}
|
||||||
throw Standard_ProgramError ("AIS_Manipulator - Invalid axis index");
|
throw Standard_ProgramError ("AIS_Manipulator - Invalid axis index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Auxiliary tool for filtering picking ray.
|
||||||
|
class ManipSensRotation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Main constructor.
|
||||||
|
ManipSensRotation (const gp_Dir& thePlaneNormal) : myPlaneNormal (thePlaneNormal), myAngleTol (10.0 * M_PI / 180.0) {}
|
||||||
|
|
||||||
|
//! Checks if picking ray can be used for detection.
|
||||||
|
Standard_Boolean isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const
|
||||||
|
{
|
||||||
|
if (theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gp_Vec aRay (theMgr.GetNearPickedPnt(), theMgr.GetFarPickedPnt());
|
||||||
|
return !aRay.IsNormal (myPlaneNormal, myAngleTol);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
gp_Dir myPlaneNormal;
|
||||||
|
Standard_Real myAngleTol;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Sensitive circle with filtering picking ray.
|
||||||
|
class ManipSensCircle : public Select3D_SensitiveCircle, public ManipSensRotation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Main constructor.
|
||||||
|
ManipSensCircle (const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||||
|
const Handle(Geom_Circle)& theCircle,
|
||||||
|
const Standard_Integer theNbPnts)
|
||||||
|
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False, theNbPnts),
|
||||||
|
ManipSensRotation (theCircle->Position().Direction()) {}
|
||||||
|
|
||||||
|
//! Checks whether the circle overlaps current selecting volume
|
||||||
|
virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
|
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
return isValidRay (theMgr)
|
||||||
|
&& Select3D_SensitiveCircle::Matches (theMgr, thePickResult);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Sensitive triangulation with filtering picking ray.
|
||||||
|
class ManipSensTriangulation : public Select3D_SensitiveTriangulation, public ManipSensRotation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ManipSensTriangulation (const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||||
|
const Handle(Poly_Triangulation)& theTrg,
|
||||||
|
const gp_Dir& thePlaneNormal)
|
||||||
|
: Select3D_SensitiveTriangulation (theOwnerId, theTrg, TopLoc_Location(), Standard_True),
|
||||||
|
ManipSensRotation (thePlaneNormal) {}
|
||||||
|
|
||||||
|
//! Checks whether the circle overlaps current selecting volume
|
||||||
|
virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
|
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
return isValidRay (theMgr)
|
||||||
|
&& Select3D_SensitiveTriangulation::Matches (theMgr, thePickResult);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -961,11 +1023,11 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
|||||||
}
|
}
|
||||||
// define sensitivity by circle
|
// define sensitivity by circle
|
||||||
Handle(Geom_Circle) aGeomCircle = new Geom_Circle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
Handle(Geom_Circle) aGeomCircle = new Geom_Circle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||||
Handle(Select3D_SensitiveCircle) aCircle = new Select3D_SensitiveCircle (anOwner, aGeomCircle, Standard_False, anAxis.FacettesNumber());
|
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, anAxis.FacettesNumber());
|
||||||
aCircle->SetSensitivityFactor (15);
|
aCircle->SetSensitivityFactor (15);
|
||||||
theSelection->Add (aCircle);
|
theSelection->Add (aCircle);
|
||||||
// enlarge sensitivity by triangulation
|
// enlarge sensitivity by triangulation
|
||||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), TopLoc_Location(), Standard_True);
|
Handle(Select3D_SensitiveTriangulation) aTri = new ManipSensTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
|
||||||
theSelection->Add (aTri);
|
theSelection->Add (aTri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,8 +32,140 @@
|
|||||||
#include <SelectMgr_Selection.hxx>
|
#include <SelectMgr_Selection.hxx>
|
||||||
#include <StdPrs_BndBox.hxx>
|
#include <StdPrs_BndBox.hxx>
|
||||||
|
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloudOwner, SelectMgr_EntityOwner)
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloud, AIS_InteractiveObject)
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloud,AIS_InteractiveObject)
|
//=======================================================================
|
||||||
|
//function : AIS_PointCloudOwner
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
AIS_PointCloudOwner::AIS_PointCloudOwner (const Handle(AIS_PointCloud)& theOrigin)
|
||||||
|
: SelectMgr_EntityOwner ((const Handle(SelectMgr_SelectableObject)& )theOrigin, 5),
|
||||||
|
myDetPoints (new TColStd_HPackedMapOfInteger()),
|
||||||
|
mySelPoints (new TColStd_HPackedMapOfInteger())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : ~AIS_PointCloudOwner
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
AIS_PointCloudOwner::~AIS_PointCloudOwner()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : HilightWithColor
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean AIS_PointCloudOwner::IsForcedHilight() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : HilightWithColor
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_PointCloudOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||||
|
const Handle(Prs3d_Drawer)& theStyle,
|
||||||
|
const Standard_Integer )
|
||||||
|
{
|
||||||
|
Handle(AIS_PointCloud) anObj = Handle(AIS_PointCloud)::DownCast (Selectable());
|
||||||
|
if (anObj.IsNull())
|
||||||
|
{
|
||||||
|
throw Standard_ProgramError ("Internal Error within AIS_PointCloud::PointsOwner!");
|
||||||
|
}
|
||||||
|
|
||||||
|
const Handle(TColStd_HPackedMapOfInteger)& aMap = thePrsMgr->IsImmediateModeOn()
|
||||||
|
? myDetPoints
|
||||||
|
: mySelPoints;
|
||||||
|
Handle(Prs3d_Presentation) aPrs = thePrsMgr->IsImmediateModeOn()
|
||||||
|
? anObj->GetHilightPresentation(thePrsMgr)
|
||||||
|
: anObj->GetSelectPresentation (thePrsMgr);
|
||||||
|
const Graphic3d_ZLayerId aZLayer = theStyle->ZLayer() != -1
|
||||||
|
? theStyle->ZLayer()
|
||||||
|
: (thePrsMgr->IsImmediateModeOn() ? Graphic3d_ZLayerId_Top : anObj->ZLayer());
|
||||||
|
aMap->ChangeMap().Clear();
|
||||||
|
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
|
||||||
|
{
|
||||||
|
const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
|
||||||
|
for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
|
||||||
|
{
|
||||||
|
const Handle(SelectMgr_SensitiveEntity)& aSelEnt = aSelEntIter.Value();
|
||||||
|
if (aSelEnt->BaseSensitive()->OwnerId() == this)
|
||||||
|
{
|
||||||
|
if (Handle(Select3D_SensitivePrimitiveArray) aSensitive = Handle(Select3D_SensitivePrimitiveArray)::DownCast (aSelEnt->BaseSensitive()))
|
||||||
|
{
|
||||||
|
aMap->ChangeMap() = aSensitive->LastDetectedElementMap()->Map();
|
||||||
|
if (aSensitive->LastDetectedElement() != -1)
|
||||||
|
{
|
||||||
|
aMap->ChangeMap().Add (aSensitive->LastDetectedElement());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aPrs->Clear();
|
||||||
|
if (aPrs->GetZLayer() != aZLayer)
|
||||||
|
{
|
||||||
|
aPrs->SetZLayer (aZLayer);
|
||||||
|
}
|
||||||
|
if (aMap->Map().IsEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Handle(Graphic3d_ArrayOfPoints) anAllPoints = anObj->GetPoints();
|
||||||
|
if (anAllPoints.IsNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(Graphic3d_ArrayOfPoints) aPoints = new Graphic3d_ArrayOfPoints (aMap->Map().Extent());
|
||||||
|
for (TColStd_PackedMapOfInteger::Iterator aPntIter (aMap->Map()); aPntIter.More(); aPntIter.Next())
|
||||||
|
{
|
||||||
|
const gp_Pnt aPnt = anAllPoints->Vertice (aPntIter.Key() + 1);
|
||||||
|
aPoints->AddVertex (aPnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
|
||||||
|
aGroup->SetGroupPrimitivesAspect (theStyle->PointAspect()->Aspect());
|
||||||
|
aGroup->AddPrimitiveArray (aPoints);
|
||||||
|
if (thePrsMgr->IsImmediateModeOn())
|
||||||
|
{
|
||||||
|
thePrsMgr->AddToImmediateList (aPrs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aPrs->Display();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Unhilight
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_PointCloudOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& , const Standard_Integer )
|
||||||
|
{
|
||||||
|
if (Handle(Prs3d_Presentation) aPrs = Selectable()->GetSelectPresentation (Handle(PrsMgr_PresentationManager3d)()))
|
||||||
|
{
|
||||||
|
aPrs->Erase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Clear
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_PointCloudOwner::Clear (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode)
|
||||||
|
{
|
||||||
|
SelectMgr_EntityOwner::Clear (thePrsMgr, theMode);
|
||||||
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// Function: AIS_PointCloud
|
// Function: AIS_PointCloud
|
||||||
@@ -46,6 +178,8 @@ AIS_PointCloud::AIS_PointCloud()
|
|||||||
|
|
||||||
SetDisplayMode (AIS_PointCloud::DM_Points);
|
SetDisplayMode (AIS_PointCloud::DM_Points);
|
||||||
SetHilightMode (AIS_PointCloud::DM_BndBox);
|
SetHilightMode (AIS_PointCloud::DM_BndBox);
|
||||||
|
|
||||||
|
myDynHilightDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_CYAN1, 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -432,14 +566,22 @@ void AIS_PointCloud::ComputeSelection (const Handle(SelectMgr_Selection)& theSel
|
|||||||
switch (theMode)
|
switch (theMode)
|
||||||
{
|
{
|
||||||
case SM_Points:
|
case SM_Points:
|
||||||
|
case SM_SubsetOfPoints:
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_ArrayOfPoints) aPoints = GetPoints();
|
const Handle(Graphic3d_ArrayOfPoints) aPoints = GetPoints();
|
||||||
if (!aPoints.IsNull()
|
if (!aPoints.IsNull()
|
||||||
&& !aPoints->Attributes().IsNull())
|
&& !aPoints->Attributes().IsNull())
|
||||||
{
|
{
|
||||||
|
if (theMode == SM_SubsetOfPoints)
|
||||||
|
{
|
||||||
|
anOwner = new AIS_PointCloudOwner (this);
|
||||||
|
}
|
||||||
|
|
||||||
// split large point clouds into several groups
|
// split large point clouds into several groups
|
||||||
const Standard_Integer aNbGroups = aPoints->Attributes()->NbElements > 500000 ? 8 : 1;
|
const Standard_Integer aNbGroups = aPoints->Attributes()->NbElements > 500000 ? 8 : 1;
|
||||||
Handle(Select3D_SensitivePrimitiveArray) aSensitive = new Select3D_SensitivePrimitiveArray (anOwner);
|
Handle(Select3D_SensitivePrimitiveArray) aSensitive = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||||
|
aSensitive->SetDetectElements (true);
|
||||||
|
aSensitive->SetDetectElementMap (theMode == SM_SubsetOfPoints);
|
||||||
aSensitive->SetSensitivityFactor (8);
|
aSensitive->SetSensitivityFactor (8);
|
||||||
aSensitive->InitPoints (aPoints->Attributes(), aPoints->Indices(), TopLoc_Location(), true, aNbGroups);
|
aSensitive->InitPoints (aPoints->Attributes(), aPoints->Indices(), TopLoc_Location(), true, aNbGroups);
|
||||||
aSensitive->BVH();
|
aSensitive->BVH();
|
||||||
|
@@ -21,14 +21,11 @@
|
|||||||
#include <Bnd_Box.hxx>
|
#include <Bnd_Box.hxx>
|
||||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||||
#include <Quantity_HArray1OfColor.hxx>
|
#include <Quantity_HArray1OfColor.hxx>
|
||||||
#include <Standard.hxx>
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
#include <Standard_Macro.hxx>
|
|
||||||
#include <TColgp_HArray1OfDir.hxx>
|
#include <TColgp_HArray1OfDir.hxx>
|
||||||
#include <TColgp_HArray1OfPnt.hxx>
|
#include <TColgp_HArray1OfPnt.hxx>
|
||||||
|
|
||||||
class AIS_PointCloud;
|
class TColStd_HPackedMapOfInteger;
|
||||||
DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject)
|
|
||||||
|
|
||||||
//! Interactive object for set of points.
|
//! Interactive object for set of points.
|
||||||
//! The presentation supports two display modes:
|
//! The presentation supports two display modes:
|
||||||
@@ -43,7 +40,7 @@ DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject)
|
|||||||
//! hilight mode, e.g. 100);
|
//! hilight mode, e.g. 100);
|
||||||
class AIS_PointCloud : public AIS_InteractiveObject
|
class AIS_PointCloud : public AIS_InteractiveObject
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(AIS_PointCloud, AIS_InteractiveObject)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Display modes supported by this Point Cloud object
|
//! Display modes supported by this Point Cloud object
|
||||||
@@ -56,8 +53,9 @@ public:
|
|||||||
//! Selection modes supported by this Point Cloud object
|
//! Selection modes supported by this Point Cloud object
|
||||||
enum SelectionMode
|
enum SelectionMode
|
||||||
{
|
{
|
||||||
SM_Points = 0, //!< detected by points
|
SM_Points = 0, //!< detected by points
|
||||||
SM_BndBox = 2 //!< detected by bounding box
|
SM_SubsetOfPoints = 1, //!< detect point(s) within Point Cloud rather than object as whole
|
||||||
|
SM_BndBox = 2, //!< detected by bounding box
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -121,10 +119,45 @@ private:
|
|||||||
Handle(Graphic3d_ArrayOfPoints) myPoints; //!< points array for presentation
|
Handle(Graphic3d_ArrayOfPoints) myPoints; //!< points array for presentation
|
||||||
Bnd_Box myBndBox; //!< bounding box for presentation
|
Bnd_Box myBndBox; //!< bounding box for presentation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject)
|
||||||
|
|
||||||
|
//! Custom owner for highlighting selected points.
|
||||||
|
class AIS_PointCloudOwner : public SelectMgr_EntityOwner
|
||||||
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(AIS_PointCloudOwner, SelectMgr_EntityOwner)
|
||||||
public:
|
public:
|
||||||
|
//! Main constructor.
|
||||||
|
Standard_EXPORT AIS_PointCloudOwner (const Handle(AIS_PointCloud)& theOrigin);
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(AIS_PointCloud,AIS_InteractiveObject)
|
//! Destructor.
|
||||||
|
Standard_EXPORT virtual ~AIS_PointCloudOwner();
|
||||||
|
|
||||||
|
//! Return selected points.
|
||||||
|
//! WARNING! Indexation starts with 0 (shifted by -1 comparing to Graphic3d_ArrayOfPoints::Vertice()).
|
||||||
|
const Handle(TColStd_HPackedMapOfInteger)& SelectedPoints() const { return mySelPoints; }
|
||||||
|
|
||||||
|
//! Return last detected points.
|
||||||
|
//! WARNING! Indexation starts with 0 (shifted by -1 comparing to Graphic3d_ArrayOfPoints::Vertice()).
|
||||||
|
const Handle(TColStd_HPackedMapOfInteger)& DetectedPoints() const { return myDetPoints; }
|
||||||
|
|
||||||
|
//! Always update dynamic highlighting.
|
||||||
|
Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Handle dynamic highlighting.
|
||||||
|
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||||
|
const Handle(Prs3d_Drawer)& theStyle,
|
||||||
|
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Removes highlighting.
|
||||||
|
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Clears presentation.
|
||||||
|
Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||||
|
protected:
|
||||||
|
Handle(TColStd_HPackedMapOfInteger) myDetPoints; //!< last detected points
|
||||||
|
Handle(TColStd_HPackedMapOfInteger) mySelPoints; //!< selected points
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _AIS_PointCloud_HeaderFile
|
#endif // _AIS_PointCloud_HeaderFile
|
||||||
|
@@ -399,7 +399,46 @@ void BOPAlgo_PaveFiller::PerformEE()
|
|||||||
aTolVnew = aTolMin;
|
aTolVnew = aTolMin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// <-LXBR
|
||||||
|
{
|
||||||
|
Standard_Integer nVS[2], iFound;
|
||||||
|
Standard_Real aTolVx, aD2, aDT2;
|
||||||
|
TColStd_MapOfInteger aMV;
|
||||||
|
gp_Pnt aPx;
|
||||||
|
//
|
||||||
|
iFound=0;
|
||||||
|
j=-1;
|
||||||
|
aMV.Add(nV[0]);
|
||||||
|
aMV.Add(nV[1]);
|
||||||
|
//
|
||||||
|
if (aMV.Contains(nV[2])) {
|
||||||
|
++j;
|
||||||
|
nVS[j]=nV[2];
|
||||||
|
}
|
||||||
|
if (aMV.Contains(nV[3])) {
|
||||||
|
++j;
|
||||||
|
nVS[j]=nV[3];
|
||||||
|
}
|
||||||
|
//
|
||||||
|
for (Standard_Integer k1=0; k1<=j; ++k1) {
|
||||||
|
const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k1]));
|
||||||
|
aTolVx=BRep_Tool::Tolerance(aVx);
|
||||||
|
aPx=BRep_Tool::Pnt(aVx);
|
||||||
|
aD2=aPnew.SquareDistance(aPx);
|
||||||
|
//
|
||||||
|
aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
|
||||||
|
//
|
||||||
|
if (aD2<aDT2) {
|
||||||
|
iFound=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (iFound) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
// 1
|
// 1
|
||||||
BOPDS_InterfEE& aEE=aEEs.Appended();
|
BOPDS_InterfEE& aEE=aEEs.Appended();
|
||||||
iX=aEEs.Length()-1;
|
iX=aEEs.Length()-1;
|
||||||
|
@@ -785,55 +785,30 @@ Standard_Integer BOPTools_AlgoTools3D::PointInFace
|
|||||||
gp_Pnt2d& theP2D,
|
gp_Pnt2d& theP2D,
|
||||||
const Handle(IntTools_Context)& theContext)
|
const Handle(IntTools_Context)& theContext)
|
||||||
{
|
{
|
||||||
// Error status
|
Standard_Integer i, iErr = 1;
|
||||||
Standard_Integer iErr = 1;
|
Standard_Real aUMin, aUMax, aVMin, aVMax, aUx;
|
||||||
|
//
|
||||||
// Get UV bounds of the face
|
|
||||||
Standard_Real aUMin, aUMax, aVMin, aVMax;
|
|
||||||
theContext->UVBounds(theF, aUMin, aUMax, aVMin, aVMax);
|
theContext->UVBounds(theF, aUMin, aUMax, aVMin, aVMax);
|
||||||
|
//
|
||||||
// Middle point of the 2d bounding box of the face
|
gp_Dir2d aD2D(0. , 1.);
|
||||||
Standard_Real aUx = IntTools_Tools::IntermediatePoint(aUMin, aUMax),
|
aUx = IntTools_Tools::IntermediatePoint(aUMin, aUMax);
|
||||||
aVx = IntTools_Tools::IntermediatePoint(aVMin, aVMax);
|
//
|
||||||
|
for (i = 0; i < 2; ++i) {
|
||||||
for (Standard_Integer i = 0; i < 4; ++i)
|
gp_Pnt2d aP2D(aUx, 0.);
|
||||||
{
|
|
||||||
// Point to start the hatching line
|
|
||||||
gp_Pnt2d aP2D(aUx, aVx);
|
|
||||||
// Direction for the hatching line
|
|
||||||
gp_Dir2d aD2D = (i < 2) ? gp::DY2d() : gp::DX2d();
|
|
||||||
Handle(Geom2d_Line) aL2D = new Geom2d_Line (aP2D, aD2D);
|
Handle(Geom2d_Line) aL2D = new Geom2d_Line (aP2D, aD2D);
|
||||||
iErr = BOPTools_AlgoTools3D::PointInFace
|
iErr = BOPTools_AlgoTools3D::PointInFace
|
||||||
(theF, aL2D, theP, theP2D, theContext);
|
(theF, aL2D, theP, theP2D, theContext);
|
||||||
if (iErr == 0)
|
if (iErr == 0) {
|
||||||
// done
|
// done
|
||||||
return iErr;
|
break;
|
||||||
else
|
}
|
||||||
{
|
else {
|
||||||
// Possible reason - incorrect computation of the 2d box of the face.
|
// possible reason - incorrect computation of the 2d box of the face.
|
||||||
// Try to compute the point with the translated line.
|
// try to compute the point with the translated line.
|
||||||
if (i < 2)
|
aUx = aUMax - (aUx - aUMin);
|
||||||
aUx = aUMax - (aUx - aUMin);
|
|
||||||
else
|
|
||||||
aVx = aVMax - (aVx - aVMin);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
// The tries to find the point using the hatching line passing through
|
|
||||||
// the middle of the bounding box of the face have failed.
|
|
||||||
// Try to start hatching line at the middle of the edges of the face.
|
|
||||||
TopExp_Explorer anExpE(theF, TopAbs_EDGE);
|
|
||||||
for (; anExpE.More(); anExpE.Next())
|
|
||||||
{
|
|
||||||
const TopoDS_Edge& aE = TopoDS::Edge(anExpE.Current());
|
|
||||||
Standard_Real aT1, aT2;
|
|
||||||
BRep_Tool::Range(aE, aT1, aT2);
|
|
||||||
iErr = BOPTools_AlgoTools3D::PointInFace
|
|
||||||
(theF, aE, 0.5 * (aT1 + aT2), 0.0, theP, theP2D, theContext);
|
|
||||||
if (iErr == 0)
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return iErr;
|
return iErr;
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -421,9 +421,9 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
|||||||
isReverse = !IsFwdSeq(1);
|
isReverse = !IsFwdSeq(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Vertex FirstVtx_final = (isReverse)? LastVertex : FirstVertex;
|
TopoDS_Vertex FirstVtx_final = FirstVertex;
|
||||||
FirstVtx_final.Orientation(TopAbs_FORWARD);
|
FirstVtx_final.Orientation(TopAbs_FORWARD);
|
||||||
TopoDS_Vertex LastVtx_final = (isReverse)? FirstVertex : LastVertex;
|
TopoDS_Vertex LastVtx_final = LastVertex;
|
||||||
LastVtx_final.Orientation(TopAbs_REVERSED);
|
LastVtx_final.Orientation(TopAbs_REVERSED);
|
||||||
|
|
||||||
if (CurveSeq.IsEmpty())
|
if (CurveSeq.IsEmpty())
|
||||||
|
@@ -1041,8 +1041,10 @@ proc locate_data_file {filename} {
|
|||||||
while {[llength $dir] != 0} {
|
while {[llength $dir] != 0} {
|
||||||
set name [lindex $dir 0]
|
set name [lindex $dir 0]
|
||||||
set dir [lrange $dir 1 end]
|
set dir [lrange $dir 1 end]
|
||||||
|
|
||||||
# skip directories starting with dot
|
# skip directories starting with dot
|
||||||
if { [regexp {^[.]} $name] } { continue }
|
set aTail [file tail $name]
|
||||||
|
if { [regexp {^[.]} $aTail] } { continue }
|
||||||
if { [file exists $name/$filename] } {
|
if { [file exists $name/$filename] } {
|
||||||
return [file normalize $name/$filename]
|
return [file normalize $name/$filename]
|
||||||
}
|
}
|
||||||
|
@@ -939,7 +939,7 @@ private:
|
|||||||
void Geom2dConvert::ConcatG1(TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves,
|
void Geom2dConvert::ConcatG1(TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
const TColStd_Array1OfReal& ArrayOfToler,
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
Handle(TColGeom2d_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
Handle(TColGeom2d_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
||||||
const Standard_Boolean ClosedFlag,
|
Standard_Boolean& ClosedFlag,
|
||||||
const Standard_Real ClosedTolerance)
|
const Standard_Real ClosedTolerance)
|
||||||
|
|
||||||
{Standard_Integer nb_curve=ArrayOfCurves.Length(),
|
{Standard_Integer nb_curve=ArrayOfCurves.Length(),
|
||||||
@@ -1013,6 +1013,14 @@ void Geom2dConvert::ConcatG1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
|
|||||||
|
|
||||||
Standard_Real aPolynomialCoefficient[3];
|
Standard_Real aPolynomialCoefficient[3];
|
||||||
|
|
||||||
|
Standard_Boolean NeedDoubleDegRepara = Need2DegRepara(ArrayOfCurves);
|
||||||
|
if (nb_group==1 && ClosedFlag && NeedDoubleDegRepara)
|
||||||
|
{
|
||||||
|
Curve1 = ArrayOfCurves(nb_curve-1);
|
||||||
|
if (Curve1->Degree() > Geom2d_BSplineCurve::MaxDegree()/2)
|
||||||
|
ClosedFlag = Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
if ((nb_group==1) && (ClosedFlag)){ //traitement d'un cas particulier
|
if ((nb_group==1) && (ClosedFlag)){ //traitement d'un cas particulier
|
||||||
indexmin=Indexmin(ArrayOfCurves);
|
indexmin=Indexmin(ArrayOfCurves);
|
||||||
if (indexmin!=(ArrayOfCurves.Length()-1))
|
if (indexmin!=(ArrayOfCurves.Length()-1))
|
||||||
@@ -1024,8 +1032,8 @@ void Geom2dConvert::ConcatG1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
|
|||||||
Curve2=ArrayOfCurves(0);
|
Curve2=ArrayOfCurves(0);
|
||||||
for (j=1;j<=nb_curve-1;j++){ //boucle secondaire a l'interieur de chaque groupe
|
for (j=1;j<=nb_curve-1;j++){ //boucle secondaire a l'interieur de chaque groupe
|
||||||
Curve1=ArrayOfCurves(j);
|
Curve1=ArrayOfCurves(j);
|
||||||
if ( (j==(nb_curve-1)) &&(Need2DegRepara(ArrayOfCurves))){
|
if ( (j==(nb_curve-1)) && (NeedDoubleDegRepara)){
|
||||||
const Standard_Integer aNewCurveDegree = Min(2 * Curve1->Degree(), Geom2d_BSplineCurve::MaxDegree());
|
const Standard_Integer aNewCurveDegree = 2 * Curve1->Degree();
|
||||||
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
||||||
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
||||||
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
||||||
@@ -1159,7 +1167,7 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
|
|||||||
const TColStd_Array1OfReal& ArrayOfToler,
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
Handle(TColGeom2d_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
Handle(TColGeom2d_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
||||||
const Standard_Boolean ClosedFlag,
|
Standard_Boolean& ClosedFlag,
|
||||||
const Standard_Real ClosedTolerance)
|
const Standard_Real ClosedTolerance)
|
||||||
{
|
{
|
||||||
ConcatC1(ArrayOfCurves,
|
ConcatC1(ArrayOfCurves,
|
||||||
@@ -1179,7 +1187,7 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
|
|||||||
const TColStd_Array1OfReal& ArrayOfToler,
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
Handle(TColGeom2d_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
Handle(TColGeom2d_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
||||||
const Standard_Boolean ClosedFlag,
|
Standard_Boolean& ClosedFlag,
|
||||||
const Standard_Real ClosedTolerance,
|
const Standard_Real ClosedTolerance,
|
||||||
const Standard_Real AngularTolerance)
|
const Standard_Real AngularTolerance)
|
||||||
|
|
||||||
@@ -1260,6 +1268,14 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
|
|||||||
Pretreatment(ArrayOfCurves);
|
Pretreatment(ArrayOfCurves);
|
||||||
Standard_Real aPolynomialCoefficient[3];
|
Standard_Real aPolynomialCoefficient[3];
|
||||||
|
|
||||||
|
Standard_Boolean NeedDoubleDegRepara = Need2DegRepara(ArrayOfCurves);
|
||||||
|
if (nb_group==1 && ClosedFlag && NeedDoubleDegRepara)
|
||||||
|
{
|
||||||
|
Curve1 = ArrayOfCurves(nb_curve-1);
|
||||||
|
if (Curve1->Degree() > Geom2d_BSplineCurve::MaxDegree()/2)
|
||||||
|
ClosedFlag = Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
if ((nb_group==1) && (ClosedFlag)){ //traitement d'un cas particulier
|
if ((nb_group==1) && (ClosedFlag)){ //traitement d'un cas particulier
|
||||||
ArrayOfIndices->SetValue(0,0);
|
ArrayOfIndices->SetValue(0,0);
|
||||||
ArrayOfIndices->SetValue(1,0);
|
ArrayOfIndices->SetValue(1,0);
|
||||||
@@ -1277,12 +1293,12 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
|
|||||||
else
|
else
|
||||||
Curve1=ArrayOfCurves(j);
|
Curve1=ArrayOfCurves(j);
|
||||||
|
|
||||||
const Standard_Integer aNewCurveDegree = Min(2 * Curve1->Degree(), Geom2d_BSplineCurve::MaxDegree());
|
const Standard_Integer aNewCurveDegree = 2 * Curve1->Degree();
|
||||||
|
|
||||||
if (j==0) //initialisation en debut de groupe
|
if (j==0) //initialisation en debut de groupe
|
||||||
Curve2=Curve1;
|
Curve2=Curve1;
|
||||||
else{
|
else{
|
||||||
if ( (j==(nb_curve-1)) &&(Need2DegRepara(ArrayOfCurves))){
|
if ( (j==(nb_curve-1)) && (NeedDoubleDegRepara)){
|
||||||
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
||||||
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
||||||
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
||||||
@@ -1463,8 +1479,8 @@ void Geom2dConvert::C0BSplineToC1BSplineCurve(Handle(Geom2d_BSplineCurve)& BS,
|
|||||||
|
|
||||||
BS->D1(BS->FirstParameter(),point1,V1); //a verifier
|
BS->D1(BS->FirstParameter(),point1,V1); //a verifier
|
||||||
BS->D1(BS->LastParameter(),point2,V2);
|
BS->D1(BS->LastParameter(),point2,V2);
|
||||||
|
|
||||||
if ((point1.SquareDistance(point2) < gp::Resolution()) &&
|
if ((point1.SquareDistance(point2) < tolerance) &&
|
||||||
(V1.IsParallel(V2, anAngularToler)))
|
(V1.IsParallel(V2, anAngularToler)))
|
||||||
{
|
{
|
||||||
closed_flag = Standard_True;
|
closed_flag = Standard_True;
|
||||||
@@ -1555,7 +1571,7 @@ void Geom2dConvert::C0BSplineToArrayOfC1BSplineCurve(const Handle(Geom2d_BSpline
|
|||||||
BS->D1(BS->FirstParameter(),point1,V1);
|
BS->D1(BS->FirstParameter(),point1,V1);
|
||||||
BS->D1(BS->LastParameter(),point2,V2);
|
BS->D1(BS->LastParameter(),point2,V2);
|
||||||
|
|
||||||
if (((point1.SquareDistance(point2) < gp::Resolution())) &&
|
if (((point1.SquareDistance(point2) < Tolerance)) &&
|
||||||
(V1.IsParallel(V2, AngularTolerance)))
|
(V1.IsParallel(V2, AngularTolerance)))
|
||||||
{
|
{
|
||||||
closed_flag = Standard_True;
|
closed_flag = Standard_True;
|
||||||
|
@@ -83,7 +83,10 @@ public:
|
|||||||
//! Raised if FromK1 or ToK2 are out of the bounds
|
//! Raised if FromK1 or ToK2 are out of the bounds
|
||||||
//! [FirstUKnotIndex, LastUKnotIndex]
|
//! [FirstUKnotIndex, LastUKnotIndex]
|
||||||
//! Raised if FromK1 = ToK2
|
//! Raised if FromK1 = ToK2
|
||||||
Standard_EXPORT static Handle(Geom2d_BSplineCurve) SplitBSplineCurve (const Handle(Geom2d_BSplineCurve)& C, const Standard_Integer FromK1, const Standard_Integer ToK2, const Standard_Boolean SameOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom2d_BSplineCurve) SplitBSplineCurve (const Handle(Geom2d_BSplineCurve)& C,
|
||||||
|
const Standard_Integer FromK1,
|
||||||
|
const Standard_Integer ToK2,
|
||||||
|
const Standard_Boolean SameOrientation = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! This function computes the segment of B-spline curve between the
|
//! This function computes the segment of B-spline curve between the
|
||||||
@@ -101,7 +104,11 @@ public:
|
|||||||
//! curve (The tolerance criterion is ParametricTolerance).
|
//! curve (The tolerance criterion is ParametricTolerance).
|
||||||
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance
|
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance
|
||||||
//! Raised if ParametricTolerance < Resolution from gp.
|
//! Raised if ParametricTolerance < Resolution from gp.
|
||||||
Standard_EXPORT static Handle(Geom2d_BSplineCurve) SplitBSplineCurve (const Handle(Geom2d_BSplineCurve)& C, const Standard_Real FromU1, const Standard_Real ToU2, const Standard_Real ParametricTolerance, const Standard_Boolean SameOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom2d_BSplineCurve) SplitBSplineCurve (const Handle(Geom2d_BSplineCurve)& C,
|
||||||
|
const Standard_Real FromU1,
|
||||||
|
const Standard_Real ToU2,
|
||||||
|
const Standard_Real ParametricTolerance,
|
||||||
|
const Standard_Boolean SameOrientation = Standard_True);
|
||||||
|
|
||||||
//! This function converts a non infinite curve from
|
//! This function converts a non infinite curve from
|
||||||
//! Geom into a B-spline curve. C must be an ellipse or a
|
//! Geom into a B-spline curve. C must be an ellipse or a
|
||||||
@@ -167,7 +174,8 @@ public:
|
|||||||
//! respectively the first and the last parameters of the
|
//! respectively the first and the last parameters of the
|
||||||
//! trimmed curve (this method of parameterization
|
//! trimmed curve (this method of parameterization
|
||||||
//! cannot be used to convert a quasi-complete circle or ellipse).
|
//! cannot be used to convert a quasi-complete circle or ellipse).
|
||||||
Standard_EXPORT static Handle(Geom2d_BSplineCurve) CurveToBSplineCurve (const Handle(Geom2d_Curve)& C, const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2);
|
Standard_EXPORT static Handle(Geom2d_BSplineCurve) CurveToBSplineCurve (const Handle(Geom2d_Curve)& C,
|
||||||
|
const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2);
|
||||||
|
|
||||||
//! This Method concatenates G1 the ArrayOfCurves as far
|
//! This Method concatenates G1 the ArrayOfCurves as far
|
||||||
//! as it is possible.
|
//! as it is possible.
|
||||||
@@ -175,11 +183,17 @@ public:
|
|||||||
//! ArrayOfToler contains the biggest tolerance of the two
|
//! ArrayOfToler contains the biggest tolerance of the two
|
||||||
//! points shared by two consecutives curves.
|
//! points shared by two consecutives curves.
|
||||||
//! Its dimension: [0..N-2]
|
//! Its dimension: [0..N-2]
|
||||||
//! ClosedTolerance indicates if the ArrayOfCurves is closed.
|
//! ClosedFlag indicates if the ArrayOfCurves is closed.
|
||||||
//! In this case ClosedTolerance contains the biggest tolerance
|
//! In this case ClosedTolerance contains the biggest tolerance
|
||||||
//! of the two points which are at the closure.
|
//! of the two points which are at the closure.
|
||||||
//! Otherwise its value is 0.0
|
//! Otherwise its value is 0.0
|
||||||
Standard_EXPORT static void ConcatG1 (TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColGeom2d_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedFlag, const Standard_Real ClosedTolerance);
|
//! ClosedFlag becomes False on the output
|
||||||
|
//! if it is impossible to build closed curve.
|
||||||
|
Standard_EXPORT static void ConcatG1 (TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
|
Handle(TColGeom2d_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
|
Standard_Boolean& ClosedFlag,
|
||||||
|
const Standard_Real ClosedTolerance);
|
||||||
|
|
||||||
//! This Method concatenates C1 the ArrayOfCurves as far
|
//! This Method concatenates C1 the ArrayOfCurves as far
|
||||||
//! as it is possible.
|
//! as it is possible.
|
||||||
@@ -187,11 +201,18 @@ public:
|
|||||||
//! ArrayOfToler contains the biggest tolerance of the two
|
//! ArrayOfToler contains the biggest tolerance of the two
|
||||||
//! points shared by two consecutives curves.
|
//! points shared by two consecutives curves.
|
||||||
//! Its dimension: [0..N-2]
|
//! Its dimension: [0..N-2]
|
||||||
//! ClosedTolerance indicates if the ArrayOfCurves is closed.
|
//! ClosedFlag indicates if the ArrayOfCurves is closed.
|
||||||
//! In this case ClosedTolerance contains the biggest tolerance
|
//! In this case ClosedTolerance contains the biggest tolerance
|
||||||
//! of the two points which are at the closure.
|
//! of the two points which are at the closure.
|
||||||
//! Otherwise its value is 0.0
|
//! Otherwise its value is 0.0
|
||||||
Standard_EXPORT static void ConcatC1 (TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, Handle(TColGeom2d_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedFlag, const Standard_Real ClosedTolerance);
|
//! ClosedFlag becomes False on the output
|
||||||
|
//! if it is impossible to build closed curve.
|
||||||
|
Standard_EXPORT static void ConcatC1 (TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
|
Handle(TColGeom2d_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
|
Standard_Boolean& ClosedFlag,
|
||||||
|
const Standard_Real ClosedTolerance);
|
||||||
|
|
||||||
//! This Method concatenates C1 the ArrayOfCurves as far
|
//! This Method concatenates C1 the ArrayOfCurves as far
|
||||||
//! as it is possible.
|
//! as it is possible.
|
||||||
@@ -199,29 +220,43 @@ public:
|
|||||||
//! ArrayOfToler contains the biggest tolerance of the two
|
//! ArrayOfToler contains the biggest tolerance of the two
|
||||||
//! points shared by two consecutives curves.
|
//! points shared by two consecutives curves.
|
||||||
//! Its dimension: [0..N-2]
|
//! Its dimension: [0..N-2]
|
||||||
//! ClosedTolerance indicates if the ArrayOfCurves is closed.
|
//! ClosedFlag indicates if the ArrayOfCurves is closed.
|
||||||
//! In this case ClosedTolerance contains the biggest tolerance
|
//! In this case ClosedTolerance contains the biggest tolerance
|
||||||
//! of the two points which are at the closure.
|
//! of the two points which are at the closure.
|
||||||
//! Otherwise its value is 0.0
|
//! Otherwise its value is 0.0
|
||||||
Standard_EXPORT static void ConcatC1 (TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, Handle(TColGeom2d_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedFlag, const Standard_Real ClosedTolerance, const Standard_Real AngularTolerance);
|
//! ClosedFlag becomes False on the output
|
||||||
|
//! if it is impossible to build closed curve.
|
||||||
|
Standard_EXPORT static void ConcatC1 (TColGeom2d_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
|
Handle(TColGeom2d_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
|
Standard_Boolean& ClosedFlag,
|
||||||
|
const Standard_Real ClosedTolerance,
|
||||||
|
const Standard_Real AngularTolerance);
|
||||||
|
|
||||||
//! This Method reduces as far as it is possible the
|
//! This Method reduces as far as it is possible the
|
||||||
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
||||||
//! It returns a new BSpline which could still be C0.
|
//! It returns a new BSpline which could still be C0.
|
||||||
//! tolerance is a geometrical tolerance
|
//! tolerance is a geometrical tolerance
|
||||||
Standard_EXPORT static void C0BSplineToC1BSplineCurve (Handle(Geom2d_BSplineCurve)& BS, const Standard_Real Tolerance);
|
Standard_EXPORT static void C0BSplineToC1BSplineCurve (Handle(Geom2d_BSplineCurve)& BS,
|
||||||
|
const Standard_Real Tolerance);
|
||||||
|
|
||||||
//! This Method reduces as far as it is possible the
|
//! This Method reduces as far as it is possible the
|
||||||
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
||||||
//! It returns an array of BSpline C1.
|
//! It returns an array of BSpline C1.
|
||||||
//! Tolerance is a geometrical tolerance
|
//! Tolerance is a geometrical tolerance
|
||||||
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom2d_BSplineCurve)& BS, Handle(TColGeom2d_HArray1OfBSplineCurve)& tabBS, const Standard_Real Tolerance);
|
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom2d_BSplineCurve)& BS,
|
||||||
|
Handle(TColGeom2d_HArray1OfBSplineCurve)& tabBS,
|
||||||
|
const Standard_Real Tolerance);
|
||||||
|
|
||||||
//! This Method reduces as far as it is possible the
|
//! This Method reduces as far as it is possible the
|
||||||
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
||||||
//! It returns an array of BSpline C1.
|
//! It returns an array of BSpline C1.
|
||||||
//! tolerance is a geometrical tolerance
|
//! tolerance is a geometrical tolerance
|
||||||
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom2d_BSplineCurve)& BS, Handle(TColGeom2d_HArray1OfBSplineCurve)& tabBS, const Standard_Real AngularTolerance, const Standard_Real Tolerance);
|
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom2d_BSplineCurve)& BS,
|
||||||
|
Handle(TColGeom2d_HArray1OfBSplineCurve)& tabBS,
|
||||||
|
const Standard_Real AngularTolerance,
|
||||||
|
const Standard_Real Tolerance);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -785,7 +785,7 @@ private:
|
|||||||
void GeomConvert::ConcatG1(TColGeom_Array1OfBSplineCurve& ArrayOfCurves,
|
void GeomConvert::ConcatG1(TColGeom_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
const TColStd_Array1OfReal& ArrayOfToler,
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
Handle(TColGeom_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
Handle(TColGeom_HArray1OfBSplineCurve) & ArrayOfConcatenated,
|
||||||
const Standard_Boolean ClosedG1Flag,
|
Standard_Boolean& ClosedG1Flag,
|
||||||
const Standard_Real ClosedTolerance)
|
const Standard_Real ClosedTolerance)
|
||||||
|
|
||||||
{Standard_Integer nb_curve=ArrayOfCurves.Length(),
|
{Standard_Integer nb_curve=ArrayOfCurves.Length(),
|
||||||
@@ -855,6 +855,14 @@ private:
|
|||||||
Pretreatment(ArrayOfCurves);
|
Pretreatment(ArrayOfCurves);
|
||||||
Standard_Real aPolynomialCoefficient[3];
|
Standard_Real aPolynomialCoefficient[3];
|
||||||
|
|
||||||
|
Standard_Boolean NeedDoubleDegRepara = Need2DegRepara(ArrayOfCurves);
|
||||||
|
if (nb_group==1 && ClosedG1Flag && NeedDoubleDegRepara)
|
||||||
|
{
|
||||||
|
Curve1 = ArrayOfCurves(nb_curve-1);
|
||||||
|
if (Curve1->Degree() > Geom2d_BSplineCurve::MaxDegree()/2)
|
||||||
|
ClosedG1Flag = Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
if ((nb_group==1) && (ClosedG1Flag)){ //treatment of a particular case
|
if ((nb_group==1) && (ClosedG1Flag)){ //treatment of a particular case
|
||||||
indexmin=Indexmin(ArrayOfCurves);
|
indexmin=Indexmin(ArrayOfCurves);
|
||||||
if (indexmin!=(ArrayOfCurves.Length()-1))
|
if (indexmin!=(ArrayOfCurves.Length()-1))
|
||||||
@@ -866,7 +874,7 @@ private:
|
|||||||
Curve2=ArrayOfCurves(0);
|
Curve2=ArrayOfCurves(0);
|
||||||
for (j=1;j<=nb_curve-1;j++){ //secondary loop inside each group
|
for (j=1;j<=nb_curve-1;j++){ //secondary loop inside each group
|
||||||
Curve1=ArrayOfCurves(j);
|
Curve1=ArrayOfCurves(j);
|
||||||
if ( (j==(nb_curve-1)) &&(Need2DegRepara(ArrayOfCurves))){
|
if ( (j==(nb_curve-1)) && (NeedDoubleDegRepara)){
|
||||||
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
||||||
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
||||||
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
||||||
@@ -983,7 +991,7 @@ void GeomConvert::ConcatC1(TColGeom_Array1OfBSplineCurve& ArrayOfCurv
|
|||||||
const TColStd_Array1OfReal& ArrayOfToler,
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
const Standard_Boolean ClosedG1Flag,
|
Standard_Boolean& ClosedG1Flag,
|
||||||
const Standard_Real ClosedTolerance)
|
const Standard_Real ClosedTolerance)
|
||||||
{
|
{
|
||||||
ConcatC1(ArrayOfCurves,
|
ConcatC1(ArrayOfCurves,
|
||||||
@@ -1003,7 +1011,7 @@ void GeomConvert::ConcatC1(TColGeom_Array1OfBSplineCurve& ArrayOfCurv
|
|||||||
const TColStd_Array1OfReal& ArrayOfToler,
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
const Standard_Boolean ClosedG1Flag,
|
Standard_Boolean& ClosedG1Flag,
|
||||||
const Standard_Real ClosedTolerance,
|
const Standard_Real ClosedTolerance,
|
||||||
const Standard_Real AngularTolerance)
|
const Standard_Real AngularTolerance)
|
||||||
|
|
||||||
@@ -1082,6 +1090,14 @@ void GeomConvert::ConcatC1(TColGeom_Array1OfBSplineCurve& ArrayOfCurv
|
|||||||
Pretreatment(ArrayOfCurves);
|
Pretreatment(ArrayOfCurves);
|
||||||
Standard_Real aPolynomialCoefficient[3];
|
Standard_Real aPolynomialCoefficient[3];
|
||||||
|
|
||||||
|
Standard_Boolean NeedDoubleDegRepara = Need2DegRepara(ArrayOfCurves);
|
||||||
|
if (nb_group==1 && ClosedG1Flag && NeedDoubleDegRepara)
|
||||||
|
{
|
||||||
|
Curve1 = ArrayOfCurves(nb_curve-1);
|
||||||
|
if (Curve1->Degree() > Geom2d_BSplineCurve::MaxDegree()/2)
|
||||||
|
ClosedG1Flag = Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
if ((nb_group==1) && (ClosedG1Flag)){ //treatment of a particular case
|
if ((nb_group==1) && (ClosedG1Flag)){ //treatment of a particular case
|
||||||
ArrayOfIndices->SetValue(0,0);
|
ArrayOfIndices->SetValue(0,0);
|
||||||
ArrayOfIndices->SetValue(1,0);
|
ArrayOfIndices->SetValue(1,0);
|
||||||
@@ -1101,7 +1117,7 @@ void GeomConvert::ConcatC1(TColGeom_Array1OfBSplineCurve& ArrayOfCurv
|
|||||||
if (j==0) //initialisation at the begining of the loop
|
if (j==0) //initialisation at the begining of the loop
|
||||||
Curve2=Curve1;
|
Curve2=Curve1;
|
||||||
else{
|
else{
|
||||||
if ( (j==(nb_curve-1)) &&(Need2DegRepara(ArrayOfCurves))){
|
if ( (j==(nb_curve-1)) && (NeedDoubleDegRepara)){
|
||||||
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
Curve2->D1(Curve2->LastParameter(),Pint,Vec1);
|
||||||
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
Curve1->D1(Curve1->FirstParameter(),Pint,Vec2);
|
||||||
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
lambda=Vec2.Magnitude()/Vec1.Magnitude();
|
||||||
|
@@ -91,7 +91,10 @@ public:
|
|||||||
//! Raised if FromK1 = ToK2
|
//! Raised if FromK1 = ToK2
|
||||||
//! Raised if FromK1 or ToK2 are out of the bounds
|
//! Raised if FromK1 or ToK2 are out of the bounds
|
||||||
//! [FirstUKnotIndex, LastUKnotIndex]
|
//! [FirstUKnotIndex, LastUKnotIndex]
|
||||||
Standard_EXPORT static Handle(Geom_BSplineCurve) SplitBSplineCurve (const Handle(Geom_BSplineCurve)& C, const Standard_Integer FromK1, const Standard_Integer ToK2, const Standard_Boolean SameOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom_BSplineCurve) SplitBSplineCurve (const Handle(Geom_BSplineCurve)& C,
|
||||||
|
const Standard_Integer FromK1,
|
||||||
|
const Standard_Integer ToK2,
|
||||||
|
const Standard_Boolean SameOrientation = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! This function computes the segment of B-spline curve between the
|
//! This function computes the segment of B-spline curve between the
|
||||||
@@ -109,7 +112,11 @@ public:
|
|||||||
//! curve (The tolerance criterion is ParametricTolerance).
|
//! curve (The tolerance criterion is ParametricTolerance).
|
||||||
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance
|
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance
|
||||||
//! Raised if ParametricTolerance < Resolution from gp.
|
//! Raised if ParametricTolerance < Resolution from gp.
|
||||||
Standard_EXPORT static Handle(Geom_BSplineCurve) SplitBSplineCurve (const Handle(Geom_BSplineCurve)& C, const Standard_Real FromU1, const Standard_Real ToU2, const Standard_Real ParametricTolerance, const Standard_Boolean SameOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom_BSplineCurve) SplitBSplineCurve (const Handle(Geom_BSplineCurve)& C,
|
||||||
|
const Standard_Real FromU1,
|
||||||
|
const Standard_Real ToU2,
|
||||||
|
const Standard_Real ParametricTolerance,
|
||||||
|
const Standard_Boolean SameOrientation = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! Computes the B-spline surface patche between the knots values
|
//! Computes the B-spline surface patche between the knots values
|
||||||
@@ -126,7 +133,13 @@ public:
|
|||||||
//! [FirstUKnotIndex, LastUKnotIndex]
|
//! [FirstUKnotIndex, LastUKnotIndex]
|
||||||
//! FromVK1 or ToVK2 are out of the bounds
|
//! FromVK1 or ToVK2 are out of the bounds
|
||||||
//! [FirstVKnotIndex, LastVKnotIndex]
|
//! [FirstVKnotIndex, LastVKnotIndex]
|
||||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, const Standard_Boolean SameUOrientation = Standard_True, const Standard_Boolean SameVOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S,
|
||||||
|
const Standard_Integer FromUK1,
|
||||||
|
const Standard_Integer ToUK2,
|
||||||
|
const Standard_Integer FromVK1,
|
||||||
|
const Standard_Integer ToVK2,
|
||||||
|
const Standard_Boolean SameUOrientation = Standard_True,
|
||||||
|
const Standard_Boolean SameVOrientation = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! This method splits a B-spline surface patche between the
|
//! This method splits a B-spline surface patche between the
|
||||||
@@ -141,7 +154,11 @@ public:
|
|||||||
//! FromK1 or ToK2 are out of the bounds
|
//! FromK1 or ToK2 are out of the bounds
|
||||||
//! [FirstUKnotIndex, LastUKnotIndex] in the
|
//! [FirstUKnotIndex, LastUKnotIndex] in the
|
||||||
//! considered parametric direction.
|
//! considered parametric direction.
|
||||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Integer FromK1, const Standard_Integer ToK2, const Standard_Boolean USplit, const Standard_Boolean SameOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S,
|
||||||
|
const Standard_Integer FromK1,
|
||||||
|
const Standard_Integer ToK2,
|
||||||
|
const Standard_Boolean USplit,
|
||||||
|
const Standard_Boolean SameOrientation = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! This method computes the B-spline surface patche between the
|
//! This method computes the B-spline surface patche between the
|
||||||
@@ -162,7 +179,14 @@ public:
|
|||||||
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance or
|
//! Raised if Abs (FromU1 - ToU2) <= ParametricTolerance or
|
||||||
//! Abs (FromV1 - ToV2) <= ParametricTolerance.
|
//! Abs (FromV1 - ToV2) <= ParametricTolerance.
|
||||||
//! Raised if ParametricTolerance < Resolution.
|
//! Raised if ParametricTolerance < Resolution.
|
||||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Real FromU1, const Standard_Real ToU2, const Standard_Real FromV1, const Standard_Real ToV2, const Standard_Real ParametricTolerance, const Standard_Boolean SameUOrientation = Standard_True, const Standard_Boolean SameVOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S,
|
||||||
|
const Standard_Real FromU1,
|
||||||
|
const Standard_Real ToU2,
|
||||||
|
const Standard_Real FromV1,
|
||||||
|
const Standard_Real ToV2,
|
||||||
|
const Standard_Real ParametricTolerance,
|
||||||
|
const Standard_Boolean SameUOrientation = Standard_True,
|
||||||
|
const Standard_Boolean SameVOrientation = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! This method splits the B-spline surface S in one direction
|
//! This method splits the B-spline surface S in one direction
|
||||||
@@ -182,7 +206,12 @@ public:
|
|||||||
//! Raises if FromParam1 or ToParam2 are out of the parametric bounds
|
//! Raises if FromParam1 or ToParam2 are out of the parametric bounds
|
||||||
//! of the surface in the considered direction.
|
//! of the surface in the considered direction.
|
||||||
//! Raises if Abs (FromParam1 - ToParam2) <= ParametricTolerance.
|
//! Raises if Abs (FromParam1 - ToParam2) <= ParametricTolerance.
|
||||||
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S, const Standard_Real FromParam1, const Standard_Real ToParam2, const Standard_Boolean USplit, const Standard_Real ParametricTolerance, const Standard_Boolean SameOrientation = Standard_True);
|
Standard_EXPORT static Handle(Geom_BSplineSurface) SplitBSplineSurface (const Handle(Geom_BSplineSurface)& S,
|
||||||
|
const Standard_Real FromParam1,
|
||||||
|
const Standard_Real ToParam2,
|
||||||
|
const Standard_Boolean USplit,
|
||||||
|
const Standard_Real ParametricTolerance,
|
||||||
|
const Standard_Boolean SameOrientation = Standard_True);
|
||||||
|
|
||||||
//! This function converts a non infinite curve from
|
//! This function converts a non infinite curve from
|
||||||
//! Geom into a B-spline curve. C must be an ellipse or a
|
//! Geom into a B-spline curve. C must be an ellipse or a
|
||||||
@@ -249,7 +278,8 @@ public:
|
|||||||
//! respectively the first and the last parameters of the
|
//! respectively the first and the last parameters of the
|
||||||
//! trimmed curve (this method of parameterization
|
//! trimmed curve (this method of parameterization
|
||||||
//! cannot be used to convert a quasi-complete circle or ellipse).
|
//! cannot be used to convert a quasi-complete circle or ellipse).
|
||||||
Standard_EXPORT static Handle(Geom_BSplineCurve) CurveToBSplineCurve (const Handle(Geom_Curve)& C, const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2);
|
Standard_EXPORT static Handle(Geom_BSplineCurve) CurveToBSplineCurve (const Handle(Geom_Curve)& C,
|
||||||
|
const Convert_ParameterisationType Parameterisation = Convert_TgtThetaOver2);
|
||||||
|
|
||||||
|
|
||||||
//! This algorithm converts a non infinite surface from Geom
|
//! This algorithm converts a non infinite surface from Geom
|
||||||
@@ -268,11 +298,17 @@ public:
|
|||||||
//! ArrayOfToler contains the biggest tolerance of the two
|
//! ArrayOfToler contains the biggest tolerance of the two
|
||||||
//! points shared by two consecutives curves.
|
//! points shared by two consecutives curves.
|
||||||
//! Its dimension: [0..N-2]
|
//! Its dimension: [0..N-2]
|
||||||
//! ClosedG1 indicates if the ArrayOfCurves is closed.
|
//! ClosedFlag indicates if the ArrayOfCurves is closed.
|
||||||
//! In this case ClosedG1 contains the biggest tolerance
|
//! In this case ClosedTolerance contains the biggest tolerance
|
||||||
//! of the two points which are at the closure.
|
//! of the two points which are at the closure.
|
||||||
//! Otherwise its value is 0.0
|
//! Otherwise its value is 0.0
|
||||||
Standard_EXPORT static void ConcatG1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedG1Flag, const Standard_Real ClosedTolerance);
|
//! ClosedFlag becomes False on the output
|
||||||
|
//! if it is impossible to build closed curve.
|
||||||
|
Standard_EXPORT static void ConcatG1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
|
Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
|
Standard_Boolean& ClosedFlag,
|
||||||
|
const Standard_Real ClosedTolerance);
|
||||||
|
|
||||||
//! This Method concatenates C1 the ArrayOfCurves as far
|
//! This Method concatenates C1 the ArrayOfCurves as far
|
||||||
//! as it is possible.
|
//! as it is possible.
|
||||||
@@ -280,11 +316,18 @@ public:
|
|||||||
//! ArrayOfToler contains the biggest tolerance of the two
|
//! ArrayOfToler contains the biggest tolerance of the two
|
||||||
//! points shared by two consecutives curves.
|
//! points shared by two consecutives curves.
|
||||||
//! Its dimension: [0..N-2]
|
//! Its dimension: [0..N-2]
|
||||||
//! ClosedG1 indicates if the ArrayOfCurves is closed.
|
//! ClosedFlag indicates if the ArrayOfCurves is closed.
|
||||||
//! In this case ClosedG1 contains the biggest tolerance
|
//! In this case ClosedTolerance contains the biggest tolerance
|
||||||
//! of the two points which are at the closure.
|
//! of the two points which are at the closure.
|
||||||
//! Otherwise its value is 0.0
|
//! Otherwise its value is 0.0
|
||||||
Standard_EXPORT static void ConcatC1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedG1Flag, const Standard_Real ClosedTolerance);
|
//! ClosedFlag becomes False on the output
|
||||||
|
//! if it is impossible to build closed curve.
|
||||||
|
Standard_EXPORT static void ConcatC1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
|
Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
|
Standard_Boolean& ClosedFlag,
|
||||||
|
const Standard_Real ClosedTolerance);
|
||||||
|
|
||||||
//! This Method concatenates C1 the ArrayOfCurves as far
|
//! This Method concatenates C1 the ArrayOfCurves as far
|
||||||
//! as it is possible.
|
//! as it is possible.
|
||||||
@@ -292,11 +335,19 @@ public:
|
|||||||
//! ArrayOfToler contains the biggest tolerance of the two
|
//! ArrayOfToler contains the biggest tolerance of the two
|
||||||
//! points shared by two consecutives curves.
|
//! points shared by two consecutives curves.
|
||||||
//! Its dimension: [0..N-2]
|
//! Its dimension: [0..N-2]
|
||||||
//! ClosedG1 indicates if the ArrayOfCurves is closed.
|
//! ClosedFlag indicates if the ArrayOfCurves is closed.
|
||||||
//! In this case ClosedG1 contains the biggest tolerance
|
//! In this case ClosedTolerance contains the biggest tolerance
|
||||||
//! of the two points which are at the closure.
|
//! of the two points which are at the closure.
|
||||||
//! Otherwise its value is 0.0
|
//! Otherwise its value is 0.0
|
||||||
Standard_EXPORT static void ConcatC1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves, const TColStd_Array1OfReal& ArrayOfToler, Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, const Standard_Boolean ClosedG1Flag, const Standard_Real ClosedTolerance, const Standard_Real AngularTolerance);
|
//! ClosedFlag becomes False on the output
|
||||||
|
//! if it is impossible to build closed curve.
|
||||||
|
Standard_EXPORT static void ConcatC1 (TColGeom_Array1OfBSplineCurve& ArrayOfCurves,
|
||||||
|
const TColStd_Array1OfReal& ArrayOfToler,
|
||||||
|
Handle(TColStd_HArray1OfInteger)& ArrayOfIndices,
|
||||||
|
Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated,
|
||||||
|
Standard_Boolean& ClosedFlag,
|
||||||
|
const Standard_Real ClosedTolerance,
|
||||||
|
const Standard_Real AngularTolerance);
|
||||||
|
|
||||||
//! This Method reduces as far as it is possible the
|
//! This Method reduces as far as it is possible the
|
||||||
//! multiplicities of the knots of the BSpline BS.(keeping the
|
//! multiplicities of the knots of the BSpline BS.(keeping the
|
||||||
@@ -305,12 +356,16 @@ public:
|
|||||||
//! The Angular toleranceis in radians and mesures the angle of
|
//! The Angular toleranceis in radians and mesures the angle of
|
||||||
//! the tangents on the left and on the right to decide if the
|
//! the tangents on the left and on the right to decide if the
|
||||||
//! curve is G1 or not at a given point
|
//! curve is G1 or not at a given point
|
||||||
Standard_EXPORT static void C0BSplineToC1BSplineCurve (Handle(Geom_BSplineCurve)& BS, const Standard_Real tolerance, const Standard_Real AngularTolerance = 1.0e-7);
|
Standard_EXPORT static void C0BSplineToC1BSplineCurve (Handle(Geom_BSplineCurve)& BS,
|
||||||
|
const Standard_Real tolerance,
|
||||||
|
const Standard_Real AngularTolerance = 1.0e-7);
|
||||||
|
|
||||||
//! This Method reduces as far as it is possible the
|
//! This Method reduces as far as it is possible the
|
||||||
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
//! multiplicities of the knots of the BSpline BS.(keeping the geometry).
|
||||||
//! It returns an array of BSpline C1. tolerance is a geometrical tolerance.
|
//! It returns an array of BSpline C1. tolerance is a geometrical tolerance.
|
||||||
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom_BSplineCurve)& BS, Handle(TColGeom_HArray1OfBSplineCurve)& tabBS, const Standard_Real tolerance);
|
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom_BSplineCurve)& BS,
|
||||||
|
Handle(TColGeom_HArray1OfBSplineCurve)& tabBS,
|
||||||
|
const Standard_Real tolerance);
|
||||||
|
|
||||||
//! This Method reduces as far as it is possible the
|
//! This Method reduces as far as it is possible the
|
||||||
//! multiplicities of the knots of the BSpline BS.(keeping the
|
//! multiplicities of the knots of the BSpline BS.(keeping the
|
||||||
@@ -319,7 +374,10 @@ public:
|
|||||||
//! The Angular tolerance is in radians and mesures the angle of
|
//! The Angular tolerance is in radians and mesures the angle of
|
||||||
//! the tangents on the left and on the right to decide if the curve
|
//! the tangents on the left and on the right to decide if the curve
|
||||||
//! is C1 or not at a given point
|
//! is C1 or not at a given point
|
||||||
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom_BSplineCurve)& BS, Handle(TColGeom_HArray1OfBSplineCurve)& tabBS, const Standard_Real AngularTolerance, const Standard_Real tolerance);
|
Standard_EXPORT static void C0BSplineToArrayOfC1BSplineCurve (const Handle(Geom_BSplineCurve)& BS,
|
||||||
|
Handle(TColGeom_HArray1OfBSplineCurve)& tabBS,
|
||||||
|
const Standard_Real AngularTolerance,
|
||||||
|
const Standard_Real tolerance);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <Adaptor2d_HCurve2d.hxx>
|
#include <Adaptor2d_HCurve2d.hxx>
|
||||||
#include <Adaptor3d_TopolTool.hxx>
|
#include <Adaptor3d_TopolTool.hxx>
|
||||||
@@ -41,96 +42,83 @@
|
|||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
#include <TopAbs_Orientation.hxx>
|
#include <TopAbs_Orientation.hxx>
|
||||||
|
|
||||||
static
|
static const Standard_Real TwoPI = M_PI + M_PI;
|
||||||
void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
|
||||||
const gp_Pnt& Ptref,
|
|
||||||
Standard_Real& U1,
|
|
||||||
Standard_Real& V1);
|
|
||||||
static
|
|
||||||
void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
|
||||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
|
||||||
const gp_Pnt& Ptref,
|
|
||||||
Standard_Real& U1,
|
|
||||||
Standard_Real& V1,
|
|
||||||
Standard_Real& U2,
|
|
||||||
Standard_Real& V2);
|
|
||||||
|
|
||||||
static
|
|
||||||
void GLinePoint(const IntPatch_IType typl,
|
|
||||||
const Handle(IntPatch_GLine)& GLine,
|
|
||||||
const Standard_Real aT,
|
|
||||||
gp_Pnt& aP);
|
|
||||||
static
|
|
||||||
void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
|
||||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
|
||||||
Standard_Real& u1,
|
|
||||||
Standard_Real& v1,
|
|
||||||
Standard_Real& u2,
|
|
||||||
Standard_Real& v2);
|
|
||||||
|
|
||||||
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
||||||
//
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//class : GeomInt_RealWithFlag
|
//class : GeomInt_Vertex
|
||||||
//purpose :
|
//purpose : This class has been created in order to provide possibility
|
||||||
|
// to sort IntPatch_Points by their parameter on line.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
class GeomInt_RealWithFlag {
|
class GeomInt_Vertex
|
||||||
public:
|
{
|
||||||
GeomInt_RealWithFlag() :
|
public:
|
||||||
myValue(-99.), myFlag(1)
|
GeomInt_Vertex()
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
//
|
|
||||||
~GeomInt_RealWithFlag() {
|
//! Initializes this class by IntPatch_Point
|
||||||
};
|
void SetVertex(const IntPatch_Point& theOther)
|
||||||
//
|
{
|
||||||
void SetValue(const Standard_Real aT) {
|
myVertex = theOther;
|
||||||
myValue=aT;
|
const Standard_Real aNewParam = ElCLib::InPeriod(theOther.ParameterOnLine(), 0.0, TwoPI);
|
||||||
};
|
SetParameter(aNewParam);
|
||||||
//
|
|
||||||
Standard_Real Value() const {
|
|
||||||
return myValue;
|
|
||||||
}
|
}
|
||||||
//
|
|
||||||
void SetFlag(const Standard_Integer aFlag) {
|
//! Sets Parameter on Line
|
||||||
myFlag=aFlag;
|
void SetParameter(const Standard_Real theParam)
|
||||||
};
|
{
|
||||||
//
|
myVertex.SetParameter(theParam);
|
||||||
Standard_Integer Flag() const {
|
|
||||||
return myFlag;
|
|
||||||
}
|
}
|
||||||
//
|
|
||||||
Standard_Boolean operator < (const GeomInt_RealWithFlag& aOther) {
|
//! Returns IntPatch_Point
|
||||||
return myValue<aOther.myValue;
|
const IntPatch_Point& Getvertex() const
|
||||||
|
{
|
||||||
|
return myVertex;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
protected:
|
//! To provide sort
|
||||||
Standard_Real myValue;
|
Standard_Boolean operator < (const GeomInt_Vertex& theOther) const
|
||||||
Standard_Integer myFlag;
|
{
|
||||||
|
return myVertex.ParameterOnLine() < theOther.myVertex.ParameterOnLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
IntPatch_Point myVertex;
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------
|
//------------
|
||||||
static
|
static void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||||
void SortShell(const Standard_Integer,
|
const gp_Pnt& Ptref,
|
||||||
GeomInt_RealWithFlag *);
|
Standard_Real& U1,
|
||||||
static
|
Standard_Real& V1);
|
||||||
void RejectDuplicates(Standard_Integer& aNbVtx,
|
|
||||||
GeomInt_RealWithFlag *pVtx,
|
static void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||||
Standard_Real aTolPrm);
|
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||||
static
|
const gp_Pnt& Ptref,
|
||||||
void RejectNearBeacons(Standard_Integer& aNbVtx,
|
Standard_Real& U1,
|
||||||
GeomInt_RealWithFlag *pVtx,
|
Standard_Real& V1,
|
||||||
Standard_Real aTolPC1,
|
Standard_Real& U2,
|
||||||
const GeomAbs_SurfaceType aTS1,
|
Standard_Real& V2);
|
||||||
const GeomAbs_SurfaceType aTS2);
|
|
||||||
static
|
static void GLinePoint(const IntPatch_IType typl,
|
||||||
Standard_Real AdjustOnPeriod(const Standard_Real aTr,
|
const Handle(IntPatch_GLine)& GLine,
|
||||||
const Standard_Real aPeriod);
|
const Standard_Real aT,
|
||||||
|
gp_Pnt& aP);
|
||||||
|
|
||||||
|
static void AdjustPeriodic(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||||
|
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||||
|
Standard_Real& u1,
|
||||||
|
Standard_Real& v1,
|
||||||
|
Standard_Real& u2,
|
||||||
|
Standard_Real& v2);
|
||||||
|
|
||||||
static
|
static
|
||||||
Standard_Boolean RejectMicroCircle(const Handle(IntPatch_GLine)& aGLine,
|
Standard_Boolean RejectMicroCircle(const Handle(IntPatch_GLine)& aGLine,
|
||||||
const IntPatch_IType aType,
|
const IntPatch_IType aType,
|
||||||
const Standard_Real aTol3D);
|
const Standard_Real aTol3D);
|
||||||
|
|
||||||
|
static void RejectDuplicates(NCollection_Array1<GeomInt_Vertex>& theVtxArr);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Perform
|
//function : Perform
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -154,7 +142,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
|||||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||||
const gp_Pnt Pmid = ALine->Value(pmid);
|
const gp_Pnt Pmid = ALine->Value(pmid);
|
||||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
|
||||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||||
if(in1 != TopAbs_OUT) {
|
if(in1 != TopAbs_OUT) {
|
||||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||||
@@ -181,7 +169,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
|||||||
const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
|
const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
|
||||||
const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
|
const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
|
||||||
Pmid.Parameters(u1,v1,u2,v2);
|
Pmid.Parameters(u1,v1,u2,v2);
|
||||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
|
||||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||||
if(in1 != TopAbs_OUT) {
|
if(in1 != TopAbs_OUT) {
|
||||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||||
@@ -194,14 +182,14 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
|||||||
else {
|
else {
|
||||||
const IntSurf_PntOn2S& Pfirst = WLine->Point((Standard_Integer)(firstp));
|
const IntSurf_PntOn2S& Pfirst = WLine->Point((Standard_Integer)(firstp));
|
||||||
Pfirst.Parameters(u1,v1,u2,v2);
|
Pfirst.Parameters(u1,v1,u2,v2);
|
||||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
|
||||||
TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||||
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
||||||
TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||||
if(in2 != TopAbs_OUT) { //-- !=ON
|
if(in2 != TopAbs_OUT) { //-- !=ON
|
||||||
const IntSurf_PntOn2S& Plast = WLine->Point((Standard_Integer)(lastp));
|
const IntSurf_PntOn2S& Plast = WLine->Point((Standard_Integer)(lastp));
|
||||||
Plast.Parameters(u1,v1,u2,v2);
|
Plast.Parameters(u1,v1,u2,v2);
|
||||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
|
||||||
in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||||
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
|
||||||
in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||||
@@ -309,7 +297,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
|||||||
GLinePoint(typl, GLine, pmid, Pmid);
|
GLinePoint(typl, GLine, pmid, Pmid);
|
||||||
//
|
//
|
||||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
AdjustPeriodic(myHS1, myHS2, u1, v1, u2, v2);
|
||||||
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
|
||||||
if(in1 != TopAbs_OUT) {
|
if(in1 != TopAbs_OUT) {
|
||||||
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
|
||||||
@@ -549,26 +537,88 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
|||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Recadre
|
//function : TreatCircle
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
void GeomInt_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& theLine,
|
||||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
const Standard_Real theTol)
|
||||||
Standard_Real& u1,
|
{
|
||||||
Standard_Real& v1,
|
const IntPatch_IType aType = theLine->ArcType();
|
||||||
Standard_Real& u2,
|
const Handle(IntPatch_GLine) aGLine(Handle(IntPatch_GLine)::DownCast(theLine));
|
||||||
Standard_Real& v2)
|
if (RejectMicroCircle(aGLine, aType, theTol))
|
||||||
{
|
{
|
||||||
Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
|
return;
|
||||||
|
}
|
||||||
|
//----------------------------------------
|
||||||
|
const Standard_Integer aNbVtx = aGLine->NbVertex();
|
||||||
|
NCollection_Array1<GeomInt_Vertex> aVtxArr(1, aNbVtx + 1);
|
||||||
|
for (Standard_Integer i = 1; i <= aNbVtx; i++)
|
||||||
|
{
|
||||||
|
aVtxArr(i).SetVertex(aGLine->Vertex(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(aVtxArr.begin(), aVtxArr.begin() + aNbVtx);
|
||||||
|
|
||||||
|
//Create last vertex
|
||||||
|
const Standard_Real aMinPrm = aVtxArr.First().Getvertex().ParameterOnLine() + TwoPI;
|
||||||
|
aVtxArr.ChangeLast().SetParameter(aMinPrm);
|
||||||
|
|
||||||
|
RejectDuplicates(aVtxArr);
|
||||||
|
|
||||||
|
std::sort(aVtxArr.begin(), aVtxArr.end());
|
||||||
|
|
||||||
|
Standard_Real aU1, aV1, aU2, aV2;
|
||||||
|
gp_Pnt aPmid;
|
||||||
|
gp_Pnt2d aP2D;
|
||||||
|
for (Standard_Integer i = aVtxArr.Lower(); i <= aVtxArr.Upper() - 1; i++)
|
||||||
|
{
|
||||||
|
const Standard_Real aT1 = aVtxArr(i).Getvertex().ParameterOnLine();
|
||||||
|
const Standard_Real aT2 = aVtxArr(i + 1).Getvertex().ParameterOnLine();
|
||||||
|
|
||||||
|
if (aT2 == RealLast())
|
||||||
|
break;
|
||||||
|
|
||||||
|
const Standard_Real aTmid = (aT1 + aT2)*0.5;
|
||||||
|
GLinePoint(aType, aGLine, aTmid, aPmid);
|
||||||
|
//
|
||||||
|
Parameters(myHS1, myHS2, aPmid, aU1, aV1, aU2, aV2);
|
||||||
|
AdjustPeriodic(myHS1, myHS2, aU1, aV1, aU2, aV2);
|
||||||
|
//
|
||||||
|
aP2D.SetCoord(aU1, aV1);
|
||||||
|
TopAbs_State aState = myDom1->Classify(aP2D, theTol);
|
||||||
|
if (aState != TopAbs_OUT)
|
||||||
|
{
|
||||||
|
aP2D.SetCoord(aU2, aV2);
|
||||||
|
aState = myDom2->Classify(aP2D, theTol);
|
||||||
|
if (aState != TopAbs_OUT)
|
||||||
|
{
|
||||||
|
seqp.Append(aT1);
|
||||||
|
seqp.Append(aT2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AdjustPeriodic
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AdjustPeriodic(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||||
|
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||||
|
Standard_Real& u1,
|
||||||
|
Standard_Real& v1,
|
||||||
|
Standard_Real& u2,
|
||||||
|
Standard_Real& v2)
|
||||||
|
{
|
||||||
|
Standard_Boolean myHS1IsUPeriodic, myHS1IsVPeriodic;
|
||||||
const GeomAbs_SurfaceType typs1 = myHS1->GetType();
|
const GeomAbs_SurfaceType typs1 = myHS1->GetType();
|
||||||
switch (typs1)
|
switch (typs1)
|
||||||
{
|
{
|
||||||
case GeomAbs_Cylinder:
|
case GeomAbs_Cylinder:
|
||||||
case GeomAbs_Cone:
|
case GeomAbs_Cone:
|
||||||
case GeomAbs_Sphere:
|
case GeomAbs_Sphere:
|
||||||
{
|
{
|
||||||
myHS1IsUPeriodic = Standard_True;
|
myHS1IsUPeriodic = Standard_True;
|
||||||
myHS1IsVPeriodic = Standard_False;
|
myHS1IsVPeriodic = Standard_False;
|
||||||
break;
|
break;
|
||||||
@@ -585,14 +635,14 @@ void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Standard_Boolean myHS2IsUPeriodic,myHS2IsVPeriodic;
|
Standard_Boolean myHS2IsUPeriodic, myHS2IsVPeriodic;
|
||||||
const GeomAbs_SurfaceType typs2 = myHS2->GetType();
|
const GeomAbs_SurfaceType typs2 = myHS2->GetType();
|
||||||
switch (typs2)
|
switch (typs2)
|
||||||
{
|
{
|
||||||
case GeomAbs_Cylinder:
|
case GeomAbs_Cylinder:
|
||||||
case GeomAbs_Cone:
|
case GeomAbs_Cone:
|
||||||
case GeomAbs_Sphere:
|
case GeomAbs_Sphere:
|
||||||
{
|
{
|
||||||
myHS2IsUPeriodic = Standard_True;
|
myHS2IsUPeriodic = Standard_True;
|
||||||
myHS2IsVPeriodic = Standard_False;
|
myHS2IsVPeriodic = Standard_False;
|
||||||
break;
|
break;
|
||||||
@@ -611,31 +661,36 @@ void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
|||||||
}
|
}
|
||||||
Standard_Real du, dv;
|
Standard_Real du, dv;
|
||||||
//
|
//
|
||||||
if(myHS1IsUPeriodic) {
|
if (myHS1IsUPeriodic)
|
||||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS1->UPeriod();
|
{
|
||||||
|
const Standard_Real lmf = M_PI + M_PI; //-- myHS1->UPeriod();
|
||||||
const Standard_Real f = myHS1->FirstUParameter();
|
const Standard_Real f = myHS1->FirstUParameter();
|
||||||
const Standard_Real l = myHS1->LastUParameter();
|
const Standard_Real l = myHS1->LastUParameter();
|
||||||
GeomInt::AdjustPeriodic(u1, f, l, lmf, u1, du);
|
GeomInt::AdjustPeriodic(u1, f, l, lmf, u1, du);
|
||||||
}
|
}
|
||||||
if(myHS1IsVPeriodic) {
|
if (myHS1IsVPeriodic)
|
||||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS1->VPeriod();
|
{
|
||||||
|
const Standard_Real lmf = M_PI + M_PI; //-- myHS1->VPeriod();
|
||||||
const Standard_Real f = myHS1->FirstVParameter();
|
const Standard_Real f = myHS1->FirstVParameter();
|
||||||
const Standard_Real l = myHS1->LastVParameter();
|
const Standard_Real l = myHS1->LastVParameter();
|
||||||
GeomInt::AdjustPeriodic(v1, f, l, lmf, v1, dv);
|
GeomInt::AdjustPeriodic(v1, f, l, lmf, v1, dv);
|
||||||
}
|
}
|
||||||
if(myHS2IsUPeriodic) {
|
if (myHS2IsUPeriodic)
|
||||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS2->UPeriod();
|
{
|
||||||
|
const Standard_Real lmf = M_PI + M_PI; //-- myHS2->UPeriod();
|
||||||
const Standard_Real f = myHS2->FirstUParameter();
|
const Standard_Real f = myHS2->FirstUParameter();
|
||||||
const Standard_Real l = myHS2->LastUParameter();
|
const Standard_Real l = myHS2->LastUParameter();
|
||||||
GeomInt::AdjustPeriodic(u2, f, l, lmf, u2, du);
|
GeomInt::AdjustPeriodic(u2, f, l, lmf, u2, du);
|
||||||
}
|
}
|
||||||
if(myHS2IsVPeriodic) {
|
if (myHS2IsVPeriodic)
|
||||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS2->VPeriod();
|
{
|
||||||
|
const Standard_Real lmf = M_PI + M_PI; //-- myHS2->VPeriod();
|
||||||
const Standard_Real f = myHS2->FirstVParameter();
|
const Standard_Real f = myHS2->FirstVParameter();
|
||||||
const Standard_Real l = myHS2->LastVParameter();
|
const Standard_Real l = myHS2->LastVParameter();
|
||||||
GeomInt::AdjustPeriodic(v2, f, l, lmf, v2, dv);
|
GeomInt::AdjustPeriodic(v2, f, l, lmf, v2, dv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Parameters
|
//function : Parameters
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -651,6 +706,7 @@ void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
|||||||
Parameters(myHS1, Ptref, U1, V1);
|
Parameters(myHS1, Ptref, U1, V1);
|
||||||
Parameters(myHS2, Ptref, U2, V2);
|
Parameters(myHS2, Ptref, U2, V2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Parameter
|
//function : Parameter
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -662,26 +718,27 @@ void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
|||||||
{
|
{
|
||||||
IntSurf_Quadric quad1;
|
IntSurf_Quadric quad1;
|
||||||
//
|
//
|
||||||
switch (myHS1->Surface().GetType()) {
|
switch (myHS1->Surface().GetType())
|
||||||
case GeomAbs_Plane:
|
{
|
||||||
quad1.SetValue(myHS1->Surface().Plane());
|
case GeomAbs_Plane:
|
||||||
|
quad1.SetValue(myHS1->Surface().Plane());
|
||||||
break;
|
break;
|
||||||
case GeomAbs_Cylinder:
|
case GeomAbs_Cylinder:
|
||||||
quad1.SetValue(myHS1->Surface().Cylinder());
|
quad1.SetValue(myHS1->Surface().Cylinder());
|
||||||
break;
|
break;
|
||||||
case GeomAbs_Cone:
|
case GeomAbs_Cone:
|
||||||
quad1.SetValue(myHS1->Surface().Cone());
|
quad1.SetValue(myHS1->Surface().Cone());
|
||||||
break;
|
break;
|
||||||
case GeomAbs_Sphere:
|
case GeomAbs_Sphere:
|
||||||
quad1.SetValue(myHS1->Surface().Sphere());
|
quad1.SetValue(myHS1->Surface().Sphere());
|
||||||
break;
|
break;
|
||||||
case GeomAbs_Torus:
|
case GeomAbs_Torus:
|
||||||
quad1.SetValue(myHS1->Surface().Torus());
|
quad1.SetValue(myHS1->Surface().Torus());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw Standard_ConstructionError("GeomInt_LineConstructor::Parameters");
|
throw Standard_ConstructionError("GeomInt_LineConstructor::Parameters");
|
||||||
}
|
}
|
||||||
quad1.Parameters(Ptref,U1,V1);
|
quad1.Parameters(Ptref, U1, V1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -693,238 +750,28 @@ void GLinePoint(const IntPatch_IType typl,
|
|||||||
const Standard_Real aT,
|
const Standard_Real aT,
|
||||||
gp_Pnt& aP)
|
gp_Pnt& aP)
|
||||||
{
|
{
|
||||||
switch (typl) {
|
switch (typl)
|
||||||
case IntPatch_Lin:
|
{
|
||||||
aP = ElCLib::Value(aT, GLine->Line());
|
case IntPatch_Lin:
|
||||||
break;
|
aP = ElCLib::Value(aT, GLine->Line());
|
||||||
case IntPatch_Circle:
|
break;
|
||||||
aP = ElCLib::Value(aT, GLine->Circle());
|
case IntPatch_Circle:
|
||||||
break;
|
aP = ElCLib::Value(aT, GLine->Circle());
|
||||||
case IntPatch_Ellipse:
|
break;
|
||||||
aP = ElCLib::Value(aT, GLine->Ellipse());
|
case IntPatch_Ellipse:
|
||||||
break;
|
aP = ElCLib::Value(aT, GLine->Ellipse());
|
||||||
case IntPatch_Hyperbola:
|
break;
|
||||||
aP = ElCLib::Value(aT, GLine->Hyperbola());
|
case IntPatch_Hyperbola:
|
||||||
break;
|
aP = ElCLib::Value(aT, GLine->Hyperbola());
|
||||||
case IntPatch_Parabola:
|
break;
|
||||||
aP = ElCLib::Value(aT, GLine->Parabola());
|
case IntPatch_Parabola:
|
||||||
break;
|
aP = ElCLib::Value(aT, GLine->Parabola());
|
||||||
default:
|
break;
|
||||||
throw Standard_ConstructionError("GeomInt_LineConstructor::Parameters");
|
default:
|
||||||
|
throw Standard_ConstructionError("GeomInt_LineConstructor::Parameters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : TreatCircle
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GeomInt_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
|
|
||||||
const Standard_Real aTol)
|
|
||||||
{
|
|
||||||
Standard_Boolean bRejected;
|
|
||||||
IntPatch_IType aType;
|
|
||||||
//
|
|
||||||
aType=aLine->ArcType();
|
|
||||||
Handle(IntPatch_GLine) aGLine (Handle(IntPatch_GLine)::DownCast (aLine));
|
|
||||||
//
|
|
||||||
bRejected=RejectMicroCircle(aGLine, aType, aTol);
|
|
||||||
if (bRejected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//----------------------------------------
|
|
||||||
Standard_Boolean bFound;
|
|
||||||
Standard_Integer aNbVtx, aNbVtxWas, i;
|
|
||||||
Standard_Real aTolPC, aT, aT1, aT2, aTmid, aTwoPI, aTolPC1;
|
|
||||||
Standard_Real aU1, aV1, aU2, aV2;
|
|
||||||
TopAbs_State aIn1, aIn2;
|
|
||||||
GeomAbs_SurfaceType aTS1, aTS2;
|
|
||||||
gp_Pnt aPmid;
|
|
||||||
gp_Pnt2d aP2D;
|
|
||||||
GeomInt_RealWithFlag *pVtx;
|
|
||||||
//-------------------------------------1
|
|
||||||
aTwoPI=M_PI+M_PI;
|
|
||||||
aTolPC=Precision::PConfusion();
|
|
||||||
aNbVtxWas=GeomInt_LineTool::NbVertex(aLine);
|
|
||||||
|
|
||||||
aNbVtx=aNbVtxWas+2;
|
|
||||||
//-------------------------------------2
|
|
||||||
aTS1=myHS1->GetType();
|
|
||||||
aTS2=myHS2->GetType();
|
|
||||||
//
|
|
||||||
// About the value aTolPC1=1000.*aTolPC,
|
|
||||||
// see IntPatch_GLine.cxx, line:398
|
|
||||||
// for more details;
|
|
||||||
aTolPC1=1000.*aTolPC;
|
|
||||||
//-------------------------------------
|
|
||||||
//
|
|
||||||
pVtx=new GeomInt_RealWithFlag [aNbVtx];
|
|
||||||
//
|
|
||||||
pVtx[0].SetValue(0.);
|
|
||||||
pVtx[1].SetValue(aTwoPI);
|
|
||||||
//
|
|
||||||
for(i=1; i<=aNbVtxWas; ++i) {
|
|
||||||
aT=GeomInt_LineTool::Vertex(aLine, i).ParameterOnLine();
|
|
||||||
aT=AdjustOnPeriod(aT, aTwoPI);
|
|
||||||
pVtx[i+1].SetValue(aT);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
SortShell(aNbVtx, pVtx);
|
|
||||||
//
|
|
||||||
RejectNearBeacons(aNbVtx, pVtx, aTolPC1, aTS1, aTS2);
|
|
||||||
//
|
|
||||||
RejectDuplicates(aNbVtx, pVtx, aTolPC);
|
|
||||||
//
|
|
||||||
if ((aType==IntPatch_Circle || aType==IntPatch_Ellipse)&& aNbVtx>2) { // zz
|
|
||||||
bFound=Standard_False;
|
|
||||||
for(i=1; i<=aNbVtxWas; ++i) {
|
|
||||||
aT=GeomInt_LineTool::Vertex(aLine, i).ParameterOnLine();
|
|
||||||
if (fabs(aT) < aTolPC1 || fabs(aT-aTwoPI) < aTolPC1) {
|
|
||||||
bFound=!bFound;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!bFound) {
|
|
||||||
aT=pVtx[1].Value()+aTwoPI;
|
|
||||||
pVtx[aNbVtx-1].SetValue(aT);
|
|
||||||
//
|
|
||||||
for(i=0; i<aNbVtx - 1; ++i) {
|
|
||||||
aT=pVtx[i+1].Value();
|
|
||||||
pVtx[i].SetValue(aT);
|
|
||||||
}
|
|
||||||
--aNbVtx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
for(i=0; i<aNbVtx-1; ++i) {
|
|
||||||
aT1=pVtx[i].Value();
|
|
||||||
aT2=pVtx[i+1].Value();
|
|
||||||
aTmid=(aT1+aT2)*0.5;
|
|
||||||
GLinePoint(aType, aGLine, aTmid, aPmid);
|
|
||||||
//
|
|
||||||
Parameters(myHS1, myHS2, aPmid, aU1, aV1, aU2, aV2);
|
|
||||||
Recadre(myHS1, myHS2, aU1, aV1, aU2, aV2);
|
|
||||||
//
|
|
||||||
aP2D.SetCoord(aU1, aV1);
|
|
||||||
aIn1=myDom1->Classify(aP2D, aTol);
|
|
||||||
if(aIn1 != TopAbs_OUT) {
|
|
||||||
aP2D.SetCoord(aU2, aV2);
|
|
||||||
aIn2=myDom2->Classify(aP2D, aTol);
|
|
||||||
if(aIn2 != TopAbs_OUT) {
|
|
||||||
seqp.Append(aT1);
|
|
||||||
seqp.Append(aT2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
delete [] pVtx;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : RejectNearBeacons
|
|
||||||
//purpose : Reject the thickenings near the beacon points (if exist)
|
|
||||||
// The gifts, made by sweep algo.
|
|
||||||
// chl/930/B5 B8 C2 C5 E2 E5 E8 F2 G8 H2 H5 H8
|
|
||||||
//=======================================================================
|
|
||||||
void RejectNearBeacons(Standard_Integer& aNbVtx,
|
|
||||||
GeomInt_RealWithFlag *pVtx,
|
|
||||||
Standard_Real aTolPC1,
|
|
||||||
const GeomAbs_SurfaceType aTS1,
|
|
||||||
const GeomAbs_SurfaceType aTS2)
|
|
||||||
{
|
|
||||||
Standard_Integer i, j, iBcn;
|
|
||||||
Standard_Real aT, aBcn[2];
|
|
||||||
//
|
|
||||||
if (aTS1==GeomAbs_Cylinder && aTS2==GeomAbs_Cylinder) {
|
|
||||||
aBcn[0]=0.5*M_PI;
|
|
||||||
aBcn[1]=1.5*M_PI;
|
|
||||||
//
|
|
||||||
for (j=0; j<2; ++j) {
|
|
||||||
iBcn=-1;
|
|
||||||
for(i=0; i<aNbVtx; ++i) {
|
|
||||||
aT=pVtx[i].Value();
|
|
||||||
if (aT==aBcn[j]) {
|
|
||||||
iBcn=i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (iBcn<0) {
|
|
||||||
// The beacon is not found
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
for(i=0; i<aNbVtx; ++i) {
|
|
||||||
if (i!=iBcn) {
|
|
||||||
aT=pVtx[i].Value();
|
|
||||||
if (fabs(aT-aBcn[j]) < aTolPC1) {
|
|
||||||
pVtx[i].SetFlag(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}// for (j=0; j<2; ++j) {
|
|
||||||
//------------------------------------------
|
|
||||||
j=0;
|
|
||||||
for(i=0; i<aNbVtx; ++i) {
|
|
||||||
if (pVtx[i].Flag()) {
|
|
||||||
pVtx[j]=pVtx[i];
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aNbVtx=j;
|
|
||||||
}// if (aTS1==GeomAbs_Cylinder && aTS2==GeomAbs_Cylinder) {
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : RejectDuplicates
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void RejectDuplicates(Standard_Integer& aNbVtx,
|
|
||||||
GeomInt_RealWithFlag *pVtx,
|
|
||||||
Standard_Real aTolPC)
|
|
||||||
{
|
|
||||||
Standard_Integer i, j;
|
|
||||||
Standard_Real dX, aT1, aT2;
|
|
||||||
//
|
|
||||||
for(i=0; i<aNbVtx-1; ++i) {
|
|
||||||
aT2=pVtx[i+1].Value();
|
|
||||||
aT1=pVtx[i].Value();
|
|
||||||
dX=aT2-aT1;
|
|
||||||
if (dX<aTolPC) {
|
|
||||||
pVtx[i+1].SetFlag(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
j=0;
|
|
||||||
for(i=0; i<aNbVtx; ++i) {
|
|
||||||
if (pVtx[i].Flag()) {
|
|
||||||
pVtx[j]=pVtx[i];
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aNbVtx=j;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : AdjustOnPeriod
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Real AdjustOnPeriod(const Standard_Real aTr,
|
|
||||||
const Standard_Real aPeriod)
|
|
||||||
{
|
|
||||||
Standard_Integer k;
|
|
||||||
Standard_Real aT;
|
|
||||||
//
|
|
||||||
aT=aTr;
|
|
||||||
if (aT<0.) {
|
|
||||||
k=-(Standard_Integer)(aT/aPeriod)+1;
|
|
||||||
aT=aT+k*aPeriod;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (!(aT>=0. && aT<=aPeriod)) {
|
|
||||||
k=(Standard_Integer)(aT/aPeriod);
|
|
||||||
aT=aT-k*aPeriod;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
return aT;
|
|
||||||
}
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : RejectMicroCrcles
|
//function : RejectMicroCrcles
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -948,35 +795,67 @@ Standard_Boolean RejectMicroCircle(const Handle(IntPatch_GLine)& aGLine,
|
|||||||
}
|
}
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function: SortShell
|
//function : RejectDuplicates
|
||||||
// purpose :
|
//purpose : Finds two coincident IntPatch_Points (if they exist) and
|
||||||
|
// sets Parameter-On-Line fore one such point to DBL_MAX
|
||||||
|
// (i.e. its use in the future is forbidden).
|
||||||
|
//
|
||||||
|
//ATTENTION!!!
|
||||||
|
// The source array must be sorted in ascending order.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SortShell(const Standard_Integer n,
|
void RejectDuplicates(NCollection_Array1<GeomInt_Vertex>& theVtxArr)
|
||||||
GeomInt_RealWithFlag *a)
|
|
||||||
{
|
{
|
||||||
Standard_Integer nd, i, j, l, d=1;
|
// About the value aTolPC=1000.*Precision::PConfusion(),
|
||||||
GeomInt_RealWithFlag x;
|
// see IntPatch_GLine::ComputeVertexParameters(...)
|
||||||
//
|
// for more details;
|
||||||
while(d<=n) {
|
const Standard_Real aTolPC = 1000.*Precision::PConfusion();
|
||||||
d*=2;
|
|
||||||
|
//Find duplicates in a slice of the array [LowerBound, UpperBound-1].
|
||||||
|
//If a duplicate has been found, the element with greater index will be rejected.
|
||||||
|
for (Standard_Integer i = theVtxArr.Lower(); i <= theVtxArr.Upper() - 2; i++)
|
||||||
|
{
|
||||||
|
const IntPatch_Point &aVi = theVtxArr(i).Getvertex();
|
||||||
|
const Standard_Real aPrmi = aVi.ParameterOnLine();
|
||||||
|
|
||||||
|
if (aPrmi == RealLast())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (Standard_Integer j = i + 1; j <= theVtxArr.Upper() - 1; j++)
|
||||||
|
{
|
||||||
|
const IntPatch_Point &aVj = theVtxArr(j).Getvertex();
|
||||||
|
const Standard_Real aPrmj = aVj.ParameterOnLine();
|
||||||
|
|
||||||
|
if (aPrmj - aPrmi < aTolPC)
|
||||||
|
{
|
||||||
|
theVtxArr(j).SetParameter(RealLast());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Find duplicates with the last element of the array.
|
||||||
|
//If a duplicate has been found, the found element will be rejected.
|
||||||
|
const Standard_Real aMaxPrm = theVtxArr.Last().Getvertex().ParameterOnLine();
|
||||||
|
for (Standard_Integer i = theVtxArr.Upper() - 1; i > theVtxArr.Lower(); i--)
|
||||||
|
{
|
||||||
|
const IntPatch_Point &aVi = theVtxArr(i).Getvertex();
|
||||||
|
const Standard_Real aPrmi = aVi.ParameterOnLine();
|
||||||
|
|
||||||
|
if (aPrmi == RealLast())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((aMaxPrm - aPrmi) < aTolPC)
|
||||||
|
{
|
||||||
|
theVtxArr(i).SetParameter(RealLast());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
while (d) {
|
|
||||||
d=(d-1)/2;
|
|
||||||
//
|
|
||||||
nd=n-d;
|
|
||||||
for (i=0; i<nd; ++i) {
|
|
||||||
j=i;
|
|
||||||
m30:;
|
|
||||||
l=j+d;
|
|
||||||
if (a[l] < a[j]){
|
|
||||||
x=a[j];
|
|
||||||
a[j]=a[l];
|
|
||||||
a[l]=x;
|
|
||||||
j-=d;
|
|
||||||
if (j > -1) goto m30;
|
|
||||||
}//if (a[l] < a[j]){
|
|
||||||
}//for (i=0; i<nd; ++i)
|
|
||||||
}//while (1)
|
|
||||||
}
|
}
|
||||||
|
@@ -758,10 +758,10 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
|
|||||||
Standard_Integer LevelOfIterWithoutAppend = -1;
|
Standard_Integer LevelOfIterWithoutAppend = -1;
|
||||||
//
|
//
|
||||||
|
|
||||||
const Standard_Real aTol[4] = { Epsilon(u1max - u1min),
|
const Standard_Real aTol[4] = { Epsilon(UM1 - Um1),
|
||||||
Epsilon(v1max - v1min),
|
Epsilon(VM1 - Vm1),
|
||||||
Epsilon(u2max - u2min),
|
Epsilon(UM2 - Um2),
|
||||||
Epsilon(v2max - v2min)};
|
Epsilon(VM2 - Vm2)};
|
||||||
Arrive = Standard_False;
|
Arrive = Standard_False;
|
||||||
while(!Arrive) //010
|
while(!Arrive) //010
|
||||||
{
|
{
|
||||||
@@ -853,8 +853,8 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
|
|||||||
|
|
||||||
Standard_Real aNewPnt[4], anAbsParamDist[4];
|
Standard_Real aNewPnt[4], anAbsParamDist[4];
|
||||||
myIntersectionOn2S.Point().Parameters(aNewPnt[0], aNewPnt[1], aNewPnt[2], aNewPnt[3]);
|
myIntersectionOn2S.Point().Parameters(aNewPnt[0], aNewPnt[1], aNewPnt[2], aNewPnt[3]);
|
||||||
const Standard_Real aParMin[4] = {u1min, v1min, u2min, v2min};
|
const Standard_Real aParMin[4] = {Um1, Vm1, Um2, Vm2};
|
||||||
const Standard_Real aParMax[4] = {u1max, v1max, u2max, v2max};
|
const Standard_Real aParMax[4] = {UM1, VM1, UM2, VM2};
|
||||||
|
|
||||||
for(Standard_Integer i = 0; i < 4; i++)
|
for(Standard_Integer i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
@@ -864,12 +864,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
|
|||||||
aNewPnt[i] = aParMax[i];
|
aNewPnt[i] = aParMax[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNewPnt[0] < u1min || aNewPnt[0] > u1max ||
|
if (aNewPnt[0] < Um1 || aNewPnt[0] > UM1 ||
|
||||||
aNewPnt[1] < v1min || aNewPnt[1] > v1max ||
|
aNewPnt[1] < Vm1 || aNewPnt[1] > VM1 ||
|
||||||
aNewPnt[2] < u2min || aNewPnt[2] > u2max ||
|
aNewPnt[2] < Um2 || aNewPnt[2] > UM2 ||
|
||||||
aNewPnt[3] < v2min || aNewPnt[3] > v2max)
|
aNewPnt[3] < Vm2 || aNewPnt[3] > VM2)
|
||||||
{
|
{
|
||||||
break; // Out of borders, handle this later.
|
// Out of borders, process it later.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
myIntersectionOn2S.ChangePoint().SetValue(aNewPnt[0],
|
myIntersectionOn2S.ChangePoint().SetValue(aNewPnt[0],
|
||||||
|
@@ -65,15 +65,17 @@ inline const gp_Dir& IntWalk_PWalking::TangentAtLine(Standard_Integer& theIndex)
|
|||||||
|
|
||||||
inline void IntWalk_PWalking::AddAPoint(const IntSurf_PntOn2S& POn2S) {
|
inline void IntWalk_PWalking::AddAPoint(const IntSurf_PntOn2S& POn2S) {
|
||||||
#if REGLAGE
|
#if REGLAGE
|
||||||
Standard_Integer n=theLine->NbPoints();
|
Standard_Integer n=line->NbPoints()+1;
|
||||||
|
if (n == 1)
|
||||||
|
{
|
||||||
|
std::cout << "Dump of WL" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
if(n) {
|
if(n) {
|
||||||
gp_Vec V(POn2S.Value(),theLine->Value(n).Value());
|
|
||||||
Standard_Real u1,v1,u2,v2;
|
Standard_Real u1,v1,u2,v2;
|
||||||
Standard_Real U1,V1,U2,V2;
|
|
||||||
POn2S.Parameters(u1,v1,u2,v2);
|
POn2S.Parameters(u1,v1,u2,v2);
|
||||||
theLine->Value(n).Parameters(U1,V1,U2,V2);
|
printf("point p%d %+10.20f %+10.20f %+10.20f\n",
|
||||||
printf("\n%3d: (%10.5g)(%+12.5g %+12.5g %+12.5g) (%+12.5g %+12.5g) (%+12.5g %+12.5g)",n,
|
n, POn2S.Value().X(), POn2S.Value().Y(), POn2S.Value().Z());
|
||||||
V.Magnitude(),V.X(),V.Y(),V.Z(),U1-u1,V1-v1,U2-u2,V2-v2);
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -222,10 +222,16 @@ void MeshVS_CommonSensitiveEntity::Swap (const Standard_Integer theIdx1,
|
|||||||
//function : overlapsElement
|
//function : overlapsElement
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth)
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
|
if (theIsFullInside)
|
||||||
|
{
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
const Standard_Integer anItemIdx = myItemIndexes.Value (theElemIdx);
|
const Standard_Integer anItemIdx = myItemIndexes.Value (theElemIdx);
|
||||||
if (mySelMethod == MeshVS_MSM_PRECISE)
|
if (mySelMethod == MeshVS_MSM_PRECISE)
|
||||||
{
|
{
|
||||||
@@ -250,7 +256,7 @@ Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_Sel
|
|||||||
return theMgr.Overlaps (gp_Pnt (aCoords (1), aCoords (2), aCoords (3)),
|
return theMgr.Overlaps (gp_Pnt (aCoords (1), aCoords (2), aCoords (3)),
|
||||||
gp_Pnt (aCoords (4), aCoords (5), aCoords (6)),
|
gp_Pnt (aCoords (4), aCoords (5), aCoords (6)),
|
||||||
gp_Pnt (aCoords (7), aCoords (8), aCoords (9)),
|
gp_Pnt (aCoords (7), aCoords (8), aCoords (9)),
|
||||||
Select3D_TOS_INTERIOR, theMatchDepth);
|
Select3D_TOS_INTERIOR, thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshVS_Buffer aFacePntsBuf (aNbNodes * 3 * sizeof (Standard_Real));
|
MeshVS_Buffer aFacePntsBuf (aNbNodes * 3 * sizeof (Standard_Real));
|
||||||
@@ -261,12 +267,12 @@ Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_Sel
|
|||||||
aCoords (3 * aNodeIdx - 1),
|
aCoords (3 * aNodeIdx - 1),
|
||||||
aCoords (3 * aNodeIdx)));
|
aCoords (3 * aNodeIdx)));
|
||||||
}
|
}
|
||||||
return theMgr.Overlaps (aFacePnts, Select3D_TOS_INTERIOR, theMatchDepth);
|
return theMgr.Overlaps (aFacePnts, Select3D_TOS_INTERIOR, thePickResult);
|
||||||
}
|
}
|
||||||
else if (mySelMethod == MeshVS_MSM_NODES)
|
else if (mySelMethod == MeshVS_MSM_NODES)
|
||||||
{
|
{
|
||||||
const gp_Pnt aVert = getVertexByIndex (anItemIdx);
|
const gp_Pnt aVert = getVertexByIndex (anItemIdx);
|
||||||
return theMgr.Overlaps (aVert, theMatchDepth);
|
return theMgr.Overlaps (aVert, thePickResult);
|
||||||
}
|
}
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -276,8 +282,14 @@ Standard_Boolean MeshVS_CommonSensitiveEntity::overlapsElement (SelectBasics_Sel
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean MeshVS_CommonSensitiveEntity::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean MeshVS_CommonSensitiveEntity::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx)
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
|
if (theIsFullInside)
|
||||||
|
{
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
const Standard_Integer anItemIdx = myItemIndexes.Value (theElemIdx);
|
const Standard_Integer anItemIdx = myItemIndexes.Value (theElemIdx);
|
||||||
if (mySelMethod == MeshVS_MSM_PRECISE)
|
if (mySelMethod == MeshVS_MSM_PRECISE)
|
||||||
{
|
{
|
||||||
|
@@ -65,13 +65,15 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx overlaps the current selecting volume
|
//! Checks whether the entity with index theIdx overlaps the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) Standard_OVERRIDE;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
||||||
Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
||||||
|
@@ -84,22 +84,21 @@ Handle(Select3D_SensitiveEntity) MeshVS_SensitivePolyhedron::GetConnected()
|
|||||||
Standard_Boolean MeshVS_SensitivePolyhedron::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean MeshVS_SensitivePolyhedron::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult)
|
||||||
{
|
{
|
||||||
Standard_Real aDepthMin = RealLast();
|
SelectBasics_PickResult aPickResult;
|
||||||
Standard_Real aDistToCOG = RealLast();
|
|
||||||
|
|
||||||
for (MeshVS_PolyhedronVertsIter aIter (myTopology); aIter.More(); aIter.Next())
|
for (MeshVS_PolyhedronVertsIter aIter (myTopology); aIter.More(); aIter.Next())
|
||||||
{
|
{
|
||||||
Standard_Real aDepth = RealLast();
|
if (theMgr.Overlaps (aIter.Value(), Select3D_TOS_INTERIOR, aPickResult))
|
||||||
if (theMgr.Overlaps (aIter.Value(), Select3D_TOS_INTERIOR, aDepth))
|
|
||||||
{
|
{
|
||||||
aDepthMin = Min (aDepth, aDepthMin);
|
thePickResult = SelectBasics_PickResult::Min (thePickResult, aPickResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!thePickResult.IsValid())
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
aDistToCOG = aDepthMin == RealLast() ? RealLast() : theMgr.DistToGeometryCenter (myCenter);
|
thePickResult.SetDistToGeomCenter (theMgr.DistToGeometryCenter (CenterOfGeometry()));
|
||||||
thePickResult = SelectBasics_PickResult (aDepthMin, aDistToCOG);
|
return Standard_True;
|
||||||
|
|
||||||
return aDepthMin != RealLast();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -66,8 +66,6 @@ Handle(Select3D_SensitiveEntity) MeshVS_SensitiveQuad::GetConnected()
|
|||||||
Standard_Boolean MeshVS_SensitiveQuad::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean MeshVS_SensitiveQuad::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult)
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (RealLast(), RealLast());
|
|
||||||
|
|
||||||
if (!theMgr.IsOverlapAllowed()) // check for inclusion
|
if (!theMgr.IsOverlapAllowed()) // check for inclusion
|
||||||
{
|
{
|
||||||
for (Standard_Integer aPntIdx = 0; aPntIdx < 4; ++aPntIdx)
|
for (Standard_Integer aPntIdx = 0; aPntIdx < 4; ++aPntIdx)
|
||||||
@@ -80,16 +78,15 @@ Standard_Boolean MeshVS_SensitiveQuad::Matches (SelectBasics_SelectingVolumeMana
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for overlap
|
// check for overlap
|
||||||
Standard_Real aDepth1 = std::numeric_limits<Standard_Real>::max();
|
SelectBasics_PickResult aPickResult1, aPickResult2;
|
||||||
Standard_Real aDepth2 = std::numeric_limits<Standard_Real>::max();
|
if (!theMgr.Overlaps (myVertices[0], myVertices[1], myVertices[2], Select3D_TOS_INTERIOR, aPickResult1)
|
||||||
if (!theMgr.Overlaps (myVertices[0], myVertices[1], myVertices[2], Select3D_TOS_INTERIOR, aDepth1)
|
&& !theMgr.Overlaps (myVertices[0], myVertices[2], myVertices[3], Select3D_TOS_INTERIOR, aPickResult2))
|
||||||
&& !theMgr.Overlaps (myVertices[0], myVertices[2], myVertices[3], Select3D_TOS_INTERIOR, aDepth2))
|
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
thePickResult = SelectBasics_PickResult (Min (aDepth1, aDepth2), theMgr.DistToGeometryCenter (CenterOfGeometry()));
|
thePickResult = SelectBasics_PickResult::Min (aPickResult1, aPickResult2);
|
||||||
|
thePickResult.SetDistToGeomCenter (theMgr.DistToGeometryCenter(CenterOfGeometry()));
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -180,7 +180,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
|||||||
#endif
|
#endif
|
||||||
myToCullBackFaces (false),
|
myToCullBackFaces (false),
|
||||||
myReadBuffer (0),
|
myReadBuffer (0),
|
||||||
myDrawBuffers (1),
|
myDrawBuffers (0, 7),
|
||||||
myDefaultVao (0),
|
myDefaultVao (0),
|
||||||
myColorMask (true),
|
myColorMask (true),
|
||||||
myAlphaToCoverage (false),
|
myAlphaToCoverage (false),
|
||||||
@@ -410,12 +410,8 @@ void OpenGl_Context::SetDrawBuffer (const Standard_Integer theDrawBuffer)
|
|||||||
}
|
}
|
||||||
::glDrawBuffer (aDrawBuffer);
|
::glDrawBuffer (aDrawBuffer);
|
||||||
|
|
||||||
myDrawBuffers.Clear();
|
myDrawBuffers.Init (GL_NONE);
|
||||||
|
myDrawBuffers.SetValue (0, aDrawBuffer);
|
||||||
if (aDrawBuffer != GL_NONE)
|
|
||||||
{
|
|
||||||
myDrawBuffers.SetValue (0, aDrawBuffer);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
(void )theDrawBuffer;
|
(void )theDrawBuffer;
|
||||||
#endif
|
#endif
|
||||||
@@ -429,7 +425,12 @@ void OpenGl_Context::SetDrawBuffers (const Standard_Integer theNb, const Standar
|
|||||||
{
|
{
|
||||||
Standard_ASSERT_RETURN (hasDrawBuffers, "Multiple draw buffers feature is not supported by the context", Standard_ASSERT_DO_NOTHING());
|
Standard_ASSERT_RETURN (hasDrawBuffers, "Multiple draw buffers feature is not supported by the context", Standard_ASSERT_DO_NOTHING());
|
||||||
|
|
||||||
myDrawBuffers.Clear();
|
if (myDrawBuffers.Length() < theNb)
|
||||||
|
{
|
||||||
|
// should actually never happen here
|
||||||
|
myDrawBuffers.Resize (0, theNb - 1, false);
|
||||||
|
}
|
||||||
|
myDrawBuffers.Init (GL_NONE);
|
||||||
|
|
||||||
Standard_Boolean useDefaultFbo = Standard_False;
|
Standard_Boolean useDefaultFbo = Standard_False;
|
||||||
for (Standard_Integer anI = 0; anI < theNb; ++anI)
|
for (Standard_Integer anI = 0; anI < theNb; ++anI)
|
||||||
@@ -438,7 +439,7 @@ void OpenGl_Context::SetDrawBuffers (const Standard_Integer theNb, const Standar
|
|||||||
{
|
{
|
||||||
useDefaultFbo = Standard_True;
|
useDefaultFbo = Standard_True;
|
||||||
}
|
}
|
||||||
else if (theDrawBuffers[anI] != GL_NONE)
|
else
|
||||||
{
|
{
|
||||||
myDrawBuffers.SetValue (anI, theDrawBuffers[anI]);
|
myDrawBuffers.SetValue (anI, theDrawBuffers[anI]);
|
||||||
}
|
}
|
||||||
@@ -491,31 +492,24 @@ void OpenGl_Context::FetchState()
|
|||||||
::glGetIntegerv (GL_READ_BUFFER, &myReadBuffer);
|
::glGetIntegerv (GL_READ_BUFFER, &myReadBuffer);
|
||||||
|
|
||||||
// cache draw buffers state
|
// cache draw buffers state
|
||||||
myDrawBuffers.Clear();
|
if (myDrawBuffers.Length() < myMaxDrawBuffers)
|
||||||
|
{
|
||||||
|
myDrawBuffers.Resize (0, myMaxDrawBuffers - 1, false);
|
||||||
|
}
|
||||||
|
myDrawBuffers.Init (GL_NONE);
|
||||||
|
|
||||||
|
Standard_Integer aDrawBuffer = GL_NONE;
|
||||||
if (myMaxDrawBuffers == 1)
|
if (myMaxDrawBuffers == 1)
|
||||||
{
|
{
|
||||||
Standard_Integer aDrawBuffer;
|
|
||||||
|
|
||||||
::glGetIntegerv (GL_DRAW_BUFFER, &aDrawBuffer);
|
::glGetIntegerv (GL_DRAW_BUFFER, &aDrawBuffer);
|
||||||
|
myDrawBuffers.SetValue (0, aDrawBuffer);
|
||||||
if (aDrawBuffer != GL_NONE)
|
|
||||||
{
|
|
||||||
myDrawBuffers.SetValue (0, aDrawBuffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Standard_Integer aDrawBuffer;
|
|
||||||
|
|
||||||
for (Standard_Integer anI = 0; anI < myMaxDrawBuffers; ++anI)
|
for (Standard_Integer anI = 0; anI < myMaxDrawBuffers; ++anI)
|
||||||
{
|
{
|
||||||
::glGetIntegerv (GL_DRAW_BUFFER0 + anI, &aDrawBuffer);
|
::glGetIntegerv (GL_DRAW_BUFFER0 + anI, &aDrawBuffer);
|
||||||
|
myDrawBuffers.SetValue (anI, aDrawBuffer);
|
||||||
if (aDrawBuffer != GL_NONE)
|
|
||||||
{
|
|
||||||
myDrawBuffers.SetValue (anI, aDrawBuffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1452,6 +1446,10 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
{
|
{
|
||||||
glGetIntegerv (GL_MAX_DRAW_BUFFERS, &myMaxDrawBuffers);
|
glGetIntegerv (GL_MAX_DRAW_BUFFERS, &myMaxDrawBuffers);
|
||||||
glGetIntegerv (GL_MAX_COLOR_ATTACHMENTS, &myMaxColorAttachments);
|
glGetIntegerv (GL_MAX_COLOR_ATTACHMENTS, &myMaxColorAttachments);
|
||||||
|
if (myDrawBuffers.Length() < myMaxDrawBuffers)
|
||||||
|
{
|
||||||
|
myDrawBuffers.Resize (0, myMaxDrawBuffers - 1, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
|
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
|
||||||
|
@@ -622,9 +622,12 @@ public: //! @name methods to alter or retrieve current state
|
|||||||
Standard_EXPORT void SetReadBuffer (const Standard_Integer theReadBuffer);
|
Standard_EXPORT void SetReadBuffer (const Standard_Integer theReadBuffer);
|
||||||
|
|
||||||
//! Return active draw buffer attached to a render target referred by index (layout location).
|
//! Return active draw buffer attached to a render target referred by index (layout location).
|
||||||
Standard_Integer DrawBuffer (const Standard_Integer theIndex = 0)
|
Standard_Integer DrawBuffer (Standard_Integer theIndex = 0) const
|
||||||
{
|
{
|
||||||
return myDrawBuffers.IsBound (theIndex) ? myDrawBuffers.Value (theIndex) : GL_NONE;
|
return theIndex >= myDrawBuffers.Lower()
|
||||||
|
&& theIndex <= myDrawBuffers.Upper()
|
||||||
|
? myDrawBuffers.Value (theIndex)
|
||||||
|
: GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Switch draw buffer, wrapper for ::glDrawBuffer().
|
//! Switch draw buffer, wrapper for ::glDrawBuffer().
|
||||||
@@ -884,7 +887,6 @@ private: // context info
|
|||||||
|
|
||||||
typedef NCollection_Shared< NCollection_DataMap<TCollection_AsciiString, Standard_Integer> > OpenGl_DelayReleaseMap;
|
typedef NCollection_Shared< NCollection_DataMap<TCollection_AsciiString, Standard_Integer> > OpenGl_DelayReleaseMap;
|
||||||
typedef NCollection_Shared< NCollection_List<Handle(OpenGl_Resource)> > OpenGl_ResourcesStack;
|
typedef NCollection_Shared< NCollection_List<Handle(OpenGl_Resource)> > OpenGl_ResourcesStack;
|
||||||
typedef NCollection_SparseArray<Standard_Integer> OpenGl_DrawBuffers;
|
|
||||||
|
|
||||||
Handle(OpenGl_ResourcesMap) mySharedResources; //!< shared resources with unique identification key
|
Handle(OpenGl_ResourcesMap) mySharedResources; //!< shared resources with unique identification key
|
||||||
Handle(OpenGl_DelayReleaseMap) myDelayed; //!< shared resources for delayed release
|
Handle(OpenGl_DelayReleaseMap) myDelayed; //!< shared resources for delayed release
|
||||||
@@ -932,7 +934,8 @@ private: //! @name fields tracking current state
|
|||||||
Graphic3d_PolygonOffset myPolygonOffset; //!< currently applied polygon offset
|
Graphic3d_PolygonOffset myPolygonOffset; //!< currently applied polygon offset
|
||||||
bool myToCullBackFaces; //!< back face culling mode enabled state (glIsEnabled (GL_CULL_FACE))
|
bool myToCullBackFaces; //!< back face culling mode enabled state (glIsEnabled (GL_CULL_FACE))
|
||||||
Standard_Integer myReadBuffer; //!< current read buffer
|
Standard_Integer myReadBuffer; //!< current read buffer
|
||||||
OpenGl_DrawBuffers myDrawBuffers; //!< current draw buffers
|
NCollection_Array1<Standard_Integer>
|
||||||
|
myDrawBuffers; //!< current draw buffers
|
||||||
unsigned int myDefaultVao; //!< default Vertex Array Object
|
unsigned int myDefaultVao; //!< default Vertex Array Object
|
||||||
Standard_Boolean myColorMask; //!< flag indicating writing into color buffer is enabled or disabled (glColorMask)
|
Standard_Boolean myColorMask; //!< flag indicating writing into color buffer is enabled or disabled (glColorMask)
|
||||||
Standard_Boolean myAlphaToCoverage; //!< flag indicating GL_SAMPLE_ALPHA_TO_COVERAGE state
|
Standard_Boolean myAlphaToCoverage; //!< flag indicating GL_SAMPLE_ALPHA_TO_COVERAGE state
|
||||||
|
@@ -950,56 +950,6 @@ static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, co
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ShapeAnalysis_Edge.hxx>
|
|
||||||
|
|
||||||
static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
|
|
||||||
{
|
|
||||||
if( n < 3) {
|
|
||||||
di<<"-1\n";
|
|
||||||
di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
TopoDS_Shape Sh1 = DBRep::Get(a[1]);
|
|
||||||
TopoDS_Shape Sh2 = DBRep::Get(a[2]);
|
|
||||||
if(Sh1.IsNull() || Sh2.IsNull()) {
|
|
||||||
di<<"-2\n";
|
|
||||||
di<<"Invalid arguments\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
TopoDS_Edge e1 = TopoDS::Edge(Sh1);
|
|
||||||
TopoDS_Edge e2 = TopoDS::Edge(Sh2);
|
|
||||||
if(e1.IsNull() || e2.IsNull()) {
|
|
||||||
di<<"-3\n";
|
|
||||||
di<<"Invalid type of arguments\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
Standard_Real aTol = Precision::Confusion();
|
|
||||||
Standard_Real aDistDomain = 0.0;
|
|
||||||
Standard_Integer k = 3;
|
|
||||||
if(k < n)
|
|
||||||
aTol = Draw::Atof(a[k++]);
|
|
||||||
if(k < n)
|
|
||||||
aDistDomain = Draw::Atof(a[k++]);
|
|
||||||
|
|
||||||
ShapeAnalysis_Edge sae;
|
|
||||||
if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
|
|
||||||
if(aDistDomain ==0.0) {
|
|
||||||
di<<"1\n";
|
|
||||||
di<<"Edges is overlaping comletly\n";
|
|
||||||
} else {
|
|
||||||
di<<"2\n";
|
|
||||||
di<<"Edges is overlaped\n";
|
|
||||||
di<<"with tolerance = "<<aTol<<"\n";
|
|
||||||
di<<"on segment length = "<<aDistDomain<<"\n";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
di<<"3\n";
|
|
||||||
di<<"Edges is not overlaped\n";
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include <DDocStd_DrawDocument.hxx>
|
#include <DDocStd_DrawDocument.hxx>
|
||||||
#include <TDataStd_Name.hxx>
|
#include <TDataStd_Name.hxx>
|
||||||
#include <Draw.hxx>
|
#include <Draw.hxx>
|
||||||
@@ -4830,8 +4780,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) {
|
|||||||
//theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
|
//theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
|
||||||
theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
|
theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
|
||||||
|
|
||||||
theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
|
|
||||||
|
|
||||||
theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
|
theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
|
||||||
// Must use OCC299
|
// Must use OCC299
|
||||||
//theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
|
//theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
|
||||||
|
@@ -3901,11 +3901,12 @@ Standard_Integer OCC26446 (Draw_Interpretor& di,
|
|||||||
aCurves.SetValue(1, aCurve2);
|
aCurves.SetValue(1, aCurve2);
|
||||||
aTolerances.SetValue(0, aTolConf);
|
aTolerances.SetValue(0, aTolConf);
|
||||||
|
|
||||||
|
Standard_Boolean closed_flag = Standard_False;
|
||||||
GeomConvert::ConcatC1(aCurves,
|
GeomConvert::ConcatC1(aCurves,
|
||||||
aTolerances,
|
aTolerances,
|
||||||
anIndices,
|
anIndices,
|
||||||
aConcatCurves,
|
aConcatCurves,
|
||||||
Standard_False,
|
closed_flag,
|
||||||
aTolClosure);
|
aTolClosure);
|
||||||
|
|
||||||
Handle(Geom_BSplineCurve) aResult =
|
Handle(Geom_BSplineCurve) aResult =
|
||||||
|
@@ -56,6 +56,7 @@
|
|||||||
#include <STEPConstruct_Tool.hxx>
|
#include <STEPConstruct_Tool.hxx>
|
||||||
#include <STEPConstruct_UnitContext.hxx>
|
#include <STEPConstruct_UnitContext.hxx>
|
||||||
#include <STEPConstruct_ValidationProps.hxx>
|
#include <STEPConstruct_ValidationProps.hxx>
|
||||||
|
#include <STEPControl_ActorRead.hxx>
|
||||||
#include <STEPControl_Reader.hxx>
|
#include <STEPControl_Reader.hxx>
|
||||||
#include <StepGeom_GeometricRepresentationItem.hxx>
|
#include <StepGeom_GeometricRepresentationItem.hxx>
|
||||||
#include <StepGeom_Axis2Placement3d.hxx>
|
#include <StepGeom_Axis2Placement3d.hxx>
|
||||||
@@ -229,6 +230,7 @@
|
|||||||
#include <Transfer_Binder.hxx>
|
#include <Transfer_Binder.hxx>
|
||||||
#include <Transfer_TransientProcess.hxx>
|
#include <Transfer_TransientProcess.hxx>
|
||||||
#include <TransferBRep.hxx>
|
#include <TransferBRep.hxx>
|
||||||
|
#include <UnitsMethods.hxx>
|
||||||
#include <XCAFDoc.hxx>
|
#include <XCAFDoc.hxx>
|
||||||
#include <XCAFDoc_Area.hxx>
|
#include <XCAFDoc_Area.hxx>
|
||||||
#include <XCAFDoc_Centroid.hxx>
|
#include <XCAFDoc_Centroid.hxx>
|
||||||
@@ -253,6 +255,8 @@
|
|||||||
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
|
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
|
||||||
#include <XCAFDimTolObjects_DatumObject.hxx>
|
#include <XCAFDimTolObjects_DatumObject.hxx>
|
||||||
#include <XCAFView_Object.hxx>
|
#include <XCAFView_Object.hxx>
|
||||||
|
#include <XSAlgo.hxx>
|
||||||
|
#include <XSAlgo_AlgoContainer.hxx>
|
||||||
#include <XSControl_TransferReader.hxx>
|
#include <XSControl_TransferReader.hxx>
|
||||||
#include <XSControl_WorkSession.hxx>
|
#include <XSControl_WorkSession.hxx>
|
||||||
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
#include <StepAP242_DraughtingModelItemAssociation.hxx>
|
||||||
@@ -1621,104 +1625,6 @@ Standard_Boolean STEPCAFControl_Reader::ReadSHUOs (const Handle(XSControl_WorkSe
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetLengthConversionFactor
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
static Standard_Boolean GetLengthConversionFactor(const Handle(StepBasic_NamedUnit)& NU,
|
|
||||||
Standard_Real& afact)
|
|
||||||
{
|
|
||||||
afact=1.;
|
|
||||||
if( !NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)) ) return Standard_False;
|
|
||||||
Handle(StepBasic_ConversionBasedUnitAndLengthUnit) CBULU =
|
|
||||||
Handle(StepBasic_ConversionBasedUnitAndLengthUnit)::DownCast(NU);
|
|
||||||
Handle(StepBasic_MeasureWithUnit) MWUCBU = CBULU->ConversionFactor();
|
|
||||||
afact = MWUCBU->ValueComponent();
|
|
||||||
StepBasic_Unit anUnit2 = MWUCBU->UnitComponent();
|
|
||||||
if(anUnit2.CaseNum(anUnit2.Value())==1) {
|
|
||||||
Handle(StepBasic_NamedUnit) NU2 = anUnit2.NamedUnit();
|
|
||||||
if(NU2->IsKind(STANDARD_TYPE(StepBasic_SiUnit))) {
|
|
||||||
Handle(StepBasic_SiUnit) SU = Handle(StepBasic_SiUnit)::DownCast(NU2);
|
|
||||||
if(SU->Name()==StepBasic_sunMetre) {
|
|
||||||
if(SU->HasPrefix())
|
|
||||||
afact *= STEPConstruct_UnitContext::ConvertSiPrefix (SU->Prefix());
|
|
||||||
// convert m to mm
|
|
||||||
afact *= 1000.;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetLengthConversionFactorFromContext
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
static Standard_Boolean GetLengthConversionFactorFromContext(const Handle(StepRepr_RepresentationContext)& theRC,
|
|
||||||
Standard_Real& theFact)
|
|
||||||
{
|
|
||||||
theFact = 1;
|
|
||||||
if (theRC.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
Handle(StepBasic_ConversionBasedUnitAndLengthUnit) aSiLU;
|
|
||||||
Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext) aCtx =
|
|
||||||
Handle(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext)::DownCast(theRC);
|
|
||||||
if (!aCtx.IsNull()) {
|
|
||||||
for (Standard_Integer j = 1; j <= aCtx->NbUnits(); j++) {
|
|
||||||
if (aCtx->UnitsValue(j)->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))) {
|
|
||||||
aSiLU = Handle(StepBasic_ConversionBasedUnitAndLengthUnit)::DownCast(aCtx->UnitsValue(j));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (aSiLU.IsNull()) {
|
|
||||||
Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx) aCtx1 =
|
|
||||||
Handle(StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx)::DownCast(theRC);
|
|
||||||
if (!aCtx1.IsNull()) {
|
|
||||||
for (Standard_Integer j = 1; j <= aCtx1->NbUnits(); j++) {
|
|
||||||
if (aCtx1->UnitsValue(j)->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))) {
|
|
||||||
aSiLU = Handle(StepBasic_ConversionBasedUnitAndLengthUnit)::DownCast(aCtx1->UnitsValue(j));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (aSiLU.IsNull())
|
|
||||||
return Standard_False;
|
|
||||||
return GetLengthConversionFactor(aSiLU, theFact);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : GetAngleConversionFactor
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
static Standard_Boolean GetAngleConversionFactor(Handle(StepBasic_NamedUnit)& NU,
|
|
||||||
Standard_Real& afact)
|
|
||||||
{
|
|
||||||
afact=1.;
|
|
||||||
if( !NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)) ) return Standard_False;
|
|
||||||
Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit) CBULU =
|
|
||||||
Handle(StepBasic_ConversionBasedUnitAndPlaneAngleUnit)::DownCast(NU);
|
|
||||||
Handle(StepBasic_MeasureWithUnit) MWUCBU = CBULU->ConversionFactor();
|
|
||||||
afact = MWUCBU->ValueComponent();
|
|
||||||
StepBasic_Unit anUnit2 = MWUCBU->UnitComponent();
|
|
||||||
if(anUnit2.CaseNum(anUnit2.Value())==1) {
|
|
||||||
Handle(StepBasic_NamedUnit) NU2 = anUnit2.NamedUnit();
|
|
||||||
if(NU2->IsKind(STANDARD_TYPE(StepBasic_SiUnit))) {
|
|
||||||
Handle(StepBasic_SiUnit) SU = Handle(StepBasic_SiUnit)::DownCast(NU2);
|
|
||||||
if(SU->Name()==StepBasic_sunRadian) {
|
|
||||||
if(SU->HasPrefix())
|
|
||||||
afact *= STEPConstruct_UnitContext::ConvertSiPrefix (SU->Prefix());
|
|
||||||
// convert radian to deg
|
|
||||||
afact *= 180/M_PI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetMassConversionFactor
|
//function : GetMassConversionFactor
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -1893,7 +1799,6 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
|||||||
//purpose : read annotation plane
|
//purpose : read annotation plane
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) theAnnotationPlane,
|
Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) theAnnotationPlane,
|
||||||
const Standard_Real theFact,
|
|
||||||
gp_Ax2& thePlane)
|
gp_Ax2& thePlane)
|
||||||
{
|
{
|
||||||
if (theAnnotationPlane.IsNull())
|
if (theAnnotationPlane.IsNull())
|
||||||
@@ -1914,13 +1819,8 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) th
|
|||||||
if (aA2P3D.IsNull())
|
if (aA2P3D.IsNull())
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
gp_Ax2 aPlaneAxes;
|
|
||||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D);
|
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D);
|
||||||
aPlaneAxes = anAxis->Ax2();
|
thePlane = anAxis->Ax2();
|
||||||
gp_XYZ aLocPos = aPlaneAxes.Location().XYZ();
|
|
||||||
aLocPos *= theFact;
|
|
||||||
aPlaneAxes.SetLocation(aLocPos);
|
|
||||||
thePlane = aPlaneAxes;
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1958,9 +1858,10 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
|||||||
// calculate units
|
// calculate units
|
||||||
Handle(StepVisual_DraughtingModel) aDModel =
|
Handle(StepVisual_DraughtingModel) aDModel =
|
||||||
Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
|
Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
|
||||||
Standard_Real aFact = 1;
|
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||||
if (!aDModel.IsNull())
|
STEPControl_ActorRead anActor;
|
||||||
GetLengthConversionFactorFromContext(aDModel->ContextOfItems(), aFact);
|
anActor.PrepareUnits(aDModel, aTP);
|
||||||
|
Standard_Real aFact = UnitsMethods::LengthFactor();
|
||||||
|
|
||||||
// retrieve AnnotationPlane
|
// retrieve AnnotationPlane
|
||||||
Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1);
|
Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1);
|
||||||
@@ -1972,7 +1873,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
|||||||
for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) {
|
for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) {
|
||||||
anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value());
|
anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value());
|
||||||
}
|
}
|
||||||
Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aFact, aPlaneAxes);
|
Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aPlaneAxes);
|
||||||
|
|
||||||
// set plane axes to XCAF
|
// set plane axes to XCAF
|
||||||
if (isHasPlane) {
|
if (isHasPlane) {
|
||||||
@@ -2052,14 +1953,15 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
|
|||||||
const Interface_Graph& aGraph = aTP->Graph();
|
const Interface_Graph& aGraph = aTP->Graph();
|
||||||
|
|
||||||
//calculate units
|
//calculate units
|
||||||
Standard_Real aFact = 1;
|
|
||||||
Handle(StepShape_ShapeDimensionRepresentation) aSDR = NULL;
|
Handle(StepShape_ShapeDimensionRepresentation) aSDR = NULL;
|
||||||
for (Interface_EntityIterator anIt = aGraph.Sharings(theGDT); aSDR.IsNull() && anIt.More(); anIt.Next()) {
|
for (Interface_EntityIterator anIt = aGraph.Sharings(theGDT); aSDR.IsNull() && anIt.More(); anIt.Next()) {
|
||||||
aSDR = Handle(StepShape_ShapeDimensionRepresentation)::DownCast(anIt.Value());
|
aSDR = Handle(StepShape_ShapeDimensionRepresentation)::DownCast(anIt.Value());
|
||||||
}
|
}
|
||||||
if (!aSDR.IsNull())
|
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||||
GetLengthConversionFactorFromContext(aSDR->ContextOfItems(), aFact);
|
STEPControl_ActorRead anActor;
|
||||||
|
anActor.PrepareUnits(aSDR, aTP);
|
||||||
|
Standard_Real aFact = UnitsMethods::LengthFactor();
|
||||||
|
|
||||||
if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) {
|
if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) {
|
||||||
// retrieve derived geometry
|
// retrieve derived geometry
|
||||||
Handle(StepShape_DimensionalSize) aDim = Handle(StepShape_DimensionalSize)::DownCast(theGDT);
|
Handle(StepShape_DimensionalSize) aDim = Handle(StepShape_DimensionalSize)::DownCast(theGDT);
|
||||||
@@ -2459,6 +2361,9 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
|||||||
{
|
{
|
||||||
Handle(StepGeom_Axis2Placement3d) anAx
|
Handle(StepGeom_Axis2Placement3d) anAx
|
||||||
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
|
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
|
||||||
|
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||||
|
STEPControl_ActorRead anActor;
|
||||||
|
anActor.PrepareUnits(aSRWP, aTP);
|
||||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx);
|
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx);
|
||||||
aDatTargetObj->SetDatumTargetAxis(anAxis->Ax2());
|
aDatTargetObj->SetDatumTargetAxis(anAxis->Ax2());
|
||||||
}
|
}
|
||||||
@@ -2468,14 +2373,14 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
|||||||
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(aSRWP->ItemsValue(j));
|
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(aSRWP->ItemsValue(j));
|
||||||
Standard_Real aVal = aM->GetMeasureWithUnit()->ValueComponent();
|
Standard_Real aVal = aM->GetMeasureWithUnit()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aM->GetMeasureWithUnit()->UnitComponent();
|
StepBasic_Unit anUnit = aM->GetMeasureWithUnit()->UnitComponent();
|
||||||
Standard_Real aFact = 1.;
|
|
||||||
if (anUnit.IsNull())
|
if (anUnit.IsNull())
|
||||||
continue;
|
continue;
|
||||||
Handle(StepBasic_NamedUnit) aNU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) aNU = anUnit.NamedUnit();
|
||||||
if (aNU.IsNull())
|
if (aNU.IsNull())
|
||||||
continue;
|
continue;
|
||||||
if (GetLengthConversionFactor(aNU, aFact))
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
aVal = aVal * aFact;
|
anUnitCtx.ComputeFactors(aNU);
|
||||||
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
if (aM->Name()->String().IsEqual("target length") ||
|
if (aM->Name()->String().IsEqual("target length") ||
|
||||||
aM->Name()->String().IsEqual("target diameter"))
|
aM->Name()->String().IsEqual("target diameter"))
|
||||||
aDatTargetObj->SetDatumTargetLength(aVal);
|
aDatTargetObj->SetDatumTargetLength(aVal);
|
||||||
@@ -2626,12 +2531,12 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
|
|||||||
aXCAFModifWithVal = (XCAFDimTolObjects_DatumModifWithValue)(aModif->Value(m).DatumReferenceModifierWithValue()->ModifierType() + 1);
|
aXCAFModifWithVal = (XCAFDimTolObjects_DatumModifWithValue)(aModif->Value(m).DatumReferenceModifierWithValue()->ModifierType() + 1);
|
||||||
Standard_Real aVal = aModif->Value(m).DatumReferenceModifierWithValue()->ModifierValue()->ValueComponent();
|
Standard_Real aVal = aModif->Value(m).DatumReferenceModifierWithValue()->ModifierValue()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aModif->Value(m).DatumReferenceModifierWithValue()->ModifierValue()->UnitComponent();
|
StepBasic_Unit anUnit = aModif->Value(m).DatumReferenceModifierWithValue()->ModifierValue()->UnitComponent();
|
||||||
Standard_Real aFact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
aModifValue = aVal;
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
aModifValue = aVal * anUnitCtx.LengthFactor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2663,12 +2568,12 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
|
|||||||
aXCAFModifWithVal = (XCAFDimTolObjects_DatumModifWithValue)(aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierType() + 1);
|
aXCAFModifWithVal = (XCAFDimTolObjects_DatumModifWithValue)(aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierType() + 1);
|
||||||
Standard_Real aVal = aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierValue()->ValueComponent();
|
Standard_Real aVal = aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierValue()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierValue()->UnitComponent();
|
StepBasic_Unit anUnit = aModifE->Value(k).DatumReferenceModifierWithValue()->ModifierValue()->UnitComponent();
|
||||||
Standard_Real aFact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
aModifValue = aVal;
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
aModifValue = aVal * anUnitCtx.LengthFactor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2863,11 +2768,12 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
|||||||
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(RI1);
|
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(RI1);
|
||||||
dim1 = RILMWU->GetMeasureWithUnit()->ValueComponent();
|
dim1 = RILMWU->GetMeasureWithUnit()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = RILMWU->GetMeasureWithUnit()->UnitComponent();
|
StepBasic_Unit anUnit = RILMWU->GetMeasureWithUnit()->UnitComponent();
|
||||||
Standard_Real afact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,afact)) dim1=dim1*afact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
dim1 = dim1 * anUnitCtx.LengthFactor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(HARI->Length()>1) {
|
if(HARI->Length()>1) {
|
||||||
@@ -2878,11 +2784,12 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
|||||||
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(RI2);
|
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(RI2);
|
||||||
dim2 = RILMWU->GetMeasureWithUnit()->ValueComponent();
|
dim2 = RILMWU->GetMeasureWithUnit()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = RILMWU->GetMeasureWithUnit()->UnitComponent();
|
StepBasic_Unit anUnit = RILMWU->GetMeasureWithUnit()->UnitComponent();
|
||||||
Standard_Real afact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,afact)) dim2 = dim2*afact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
dim2 = dim2 * anUnitCtx.LengthFactor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2918,11 +2825,12 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
|||||||
if(dim3.IsNull()) continue;
|
if(dim3.IsNull()) continue;
|
||||||
Standard_Real dim = dim3->ValueComponent();
|
Standard_Real dim = dim3->ValueComponent();
|
||||||
StepBasic_Unit anUnit = GT->Magnitude()->UnitComponent();
|
StepBasic_Unit anUnit = GT->Magnitude()->UnitComponent();
|
||||||
Standard_Real afact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,afact)) dim = dim*afact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
dim = dim * anUnitCtx.LengthFactor();
|
||||||
//cout<<"GeometricTolerance: Magnitude = "<<dim<<endl;
|
//cout<<"GeometricTolerance: Magnitude = "<<dim<<endl;
|
||||||
Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(1,1);
|
Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(1,1);
|
||||||
arr->SetValue(1,dim);
|
arr->SetValue(1,dim);
|
||||||
@@ -3146,6 +3054,25 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
|||||||
return aGDTL;
|
return aGDTL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : convertAngleValue
|
||||||
|
//purpose : auxilary
|
||||||
|
//=======================================================================
|
||||||
|
void convertAngleValue(
|
||||||
|
const STEPConstruct_UnitContext& anUnitCtx,
|
||||||
|
Standard_Real& aVal)
|
||||||
|
{
|
||||||
|
// convert radian to deg
|
||||||
|
Standard_Real aFact = anUnitCtx.PlaneAngleFactor() * 180 / M_PI;
|
||||||
|
// in order to avoid inaccuracy of calculation perform conversion
|
||||||
|
// only if aFact not eqaul 1 with some precision
|
||||||
|
if (fabs(1. - aFact) > Precision::Confusion())
|
||||||
|
{
|
||||||
|
aVal = aVal * aFact;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : setDimObjectToXCAF
|
//function : setDimObjectToXCAF
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -3212,20 +3139,19 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
Handle(StepRepr_ReprItemAndMeasureWithUnit)::DownCast(aDRI);
|
Handle(StepRepr_ReprItemAndMeasureWithUnit)::DownCast(aDRI);
|
||||||
Standard_Real aVal = aMWU->GetMeasureWithUnit()->ValueComponent();
|
Standard_Real aVal = aMWU->GetMeasureWithUnit()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aMWU->GetMeasureWithUnit()->UnitComponent();
|
StepBasic_Unit anUnit = aMWU->GetMeasureWithUnit()->UnitComponent();
|
||||||
Standard_Real aFact = 1.;
|
|
||||||
if (anUnit.IsNull())
|
if (anUnit.IsNull())
|
||||||
continue;
|
continue;
|
||||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1))
|
if (!(anUnit.CaseNum(anUnit.Value()) == 1))
|
||||||
continue;
|
continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
|
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
|
||||||
if (GetLengthConversionFactor(NU, aFact))
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
aVal = aVal * aFact;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnit))) {
|
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnit))) {
|
||||||
if (GetAngleConversionFactor(NU, aFact))
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
aVal = aVal * aFact;
|
|
||||||
}
|
}
|
||||||
Handle(TCollection_HAsciiString) aName = aMWU->Name();
|
Handle(TCollection_HAsciiString) aName = aMWU->Name();
|
||||||
if (aName->Search("upper") > 0) // upper limit
|
if (aName->Search("upper") > 0) // upper limit
|
||||||
@@ -3239,20 +3165,19 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
Handle(StepRepr_ReprItemAndMeasureWithUnitAndQRI)::DownCast(aDRI);
|
Handle(StepRepr_ReprItemAndMeasureWithUnitAndQRI)::DownCast(aDRI);
|
||||||
Standard_Real aVal = aMWU->GetMeasureWithUnit()->ValueComponent();
|
Standard_Real aVal = aMWU->GetMeasureWithUnit()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aMWU->GetMeasureWithUnit()->UnitComponent();
|
StepBasic_Unit anUnit = aMWU->GetMeasureWithUnit()->UnitComponent();
|
||||||
Standard_Real aFact = 1.;
|
|
||||||
if(anUnit.IsNull())
|
if(anUnit.IsNull())
|
||||||
continue;
|
continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value()) == 1) )
|
if( !(anUnit.CaseNum(anUnit.Value()) == 1) )
|
||||||
continue;
|
continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) {
|
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) {
|
||||||
if (GetLengthConversionFactor(NU, aFact))
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
aVal = aVal * aFact;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))) {
|
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI))) {
|
||||||
if (GetAngleConversionFactor(NU, aFact))
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
aVal = aVal * aFact;
|
|
||||||
}
|
}
|
||||||
Handle(StepShape_QualifiedRepresentationItem) aQRI = aMWU->GetQualifiedRepresentationItem();
|
Handle(StepShape_QualifiedRepresentationItem) aQRI = aMWU->GetQualifiedRepresentationItem();
|
||||||
if (aQRI->Qualifiers()->Length() == 0) {
|
if (aQRI->Qualifiers()->Length() == 0) {
|
||||||
@@ -3305,22 +3230,43 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
aTV = aTMD.ToleranceValue();
|
aTV = aTMD.ToleranceValue();
|
||||||
if (aTV.IsNull()) continue;
|
if (aTV.IsNull()) continue;
|
||||||
|
|
||||||
|
Handle(StepBasic_MeasureWithUnit) aMWU = aTV->UpperBound();
|
||||||
Standard_Real aVal = aTV->UpperBound()->ValueComponent();
|
Standard_Real aVal = aTV->UpperBound()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aTV->UpperBound()->UnitComponent();
|
StepBasic_Unit anUnit = aTV->UpperBound()->UnitComponent();
|
||||||
Standard_Real aFact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||||
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||||
|
{
|
||||||
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
|
}
|
||||||
|
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||||
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||||
|
{
|
||||||
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
|
}
|
||||||
aDim3 = aVal;
|
aDim3 = aVal;
|
||||||
|
|
||||||
|
aMWU = aTV->LowerBound();
|
||||||
aVal = aTV->LowerBound()->ValueComponent();
|
aVal = aTV->LowerBound()->ValueComponent();
|
||||||
anUnit = aTV->LowerBound()->UnitComponent();
|
anUnit = aTV->LowerBound()->UnitComponent();
|
||||||
aFact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
NU = anUnit.NamedUnit();
|
NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,aFact)) aVal=aVal*aFact;
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||||
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||||
|
{
|
||||||
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
|
}
|
||||||
|
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||||
|
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||||
|
{
|
||||||
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
|
}
|
||||||
aDim2 = Abs(aVal);
|
aDim2 = Abs(aVal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3664,12 +3610,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
//get value
|
//get value
|
||||||
Standard_Real aVal = aTolEnt->Magnitude()->ValueComponent();
|
Standard_Real aVal = aTolEnt->Magnitude()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aTolEnt->Magnitude()->UnitComponent();
|
StepBasic_Unit anUnit = aTolEnt->Magnitude()->UnitComponent();
|
||||||
Standard_Real aFact=1.;
|
|
||||||
if(anUnit.IsNull()) return;
|
if(anUnit.IsNull()) return;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) return;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) return;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,aFact))
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
aVal=aVal*aFact;
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
aTolObj->SetValue(aVal);
|
aTolObj->SetValue(aVal);
|
||||||
}
|
}
|
||||||
//get modifiers
|
//get modifiers
|
||||||
@@ -3689,12 +3635,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
{
|
{
|
||||||
Standard_Real aVal = aPZone->ProjectionLength()->ValueComponent();
|
Standard_Real aVal = aPZone->ProjectionLength()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aPZone->ProjectionLength()->UnitComponent();
|
StepBasic_Unit anUnit = aPZone->ProjectionLength()->UnitComponent();
|
||||||
Standard_Real aFact=1.;
|
|
||||||
if(anUnit.IsNull()) return;
|
if(anUnit.IsNull()) return;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) return;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) return;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetLengthConversionFactor(NU,aFact))
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
aVal=aVal*aFact;
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
aVal = aVal * anUnitCtx.LengthFactor();
|
||||||
aTolObj->SetValueOfZoneModifier(aVal);
|
aTolObj->SetValueOfZoneModifier(aVal);
|
||||||
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Projected);
|
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Projected);
|
||||||
}
|
}
|
||||||
@@ -3707,11 +3653,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
{
|
{
|
||||||
Standard_Real aVal = aRZone->Orientation()->Angle()->ValueComponent();
|
Standard_Real aVal = aRZone->Orientation()->Angle()->ValueComponent();
|
||||||
StepBasic_Unit anUnit = aRZone->Orientation()->Angle()->UnitComponent();
|
StepBasic_Unit anUnit = aRZone->Orientation()->Angle()->UnitComponent();
|
||||||
Standard_Real aFact=1.;
|
|
||||||
if(anUnit.IsNull()) continue;
|
if(anUnit.IsNull()) continue;
|
||||||
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
if( !(anUnit.CaseNum(anUnit.Value())==1) ) continue;
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetAngleConversionFactor(NU,aFact)) aVal=aVal*aFact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
aTolObj->SetValueOfZoneModifier(aVal);
|
aTolObj->SetValueOfZoneModifier(aVal);
|
||||||
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Runout);
|
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Runout);
|
||||||
}
|
}
|
||||||
@@ -3781,9 +3728,10 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
|||||||
}
|
}
|
||||||
if (!anUnit.IsNull() && (anUnit.CaseNum(anUnit.Value()) == 1))
|
if (!anUnit.IsNull() && (anUnit.CaseNum(anUnit.Value()) == 1))
|
||||||
{
|
{
|
||||||
Standard_Real aFact=1.;
|
|
||||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||||
if(GetAngleConversionFactor(NU,aFact)) aVal=aVal*aFact;
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
convertAngleValue(anUnitCtx, aVal);
|
||||||
aTolObj->SetMaxValueModifier(aVal);
|
aTolObj->SetMaxValueModifier(aVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3910,8 +3858,14 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
|||||||
|
|
||||||
// Calculate unit
|
// Calculate unit
|
||||||
Standard_Real aFact = 1.0;
|
Standard_Real aFact = 1.0;
|
||||||
if (!aDMIA.IsNull() && !aDMIA->UsedRepresentation().IsNull())
|
if (!aDMIA.IsNull())
|
||||||
GetLengthConversionFactorFromContext(aDMIA->UsedRepresentation()->ContextOfItems(), aFact);
|
{
|
||||||
|
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||||
|
STEPControl_ActorRead anActor;
|
||||||
|
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||||
|
anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP);
|
||||||
|
aFact = UnitsMethods::LengthFactor();
|
||||||
|
}
|
||||||
|
|
||||||
// Presentation
|
// Presentation
|
||||||
TopoDS_Shape aPresentation;
|
TopoDS_Shape aPresentation;
|
||||||
@@ -3944,7 +3898,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
|||||||
aDGTTool->SetDimension(aShapesL, anEmptySeq2, aGDTL);
|
aDGTTool->SetDimension(aShapesL, anEmptySeq2, aGDTL);
|
||||||
gp_Ax2 aPlaneAxes;
|
gp_Ax2 aPlaneAxes;
|
||||||
if (!anAnPlane.IsNull()) {
|
if (!anAnPlane.IsNull()) {
|
||||||
if (readAnnotationPlane(anAnPlane, aFact, aPlaneAxes))
|
if (readAnnotationPlane(anAnPlane, aPlaneAxes))
|
||||||
aDimObj->SetPlane(aPlaneAxes);
|
aDimObj->SetPlane(aPlaneAxes);
|
||||||
}
|
}
|
||||||
aDimObj->SetPresentation(aPresentation, aPresentName);
|
aDimObj->SetPresentation(aPresentation, aPresentName);
|
||||||
@@ -4064,15 +4018,23 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
|
|||||||
for(Standard_Integer idu=1; idu<=DU->NbElements(); idu++) {
|
for(Standard_Integer idu=1; idu<=DU->NbElements(); idu++) {
|
||||||
Handle(StepBasic_DerivedUnitElement) DUE = DU->ElementsValue(idu);
|
Handle(StepBasic_DerivedUnitElement) DUE = DU->ElementsValue(idu);
|
||||||
Handle(StepBasic_NamedUnit) NU = DUE->Unit();
|
Handle(StepBasic_NamedUnit) NU = DUE->Unit();
|
||||||
Standard_Real afact=1.;
|
if(NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)) ||
|
||||||
if(NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit))) {
|
NU->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit)))
|
||||||
if(GetLengthConversionFactor(NU,afact)) aDensity = aDensity/(afact*afact*afact);
|
{
|
||||||
|
STEPConstruct_UnitContext anUnitCtx;
|
||||||
|
anUnitCtx.ComputeFactors(NU);
|
||||||
|
aDensity = aDensity / (anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor());
|
||||||
// transfer length value for Density from millimeter to santimeter
|
// transfer length value for Density from millimeter to santimeter
|
||||||
// in order to result density has dimension gram/(sm*sm*sm)
|
// in order to result density has dimension gram/(sm*sm*sm)
|
||||||
aDensity = aDensity*1000.;
|
aDensity = aDensity*1000. / (UnitsMethods::GetCasCadeLengthUnit()
|
||||||
|
* UnitsMethods::GetCasCadeLengthUnit() * UnitsMethods::GetCasCadeLengthUnit());
|
||||||
}
|
}
|
||||||
if(NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndMassUnit))) {
|
if(NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndMassUnit))) {
|
||||||
if(GetMassConversionFactor(NU,afact)) aDensity=aDensity*afact;
|
Standard_Real afact = 1.;
|
||||||
|
if (GetMassConversionFactor(NU, afact))
|
||||||
|
{
|
||||||
|
aDensity = aDensity*afact;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4226,6 +4188,28 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
|
|||||||
Handle(XCAFView_Object) anObj = new XCAFView_Object();
|
Handle(XCAFView_Object) anObj = new XCAFView_Object();
|
||||||
// Import attributes of view
|
// Import attributes of view
|
||||||
Handle(StepVisual_CameraModelD3) aCameraModel = Handle(StepVisual_CameraModelD3)::DownCast(anEnt);
|
Handle(StepVisual_CameraModelD3) aCameraModel = Handle(StepVisual_CameraModelD3)::DownCast(anEnt);
|
||||||
|
|
||||||
|
const Handle(XSControl_TransferReader)& aTR = theWS->TransferReader();
|
||||||
|
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||||
|
const Interface_Graph& aGraph = aTP->Graph();
|
||||||
|
// find the proper DraughtingModel
|
||||||
|
Interface_EntityIterator subs = aGraph.Sharings(aCameraModel);
|
||||||
|
Handle(StepVisual_DraughtingModel) aDModel;
|
||||||
|
for (subs.Start(); subs.More() && aDModel.IsNull(); subs.Next())
|
||||||
|
{
|
||||||
|
if (!subs.Value()->IsKind(STANDARD_TYPE(StepVisual_DraughtingModel)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
aDModel = Handle(StepVisual_DraughtingModel)::DownCast(subs.Value());
|
||||||
|
}
|
||||||
|
if (!aDModel.IsNull())
|
||||||
|
{
|
||||||
|
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||||
|
STEPControl_ActorRead anActor;
|
||||||
|
anActor.PrepareUnits(aDModel, aTP);
|
||||||
|
}
|
||||||
|
|
||||||
anObj->SetName(aCameraModel->Name());
|
anObj->SetName(aCameraModel->Name());
|
||||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem());
|
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem());
|
||||||
anObj->SetViewDirection(anAxis->Direction());
|
anObj->SetViewDirection(anAxis->Direction());
|
||||||
@@ -4257,20 +4241,12 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
|
|||||||
aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool);
|
aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool);
|
||||||
anObj->SetClippingExpression(aClippingExpression);
|
anObj->SetClippingExpression(aClippingExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect shapes and GDTs
|
// Collect shapes and GDTs
|
||||||
TDF_LabelSequence aShapes, aGDTs;
|
|
||||||
Handle(XSControl_TransferReader) aTR = theWS->TransferReader();
|
|
||||||
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
|
||||||
const Interface_Graph& aGraph = aTP->Graph();
|
|
||||||
Handle(StepVisual_DraughtingModel) aDModel;
|
|
||||||
Interface_EntityIterator anIter = aGraph.Sharings(aCameraModel);
|
|
||||||
for (; anIter.More() && aDModel.IsNull(); anIter.Next()) {
|
|
||||||
aDModel = Handle(StepVisual_DraughtingModel)::DownCast(anIter.Value());
|
|
||||||
}
|
|
||||||
if (aDModel.IsNull())
|
if (aDModel.IsNull())
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
TDF_LabelSequence aShapes, aGDTs;
|
||||||
anIter = aGraph.Shareds(aDModel);
|
Interface_EntityIterator anIter = aGraph.Shareds(aDModel);
|
||||||
for (; anIter.More(); anIter.Next()) {
|
for (; anIter.More(); anIter.Next()) {
|
||||||
if (anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
|
if (anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
|
||||||
Handle(StepRepr_MappedItem) anItem = Handle(StepRepr_MappedItem)::DownCast(anIter.Value());
|
Handle(StepRepr_MappedItem) anItem = Handle(StepRepr_MappedItem)::DownCast(anIter.Value());
|
||||||
|
@@ -401,11 +401,22 @@ static Standard_Integer reface (Draw_Interpretor& di, Standard_Integer argc, con
|
|||||||
//function : fixshape
|
//function : fixshape
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
{
|
{
|
||||||
|
TopoDS_Shape aShF = DBRep::Get (argv[1]);
|
||||||
|
Handle(ShapeFix_Edge) anEdgeFixer = new ShapeFix_Edge();
|
||||||
|
for (TopExp_Explorer anEdgeIter (aShF, TopAbs_EDGE); anEdgeIter.More(); anEdgeIter.Next())
|
||||||
|
{
|
||||||
|
TopoDS_Edge anEdge = TopoDS::Edge (anEdgeIter.Current());
|
||||||
|
anEdgeFixer->FixAddCurve3d (anEdge);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
Handle(ShapeExtend_MsgRegistrator) msg = new ShapeExtend_MsgRegistrator;
|
Handle(ShapeExtend_MsgRegistrator) msg = new ShapeExtend_MsgRegistrator;
|
||||||
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
|
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
|
||||||
|
sfs->FixWireTool()->FixAddCurve3dMode() = 1; ///
|
||||||
|
sfs->FixFreeWireMode() = 1; ///
|
||||||
sfs->SetMsgRegistrator ( msg );
|
sfs->SetMsgRegistrator ( msg );
|
||||||
|
|
||||||
Standard_CString res = 0;
|
Standard_CString res = 0;
|
||||||
|
@@ -238,11 +238,9 @@ Select3D_BndBox3d Select3D_InteriorSensitivePointSet::Box (const Standard_Intege
|
|||||||
Standard_Real Select3D_InteriorSensitivePointSet::Center (const Standard_Integer theIdx,
|
Standard_Real Select3D_InteriorSensitivePointSet::Center (const Standard_Integer theIdx,
|
||||||
const Standard_Integer theAxis) const
|
const Standard_Integer theAxis) const
|
||||||
{
|
{
|
||||||
Standard_Integer aPolygIdx = myPolygonsIdxs->Value (theIdx);
|
const Standard_Integer aPolygIdx = myPolygonsIdxs->Value (theIdx);
|
||||||
const gp_XYZ& aCOG = myPlanarPolygons.Value (aPolygIdx)->CenterOfGeometry().XYZ();
|
const gp_Pnt aCOG = myPlanarPolygons.Value (aPolygIdx)->CenterOfGeometry();
|
||||||
Standard_Real aCenter = theAxis == 0 ? aCOG.X() : (theAxis == 1 ? aCOG.Y() : aCOG.Z());
|
return aCOG.Coord (theAxis - 1);
|
||||||
|
|
||||||
return aCenter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -261,18 +259,18 @@ void Select3D_InteriorSensitivePointSet::Swap (const Standard_Integer theIdx1,
|
|||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : overlapsElement
|
// function : overlapsElement
|
||||||
// purpose : Checks whether the planar convex polygon with index theIdx
|
// purpose :
|
||||||
// in myPlanarPolygons overlaps the current selecting volume
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth)
|
Standard_Boolean )
|
||||||
{
|
{
|
||||||
Standard_Integer aPolygIdx = myPolygonsIdxs->Value (theElemIdx);
|
Standard_Integer aPolygIdx = myPolygonsIdxs->Value (theElemIdx);
|
||||||
const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (aPolygIdx);
|
const Handle(Select3D_SensitivePoly)& aPolygon = myPlanarPolygons.Value (aPolygIdx);
|
||||||
Handle(TColgp_HArray1OfPnt) aPoints;
|
Handle(TColgp_HArray1OfPnt) aPoints;
|
||||||
aPolygon->Points3D (aPoints);
|
aPolygon->Points3D (aPoints);
|
||||||
return theMgr.Overlaps (aPoints, Select3D_TOS_INTERIOR, theMatchDepth);
|
return theMgr.Overlaps (aPoints, Select3D_TOS_INTERIOR, thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -280,10 +278,11 @@ Standard_Boolean Select3D_InteriorSensitivePointSet::overlapsElement (SelectBasi
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_InteriorSensitivePointSet::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_InteriorSensitivePointSet::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx)
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
Standard_Real aDummy;
|
SelectBasics_PickResult aDummy;
|
||||||
return overlapsElement (theMgr, theElemIdx, aDummy);
|
return overlapsElement (aDummy, theMgr, theElemIdx, theIsFullInside);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@@ -76,13 +76,15 @@ protected:
|
|||||||
|
|
||||||
//! Checks whether the planar convex polygon with index theIdx
|
//! Checks whether the planar convex polygon with index theIdx
|
||||||
//! in myPlanarPolygons overlaps the current selecting volume
|
//! in myPlanarPolygons overlaps the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) Standard_OVERRIDE;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked
|
//! Calculates distance from the 3d projection of used-picked
|
||||||
//! screen point to center of the geometry
|
//! screen point to center of the geometry
|
||||||
|
@@ -86,23 +86,18 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitiveBox::GetConnected()
|
|||||||
Standard_Boolean Select3D_SensitiveBox::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveBox::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult)
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (RealLast(), RealLast());
|
|
||||||
|
|
||||||
if (!theMgr.IsOverlapAllowed()) // check for inclusion
|
if (!theMgr.IsOverlapAllowed()) // check for inclusion
|
||||||
{
|
{
|
||||||
Standard_Boolean isInside = Standard_True;
|
Standard_Boolean isInside = Standard_True;
|
||||||
return theMgr.Overlaps (myBox.CornerMin(), myBox.CornerMax(), &isInside) && isInside;
|
return theMgr.Overlaps (myBox.CornerMin(), myBox.CornerMax(), &isInside) && isInside;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real aDepth;
|
if (!theMgr.Overlaps (myBox.CornerMin(), myBox.CornerMax(), thePickResult)) // check for overlap
|
||||||
if (!theMgr.Overlaps (myBox.CornerMin(), myBox.CornerMax(), aDepth)) // check for overlap
|
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
thePickResult = SelectBasics_PickResult (
|
thePickResult.SetDistToGeomCenter (theMgr.DistToGeometryCenter(myCenter3d));
|
||||||
aDepth, theMgr.DistToGeometryCenter (myCenter3d));
|
|
||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -238,14 +238,10 @@ void Select3D_SensitiveCircle::BVH()
|
|||||||
Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult)
|
||||||
{
|
{
|
||||||
Standard_Real aDepth = RealLast();
|
|
||||||
Standard_Real aDistToCOG = RealLast();
|
|
||||||
|
|
||||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||||
{
|
{
|
||||||
if (!Select3D_SensitivePoly::Matches (theMgr, thePickResult))
|
if (!Select3D_SensitivePoly::Matches (theMgr, thePickResult))
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,24 +251,21 @@ Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolume
|
|||||||
Points3D (anArrayOfPnt);
|
Points3D (anArrayOfPnt);
|
||||||
if (!theMgr.IsOverlapAllowed())
|
if (!theMgr.IsOverlapAllowed())
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
for (Standard_Integer aPntIdx = anArrayOfPnt->Lower(); aPntIdx <= anArrayOfPnt->Upper(); ++aPntIdx)
|
for (Standard_Integer aPntIdx = anArrayOfPnt->Lower(); aPntIdx <= anArrayOfPnt->Upper(); ++aPntIdx)
|
||||||
{
|
{
|
||||||
if (!theMgr.Overlaps (anArrayOfPnt->Value (aPntIdx)))
|
if (!theMgr.Overlaps (anArrayOfPnt->Value(aPntIdx)))
|
||||||
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theMgr.Overlaps (anArrayOfPnt, Select3D_TOS_INTERIOR, aDepth))
|
if (!theMgr.Overlaps (anArrayOfPnt, Select3D_TOS_INTERIOR, thePickResult))
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
else
|
thePickResult.SetDistToGeomCenter(distanceToCOG(theMgr));
|
||||||
{
|
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, theMgr.DistToGeometryCenter (myCenter3D));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
|
@@ -202,14 +202,12 @@ Standard_Boolean Select3D_SensitiveGroup::Matches (SelectBasics_SelectingVolumeM
|
|||||||
return Select3D_SensitiveSet::Matches (theMgr, thePickResult);
|
return Select3D_SensitiveSet::Matches (theMgr, thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real aDepth = RealLast();
|
SelectBasics_PickResult aPickResult;
|
||||||
Standard_Real aDistToCOG = RealLast();
|
|
||||||
Standard_Boolean isFailed = Standard_False;
|
Standard_Boolean isFailed = Standard_False;
|
||||||
for (Select3D_IndexedMapOfEntity::Iterator anEntityIter (myEntities); anEntityIter.More(); anEntityIter.Next())
|
for (Select3D_IndexedMapOfEntity::Iterator anEntityIter (myEntities); anEntityIter.More(); anEntityIter.Next())
|
||||||
{
|
{
|
||||||
SelectBasics_PickResult aMatchResult;
|
|
||||||
const Handle(Select3D_SensitiveEntity)& aChild = anEntityIter.Value();
|
const Handle(Select3D_SensitiveEntity)& aChild = anEntityIter.Value();
|
||||||
if (!aChild->Matches (theMgr, aMatchResult))
|
if (!aChild->Matches (theMgr, aPickResult))
|
||||||
{
|
{
|
||||||
if (toMatchAll)
|
if (toMatchAll)
|
||||||
{
|
{
|
||||||
@@ -222,17 +220,15 @@ Standard_Boolean Select3D_SensitiveGroup::Matches (SelectBasics_SelectingVolumeM
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aDepth = Min (aMatchResult.Depth(), aDepth);
|
thePickResult = SelectBasics_PickResult::Min (thePickResult, aPickResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isFailed)
|
if (isFailed)
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (RealLast(), RealLast());
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
aDistToCOG = theMgr.DistToGeometryCenter (CenterOfGeometry());
|
thePickResult.SetDistToGeomCenter(distanceToCOG(theMgr));
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,16 +326,14 @@ Standard_Integer Select3D_SensitiveGroup::Size() const
|
|||||||
// purpose : Checks whether the entity with index theIdx overlaps the
|
// purpose : Checks whether the entity with index theIdx overlaps the
|
||||||
// current selecting volume
|
// current selecting volume
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_SensitiveGroup::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveGroup::overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth)
|
Standard_Boolean )
|
||||||
{
|
{
|
||||||
theMatchDepth = RealLast();
|
|
||||||
const Standard_Integer aSensitiveIdx = myBVHPrimIndexes.Value (theElemIdx);
|
const Standard_Integer aSensitiveIdx = myBVHPrimIndexes.Value (theElemIdx);
|
||||||
SelectBasics_PickResult aResult;
|
if (myEntities.FindKey (aSensitiveIdx)->Matches (theMgr, thePickResult))
|
||||||
if (myEntities.FindKey (aSensitiveIdx)->Matches (theMgr, aResult))
|
|
||||||
{
|
{
|
||||||
theMatchDepth = aResult.Depth();
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,10 +345,11 @@ Standard_Boolean Select3D_SensitiveGroup::overlapsElement (SelectBasics_Selectin
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_SensitiveGroup::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveGroup::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx)
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
Standard_Real aDummy;
|
SelectBasics_PickResult aDummy;
|
||||||
return overlapsElement(theMgr, theElemIdx, aDummy);
|
return overlapsElement (aDummy, theMgr, theElemIdx, theIsFullInside);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@@ -146,13 +146,15 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx overlaps the current selecting volume
|
//! Checks whether the entity with index theIdx overlaps the current selecting volume
|
||||||
virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
||||||
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) Standard_OVERRIDE;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
||||||
virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
||||||
|
@@ -37,16 +37,12 @@ Select3D_SensitivePoint::Select3D_SensitivePoint (const Handle(SelectBasics_Enti
|
|||||||
Standard_Boolean Select3D_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult)
|
||||||
{
|
{
|
||||||
Standard_Real aDepth = RealLast();
|
if (!theMgr.Overlaps (myPoint, thePickResult))
|
||||||
Standard_Real aDistToCOG = RealLast();
|
|
||||||
if (!theMgr.Overlaps (myPoint, aDepth))
|
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
aDistToCOG = aDepth;
|
thePickResult.SetDistToGeomCenter (thePickResult.Depth());
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -220,18 +220,24 @@ void Select3D_SensitivePoly::Swap (const Standard_Integer theIdx1,
|
|||||||
// theIdx overlaps the current selecting
|
// theIdx overlaps the current selecting
|
||||||
// volume
|
// volume
|
||||||
//==================================================
|
//==================================================
|
||||||
Standard_Boolean Select3D_SensitivePoly::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitivePoly::overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth)
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
if (mySegmentIndexes.IsNull())
|
if (mySegmentIndexes.IsNull())
|
||||||
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
}
|
||||||
|
else if (theIsFullInside)
|
||||||
|
{
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
const Standard_Integer aSegmentIdx = mySegmentIndexes->Value (theElemIdx);
|
const Standard_Integer aSegmentIdx = mySegmentIndexes->Value (theElemIdx);
|
||||||
gp_Pnt aPnt1 = myPolyg.Pnt3d (aSegmentIdx);
|
gp_Pnt aPnt1 = myPolyg.Pnt3d (aSegmentIdx);
|
||||||
gp_Pnt aPnt2 = myPolyg.Pnt3d (aSegmentIdx + 1);
|
gp_Pnt aPnt2 = myPolyg.Pnt3d (aSegmentIdx + 1);
|
||||||
|
return theMgr.Overlaps (aPnt1, aPnt2, thePickResult);
|
||||||
return theMgr.Overlaps (aPnt1, aPnt2, theMatchDepth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
@@ -239,10 +245,15 @@ Standard_Boolean Select3D_SensitivePoly::overlapsElement (SelectBasics_Selecting
|
|||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
Standard_Boolean Select3D_SensitivePoly::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitivePoly::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx)
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
const Standard_Integer aSegmentIdx = mySegmentIndexes->Value (theElemIdx);
|
if (theIsFullInside)
|
||||||
|
{
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Integer aSegmentIdx = mySegmentIndexes->Value (theElemIdx);
|
||||||
return theMgr.Overlaps (myPolyg.Pnt3d (aSegmentIdx + 0))
|
return theMgr.Overlaps (myPolyg.Pnt3d (aSegmentIdx + 0))
|
||||||
&& theMgr.Overlaps (myPolyg.Pnt3d (aSegmentIdx + 1));
|
&& theMgr.Overlaps (myPolyg.Pnt3d (aSegmentIdx + 1));
|
||||||
}
|
}
|
||||||
|
@@ -95,13 +95,15 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! Checks whether the segment with index theIdx overlaps the current selecting volume
|
//! Checks whether the segment with index theIdx overlaps the current selecting volume
|
||||||
virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
||||||
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) Standard_OVERRIDE;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked screen point
|
//! Calculates distance from the 3d projection of used-picked screen point
|
||||||
//! to center of the geometry
|
//! to center of the geometry
|
||||||
|
@@ -908,7 +908,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::Matches (SelectBasics_Selecti
|
|||||||
|| theMgr.GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Point
|
|| theMgr.GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Point
|
||||||
|| !toDetectRange)
|
|| !toDetectRange)
|
||||||
{
|
{
|
||||||
if (!Select3D_SensitiveSet::Matches (theMgr, thePickResult))
|
if (!matches (theMgr, thePickResult, toDetectRange))
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -928,51 +928,35 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::Matches (SelectBasics_Selecti
|
|||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real aDepth = RealLast();
|
SelectBasics_PickResult aPickResult;
|
||||||
bool isFailed = false;
|
bool hasResults = false;
|
||||||
const bool toMatchAll = !theMgr.IsOverlapAllowed();
|
|
||||||
for (Standard_Integer aGroupIter = 0; aGroupIter < myBvhIndices.NbElements; ++aGroupIter)
|
for (Standard_Integer aGroupIter = 0; aGroupIter < myBvhIndices.NbElements; ++aGroupIter)
|
||||||
{
|
{
|
||||||
const Standard_Integer anElemIdx = myBvhIndices.Index (aGroupIter);
|
const Standard_Integer anElemIdx = myBvhIndices.Index (aGroupIter);
|
||||||
SelectBasics_PickResult aMatchResult;
|
|
||||||
Handle(Select3D_SensitivePrimitiveArray)& aChild = myGroups->ChangeValue (anElemIdx);
|
Handle(Select3D_SensitivePrimitiveArray)& aChild = myGroups->ChangeValue (anElemIdx);
|
||||||
const bool isMatched = aChild->Matches (theMgr, aMatchResult);
|
if (aChild->Matches (theMgr, aPickResult))
|
||||||
if (!myDetectedElemMap.IsNull())
|
|
||||||
{
|
{
|
||||||
myDetectedElemMap->ChangeMap().Unite (aChild->myDetectedElemMap->Map());
|
hasResults = true;
|
||||||
}
|
if (!myDetectedElemMap.IsNull())
|
||||||
if (!myDetectedNodeMap.IsNull())
|
|
||||||
{
|
|
||||||
myDetectedNodeMap->ChangeMap().Unite (aChild->myDetectedNodeMap->Map());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isMatched)
|
|
||||||
{
|
|
||||||
if (toMatchAll)
|
|
||||||
{
|
{
|
||||||
isFailed = true;
|
myDetectedElemMap->ChangeMap().Unite (aChild->myDetectedElemMap->Map());
|
||||||
if (!toDetectRange)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
if (!myDetectedNodeMap.IsNull())
|
||||||
else
|
{
|
||||||
{
|
myDetectedNodeMap->ChangeMap().Unite (aChild->myDetectedNodeMap->Map());
|
||||||
if (aDepth > aMatchResult.Depth())
|
}
|
||||||
|
if (thePickResult.Depth() > aPickResult.Depth())
|
||||||
{
|
{
|
||||||
myDetectedIdx = aGroupIter;
|
myDetectedIdx = aGroupIter;
|
||||||
aDepth = aMatchResult.Depth();
|
thePickResult = aPickResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isFailed)
|
if (!hasResults)
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (RealLast(), RealLast());
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
thePickResult.SetDistToGeomCenter(theMgr.DistToGeometryCenter(CenterOfGeometry()));
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, theMgr.DistToGeometryCenter (CenterOfGeometry()));
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -980,27 +964,21 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::Matches (SelectBasics_Selecti
|
|||||||
// function : overlapsElement
|
// function : overlapsElement
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth)
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
const Standard_Integer anElemIdx = myBvhIndices.Index (theElemIdx);
|
const Standard_Integer anElemIdx = myBvhIndices.Index (theElemIdx);
|
||||||
if (!myGroups.IsNull())
|
if (!myGroups.IsNull())
|
||||||
{
|
{
|
||||||
SelectBasics_PickResult aResult;
|
return myGroups->Value (anElemIdx)->Matches (theMgr, thePickResult);
|
||||||
if (myGroups->Value (anElemIdx)->Matches (theMgr, aResult))
|
|
||||||
{
|
|
||||||
theMatchDepth = aResult.Depth();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
theMatchDepth = RealLast();
|
|
||||||
return Standard_False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Standard_Integer aPatchSize = myBvhIndices.PatchSize (theElemIdx);
|
const Standard_Integer aPatchSize = myBvhIndices.PatchSize (theElemIdx);
|
||||||
Select3D_BndBox3d aBox;
|
Select3D_BndBox3d aBox;
|
||||||
Standard_Boolean aResult = Standard_False;
|
Standard_Boolean aResult = Standard_False;
|
||||||
Standard_Real aMinDepth = RealLast();
|
SelectBasics_PickResult aPickResult;
|
||||||
switch (myPrimType)
|
switch (myPrimType)
|
||||||
{
|
{
|
||||||
case Graphic3d_TOPA_POINTS:
|
case Graphic3d_TOPA_POINTS:
|
||||||
@@ -1021,16 +999,15 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
|
|||||||
aPoint = vecToPnt (getPosVec2 (aPointIndex));
|
aPoint = vecToPnt (getPosVec2 (aPointIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real aCurrentDepth = RealLast();
|
|
||||||
if (myToDetectNode
|
if (myToDetectNode
|
||||||
|| myToDetectElem)
|
|| myToDetectElem)
|
||||||
{
|
{
|
||||||
if (theMgr.Overlaps (aPoint, aCurrentDepth))
|
if (theIsFullInside || theMgr.Overlaps (aPoint, aPickResult))
|
||||||
{
|
{
|
||||||
if (aCurrentDepth <= myMinDepthNode)
|
if (aPickResult.Depth() <= myMinDepthNode)
|
||||||
{
|
{
|
||||||
myDetectedElem = myDetectedNode = aPointIndex;
|
myDetectedElem = myDetectedNode = aPointIndex;
|
||||||
myMinDepthElem = myMinDepthNode = aCurrentDepth;
|
myMinDepthElem = myMinDepthNode = aPickResult.Depth();
|
||||||
}
|
}
|
||||||
if (theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point)
|
if (theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point)
|
||||||
{
|
{
|
||||||
@@ -1046,7 +1023,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
|
|||||||
aResult = Standard_True;
|
aResult = Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aMinDepth = Min (aMinDepth, aCurrentDepth);
|
thePickResult = SelectBasics_PickResult::Min (thePickResult, aPickResult);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1072,15 +1049,14 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
|
|||||||
aPnts[2] = vecToPnt (getPosVec2 (aTriNodes[2]));
|
aPnts[2] = vecToPnt (getPosVec2 (aTriNodes[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real aCurrentDepth = RealLast();
|
|
||||||
if (myToDetectElem)
|
if (myToDetectElem)
|
||||||
{
|
{
|
||||||
if (theMgr.Overlaps (aPnts[0], aPnts[1], aPnts[2], Select3D_TOS_INTERIOR, aCurrentDepth))
|
if (theIsFullInside || theMgr.Overlaps (aPnts[0], aPnts[1], aPnts[2], Select3D_TOS_INTERIOR, aPickResult))
|
||||||
{
|
{
|
||||||
if (aCurrentDepth <= myMinDepthElem)
|
if (aPickResult.Depth() <= myMinDepthElem)
|
||||||
{
|
{
|
||||||
myDetectedElem = aTriIndex;
|
myDetectedElem = aTriIndex;
|
||||||
myMinDepthElem = aCurrentDepth;
|
myMinDepthElem = aPickResult.Depth();
|
||||||
}
|
}
|
||||||
aResult = Standard_True;
|
aResult = Standard_True;
|
||||||
}
|
}
|
||||||
@@ -1094,12 +1070,12 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
|
|||||||
{
|
{
|
||||||
for (int aNodeIter = 0; aNodeIter < 3; ++aNodeIter)
|
for (int aNodeIter = 0; aNodeIter < 3; ++aNodeIter)
|
||||||
{
|
{
|
||||||
if (theMgr.Overlaps (aPnts[aNodeIter], aCurrentDepth))
|
if (theIsFullInside || theMgr.Overlaps (aPnts[aNodeIter], aPickResult))
|
||||||
{
|
{
|
||||||
if (aCurrentDepth <= myMinDepthNode)
|
if (aPickResult.Depth() <= myMinDepthNode)
|
||||||
{
|
{
|
||||||
myDetectedNode = aTriNodes[aNodeIter];
|
myDetectedNode = aTriNodes[aNodeIter];
|
||||||
myMinDepthNode = aCurrentDepth;
|
myMinDepthNode = aPickResult.Depth();
|
||||||
}
|
}
|
||||||
if (!myDetectedNodeMap.IsNull()
|
if (!myDetectedNodeMap.IsNull()
|
||||||
&& theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point)
|
&& theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point)
|
||||||
@@ -1116,19 +1092,19 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
|
|||||||
{
|
{
|
||||||
int aNode1 = aNodeIter == 0 ? 2 : (aNodeIter - 1);
|
int aNode1 = aNodeIter == 0 ? 2 : (aNodeIter - 1);
|
||||||
int aNode2 = aNodeIter;
|
int aNode2 = aNodeIter;
|
||||||
if (theMgr.Overlaps (aPnts[aNode1], aPnts[aNode2], aCurrentDepth))
|
if (theIsFullInside || theMgr.Overlaps (aPnts[aNode1], aPnts[aNode2], aPickResult))
|
||||||
{
|
{
|
||||||
if (aCurrentDepth <= myMinDepthEdge)
|
if (aPickResult.Depth() <= myMinDepthEdge)
|
||||||
{
|
{
|
||||||
myDetectedEdgeNode1 = aTriNodes[aNode1];
|
myDetectedEdgeNode1 = aTriNodes[aNode1];
|
||||||
myDetectedEdgeNode2 = aTriNodes[aNode2];
|
myDetectedEdgeNode2 = aTriNodes[aNode2];
|
||||||
myMinDepthEdge = aCurrentDepth;
|
myMinDepthEdge = aPickResult.Depth();
|
||||||
}
|
}
|
||||||
aResult = Standard_True;
|
aResult = Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aMinDepth = Min (aMinDepth, aCurrentDepth);
|
thePickResult = SelectBasics_PickResult::Min (thePickResult, aPickResult);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1138,7 +1114,6 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::overlapsElement (SelectBasics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
theMatchDepth = aMinDepth;
|
|
||||||
return aResult;
|
return aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1156,13 +1131,14 @@ Standard_Real Select3D_SensitivePrimitiveArray::distanceToCOG (SelectBasics_Sele
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx)
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
const Standard_Integer anElemIdx = myBvhIndices.Index (theElemIdx);
|
const Standard_Integer anElemIdx = myBvhIndices.Index (theElemIdx);
|
||||||
if (!myGroups.IsNull())
|
if (!myGroups.IsNull())
|
||||||
{
|
{
|
||||||
Standard_Real aDummy;
|
SelectBasics_PickResult aDummy;
|
||||||
return overlapsElement (theMgr, theElemIdx, aDummy);
|
return myGroups->Value (anElemIdx)->Matches (theMgr, aDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Standard_Integer aPatchSize = myBvhIndices.PatchSize (theElemIdx);
|
const Standard_Integer aPatchSize = myBvhIndices.PatchSize (theElemIdx);
|
||||||
@@ -1185,7 +1161,7 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics
|
|||||||
{
|
{
|
||||||
aPoint = vecToPnt (getPosVec2 (aPointIndex));
|
aPoint = vecToPnt (getPosVec2 (aPointIndex));
|
||||||
}
|
}
|
||||||
if (!theMgr.Overlaps (aPoint))
|
if (!theIsFullInside && !theMgr.Overlaps (aPoint))
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -1226,9 +1202,9 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics
|
|||||||
aPnts[2] = vecToPnt (getPosVec2 (aTriNodes[2]));
|
aPnts[2] = vecToPnt (getPosVec2 (aTriNodes[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theMgr.Overlaps (aPnts[0])
|
if (!theIsFullInside && ( !theMgr.Overlaps (aPnts[0])
|
||||||
|| !theMgr.Overlaps (aPnts[1])
|
|| !theMgr.Overlaps (aPnts[1])
|
||||||
|| !theMgr.Overlaps (aPnts[2]))
|
|| !theMgr.Overlaps (aPnts[2])))
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
@@ -278,16 +278,18 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Checks whether the element with index theIdx overlaps the current selecting volume
|
//! Checks whether the element with index theIdx overlaps the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
||||||
Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) Standard_OVERRIDE;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -42,22 +42,17 @@ Select3D_SensitiveSegment::Select3D_SensitiveSegment (const Handle(SelectBasics_
|
|||||||
Standard_Boolean Select3D_SensitiveSegment::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveSegment::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult)
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (RealLast(), RealLast());
|
|
||||||
|
|
||||||
Standard_Real aDepth;
|
|
||||||
if (!theMgr.IsOverlapAllowed()) // check for inclusion
|
if (!theMgr.IsOverlapAllowed()) // check for inclusion
|
||||||
{
|
{
|
||||||
return theMgr.Overlaps (myStart, aDepth) && theMgr.Overlaps (myEnd, aDepth);
|
return theMgr.Overlaps (myStart, thePickResult) && theMgr.Overlaps (myEnd, thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theMgr.Overlaps (myStart, myEnd, aDepth)) // check for overlap
|
if (!theMgr.Overlaps (myStart, myEnd, thePickResult)) // check for overlap
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
thePickResult = SelectBasics_PickResult (aDepth,
|
thePickResult.SetDistToGeomCenter (theMgr.DistToGeometryCenter(CenterOfGeometry()));
|
||||||
theMgr.DistToGeometryCenter (CenterOfGeometry()));
|
|
||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,68 +65,87 @@ void Select3D_SensitiveSet::BVH()
|
|||||||
myContent.GetBVH();
|
myContent.GetBVH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//! This structure describes the node in BVH
|
||||||
|
struct NodeInStack
|
||||||
|
{
|
||||||
|
NodeInStack (Standard_Integer theId = 0,
|
||||||
|
Standard_Boolean theIsFullInside = false) : Id (theId), IsFullInside (theIsFullInside) {}
|
||||||
|
|
||||||
|
Standard_Integer Id; //!< node identifier
|
||||||
|
Standard_Boolean IsFullInside; //!< if the node is completely inside the current selection volume
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Matches
|
// function : Matches
|
||||||
// purpose : Checks whether one or more entities of the set overlap
|
// purpose :
|
||||||
// current selecting volume. Implements the traverse of BVH
|
|
||||||
// tree built for the set
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveSet::matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult,
|
||||||
|
Standard_Boolean theToCheckAllInside)
|
||||||
{
|
{
|
||||||
myDetectedIdx = -1;
|
myDetectedIdx = -1;
|
||||||
const BVH_Tree<Standard_Real, 3, BVH_BinaryTree>* aBVH = myContent.GetBVH().get();
|
const BVH_Tree<Standard_Real, 3, BVH_BinaryTree>* aBVH = myContent.GetBVH().get();
|
||||||
thePickResult = SelectBasics_PickResult (RealLast(), RealLast());
|
|
||||||
if (myContent.Size() < 1 || !theMgr.Overlaps (aBVH->MinPoint (0),
|
if (myContent.Size() < 1 || !theMgr.Overlaps (aBVH->MinPoint (0),
|
||||||
aBVH->MaxPoint (0)))
|
aBVH->MaxPoint (0)))
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer aStack[BVH_Constants_MaxTreeDepth];
|
NodeInStack aStack[BVH_Constants_MaxTreeDepth];
|
||||||
Standard_Integer aNode = 0;
|
NodeInStack aNode;
|
||||||
|
|
||||||
Standard_Integer aHead = -1;
|
Standard_Integer aHead = -1;
|
||||||
|
|
||||||
Standard_Integer aMatchesNb = -1;
|
Standard_Integer aMatchesNb = -1;
|
||||||
Standard_Real aMinDepth = RealLast();
|
SelectBasics_PickResult aPickResult;
|
||||||
|
const bool toCheckFullInside = (theMgr.GetActiveSelectionType() != SelectBasics_SelectingVolumeManager::Point);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const BVH_Vec4i& aData = aBVH->NodeInfoBuffer()[aNode];
|
const BVH_Vec4i& aData = aBVH->NodeInfoBuffer()[aNode.Id];
|
||||||
|
|
||||||
if (aData.x() == 0) // is inner node
|
if (aData.x() == 0) // is inner node
|
||||||
{
|
{
|
||||||
const Standard_Integer aLftIdx = aData.y();
|
NodeInStack aLeft (aData.y(), toCheckFullInside), aRight(aData.z(), toCheckFullInside);
|
||||||
const Standard_Integer aRghIdx = aData.z();
|
Standard_Boolean toCheckLft = Standard_True, toCheckRgh = Standard_True;
|
||||||
|
if (!aNode.IsFullInside)
|
||||||
|
{
|
||||||
|
toCheckLft = theMgr.Overlaps (aBVH->MinPoint (aLeft.Id), aBVH->MaxPoint (aLeft.Id), toCheckFullInside ? &aLeft.IsFullInside : NULL);
|
||||||
|
if (!toCheckLft)
|
||||||
|
{
|
||||||
|
aLeft.IsFullInside = Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Boolean isLftInside = Standard_True;
|
toCheckRgh = theMgr.Overlaps (aBVH->MinPoint (aRight.Id), aBVH->MaxPoint (aRight.Id), toCheckFullInside ? &aRight.IsFullInside : NULL);
|
||||||
Standard_Boolean isRghInside = Standard_True;
|
if (!toCheckRgh)
|
||||||
|
{
|
||||||
Standard_Boolean toCheckLft = theMgr.Overlaps (aBVH->MinPoint (aLftIdx),
|
aRight.IsFullInside = Standard_False;
|
||||||
aBVH->MaxPoint (aLftIdx),
|
}
|
||||||
theMgr.IsOverlapAllowed() ? NULL : &isLftInside);
|
}
|
||||||
|
|
||||||
Standard_Boolean toCheckRgh = theMgr.Overlaps (aBVH->MinPoint (aRghIdx),
|
|
||||||
aBVH->MaxPoint (aRghIdx),
|
|
||||||
theMgr.IsOverlapAllowed() ? NULL : &isRghInside);
|
|
||||||
|
|
||||||
if (!theMgr.IsOverlapAllowed()) // inclusion test
|
if (!theMgr.IsOverlapAllowed()) // inclusion test
|
||||||
{
|
{
|
||||||
if (!toCheckLft || !toCheckRgh)
|
if (!theToCheckAllInside)
|
||||||
{
|
{
|
||||||
return Standard_False; // no inclusion
|
if (!toCheckLft || !toCheckRgh)
|
||||||
}
|
{
|
||||||
|
return Standard_False; // no inclusion
|
||||||
|
}
|
||||||
|
|
||||||
toCheckLft &= !isLftInside;
|
// skip extra checks
|
||||||
toCheckRgh &= !isRghInside;
|
toCheckLft &= !aLeft.IsFullInside;
|
||||||
|
toCheckRgh &= !aRight.IsFullInside;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toCheckLft || toCheckRgh)
|
if (toCheckLft || toCheckRgh)
|
||||||
{
|
{
|
||||||
aNode = toCheckLft ? aLftIdx : aRghIdx;
|
aNode = toCheckLft ? aLeft : aRight;
|
||||||
|
|
||||||
if (toCheckLft && toCheckRgh)
|
if (toCheckLft && toCheckRgh)
|
||||||
{
|
{
|
||||||
aStack[++aHead] = aRghIdx;
|
aStack[++aHead] = aRight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -143,28 +162,29 @@ Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeMan
|
|||||||
{
|
{
|
||||||
if (!theMgr.IsOverlapAllowed()) // inclusion test
|
if (!theMgr.IsOverlapAllowed()) // inclusion test
|
||||||
{
|
{
|
||||||
if (!elementIsInside (theMgr, anElemIdx))
|
if (!elementIsInside (theMgr, anElemIdx, aNode.IsFullInside))
|
||||||
{
|
{
|
||||||
|
if (theToCheckAllInside)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // overlap test
|
else // overlap test
|
||||||
{
|
{
|
||||||
Standard_Real aCurrentDepth = aMinDepth;
|
if (!overlapsElement (aPickResult, theMgr, anElemIdx, aNode.IsFullInside))
|
||||||
|
|
||||||
if (!overlapsElement (theMgr, anElemIdx, aCurrentDepth))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aMinDepth > aCurrentDepth)
|
if (thePickResult.Depth() > aPickResult.Depth())
|
||||||
{
|
{
|
||||||
aMinDepth = aCurrentDepth;
|
thePickResult = aPickResult;
|
||||||
myDetectedIdx = anElemIdx;
|
myDetectedIdx = anElemIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
++aMatchesNb;
|
|
||||||
}
|
}
|
||||||
|
++aMatchesNb;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aHead < 0)
|
if (aHead < 0)
|
||||||
@@ -176,10 +196,11 @@ Standard_Boolean Select3D_SensitiveSet::Matches (SelectBasics_SelectingVolumeMan
|
|||||||
|
|
||||||
if (aMatchesNb != -1)
|
if (aMatchesNb != -1)
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (aMinDepth, distanceToCOG (theMgr));
|
thePickResult.SetDistToGeomCenter(distanceToCOG(theMgr));
|
||||||
}
|
}
|
||||||
|
|
||||||
return !theMgr.IsOverlapAllowed() || aMatchesNb != -1;
|
return aMatchesNb != -1
|
||||||
|
|| (!theToCheckAllInside && !theMgr.IsOverlapAllowed());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@@ -64,8 +64,11 @@ public:
|
|||||||
|
|
||||||
//! Checks whether one or more entities of the set overlap current selecting volume.
|
//! Checks whether one or more entities of the set overlap current selecting volume.
|
||||||
//! Implements the traverse of BVH tree built for the set
|
//! Implements the traverse of BVH tree built for the set
|
||||||
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE
|
||||||
|
{
|
||||||
|
return matches (theMgr, thePickResult, false);
|
||||||
|
}
|
||||||
|
|
||||||
//! Builds BVH tree for sensitive set.
|
//! Builds BVH tree for sensitive set.
|
||||||
//! Must be called manually to build BVH tree for any sensitive set
|
//! Must be called manually to build BVH tree for any sensitive set
|
||||||
@@ -96,15 +99,36 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx overlaps the current selecting volume.
|
//! Checks whether one or more entities of the set overlap current selecting volume.
|
||||||
//! @param theMatchDepth set to the current minimum depth by Select3D_SensitiveSet; should be set to the new depth when overlapping is detected
|
//! Implements the traverse of BVH tree built for the set
|
||||||
virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
//! @param theMgr selection manager
|
||||||
Standard_Integer theElemIdx,
|
//! @param thePickResult picking result (for picking by ray)
|
||||||
Standard_Real& theMatchDepth) = 0;
|
//! @param theToCheckAllInside flag indicating that even with SelectMgr_SelectingVolumeManager::IsOverlapAllowed() returning FALSE
|
||||||
|
//! the method will return TRUE if at least one sub-element is fully inside selection volume ::elementIsInside();
|
||||||
|
//! this is useful for entities allowing local selection of sub-elements using single Owner object.
|
||||||
|
Standard_EXPORT Standard_Boolean matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
|
SelectBasics_PickResult& thePickResult,
|
||||||
|
Standard_Boolean theToCheckAllInside);
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx (partially) overlaps the current selecting volume.
|
||||||
|
//! @param thePickResult [OUT] picking result, should update minimum depth
|
||||||
|
//! @param theMgr [IN] selection manager
|
||||||
|
//! @param theElemIdx [IN] element index within BVH tree to check
|
||||||
|
//! @param theIsFullInside [IN] when TRUE indicates that entire BVH node is already inside selection volume (in case of rectangle selection);
|
||||||
|
//! in this case algorithm might skip checking the element and just register it as detected
|
||||||
|
virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) = 0;
|
||||||
|
|
||||||
|
//! Checks whether the entity with index theIdx is (fully) inside the current selecting volume
|
||||||
|
//! @param theMgr [IN] selection manager
|
||||||
|
//! @param theElemIdx [IN] element index within BVH tree to check
|
||||||
|
//! @param theIsFullInside [IN] when TRUE indicates that entire BVH node is already inside selection volume (in case of rectangle selection);
|
||||||
|
//! in this case algorithm might skip checking the element and just register it as detected
|
||||||
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) = 0;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) = 0;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
||||||
virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) = 0;
|
virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) = 0;
|
||||||
|
@@ -48,8 +48,6 @@ Select3D_SensitiveTriangle::Select3D_SensitiveTriangle (const Handle(SelectBasic
|
|||||||
Standard_Boolean Select3D_SensitiveTriangle::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveTriangle::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
SelectBasics_PickResult& thePickResult)
|
SelectBasics_PickResult& thePickResult)
|
||||||
{
|
{
|
||||||
Standard_Real aDepth = RealLast();
|
|
||||||
Standard_Real aDistToCOG = RealLast();
|
|
||||||
if (!theMgr.IsOverlapAllowed())
|
if (!theMgr.IsOverlapAllowed())
|
||||||
{
|
{
|
||||||
return theMgr.Overlaps (myPoints[0])
|
return theMgr.Overlaps (myPoints[0])
|
||||||
@@ -57,14 +55,12 @@ Standard_Boolean Select3D_SensitiveTriangle::Matches (SelectBasics_SelectingVolu
|
|||||||
&& theMgr.Overlaps (myPoints[2]);
|
&& theMgr.Overlaps (myPoints[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theMgr.Overlaps (myPoints[0], myPoints[1], myPoints[2], mySensType, aDepth))
|
if (!theMgr.Overlaps (myPoints[0], myPoints[1], myPoints[2], mySensType, thePickResult))
|
||||||
{
|
{
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
aDistToCOG = theMgr.DistToGeometryCenter (myCentroid);
|
thePickResult.SetDistToGeomCenter (theMgr.DistToGeometryCenter(myCentroid));
|
||||||
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -198,9 +198,9 @@ Select3D_BndBox3d Select3D_SensitiveTriangulation::Box (const Standard_Integer t
|
|||||||
Standard_Integer aNode1, aNode2, aNode3;
|
Standard_Integer aNode1, aNode2, aNode3;
|
||||||
myTriangul->Triangles() (aPrimIdx + 1).Get (aNode1, aNode2, aNode3);
|
myTriangul->Triangles() (aPrimIdx + 1).Get (aNode1, aNode2, aNode3);
|
||||||
|
|
||||||
gp_Pnt aPnt1 = myTriangul->Nodes().Value (aNode1);
|
const gp_Pnt& aPnt1 = myTriangul->Nodes().Value (aNode1);
|
||||||
gp_Pnt aPnt2 = myTriangul->Nodes().Value (aNode2);
|
const gp_Pnt& aPnt2 = myTriangul->Nodes().Value (aNode2);
|
||||||
gp_Pnt aPnt3 = myTriangul->Nodes().Value (aNode3);
|
const gp_Pnt& aPnt3 = myTriangul->Nodes().Value (aNode3);
|
||||||
|
|
||||||
aMinPnt = SelectMgr_Vec3 (Min (aPnt1.X(), Min (aPnt2.X(), aPnt3.X())),
|
aMinPnt = SelectMgr_Vec3 (Min (aPnt1.X(), Min (aPnt2.X(), aPnt3.X())),
|
||||||
Min (aPnt1.Y(), Min (aPnt2.Y(), aPnt3.Y())),
|
Min (aPnt1.Y(), Min (aPnt2.Y(), aPnt3.Y())),
|
||||||
@@ -213,8 +213,8 @@ Select3D_BndBox3d Select3D_SensitiveTriangulation::Box (const Standard_Integer t
|
|||||||
{
|
{
|
||||||
Standard_Integer aNodeIdx1 = myFreeEdges->Value (myFreeEdges->Lower() + aPrimIdx);
|
Standard_Integer aNodeIdx1 = myFreeEdges->Value (myFreeEdges->Lower() + aPrimIdx);
|
||||||
Standard_Integer aNodeIdx2 = myFreeEdges->Value (myFreeEdges->Lower() + aPrimIdx + 1);
|
Standard_Integer aNodeIdx2 = myFreeEdges->Value (myFreeEdges->Lower() + aPrimIdx + 1);
|
||||||
gp_Pnt aNode1 = myTriangul->Nodes().Value (aNodeIdx1);
|
const gp_Pnt& aNode1 = myTriangul->Nodes().Value (aNodeIdx1);
|
||||||
gp_Pnt aNode2 = myTriangul->Nodes().Value (aNodeIdx2);
|
const gp_Pnt& aNode2 = myTriangul->Nodes().Value (aNodeIdx2);
|
||||||
|
|
||||||
aMinPnt = SelectMgr_Vec3 (Min (aNode1.X(), aNode2.X()),
|
aMinPnt = SelectMgr_Vec3 (Min (aNode1.X(), aNode2.X()),
|
||||||
Min (aNode1.Y(), aNode2.Y()),
|
Min (aNode1.Y(), aNode2.Y()),
|
||||||
@@ -236,9 +236,8 @@ Standard_Real Select3D_SensitiveTriangulation::Center (const Standard_Integer th
|
|||||||
const Standard_Integer theAxis) const
|
const Standard_Integer theAxis) const
|
||||||
{
|
{
|
||||||
const Select3D_BndBox3d& aBox = Box (theIdx);
|
const Select3D_BndBox3d& aBox = Box (theIdx);
|
||||||
SelectMgr_Vec3 aCenter = (aBox.CornerMin () + aBox.CornerMax ()) * 0.5;
|
const SelectMgr_Vec3 aCenter = (aBox.CornerMin () + aBox.CornerMax ()) * 0.5;
|
||||||
|
return aCenter[theAxis];
|
||||||
return theAxis == 0 ? aCenter.x() : (theAxis == 1 ? aCenter.y() : aCenter.z());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -260,23 +259,29 @@ void Select3D_SensitiveTriangulation::Swap (const Standard_Integer theIdx1,
|
|||||||
// purpose : Checks whether the element with index theIdx overlaps the
|
// purpose : Checks whether the element with index theIdx overlaps the
|
||||||
// current selecting volume
|
// current selecting volume
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean Select3D_SensitiveTriangulation::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveTriangulation::overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth)
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
const Standard_Integer& aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
|
if (theIsFullInside)
|
||||||
|
{
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Integer aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
|
||||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||||
{
|
{
|
||||||
Standard_Integer aSegmStartIdx = myFreeEdges->Value (aPrimitiveIdx * 2 + 1);
|
Standard_Integer aSegmStartIdx = myFreeEdges->Value (aPrimitiveIdx * 2 + 1);
|
||||||
Standard_Integer aSegmEndIdx = myFreeEdges->Value (aPrimitiveIdx * 2 + 2);
|
Standard_Integer aSegmEndIdx = myFreeEdges->Value (aPrimitiveIdx * 2 + 2);
|
||||||
Handle(TColgp_HArray1OfPnt) anEdgePnts = new TColgp_HArray1OfPnt (1, 2);
|
|
||||||
gp_Pnt aSegmStart = myTriangul->Nodes().Value (aSegmStartIdx);
|
const gp_Pnt anEdgePnts[2] =
|
||||||
gp_Pnt aSegmEnd = myTriangul->Nodes().Value (aSegmEndIdx);
|
{
|
||||||
anEdgePnts->SetValue (1, aSegmStart);
|
myTriangul->Nodes().Value (aSegmStartIdx),
|
||||||
anEdgePnts->SetValue (2, aSegmEnd);
|
myTriangul->Nodes().Value (aSegmEndIdx)
|
||||||
Standard_Boolean isMatched = theMgr.Overlaps (anEdgePnts, Select3D_TOS_BOUNDARY, theMatchDepth);
|
};
|
||||||
anEdgePnts.Nullify();
|
TColgp_Array1OfPnt anEdgePntsArr (anEdgePnts[0], 1, 2);
|
||||||
|
Standard_Boolean isMatched = theMgr.Overlaps (anEdgePntsArr, Select3D_TOS_BOUNDARY, thePickResult);
|
||||||
return isMatched;
|
return isMatched;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -284,10 +289,10 @@ Standard_Boolean Select3D_SensitiveTriangulation::overlapsElement (SelectBasics_
|
|||||||
const Poly_Array1OfTriangle& aTriangles = myTriangul->Triangles();
|
const Poly_Array1OfTriangle& aTriangles = myTriangul->Triangles();
|
||||||
Standard_Integer aNode1, aNode2, aNode3;
|
Standard_Integer aNode1, aNode2, aNode3;
|
||||||
aTriangles (aPrimitiveIdx + 1).Get (aNode1, aNode2, aNode3);
|
aTriangles (aPrimitiveIdx + 1).Get (aNode1, aNode2, aNode3);
|
||||||
gp_Pnt aPnt1 = myTriangul->Nodes().Value (aNode1);
|
const gp_Pnt& aPnt1 = myTriangul->Nodes().Value (aNode1);
|
||||||
gp_Pnt aPnt2 = myTriangul->Nodes().Value (aNode2);
|
const gp_Pnt& aPnt2 = myTriangul->Nodes().Value (aNode2);
|
||||||
gp_Pnt aPnt3 = myTriangul->Nodes().Value (aNode3);
|
const gp_Pnt& aPnt3 = myTriangul->Nodes().Value (aNode3);
|
||||||
return theMgr.Overlaps (aPnt1, aPnt2, aPnt3, Select3D_TOS_INTERIOR, theMatchDepth);
|
return theMgr.Overlaps (aPnt1, aPnt2, aPnt3, Select3D_TOS_INTERIOR, thePickResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,29 +301,29 @@ Standard_Boolean Select3D_SensitiveTriangulation::overlapsElement (SelectBasics_
|
|||||||
// Purpose :
|
// Purpose :
|
||||||
//==================================================
|
//==================================================
|
||||||
Standard_Boolean Select3D_SensitiveTriangulation::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveTriangulation::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx)
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside)
|
||||||
{
|
{
|
||||||
const Standard_Integer& aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
|
if (theIsFullInside)
|
||||||
|
{
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Integer aPrimitiveIdx = myBVHPrimIndexes->Value (theElemIdx);
|
||||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||||
{
|
{
|
||||||
gp_Pnt aSegmPnt1 = myTriangul->Nodes().Value (myFreeEdges->Value (aPrimitiveIdx * 2 + 1));
|
const gp_Pnt& aSegmPnt1 = myTriangul->Nodes().Value (myFreeEdges->Value (aPrimitiveIdx * 2 + 1));
|
||||||
gp_Pnt aSegmPnt2 = myTriangul->Nodes().Value (myFreeEdges->Value (aPrimitiveIdx * 2 + 2));
|
const gp_Pnt& aSegmPnt2 = myTriangul->Nodes().Value (myFreeEdges->Value (aPrimitiveIdx * 2 + 2));
|
||||||
|
|
||||||
return theMgr.Overlaps (aSegmPnt1) && theMgr.Overlaps (aSegmPnt2);
|
return theMgr.Overlaps (aSegmPnt1) && theMgr.Overlaps (aSegmPnt2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Standard_Integer aNode1;
|
Standard_Integer aNode1, aNode2, aNode3;
|
||||||
Standard_Integer aNode2;
|
|
||||||
Standard_Integer aNode3;
|
|
||||||
|
|
||||||
myTriangul->Triangles() (aPrimitiveIdx + 1).Get (aNode1, aNode2, aNode3);
|
myTriangul->Triangles() (aPrimitiveIdx + 1).Get (aNode1, aNode2, aNode3);
|
||||||
|
|
||||||
gp_Pnt aPnt1 = myTriangul->Nodes().Value (aNode1);
|
const gp_Pnt& aPnt1 = myTriangul->Nodes().Value (aNode1);
|
||||||
gp_Pnt aPnt2 = myTriangul->Nodes().Value (aNode2);
|
const gp_Pnt& aPnt2 = myTriangul->Nodes().Value (aNode2);
|
||||||
gp_Pnt aPnt3 = myTriangul->Nodes().Value (aNode3);
|
const gp_Pnt& aPnt3 = myTriangul->Nodes().Value (aNode3);
|
||||||
|
|
||||||
return theMgr.Overlaps (aPnt1)
|
return theMgr.Overlaps (aPnt1)
|
||||||
&& theMgr.Overlaps (aPnt2)
|
&& theMgr.Overlaps (aPnt2)
|
||||||
&& theMgr.Overlaps (aPnt3);
|
&& theMgr.Overlaps (aPnt3);
|
||||||
|
@@ -102,16 +102,18 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//! Checks whether the element with index theIdx overlaps the current selecting volume
|
//! Checks whether the element with index theIdx overlaps the current selecting volume
|
||||||
virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
||||||
virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
||||||
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) Standard_OVERRIDE;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -112,20 +112,14 @@ void Select3D_SensitiveWire::Swap (const Standard_Integer theIdx1,
|
|||||||
// purpose : Checks whether the entity with index theIdx overlaps the
|
// purpose : Checks whether the entity with index theIdx overlaps the
|
||||||
// current selecting volume
|
// current selecting volume
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_SensitiveWire::overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveWire::overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth)
|
Standard_Boolean )
|
||||||
{
|
{
|
||||||
const Standard_Integer aSensitiveIdx = myEntityIndexes.Value (theElemIdx);
|
const Standard_Integer aSensitiveIdx = myEntityIndexes.Value (theElemIdx);
|
||||||
const Handle(SelectBasics_SensitiveEntity)& aSeg = myEntities.Value (aSensitiveIdx);
|
const Handle(SelectBasics_SensitiveEntity)& aSeg = myEntities.Value (aSensitiveIdx);
|
||||||
SelectBasics_PickResult aMatchResult;
|
return aSeg->Matches (theMgr, thePickResult);
|
||||||
if (aSeg->Matches (theMgr, aMatchResult))
|
|
||||||
{
|
|
||||||
theMatchDepth = aMatchResult.Depth();
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Standard_False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -133,7 +127,8 @@ Standard_Boolean Select3D_SensitiveWire::overlapsElement (SelectBasics_Selecting
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean Select3D_SensitiveWire::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_Boolean Select3D_SensitiveWire::elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx)
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean )
|
||||||
{
|
{
|
||||||
SelectBasics_PickResult aMatchResult;
|
SelectBasics_PickResult aMatchResult;
|
||||||
return myEntities.Value (myEntityIndexes.Value (theElemIdx))->Matches (theMgr, aMatchResult);
|
return myEntities.Value (myEntityIndexes.Value (theElemIdx))->Matches (theMgr, aMatchResult);
|
||||||
|
@@ -73,13 +73,15 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx overlaps the current selecting volume
|
//! Checks whether the entity with index theIdx overlaps the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
|
||||||
|
SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Real& theMatchDepth) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
//! Checks whether the entity with index theIdx is inside the current selecting volume
|
||||||
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
const Standard_Integer theElemIdx) Standard_OVERRIDE;
|
Standard_Integer theElemIdx,
|
||||||
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
//! Calculates distance from the 3d projection of used-picked screen point to center of the geometry
|
||||||
Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
||||||
|
@@ -27,3 +27,13 @@ SelectBasics_EntityOwner::SelectBasics_EntityOwner (const Standard_Integer thePr
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//========================================
|
||||||
|
// Function : SelectBasics_EntityOwner
|
||||||
|
// Purpose :
|
||||||
|
//========================================
|
||||||
|
SelectBasics_EntityOwner::SelectBasics_EntityOwner()
|
||||||
|
: mypriority (0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
@@ -62,7 +62,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Standard_EXPORT SelectBasics_EntityOwner (const Standard_Integer thePriority = 0);
|
Standard_EXPORT SelectBasics_EntityOwner (const Standard_Integer thePriority);
|
||||||
|
|
||||||
|
Standard_EXPORT SelectBasics_EntityOwner();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -19,37 +19,71 @@
|
|||||||
#include <Standard.hxx>
|
#include <Standard.hxx>
|
||||||
#include <NCollection_Vec4.hxx>
|
#include <NCollection_Vec4.hxx>
|
||||||
|
|
||||||
//! This structure provides unified access to the results of
|
//! This structure provides unified access to the results of Matches() method in all sensitive entities,
|
||||||
//! Matches() method in all sensitive entities.
|
//! so that it defines a Depth (distance to the entity along picking ray) and a closest Point on entity.
|
||||||
struct SelectBasics_PickResult
|
struct SelectBasics_PickResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//! Return closest result between two Pick Results according to Depth value.
|
||||||
|
static const SelectBasics_PickResult& Min (const SelectBasics_PickResult& thePickResult1,
|
||||||
|
const SelectBasics_PickResult& thePickResult2)
|
||||||
|
{
|
||||||
|
return thePickResult1.Depth() <= thePickResult2.Depth() ? thePickResult1 : thePickResult2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Empty constructor defining an invalid result.
|
||||||
SelectBasics_PickResult()
|
SelectBasics_PickResult()
|
||||||
: myDepth (DBL_MAX),
|
: myObjPickedPnt (RealLast(), 0.0, 0.0),
|
||||||
myDistToCenter (DBL_MAX) {}
|
myDepth (RealLast()),
|
||||||
|
myDistToCenter (RealLast()) {}
|
||||||
|
|
||||||
SelectBasics_PickResult (const Standard_Real theDepth,
|
//! Constructor with initialization.
|
||||||
const Standard_Real theDistToCenter)
|
SelectBasics_PickResult (Standard_Real theDepth,
|
||||||
: myDepth (theDepth),
|
Standard_Real theDistToCenter,
|
||||||
|
const gp_Pnt& theObjPickedPnt)
|
||||||
|
: myObjPickedPnt (theObjPickedPnt),
|
||||||
|
myDepth (theDepth),
|
||||||
myDistToCenter (theDistToCenter) {}
|
myDistToCenter (theDistToCenter) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline Standard_Real Depth() const
|
|
||||||
|
//! Return TRUE if result was been defined.
|
||||||
|
Standard_Boolean IsValid() const { return myDepth != RealLast(); }
|
||||||
|
|
||||||
|
//! Reset depth value.
|
||||||
|
void Invalidate()
|
||||||
{
|
{
|
||||||
return myDepth;
|
myDepth = RealLast();
|
||||||
|
myObjPickedPnt = gp_Pnt (RealLast(), 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Standard_Real DistToGeomCenter() const
|
//! Return depth along picking ray.
|
||||||
{
|
Standard_Real Depth() const { return myDepth; }
|
||||||
return myDistToCenter;
|
|
||||||
}
|
//! Set depth along picking ray.
|
||||||
|
void SetDepth (Standard_Real theDepth) { myDepth = theDepth; }
|
||||||
|
|
||||||
|
//! Return TRUE if Picked Point lying on detected entity was set.
|
||||||
|
Standard_Boolean HasPickedPoint() const { return myObjPickedPnt.X() != RealLast(); }
|
||||||
|
|
||||||
|
//! Return picked point lying on detected entity.
|
||||||
|
//! WARNING! Point is defined in local coordinate system and should be translated into World System before usage!
|
||||||
|
const gp_Pnt& PickedPoint() const { return myObjPickedPnt; }
|
||||||
|
|
||||||
|
//! Set picked point.
|
||||||
|
void SetPickedPoint (const gp_Pnt& theObjPickedPnt) { myObjPickedPnt = theObjPickedPnt; }
|
||||||
|
|
||||||
|
//! Return distance to geometry center (auxiliary value for comparing results).
|
||||||
|
Standard_Real DistToGeomCenter() const { return myDistToCenter; }
|
||||||
|
|
||||||
|
//! Set distance to geometry center.
|
||||||
|
void SetDistToGeomCenter (Standard_Real theDistToCenter) { myDistToCenter = theDistToCenter; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//!< Depth to detected point
|
gp_Pnt myObjPickedPnt; //!< User-picked selection point onto object
|
||||||
Standard_Real myDepth;
|
Standard_Real myDepth; //!< Depth to detected point
|
||||||
//!< Distance from 3d projection user-picked selection point to entity's geometry center
|
Standard_Real myDistToCenter; //!< Distance from 3d projection user-picked selection point to entity's geometry center
|
||||||
Standard_Real myDistToCenter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SelectBasics_PickResult_HeaderFile
|
#endif // _SelectBasics_PickResult_HeaderFile
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include <BVH_Box.hxx>
|
#include <BVH_Box.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <TColgp_HArray1OfPnt.hxx>
|
#include <TColgp_HArray1OfPnt.hxx>
|
||||||
|
#include <SelectBasics_PickResult.hxx>
|
||||||
|
|
||||||
class Bnd_Box;
|
class Bnd_Box;
|
||||||
class gp_Pnt;
|
class gp_Pnt;
|
||||||
@@ -45,40 +46,40 @@ public:
|
|||||||
//! Returns true if selecting volume is overlapped by box theBox
|
//! Returns true if selecting volume is overlapped by box theBox
|
||||||
virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
||||||
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
||||||
Standard_Real& theDepth) = 0;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box with minimum
|
//! Returns true if selecting volume is overlapped by axis-aligned bounding box with minimum
|
||||||
//! corner at point theMinPt and maximum at point theMaxPt
|
//! corner at point theMinPt and maximum at point theMaxPt
|
||||||
virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
virtual Standard_Boolean Overlaps (const NCollection_Vec3<Standard_Real>& theBoxMin,
|
||||||
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
const NCollection_Vec3<Standard_Real>& theBoxMax,
|
||||||
Standard_Boolean* theInside = NULL) = 0;
|
Standard_Boolean* theInside = NULL) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by point thePnt
|
//! Returns true if selecting volume is overlapped by point thePnt
|
||||||
virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth) = 0;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by point thePnt.
|
//! Returns true if selecting volume is overlapped by point thePnt.
|
||||||
//! Does not perform depth calculation, so this method is defined as
|
//! Does not perform depth calculation, so this method is defined as
|
||||||
//! helper function for inclusion test.
|
//! helper function for inclusion test.
|
||||||
virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) = 0;
|
virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
||||||
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
||||||
virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth) = 0;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
//! Returns true if selecting volume is overlapped by planar convex polygon, which points
|
||||||
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
//! are stored in theArrayOfPts, taking into account sensitivity type theSensType
|
||||||
virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth) = 0;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by line segment with start point at thePt1
|
//! Returns true if selecting volume is overlapped by line segment with start point at thePt1
|
||||||
//! and end point at thePt2
|
//! and end point at thePt2
|
||||||
virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
|
virtual Standard_Boolean Overlaps (const gp_Pnt& thePt1,
|
||||||
const gp_Pnt& thePt2,
|
const gp_Pnt& thePt2,
|
||||||
Standard_Real& theDepth) = 0;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by triangle with vertices thePt1,
|
//! Returns true if selecting volume is overlapped by triangle with vertices thePt1,
|
||||||
//! thePt2 and thePt3, taking into account sensitivity type theSensType
|
//! thePt2 and thePt3, taking into account sensitivity type theSensType
|
||||||
@@ -86,11 +87,11 @@ public:
|
|||||||
const gp_Pnt& thePt2,
|
const gp_Pnt& thePt2,
|
||||||
const gp_Pnt& thePt3,
|
const gp_Pnt& thePt3,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth) = 0;
|
SelectBasics_PickResult& thePickResult) const = 0;
|
||||||
|
|
||||||
//! Calculates distance from 3d projection of user-defined selection point
|
//! Calculates distance from 3d projection of user-defined selection point
|
||||||
//! to the given point theCOG
|
//! to the given point theCOG
|
||||||
virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) = 0;
|
virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const = 0;
|
||||||
|
|
||||||
virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0;
|
virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const = 0;
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ void SelectMgr_BaseFrustum::SetBuilder (const Handle(SelectMgr_FrustumBuilder)&
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
|
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
|
||||||
const SelectMgr_Vec3& /*theBoxMax*/,
|
const SelectMgr_Vec3& /*theBoxMax*/,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& /*thePickResult*/) const
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBox
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
|
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBoxMin*/,
|
||||||
const SelectMgr_Vec3& /*theBoxMax*/,
|
const SelectMgr_Vec3& /*theBoxMax*/,
|
||||||
Standard_Boolean* /*theInside*/)
|
Standard_Boolean* /*theInside*/) const
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const SelectMgr_Vec3& /*theBox
|
|||||||
// purpose : Intersection test between defined volume and given point
|
// purpose : Intersection test between defined volume and given point
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/,
|
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& ) const
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/,
|
|||||||
// function : Overlaps
|
// function : Overlaps
|
||||||
// purpose : Intersection test between defined volume and given point
|
// purpose : Intersection test between defined volume and given point
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/)
|
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/) const
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt*/)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const TColgp_Array1OfPnt& /*theArrayOfPnts*/,
|
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const TColgp_Array1OfPnt& /*theArrayOfPnts*/,
|
||||||
Select3D_TypeOfSensitivity /*theSensType*/,
|
Select3D_TypeOfSensitivity /*theSensType*/,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& ) const
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePt1*/,
|
|||||||
const gp_Pnt& /*thePt2*/,
|
const gp_Pnt& /*thePt2*/,
|
||||||
const gp_Pnt& /*thePt3*/,
|
const gp_Pnt& /*thePt3*/,
|
||||||
Select3D_TypeOfSensitivity /*theSensType*/,
|
Select3D_TypeOfSensitivity /*theSensType*/,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& ) const
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePt1*/,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt1*/,
|
Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt1*/,
|
||||||
const gp_Pnt& /*thePnt2*/,
|
const gp_Pnt& /*thePnt2*/,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& ) const
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ Standard_Boolean SelectMgr_BaseFrustum::Overlaps (const gp_Pnt& /*thePnt1*/,
|
|||||||
// purpose : Measures distance between 3d projection of user-picked
|
// purpose : Measures distance between 3d projection of user-picked
|
||||||
// screen point and given point theCOG
|
// screen point and given point theCOG
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Real SelectMgr_BaseFrustum::DistToGeometryCenter (const gp_Pnt& /*theCOG*/)
|
Standard_Real SelectMgr_BaseFrustum::DistToGeometryCenter (const gp_Pnt& /*theCOG*/) const
|
||||||
{
|
{
|
||||||
return DBL_MAX;
|
return DBL_MAX;
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ gp_Pnt SelectMgr_BaseFrustum::DetectedPoint (const Standard_Real /*theDepth*/) c
|
|||||||
// detected belongs to the region defined by clipping planes
|
// detected belongs to the region defined by clipping planes
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_BaseFrustum::IsClipped (const Graphic3d_SequenceOfHClipPlane& /*thePlanes*/,
|
Standard_Boolean SelectMgr_BaseFrustum::IsClipped (const Graphic3d_SequenceOfHClipPlane& /*thePlanes*/,
|
||||||
const Standard_Real /*theDepth*/)
|
const Standard_Real /*theDepth*/) const
|
||||||
{
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
#include <Select3D_TypeOfSensitivity.hxx>
|
#include <Select3D_TypeOfSensitivity.hxx>
|
||||||
#include <SelectMgr_VectorTypes.hxx>
|
#include <SelectMgr_VectorTypes.hxx>
|
||||||
|
|
||||||
|
#include <SelectBasics_PickResult.hxx>
|
||||||
|
|
||||||
//! This class is an interface for different types of selecting frustums,
|
//! This class is an interface for different types of selecting frustums,
|
||||||
//! defining different selection types, like point, box or polyline
|
//! defining different selection types, like point, box or polyline
|
||||||
//! selection. It contains signatures of functions for detection of
|
//! selection. It contains signatures of functions for detection of
|
||||||
@@ -118,35 +120,35 @@ public:
|
|||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
//! SAT intersection test between defined volume and given axis-aligned box
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Real& theDepth);
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Boolean* theInside = NULL);
|
Standard_Boolean* theInside = NULL) const;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth);
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
//! Does not perform depth calculation, so this method is defined as
|
//! Does not perform depth calculation, so this method is defined as
|
||||||
//! helper function for inclusion test. Therefore, its implementation
|
//! helper function for inclusion test. Therefore, its implementation
|
||||||
//! makes sense only for rectangular frustum with box selection mode activated.
|
//! makes sense only for rectangular frustum with box selection mode activated.
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt);
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) const;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth);
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
//! Checks if line segment overlaps selecting frustum
|
//! Checks if line segment overlaps selecting frustum
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& theDepth);
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle. The test may
|
//! SAT intersection test between defined volume and given triangle. The test may
|
||||||
//! be considered of interior part or boundary line defined by triangle vertices
|
//! be considered of interior part or boundary line defined by triangle vertices
|
||||||
@@ -155,18 +157,18 @@ public:
|
|||||||
const gp_Pnt& thePt2,
|
const gp_Pnt& thePt2,
|
||||||
const gp_Pnt& thePt3,
|
const gp_Pnt& thePt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth);
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
//! Measures distance between 3d projection of user-picked
|
//! Measures distance between 3d projection of user-picked
|
||||||
//! screen point and given point theCOG
|
//! screen point and given point theCOG
|
||||||
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG);
|
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const;
|
||||||
|
|
||||||
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const;
|
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const;
|
||||||
|
|
||||||
//! Checks if the point of sensitive in which selection was detected belongs
|
//! Checks if the point of sensitive in which selection was detected belongs
|
||||||
//! to the region defined by clipping planes
|
//! to the region defined by clipping planes
|
||||||
Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||||
const Standard_Real theDepth);
|
const Standard_Real theDepth) const;
|
||||||
|
|
||||||
//! Valid for point selection only!
|
//! Valid for point selection only!
|
||||||
//! Computes depth range for global (defined for the whole view) clipping planes.
|
//! Computes depth range for global (defined for the whole view) clipping planes.
|
||||||
|
@@ -66,24 +66,24 @@ protected:
|
|||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
||||||
Standard_Boolean hasOverlap (const SelectMgr_Vec3& theBoxMin,
|
Standard_Boolean hasOverlap (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Boolean* theInside = NULL);
|
Standard_Boolean* theInside = NULL) const;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given point
|
//! SAT intersection test between defined volume and given point
|
||||||
Standard_Boolean hasOverlap (const gp_Pnt& thePnt);
|
Standard_Boolean hasOverlap (const gp_Pnt& thePnt) const;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given segment
|
//! SAT intersection test between defined volume and given segment
|
||||||
Standard_Boolean hasOverlap (const gp_Pnt& thePnt1,
|
Standard_Boolean hasOverlap (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2);
|
const gp_Pnt& thePnt2) const;
|
||||||
|
|
||||||
//! SAT intersection test between frustum given and planar convex polygon represented as ordered point set
|
//! SAT intersection test between frustum given and planar convex polygon represented as ordered point set
|
||||||
Standard_Boolean hasOverlap (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_Boolean hasOverlap (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
gp_Vec& theNormal);
|
gp_Vec& theNormal) const;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle
|
//! SAT intersection test between defined volume and given triangle
|
||||||
Standard_Boolean hasOverlap (const gp_Pnt& thePnt1,
|
Standard_Boolean hasOverlap (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
gp_Vec& theNormal);
|
gp_Vec& theNormal) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -129,7 +129,7 @@ Standard_Boolean SelectMgr_Frustum<N>::isSeparated (const gp_Pnt& thePnt1,
|
|||||||
template <int N>
|
template <int N>
|
||||||
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const SelectMgr_Vec3& theMinPnt,
|
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const SelectMgr_Vec3& theMinPnt,
|
||||||
const SelectMgr_Vec3& theMaxPnt,
|
const SelectMgr_Vec3& theMaxPnt,
|
||||||
Standard_Boolean* theInside)
|
Standard_Boolean* theInside) const
|
||||||
{
|
{
|
||||||
for (Standard_Integer anAxis = 0; anAxis < 3; ++anAxis)
|
for (Standard_Integer anAxis = 0; anAxis < 3; ++anAxis)
|
||||||
{
|
{
|
||||||
@@ -203,7 +203,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const SelectMgr_Vec3& theMinP
|
|||||||
// purpose : SAT intersection test between defined volume and given point
|
// purpose : SAT intersection test between defined volume and given point
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
template <int N>
|
template <int N>
|
||||||
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt)
|
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt) const
|
||||||
{
|
{
|
||||||
const Standard_Integer anIncFactor = (myIsOrthographic && N == 4) ? 2 : 1;
|
const Standard_Integer anIncFactor = (myIsOrthographic && N == 4) ? 2 : 1;
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
template <int N>
|
template <int N>
|
||||||
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& theStartPnt,
|
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& theStartPnt,
|
||||||
const gp_Pnt& theEndPnt)
|
const gp_Pnt& theEndPnt) const
|
||||||
{
|
{
|
||||||
const gp_XYZ& aDir = theEndPnt.XYZ() - theStartPnt.XYZ();
|
const gp_XYZ& aDir = theEndPnt.XYZ() - theStartPnt.XYZ();
|
||||||
if (aDir.Modulus() < Precision::Confusion())
|
if (aDir.Modulus() < Precision::Confusion())
|
||||||
@@ -309,7 +309,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& theStartPnt,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
template <int N>
|
template <int N>
|
||||||
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
gp_Vec& theNormal)
|
gp_Vec& theNormal) const
|
||||||
{
|
{
|
||||||
Standard_Integer aStartIdx = theArrayOfPnts.Lower();
|
Standard_Integer aStartIdx = theArrayOfPnts.Lower();
|
||||||
Standard_Integer anEndIdx = theArrayOfPnts.Upper();
|
Standard_Integer anEndIdx = theArrayOfPnts.Upper();
|
||||||
@@ -406,7 +406,7 @@ template <int N>
|
|||||||
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt1,
|
Standard_Boolean SelectMgr_Frustum<N>::hasOverlap (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
gp_Vec& theNormal)
|
gp_Vec& theNormal) const
|
||||||
{
|
{
|
||||||
const gp_XYZ aTrEdges[3] = { thePnt2.XYZ() - thePnt1.XYZ(),
|
const gp_XYZ aTrEdges[3] = { thePnt2.XYZ() - thePnt1.XYZ(),
|
||||||
thePnt3.XYZ() - thePnt2.XYZ(),
|
thePnt3.XYZ() - thePnt2.XYZ(),
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void SelectMgr_RectangularFrustum::segmentSegmentDistance (const gp_Pnt& theSegPnt1,
|
void SelectMgr_RectangularFrustum::segmentSegmentDistance (const gp_Pnt& theSegPnt1,
|
||||||
const gp_Pnt& theSegPnt2,
|
const gp_Pnt& theSegPnt2,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
gp_XYZ anU = theSegPnt2.XYZ() - theSegPnt1.XYZ();
|
gp_XYZ anU = theSegPnt2.XYZ() - theSegPnt1.XYZ();
|
||||||
gp_XYZ aV = myViewRayDir.XYZ();
|
gp_XYZ aV = myViewRayDir.XYZ();
|
||||||
@@ -70,17 +70,32 @@ void SelectMgr_RectangularFrustum::segmentSegmentDistance (const gp_Pnt& theSegP
|
|||||||
}
|
}
|
||||||
aTc = (Abs (aTd) < gp::Resolution() ? 0.0 : aTn / aTd);
|
aTc = (Abs (aTd) < gp::Resolution() ? 0.0 : aTn / aTd);
|
||||||
|
|
||||||
gp_Pnt aClosestPnt = myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * aTc;
|
const gp_Pnt aClosestPnt = myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * aTc;
|
||||||
theDepth = myNearPickedPnt.Distance (aClosestPnt) * myScale;
|
thePickResult.SetDepth (myNearPickedPnt.Distance (aClosestPnt) * myScale);
|
||||||
|
|
||||||
|
const gp_Vec aPickedVec = aClosestPnt.XYZ() - theSegPnt1.XYZ();
|
||||||
|
const gp_Vec aFigureVec = theSegPnt2.XYZ() - theSegPnt1.XYZ();
|
||||||
|
const Standard_Real aPickedVecMod = aPickedVec.Magnitude();
|
||||||
|
const Standard_Real aFigureVecMod = aFigureVec.Magnitude();
|
||||||
|
if (aPickedVecMod <= gp::Resolution()
|
||||||
|
|| aFigureVecMod <= gp::Resolution())
|
||||||
|
{
|
||||||
|
thePickResult.SetPickedPoint (aClosestPnt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Real aCosOfAngle = aFigureVec.Dot (aPickedVec) / (aPickedVecMod * aFigureVecMod);
|
||||||
|
const Standard_Real aSegPntShift = Min(aFigureVecMod, Max(0.0, aCosOfAngle * aPickedVecMod));
|
||||||
|
thePickResult.SetPickedPoint (theSegPnt1.XYZ() + aFigureVec.XYZ() * (aSegPntShift / aFigureVecMod));
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : segmentPlaneIntersection
|
// function : segmentPlaneIntersection
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void SelectMgr_RectangularFrustum::segmentPlaneIntersection (const gp_Vec& thePlane,
|
bool SelectMgr_RectangularFrustum::segmentPlaneIntersection (const gp_Vec& thePlane,
|
||||||
const gp_Pnt& thePntOnPlane,
|
const gp_Pnt& thePntOnPlane,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
gp_XYZ anU = myViewRayDir.XYZ();
|
gp_XYZ anU = myViewRayDir.XYZ();
|
||||||
gp_XYZ aW = myNearPickedPnt.XYZ() - thePntOnPlane.XYZ();
|
gp_XYZ aW = myNearPickedPnt.XYZ() - thePntOnPlane.XYZ();
|
||||||
@@ -91,25 +106,26 @@ void SelectMgr_RectangularFrustum::segmentPlaneIntersection (const gp_Vec& thePl
|
|||||||
{
|
{
|
||||||
if (Abs (aN) < Precision::Angular())
|
if (Abs (aN) < Precision::Angular())
|
||||||
{
|
{
|
||||||
theDepth = DBL_MAX;
|
thePickResult.Invalidate();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theDepth = DBL_MAX;
|
thePickResult.Invalidate();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real aParam = aN / aD;
|
Standard_Real aParam = aN / aD;
|
||||||
if (aParam < 0.0 || aParam > 1.0)
|
if (aParam < 0.0 || aParam > 1.0)
|
||||||
{
|
{
|
||||||
theDepth = DBL_MAX;
|
thePickResult.Invalidate();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gp_Pnt aClosestPnt = myNearPickedPnt.XYZ() + anU * aParam;
|
gp_Pnt aClosestPnt = myNearPickedPnt.XYZ() + anU * aParam;
|
||||||
theDepth = myNearPickedPnt.Distance (aClosestPnt) * myScale;
|
thePickResult.SetDepth (myNearPickedPnt.Distance (aClosestPnt) * myScale);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -413,7 +429,7 @@ Handle(SelectMgr_BaseFrustum) SelectMgr_RectangularFrustum::ScaleAndTransform (c
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Boolean* theInside)
|
Standard_Boolean* theInside) const
|
||||||
{
|
{
|
||||||
return hasOverlap (theBoxMin, theBoxMax, theInside);
|
return hasOverlap (theBoxMin, theBoxMax, theInside);
|
||||||
}
|
}
|
||||||
@@ -425,7 +441,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& t
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (!hasOverlap (theBoxMin, theBoxMax))
|
if (!hasOverlap (theBoxMin, theBoxMax))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -435,9 +451,9 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& t
|
|||||||
aNearestPnt.SetY (Max (Min (myNearPickedPnt.Y(), theBoxMax.y()), theBoxMin.y()));
|
aNearestPnt.SetY (Max (Min (myNearPickedPnt.Y(), theBoxMax.y()), theBoxMin.y()));
|
||||||
aNearestPnt.SetZ (Max (Min (myNearPickedPnt.Z(), theBoxMax.z()), theBoxMin.z()));
|
aNearestPnt.SetZ (Max (Min (myNearPickedPnt.Z(), theBoxMax.z()), theBoxMin.z()));
|
||||||
|
|
||||||
theDepth = aNearestPnt.Distance (myNearPickedPnt);
|
thePickResult.SetDepth (aNearestPnt.Distance (myNearPickedPnt));
|
||||||
|
|
||||||
return isViewClippingOk (theDepth);
|
return isViewClippingOk (thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -445,7 +461,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const SelectMgr_Vec3& t
|
|||||||
// purpose : Intersection test between defined volume and given point
|
// purpose : Intersection test between defined volume and given point
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt,
|
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (!hasOverlap (thePnt))
|
if (!hasOverlap (thePnt))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -454,16 +470,17 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt,
|
|||||||
gp_Pnt aDetectedPnt =
|
gp_Pnt aDetectedPnt =
|
||||||
myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * (aV.Dot (myViewRayDir.XYZ()) / myViewRayDir.Dot (myViewRayDir));
|
myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * (aV.Dot (myViewRayDir.XYZ()) / myViewRayDir.Dot (myViewRayDir));
|
||||||
|
|
||||||
theDepth = aDetectedPnt.Distance (myNearPickedPnt) * myScale;
|
thePickResult.SetDepth (aDetectedPnt.Distance (myNearPickedPnt) * myScale);
|
||||||
|
thePickResult.SetPickedPoint (thePnt);
|
||||||
|
|
||||||
return isViewClippingOk (theDepth);
|
return isViewClippingOk (thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : Overlaps
|
// function : Overlaps
|
||||||
// purpose : Intersection test between defined volume and given point
|
// purpose : Intersection test between defined volume and given point
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt)
|
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt) const
|
||||||
{
|
{
|
||||||
return hasOverlap (thePnt);
|
return hasOverlap (thePnt);
|
||||||
}
|
}
|
||||||
@@ -474,15 +491,14 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
theDepth = -DBL_MAX;
|
|
||||||
if (!hasOverlap (thePnt1, thePnt2))
|
if (!hasOverlap (thePnt1, thePnt2))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
segmentSegmentDistance (thePnt1, thePnt2, theDepth);
|
segmentSegmentDistance (thePnt1, thePnt2, thePickResult);
|
||||||
|
|
||||||
return isViewClippingOk (theDepth);
|
return isViewClippingOk (thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -494,12 +510,13 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (theSensType == Select3D_TOS_BOUNDARY)
|
if (theSensType == Select3D_TOS_BOUNDARY)
|
||||||
{
|
{
|
||||||
Standard_Integer aMatchingSegmentsNb = -1;
|
Standard_Integer aMatchingSegmentsNb = -1;
|
||||||
theDepth = DBL_MAX;
|
SelectBasics_PickResult aPickResult;
|
||||||
|
thePickResult.Invalidate();
|
||||||
const Standard_Integer aLower = theArrayOfPnts.Lower();
|
const Standard_Integer aLower = theArrayOfPnts.Lower();
|
||||||
const Standard_Integer anUpper = theArrayOfPnts.Upper();
|
const Standard_Integer anUpper = theArrayOfPnts.Upper();
|
||||||
for (Standard_Integer aPntIter = aLower; aPntIter <= anUpper; ++aPntIter)
|
for (Standard_Integer aPntIter = aLower; aPntIter <= anUpper; ++aPntIter)
|
||||||
@@ -509,9 +526,8 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const TColgp_Array1OfPn
|
|||||||
if (hasOverlap (aStartPnt, aEndPnt))
|
if (hasOverlap (aStartPnt, aEndPnt))
|
||||||
{
|
{
|
||||||
aMatchingSegmentsNb++;
|
aMatchingSegmentsNb++;
|
||||||
Standard_Real aSegmentDepth = RealLast();
|
segmentSegmentDistance (aStartPnt, aEndPnt, aPickResult);
|
||||||
segmentSegmentDistance (aStartPnt, aEndPnt, aSegmentDepth);
|
thePickResult = SelectBasics_PickResult::Min (thePickResult, aPickResult);
|
||||||
theDepth = Min (theDepth, aSegmentDepth);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,15 +537,16 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const TColgp_Array1OfPn
|
|||||||
else if (theSensType == Select3D_TOS_INTERIOR)
|
else if (theSensType == Select3D_TOS_INTERIOR)
|
||||||
{
|
{
|
||||||
gp_Vec aPolyNorm (gp_XYZ (RealLast(), RealLast(), RealLast()));
|
gp_Vec aPolyNorm (gp_XYZ (RealLast(), RealLast(), RealLast()));
|
||||||
if (!hasOverlap (theArrayOfPnts, aPolyNorm))
|
if (!hasOverlap (theArrayOfPnts, aPolyNorm)
|
||||||
|
|| !segmentPlaneIntersection (aPolyNorm,
|
||||||
|
theArrayOfPnts.First(),
|
||||||
|
thePickResult))
|
||||||
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
}
|
||||||
segmentPlaneIntersection (aPolyNorm,
|
|
||||||
theArrayOfPnts.Value (theArrayOfPnts.Lower()),
|
|
||||||
theDepth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return isViewClippingOk (theDepth);
|
return isViewClippingOk (thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -543,13 +560,13 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
|||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (theSensType == Select3D_TOS_BOUNDARY)
|
if (theSensType == Select3D_TOS_BOUNDARY)
|
||||||
{
|
{
|
||||||
const gp_Pnt aPntsArrayBuf[4] = { thePnt1, thePnt2, thePnt3, thePnt1 };
|
const gp_Pnt aPntsArrayBuf[4] = { thePnt1, thePnt2, thePnt3, thePnt1 };
|
||||||
const TColgp_Array1OfPnt aPntsArray (aPntsArrayBuf[0], 1, 4);
|
const TColgp_Array1OfPnt aPntsArray (aPntsArrayBuf[0], 1, 4);
|
||||||
return Overlaps (aPntsArray, Select3D_TOS_BOUNDARY, theDepth);
|
return Overlaps (aPntsArray, Select3D_TOS_BOUNDARY, thePickResult);
|
||||||
}
|
}
|
||||||
else if (theSensType == Select3D_TOS_INTERIOR)
|
else if (theSensType == Select3D_TOS_INTERIOR)
|
||||||
{
|
{
|
||||||
@@ -568,16 +585,15 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
|||||||
// handle degenerated triangles: in this case, there is no possible way to detect overlap correctly.
|
// handle degenerated triangles: in this case, there is no possible way to detect overlap correctly.
|
||||||
if (aTriangleNormal.SquareMagnitude() < gp::Resolution())
|
if (aTriangleNormal.SquareMagnitude() < gp::Resolution())
|
||||||
{
|
{
|
||||||
theDepth = std::numeric_limits<Standard_Real>::max();
|
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle the case when triangle normal and selecting frustum direction are orthogonal: for this case, overlap
|
// handle the case when triangle normal and selecting frustum direction are orthogonal: for this case, overlap
|
||||||
// is detected correctly, and distance to triangle's plane can be measured as distance to its arbitrary vertex.
|
// is detected correctly, and distance to triangle's plane can be measured as distance to its arbitrary vertex.
|
||||||
const gp_XYZ aDiff = myNearPickedPnt.XYZ() - thePnt1.XYZ();
|
const gp_XYZ aDiff = myNearPickedPnt.XYZ() - thePnt1.XYZ();
|
||||||
theDepth = aTriangleNormal.Dot (aDiff) * myScale;
|
thePickResult.SetDepth (aTriangleNormal.Dot (aDiff) * myScale);
|
||||||
|
thePickResult.SetPickedPoint (thePnt1);
|
||||||
return isViewClippingOk (theDepth);
|
return isViewClippingOk (thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
gp_XYZ anEdge = (thePnt1.XYZ() - myNearPickedPnt.XYZ()) * (1.0 / anAlpha);
|
gp_XYZ anEdge = (thePnt1.XYZ() - myNearPickedPnt.XYZ()) * (1.0 / anAlpha);
|
||||||
@@ -589,20 +605,18 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
|||||||
Standard_Real anU = aVec.Dot (aTrEdges[2]);
|
Standard_Real anU = aVec.Dot (aTrEdges[2]);
|
||||||
Standard_Real aV = aVec.Dot (aTrEdges[0]);
|
Standard_Real aV = aVec.Dot (aTrEdges[0]);
|
||||||
|
|
||||||
Standard_Boolean isInterior = (aTime >= 0.0) && (anU >= 0.0) && (aV >= 0.0) && (anU + aV <= 1.0);
|
const Standard_Boolean isInterior = (aTime >= 0.0) && (anU >= 0.0) && (aV >= 0.0) && (anU + aV <= 1.0);
|
||||||
|
const gp_Pnt aPtOnPlane = myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * aTime;
|
||||||
if (isInterior)
|
if (isInterior)
|
||||||
{
|
{
|
||||||
gp_Pnt aDetectedPnt = myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * aTime;
|
thePickResult.SetDepth (myNearPickedPnt.Distance (aPtOnPlane) * myScale);
|
||||||
theDepth = myNearPickedPnt.Distance (aDetectedPnt) * myScale;
|
thePickResult.SetPickedPoint (aPtOnPlane);
|
||||||
|
return isViewClippingOk (thePickResult);
|
||||||
return isViewClippingOk (theDepth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gp_Pnt aPnts[3] = {thePnt1, thePnt2, thePnt3};
|
gp_Pnt aPnts[3] = {thePnt1, thePnt2, thePnt3};
|
||||||
Standard_Real aMinDist = RealLast();
|
Standard_Real aMinDist = RealLast();
|
||||||
Standard_Integer aNearestEdgeIdx = -1;
|
Standard_Integer aNearestEdgeIdx = -1;
|
||||||
gp_Pnt aPtOnPlane = myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * aTime;
|
|
||||||
for (Standard_Integer anEdgeIdx = 0; anEdgeIdx < 3; ++anEdgeIdx)
|
for (Standard_Integer anEdgeIdx = 0; anEdgeIdx < 3; ++anEdgeIdx)
|
||||||
{
|
{
|
||||||
gp_XYZ aW = aPtOnPlane.XYZ() - aPnts[anEdgeIdx].XYZ();
|
gp_XYZ aW = aPtOnPlane.XYZ() - aPnts[anEdgeIdx].XYZ();
|
||||||
@@ -614,10 +628,10 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
|||||||
aNearestEdgeIdx = anEdgeIdx;
|
aNearestEdgeIdx = anEdgeIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
segmentSegmentDistance (aPnts[aNearestEdgeIdx], aPnts[(aNearestEdgeIdx + 1) % 3], theDepth);
|
segmentSegmentDistance (aPnts[aNearestEdgeIdx], aPnts[(aNearestEdgeIdx + 1) % 3], thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isViewClippingOk (theDepth);
|
return isViewClippingOk (thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -625,7 +639,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
|||||||
// purpose : Measures distance between 3d projection of user-picked
|
// purpose : Measures distance between 3d projection of user-picked
|
||||||
// screen point and given point theCOG
|
// screen point and given point theCOG
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Real SelectMgr_RectangularFrustum::DistToGeometryCenter (const gp_Pnt& theCOG)
|
Standard_Real SelectMgr_RectangularFrustum::DistToGeometryCenter (const gp_Pnt& theCOG) const
|
||||||
{
|
{
|
||||||
return theCOG.Distance (myNearPickedPnt) * myScale;
|
return theCOG.Distance (myNearPickedPnt) * myScale;
|
||||||
}
|
}
|
||||||
@@ -645,7 +659,7 @@ gp_Pnt SelectMgr_RectangularFrustum::DetectedPoint (const Standard_Real theDepth
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void SelectMgr_RectangularFrustum::computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
void SelectMgr_RectangularFrustum::computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||||
SelectMgr_ViewClipRange& theRange)
|
SelectMgr_ViewClipRange& theRange) const
|
||||||
{
|
{
|
||||||
Standard_Real aPlaneA, aPlaneB, aPlaneC, aPlaneD;
|
Standard_Real aPlaneA, aPlaneB, aPlaneC, aPlaneD;
|
||||||
for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes); aPlaneIt.More(); aPlaneIt.Next())
|
for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes); aPlaneIt.More(); aPlaneIt.Next())
|
||||||
@@ -696,11 +710,11 @@ void SelectMgr_RectangularFrustum::computeClippingRange (const Graphic3d_Sequenc
|
|||||||
{
|
{
|
||||||
if (aDotProduct < 0.0)
|
if (aDotProduct < 0.0)
|
||||||
{
|
{
|
||||||
theRange.ChangeMain().Add (Bnd_Range (aDistToPln, RealLast()));
|
theRange.ChangeUnclipRange().TrimTo (aDistToPln);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theRange.ChangeMain().Add (Bnd_Range (RealFirst(), aDistToPln));
|
theRange.ChangeUnclipRange().TrimFrom (aDistToPln);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -719,7 +733,7 @@ void SelectMgr_RectangularFrustum::computeClippingRange (const Graphic3d_Sequenc
|
|||||||
if (!aSubRange.IsVoid()
|
if (!aSubRange.IsVoid()
|
||||||
&& aClipPlane->IsChain())
|
&& aClipPlane->IsChain())
|
||||||
{
|
{
|
||||||
theRange.AddSubRange (aSubRange);
|
theRange.AddClipSubRange (aSubRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -730,7 +744,7 @@ void SelectMgr_RectangularFrustum::computeClippingRange (const Graphic3d_Sequenc
|
|||||||
// detected belongs to the region defined by clipping planes
|
// detected belongs to the region defined by clipping planes
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
Standard_Boolean SelectMgr_RectangularFrustum::IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||||
const Standard_Real theDepth)
|
const Standard_Real theDepth) const
|
||||||
{
|
{
|
||||||
SelectMgr_ViewClipRange aRange;
|
SelectMgr_ViewClipRange aRange;
|
||||||
computeClippingRange (thePlanes, aRange);
|
computeClippingRange (thePlanes, aRange);
|
||||||
@@ -757,10 +771,10 @@ void SelectMgr_RectangularFrustum::SetViewClipping (const Handle(Graphic3d_Seque
|
|||||||
// function : isViewClippingOk
|
// function : isViewClippingOk
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_RectangularFrustum::isViewClippingOk (const Standard_Real theDepth) const
|
Standard_Boolean SelectMgr_RectangularFrustum::isViewClippingOk (const SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
return !myIsViewClipEnabled
|
return !myIsViewClipEnabled
|
||||||
|| !myViewClipRange.IsClipped (theDepth);
|
|| !myViewClipRange.IsClipped (thePickResult.Depth());
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
@@ -59,32 +59,32 @@ public:
|
|||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
//! SAT intersection test between defined volume and given axis-aligned box
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Boolean* theInside = NULL) Standard_OVERRIDE;
|
Standard_Boolean* theInside) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks if line segment overlaps selecting frustum
|
//! Checks if line segment overlaps selecting frustum
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle. The test may
|
//! SAT intersection test between defined volume and given triangle. The test may
|
||||||
//! be considered of interior part or boundary line defined by triangle vertices
|
//! be considered of interior part or boundary line defined by triangle vertices
|
||||||
@@ -93,11 +93,11 @@ public:
|
|||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Measures distance between 3d projection of user-picked
|
//! Measures distance between 3d projection of user-picked
|
||||||
//! screen point and given point theCOG
|
//! screen point and given point theCOG
|
||||||
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth
|
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth
|
||||||
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;
|
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;
|
||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
//! Checks if the point of sensitive in which selection was detected belongs
|
//! Checks if the point of sensitive in which selection was detected belongs
|
||||||
//! to the region defined by clipping planes
|
//! to the region defined by clipping planes
|
||||||
Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||||
const Standard_Real theDepth) Standard_OVERRIDE;
|
const Standard_Real theDepth) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Valid for point selection only!
|
//! Valid for point selection only!
|
||||||
//! Computes depth range for global (defined for the whole view) clipping planes.
|
//! Computes depth range for global (defined for the whole view) clipping planes.
|
||||||
@@ -141,18 +141,18 @@ protected:
|
|||||||
|
|
||||||
Standard_EXPORT void segmentSegmentDistance (const gp_Pnt& theSegPnt1,
|
Standard_EXPORT void segmentSegmentDistance (const gp_Pnt& theSegPnt1,
|
||||||
const gp_Pnt& theSegPnt2,
|
const gp_Pnt& theSegPnt2,
|
||||||
Standard_Real& theDepth);
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
Standard_EXPORT void segmentPlaneIntersection (const gp_Vec& thePlane,
|
Standard_EXPORT bool segmentPlaneIntersection (const gp_Vec& thePlane,
|
||||||
const gp_Pnt& thePntOnPlane,
|
const gp_Pnt& thePntOnPlane,
|
||||||
Standard_Real& theDepth);
|
SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
//! Computes valid depth range for the given clipping planes
|
//! Computes valid depth range for the given clipping planes
|
||||||
Standard_EXPORT void computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
Standard_EXPORT void computeClippingRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||||
SelectMgr_ViewClipRange& theRange);
|
SelectMgr_ViewClipRange& theRange) const;
|
||||||
|
|
||||||
//! Returns false if theDepth must be clipped by current view clip range
|
//! Returns false if theDepth must be clipped by current view clip range
|
||||||
Standard_EXPORT Standard_Boolean isViewClippingOk (const Standard_Real theDepth) const;
|
Standard_EXPORT Standard_Boolean isViewClippingOk (const SelectBasics_PickResult& thePickResult) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@@ -236,12 +236,12 @@ void SelectMgr_SelectingVolumeManager::BuildSelectingVolume (const TColgp_Array1
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (theBoxMin, theBoxMax, theDepth);
|
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (theBoxMin, theBoxMax, thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -250,7 +250,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Boolean* theInside)
|
Standard_Boolean* theInside) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -263,20 +263,20 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const SelectMgr_Vec
|
|||||||
// purpose : Intersection test between defined volume and given point
|
// purpose : Intersection test between defined volume and given point
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePnt,
|
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (thePnt,
|
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (thePnt,
|
||||||
theDepth);
|
thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Overlaps
|
// function : Overlaps
|
||||||
// purpose : Intersection test between defined volume and given point
|
// purpose : Intersection test between defined volume and given point
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePnt)
|
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePnt) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -293,14 +293,14 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePn
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPnts,
|
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPnts,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (theArrayOfPnts->Array1(),
|
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (theArrayOfPnts->Array1(),
|
||||||
(Select3D_TypeOfSensitivity)theSensType,
|
(Select3D_TypeOfSensitivity)theSensType,
|
||||||
theDepth);
|
thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -312,14 +312,14 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const Handle(TColgp
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (theArrayOfPnts,
|
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (theArrayOfPnts,
|
||||||
(Select3D_TypeOfSensitivity)theSensType,
|
(Select3D_TypeOfSensitivity)theSensType,
|
||||||
theDepth);
|
thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -328,12 +328,12 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const TColgp_Array1
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt1,
|
Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt1,
|
||||||
const gp_Pnt& thePt2,
|
const gp_Pnt& thePt2,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (thePt1, thePt2, theDepth);
|
return mySelectingVolumes[myActiveSelectionType / 2]->Overlaps (thePt1, thePt2, thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -347,7 +347,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt
|
|||||||
const gp_Pnt& thePt2,
|
const gp_Pnt& thePt2,
|
||||||
const gp_Pnt& thePt3,
|
const gp_Pnt& thePt3,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -356,7 +356,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt
|
|||||||
thePt2,
|
thePt2,
|
||||||
thePt3,
|
thePt3,
|
||||||
(Select3D_TypeOfSensitivity)theSensType,
|
(Select3D_TypeOfSensitivity)theSensType,
|
||||||
theDepth);
|
thePickResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -364,7 +364,7 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::Overlaps (const gp_Pnt& thePt
|
|||||||
// purpose : Measures distance between 3d projection of user-picked
|
// purpose : Measures distance between 3d projection of user-picked
|
||||||
// screen point and given point theCOG
|
// screen point and given point theCOG
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Real SelectMgr_SelectingVolumeManager::DistToGeometryCenter (const gp_Pnt& theCOG)
|
Standard_Real SelectMgr_SelectingVolumeManager::DistToGeometryCenter (const gp_Pnt& theCOG) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType == Unknown)
|
if (myActiveSelectionType == Unknown)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -394,7 +394,7 @@ gp_Pnt SelectMgr_SelectingVolumeManager::DetectedPoint (const Standard_Real theD
|
|||||||
// detected belongs to the region defined by clipping planes
|
// detected belongs to the region defined by clipping planes
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_SelectingVolumeManager::IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
Standard_Boolean SelectMgr_SelectingVolumeManager::IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||||
const Standard_Real& theDepth)
|
const Standard_Real& theDepth) const
|
||||||
{
|
{
|
||||||
if (myActiveSelectionType != Point)
|
if (myActiveSelectionType != Point)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
@@ -105,40 +105,40 @@ public:
|
|||||||
|
|
||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
//! SAT intersection test between defined volume and given axis-aligned box
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
|
||||||
const SelectMgr_Vec3& theBoxMax,
|
const SelectMgr_Vec3& theBoxMax,
|
||||||
Standard_Boolean* theInside = NULL) Standard_OVERRIDE;
|
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const Handle(TColgp_HArray1OfPnt)& theArrayOfPts,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks if line segment overlaps selecting frustum
|
//! Checks if line segment overlaps selecting frustum
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle. The test may
|
//! SAT intersection test between defined volume and given triangle. The test may
|
||||||
//! be considered of interior part or boundary line defined by triangle vertices
|
//! be considered of interior part or boundary line defined by triangle vertices
|
||||||
@@ -147,12 +147,12 @@ public:
|
|||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
Standard_Integer theSensType,
|
Standard_Integer theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
|
||||||
//! Measures distance between 3d projection of user-picked
|
//! Measures distance between 3d projection of user-picked
|
||||||
//! screen point and given point theCOG
|
//! screen point and given point theCOG
|
||||||
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth.
|
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth.
|
||||||
//! Throws exception if active selection type is not Point.
|
//! Throws exception if active selection type is not Point.
|
||||||
@@ -161,7 +161,7 @@ public:
|
|||||||
//! Checks if the point of sensitive in which selection was detected belongs
|
//! Checks if the point of sensitive in which selection was detected belongs
|
||||||
//! to the region defined by clipping planes
|
//! to the region defined by clipping planes
|
||||||
Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
Standard_EXPORT virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||||
const Standard_Real& theDepth);
|
const Standard_Real& theDepth) const;
|
||||||
|
|
||||||
//! Is used for rectangular selection only
|
//! Is used for rectangular selection only
|
||||||
//! If theIsToAllow is false, only fully included sensitives will be detected, otherwise the algorithm will
|
//! If theIsToAllow is false, only fully included sensitives will be detected, otherwise the algorithm will
|
||||||
|
@@ -169,7 +169,7 @@ Handle(SelectMgr_BaseFrustum) SelectMgr_TriangularFrustum::ScaleAndTransform (co
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& theMinPt,
|
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& theMinPt,
|
||||||
const SelectMgr_Vec3& theMaxPt,
|
const SelectMgr_Vec3& theMaxPt,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& /*thePickResult*/) const
|
||||||
{
|
{
|
||||||
return hasOverlap (theMinPt, theMaxPt);
|
return hasOverlap (theMinPt, theMaxPt);
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& th
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& theMinPt,
|
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& theMinPt,
|
||||||
const SelectMgr_Vec3& theMaxPt,
|
const SelectMgr_Vec3& theMaxPt,
|
||||||
Standard_Boolean* /*theInside*/)
|
Standard_Boolean* /*theInside*/) const
|
||||||
{
|
{
|
||||||
return hasOverlap (theMinPt, theMaxPt, NULL);
|
return hasOverlap (theMinPt, theMaxPt, NULL);
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const SelectMgr_Vec3& th
|
|||||||
// purpose : Intersection test between defined volume and given point
|
// purpose : Intersection test between defined volume and given point
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt,
|
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& /*thePickResult*/) const
|
||||||
{
|
{
|
||||||
return hasOverlap (thePnt);
|
return hasOverlap (thePnt);
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& /*thePickResult*/) const
|
||||||
{
|
{
|
||||||
if (theSensType == Select3D_TOS_BOUNDARY)
|
if (theSensType == Select3D_TOS_BOUNDARY)
|
||||||
{
|
{
|
||||||
@@ -237,7 +237,7 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const TColgp_Array1OfPnt
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& /*theDepth*/)
|
SelectBasics_PickResult& /*thePickResult*/) const
|
||||||
{
|
{
|
||||||
return hasOverlap (thePnt1, thePnt2);
|
return hasOverlap (thePnt1, thePnt2);
|
||||||
}
|
}
|
||||||
@@ -253,13 +253,13 @@ Standard_Boolean SelectMgr_TriangularFrustum::Overlaps (const gp_Pnt& thePnt1,
|
|||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
if (theSensType == Select3D_TOS_BOUNDARY)
|
if (theSensType == Select3D_TOS_BOUNDARY)
|
||||||
{
|
{
|
||||||
const gp_Pnt aPntsArrayBuf[3] = { thePnt1, thePnt2, thePnt3 };
|
const gp_Pnt aPntsArrayBuf[3] = { thePnt1, thePnt2, thePnt3 };
|
||||||
const TColgp_Array1OfPnt aPntsArray (aPntsArrayBuf[0], 1, 3);
|
const TColgp_Array1OfPnt aPntsArray (aPntsArrayBuf[0], 1, 3);
|
||||||
return Overlaps (aPntsArray, Select3D_TOS_BOUNDARY, theDepth);
|
return Overlaps (aPntsArray, Select3D_TOS_BOUNDARY, thePickResult);
|
||||||
}
|
}
|
||||||
else if (theSensType == Select3D_TOS_INTERIOR)
|
else if (theSensType == Select3D_TOS_INTERIOR)
|
||||||
{
|
{
|
||||||
|
@@ -48,29 +48,29 @@ public:
|
|||||||
//! SAT intersection test between defined volume and given axis-aligned box
|
//! SAT intersection test between defined volume and given axis-aligned box
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
|
||||||
const SelectMgr_Vec3& theMaxPnt,
|
const SelectMgr_Vec3& theMaxPnt,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
//! Returns true if selecting volume is overlapped by axis-aligned bounding box
|
||||||
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
//! with minimum corner at point theMinPt and maximum at point theMaxPt
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPt,
|
||||||
const SelectMgr_Vec3& theMaxPt,
|
const SelectMgr_Vec3& theMaxPt,
|
||||||
Standard_Boolean* theInside) Standard_OVERRIDE;
|
Standard_Boolean* theInside) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Intersection test between defined volume and given point
|
//! Intersection test between defined volume and given point
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given ordered set of points,
|
//! SAT intersection test between defined volume and given ordered set of points,
|
||||||
//! representing line segments. The test may be considered of interior part or
|
//! representing line segments. The test may be considered of interior part or
|
||||||
//! boundary line defined by segments depending on given sensitivity type
|
//! boundary line defined by segments depending on given sensitivity type
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Checks if line segment overlaps selecting frustum
|
//! Checks if line segment overlaps selecting frustum
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! SAT intersection test between defined volume and given triangle. The test may
|
//! SAT intersection test between defined volume and given triangle. The test may
|
||||||
//! be considered of interior part or boundary line defined by triangle vertices
|
//! be considered of interior part or boundary line defined by triangle vertices
|
||||||
@@ -79,7 +79,7 @@ public:
|
|||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Nullifies the handle to corresponding builder instance to prevent memory leaks
|
//! Nullifies the handle to corresponding builder instance to prevent memory leaks
|
||||||
Standard_EXPORT void Clear();
|
Standard_EXPORT void Clear();
|
||||||
|
@@ -127,11 +127,11 @@ Handle(SelectMgr_BaseFrustum) SelectMgr_TriangularFrustumSet::ScaleAndTransform
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3& theMinPnt,
|
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3& theMinPnt,
|
||||||
const SelectMgr_Vec3& theMaxPnt,
|
const SelectMgr_Vec3& theMaxPnt,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->Overlaps (theMinPnt, theMaxPnt, theDepth))
|
if (anIter.Value()->Overlaps (theMinPnt, theMaxPnt, thePickResult))
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3&
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3& theMinPnt,
|
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3& theMinPnt,
|
||||||
const SelectMgr_Vec3& theMaxPnt,
|
const SelectMgr_Vec3& theMaxPnt,
|
||||||
Standard_Boolean* /*theInside*/)
|
Standard_Boolean* /*theInside*/) const
|
||||||
{
|
{
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
@@ -160,11 +160,11 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const SelectMgr_Vec3&
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt,
|
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->Overlaps (thePnt, theDepth))
|
if (anIter.Value()->Overlaps (thePnt, thePickResult))
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,11 +177,11 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const TColgp_Array1OfPnt& theArrayOfPts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->Overlaps (theArrayOfPts, theSensType, theDepth))
|
if (anIter.Value()->Overlaps (theArrayOfPts, theSensType, thePickResult))
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,11 +194,11 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const TColgp_Array1Of
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt1,
|
Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->Overlaps (thePnt1, thePnt2, theDepth))
|
if (anIter.Value()->Overlaps (thePnt1, thePnt2, thePickResult))
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,11 +213,11 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::Overlaps (const gp_Pnt& thePnt1
|
|||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth)
|
SelectBasics_PickResult& thePickResult) const
|
||||||
{
|
{
|
||||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
if (anIter.Value()->Overlaps (thePnt1, thePnt2, thePnt3, theSensType, theDepth))
|
if (anIter.Value()->Overlaps (thePnt1, thePnt2, thePnt3, theSensType, thePickResult))
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,28 +52,28 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
|
||||||
const SelectMgr_Vec3& theMaxPnt,
|
const SelectMgr_Vec3& theMaxPnt,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
|
||||||
const SelectMgr_Vec3& theMaxPnt,
|
const SelectMgr_Vec3& theMaxPnt,
|
||||||
Standard_Boolean* theInside) Standard_OVERRIDE;
|
Standard_Boolean* theInside) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const TColgp_Array1OfPnt& theArrayOfPnts,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
Standard_EXPORT virtual Standard_Boolean Overlaps (const gp_Pnt& thePnt1,
|
||||||
const gp_Pnt& thePnt2,
|
const gp_Pnt& thePnt2,
|
||||||
const gp_Pnt& thePnt3,
|
const gp_Pnt& thePnt3,
|
||||||
Select3D_TypeOfSensitivity theSensType,
|
Select3D_TypeOfSensitivity theSensType,
|
||||||
Standard_Real& theDepth) Standard_OVERRIDE;
|
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Stores plane equation coefficients (in the following form:
|
//! Stores plane equation coefficients (in the following form:
|
||||||
//! Ax + By + Cz + D = 0) to the given vector
|
//! Ax + By + Cz + D = 0) to the given vector
|
||||||
|
@@ -35,9 +35,13 @@ public:
|
|||||||
//! e.g. TRUE means depth is clipped.
|
//! e.g. TRUE means depth is clipped.
|
||||||
Standard_Boolean IsClipped (const Standard_Real theDepth) const
|
Standard_Boolean IsClipped (const Standard_Real theDepth) const
|
||||||
{
|
{
|
||||||
for (size_t aRangeIter = 0; aRangeIter < myRanges.size(); ++aRangeIter)
|
if (myUnclipRange.IsOut (theDepth))
|
||||||
{
|
{
|
||||||
if (!myRanges[aRangeIter].IsOut (theDepth))
|
return Standard_True;
|
||||||
|
}
|
||||||
|
for (size_t aRangeIter = 0; aRangeIter < myClipRanges.size(); ++aRangeIter)
|
||||||
|
{
|
||||||
|
if (!myClipRanges[aRangeIter].IsOut (theDepth))
|
||||||
{
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
@@ -48,19 +52,20 @@ public:
|
|||||||
//! Clears clipping range.
|
//! Clears clipping range.
|
||||||
void SetVoid()
|
void SetVoid()
|
||||||
{
|
{
|
||||||
myRanges.resize (1);
|
myClipRanges.resize (0);
|
||||||
myRanges[0].SetVoid();
|
myUnclipRange = Bnd_Range (RealFirst(), RealLast());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the main range.
|
//! Returns the main unclipped range; [-inf, inf] by default.
|
||||||
Bnd_Range& ChangeMain() { return myRanges[0]; }
|
Bnd_Range& ChangeUnclipRange() { return myUnclipRange; }
|
||||||
|
|
||||||
//! Adds a sub-range.
|
//! Adds a clipping sub-range (for clipping chains).
|
||||||
void AddSubRange (const Bnd_Range& theRange) { myRanges.push_back (theRange); }
|
void AddClipSubRange (const Bnd_Range& theRange) { myClipRanges.push_back (theRange); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<Bnd_Range> myRanges;
|
std::vector<Bnd_Range> myClipRanges;
|
||||||
|
Bnd_Range myUnclipRange;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -67,6 +67,7 @@ namespace {
|
|||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SelectMgr_ViewerSelector::updatePoint3d (SelectMgr_SortCriterion& theCriterion,
|
void SelectMgr_ViewerSelector::updatePoint3d (SelectMgr_SortCriterion& theCriterion,
|
||||||
|
const SelectBasics_PickResult& thePickResult,
|
||||||
const Handle(SelectBasics_SensitiveEntity)& theEntity,
|
const Handle(SelectBasics_SensitiveEntity)& theEntity,
|
||||||
const gp_GTrsf& theInversedTrsf,
|
const gp_GTrsf& theInversedTrsf,
|
||||||
const SelectMgr_SelectingVolumeManager& theMgr) const
|
const SelectMgr_SelectingVolumeManager& theMgr) const
|
||||||
@@ -76,7 +77,15 @@ void SelectMgr_ViewerSelector::updatePoint3d (SelectMgr_SortCriterion& theCriter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
theCriterion.Point = theMgr.DetectedPoint (theCriterion.Depth);
|
if (thePickResult.HasPickedPoint())
|
||||||
|
{
|
||||||
|
theCriterion.Point = thePickResult.PickedPoint();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theCriterion.Point = theMgr.DetectedPoint (theCriterion.Depth);
|
||||||
|
}
|
||||||
|
|
||||||
gp_GTrsf anInvTrsf = theInversedTrsf;
|
gp_GTrsf anInvTrsf = theInversedTrsf;
|
||||||
if (theCriterion.Entity->HasInitLocation())
|
if (theCriterion.Entity->HasInitLocation())
|
||||||
{
|
{
|
||||||
@@ -277,7 +286,7 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
|
|||||||
{
|
{
|
||||||
if (aCriterion > *aPrevCriterion)
|
if (aCriterion > *aPrevCriterion)
|
||||||
{
|
{
|
||||||
updatePoint3d (aCriterion, theEntity, theInversedTrsf, theMgr);
|
updatePoint3d (aCriterion, aPickResult, theEntity, theInversedTrsf, theMgr);
|
||||||
*aPrevCriterion = aCriterion;
|
*aPrevCriterion = aCriterion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,7 +294,7 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
aCriterion.NbOwnerMatches = 1;
|
aCriterion.NbOwnerMatches = 1;
|
||||||
updatePoint3d (aCriterion, theEntity, theInversedTrsf, theMgr);
|
updatePoint3d (aCriterion, aPickResult, theEntity, theInversedTrsf, theMgr);
|
||||||
mystored.Add (anOwner, aCriterion);
|
mystored.Add (anOwner, aCriterion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -326,6 +326,7 @@ private: // implementation of deprecated methods
|
|||||||
|
|
||||||
//! Compute 3d position for detected entity.
|
//! Compute 3d position for detected entity.
|
||||||
void updatePoint3d (SelectMgr_SortCriterion& theCriterion,
|
void updatePoint3d (SelectMgr_SortCriterion& theCriterion,
|
||||||
|
const SelectBasics_PickResult& thePickResult,
|
||||||
const Handle(SelectBasics_SensitiveEntity)& theEntity,
|
const Handle(SelectBasics_SensitiveEntity)& theEntity,
|
||||||
const gp_GTrsf& theInversedTrsf,
|
const gp_GTrsf& theInversedTrsf,
|
||||||
const SelectMgr_SelectingVolumeManager& theMgr) const;
|
const SelectMgr_SelectingVolumeManager& theMgr) const;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1918,7 +1918,7 @@ static Standard_Integer IsShortSegment (const ShapeFix_WireSegment &seg,
|
|||||||
const Standard_Real VResolution)
|
const Standard_Real VResolution)
|
||||||
{
|
{
|
||||||
TopoDS_Vertex Vf = seg.FirstVertex();
|
TopoDS_Vertex Vf = seg.FirstVertex();
|
||||||
if ( ! Vf.IsSame ( seg.LastVertex() ) ) return Standard_False;
|
if ( ! Vf.IsSame ( seg.LastVertex() ) ) return 0;
|
||||||
|
|
||||||
gp_Pnt pnt = BRep_Tool::Pnt(Vf);
|
gp_Pnt pnt = BRep_Tool::Pnt(Vf);
|
||||||
Standard_Real tol = BRep_Tool::Tolerance(Vf);
|
Standard_Real tol = BRep_Tool::Tolerance(Vf);
|
||||||
@@ -1929,7 +1929,7 @@ static Standard_Integer IsShortSegment (const ShapeFix_WireSegment &seg,
|
|||||||
Handle(ShapeExtend_WireData) sbwd = seg.WireData();
|
Handle(ShapeExtend_WireData) sbwd = seg.WireData();
|
||||||
for ( Standard_Integer i=1; i <= sbwd->NbEdges(); i++ ) {
|
for ( Standard_Integer i=1; i <= sbwd->NbEdges(); i++ ) {
|
||||||
TopoDS_Edge edge = sbwd->Edge ( i );
|
TopoDS_Edge edge = sbwd->Edge ( i );
|
||||||
if ( ! Vf.IsSame ( sae.LastVertex ( edge ) ) ) return Standard_False;
|
if ( ! Vf.IsSame ( sae.LastVertex ( edge ) ) ) return 0;
|
||||||
Handle(Geom2d_Curve) c2d;
|
Handle(Geom2d_Curve) c2d;
|
||||||
Standard_Real f, l;
|
Standard_Real f, l;
|
||||||
if ( ! sae.PCurve ( edge, myFace, c2d, f, l ) ) continue;
|
if ( ! sae.PCurve ( edge, myFace, c2d, f, l ) ) continue;
|
||||||
|
@@ -477,11 +477,12 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
|||||||
}
|
}
|
||||||
Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
|
Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
|
||||||
Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
|
Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
|
||||||
|
Standard_Boolean closed_flag = Standard_False;
|
||||||
GeomConvert::ConcatC1(tab_c3d,
|
GeomConvert::ConcatC1(tab_c3d,
|
||||||
tabtolvertex,
|
tabtolvertex,
|
||||||
ArrayOfIndices,
|
ArrayOfIndices,
|
||||||
concatcurve,
|
concatcurve,
|
||||||
Standard_False,
|
closed_flag,
|
||||||
Precision::Confusion()); //C1 concatenation
|
Precision::Confusion()); //C1 concatenation
|
||||||
|
|
||||||
if (concatcurve->Length() > 1)
|
if (concatcurve->Length() > 1)
|
||||||
@@ -523,11 +524,12 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
|
|||||||
}
|
}
|
||||||
Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves
|
Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves
|
||||||
Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex
|
Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex
|
||||||
|
closed_flag = Standard_False;
|
||||||
Geom2dConvert::ConcatC1(tab_c2d,
|
Geom2dConvert::ConcatC1(tab_c2d,
|
||||||
tabtolvertex,
|
tabtolvertex,
|
||||||
ArrayOfInd2d,
|
ArrayOfInd2d,
|
||||||
concatc2d,
|
concatc2d,
|
||||||
Standard_False,
|
closed_flag,
|
||||||
Precision::Confusion()); //C1 concatenation
|
Precision::Confusion()); //C1 concatenation
|
||||||
|
|
||||||
if (concatc2d->Length() > 1)
|
if (concatc2d->Length() > 1)
|
||||||
|
@@ -222,24 +222,29 @@ Standard_Boolean StepToTopoDS_GeometricTool::IsLikeSeam
|
|||||||
// This situation occurs when an edge crosses the parametric origin.
|
// This situation occurs when an edge crosses the parametric origin.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d(
|
||||||
(const Handle(Geom_Curve)& theCurve, Standard_Real& w1, Standard_Real& w2,
|
const Handle(Geom_Curve)& theCurve,
|
||||||
const Standard_Real preci)
|
Standard_Real& w1,
|
||||||
|
Standard_Real& w2,
|
||||||
|
const Standard_Real preci)
|
||||||
{
|
{
|
||||||
// w1 et/ou w2 peuvent etre en dehors des bornes naturelles de la courbe.
|
// w1 et/ou w2 peuvent etre en dehors des bornes naturelles de la courbe.
|
||||||
// On donnera alors la valeur en bout a w1 et/ou w2
|
// On donnera alors la valeur en bout a w1 et/ou w2
|
||||||
|
|
||||||
Standard_Real cf = theCurve->FirstParameter();
|
Standard_Real cf = theCurve->FirstParameter();
|
||||||
Standard_Real cl = theCurve->LastParameter();
|
Standard_Real cl = theCurve->LastParameter();
|
||||||
|
|
||||||
if (theCurve->IsKind(STANDARD_TYPE(Geom_BoundedCurve)) && !theCurve->IsClosed()) {
|
if (theCurve->IsKind(STANDARD_TYPE(Geom_BoundedCurve)) && !theCurve->IsClosed())
|
||||||
if (w1 < cf) {
|
{
|
||||||
|
if (w1 < cf)
|
||||||
|
{
|
||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
cout << "Update Edge First Parameter to Curve First Parameter" << endl;
|
cout << "Update Edge First Parameter to Curve First Parameter" << endl;
|
||||||
#endif
|
#endif
|
||||||
w1 = cf;
|
w1 = cf;
|
||||||
}
|
}
|
||||||
else if (w1 > cl) {
|
else if (w1 > cl)
|
||||||
|
{
|
||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
cout << "Update Edge First Parameter to Curve Last Parameter" << endl;
|
cout << "Update Edge First Parameter to Curve Last Parameter" << endl;
|
||||||
#endif
|
#endif
|
||||||
@@ -261,26 +266,47 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
|||||||
|
|
||||||
if (w1 < w2) return Standard_True;
|
if (w1 < w2) return Standard_True;
|
||||||
|
|
||||||
if (theCurve->IsPeriodic())
|
if (theCurve->IsPeriodic())
|
||||||
ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),w1,w2); //:a7 abv 11 Feb 98: preci -> PConfusion()
|
{
|
||||||
else if (theCurve->IsClosed()) {
|
ElCLib::AdjustPeriodic(cf, cl, Precision::PConfusion(), w1, w2); //:a7 abv 11 Feb 98: preci -> PConfusion()
|
||||||
|
}
|
||||||
|
else if (theCurve->IsClosed())
|
||||||
|
{
|
||||||
// l'un des points projecte se trouve sur l'origine du parametrage
|
// l'un des points projecte se trouve sur l'origine du parametrage
|
||||||
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
|
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
|
||||||
// DANGER precision 3d applique a une espace 1d
|
// DANGER precision 3d applique a une espace 1d
|
||||||
|
|
||||||
// w2 = cf au lieu de w2 = cl
|
// w2 = cf au lieu de w2 = cl
|
||||||
if (Abs(w2 - cf) < Precision::PConfusion() /*preci*/) w2 = cl;
|
if (Abs(w2 - cf) < Precision::PConfusion() /*preci*/)
|
||||||
|
{
|
||||||
|
w2 = cl;
|
||||||
|
}
|
||||||
// w1 = cl au lieu de w1 = cf
|
// w1 = cl au lieu de w1 = cf
|
||||||
else if (Abs(w1 - cl) < Precision::PConfusion() /*preci*/) w1 = cf;
|
else if (Abs(w1 - cl) < Precision::PConfusion() /*preci*/)
|
||||||
|
{
|
||||||
|
w1 = cf;
|
||||||
|
}
|
||||||
// on se trouve dans un cas ou l origine est traversee
|
// on se trouve dans un cas ou l origine est traversee
|
||||||
// illegal sur une courbe fermee non periodique
|
// illegal sur une courbe fermee non periodique
|
||||||
// on inverse quand meme les parametres !!!!!!
|
// on inverse quand meme les parametres !!!!!!
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
//:S4136 abv 20 Apr 99: r0701_ug.stp #6230: add check in 3d
|
//:S4136 abv 20 Apr 99: r0701_ug.stp #6230: add check in 3d
|
||||||
if (theCurve->Value(w1).Distance(theCurve->Value(cf)) < preci) w1 = cf;
|
if (theCurve->Value(w1).Distance(theCurve->Value(cf)) < preci)
|
||||||
if (theCurve->Value(w2).Distance(theCurve->Value(cl)) < preci) w2 = cl;
|
{
|
||||||
if (w1 > w2) {
|
w1 = cf;
|
||||||
|
}
|
||||||
|
if (theCurve->Value(w2).Distance(theCurve->Value(cl)) < preci)
|
||||||
|
{
|
||||||
|
w2 = cl;
|
||||||
|
}
|
||||||
|
if (fabs(w2 - w1) < Precision::PConfusion())
|
||||||
|
{
|
||||||
|
w1 = cf;
|
||||||
|
w2 = cl;
|
||||||
|
}
|
||||||
|
else if (w1 > w2)
|
||||||
|
{
|
||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
|
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
|
||||||
#endif
|
#endif
|
||||||
@@ -291,48 +317,60 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The curve is closed within the 3D tolerance
|
// The curve is closed within the 3D tolerance
|
||||||
else if (theCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
else if (theCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
|
||||||
Handle(Geom_BSplineCurve) aBSpline =
|
{
|
||||||
|
Handle(Geom_BSplineCurve) aBSpline =
|
||||||
Handle(Geom_BSplineCurve)::DownCast(theCurve);
|
Handle(Geom_BSplineCurve)::DownCast(theCurve);
|
||||||
if (aBSpline->StartPoint().Distance(aBSpline->EndPoint()) <= preci ) {
|
if (aBSpline->StartPoint().Distance(aBSpline->EndPoint()) <= preci)
|
||||||
//:S4136 <= BRepAPI::Precision()) {
|
{
|
||||||
// l'un des points projecte se trouve sur l'origine du parametrage
|
//:S4136 <= BRepAPI::Precision()) {
|
||||||
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
|
// l'un des points projecte se trouve sur l'origine du parametrage
|
||||||
// DANGER precision 3d applique a une espace 1d
|
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
|
||||||
|
// DANGER precision 3d applique a une espace 1d
|
||||||
// w2 = cf au lieu de w2 = cl
|
|
||||||
if (Abs(w2 - cf) < Precision::PConfusion()) w2 = cl ;
|
|
||||||
// w1 = cl au lieu de w1 = cf
|
|
||||||
else if (Abs(w1 - cl) < Precision::PConfusion()) w1 = cf;
|
|
||||||
|
|
||||||
|
// w2 = cf au lieu de w2 = cl
|
||||||
|
if (Abs(w2 - cf) < Precision::PConfusion())
|
||||||
|
{
|
||||||
|
w2 = cl;
|
||||||
|
}
|
||||||
|
// w1 = cl au lieu de w1 = cf
|
||||||
|
else if (Abs(w1 - cl) < Precision::PConfusion())
|
||||||
|
{
|
||||||
|
w1 = cf;
|
||||||
|
}
|
||||||
// on se trouve dans un cas ou l origine est traversee
|
// on se trouve dans un cas ou l origine est traversee
|
||||||
// illegal sur une courbe fermee non periodique
|
// illegal sur une courbe fermee non periodique
|
||||||
// on inverse quand meme les parametres !!!!!!
|
// on inverse quand meme les parametres !!!!!!
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
|
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
|
||||||
#endif
|
#endif
|
||||||
Standard_Real tmp = w1;
|
Standard_Real tmp = w1;
|
||||||
w1 = w2;
|
w1 = w2;
|
||||||
w2 = tmp;
|
w2 = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//abv 15.03.00 #72 bm1_pe_t4 protection of exceptions in draw
|
//abv 15.03.00 #72 bm1_pe_t4 protection of exceptions in draw
|
||||||
else if ( w1 > w2 ) {
|
else if (w1 > w2)
|
||||||
|
{
|
||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
cout << "Warning: parameter range is bad; curve reversed" << endl;
|
cout << "Warning: parameter range is bad; curve reversed" << endl;
|
||||||
#endif
|
#endif
|
||||||
w1 = theCurve->ReversedParameter ( w1 );
|
w1 = theCurve->ReversedParameter(w1);
|
||||||
w2 = theCurve->ReversedParameter ( w2 );
|
w2 = theCurve->ReversedParameter(w2);
|
||||||
theCurve->Reverse();
|
theCurve->Reverse();
|
||||||
}
|
}
|
||||||
//:j9 abv 11 Dec 98: PRO7747 #4875, after :j8: else
|
//:j9 abv 11 Dec 98: PRO7747 #4875, after :j8: else
|
||||||
if (w1 == w2) { //gka 10.07.1998 file PRO7656 entity 33334
|
if (w1 == w2)
|
||||||
w1 = cf; w2 = cl;
|
{ //gka 10.07.1998 file PRO7656 entity 33334
|
||||||
|
w1 = cf;
|
||||||
|
w2 = cl;
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
cout << "UpdateParam3d Failed" << endl;
|
cout << "UpdateParam3d Failed" << endl;
|
||||||
cout << " - Curve Type : " << theCurve->DynamicType() << endl;
|
cout << " - Curve Type : " << theCurve->DynamicType() << endl;
|
||||||
@@ -340,16 +378,18 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
|
|||||||
cout << " - Param 2 : " << w2 << endl;
|
cout << " - Param 2 : " << w2 << endl;
|
||||||
#endif
|
#endif
|
||||||
//abv 15.03.00 #72 bm1_pe_t4 protection of exceptions in draw
|
//abv 15.03.00 #72 bm1_pe_t4 protection of exceptions in draw
|
||||||
if ( w1 > w2 ) {
|
if (w1 > w2)
|
||||||
|
{
|
||||||
#ifdef OCCT_DEBUG
|
#ifdef OCCT_DEBUG
|
||||||
cout << "Warning: parameter range is bad; curve reversed" << endl;
|
cout << "Warning: parameter range is bad; curve reversed" << endl;
|
||||||
#endif
|
#endif
|
||||||
w1 = theCurve->ReversedParameter ( w1 );
|
w1 = theCurve->ReversedParameter(w1);
|
||||||
w2 = theCurve->ReversedParameter ( w2 );
|
w2 = theCurve->ReversedParameter(w2);
|
||||||
theCurve->Reverse();
|
theCurve->Reverse();
|
||||||
}
|
}
|
||||||
//pdn 11.01.99 #144 bm1_pe_t4 protection of exceptions in draw
|
//pdn 11.01.99 #144 bm1_pe_t4 protection of exceptions in draw
|
||||||
if (w1 == w2) {
|
if (w1 == w2)
|
||||||
|
{
|
||||||
w1 -= Precision::PConfusion();
|
w1 -= Precision::PConfusion();
|
||||||
w2 += Precision::PConfusion();
|
w2 += Precision::PConfusion();
|
||||||
}
|
}
|
||||||
|
@@ -285,11 +285,12 @@ void TDataXtd_Presentation::SetMode(const Standard_Integer theMode)
|
|||||||
//function : SetSelectionMode
|
//function : SetSelectionMode
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void TDataXtd_Presentation::SetSelectionMode(const Standard_Integer theSelectionMode)
|
void TDataXtd_Presentation::SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction)
|
||||||
{
|
{
|
||||||
if (! myHasOwnSelectionMode || mySelectionMode != theSelectionMode)
|
if (! myHasOwnSelectionMode || mySelectionMode != theSelectionMode)
|
||||||
{
|
{
|
||||||
Backup();
|
if (theTransaction)
|
||||||
|
Backup();
|
||||||
mySelectionMode = theSelectionMode;
|
mySelectionMode = theSelectionMode;
|
||||||
myHasOwnSelectionMode = Standard_True;
|
myHasOwnSelectionMode = Standard_True;
|
||||||
}
|
}
|
||||||
|
@@ -114,7 +114,13 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT void SetMode(const Standard_Integer theMode);
|
Standard_EXPORT void SetMode(const Standard_Integer theMode);
|
||||||
|
|
||||||
Standard_EXPORT void SetSelectionMode(const Standard_Integer theSelectionMode);
|
//! Sets selection mode.
|
||||||
|
//! If "theTransaction" flag is OFF, modification of the attribute doesn't influence the transaction mechanism
|
||||||
|
//! (the attribute doesn't participate in undo/redo).
|
||||||
|
//! Certainly, if any other data of the attribute is modified (display mode, color, ...),
|
||||||
|
//! the attribute will be included into transaction.
|
||||||
|
//! Obsolete method (may be removed later).
|
||||||
|
Standard_EXPORT void SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
|
||||||
|
|
||||||
Standard_EXPORT Standard_Integer MaterialIndex() const;
|
Standard_EXPORT Standard_Integer MaterialIndex() const;
|
||||||
|
|
||||||
|
@@ -591,10 +591,11 @@ Standard_Boolean TPrsStd_AISPresentation::HasOwnSelectionMode() const
|
|||||||
//function : SetSelectionMode
|
//function : SetSelectionMode
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode)
|
void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction)
|
||||||
{
|
{
|
||||||
Backup();
|
if (theTransaction)
|
||||||
getData()->SetSelectionMode (theSelectionMode);
|
Backup();
|
||||||
|
getData()->SetSelectionMode (theSelectionMode, theTransaction);
|
||||||
|
|
||||||
if ( myAIS.IsNull() )
|
if ( myAIS.IsNull() )
|
||||||
AISUpdate();
|
AISUpdate();
|
||||||
|
@@ -157,8 +157,14 @@ public:
|
|||||||
Standard_EXPORT void UnsetMode();
|
Standard_EXPORT void UnsetMode();
|
||||||
|
|
||||||
Standard_EXPORT Standard_Integer SelectionMode() const;
|
Standard_EXPORT Standard_Integer SelectionMode() const;
|
||||||
|
|
||||||
Standard_EXPORT void SetSelectionMode (const Standard_Integer theSelectionMode);
|
//! Sets selection mode.
|
||||||
|
//! If "theTransaction" flag is OFF, modification of the attribute doesn't influence the transaction mechanism
|
||||||
|
//! (the attribute doesn't participate in undo/redo).
|
||||||
|
//! Certainly, if any other data of the attribute is modified (display mode, color, ...),
|
||||||
|
//! the attribute will be included into transaction.
|
||||||
|
//! Obsolete method (may be removed later).
|
||||||
|
Standard_EXPORT void SetSelectionMode (const Standard_Integer theSelectionMode, const Standard_Boolean theTransaction = Standard_True);
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const;
|
Standard_EXPORT Standard_Boolean HasOwnSelectionMode() const;
|
||||||
|
|
||||||
|
@@ -805,17 +805,21 @@ public:
|
|||||||
//! grid in <me>
|
//! grid in <me>
|
||||||
Standard_EXPORT void SetGridActivity (const Standard_Boolean aFlag);
|
Standard_EXPORT void SetGridActivity (const Standard_Boolean aFlag);
|
||||||
|
|
||||||
//! dump the full contents of the view at the same
|
//! Dumps the full contents of the View into the image file. This is an alias for ToPixMap() with Image_AlienPixMap.
|
||||||
//! scale in the file <theFile>. The file name
|
//! @param theFile destination image file (image format is determined by file extension like .png, .bmp, .jpg)
|
||||||
//! extension must be one of ".png",".bmp",".jpg",".gif".
|
//! @param theBufferType buffer to dump
|
||||||
//! Returns FALSE when the dump has failed
|
//! @return FALSE when the dump has failed
|
||||||
Standard_EXPORT Standard_Boolean Dump (const Standard_CString theFile, const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB);
|
Standard_EXPORT Standard_Boolean Dump (const Standard_CString theFile, const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB);
|
||||||
|
|
||||||
//! Dumps the full contents of the view to a pixmap with specified parameters.
|
//! Dumps the full contents of the view to a pixmap with specified parameters.
|
||||||
|
//! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
|
||||||
|
//! so that there is no need resizing a window control for making a dump of different size.
|
||||||
Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap& theImage,
|
Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap& theImage,
|
||||||
const V3d_ImageDumpOptions& theParams);
|
const V3d_ImageDumpOptions& theParams);
|
||||||
|
|
||||||
//! Dumps the full contents of the view to a pixmap.
|
//! Dumps the full contents of the view to a pixmap.
|
||||||
|
//! Internally this method calls Redraw() with an offscreen render buffer of requested target size (theWidth x theHeight),
|
||||||
|
//! so that there is no need resizing a window control for making a dump of different size.
|
||||||
//! @param theImage target image, will be re-allocated to match theWidth x theHeight
|
//! @param theImage target image, will be re-allocated to match theWidth x theHeight
|
||||||
//! @param theWidth target image width
|
//! @param theWidth target image width
|
||||||
//! @param theHeight target image height
|
//! @param theHeight target image height
|
||||||
|
@@ -3445,20 +3445,12 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char*
|
|||||||
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
|
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
|
||||||
if (aContextAIS.IsNull())
|
if (aContextAIS.IsNull())
|
||||||
{
|
{
|
||||||
di << "Call vinit before!\n";
|
std::cout << "Error: no active Viewer\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (argc < 3)
|
else if (argc < 3)
|
||||||
{
|
{
|
||||||
di << "Use: " << argv[0] << " Name TypeOfArray"
|
std::cout << "Syntax error: wrong number of arguments\n";
|
||||||
<< " [vertex] ... [bounds] ... [edges]\n"
|
|
||||||
<< " TypeOfArray={ points | segments | polylines | triangles |\n"
|
|
||||||
<< " trianglefans | trianglestrips | quads |\n"
|
|
||||||
<< " quadstrips | polygons }\n"
|
|
||||||
<< " vertex={ 'v' x y z [normal={ 'n' nx ny nz }] [color={ 'c' r g b }]"
|
|
||||||
<< " [texel={ 't' tx ty }] } \n"
|
|
||||||
<< " bounds={ 'b' verticies_count [color={ 'c' r g b }] }\n"
|
|
||||||
<< " edges={ 'e' vertex_id }\n";
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3466,6 +3458,26 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char*
|
|||||||
Standard_Integer aArgIndex = 1;
|
Standard_Integer aArgIndex = 1;
|
||||||
TCollection_AsciiString aName (argv[aArgIndex++]);
|
TCollection_AsciiString aName (argv[aArgIndex++]);
|
||||||
TCollection_AsciiString anArrayType (argv[aArgIndex++]);
|
TCollection_AsciiString anArrayType (argv[aArgIndex++]);
|
||||||
|
if (anArrayType == "-shape")
|
||||||
|
{
|
||||||
|
Standard_CString aShapeName = argv[aArgIndex++];
|
||||||
|
TopoDS_Shape aShape = DBRep::Get (aShapeName);
|
||||||
|
Handle(Graphic3d_ArrayOfPrimitives) aTris = StdPrs_ShadedShape::FillTriangles (aShape);
|
||||||
|
if (aShape.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "Syntax error: shape '" << aShapeName << "' is not found\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (aTris.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "Syntax error: shape '" << aShapeName << "' is not triangulated\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(MyPArrayObject) aPObject = new MyPArrayObject (aTris);
|
||||||
|
ViewerTest::Display (aName, aPObject);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Boolean hasVertex = Standard_False;
|
Standard_Boolean hasVertex = Standard_False;
|
||||||
|
|
||||||
@@ -6306,7 +6318,14 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
|
|||||||
__FILE__, VComputeHLR, group);
|
__FILE__, VComputeHLR, group);
|
||||||
|
|
||||||
theCommands.Add("vdrawparray",
|
theCommands.Add("vdrawparray",
|
||||||
"vdrawparray : vdrawparray Name TypeOfArray [vertex = { 'v' x y z [vertex_normal = { 'n' x y z }] [vertex_color = { 'c' r g b }] ] ... [bound = { 'b' vertex_count [bound_color = { 'c' r g b }] ] ... [edge = { 'e' vertex_id ]",
|
"vdrawparray name TypeOfArray={points|segments|polylines|triangles"
|
||||||
|
"\n\t\t: |trianglefans|trianglestrips|quads|quadstrips|polygons}"
|
||||||
|
"\n\t\t: [vertex={'v' x y z [normal={'n' nx ny nz}] [color={'c' r g b}] [texel={'t' tx ty}]]"
|
||||||
|
"\n\t\t: [bound= {'b' nbVertices [bound_color={'c' r g b}]]"
|
||||||
|
"\n\t\t: [edge= {'e' vertexId]"
|
||||||
|
"\n\t\t: [-shape shapeName]"
|
||||||
|
"\n\t\t: Commands create an Interactive Object for specified Primitive Array definition (Graphic3d_ArrayOfPrimitives)"
|
||||||
|
"\n\t\t: with the main purpose is covering various combinations by tests",
|
||||||
__FILE__,VDrawPArray,group);
|
__FILE__,VDrawPArray,group);
|
||||||
|
|
||||||
theCommands.Add("vconnect",
|
theCommands.Add("vconnect",
|
||||||
|
@@ -321,6 +321,14 @@ inline gp_Mat gp_Mat::Subtracted (const gp_Mat& Other) const
|
|||||||
return NewMat;
|
return NewMat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On macOS 10.13.6 with XCode 9.4.1 the compiler has a bug leading to
|
||||||
|
// generation of invalid code when method gp_Mat::Transpose() is called
|
||||||
|
// for a matrix which is when applied to vector; it looks like vector
|
||||||
|
// is transformed before the matrix is actually transposed; see #29978.
|
||||||
|
// To avoid this, we disable compiler optimization here.
|
||||||
|
#if defined(__APPLE__) && (__apple_build_version__ > 9020000)
|
||||||
|
__attribute__((optnone))
|
||||||
|
#endif
|
||||||
inline void gp_Mat::Transpose ()
|
inline void gp_Mat::Transpose ()
|
||||||
{
|
{
|
||||||
Standard_Real Temp;
|
Standard_Real Temp;
|
||||||
|
@@ -157,11 +157,10 @@ void gp_Trsf::SetTransformation (const gp_Ax3& FromA1,
|
|||||||
shape = gp_CompoundTrsf;
|
shape = gp_CompoundTrsf;
|
||||||
scale = 1.0;
|
scale = 1.0;
|
||||||
// matrix from XOY ToA2 :
|
// matrix from XOY ToA2 :
|
||||||
matrix.SetCol (1, ToA2.XDirection().XYZ());
|
matrix.SetRows (ToA2.XDirection().XYZ(),
|
||||||
matrix.SetCol (2, ToA2.YDirection().XYZ());
|
ToA2.YDirection().XYZ(),
|
||||||
matrix.SetCol (3, ToA2.Direction().XYZ());
|
ToA2. Direction().XYZ());
|
||||||
loc = ToA2.Location().XYZ();
|
loc = ToA2.Location().XYZ();
|
||||||
matrix.Transpose();
|
|
||||||
loc.Multiply (matrix);
|
loc.Multiply (matrix);
|
||||||
loc.Reverse ();
|
loc.Reverse ();
|
||||||
|
|
||||||
@@ -183,11 +182,10 @@ void gp_Trsf::SetTransformation (const gp_Ax3& A3)
|
|||||||
{
|
{
|
||||||
shape = gp_CompoundTrsf;
|
shape = gp_CompoundTrsf;
|
||||||
scale = 1.0;
|
scale = 1.0;
|
||||||
loc = A3.Location().XYZ();
|
matrix.SetRows (A3.XDirection().XYZ(),
|
||||||
matrix.SetCols (A3.XDirection().XYZ(),
|
|
||||||
A3.YDirection().XYZ(),
|
A3.YDirection().XYZ(),
|
||||||
A3. Direction().XYZ());
|
A3. Direction().XYZ());
|
||||||
matrix.Transpose();
|
loc = A3.Location().XYZ();
|
||||||
loc.Multiply (matrix);
|
loc.Multiply (matrix);
|
||||||
loc.Reverse ();
|
loc.Reverse ();
|
||||||
}
|
}
|
||||||
@@ -403,16 +401,12 @@ void gp_Trsf::Invert()
|
|||||||
if (shape == gp_Identity) { }
|
if (shape == gp_Identity) { }
|
||||||
else if (shape == gp_Translation || shape == gp_PntMirror) loc.Reverse();
|
else if (shape == gp_Translation || shape == gp_PntMirror) loc.Reverse();
|
||||||
else if (shape == gp_Scale) {
|
else if (shape == gp_Scale) {
|
||||||
Standard_Real As = scale;
|
Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||||
if (As < 0) As = - As;
|
|
||||||
Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
|
||||||
scale = 1.0 / scale;
|
scale = 1.0 / scale;
|
||||||
loc.Multiply (-scale);
|
loc.Multiply (-scale);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Standard_Real As = scale;
|
Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||||
if (As < 0) As = - As;
|
|
||||||
Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
|
||||||
scale = 1.0 / scale;
|
scale = 1.0 / scale;
|
||||||
matrix.Transpose ();
|
matrix.Transpose ();
|
||||||
loc.Multiply (matrix);
|
loc.Multiply (matrix);
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
puts "TODO OCC12345 ALL: OCC1919 Error : Italian locale not seted"
|
|
||||||
puts "TODO OCC12345 ALL: OCC1919 Error"
|
puts "TODO OCC12345 ALL: OCC1919 Error"
|
||||||
|
|
||||||
puts "================"
|
puts "================"
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
puts "TODO OCC28694 ALL: ERROR: OCC28694 is reproduced."
|
|
||||||
|
|
||||||
puts "========"
|
puts "========"
|
||||||
puts "OCC28694"
|
puts "OCC28694"
|
||||||
puts "========"
|
puts "========"
|
||||||
|
@@ -1,13 +1,7 @@
|
|||||||
pload QAcommands
|
|
||||||
|
|
||||||
puts "================"
|
puts "================"
|
||||||
puts "OCC251"
|
puts "OCC251: Section of two faces f1 and f2 depends on order of arguments: section r1 f1 f2 and section r2 f2 f1 give different results, one of result is invalid - overlapped edges."
|
||||||
puts "================"
|
puts "================"
|
||||||
puts ""
|
puts ""
|
||||||
###########################################################
|
|
||||||
## Section of two faces f1 and f2 depends on order of arguments: section r1 f1 f2 and
|
|
||||||
## section r2 f2 f1 give different results, one of result is invalid - overlapped edges.
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
restore [locate_data_file OCC251.brep] f
|
restore [locate_data_file OCC251.brep] f
|
||||||
explode f
|
explode f
|
||||||
@@ -17,19 +11,27 @@ checkshape f_2
|
|||||||
bsection result f_1 f_2
|
bsection result f_1 f_2
|
||||||
explode result
|
explode result
|
||||||
|
|
||||||
set status [OCC333 result_1 result_2]
|
foreach a [explode result e] {
|
||||||
if {[llength ${status}] < 1} {
|
foreach b [explode result e] {
|
||||||
puts "OCC251 ERROR"
|
if { ![regexp {not} [compare b_1 n_1]] } {
|
||||||
} else {
|
continue;
|
||||||
regexp {([-0-9.+eE]+)} $status full code
|
|
||||||
if { ${code} == 3 || ${code} == 2} {
|
|
||||||
puts "OCC251 OK (case 1) : Section command works properly"
|
|
||||||
} else {
|
|
||||||
puts "Faulty OCC251 (case 1): Section was made WRONGLY"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set coe [checkoverlapedges e1 e2 5.0e-5]
|
||||||
|
|
||||||
|
puts "$a <-> $b: $coe"
|
||||||
|
if { [regexp "Edges is not overlaped" $coe] != 1 } {
|
||||||
|
puts "Error: $a and $b are overlaped"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkprops result -l 1.
|
checkprops result -l 1.
|
||||||
checkshape result
|
checkshape result
|
||||||
checksection result
|
checksection result -r 2
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
||||||
|
smallview
|
||||||
|
don result*
|
||||||
|
fit
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
||||||
|
@@ -1,13 +1,7 @@
|
|||||||
pload QAcommands
|
|
||||||
|
|
||||||
puts "================"
|
puts "================"
|
||||||
puts "OCC251"
|
puts "OCC251: Section of two faces f1 and f2 depends on order of arguments: section r1 f1 f2 and section r2 f2 f1 give different results, one of result is invalid - overlapped edges."
|
||||||
puts "================"
|
puts "================"
|
||||||
puts ""
|
puts ""
|
||||||
###########################################################
|
|
||||||
## Section of two faces f1 and f2 depends on order of arguments: section r1 f1 f2 and
|
|
||||||
## section r2 f2 f1 give different results, one of result is invalid - overlapped edges.
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
restore [locate_data_file OCC251.brep] f
|
restore [locate_data_file OCC251.brep] f
|
||||||
explode f
|
explode f
|
||||||
@@ -17,19 +11,27 @@ checkshape f_2
|
|||||||
bsection result f_2 f_1
|
bsection result f_2 f_1
|
||||||
explode result
|
explode result
|
||||||
|
|
||||||
set status [OCC333 result_1 result_2]
|
foreach a [explode result e] {
|
||||||
if {[llength ${status}] < 1} {
|
foreach b [explode result e] {
|
||||||
puts "OCC251 ERROR"
|
if { ![regexp {not} [compare b_1 n_1]] } {
|
||||||
} else {
|
continue;
|
||||||
regexp {([-0-9.+eE]+)} $status full code
|
|
||||||
if { ${code} == 3 || ${code} == 2 } {
|
|
||||||
puts "OCC251 OK (case 2) : Section command works properly"
|
|
||||||
} else {
|
|
||||||
puts "Faulty OCC251 (case 2): Section was made WRONGLY"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set coe [checkoverlapedges e1 e2 5.0e-5]
|
||||||
|
|
||||||
|
puts "$a <-> $b: $coe"
|
||||||
|
if { [regexp "Edges is not overlaped" $coe] != 1 } {
|
||||||
|
puts "Error: $a and $b are overlaped"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkprops result -l 1.
|
checkprops result -l 1.
|
||||||
checkshape result
|
checkshape result
|
||||||
checksection result
|
checksection result -r 2
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
||||||
|
smallview
|
||||||
|
don result*
|
||||||
|
fit
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
||||||
|
@@ -1,31 +1,32 @@
|
|||||||
|
puts "========================"
|
||||||
|
puts " OCC600: Result of BOPCOMMON operation is unclosed shape inspite of source solids are valid"
|
||||||
|
puts "========================"
|
||||||
|
|
||||||
|
cpulimit 200
|
||||||
|
|
||||||
puts "========================"
|
|
||||||
puts " OCC600"
|
|
||||||
puts "========================"
|
|
||||||
## Result of BOPCOMMON operation is unclosed shape inspite of source solids are valid
|
|
||||||
############################################################
|
|
||||||
cpulimit 5000
|
|
||||||
restore [locate_data_file OCC600_1.brep] a
|
restore [locate_data_file OCC600_1.brep] a
|
||||||
checkshape a
|
checkshape a
|
||||||
restore [locate_data_file OCC600_2.brep] b
|
restore [locate_data_file OCC600_2.brep] b
|
||||||
checkshape b
|
checkshape b
|
||||||
bop b a
|
bop b a
|
||||||
|
|
||||||
bopcommon result
|
bopsection rs
|
||||||
|
checksection rs -r 0
|
||||||
|
checkprops rs -l 1439.11
|
||||||
|
|
||||||
set square 41970.8
|
bopcommon result
|
||||||
|
|
||||||
set nbshapes_expected "
|
set nbshapes_expected "
|
||||||
Number of shapes in shape
|
Number of shapes in shape
|
||||||
VERTEX : 55
|
VERTEX : 55
|
||||||
EDGE : 93
|
EDGE : 93
|
||||||
WIRE : 40
|
WIRE : 40
|
||||||
FACE : 40
|
FACE : 40
|
||||||
SHELL : 1
|
SHELL : 1
|
||||||
SOLID : 1
|
SOLID : 1
|
||||||
COMPSOLID : 0
|
COMPSOLID : 0
|
||||||
COMPOUND : 1
|
COMPOUND : 1
|
||||||
SHAPE : 231
|
SHAPE : 231
|
||||||
"
|
"
|
||||||
checknbshapes result -ref ${nbshapes_expected} -t -m "Result of Boolean operations"
|
checknbshapes result -ref ${nbshapes_expected} -t -m "Result of Boolean operations"
|
||||||
|
|
||||||
|
34
tests/bugs/modalg_7/bug28085_1
Normal file
34
tests/bugs/modalg_7/bug28085_1
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC28085: Incorrect result of CUT operation"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
# enable FPE signals
|
||||||
|
dsetsignal 1
|
||||||
|
|
||||||
|
restore [locate_data_file bug28085_object.brep] b1
|
||||||
|
restore [locate_data_file bug28085_tool.brep] b2
|
||||||
|
|
||||||
|
bclearobjects
|
||||||
|
bcleartools
|
||||||
|
baddobjects b1
|
||||||
|
baddtools b2
|
||||||
|
bfillds
|
||||||
|
|
||||||
|
bbop rs 4
|
||||||
|
|
||||||
|
checkprops rs -l 456.152
|
||||||
|
checkmaxtol rs -ref 2.3840014382159325e-005
|
||||||
|
checksection rs -r 8
|
||||||
|
|
||||||
|
bbop result 2
|
||||||
|
|
||||||
|
checkprops result -s 6168.4 -v 10554.5
|
||||||
|
checknbshapes result -face 22 -shell 1 -solid 1
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
if {[regexp "Faulties" [bopargcheck result]]} {
|
||||||
|
puts "Error: bopargcheck has found some faulties in result"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
33
tests/bugs/modalg_7/bug28085_2
Normal file
33
tests/bugs/modalg_7/bug28085_2
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC28085: Incorrect result of CUT operation"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
foreach a [directory c_*] {unset $a}
|
||||||
|
|
||||||
|
# enable FPE signals
|
||||||
|
dsetsignal 1
|
||||||
|
|
||||||
|
restore [locate_data_file bug28883_Prism.brep] b1
|
||||||
|
restore [locate_data_file bug28883_LES_2d_shell.brep] b2
|
||||||
|
|
||||||
|
explode b1 f
|
||||||
|
explode b2 f
|
||||||
|
|
||||||
|
|
||||||
|
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} [bopcurves b1_74 b2_13 -2d] full Toler NbCurv
|
||||||
|
|
||||||
|
checkreal Tolerance $Toler 0.0 1.0e-7 0.0
|
||||||
|
|
||||||
|
if {$NbCurv != 1} {
|
||||||
|
puts "Error: Please check NbCurves for intersector"
|
||||||
|
} else {
|
||||||
|
puts "OK: good number of curves!"
|
||||||
|
checklength c_1 -l 0.036019405388914391 -eps 1.0e-3
|
||||||
|
}
|
||||||
|
|
||||||
|
don c_*
|
||||||
|
smallview; fit;
|
||||||
|
disp b1_74 b2_13
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
@@ -1,12 +1,15 @@
|
|||||||
puts "TODO OCC28119 ALL: Error: Cannot find the result of BLEND-operation. The result of BOP operation will be returned."
|
|
||||||
|
|
||||||
puts "========"
|
puts "========"
|
||||||
puts "OCC28119"
|
puts "OCC28119: Blend fails on fused identical but shifted tori"
|
||||||
puts "========"
|
puts "========"
|
||||||
puts ""
|
puts ""
|
||||||
#################################################
|
|
||||||
# Blend fails on fused identical but shifted tori
|
# Different result between Debian 7 and Debian 8.
|
||||||
#################################################
|
puts "TODO ?OCC28119 ALL: Error: Cannot find the result of BLEND-operation. The result of BOP operation will be returned."
|
||||||
|
puts "TODO ?OCC29910 ALL: exception"
|
||||||
|
puts "TODO ?OCC29910 ALL: Exception"
|
||||||
|
puts "TODO ?OCC29910 ALL: Error: Exception in bfuseblend operation"
|
||||||
|
|
||||||
|
cpulimit 200
|
||||||
|
|
||||||
# identical secondary radi
|
# identical secondary radi
|
||||||
|
|
||||||
@@ -14,7 +17,9 @@ ptorus t1 100 10
|
|||||||
ptorus t2 100 10
|
ptorus t2 100 10
|
||||||
ttranslate t2 100 0 0
|
ttranslate t2 100 0 0
|
||||||
|
|
||||||
bfuseblend result t1 t2 5
|
if { [ catch { bfuseblend result t1 t2 5 } catch_result ] } {
|
||||||
|
puts "Error: Exception in bfuseblend operation."
|
||||||
|
}
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png
|
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png
|
||||||
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
|
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
|
||||||
|
@@ -16,9 +16,12 @@ don f
|
|||||||
fit
|
fit
|
||||||
|
|
||||||
# Before the fix: Exception in Debug-mode only
|
# Before the fix: Exception in Debug-mode only
|
||||||
set log [bopcurves f_1 f_2 -2d]
|
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} [bopcurves f_1 f_2 -2d] full Toler NbCurv
|
||||||
|
|
||||||
|
checkreal Tolerance $Toler 4.601149532364662e-008 1.0e-7 0.0
|
||||||
|
|
||||||
|
if {$NbCurv != 1} {
|
||||||
|
puts "Error: Please check NbCurves for intersector"
|
||||||
|
}
|
||||||
|
|
||||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
||||||
|
|
||||||
regexp {Tolerance Reached=+([-0-9.+eE]+)} ${log} full Toler
|
|
||||||
checkreal TolReached $Toler 4.60347250530349e-008 0.0 0.1
|
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ bsection result b1 b2
|
|||||||
checkshape result
|
checkshape result
|
||||||
checksection result
|
checksection result
|
||||||
|
|
||||||
checknbshapes result -edge 133 -vertex 134
|
checknbshapes result -edge 132 -vertex 133
|
||||||
checkprops result -l 2.20769
|
checkprops result -l 2.20769
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
14
tests/bugs/modalg_7/bug29573
Normal file
14
tests/bugs/modalg_7/bug29573
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "0029573: ConcatenateWireC0 crashes on two edges wire"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
restore [locate_data_file bug29573.brep] w
|
||||||
|
|
||||||
|
explode w
|
||||||
|
|
||||||
|
concatC0wire r1 w_1
|
||||||
|
checknbshapes r1 -vertex 2 -edge 1
|
||||||
|
|
||||||
|
concatC0wire r2 w_2
|
||||||
|
checknbshapes r2 -vertex 2 -edge 1
|
46
tests/bugs/modalg_7/bug29910_1
Normal file
46
tests/bugs/modalg_7/bug29910_1
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC29910: Porting to Debian80-64 : Regressions in Modeling Algorithms"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
# Different result between Debian 7 and Debian 8.
|
||||||
|
puts "TODO ?OCC29910 Linux: Error : is WRONG because number of EDGE entities in shape \"rs\" is 16"
|
||||||
|
puts "TODO ?OCC29910 Linux: Error : is WRONG because number of SHELL entities in shape \"result\" is 5"
|
||||||
|
puts "TODO ?OCC29910 Linux: Error : is WRONG because number of SOLID entities in shape \"result\" is 5"
|
||||||
|
puts "TODO ?OCC29910 Linux: Error : The area of result shape is"
|
||||||
|
puts "TODO ?OCC29910 Linux: Error : The volume of result shape is"
|
||||||
|
|
||||||
|
ptorus t1 100 10
|
||||||
|
ptorus t2 100 10
|
||||||
|
ttranslate t2 100 0 0
|
||||||
|
axo; fit
|
||||||
|
bclearobjects
|
||||||
|
bcleartools
|
||||||
|
baddobjects t1
|
||||||
|
baddtools t2
|
||||||
|
bfillds
|
||||||
|
bbop rs 4
|
||||||
|
|
||||||
|
checksection rs -r 0
|
||||||
|
|
||||||
|
checkshape rs
|
||||||
|
|
||||||
|
if {[regexp "Faulties" [bopargcheck rs]]} {
|
||||||
|
puts "Error: bopargcheck has found some faulties in result"
|
||||||
|
}
|
||||||
|
|
||||||
|
checkmaxtol rs -ref 7.5e-6
|
||||||
|
checknbshapes rs -edge 14
|
||||||
|
checkprops rs -l 330.096
|
||||||
|
|
||||||
|
bbuild result
|
||||||
|
|
||||||
|
checknbshapes result -shell 6 -solid 6
|
||||||
|
checkshape result
|
||||||
|
checkprops result -v 382445 -s 82663
|
||||||
|
|
||||||
|
smallview
|
||||||
|
don result
|
||||||
|
fit
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
37
tests/bugs/modalg_7/bug29910_2
Normal file
37
tests/bugs/modalg_7/bug29910_2
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC29910: Porting to Debian80-64 : Regressions in Modeling Algorithms"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
# Different result between Debian 7 and Debian 8 and between MSVC 2010 and 2017.
|
||||||
|
puts "TODO ?OCC29910 Windows: Error: Tolerance = 4.0169383828521568e-006 is not equal to expected"
|
||||||
|
puts "TODO ?OCC29910 Linux: Error: Tolerance = 6.0392296447644325e-07 is not equal to expected"
|
||||||
|
puts "TODO ?OCC29910 ALL: Error : is WRONG because number of VERTEX entities in shape \"result\" is 7"
|
||||||
|
puts "TODO ?OCC29910 ALL: Error : is WRONG because number of EDGE entities in shape \"result\" is 5"
|
||||||
|
|
||||||
|
restore [locate_data_file bug29910_f1.brep] f1
|
||||||
|
restore [locate_data_file bug29910_f2.brep] f2
|
||||||
|
|
||||||
|
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} [bopcurves f1 f2 -2d] full Toler NbCurv
|
||||||
|
|
||||||
|
checkreal Tolerance $Toler 1.0e-7 1.0e-7 0.0
|
||||||
|
|
||||||
|
if {$NbCurv != 4} {
|
||||||
|
puts "Error: Please check NbCurves for intersector"
|
||||||
|
}
|
||||||
|
|
||||||
|
bsection result f1 f2
|
||||||
|
checksection result -r 4
|
||||||
|
checkshape result
|
||||||
|
checknbshapes result -edge 4 -vertex 6
|
||||||
|
checkprops result -l 97.2011
|
||||||
|
|
||||||
|
if {[regexp "Faulties" [bopargcheck result]]} {
|
||||||
|
puts "Error: bopargcheck has found some faulties in result"
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
don result
|
||||||
|
fit
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
63
tests/bugs/modalg_7/bug29994
Normal file
63
tests/bugs/modalg_7/bug29994
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "0029994: Misprint in IntWalk_PWalking::Perform(...) method"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
foreach a [directory res*] {unset $a}
|
||||||
|
|
||||||
|
torus s1 185.793144150183 -13 70.9931441501827 0 -1 0 0 0 -1 27.0094480547676 0.25
|
||||||
|
restore [locate_data_file bug29994_s2.draw] s2
|
||||||
|
|
||||||
|
intersect res s1 s2 1.0e-4
|
||||||
|
|
||||||
|
if { [info exists res] } {
|
||||||
|
#Only variable "res" exists
|
||||||
|
renamevar res res_1
|
||||||
|
}
|
||||||
|
|
||||||
|
bclearobjects
|
||||||
|
bcleartools
|
||||||
|
|
||||||
|
set ic 1
|
||||||
|
set AllowRepeat 1
|
||||||
|
while { $AllowRepeat != 0 } {
|
||||||
|
if { ![info exists res_$ic] } {
|
||||||
|
set AllowRepeat 0
|
||||||
|
} else {
|
||||||
|
bounds res_$ic U1 U2
|
||||||
|
|
||||||
|
if {[dval U2-U1] < 1.0e-9} {
|
||||||
|
puts "Error: Wrong curve's range!"
|
||||||
|
}
|
||||||
|
|
||||||
|
xdistcs res_$ic s1 U1 U2 100 2.0e-7
|
||||||
|
xdistcs res_$ic s2 U1 U2 100 2.0e-7
|
||||||
|
|
||||||
|
mkedge ee res_$ic
|
||||||
|
baddobjects ee
|
||||||
|
incr ic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
incr ic -1
|
||||||
|
|
||||||
|
if { $ic == 1 } {
|
||||||
|
puts "OK: good number of curves!"
|
||||||
|
checklength res_1 -l 0.70541045554962345 -eps 1.0e-3
|
||||||
|
} else {
|
||||||
|
puts "Error: Incorrect number of curves in intersection result!"
|
||||||
|
bfillds
|
||||||
|
bbuild result
|
||||||
|
|
||||||
|
# Check gaps between edges in result
|
||||||
|
checksection result -r 2
|
||||||
|
checkmaxtol result -min_tol 2.0e-7
|
||||||
|
checknbshapes result -edge 1 -vertex 2
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
don res_*
|
||||||
|
fit
|
||||||
|
disp s1 s2
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
@@ -1,38 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
puts "TODO CR30010 All: Error : The area of result shape is"
|
|
||||||
puts "TODO CR30010 All: Error : is WRONG because number of"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_28_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_28_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -shell 1 -solid 1
|
|
||||||
checkprops result -s 176281 -v 1.47407e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,36 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_31_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_31_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -wire 44 -face 44 -shell 1 -solid 1
|
|
||||||
checkprops result -s 153019 -v 1.16027e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,40 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
puts "TODO CR30010 All: Error : is WRONG because number of"
|
|
||||||
puts "TODO CR30010 All: Warning: Building 2D curve of edge on face has failed"
|
|
||||||
puts "TODO CR30010 All: Error: Meshing not done"
|
|
||||||
puts "TODO CR30010 All: Error : The area of result shape is"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_32_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_32_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -wire 49 -face 49 -shell 1 -solid 1
|
|
||||||
checkprops result -s 163660 -v 1.2937e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,39 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
puts "TODO CR30010 All: Error : is WRONG because number of"
|
|
||||||
puts "TODO CR30010 All: Error: Meshing not done"
|
|
||||||
puts "TODO CR30010 All: Faulty shapes in variables faulty_1 to faulty_"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_bigFillet_Run_12_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_bigFillet_Run_12_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -wire 80 -face 80 -shell 1 -solid 1
|
|
||||||
checkprops result -s 131053 -v 1.23621e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,36 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_bigFillet_Run_16_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_bigFillet_Run_16_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -wire 78 -face 78 -shell 1 -solid 1
|
|
||||||
checkprops result -s 131726 -v 1.22931e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,38 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
puts "TODO CR30010 All: Error : The area of result shape is"
|
|
||||||
puts "TODO CR30010 All: Error : is WRONG because number of"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_20_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_20_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -shell 1 -solid 1
|
|
||||||
checkprops result -s 0 -v 1.07073e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,42 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
puts "TODO CR30010 All: Error : The area of result shape is"
|
|
||||||
puts "TODO CR30010 All: Error : is WRONG because number of"
|
|
||||||
puts "TODO CR30010 All: Error: Meshing not done"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_20_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_20_2.brep] s2
|
|
||||||
|
|
||||||
breducetolerance s1
|
|
||||||
breducetolerance s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -wire 59 -face 59 -shell 1 -solid 1
|
|
||||||
checkprops result -s 0 -v 1.07073e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,36 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_27_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_27_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -wire 48 -face 48 -shell 1 -solid 1
|
|
||||||
checkprops result -s 162464 -v 1.30125e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,37 +0,0 @@
|
|||||||
puts "TODO CR29596 All: Intersection of pair of shapes has failed"
|
|
||||||
puts "TODO CR26106 All: Error: Meshing not done"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC29900: Invalid result of FUSE operation"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
cpulimit 3000
|
|
||||||
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_29_1.brep] s1
|
|
||||||
brestore [locate_data_file bug30010_Eckardt_Run_29_2.brep] s2
|
|
||||||
|
|
||||||
bdrawwarnshapes 1
|
|
||||||
bnondestructive 1
|
|
||||||
bfuzzyvalue 0.0
|
|
||||||
brunparallel 1
|
|
||||||
|
|
||||||
bclearobjects
|
|
||||||
bcleartools
|
|
||||||
baddobjects s1
|
|
||||||
baddtools s2
|
|
||||||
bfillds
|
|
||||||
bbop result 1
|
|
||||||
|
|
||||||
checkshape result
|
|
||||||
checknbshapes result -wire 51 -face 51 -shell 1 -solid 1
|
|
||||||
checkprops result -s 194270 -v 1.70455e+006
|
|
||||||
|
|
||||||
incmesh result 0.01
|
|
||||||
if {[tricheck result] != ""} {
|
|
||||||
puts "Error: Meshing not done"
|
|
||||||
}
|
|
||||||
|
|
||||||
boptions -default
|
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
@@ -1,37 +1,72 @@
|
|||||||
puts "================"
|
puts "================"
|
||||||
puts "OCC333"
|
puts "OCC333: Superimposed curves during intersection two surfaces "
|
||||||
puts "================"
|
puts "================"
|
||||||
puts ""
|
puts ""
|
||||||
#######################################################
|
|
||||||
## Superimposed curves during intersection two surfaces
|
|
||||||
#######################################################
|
|
||||||
|
|
||||||
pload QAcommands
|
set GoodNbCurv 14
|
||||||
|
|
||||||
restore [locate_data_file OCC333a.draw] s12
|
restore [locate_data_file OCC333a.draw] s1
|
||||||
############### checkshape su12 # is not a topological shape
|
restore [locate_data_file OCC333b.draw] s2
|
||||||
restore [locate_data_file OCC333b.draw] s11
|
|
||||||
############### checkshape su11 # is not a topological shape
|
|
||||||
intersect result s12 s11
|
|
||||||
explode result e
|
|
||||||
clknots result_3
|
|
||||||
clknots result_13
|
|
||||||
|
|
||||||
mkedge e_1 result_3
|
intersect result s1 s2
|
||||||
mkedge e_2 result_13
|
|
||||||
|
|
||||||
set status [OCC333 e_1 e_2]
|
set che [whatis result]
|
||||||
if {[llength ${status}] < 1} {
|
set ind [string first "3d curve" $che]
|
||||||
puts "OCC333 ERROR"
|
if {${ind} >= 0} {
|
||||||
} else {
|
#Only variable "result" exists
|
||||||
regexp {([-0-9.+eE]+)} ${status} full code
|
renamevar result result_1
|
||||||
if { ${code} == 3 || ${code} == 2} {
|
|
||||||
puts "OCC333 OK : Intersection command works properly"
|
|
||||||
} else {
|
|
||||||
puts "Faulty OCC333 : Intersection was made WRONGLY"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
donly i_3 i_13
|
set ic 1
|
||||||
|
set AllowRepeate 1
|
||||||
|
while { $AllowRepeate != 0 } {
|
||||||
|
set che [whatis result_$ic]
|
||||||
|
set ind [string first "3d curve" $che]
|
||||||
|
if {${ind} < 0} {
|
||||||
|
set AllowRepeate 0
|
||||||
|
} else {
|
||||||
|
display result_$ic
|
||||||
|
|
||||||
|
bounds result_$ic U1 U2
|
||||||
|
|
||||||
|
dump U1 U2
|
||||||
|
|
||||||
|
if {[dval U2-U1] < 1.0e-9} {
|
||||||
|
puts "Error: Wrong curve's range!"
|
||||||
|
}
|
||||||
|
|
||||||
|
xdistcs result_$ic s1 U1 U2 10 2.0e-7
|
||||||
|
xdistcs result_$ic s2 U1 U2 10 2.0e-7
|
||||||
|
|
||||||
|
for { set ip [expr $ic-1] } { $ip > 0 } { incr ip -1 } {
|
||||||
|
mkedge e1 result_$ic
|
||||||
|
mkedge e2 result_$ip
|
||||||
|
|
||||||
|
set coe [checkoverlapedges e1 e2 5.0e-5]
|
||||||
|
|
||||||
|
puts "result_$ic <-> result_$ip: $coe"
|
||||||
|
if { [regexp "Edges is not overlaped" $coe] != 1 } {
|
||||||
|
puts "Error: result_$ic and result_$ip are overlaped"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
incr ic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
incr ic -1
|
||||||
|
|
||||||
|
if {$ic == $GoodNbCurv} {
|
||||||
|
puts "OK: Number of curves is good!"
|
||||||
|
} else {
|
||||||
|
puts "Error: $GoodNbCurv curves are expected but $ic ones are found!"
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
don result*
|
||||||
|
fit
|
||||||
|
clear
|
||||||
|
don s1 s2 result*
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
||||||
|
|
||||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
|
||||||
|
@@ -1,62 +0,0 @@
|
|||||||
puts "TODO OCC12345 ALL: Faulty OCC565: function intersection works wrongly with trimmed Surfaces"
|
|
||||||
puts "TODO OCC12345 Linux: Faulty OCC565: function intersection works wrongly with infinite Surfaces"
|
|
||||||
puts "TODO OCC12345 MacOS: Faulty OCC565: function intersection works wrongly with infinite Surfaces"
|
|
||||||
|
|
||||||
puts "========"
|
|
||||||
puts "OCC567"
|
|
||||||
puts "========"
|
|
||||||
puts ""
|
|
||||||
#######################################
|
|
||||||
## Can not intersect two Rectangular Trimmed Surfaces .
|
|
||||||
#######################################
|
|
||||||
|
|
||||||
restore [locate_data_file OCC567a.draw] s1
|
|
||||||
restore [locate_data_file OCC567b.draw] s2
|
|
||||||
|
|
||||||
if { [checkplatform -windows] } {
|
|
||||||
puts "OS = Windows NT"
|
|
||||||
set N_repeat 10
|
|
||||||
} else {
|
|
||||||
puts "OS = Linux"
|
|
||||||
set N_repeat 11
|
|
||||||
}
|
|
||||||
|
|
||||||
if { [catch {intersect i s1 s2 } catch_result] } {
|
|
||||||
puts "Faulty OCC565: function intersection works wrongly with infinite Surfaces"
|
|
||||||
} else {
|
|
||||||
set j 1
|
|
||||||
repeat ${N_repeat} {
|
|
||||||
set err [lindex [whatis i_$j] 5]
|
|
||||||
if { $err != "curve"} {
|
|
||||||
puts " Faulty OCC565: function intersection works wrongly with infinite Surfaces"
|
|
||||||
break
|
|
||||||
} else {
|
|
||||||
puts [format "%s ) OCC565 OK: function intersection works with infinite Surfaces" $j]
|
|
||||||
}
|
|
||||||
incr j}
|
|
||||||
}
|
|
||||||
|
|
||||||
trim s1x s1 0 2*pi 0 2*pi/13
|
|
||||||
trim s2x s2 0 2*pi 0 2*pi/13
|
|
||||||
|
|
||||||
if { [catch {intersect result s1x s2x } catch_result] } {
|
|
||||||
puts "Faulty OCC565 exception: function intersection works wrongly with trimmed Surfaces"
|
|
||||||
} else {
|
|
||||||
set nom 0
|
|
||||||
set j 1
|
|
||||||
repeat 11 {
|
|
||||||
set err [lindex [whatis result_$j] 5]
|
|
||||||
if { $err != "curve"} {
|
|
||||||
break
|
|
||||||
} else {
|
|
||||||
set nom [expr $nom + 1]
|
|
||||||
}
|
|
||||||
incr j
|
|
||||||
}
|
|
||||||
if { $nom == 0} {
|
|
||||||
puts "Faulty OCC565: function intersection works wrongly with trimmed Surfaces"
|
|
||||||
} else {
|
|
||||||
puts " OCC565 OK: function intersection works with trimmed Surfaces"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user