1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Compare commits

..

18 Commits

Author SHA1 Message Date
jgv
97112d08cf Another version. 2017-06-08 17:44:45 +03:00
apn
c765ab619b 0028347: Reuse OCCT implementation for producing end-user documentation for Products
Remove unnecessary definition of PRODROOT
2017-06-01 16:24:53 +03:00
apv
3b337f77ed 0023378: BRepAlgoAPI_Cut returns wrong result
Adding test cases only
2017-06-01 13:55:29 +03:00
mpv
ec2039e9a7 0028714: XmlMFunction_ScopeDriver fail to read and write function label including 0 tag in label path.
Reproduced on TDF_Reference attribute that refers to label with zero-tags entry. Make checking of saved/retrieved tags in XML format pass zero-tags as correct.
2017-06-01 13:55:26 +03:00
bugmaster
4f0ba168fb 0028773: BRepAlgoAPI_Cut invalid result
Adding test case only
2017-06-01 13:55:24 +03:00
ifv
f6b08ecf71 0028346: Function ProjectOnSegments of ShapeAnalysis_Curve returns only single solution leading to projection result far from optimal
Subdivision of curve parametric interval based on deflection criteria is added for curve type OtherCurve in
Extrema_GExtPC.gxx. Algorithm of subdivision is implemented in Extrema_Curve(2d)Tool.cxx

New Draw command projpcurve for projection of point on CurveOnSurface is added in SWDRAW_ShapeAnalysis.cxx
projpcurve is modified to reflect "start parameter" in usage message and Draw help.
2017-06-01 13:55:22 +03:00
nbv
75b9688a9f 0023177: Intersection of plane and torus misses a result and never produces analytical result
Creation of the test case.
2017-06-01 13:55:20 +03:00
kgv
ee2be2a881 0028316: Coding Rules - Elimilate confusing aliases of Standard_Real type in V3d_View
Quantity_Factor, Quantity_Parameter, Quantity_Ratio, Quantity_Coefficient,
Quantity_PlaneAngle, Quantity_Length, V3d_Parameter and V3d_Coordinate
have been replaced by Standard_Real in visualization classes.
2017-06-01 13:55:18 +03:00
msv
3f5aa017e7 0028782: Shape sewing behavior not consistent for the same CAD file
Get rid of iterations on maps with shape key by replacing simple maps with indexed maps. So iteration is done on integer key.

The map containers have been updated to insert into them type definitions of key and value.

The new methods RemoveKey() and RemoveFromIndex() have been added to indexed [data] map to be able to remove an arbitrary key from the map.

All the code in OCCT has been updated where RemoveLast() and Substitute() methods were used to remove a key from indexed [data] map.
2017-06-01 13:55:15 +03:00
mpv
58e5d30edc 0028714: Dimension of TDataStd_Real is not serialized to document
Added a comments and Standard_DEPRECATED macros to obsolete methods that these methods will be removed and that the corresponding field myDimension is not stored in the document.
2017-06-01 13:55:13 +03:00
szy
fa6fc587b9 0028616: TNaming - DELETE evolution is not considered by TNaming_NewShapeIterator.
// Fixed TNaming_Builder.
2017-06-01 10:41:25 +03:00
kgv
e28f12b304 0028793: Visualization, TKV3d - make BVH_Builder::Build() const for propagating builder by value
Added const for method BVH_Builder::Build().
Added missing Standard_OVERRIDE to overridden methods.
Merged code from .lxx in BVH package directly into .hxx headers.
2017-06-01 10:39:35 +03:00
emv
edfa30deef 0028259: Method MakeBlocksCnx is duplicated in two different places in BOPAlgo
The methods BOPAlgo_Tools::MakeBlocksCnx(), BOPAlgo_Tools::MakeBlocks() and static method MakeBlocksCnx in BOPAlgo_Builder_2.cxx have been replaced with the new template method BOPAlgo_Tools::MakeBlocks(). The blocks of connected elements are now stored into the list of list instead of data map.
All methods BOPAlgo_Tools::FillMap() have been replaced with the new template method BOPAlgo_Tools::FillMap().

Making the Pave Block with the smallest index of original edge to be the first in the Common Block (i.e. the representing Pave Block).

The following improvements have been made in Boolean Operations algorithm to avoid regressions:
- When updating the existing common block update its pave blocks in a way that the parameters of the paves should be valid for the original edge (bugs/modalg_5/bug24809);
- When trying to reduce the tolerance of the section edge check the tolerance of all Face/Face interferences that created this edge (boolean/volumemaker/C4,D2);
- Avoid producing the different Pave Blocks for the same section edge (boolean/volumemaker/D6);

Adjustment of the test cases.
2017-06-01 10:20:25 +03:00
kgv
884cafd893 0028788: Visualization, StdPrs_WFShape - Add option to compute Isolines using multiple threads
StdPrs_WFShape::Add() now accepts new argument theIsParallel (FALSE by default)
for computing Isolines using multiple threads (if there is more then 1 Face).
StdPrs_Isolines::addOnTriangulation() - changed the iteration order (cosmetics).
2017-06-01 10:18:34 +03:00
kgv
3ae5dc8173 0028796: Coding Rules - fix declaration of Move constructor in NCollection_Array1 2017-06-01 10:17:31 +03:00
ika
1603a49799 0028790: Data Exchange - Wrong orientation of Annotation Plane in GD&T (Writing)
Fix building of Axis2Placement3d.
2017-06-01 10:14:34 +03:00
ifv
4560c05480 0028771: BRepOffset_MakeOffset incorrect result
Correction of tolerance of new edges, which belongs planar faces is improved
Test case added.
2017-06-01 10:10:46 +03:00
mpv
354c94b724 0025536: XmlMDataXtd_GeometryDriver doesn't support TDataXtd_SPLINE, TDataXtd_PLANE and TDataXtd_CYLINDER.
Added support of the missed geometrical types into the XML driver.
2017-06-01 10:05:04 +03:00
272 changed files with 4402 additions and 5343 deletions

View File

@@ -23,7 +23,6 @@ if exist "%~dp0custom.bat" (
rem for compatability with external application using CASROOT
if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
set "PRODROOT="
if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%"

View File

@@ -1246,8 +1246,15 @@ In most cases this change should be transparent, however applications implementi
* Types GeomPlate_Array1OfHCurveOnSurface and GeomPlate_HArray1OfHCurveOnSurface have been replaced with GeomPlate_Array1OfHCurve and GeomPlate_HArray1OfHCurve correspondingly (accept base class Adaptor3d_HCurve instead of Adaptor3d_HCurveOnSurface).
* Enumeration *Image_PixMap::ImgFormat*, previously declared as nested enumeration within class *Image_PixMap*, has been moved to global namespace as *Image_Format* following OCCT coding rules.
The enumeration values have suffix Image_Format_ and preserve previous name scheme for easy renaming of old values - e.g. Image_PixMap::ImgGray become Image_Format_Gray.
<<<<<<< HEAD
Old definitions are preserved as depreacated aliases to the new ones;
* The method BOPAlgo_Builder::Origins() returns BOPCol_DataMapOfShapeListOfShape instead of BOPCol_DataMapOfShapeShape.
=======
Old definitions are preserved as depreacated aliases to the new ones.
* The methods BOPDS_DS::IsToSort(const Handle(BOPDS_CommonBlock)&, Standard_Integer&) and BOPDS_DS::SortPaveBlocks(const Handle(BOPDS_CommonBlock)&) have been removed. The sorting is now performed during the addition of the Pave Blocks into Common Block.
* The methods BOPAlgo_Tools::MakeBlocks() and BOPAlgo_Tools::MakeBlocksCnx() have been replaced with the single template method BOPAlgo_Tools::MakeBlocks(). The chains of connected elements are now stored into the list of list instead of data map.
* The methods BOPAlgo_Tools::FillMap() have been replaced with the single template method BOPAlgo_Tools::FillMap().
>>>>>>> 648fab3... 0028259: Method MakeBlocksCnx is duplicated in two different places in BOPAlgo
@subsection upgrade_720_BOP_DataStructure BOP - Pairs of interfering indices

View File

@@ -9845,7 +9845,31 @@ projcurve k_1 0 1 5
==Param = -0.20000000000000001 Gap = 5.0009999000199947
~~~~~
@subsubsection occt_draw_9_1_14 projface
@subsubsection occt_draw_9_1_14 projpcurve
Syntax:
~~~~~
projpcurve <edge> <face> <Tol> <X> <Y> <Z> [<start_param>]
~~~~~
**projpcurve** returns the projection of a given point on a given curve on surface. The curve on surface is defined by giving the edge and face names. Edge must have curve 2D repesentation on the face. Optional parameter <i>\<start_param\></i> is any parameter of pcurve, which is used by algoritm as start point for searching projection of given point with help of local Extrema algorithm. If this parameter is not set, algorithm uses whole parametric interval of pcurve for searching projection.
**Example:**
~~~~~
##Using global searching
projpcurve f_1 f 1.e-7 0.877 0 0.479
==Point: 0.87762772831890712 0 0.47934285275342808
==Param: 0.49990578239977856
==Dist: 0.0007152557954264938
~~~~~
##Using starting parameter on edge
projpcurve f_1 f 1.e-7 0.877 0 0.479 .6
==Point: 0.87762772831890712 0 0.47934285275342808
==Param: 0.49990578239977856
==Dist: 0.0007152557954264938
~~~~~
@subsubsection occt_draw_9_1_15 projface
Syntax:
~~~~~
@@ -9861,7 +9885,7 @@ projface a_1 10.0 0.0
== = proj X = -116 Y = -45 Z = 0
~~~~~
@subsubsection occt_draw_9_1_15 scaleshape
@subsubsection occt_draw_9_1_16 scaleshape
Syntax:
~~~~~
@@ -9875,7 +9899,7 @@ Returns a new shape, which is the result of scaling of a given shape with a coef
scaleshape r a_1 0.8
~~~~~
@subsubsection occt_draw_9_1_16 settolerance
@subsubsection occt_draw_9_1_17 settolerance
Syntax:
~~~~~
@@ -9890,7 +9914,7 @@ Sets new values of tolerance for a given shape. If the second parameter <i>mode<
settolerance a 0.001
~~~~~
@subsubsection occt_draw_9_1_17 splitface
@subsubsection occt_draw_9_1_18 splitface
Syntax:
~~~~~
@@ -9908,7 +9932,7 @@ splitface r f u 5
==> Status: DONE1
~~~~~
@subsubsection occt_draw_9_1_18 statshape
@subsubsection occt_draw_9_1_19 statshape
Syntax:
~~~~~
@@ -9934,7 +9958,7 @@ statshape a
==> 34 bspsur: BSplineSurface
~~~~~
@subsubsection occt_draw_9_1_19 tolerance
@subsubsection occt_draw_9_1_20 tolerance
Syntax:
~~~~~

View File

@@ -164,7 +164,7 @@ public:
/// <param name="theZoomFactor">Current zoom</param>
void Place(int theX, int theY, float theZoomFactor)
{
Quantity_Factor aZoomFactor = theZoomFactor;
Standard_Real aZoomFactor = theZoomFactor;
if (!myView().IsNull())
{
myView()->Place(theX, theY, aZoomFactor);
@@ -537,7 +537,7 @@ public:
{
Quantity_Color anObjCol;
myAISContext()->Color (aCurrent, anObjCol);
Quantity_Parameter r1, r2, r3;
Standard_Real r1, r2, r3;
anObjCol.Values(r1, r2, r3, Quantity_TOC_RGB);
theRed=(int)r1*255;
theGreen=(int)r2*255;

View File

@@ -180,7 +180,7 @@ public:
/// <param name="theZoomFactor">Current zoom</param>
void Place (int theX, int theY, float theZoomFactor)
{
Quantity_Factor aZoomFactor = theZoomFactor;
Standard_Real aZoomFactor = theZoomFactor;
if (!myView().IsNull())
{
myView()->Place (theX, theY, aZoomFactor);

View File

@@ -71,7 +71,7 @@ namespace IE_WPF_D3D
public bool IsMaterialEnabled { get; private set; }
public bool IsDeleteEnabled { get; private set; }
private float myCurZoom;// ~ Quantity_Factor
private float myCurZoom;
private int myXmin;
private int myYmin;
private int myXmax;

View File

@@ -70,7 +70,7 @@ namespace IE_WPF_WinForms
public bool IsMaterialEnabled { get; private set; }
public bool IsDeleteEnabled { get; private set; }
private float myCurZoom;// ~ Quantity_Factor
private float myCurZoom;
private int myXmin;
private int myYmin;
private int myXmax;

View File

@@ -286,7 +286,7 @@ namespace IE_WinForms
protected CurrentAction3d myCurrentMode;
protected CurrentPressedKey myCurrentPressedKey;
protected float myCurZoom;// ~ Quantity_Factor
protected float myCurZoom;
protected bool myDegenerateModeIsOn;
protected int myXmin;
protected int myYmin;

View File

@@ -53,7 +53,7 @@ public:
virtual Standard_Boolean IsMapped() const Standard_OVERRIDE { return Standard_True; }
//! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions
virtual Quantity_Ratio Ratio() const Standard_OVERRIDE { return 1.0; }
virtual Standard_Real Ratio() const Standard_OVERRIDE { return 1.0; }
//! Returns The Window POSITION in PIXEL
virtual void Position (Standard_Integer& theX1,

View File

@@ -257,7 +257,7 @@ Handle(AIS_Shape) OCCDemo_Presentation::drawShape
return aGraphicShape;
}
void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
void OCCDemo_Presentation::GetViewCenter(Standard_Real& Xc, Standard_Real& Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -265,7 +265,7 @@ void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
pView->GetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
void OCCDemo_Presentation::SetViewCenter(Standard_Real Xc, Standard_Real Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -273,7 +273,7 @@ void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
pView->SetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
void OCCDemo_Presentation::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -281,7 +281,7 @@ void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_
pView->GetViewEye(X,Y,Z);
}
void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
void OCCDemo_Presentation::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -289,7 +289,7 @@ void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Co
pView->SetViewEye(X,Y,Z);
}
Quantity_Factor OCCDemo_Presentation::GetViewScale()
Standard_Real OCCDemo_Presentation::GetViewScale()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -297,7 +297,7 @@ Quantity_Factor OCCDemo_Presentation::GetViewScale()
return pView->GetViewScale();
}
void OCCDemo_Presentation::SetViewScale(Quantity_Factor Coef)
void OCCDemo_Presentation::SetViewScale(Standard_Real Coef)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();

View File

@@ -48,12 +48,12 @@ public:
void NextSample() {myIndex++;}
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
static void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void GetViewCenter(Standard_Real& Xc, Standard_Real& Yc);
static void SetViewCenter(const Standard_Real Xc, const Standard_Real Yc);
static void GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
static void SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z);
static Standard_Real GetViewScale();
static void SetViewScale(Standard_Real Coef);
static void ResetView();

View File

@@ -9,7 +9,6 @@
#include "OCCDemoView.h"
#include <Standard_ErrorHandler.hxx>
#include <V3d_Coordinate.hxx>
#ifdef _DEBUG
#undef THIS_FILE

View File

@@ -8,7 +8,6 @@
#include "OCCDemoView.h"
#include <Graphic3d_GraphicDriver.hxx>
#include <V3d_Coordinate.hxx>
#define ValZWMin 1
@@ -548,32 +547,32 @@ void COCCDemoView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
pCmdUI->Enable (myVisMode != VIS_HLR);
}
void COCCDemoView::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
void COCCDemoView::GetViewCenter(Standard_Real& Xc, Standard_Real& Yc)
{
myView->Center(Xc,Yc);
}
void COCCDemoView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
void COCCDemoView::SetViewCenter(Standard_Real Xc, Standard_Real Yc)
{
myView->SetCenter(Xc,Yc);
}
void COCCDemoView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
void COCCDemoView::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
myView->Eye(X,Y,Z);
}
void COCCDemoView::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
void COCCDemoView::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
myView->SetEye(X,Y,Z);
}
Quantity_Factor COCCDemoView::GetViewScale()
Standard_Real COCCDemoView::GetViewScale()
{
return myView->Scale();
}
void COCCDemoView::SetViewScale(Quantity_Factor Coef)
void COCCDemoView::SetViewScale(Standard_Real Coef)
{
myView->SetScale(Coef);
}

View File

@@ -33,12 +33,12 @@ public:
void InitButtons();
void Reset();
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale();
void SetViewScale(const Quantity_Factor Coef);
void GetViewCenter(Standard_Real& Xc, Standard_Real& Yc);
void SetViewCenter(const Standard_Real Xc, const Standard_Real Yc);
void GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
void SetViewEye(const Standard_Real X,const Standard_Real Y,const Standard_Real Z);
Standard_Real GetViewScale();
void SetViewScale(const Standard_Real Coef);
// Overrides
@@ -111,7 +111,7 @@ private:
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Quantity_Factor myCurZoom;
Standard_Real myCurZoom;
private:
enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };

View File

@@ -18,8 +18,6 @@
#include <GeomLProp_CLProps.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <V3d_Coordinate.hxx>
#ifdef WNT
#define EOL "\r\n"
#else

View File

@@ -56,7 +56,7 @@ void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType)
}
void GeomSources::PostProcess (CGeometryDoc* aDoc, UINT anID, DisplayType aDisplayType,
const TCollection_AsciiString& theString, Standard_Boolean UpdateViewer, Quantity_Coefficient Coef)
const TCollection_AsciiString& theString, Standard_Boolean UpdateViewer, Standard_Real Coef)
{
Standard_CString aString = theString.ToCString();
if (UpdateViewer)
@@ -3808,7 +3808,7 @@ void GeomSources::gpTest47(CGeometryDoc* aDoc)
GeomAPI_PointsToBSplineSurface(array3).Surface();
GeomAPI_ExtremaSurfaceSurface ESS(aSurf1,aSurf2);
//Quantity_Length dist = ESS.LowerDistance();
//Standard_Real dist = ESS.LowerDistance();
gp_Pnt P1,P2;
ESS.NearestPoints(P1,P2);
@@ -3833,7 +3833,7 @@ Handle(Geom_BSplineSurface) aSurf2 = \n\
GeomAPI_PointsToBSplineSurface(array3).Surface(); \n\
\n\
GeomAPI_ExtremaSurfaceSurface ESS(aSurf1,aSurf2); \n\
Quantity_Length dist = ESS.LowerDistance(); \n\
Standard_Real dist = ESS.LowerDistance(); \n\
gp_Pnt P1,P2; \n\
ESS.NearestPoints(P1,P2); \n\
\n");

View File

@@ -82,7 +82,7 @@ private:
DisplayType aDisplayType,
const TCollection_AsciiString& aString,
Standard_Boolean UpdateViewer = Standard_True,
Quantity_Coefficient Coef = -1);
Standard_Real Coef = -1);
static void DisplayPoint(CGeometryDoc* aDoc,
const gp_Pnt2d& aPoint,
const char* aText,

View File

@@ -256,7 +256,7 @@ void CGeometryDoc::MoveEvent2D(const Standard_Integer x,
{
if(aView->Viewer()->Grid()->IsActive())
{
Quantity_Length aGridX=0,aGridY=0,aGridZ=0;
Standard_Real aGridX=0,aGridY=0,aGridZ=0;
aView->ConvertToGrid(x,y,aGridX,aGridY,aGridZ);
//View is not updated automatically in ConvertToGrid
aView->Update();
@@ -470,7 +470,7 @@ void CGeometryDoc::Minimize3D()
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CGeometryDoc::Fit3DViews(Quantity_Coefficient Coef)
void CGeometryDoc::Fit3DViews(Standard_Real Coef)
{
POSITION position = GetFirstViewPosition();
while (position != (POSITION)NULL)
@@ -488,7 +488,7 @@ void CGeometryDoc::Fit3DViews(Quantity_Coefficient Coef)
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CGeometryDoc::Set3DViewsZoom(const Quantity_Factor& Coef)
void CGeometryDoc::Set3DViewsZoom(const Standard_Real& Coef)
{
POSITION position = GetFirstViewPosition();
while (position != (POSITION)NULL)

View File

@@ -20,8 +20,8 @@ public:
void Put2DOnTop(bool isMax = true);
void Put3DOnTop(bool isMax = true);
void Fit2DViews();
void Set3DViewsZoom(const Quantity_Factor& Coef );
void Fit3DViews(Quantity_Coefficient Coef);
void Set3DViewsZoom(const Standard_Real& Coef );
void Fit3DViews(Standard_Real Coef);
void simplify(const TopoDS_Shape& aShape);

View File

@@ -34,7 +34,7 @@ public:
// Implementation
public:
virtual ~CGeometryView();
void FitAll(Quantity_Coefficient Coef)
void FitAll(Standard_Real Coef)
{
if (Coef != -1)
myView->FitAll(Coef);

View File

@@ -4,8 +4,6 @@
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <Quantity_Length.hxx>
#include <Aspect_TypeOfline.hxx>
#include <Aspect_WidthOfline.hxx>
#include <Standard_Integer.hxx>

View File

@@ -40,7 +40,7 @@ private:
gp_Pnt myPnt;
gp_Dir myDir;
Standard_Real myLength;
Quantity_Length myArrowLength;
Standard_Real myArrowLength;
};
#endif // !defined(AFX_ISession_Direction_H__767C0DB3_A3B0_11D1_8DA3_0800369C8A03__INCLUDED_)

View File

@@ -3,7 +3,7 @@
gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView)
{
V3d_Coordinate XEye,YEye,ZEye,XAt,YAt,ZAt;
Standard_Real XEye,YEye,ZEye,XAt,YAt,ZAt;
aView->Eye(XEye,YEye,ZEye);
aView->At(XAt,YAt,ZAt);
gp_Pnt EyePoint(XEye,YEye,ZEye);

View File

@@ -257,7 +257,7 @@ Handle(AIS_Shape) OCCDemo_Presentation::drawShape
return aGraphicShape;
}
void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ)
void OCCDemo_Presentation::GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -265,7 +265,7 @@ void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY
pView->GetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
void OCCDemo_Presentation::SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -273,7 +273,7 @@ void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coord
pView->SetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
void OCCDemo_Presentation::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -281,7 +281,7 @@ void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_
pView->GetViewEye(X,Y,Z);
}
void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
void OCCDemo_Presentation::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -289,7 +289,7 @@ void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Co
pView->SetViewEye(X,Y,Z);
}
Quantity_Factor OCCDemo_Presentation::GetViewScale()
Standard_Real OCCDemo_Presentation::GetViewScale()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -297,7 +297,7 @@ Quantity_Factor OCCDemo_Presentation::GetViewScale()
return pView->GetViewScale();
}
void OCCDemo_Presentation::SetViewScale(Quantity_Factor Coef)
void OCCDemo_Presentation::SetViewScale(Standard_Real Coef)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();

View File

@@ -50,12 +50,12 @@ public:
void NextSample() {myIndex++;}
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
static void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
static void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ);
static void SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ);
static void GetViewEye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
static void SetViewEye (Standard_Real X, Standard_Real Y, Standard_Real Z);
static Standard_Real GetViewScale();
static void SetViewScale(Standard_Real Coef);
static void ResetView();
CViewer3dDoc* getDocument() { return myDoc; }

View File

@@ -193,7 +193,7 @@ CViewer3dDoc* CViewer3dView::GetDocument() // non-debug version is inline
gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView)
{
V3d_Coordinate XEye,YEye,ZEye,XAt,YAt,ZAt;
Standard_Real XEye,YEye,ZEye,XAt,YAt,ZAt;
aView->Eye(XEye,YEye,ZEye);
aView->At(XAt,YAt,ZAt);
gp_Pnt EyePoint(XEye,YEye,ZEye);
@@ -1140,32 +1140,32 @@ void CViewer3dView::Reset()
}
}
void CViewer3dView::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const
void CViewer3dView::GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const
{
myView->At (theX, theY, theZ);
}
void CViewer3dView::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
void CViewer3dView::SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ)
{
myView->SetAt (theX, theY, theZ);
}
void CViewer3dView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
void CViewer3dView::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
myView->Eye(X,Y,Z);
}
void CViewer3dView::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
void CViewer3dView::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
myView->SetEye(X,Y,Z);
}
Quantity_Factor CViewer3dView::GetViewScale()
Standard_Real CViewer3dView::GetViewScale()
{
return myView->Scale();
}
void CViewer3dView::SetViewScale(Quantity_Factor Coef)
void CViewer3dView::SetViewScale(Standard_Real Coef)
{
myView->SetScale(Coef);
}

View File

@@ -44,12 +44,12 @@ public:
void Redraw() { myView->Redraw(); };
void InitButtons();
void Reset();
void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const;
void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye (const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale();
void SetViewScale (const Quantity_Factor Coef);
void GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const;
void SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ);
void GetViewEye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
void SetViewEye (const Standard_Real X,const Standard_Real Y,const Standard_Real Z);
Standard_Real GetViewScale();
void SetViewScale (const Standard_Real Coef);
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
@@ -138,7 +138,7 @@ private:
Standard_Integer NbActiveLights;
Standard_Boolean myHlrModeIsOn;
Quantity_Factor myCurZoom;
Standard_Real myCurZoom;
Handle(V3d_AmbientLight) myCurrent_AmbientLight;
Handle(V3d_SpotLight) myCurrent_SpotLight;
Handle(V3d_PositionalLight) myCurrent_PositionalLight;

View File

@@ -258,7 +258,7 @@ Handle(AIS_Shape) OCCDemo_Presentation::drawShape
return aGraphicShape;
}
/*
void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
void OCCDemo_Presentation::GetViewCenter(Standard_Real& Xc, Standard_Real& Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -266,7 +266,7 @@ void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
pView->GetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
void OCCDemo_Presentation::SetViewCenter(Standard_Real Xc, Standard_Real Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -274,7 +274,7 @@ void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
pView->SetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
void OCCDemo_Presentation::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -282,7 +282,7 @@ void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_
pView->GetViewEye(X,Y,Z);
}
void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
void OCCDemo_Presentation::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -290,7 +290,7 @@ void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Co
pView->SetViewEye(X,Y,Z);
}
Quantity_Factor OCCDemo_Presentation::GetViewScale()
Standard_Real OCCDemo_Presentation::GetViewScale()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -298,7 +298,7 @@ Quantity_Factor OCCDemo_Presentation::GetViewScale()
return pView->GetViewScale();
}
void OCCDemo_Presentation::SetViewScale(Quantity_Factor Coef)
void OCCDemo_Presentation::SetViewScale(Standard_Real Coef)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();

View File

@@ -53,12 +53,12 @@ public:
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
/*
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
static void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void GetViewCenter(Standard_Real& Xc, Standard_Real& Yc);
static void SetViewCenter(const Standard_Real Xc, const Standard_Real Yc);
static void GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
static void SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z);
static Standard_Real GetViewScale();
static void SetViewScale(Standard_Real Coef);
static void ResetView();
*/

View File

@@ -261,13 +261,13 @@ void CSelectionDialog::Apply()
void CSelectionDialog::UpdateProjector()
{
V3d_Coordinate DX,DY,DZ,XAt,YAt,ZAt, Vx,Vy,Vz ;
Standard_Real DX,DY,DZ,XAt,YAt,ZAt, Vx,Vy,Vz ;
myActiveView->Proj(DX,DY,DZ);
myActiveView->At(XAt,YAt,ZAt);
myActiveView->Up( Vx,Vy,Vz );
OnDisplay(false);
Standard_Boolean IsPerspective = (myActiveView->Type() == V3d_PERSPECTIVE);
Quantity_Length aFocus = 1;
Standard_Real aFocus = 1;
Prs3d_Projector aPrs3dProjector(IsPerspective,aFocus,DX,DY,DZ,XAt,YAt,ZAt,Vx,Vy,Vz);
HLRAlgo_Projector aProjector = aPrs3dProjector.Projector();

View File

@@ -135,7 +135,7 @@ private:
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Quantity_Factor myCurZoom;
Standard_Real myCurZoom;
Standard_Boolean myHlrModeIsOn;
View3D_CurrentAction myCurrentMode;

View File

@@ -259,7 +259,7 @@ Handle(AIS_Shape) OCCDemo_Presentation::drawShape
return aGraphicShape;
}
void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ)
void OCCDemo_Presentation::GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -267,7 +267,7 @@ void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY
pView->GetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
void OCCDemo_Presentation::SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -275,7 +275,7 @@ void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coord
pView->SetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
void OCCDemo_Presentation::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -283,7 +283,7 @@ void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_
pView->GetViewEye(X,Y,Z);
}
void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
void OCCDemo_Presentation::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -291,7 +291,7 @@ void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Co
pView->SetViewEye(X,Y,Z);
}
Quantity_Factor OCCDemo_Presentation::GetViewScale()
Standard_Real OCCDemo_Presentation::GetViewScale()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -299,7 +299,7 @@ Quantity_Factor OCCDemo_Presentation::GetViewScale()
return pView->GetViewScale();
}
void OCCDemo_Presentation::SetViewScale(Quantity_Factor Coef)
void OCCDemo_Presentation::SetViewScale(Standard_Real Coef)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
@@ -315,7 +315,7 @@ void OCCDemo_Presentation::ResetView()
pView->Reset();
}
void OCCDemo_Presentation::TranslateView (const V3d_Coordinate theX, const V3d_Coordinate theY)
void OCCDemo_Presentation::TranslateView (const Standard_Real theX, const Standard_Real theY)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();

View File

@@ -50,14 +50,14 @@ public:
void NextSample() {myIndex++;}
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
static void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
static void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ);
static void SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ);
static void GetViewEye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
static void SetViewEye (Standard_Real X, Standard_Real Y, Standard_Real Z);
static Standard_Real GetViewScale();
static void SetViewScale(Standard_Real Coef);
static void ResetView();
static void TranslateView (const V3d_Coordinate theX, const V3d_Coordinate theY);
static void TranslateView (const Standard_Real theX, const Standard_Real theY);
// place one-time initialization code in this function
virtual void Init() {}

View File

@@ -546,32 +546,32 @@ void COCCDemoView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
pCmdUI->Enable (myVisMode != VIS_HLR);
}
void COCCDemoView::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const
void COCCDemoView::GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const
{
myView->At (theX, theY, theZ);
}
void COCCDemoView::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
void COCCDemoView::SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ)
{
myView->SetAt (theX, theY, theZ);
}
void COCCDemoView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
void COCCDemoView::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
myView->Eye(X,Y,Z);
}
void COCCDemoView::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
void COCCDemoView::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
myView->SetEye(X,Y,Z);
}
Quantity_Factor COCCDemoView::GetViewScale()
Standard_Real COCCDemoView::GetViewScale()
{
return myView->Scale();
}
void COCCDemoView::SetViewScale(Quantity_Factor Coef)
void COCCDemoView::SetViewScale(Standard_Real Coef)
{
myView->SetScale(Coef);
}

View File

@@ -32,13 +32,13 @@ public:
myView->FitAll();
myView->ZFitAll();
};
void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const;
void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye (const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale();
void SetViewScale(const Quantity_Factor Coef);
void Translate (const V3d_Coordinate theX, const V3d_Coordinate theY);
void GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ) const;
void SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ);
void GetViewEye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
void SetViewEye (const Standard_Real X,const Standard_Real Y,const Standard_Real Z);
Standard_Real GetViewScale();
void SetViewScale(const Standard_Real Coef);
void Translate (const Standard_Real theX, const Standard_Real theY);
// Operations
@@ -116,7 +116,7 @@ private:
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Quantity_Factor myCurZoom;
Standard_Real myCurZoom;
private:
enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };

View File

@@ -607,7 +607,7 @@ void OCC_2dView::MoveEvent2D(const Standard_Integer x,
{
if(myV2dView->Viewer()->Grid()->IsActive())
{
Quantity_Length aGridX=0,aGridY=0,aGridZ=0;
Standard_Real aGridX=0,aGridY=0,aGridZ=0;
myV2dView->ConvertToGrid(x,y,aGridX,aGridY,aGridZ);
//View is not updated automatically in ConvertToGrid
myV2dView->Update();

View File

@@ -34,7 +34,7 @@ public:
void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); };
void Redraw() { if ( !myView.IsNull() ) myView->Redraw(); };
void SetZoom ( const Quantity_Factor& Coef ) { myView->SetZoom ( Coef ); };
void SetZoom ( const Standard_Real& Coef ) { myView->SetZoom ( Coef ); };
Handle(V3d_View)& GetView() { return myView; }
// Overrides

View File

@@ -36,7 +36,7 @@ protected:
protected:
Quantity_Factor myCurZoom;
Standard_Real myCurZoom;
Standard_Integer myXmin;
Standard_Integer myYmin;
Standard_Integer myXmax;

View File

@@ -5,9 +5,9 @@
IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Image,AIS_TexturedShape)
Sample2D_Image::Sample2D_Image(TCollection_AsciiString& aFileName,
const Quantity_Length X,
const Quantity_Length Y,
const Quantity_Factor aScale)
const Standard_Real X,
const Standard_Real Y,
const Standard_Real aScale)
:AIS_TexturedShape(TopoDS_Shape())
{
myFilename = aFileName;

View File

@@ -4,8 +4,6 @@
#include <Standard_DefineHandle.hxx>
#include <OSD_File.hxx>
#include <Quantity_Length.hxx>
#include <Quantity_Factor.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Integer.hxx>
@@ -19,13 +17,13 @@ class Sample2D_Image : public AIS_TexturedShape {
public:
Standard_EXPORT Sample2D_Image(TCollection_AsciiString& aFileName,
const Quantity_Length X = 0.0,
const Quantity_Length Y = 0.0,
const Quantity_Factor aScale = 1.0);
Standard_EXPORT inline virtual void GetCoord(Quantity_Length& X,Quantity_Length& Y) const;
Standard_EXPORT inline virtual void SetCoord(const Quantity_Length X,const Quantity_Length Y) ;
Standard_EXPORT inline Quantity_Factor GetScale() const;
Standard_EXPORT inline void SetScale(const Quantity_Factor aNewScale) ;
const Standard_Real X = 0.0,
const Standard_Real Y = 0.0,
const Standard_Real aScale = 1.0);
Standard_EXPORT inline virtual void GetCoord(Standard_Real& X,Standard_Real& Y) const;
Standard_EXPORT inline virtual void SetCoord(const Standard_Real X,const Standard_Real Y) ;
Standard_EXPORT inline Standard_Real GetScale() const;
Standard_EXPORT inline void SetScale(const Standard_Real aNewScale) ;
Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& theContext) ;
DEFINE_STANDARD_RTTIEXT(Sample2D_Image,AIS_TexturedShape)
@@ -34,33 +32,33 @@ private:
protected:
TopoDS_Face myFace;
TCollection_AsciiString myFilename;
Quantity_Length myX;
Quantity_Length myY;
Quantity_Factor myScale;
Standard_Real myX;
Standard_Real myY;
Standard_Real myScale;
};
// other inline functions and methods (like "C++: function call" methods)
//
inline void Sample2D_Image::GetCoord(Quantity_Length& X, Quantity_Length& Y) const
inline void Sample2D_Image::GetCoord(Standard_Real& X, Standard_Real& Y) const
{
X = myX;
Y = myY;
}
inline void Sample2D_Image::SetCoord(const Quantity_Length X, const Quantity_Length Y)
inline void Sample2D_Image::SetCoord(const Standard_Real X, const Standard_Real Y)
{
myX = X;
myY = Y;
}
inline Quantity_Factor Sample2D_Image::GetScale() const
inline Standard_Real Sample2D_Image::GetScale() const
{
return myScale;
}
inline void Sample2D_Image::SetScale(const Quantity_Factor aNewScale)
inline void Sample2D_Image::SetScale(const Standard_Real aNewScale)
{
myScale = aNewScale;
}

View File

@@ -5,8 +5,8 @@
IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Markers,AIS_InteractiveObject)
// generic marker
Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition ,
const Quantity_Length theYPosition ,
Sample2D_Markers::Sample2D_Markers (const Standard_Real theXPosition,
const Standard_Real theYPosition,
const Aspect_TypeOfMarker theMarkerType,
const Quantity_Color theColor,
const Standard_Real theScaleOrId)
@@ -19,8 +19,8 @@ Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition ,
myIndex = theScaleOrId;
}
Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition ,
const Quantity_Length theYPosition ,
Sample2D_Markers::Sample2D_Markers (const Standard_Real theXPosition,
const Standard_Real theYPosition,
const Handle(Graphic3d_ArrayOfPoints)& theArrayOfPoints,
const Aspect_TypeOfMarker theMarkerType,
const Quantity_Color theColor,

View File

@@ -18,15 +18,15 @@ Sample2D_CTOM_Ellips
public:
// Generic marker
Standard_EXPORT Sample2D_Markers (const Quantity_Length theXPosition ,
const Quantity_Length theYPosition ,
Standard_EXPORT Sample2D_Markers (const Standard_Real theXPosition,
const Standard_Real theYPosition,
const Aspect_TypeOfMarker theMarkerType,
const Quantity_Color theColor,
const Standard_Real theScaleOrId=5.0);
// Polyline marker
Standard_EXPORT Sample2D_Markers (const Quantity_Length theXPosition ,
const Quantity_Length theYPosition ,
Standard_EXPORT Sample2D_Markers (const Standard_Real theXPosition,
const Standard_Real theYPosition,
const Handle(Graphic3d_ArrayOfPoints)& theArrayOfPoints,
const Aspect_TypeOfMarker theMarkerType,
const Quantity_Color theColor,
@@ -50,13 +50,13 @@ Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& /*
Sample2D_CurrentTypeOfMarker myCurrentTypeOfMarker;
Quantity_Length myXPosition ;
Quantity_Length myYPosition ;
Aspect_TypeOfMarker myMarkerType;
Quantity_Color myColor;
Quantity_Length myWidth ;
Quantity_Length myHeight ;
Standard_Real myIndex ;//myScaleOrId
Standard_Real myXPosition;
Standard_Real myYPosition;
Aspect_TypeOfMarker myMarkerType;
Quantity_Color myColor;
Standard_Real myWidth;
Standard_Real myHeight;
Standard_Real myIndex;//myScaleOrId
// specific polyline marker
Handle(Graphic3d_ArrayOfPoints) myArrayOfPoints;
};

View File

@@ -60,9 +60,9 @@ void CCircularGrid::UpdateDialogData()
{
UpdateData(TRUE);
ASSERT(!myViewer.IsNull());
Quantity_Length XOrigin,YOrigin,RadiusStep;
Standard_Real XOrigin,YOrigin,RadiusStep;
Standard_Integer DivisionNumber;
Quantity_PlaneAngle RotationAngle ;
Standard_Real RotationAngle;
XOrigin = m_XOrigin ;
YOrigin = m_YOrigin ;
@@ -101,9 +101,9 @@ void CCircularGrid::OnUpdateCirctGridRadiusStep()
void CCircularGrid::UpdateValues()
{
Quantity_Length XOrigin,YOrigin,RadiusStep;
Standard_Real XOrigin,YOrigin,RadiusStep;
Standard_Integer DivisionNumber;
Quantity_PlaneAngle RotationAngle ;
Standard_Real RotationAngle;
myViewer->CircularGridValues(XOrigin, YOrigin, RadiusStep, DivisionNumber, RotationAngle );
m_XOrigin = SavedXOrigin = XOrigin;
m_YOrigin = SavedYOrigin = YOrigin;

View File

@@ -57,9 +57,9 @@ protected:
private :
Handle(V3d_Viewer) myViewer;
Quantity_Length SavedXOrigin,SavedYOrigin,SavedRadiusStep;
Standard_Real SavedXOrigin,SavedYOrigin,SavedRadiusStep;
Standard_Integer SavedDivisionNumber;
Quantity_PlaneAngle SavedRotationAngle ;
Standard_Real SavedRotationAngle;
};

View File

@@ -52,8 +52,8 @@ void CRectangularGrid::UpdateDialogData()
{
UpdateData(TRUE);
ASSERT(!myViewer.IsNull());
Quantity_Length XOrigin,YOrigin , XStep, YStep;
Quantity_PlaneAngle RotationAngle ;
Standard_Real XOrigin,YOrigin , XStep, YStep;
Standard_Real RotationAngle;
XOrigin = m_XOrigin ;
YOrigin = m_YOrigin ;
XStep = m_XStep ;
@@ -97,8 +97,8 @@ void CRectangularGrid::OnCancel()
void CRectangularGrid::UpdateValues()
{
Quantity_Length XOrigin,YOrigin , XStep, YStep;
Quantity_PlaneAngle RotationAngle ;
Standard_Real XOrigin, YOrigin, XStep, YStep;
Standard_Real RotationAngle;
myViewer->RectangularGridValues(XOrigin, YOrigin, XStep, YStep, RotationAngle );
m_XOrigin = SavedXOrigin = XOrigin;
m_YOrigin = SavedYOrigin = YOrigin;

View File

@@ -58,8 +58,8 @@ protected:
private :
Handle(V3d_Viewer) myViewer;
Quantity_Length SavedXOrigin,SavedYOrigin , SavedXStep, SavedYStep;
Quantity_PlaneAngle SavedRotationAngle ;
Standard_Real SavedXOrigin, SavedYOrigin, SavedXStep, SavedYStep;
Standard_Real SavedRotationAngle;
};
//{{AFX_INSERT_LOCATION}}

View File

@@ -52,7 +52,7 @@ public:
virtual Standard_Boolean IsMapped() const { return Standard_True; }
//! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions
virtual Quantity_Ratio Ratio() const { return 1.0; }
virtual Standard_Real Ratio() const { return 1.0; }
//! Returns The Window POSITION in PIXEL
virtual void Position (Standard_Integer& theX1,

View File

@@ -139,10 +139,10 @@ Aspect_TypeOfResize OcctWindow::DoResize() const
// function : Ratio
// purpose :
// =======================================================================
Quantity_Ratio OcctWindow::Ratio() const
Standard_Real OcctWindow::Ratio() const
{
QRect aRect = myWidget->rect();
return Quantity_Ratio( aRect.right() - aRect.left() ) / Quantity_Ratio( aRect.bottom() - aRect.top() );
return Standard_Real( aRect.right() - aRect.left() ) / Standard_Real( aRect.bottom() - aRect.top() );
}
// =======================================================================

View File

@@ -69,7 +69,7 @@ public:
//! Returns The Window RATIO equal to the physical
//! WIDTH/HEIGHT dimensions.
virtual Quantity_Ratio Ratio() const;
virtual Standard_Real Ratio() const;
virtual void Size( Standard_Integer& theWidth, Standard_Integer& theHeight ) const;

View File

@@ -137,7 +137,7 @@ private:
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Quantity_Factor myCurZoom;
Standard_Real myCurZoom;
Standard_Boolean myHlrModeIsOn;
QList<QAction*>* myViewActions;
QList<QAction*>* myRaytraceActions;

View File

@@ -1132,7 +1132,7 @@ Standard_Boolean AIS::InitAngleBetweenCurvilinearFaces (const TopoDS_Face&
{
return Standard_False;
}
Quantity_Parameter anU, aV;
Standard_Real anU, aV;
aProjector.LowerDistanceParameters (anU, aV);
theSecondAttach = aSecondSurf->Value (anU, aV);
}
@@ -1158,7 +1158,7 @@ void AIS::InitLengthBetweenCurvilinearFaces (const TopoDS_Face& theFirstFace,
gp_Dir& theDirOnPlane)
{
GeomAPI_ProjectPointOnSurf aProjector;
Quantity_Parameter aPU, aPV;
Standard_Real aPU, aPV;
TopExp_Explorer anExplorer (theFirstFace, TopAbs_VERTEX);
@@ -1189,7 +1189,7 @@ void AIS::InitLengthBetweenCurvilinearFaces (const TopoDS_Face& theFirstFace,
aProjector.Init (theFirstAttach, theSecondSurf);
Standard_Integer aBestPointIndex = 0;
Quantity_Length aMinDist = RealLast();
Standard_Real aMinDist = RealLast();
gp_Dir aLocalDir;
for (Standard_Integer aPointIt = 1; aPointIt <= aProjector.NbPoints(); aPointIt++)

View File

@@ -641,7 +641,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
// prepare label string and compute its geometrical width
Standard_Real aLabelWidth;
@@ -1414,7 +1414,7 @@ void AIS_AngleDimension::FitTextAlignment (const Prs3d_DimensionTextHorizontalPo
{
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
// Prepare label string and compute its geometrical width
Standard_Real aLabelWidth;

View File

@@ -266,7 +266,7 @@ void AIS_Axis::ComputeFields()
const gp_Dir& oX = anAxis.XDirection();
const gp_Dir& oY = anAxis.YDirection();
const gp_Dir& oZ = anAxis.Direction();
Quantity_Length xo,yo,zo,x = 0.,y = 0.,z = 0.;
Standard_Real xo,yo,zo,x = 0.,y = 0.,z = 0.;
Orig.Coord(xo,yo,zo);
myPfirst.SetCoord(xo,yo,zo);

View File

@@ -376,8 +376,8 @@ void AIS_Dimension::DrawArrow (const Handle(Prs3d_Presentation)& thePresentation
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
Quantity_Length aLength = myDrawer->DimensionAspect()->ArrowAspect()->Length();
Standard_Real anAngle = myDrawer->DimensionAspect()->ArrowAspect()->Angle();
Standard_Real aLength = myDrawer->DimensionAspect()->ArrowAspect()->Length();
Standard_Real anAngle = myDrawer->DimensionAspect()->ArrowAspect()->Angle();
if (myDrawer->DimensionAspect()->IsArrows3d())
{
@@ -662,8 +662,8 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
// For extensions we need to know arrow size, text size and extension size: get it from aspect
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
Standard_Real anExtensionSize = aDimensionAspect->ExtensionSize();
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
Standard_Real anExtensionSize = aDimensionAspect->ExtensionSize();
// prepare label string and compute its geometrical width
Standard_Real aLabelWidth;
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
@@ -1308,8 +1308,8 @@ void AIS_Dimension::ComputeSelection (const Handle(SelectMgr_Selection)& theSele
aGroupOfSensitives->Add (new Select3D_SensitiveCurve (aSensitiveOwner, aSensitivePnts));
}
Quantity_Length anArrowLength = myDrawer->DimensionAspect()->ArrowAspect()->Length();
Standard_Real anArrowAngle = myDrawer->DimensionAspect()->ArrowAspect()->Angle();
Standard_Real anArrowLength = myDrawer->DimensionAspect()->ArrowAspect()->Length();
Standard_Real anArrowAngle = myDrawer->DimensionAspect()->ArrowAspect()->Angle();
// sensitives for arrows
SelectionGeometry::SeqOfArrows::Iterator anArrowIt (mySelectionGeom.Arrows);
@@ -1610,7 +1610,7 @@ void AIS_Dimension::FitTextAlignmentForLinear (const gp_Pnt& theFirstPoint,
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
// For extensions we need to know arrow size, text size and extension size: get it from aspect
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
// prepare label string and compute its geometrical width
Standard_Real aLabelWidth;

View File

@@ -547,7 +547,7 @@ Standard_Boolean AIS_LengthDimension::InitTwoShapesPoints (const TopoDS_Shape& t
mySecondPoint = AIS::ProjectPointOnPlane (myFirstPoint, aSecondPlane);
Quantity_Parameter anU, aV;
Standard_Real anU, aV;
ElSLib::Parameters (aSecondPlane, mySecondPoint, anU, aV);
BRepTopAdaptor_FClass2d aClassifier (aSecondFace, Precision::Confusion());

View File

@@ -162,7 +162,7 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
gp_Dir xDir = myPlane->Position().Ax2().XDirection();
gp_Pnt orig = myPlane->Position().Ax2().Location();
Quantity_Length xo,yo,zo,x,y,z;
Standard_Real xo,yo,zo,x,y,z;
orig.Coord( xo, yo, zo );
xDir.Coord( x, y, z );
first.SetCoord( xo, yo, zo );

View File

@@ -23,11 +23,11 @@
IMPLEMENT_STANDARD_RTTIEXT(Aspect_CircularGrid,Aspect_Grid)
Aspect_CircularGrid::Aspect_CircularGrid
(const Quantity_Length aRadiusStep,
(const Standard_Real aRadiusStep,
const Standard_Integer aDivisionNumber,
const Quantity_Length anXOrigin,
const Quantity_Length anYOrigin,
const Quantity_PlaneAngle aRotationAngle)
const Standard_Real anXOrigin,
const Standard_Real anYOrigin,
const Standard_Real aRotationAngle)
:Aspect_Grid(anXOrigin,anYOrigin,aRotationAngle),myRadiusStep(aRadiusStep),
myDivisionNumber(aDivisionNumber) {
}
@@ -47,11 +47,11 @@ void Aspect_CircularGrid::SetDivisionNumber(const Standard_Integer aNumber) {
UpdateDisplay();
}
void Aspect_CircularGrid::SetGridValues
(const Quantity_Length theXOrigin,
const Quantity_Length theYOrigin,
const Quantity_Length theRadiusStep,
(const Standard_Real theXOrigin,
const Standard_Real theYOrigin,
const Standard_Real theRadiusStep,
const Standard_Integer theDivisionNumber,
const Quantity_PlaneAngle theRotationAngle) {
const Standard_Real theRotationAngle) {
myXOrigin = theXOrigin;
myYOrigin = theYOrigin;
Standard_NegativeValue_Raise_if(theRadiusStep < 0., "invalid radius step");
@@ -64,10 +64,10 @@ void Aspect_CircularGrid::SetGridValues
Init();
UpdateDisplay();
}
void Aspect_CircularGrid::Compute(const Quantity_Length X,
const Quantity_Length Y,
Quantity_Length& gridX,
Quantity_Length& gridY) const {
void Aspect_CircularGrid::Compute(const Standard_Real X,
const Standard_Real Y,
Standard_Real& gridX,
Standard_Real& gridY) const {
Standard_Real xo = XOrigin();
Standard_Real yo = YOrigin();
@@ -131,7 +131,7 @@ void Aspect_CircularGrid::Compute(const Quantity_Length X,
gridY = yo + sn * radius;
}
Quantity_Length Aspect_CircularGrid::RadiusStep() const {
Standard_Real Aspect_CircularGrid::RadiusStep() const {
return myRadiusStep;
}

View File

@@ -20,75 +20,55 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Quantity_Length.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Aspect_Grid.hxx>
#include <Quantity_PlaneAngle.hxx>
class Standard_NegativeValue;
class Standard_NullValue;
class Standard_NumericError;
class Aspect_CircularGrid;
DEFINE_STANDARD_HANDLE(Aspect_CircularGrid, Aspect_Grid)
class Aspect_CircularGrid : public Aspect_Grid
{
public:
//! creates a new grid. By default this grid is not
//! active.
Standard_EXPORT Aspect_CircularGrid(const Quantity_Length aRadiusStep, const Standard_Integer aDivisionNumber, const Quantity_Length XOrigin = 0, const Quantity_Length anYOrigin = 0, const Quantity_PlaneAngle aRotationAngle = 0);
Standard_EXPORT Aspect_CircularGrid(const Standard_Real aRadiusStep, const Standard_Integer aDivisionNumber, const Standard_Real XOrigin = 0, const Standard_Real anYOrigin = 0, const Standard_Real aRotationAngle = 0);
//! defines the x step of the grid.
Standard_EXPORT void SetRadiusStep (const Quantity_Length aStep);
Standard_EXPORT void SetRadiusStep (const Standard_Real aStep);
//! defines the step of the grid.
Standard_EXPORT void SetDivisionNumber (const Standard_Integer aNumber);
Standard_EXPORT void SetGridValues (const Quantity_Length XOrigin, const Quantity_Length YOrigin, const Quantity_Length RadiusStep, const Standard_Integer DivisionNumber, const Quantity_PlaneAngle RotationAngle);
Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real RadiusStep, const Standard_Integer DivisionNumber, const Standard_Real RotationAngle);
//! returns the point of the grid the closest to the point X,Y
Standard_EXPORT void Compute (const Quantity_Length X, const Quantity_Length Y, Quantity_Length& gridX, Quantity_Length& gridY) const Standard_OVERRIDE;
Standard_EXPORT void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
//! returns the x step of the grid.
Standard_EXPORT Quantity_Length RadiusStep() const;
Standard_EXPORT Standard_Real RadiusStep() const;
//! returns the x step of the grid.
Standard_EXPORT Standard_Integer DivisionNumber() const;
Standard_EXPORT void Init() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Aspect_CircularGrid,Aspect_Grid)
protected:
private:
Quantity_Length myRadiusStep;
Standard_Real myRadiusStep;
Standard_Integer myDivisionNumber;
Standard_Real myAlpha;
Standard_Real myA1;
Standard_Real myB1;
};
#endif // _Aspect_CircularGrid_HeaderFile

View File

@@ -15,7 +15,7 @@
#define _Aspect_Convert_HeaderFile
#include <Standard.hxx>
#include <Quantity_Parameter.hxx>
#include <Standard_Real.hxx>
//! Auxiliary functions for DCU <-> Pixels conversions.
namespace Aspect_Convert
@@ -27,16 +27,16 @@ namespace Aspect_Convert
}
inline void ConvertCoordinates (const Standard_Integer theParentPxSizeX, const Standard_Integer theParentPxSizeY,
const Quantity_Parameter theQCenterX, const Quantity_Parameter theQCenterY,
const Quantity_Parameter theQSizeX, const Quantity_Parameter theQSizeY,
const Standard_Real theQCenterX, const Standard_Real theQCenterY,
const Standard_Real theQSizeX, const Standard_Real theQSizeY,
Standard_Integer& thePxLeft, Standard_Integer& thePxTop,
Standard_Integer& thePxSizeX, Standard_Integer& thePxSizeY)
{
Quantity_Parameter theParentSizeMin = Min (theParentPxSizeX, theParentPxSizeY);
Standard_Real theParentSizeMin = Min (theParentPxSizeX, theParentPxSizeY);
thePxSizeX = Round (theQSizeX * theParentSizeMin);
thePxSizeY = Round (theQSizeY * theParentSizeMin);
Standard_Integer thePxCenterX = Round(theQCenterX * Quantity_Parameter (theParentPxSizeX));
Standard_Integer thePxCenterY = Round((1.0 - theQCenterY) * Quantity_Parameter (theParentPxSizeY));
Standard_Integer thePxCenterX = Round(theQCenterX * Standard_Real (theParentPxSizeX));
Standard_Integer thePxCenterY = Round((1.0 - theQCenterY) * Standard_Real (theParentPxSizeY));
thePxLeft = thePxCenterX - thePxSizeX / 2;
thePxTop = thePxCenterY - thePxSizeY / 2;
}
@@ -44,16 +44,16 @@ namespace Aspect_Convert
inline void ConvertCoordinates (const Standard_Integer theParentPxSizeX, const Standard_Integer theParentPxSizeY,
const Standard_Integer thePxLeft, const Standard_Integer thePxTop,
const Standard_Integer thePxSizeX, const Standard_Integer thePxSizeY,
Quantity_Parameter& theQCenterX, Quantity_Parameter& theQCenterY,
Quantity_Parameter& theQSizeX, Quantity_Parameter& theQSizeY)
Standard_Real& theQCenterX, Standard_Real& theQCenterY,
Standard_Real& theQSizeX, Standard_Real& theQSizeY)
{
Quantity_Parameter theParentSizeMin = Min (theParentPxSizeX, theParentPxSizeY);
theQSizeX = Quantity_Parameter(thePxSizeX) / theParentSizeMin;
theQSizeY = Quantity_Parameter(thePxSizeY) / theParentSizeMin;
Standard_Real theParentSizeMin = Min (theParentPxSizeX, theParentPxSizeY);
theQSizeX = Standard_Real(thePxSizeX) / theParentSizeMin;
theQSizeY = Standard_Real(thePxSizeY) / theParentSizeMin;
Standard_Integer thePxCenterX = thePxLeft + thePxSizeX / 2;
Standard_Integer thePxCenterY = thePxTop + thePxSizeY / 2;
theQCenterX = Quantity_Parameter (thePxCenterX) / Quantity_Parameter (theParentPxSizeX);
theQCenterY = 1.0 - Quantity_Parameter (thePxCenterY) / Quantity_Parameter (theParentPxSizeY);
theQCenterX = Standard_Real (thePxCenterX) / Standard_Real (theParentPxSizeX);
theQCenterY = 1.0 - Standard_Real (thePxCenterY) / Standard_Real (theParentPxSizeY);
}
inline void FitIn (const Standard_Integer theParentPxSizeX, const Standard_Integer theParentPxSizeY,

View File

@@ -19,9 +19,9 @@
IMPLEMENT_STANDARD_RTTIEXT(Aspect_Grid,MMgt_TShared)
Aspect_Grid::Aspect_Grid(
const Quantity_Length anXOrigin,
const Quantity_Length anYOrigin,
const Quantity_PlaneAngle anAngle,
const Standard_Real anXOrigin,
const Standard_Real anYOrigin,
const Standard_Real anAngle,
const Quantity_Color& aColor,
const Quantity_Color& aTenthColor)
: myRotationAngle(anAngle),
@@ -35,32 +35,32 @@ Aspect_Grid::Aspect_Grid(
}
void Aspect_Grid::SetXOrigin(const Quantity_Length anOrigin) {
void Aspect_Grid::SetXOrigin(const Standard_Real anOrigin) {
myXOrigin = anOrigin;
Init();
UpdateDisplay();
}
void Aspect_Grid::SetYOrigin(const Quantity_Length anOrigin) {
void Aspect_Grid::SetYOrigin(const Standard_Real anOrigin) {
myYOrigin = anOrigin;
Init();
UpdateDisplay();
}
void Aspect_Grid::SetRotationAngle(const Quantity_Length anAngle){
void Aspect_Grid::SetRotationAngle(const Standard_Real anAngle){
myRotationAngle = anAngle;
Init();
UpdateDisplay();
}
void Aspect_Grid::Rotate(const Quantity_PlaneAngle anAngle) {
void Aspect_Grid::Rotate(const Standard_Real anAngle) {
myRotationAngle += anAngle;
Init();
UpdateDisplay();
}
void Aspect_Grid::Translate(const Quantity_Length aDx,
const Quantity_Length aDy) {
void Aspect_Grid::Translate(const Standard_Real aDx,
const Standard_Real aDy) {
myXOrigin += aDx;
myYOrigin += aDy;
Init();
@@ -80,10 +80,10 @@ void Aspect_Grid::Colors(Quantity_Color& aColor,
aTenthColor = myTenthColor;
}
void Aspect_Grid::Hit(const Quantity_Length X,
const Quantity_Length Y,
Quantity_Length& gridX,
Quantity_Length& gridY) const {
void Aspect_Grid::Hit(const Standard_Real X,
const Standard_Real Y,
Standard_Real& gridX,
Standard_Real& gridY) const {
if (myIsActive) {
Compute(X,Y,gridX,gridY);}
else{
@@ -99,15 +99,15 @@ void Aspect_Grid::Deactivate () {
myIsActive = Standard_False;
}
Quantity_Length Aspect_Grid::XOrigin() const {
Standard_Real Aspect_Grid::XOrigin() const {
return myXOrigin;
}
Quantity_Length Aspect_Grid::YOrigin() const {
Standard_Real Aspect_Grid::YOrigin() const {
return myYOrigin;
}
Quantity_Length Aspect_Grid::RotationAngle() const {
Standard_Real Aspect_Grid::RotationAngle() const {
return myRotationAngle;
}

View File

@@ -20,39 +20,33 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Quantity_PlaneAngle.hxx>
#include <Quantity_Length.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Boolean.hxx>
#include <Aspect_GridDrawMode.hxx>
#include <MMgt_TShared.hxx>
class Quantity_Color;
class Aspect_Grid;
DEFINE_STANDARD_HANDLE(Aspect_Grid, MMgt_TShared)
class Aspect_Grid : public MMgt_TShared
{
public:
//! defines the x Origin of the grid.
Standard_EXPORT void SetXOrigin (const Quantity_Length anOrigin);
Standard_EXPORT void SetXOrigin (const Standard_Real anOrigin);
//! defines the y Origin of the grid.
Standard_EXPORT void SetYOrigin (const Quantity_Length anOrigin);
Standard_EXPORT void SetYOrigin (const Standard_Real anOrigin);
//! defines the orientation of the the grid.
Standard_EXPORT void SetRotationAngle (const Quantity_PlaneAngle anAngle);
Standard_EXPORT void SetRotationAngle (const Standard_Real anAngle);
//! Rotate the grid from a relative angle.
Standard_EXPORT void Rotate (const Quantity_PlaneAngle anAngle);
Standard_EXPORT void Rotate (const Standard_Real anAngle);
//! Translate the grid from a relative distance.
Standard_EXPORT void Translate (const Quantity_Length aDx, const Quantity_Length aDy);
Standard_EXPORT void Translate (const Standard_Real aDx, const Standard_Real aDy);
//! Change the colors of the grid
Standard_EXPORT virtual void SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor);
@@ -60,10 +54,10 @@ public:
//! returns the point of the grid the closest to the point X,Y
//! if the grid is active. If the grid is not active returns
//! X,Y.
Standard_EXPORT void Hit (const Quantity_Length X, const Quantity_Length Y, Quantity_Length& gridX, Quantity_Length& gridY) const;
Standard_EXPORT void Hit (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const;
//! returns the point of the grid the closest to the point X,Y
Standard_EXPORT virtual void Compute (const Quantity_Length X, const Quantity_Length Y, Quantity_Length& gridX, Quantity_Length& gridY) const = 0;
Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const = 0;
//! activates the grid. The Hit method will return
//! gridx and gridx computed according to the steps
@@ -75,13 +69,13 @@ public:
Standard_EXPORT void Deactivate();
//! returns the x Origin of the grid.
Standard_EXPORT Quantity_Length XOrigin() const;
Standard_EXPORT Standard_Real XOrigin() const;
//! returns the x Origin of the grid.
Standard_EXPORT Quantity_Length YOrigin() const;
Standard_EXPORT Standard_Real YOrigin() const;
//! returns the x Angle of the grid.
Standard_EXPORT Quantity_PlaneAngle RotationAngle() const;
Standard_EXPORT Standard_Real RotationAngle() const;
//! Returns TRUE when the grid is active.
Standard_EXPORT Standard_Boolean IsActive() const;
@@ -106,41 +100,28 @@ public:
Standard_EXPORT virtual void Init() = 0;
DEFINE_STANDARD_RTTIEXT(Aspect_Grid,MMgt_TShared)
protected:
//! creates a new grid. By default this grid is not
//! active.
Standard_EXPORT Aspect_Grid(const Quantity_Length anXOrigin = 0.0, const Quantity_Length anYOrigin = 0.0, const Quantity_PlaneAngle aRotationAngle = 0, const Quantity_Color& aColor = Quantity_NOC_GRAY50, const Quantity_Color& aTenthColor = Quantity_NOC_GRAY70);
Standard_EXPORT Aspect_Grid(const Standard_Real anXOrigin = 0.0, const Standard_Real anYOrigin = 0.0, const Standard_Real aRotationAngle = 0, const Quantity_Color& aColor = Quantity_NOC_GRAY50, const Quantity_Color& aTenthColor = Quantity_NOC_GRAY70);
//! Updates the grid parameters.
Standard_EXPORT virtual void UpdateDisplay();
Quantity_PlaneAngle myRotationAngle;
Quantity_Length myXOrigin;
Quantity_Length myYOrigin;
Standard_Real myRotationAngle;
Standard_Real myXOrigin;
Standard_Real myYOrigin;
Quantity_Color myColor;
Quantity_Color myTenthColor;
private:
Standard_Boolean myIsActive;
Aspect_GridDrawMode myDrawMode;
};
#endif // _Aspect_Grid_HeaderFile

View File

@@ -65,10 +65,10 @@ public:
virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; }
//! Returns window ratio equal to the physical width/height dimensions.
virtual Quantity_Ratio Ratio() const Standard_OVERRIDE
virtual Standard_Real Ratio() const Standard_OVERRIDE
{
return (myWidth != 0 && myHeight != 0)
? Quantity_Ratio(myWidth) / Quantity_Ratio(myHeight)
? Standard_Real(myWidth) / Standard_Real(myHeight)
: 1.0;
}

View File

@@ -22,13 +22,13 @@
IMPLEMENT_STANDARD_RTTIEXT(Aspect_RectangularGrid,Aspect_Grid)
Aspect_RectangularGrid::Aspect_RectangularGrid(
const Quantity_Length aXStep,
const Quantity_Length aYStep,
const Quantity_Length anXOrigin,
const Quantity_Length anYOrigin,
const Quantity_PlaneAngle aFirstAngle,
const Quantity_PlaneAngle aSecondAngle,
const Quantity_PlaneAngle aRotationAngle)
const Standard_Real aXStep,
const Standard_Real aYStep,
const Standard_Real anXOrigin,
const Standard_Real anYOrigin,
const Standard_Real aFirstAngle,
const Standard_Real aSecondAngle,
const Standard_Real aRotationAngle)
:Aspect_Grid(anXOrigin,anYOrigin,aRotationAngle),myXStep(aXStep),myYStep(aYStep),myFirstAngle(aFirstAngle),mySecondAngle(aSecondAngle)
{
@@ -43,7 +43,7 @@ Aspect_RectangularGrid::Aspect_RectangularGrid(
void Aspect_RectangularGrid::SetXStep(const Quantity_Length aStep) {
void Aspect_RectangularGrid::SetXStep(const Standard_Real aStep) {
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
myXStep = aStep;
@@ -51,7 +51,7 @@ void Aspect_RectangularGrid::SetXStep(const Quantity_Length aStep) {
UpdateDisplay();
}
void Aspect_RectangularGrid::SetYStep(const Quantity_Length aStep) {
void Aspect_RectangularGrid::SetYStep(const Standard_Real aStep) {
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
myYStep = aStep;
@@ -59,9 +59,9 @@ void Aspect_RectangularGrid::SetYStep(const Quantity_Length aStep) {
UpdateDisplay();
}
void Aspect_RectangularGrid::SetAngle(const Quantity_PlaneAngle anAngle1,
const Quantity_PlaneAngle anAngle2){
void Aspect_RectangularGrid::SetAngle (const Standard_Real anAngle1,
const Standard_Real anAngle2)
{
Standard_NumericError_Raise_if(!CheckAngle (anAngle1,anAngle2 ),
"axis are parallel");
myFirstAngle = anAngle1;
@@ -71,11 +71,11 @@ void Aspect_RectangularGrid::SetAngle(const Quantity_PlaneAngle anAngle1,
}
void Aspect_RectangularGrid::SetGridValues(
const Quantity_Length theXOrigin,
const Quantity_Length theYOrigin,
const Quantity_Length theXStep,
const Quantity_Length theYStep,
const Quantity_PlaneAngle theRotationAngle) {
const Standard_Real theXOrigin,
const Standard_Real theYOrigin,
const Standard_Real theXStep,
const Standard_Real theYStep,
const Standard_Real theRotationAngle) {
myXOrigin = theXOrigin;
myYOrigin = theYOrigin;
@@ -90,10 +90,10 @@ void Aspect_RectangularGrid::SetGridValues(
UpdateDisplay();
}
void Aspect_RectangularGrid::Compute(const Quantity_Length X,
const Quantity_Length Y,
Quantity_Length& gridX,
Quantity_Length& gridY) const {
void Aspect_RectangularGrid::Compute(const Standard_Real X,
const Standard_Real Y,
Standard_Real& gridX,
Standard_Real& gridY) const {
Standard_Real D1 = b1 * X - a1 * Y - c1;
Standard_Real D2 = b2 * X - a2 * Y - c2;
Standard_Integer n1 = Standard_Integer ( Abs(D1)/myXStep + 0.5);
@@ -105,19 +105,19 @@ void Aspect_RectangularGrid::Compute(const Quantity_Length X,
gridY = ( offset2*b1 - offset1*b2) /Delta;
}
Quantity_Length Aspect_RectangularGrid::XStep() const {
Standard_Real Aspect_RectangularGrid::XStep() const {
return myXStep;
}
Quantity_Length Aspect_RectangularGrid::YStep() const {
Standard_Real Aspect_RectangularGrid::YStep() const {
return myYStep;
}
Quantity_Length Aspect_RectangularGrid::FirstAngle() const {
Standard_Real Aspect_RectangularGrid::FirstAngle() const {
return myFirstAngle;
}
Quantity_Length Aspect_RectangularGrid::SecondAngle() const {
Standard_Real Aspect_RectangularGrid::SecondAngle() const {
return mySecondAngle;
}

View File

@@ -20,8 +20,6 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Quantity_Length.hxx>
#include <Quantity_PlaneAngle.hxx>
#include <Standard_Real.hxx>
#include <Aspect_Grid.hxx>
#include <Standard_Boolean.hxx>
@@ -29,11 +27,9 @@ class Standard_NegativeValue;
class Standard_NullValue;
class Standard_NumericError;
class Aspect_RectangularGrid;
DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid)
class Aspect_RectangularGrid : public Aspect_Grid
{
@@ -44,57 +40,48 @@ public:
//! active.
//! The first angle is given relatively to the horizontal.
//! The second angle is given relatively to the vertical.
Standard_EXPORT Aspect_RectangularGrid(const Quantity_Length aXStep, const Quantity_Length aYStep, const Quantity_Length anXOrigin = 0, const Quantity_Length anYOrigin = 0, const Quantity_PlaneAngle aFirstAngle = 0, const Quantity_PlaneAngle aSecondAngle = 0, const Quantity_PlaneAngle aRotationAngle = 0);
Standard_EXPORT Aspect_RectangularGrid(const Standard_Real aXStep, const Standard_Real aYStep, const Standard_Real anXOrigin = 0, const Standard_Real anYOrigin = 0, const Standard_Real aFirstAngle = 0, const Standard_Real aSecondAngle = 0, const Standard_Real aRotationAngle = 0);
//! defines the x step of the grid.
Standard_EXPORT void SetXStep (const Quantity_Length aStep);
Standard_EXPORT void SetXStep (const Standard_Real aStep);
//! defines the y step of the grid.
Standard_EXPORT void SetYStep (const Quantity_Length aStep);
Standard_EXPORT void SetYStep (const Standard_Real aStep);
//! defines the angle of the second network
//! the fist angle is given relatively to the horizontal.
//! the second angle is given relatively to the vertical.
Standard_EXPORT void SetAngle (const Quantity_PlaneAngle anAngle1, const Quantity_PlaneAngle anAngle2);
Standard_EXPORT void SetAngle (const Standard_Real anAngle1, const Standard_Real anAngle2);
Standard_EXPORT void SetGridValues (const Quantity_Length XOrigin, const Quantity_Length YOrigin, const Quantity_Length XStep, const Quantity_Length YStep, const Quantity_PlaneAngle RotationAngle);
Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real XStep, const Standard_Real YStep, const Standard_Real RotationAngle);
//! returns the point of the grid the closest to the point X,Y
Standard_EXPORT void Compute (const Quantity_Length X, const Quantity_Length Y, Quantity_Length& gridX, Quantity_Length& gridY) const Standard_OVERRIDE;
Standard_EXPORT void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
//! returns the x step of the grid.
Standard_EXPORT Quantity_Length XStep() const;
Standard_EXPORT Standard_Real XStep() const;
//! returns the x step of the grid.
Standard_EXPORT Quantity_Length YStep() const;
Standard_EXPORT Standard_Real YStep() const;
//! returns the x Angle of the grid, relatively to the horizontal.
Standard_EXPORT Quantity_PlaneAngle FirstAngle() const;
Standard_EXPORT Standard_Real FirstAngle() const;
//! returns the y Angle of the grid, relatively to the vertical.
Standard_EXPORT Quantity_PlaneAngle SecondAngle() const;
Standard_EXPORT Standard_Real SecondAngle() const;
Standard_EXPORT void Init() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid,Aspect_Grid)
protected:
private:
Standard_EXPORT Standard_Boolean CheckAngle (const Quantity_PlaneAngle alpha, const Quantity_PlaneAngle beta) const;
Standard_EXPORT Standard_Boolean CheckAngle (const Standard_Real alpha, const Standard_Real beta) const;
Quantity_Length myXStep;
Quantity_Length myYStep;
Quantity_PlaneAngle myFirstAngle;
Quantity_PlaneAngle mySecondAngle;
Standard_Real myXStep;
Standard_Real myYStep;
Standard_Real myFirstAngle;
Standard_Real mySecondAngle;
Standard_Real a1;
Standard_Real b1;
Standard_Real c1;
@@ -102,13 +89,6 @@ private:
Standard_Real b2;
Standard_Real c2;
};
#endif // _Aspect_RectangularGrid_HeaderFile

View File

@@ -28,7 +28,6 @@
#include <Quantity_Color.hxx>
#include <Aspect_GradientFillMethod.hxx>
#include <Aspect_TypeOfResize.hxx>
#include <Quantity_Ratio.hxx>
#include <Standard_Integer.hxx>
#include <Aspect_Drawable.hxx>
class Aspect_WindowDefinitionError;
@@ -91,7 +90,7 @@ public:
//! Returns The Window RATIO equal to the physical
//! WIDTH/HEIGHT dimensions
Standard_EXPORT virtual Quantity_Ratio Ratio() const = 0;
Standard_EXPORT virtual Standard_Real Ratio() const = 0;
//! Returns The Window POSITION in PIXEL
Standard_EXPORT virtual void Position (Standard_Integer& X1, Standard_Integer& Y1, Standard_Integer& X2, Standard_Integer& Y2) const = 0;

View File

@@ -19,6 +19,7 @@
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_DataMapOfIntegerListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_ListOfInteger.hxx>
@@ -60,15 +61,6 @@
static
Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
const BOPDS_FaceInfo& aFI2);
static
void FillMap(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
BOPCol_IndexedDataMapOfShapeListOfShape& aDMSLS,
Handle(NCollection_BaseAllocator)& aAllocator);
static
void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI,
BOPCol_DataMapOfIntegerListOfShape& aMBlocks,
Handle(NCollection_BaseAllocator)& aAllocator);
//
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
//
@@ -475,7 +467,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
void BOPAlgo_Builder::FillSameDomainFaces()
{
Standard_Boolean bFlag;
Standard_Integer i, j, k, aNbFFs, nF1, nF2, aNbS;
Standard_Integer i, j, k, aNbFFs, nF1, nF2;
Handle(NCollection_BaseAllocator) aAllocator;
BOPCol_ListIteratorOfListOfShape aItF;
BOPCol_MapOfShape aMFence;
@@ -605,7 +597,7 @@ void BOPAlgo_Builder::FillSameDomainFaces()
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
BOPCol_IndexedDataMapOfShapeListOfShape aDMSLS(100, aAllocator);
BOPCol_DataMapOfIntegerListOfShape aMBlocks(100, aAllocator);
NCollection_List<BOPCol_ListOfShape> aMBlocks(aAllocator);
//
aNbVPSB=aVPSB.Extent();
for (i=0; i<aNbVPSB; ++i) {
@@ -614,21 +606,18 @@ void BOPAlgo_Builder::FillSameDomainFaces()
if (bFlagSD) {
const TopoDS_Shape& aFj=aPSB.Shape1();
const TopoDS_Shape& aFk=aPSB.Shape2();
FillMap(aFj, aFk, aDMSLS, aAllocator);
BOPAlgo_Tools::FillMap<TopoDS_Shape, TopTools_ShapeMapHasher>(aFj, aFk, aDMSLS, aAllocator);
}
}
aVPSB.Clear();
//
// 2. Make blocks
MakeBlocksCnx(aDMSLS, aMBlocks, aAllocator);
BOPAlgo_Tools::MakeBlocks<TopoDS_Shape, TopTools_ShapeMapHasher>(aDMSLS, aMBlocks, aAllocator);
//
// 3. Fill same domain faces map -> aMSDF
aNbS = aMBlocks.Extent();
for (i=0; i<aNbS; ++i) {
const BOPCol_ListOfShape& aLSD=aMBlocks.Find(i);
if (aLSD.IsEmpty()) {
continue;
}
NCollection_List<BOPCol_ListOfShape>::Iterator aItB(aMBlocks);
for (; aItB.More(); aItB.Next()) {
const BOPCol_ListOfShape& aLSD = aItB.Value();
//
const TopoDS_Shape& aFSD1=aLSD.First();
aItF.Initialize(aLSD);
@@ -753,116 +742,6 @@ void BOPAlgo_Builder::FillImagesFaces1()
}
}
//=======================================================================
//function : MakeBlocksCnx
//purpose :
//=======================================================================
void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI,
BOPCol_DataMapOfIntegerListOfShape& aMBlocks,
Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer aNbV, aNbVS, aNbVP, aNbEC, k, i, j;
BOPCol_ListIteratorOfListOfShape aItLI;
//
BOPCol_MapOfShape aMVS(100, aAllocator);
BOPCol_IndexedMapOfShape aMEC(100, aAllocator);
BOPCol_IndexedMapOfShape aMVP(100, aAllocator);
BOPCol_IndexedMapOfShape aMVAdd(100, aAllocator);
//
aNbV=aMILI.Extent();
//
for (k=0,i=1; i<=aNbV; ++i) {
aNbVS=aMVS.Extent();
if (aNbVS==aNbV) {
break;
}
//
const TopoDS_Shape& nV=aMILI.FindKey(i);
if (aMVS.Contains(nV)){
continue;
}
aMVS.Add(nV);
//
aMEC.Clear();
aMVP.Clear();
aMVAdd.Clear();
//
aMVP.Add(nV);
for(;;) {
aNbVP=aMVP.Extent();
for (j=1; j<=aNbVP; ++j) {
const TopoDS_Shape& nVP=aMVP(j);
const BOPCol_ListOfShape& aLV=aMILI.FindFromKey(nVP);
aItLI.Initialize(aLV);
for (; aItLI.More(); aItLI.Next()) {
const TopoDS_Shape& nVx=aItLI.Value();
if (aMEC.Contains(nVx)) {
continue;
}
//
aMVS.Add(nVx);
aMEC.Add(nVx);
aMVAdd.Add(nVx);
}
}
//
aNbVP=aMVAdd.Extent();
if (!aNbVP) {
break; // from while(1)
}
//
aMVP.Clear();
for (j=1; j<=aNbVP; ++j) {
aMVP.Add(aMVAdd(j));
}
aMVAdd.Clear();
}//while(1) {
//
BOPCol_ListOfShape aLIx(aAllocator);
//
aNbEC = aMEC.Extent();
for (j=1; j<=aNbEC; ++j) {
const TopoDS_Shape& nVx=aMEC(j);
aLIx.Append(nVx);
}
//
aMBlocks.Bind(k, aLIx);
++k;
}//for (k=0,i=1; i<=aNbV; ++i)
aMVAdd.Clear();
aMVP.Clear();
aMEC.Clear();
aMVS.Clear();
}
//=======================================================================
//function : FillMap
//purpose :
//=======================================================================
void FillMap(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
BOPCol_IndexedDataMapOfShapeListOfShape& aDMSLS,
Handle(NCollection_BaseAllocator)& aAllocator)
{
if (aDMSLS.Contains(aS1)) {
BOPCol_ListOfShape& aLS=aDMSLS.ChangeFromKey(aS1);
aLS.Append(aS2);
}
else {
BOPCol_ListOfShape aLS(aAllocator);
aLS.Append(aS2);
aDMSLS.Add(aS1, aLS);
}
//
if (aDMSLS.Contains(aS2)) {
BOPCol_ListOfShape& aLS=aDMSLS.ChangeFromKey(aS2);
aLS.Append(aS1);
}
else {
BOPCol_ListOfShape aLS(aAllocator);
aLS.Append(aS1);
aDMSLS.Add(aS2, aLS);
}
}
//=======================================================================
//function :HasPaveBlocksOnIn
//purpose :
//=======================================================================
@@ -897,22 +776,3 @@ Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
}
return bRet;
}
/*
//DEBf
{
TopoDS_Compound aCx;
BRep_Builder aBBx;
BOPCol_ListIteratorOfListOfShape aItx;
//
aBBx.MakeCompound(aCx);
aBBx.Add(aCx, aFF);
aItx.Initialize(aLE);
for (; aItx.More(); aItx.Next()) {
const TopoDS_Shape& aEx=aItx.Value();
aBBx.Add(aCx, aEx);
}
int a=0;
}
//DEBt
*/

View File

@@ -22,6 +22,7 @@
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPDS_Curve.hxx>
@@ -48,7 +49,7 @@
//=======================================================================
void BOPAlgo_PaveFiller::PerformVV()
{
Standard_Integer n1, n2, iFlag, aSize, k, aNbBlocks;
Standard_Integer n1, n2, iFlag, aSize;
Handle(NCollection_BaseAllocator) aAllocator;
//
myErrorStatus=0;
@@ -66,7 +67,7 @@ void BOPAlgo_PaveFiller::PerformVV()
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
BOPCol_IndexedDataMapOfIntegerListOfInteger aMILI(100, aAllocator);
BOPCol_DataMapOfIntegerListOfInteger aMBlocks(100, aAllocator);
NCollection_List<BOPCol_ListOfInteger> aMBlocks(aAllocator);
//
// 1. Map V/LV
for (; myIterator->More(); myIterator->Next()) {
@@ -77,18 +78,17 @@ void BOPAlgo_PaveFiller::PerformVV()
//
iFlag=BOPTools_AlgoTools::ComputeVV(aV1, aV2, myFuzzyValue);
if (!iFlag) {
BOPAlgo_Tools::FillMap(n1, n2, aMILI, aAllocator);
BOPAlgo_Tools::FillMap<Standard_Integer, TColStd_MapIntegerHasher>(n1, n2, aMILI, aAllocator);
}
}
//
// 2. Make blocks
BOPAlgo_Tools::MakeBlocksCnx(aMILI, aMBlocks, aAllocator);
BOPAlgo_Tools::MakeBlocks<Standard_Integer, TColStd_MapIntegerHasher>(aMILI, aMBlocks, aAllocator);
//
// 3. Make vertices
aNbBlocks=aMBlocks.Extent();
for (k=0; k<aNbBlocks; ++k) {
const BOPCol_ListOfInteger& aLI=aMBlocks.Find(k);
//
NCollection_List<BOPCol_ListOfInteger>::Iterator aItB(aMBlocks);
for (; aItB.More(); aItB.Next()) {
const BOPCol_ListOfInteger& aLI = aItB.Value();
MakeSDVertices(aLI);
}
//

View File

@@ -220,7 +220,6 @@ void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
}
//
if (aMCB.Add(aCB)) {
myDS->SortPaveBlocks(aCB);
aPB->Indices(nV1, nV2);
UpdateVertex(nV1, aTolV);
UpdateVertex(nV2, aTolV);

View File

@@ -632,7 +632,7 @@ void BOPAlgo_PaveFiller::PerformEE()
// 2
myDS->AddInterf(nE1, nE2);
//
BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
BOPAlgo_Tools::FillMap<Handle(BOPDS_PaveBlock), TColStd_MapTransientHasher>(aPB1, aPB2, aMPBLPB, aAllocator);
}//case TopAbs_EDGE
break;
default:

View File

@@ -844,6 +844,15 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
}
aPDS=aPF.PDS();
//
// Map to store the real tolerance of the common block
// and avoid repeated computation of it
NCollection_DataMap<Handle(BOPDS_CommonBlock),
Standard_Real,
TColStd_MapTransientHasher> aMCBTol;
// Map to avoid creation of different pave blocks for
// the same intersection edge
NCollection_DataMap<Standard_Integer, Handle(BOPDS_PaveBlock)> aMEPB;
//
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSx=aItLS.Value();
@@ -982,37 +991,46 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
// add edge
aE=aPDS->Shape(aPBRx->Edge());
iE = myDS->Index(aE);
//
if (iE < 0) {
aSI.SetShapeType(aType);
aSI.SetShape(aE);
iE=myDS->Append(aSI);
// update real edge tolerance according to distances in common block if any
if (aPDS->IsCommonBlock(aPBRx)) {
const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBRx);
}
//
// update real edge tolerance according to distances in common block if any
if (aPDS->IsCommonBlock(aPBRx)) {
const Handle(BOPDS_CommonBlock)& aCB = aPDS->CommonBlock(aPBRx);
Standard_Real *pTol = aMCBTol.ChangeSeek(aCB);
if (!pTol) {
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, aPDS, aPF.Context());
if (aNC.Tolerance() < aTol) {
aNC.SetTolerance(aTol);
}
pTol = aMCBTol.Bound(aCB, aTol);
}
//
if (aNC.Tolerance() < *pTol) {
aNC.SetTolerance(*pTol);
}
}
// append new PaveBlock to aLPBC
Handle(BOPDS_PaveBlock) aPBC=new BOPDS_PaveBlock();
BOPDS_Pave aPaveR1, aPaveR2;
aPaveR1 = aPBRx->Pave1();
aPaveR2 = aPBRx->Pave2();
aPaveR1.SetIndex(myDS->Index(aPDS->Shape(aPaveR1.Index())));
aPaveR2.SetIndex(myDS->Index(aPDS->Shape(aPaveR2.Index())));
Handle(BOPDS_PaveBlock) *pPBC = aMEPB.ChangeSeek(iE);
if (!pPBC) {
pPBC = aMEPB.Bound(iE, new BOPDS_PaveBlock());
BOPDS_Pave aPaveR1, aPaveR2;
aPaveR1 = aPBRx->Pave1();
aPaveR2 = aPBRx->Pave2();
aPaveR1.SetIndex(myDS->Index(aPDS->Shape(aPaveR1.Index())));
aPaveR2.SetIndex(myDS->Index(aPDS->Shape(aPaveR2.Index())));
//
(*pPBC)->SetPave1(aPaveR1);
(*pPBC)->SetPave2(aPaveR2);
(*pPBC)->SetEdge(iE);
}
//
aPBC->SetPave1(aPaveR1);
aPBC->SetPave2(aPaveR2);
aPBC->SetEdge(iE);
if (bOld) {
aPBC->SetOriginalEdge(aPB1->OriginalEdge());
aDMExEdges.ChangeFind(aPB1).Append(aPBC);
(*pPBC)->SetOriginalEdge(aPB1->OriginalEdge());
aDMExEdges.ChangeFind(aPB1).Append(*pPBC);
}
else {
aLPBC.Append(aPBC);
aLPBC.Append(*pPBC);
}
}
}
@@ -2228,12 +2246,13 @@ void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
//
// 2. Update pave blocks
if (bCB) {
//create new common blocks
// Create new common blocks
BOPDS_ListOfPaveBlock aLPBNew;
const BOPCol_ListOfInteger& aFaces = aCB1->Faces();
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
const Handle(BOPDS_PaveBlock)& aPBValue = aIt.Value();
BOPDS_Pave aPBValuePaves[2] = {aPBValue->Pave1(), aPBValue->Pave2()};
//
aCB = new BOPDS_CommonBlock;
aIt1.Initialize(aLPB1);
@@ -2241,9 +2260,60 @@ void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
aPB2 = aIt1.Value();
nE = aPB2->OriginalEdge();
//
// Create new pave block
aPB2n = new BOPDS_PaveBlock;
aPB2n->SetPave1(aPBValue->Pave1());
aPB2n->SetPave2(aPBValue->Pave2());
if (aPBValue->OriginalEdge() == nE) {
aPB2n->SetPave1(aPBValuePaves[0]);
aPB2n->SetPave2(aPBValuePaves[1]);
}
else {
// For the different original edge compute the parameters of paves
BOPDS_Pave aPave[2];
for (Standard_Integer i = 0; i < 2; ++i) {
Standard_Integer nV = aPBValuePaves[i].Index();
aPave[i].SetIndex(nV);
if (nV == aPB2->Pave1().Index()) {
aPave[i].SetParameter(aPB2->Pave1().Parameter());
}
else if (nV == aPB2->Pave2().Index()) {
aPave[i].SetParameter(aPB2->Pave2().Parameter());
}
else {
// Compute the parameter by projecting the point
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV));
const TopoDS_Edge& aEOr = TopoDS::Edge(myDS->Shape(nE));
Standard_Real aTOut, aDist;
Standard_Integer iErr = myContext->ComputeVE(aV, aEOr, aTOut, aDist, myFuzzyValue);
if (!iErr) {
aPave[i].SetParameter(aTOut);
}
else {
// Unable to project - set the parameter of the closest boundary
const TopoDS_Vertex& aV1 = TopoDS::Vertex(myDS->Shape(aPB2->Pave1().Index()));
const TopoDS_Vertex& aV2 = TopoDS::Vertex(myDS->Shape(aPB2->Pave2().Index()));
//
gp_Pnt aP = BRep_Tool::Pnt(aV);
gp_Pnt aP1 = BRep_Tool::Pnt(aV1);
gp_Pnt aP2 = BRep_Tool::Pnt(aV2);
//
Standard_Real aDist1 = aP.SquareDistance(aP1);
Standard_Real aDist2 = aP.SquareDistance(aP2);
//
aPave[i].SetParameter(aDist1 < aDist2 ? aPB2->Pave1().Parameter() : aPB2->Pave2().Parameter());
}
}
}
//
if (aPave[1].Parameter() < aPave[0].Parameter()) {
BOPDS_Pave aPaveTmp = aPave[0];
aPave[0] = aPave[1];
aPave[1] = aPaveTmp;
}
//
aPB2n->SetPave1(aPave[0]);
aPB2n->SetPave2(aPave[1]);
}
//
aPB2n->SetEdge(aPBValue->Edge());
aPB2n->SetOriginalEdge(nE);
aCB->AddPaveBlock(aPB2n);
@@ -2251,7 +2321,6 @@ void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
myDS->ChangePaveBlocks(nE).Append(aPB2n);
}
aCB->SetFaces(aFaces);
myDS->SortPaveBlocks(aCB);
//
const Handle(BOPDS_PaveBlock)& aPBNew = aCB->PaveBlocks().First();
aLPBNew.Append(aPBNew);
@@ -2788,6 +2857,8 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF();
NCollection_IndexedDataMap<Standard_Integer,BOPDS_ListOfPaveBlock> aMVIPBs;
BOPCol_MapOfInteger aMVIToReduce;
// Fence map to avoid repeated checking of the same edge
BOPDS_MapOfPaveBlock aMPB;
//
// 1. iterate on all sections F-F
Standard_Integer aNb = aFFs.Extent(), i;
@@ -2808,6 +2879,11 @@ void BOPAlgo_PaveFiller::CorrectToleranceOfSE()
continue;
}
//
if (!aMPB.Add(aPB)) {
aItLPB.Next();
continue;
}
//
Standard_Boolean bIsReduced = Standard_False;
if (aPB->OriginalEdge() < 0) {
// It is possible that due to small angle between faces the

View File

@@ -393,13 +393,20 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
bCB=myDS->IsCommonBlock(aPB);
//
if (!(bV1 || bV2)) { // no new vertices here
if (!myNonDestructive || (myNonDestructive && !bCB)) {
nE = aPB->OriginalEdge();
aPB->SetEdge(nE);
if (!myNonDestructive && bCB) {
const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, myDS, myContext);
myDS->UpdateEdgeTolerance(nE, aTol);
if (!myNonDestructive || !bCB) {
if (bCB) {
if (!aPB->HasEdge()) {
const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
nE = aCB->PaveBlock1()->OriginalEdge();
aCB->SetEdge(nE);
// Compute tolerance of the common block and update the edge
Standard_Real aTol = BOPAlgo_Tools::ComputeToleranceOfCB(aCB, myDS, myContext);
myDS->UpdateEdgeTolerance(nE, aTol);
}
}
else {
nE = aPB->OriginalEdge();
aPB->SetEdge(nE);
}
continue;
}
@@ -418,7 +425,6 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
bCB=!aCB.IsNull();
if (bCB) {
myDS->SortPaveBlocks(aCB);
aPB=aCB->PaveBlock1();
}
//

View File

@@ -94,143 +94,6 @@ static
Standard_Boolean FindEdgeTangent(const BRepAdaptor_Curve& theCurve,
gp_Vec& theTangent);
//=======================================================================
//function : MakeBlocksCnx
//purpose :
//=======================================================================
void BOPAlgo_Tools::MakeBlocksCnx(const BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
BOPCol_DataMapOfIntegerListOfInteger& aMBlocks,
const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer aNbV, nV, aNbVS, nVP, nVx, aNbVP, aNbEC, k, i, j;
BOPCol_ListIteratorOfListOfInteger aItLI;
//
BOPCol_MapOfInteger aMVS(100, aAllocator);
BOPCol_IndexedMapOfInteger aMEC(100, aAllocator);
BOPCol_IndexedMapOfInteger aMVP(100, aAllocator);
BOPCol_IndexedMapOfInteger aMVAdd(100, aAllocator);
//
aNbV=aMILI.Extent();
//
for (k=0,i=1; i<=aNbV; ++i) {
aNbVS=aMVS.Extent();
if (aNbVS==aNbV) {
break;
}
//
nV = aMILI.FindKey(i);
if (aMVS.Contains(nV)){
continue;
}
aMVS.Add(nV);
//
aMEC.Clear();
aMVP.Clear();
aMVAdd.Clear();
//
aMVP.Add(nV);
for(;;) {
aNbVP=aMVP.Extent();
for (j=1; j<=aNbVP; ++j) {
nVP=aMVP(j);
const BOPCol_ListOfInteger& aLV=aMILI.FindFromKey(nVP);
aItLI.Initialize(aLV);
for (; aItLI.More(); aItLI.Next()) {
nVx=aItLI.Value();
if (aMEC.Contains(nVx)) {
continue;
}
//
aMVS.Add(nVx);
aMEC.Add(nVx);
aMVAdd.Add(nVx);
}
}
//
aNbVP=aMVAdd.Extent();
if (!aNbVP) {
break; // from while(1)
}
//
aMVP.Clear();
for (j=1; j<=aNbVP; ++j) {
aMVP.Add(aMVAdd(j));
}
aMVAdd.Clear();
}//while(1) {
//
BOPCol_ListOfInteger aLIx(aAllocator);
//
aNbEC = aMEC.Extent();
for (j=1; j<=aNbEC; ++j) {
nVx=aMEC(j);
aLIx.Append(nVx);
}
//
aMBlocks.Bind(k, aLIx);
++k;
}//for (k=0,i=1; i<=aNbV; ++i)
aMVAdd.Clear();
aMVP.Clear();
aMEC.Clear();
aMVS.Clear();
}
//=======================================================================
//function : FillMap
//purpose :
//=======================================================================
void BOPAlgo_Tools::FillMap(const Standard_Integer n1,
const Standard_Integer n2,
BOPCol_IndexedDataMapOfIntegerListOfInteger& aMILI,
const Handle(NCollection_BaseAllocator)& aAllocator)
{
if (aMILI.Contains(n1)) {
BOPCol_ListOfInteger& aLI=aMILI.ChangeFromKey(n1);
aLI.Append(n2);
}
else {
BOPCol_ListOfInteger aLI(aAllocator);
aLI.Append(n2);
aMILI.Add(n1, aLI);
}
if (aMILI.Contains(n2)) {
BOPCol_ListOfInteger& aLI=aMILI.ChangeFromKey(n2);
aLI.Append(n1);
}
else {
BOPCol_ListOfInteger aLI(aAllocator);
aLI.Append(n1);
aMILI.Add(n2, aLI);
}
}
//=======================================================================
//function : FillMap
//purpose :
//=======================================================================
void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB1,
const Handle(BOPDS_PaveBlock)& aPB2,
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMPBLPB,
const Handle(NCollection_BaseAllocator)& aAllocator)
{
if (aMPBLPB.Contains(aPB1)) {
BOPDS_ListOfPaveBlock& aLPB=aMPBLPB.ChangeFromKey(aPB1);
aLPB.Append(aPB2);
}
else {
BOPDS_ListOfPaveBlock aLPB(aAllocator);
aLPB.Append(aPB2);
aMPBLPB.Add(aPB1, aLPB);
}
if (aMPBLPB.Contains(aPB2)) {
BOPDS_ListOfPaveBlock& aLPB=aMPBLPB.ChangeFromKey(aPB2);
aLPB.Append(aPB1);
}
else {
BOPDS_ListOfPaveBlock aLPB(aAllocator);
aLPB.Append(aPB1);
aMPBLPB.Add(aPB2, aLPB);
}
}
//=======================================================================
//function : FillMap
//purpose :
@@ -240,96 +103,11 @@ void BOPAlgo_Tools::FillMap(const Handle(BOPDS_PaveBlock)& aPB,
BOPDS_IndexedDataMapOfPaveBlockListOfInteger& aMPBLI,
const Handle(NCollection_BaseAllocator)& aAllocator)
{
if (aMPBLI.Contains(aPB)) {
BOPCol_ListOfInteger& aLI=aMPBLI.ChangeFromKey(aPB);
aLI.Append(nF);
BOPCol_ListOfInteger *pLI = aMPBLI.ChangeSeek(aPB);
if (!pLI) {
pLI = &aMPBLI(aMPBLI.Add(aPB, BOPCol_ListOfInteger(aAllocator)));
}
else {
BOPCol_ListOfInteger aLI(aAllocator);
aLI.Append(nF);
aMPBLI.Add(aPB, aLI);
}
}
//=======================================================================
//function : MakeBlocks
//purpose :
//=======================================================================
void BOPAlgo_Tools::MakeBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& aMILI,
BOPDS_DataMapOfIntegerListOfPaveBlock& aMBlocks,
const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer aNbV, aNbVS, aNbVP, aNbEC, k, i, j;
BOPDS_ListIteratorOfListOfPaveBlock aItLI;
//
BOPDS_MapOfPaveBlock aMVS(100, aAllocator);
BOPDS_IndexedMapOfPaveBlock aMEC(100, aAllocator);
BOPDS_IndexedMapOfPaveBlock aMVP(100, aAllocator);
BOPDS_IndexedMapOfPaveBlock aMVAdd(100, aAllocator);
//
aNbV=aMILI.Extent();
//
for (k=0, i=1; i<=aNbV; ++i) {
aNbVS=aMVS.Extent();
if (aNbVS==aNbV) {
break;
}
//
const Handle(BOPDS_PaveBlock)& nV=aMILI.FindKey(i);
if (aMVS.Contains(nV)){
continue;
}
aMVS.Add(nV);
//
aMEC.Clear();
aMVP.Clear();
aMVAdd.Clear();
//
aMVP.Add(nV);
for(;;) {
aNbVP=aMVP.Extent();
for (j=1; j<=aNbVP; ++j) {
const Handle(BOPDS_PaveBlock)& nVP=aMVP(j);
const BOPDS_ListOfPaveBlock& aLV=aMILI.FindFromKey(nVP);
aItLI.Initialize(aLV);
for (; aItLI.More(); aItLI.Next()) {
const Handle(BOPDS_PaveBlock)& nVx=aItLI.Value();
if (aMEC.Contains(nVx)) {
continue;
}
//
aMVS.Add(nVx);
aMEC.Add(nVx);
aMVAdd.Add(nVx);
}
}
//
aNbVP=aMVAdd.Extent();
if (!aNbVP) {
break; // from while(1)
}
//
aMVP.Clear();
for (j=1; j<=aNbVP; ++j) {
aMVP.Add(aMVAdd(j));
}
aMVAdd.Clear();
}//while(1) {
//
BOPDS_ListOfPaveBlock aLIx(aAllocator);
//
aNbEC = aMEC.Extent();
for (j=1; j<=aNbEC; ++j) {
const Handle(BOPDS_PaveBlock)& nVx=aMEC(j);
aLIx.Append(nVx);
}
//
aMBlocks.Bind(k, aLIx);
++k;
}//for (k=0, i=1; i<=aNbV; ++i)
aMVAdd.Clear();
aMVP.Clear();
aMEC.Clear();
aMVS.Clear();
pLI->Append(nF);
}
//=======================================================================
//function : PerformCommonBlocks
@@ -346,30 +124,22 @@ void BOPAlgo_Tools::PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPav
return;
}
//
Standard_Integer aNbPB, aNbBlocks, k;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
Handle(BOPDS_CommonBlock) aCB;
BOPDS_DataMapOfIntegerListOfPaveBlock aMBlocks(100, aAllocator);
NCollection_List<BOPDS_ListOfPaveBlock> aMBlocks(aAllocator);
//
BOPAlgo_Tools::MakeBlocks(aMPBLPB, aMBlocks, aAllocator);
BOPAlgo_Tools::MakeBlocks<Handle(BOPDS_PaveBlock), TColStd_MapTransientHasher>(aMPBLPB, aMBlocks, aAllocator);
//
aNbBlocks = aMBlocks.Extent();
for (k=0; k<aNbBlocks; ++k) {
const BOPDS_ListOfPaveBlock& aLPB=aMBlocks.Find(k);
aNbPB=aLPB.Extent();
NCollection_List<BOPDS_ListOfPaveBlock>::Iterator aItB(aMBlocks);
for (; aItB.More(); aItB.Next()) {
const BOPDS_ListOfPaveBlock& aLPB = aItB.Value();
Standard_Integer aNbPB = aLPB.Extent();
if (aNbPB>1) {
aCB=new BOPDS_CommonBlock;
aCB->SetPaveBlocks(aLPB);
//
aItLPB.Initialize(aLPB);
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
aCB->AddPaveBlock(aPBx);
}
//
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
pDS->SetCommonBlock(aPBx, aCB);
pDS->SetCommonBlock(aItLPB.Value(), aCB);
}
}//if (aNbPB>1) {
}

View File

@@ -19,40 +19,86 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPDS_DataMapOfIntegerListOfPaveBlock.hxx>
#include <BOPDS_PDS.hxx>
#include <Standard_Integer.hxx>
#include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
class BOPDS_PaveBlock;
class BOPDS_CommonBlock;
class IntTools_Context;
class TopoDS_Shape;
class BOPAlgo_Tools
class BOPAlgo_Tools
{
public:
DEFINE_STANDARD_ALLOC
//! Makes the chains of the connected elements from the given connexity map
template <class theType, class theTypeHasher>
static void MakeBlocks(const NCollection_IndexedDataMap<theType, NCollection_List<theType>, theTypeHasher>& theMILI,
NCollection_List<NCollection_List<theType>>& theMBlocks,
const BOPCol_BaseAllocator& theAllocator)
{
NCollection_Map<theType, theTypeHasher> aMFence;
Standard_Integer i, aNb = theMILI.Extent();
for (i = 1; i <= aNb; ++i) {
const theType& n = theMILI.FindKey(i);
if (!aMFence.Add(n))
continue;
//
// Start the chain
NCollection_List<theType>& aChain = theMBlocks.Append(NCollection_List<theType>(theAllocator));
aChain.Append(n);
// Look for connected elements
typename NCollection_List<theType>::Iterator aItLChain(aChain);
for (; aItLChain.More(); aItLChain.Next()) {
const theType& n1 = aItLChain.Value();
const NCollection_List<theType>& aLI = theMILI.FindFromKey(n1);
// Add connected elements into the chain
typename NCollection_List<theType>::Iterator aItLI(aLI);
for (; aItLI.More(); aItLI.Next()) {
const theType& n2 = aItLI.Value();
if (aMFence.Add(n2)) {
aChain.Append(n2);
}
}
}
}
}
//! Fills the map with the connected entities
template <class theType, class theTypeHasher>
static void FillMap(const theType& n1,
const theType& n2,
NCollection_IndexedDataMap<theType, NCollection_List<theType>, theTypeHasher>& theMILI,
const BOPCol_BaseAllocator& theAllocator)
{
NCollection_List<theType> *pList1 = theMILI.ChangeSeek(n1);
if (!pList1) {
pList1 = &theMILI(theMILI.Add(n1, NCollection_List<theType>(theAllocator)));
}
pList1->Append(n2);
//
NCollection_List<theType> *pList2 = theMILI.ChangeSeek(n2);
if (!pList2) {
pList2 = &theMILI(theMILI.Add(n2, NCollection_List<theType>(theAllocator)));
}
pList2->Append(n1);
}
Standard_EXPORT static void FillMap(const Handle(BOPDS_PaveBlock)& thePB1,
const Standard_Integer theF,
BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMILI,
const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT static void MakeBlocksCnx (const BOPCol_IndexedDataMapOfIntegerListOfInteger& theMILI, BOPCol_DataMapOfIntegerListOfInteger& theMBlocks, const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT static void MakeBlocks (const BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& theMILI, BOPDS_DataMapOfIntegerListOfPaveBlock& theMBlocks, const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT static void PerformCommonBlocks (BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& theMBlocks, const BOPCol_BaseAllocator& theAllocator, BOPDS_PDS& pDS);
Standard_EXPORT static void FillMap (const Standard_Integer tneN1, const Standard_Integer tneN2, BOPCol_IndexedDataMapOfIntegerListOfInteger& theMILI, const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT static void FillMap (const Handle(BOPDS_PaveBlock)& tnePB1, const Handle(BOPDS_PaveBlock)& tnePB2, BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& theMILI, const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT static void FillMap (const Handle(BOPDS_PaveBlock)& tnePB1, const Standard_Integer tneF, BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMILI, const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT static void PerformCommonBlocks (const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMBlocks, const BOPCol_BaseAllocator& theAllocator, BOPDS_PDS& pDS);
Standard_EXPORT static void PerformCommonBlocks(BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock& theMBlocks,
const BOPCol_BaseAllocator& theAllocator,
BOPDS_PDS& theDS);
Standard_EXPORT static void PerformCommonBlocks(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theMBlocks,
const BOPCol_BaseAllocator& theAllocator,
BOPDS_PDS& pDS);
Standard_EXPORT static Standard_Real ComputeToleranceOfCB
(const Handle(BOPDS_CommonBlock)& theCB,

View File

@@ -42,15 +42,30 @@ IMPLEMENT_STANDARD_RTTIEXT(BOPDS_CommonBlock,MMgt_TShared)
//=======================================================================
void BOPDS_CommonBlock::AddPaveBlock(const Handle(BOPDS_PaveBlock)& aPB)
{
myPaveBlocks.Append(aPB);
if (myPaveBlocks.IsEmpty()) {
myPaveBlocks.Append(aPB);
return;
}
//
// Put the pave block with the minimal index of the original edge in the first place
if (aPB->OriginalEdge() < myPaveBlocks.First()->OriginalEdge()) {
myPaveBlocks.Prepend(aPB);
}
else {
myPaveBlocks.Append(aPB);
}
}
//=======================================================================
// function: AddPaveBlocks
// function: SetPaveBlocks
// purpose:
//=======================================================================
void BOPDS_CommonBlock::AddPaveBlocks(const BOPDS_ListOfPaveBlock& aLPB)
void BOPDS_CommonBlock::SetPaveBlocks(const BOPDS_ListOfPaveBlock& aLPB)
{
myPaveBlocks=aLPB;
myPaveBlocks.Clear();
BOPDS_ListIteratorOfListOfPaveBlock aIt(aLPB);
for (; aIt.More(); aIt.Next()) {
AddPaveBlock(aIt.Value());
}
}
//=======================================================================
// function: PaveBlocks

View File

@@ -31,11 +31,13 @@ class BOPDS_CommonBlock;
DEFINE_STANDARD_HANDLE(BOPDS_CommonBlock, MMgt_TShared)
//! The class BOPDS_CommonBlock is to store
//! the information about pave blocks that have
//! geometry coincidence (in terms of a tolerance) with
//! a) other pave block(s)
//! b) face(s)
//! The class BOPDS_CommonBlock is to store the information
//! about pave blocks that have geometrical coincidence
//! (in terms of a tolerance) with:<br>
//! a) other pave block(s);<br>
//! b) face(s).<br>
//! First pave block in the common block (real pave block)
//! is always a pave block with the minimal index of the original edge.
class BOPDS_CommonBlock : public MMgt_TShared
{
@@ -62,7 +64,7 @@ public:
//! Adds the list of pave blocks <aLPB>
//! to the list of pave blocks
//! of the common block
Standard_EXPORT void AddPaveBlocks (const BOPDS_ListOfPaveBlock& aLPB);
Standard_EXPORT void SetPaveBlocks (const BOPDS_ListOfPaveBlock& aLPB);
//! Modifier

View File

@@ -1065,7 +1065,6 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
//
while (aLPBx.Extent()) {
Standard_Boolean bCoinside;
Standard_Real aTol, aTolMax(0.);
BOPDS_ListOfPaveBlock aLPBxN;
//
aItPB.Initialize(aLPBx);
@@ -1075,27 +1074,12 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
const Handle(BOPDS_PaveBlock)& aPBCx = aLPBxN.First();
bCoinside = CheckCoincidence(aPBx, aPBCx, theFuzz);
if (bCoinside) {
nE = aPBx->OriginalEdge();
const TopoDS_Edge& aE = *(TopoDS_Edge*)&Shape(nE);
aTol = BRep_Tool::Tolerance(aE);
//
//pave block with the max tolerance of the original edge
//must be the first in the common block
if (aTolMax < aTol) {
aTolMax = aTol;
aLPBxN.Prepend(aPBx);
} else {
aLPBxN.Append(aPBx);
}
aLPBxN.Append(aPBx);
aLPBx.Remove(aItPB);
continue;
}//if (bCoinside) {
}//if (aLPBxN.Extent()) {
else {
nE = aPBx->OriginalEdge();
const TopoDS_Edge& aE = *(TopoDS_Edge*)&Shape(nE);
aTolMax = BRep_Tool::Tolerance(aE);
//
aLPBxN.Append(aPBx);
aLPBx.Remove(aItPB);
continue;
@@ -1104,7 +1088,7 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
}//for(; aItPB.More(); ) {
//
aCBx=new BOPDS_CommonBlock;
aCBx->AddPaveBlocks(aLPBxN);
aCBx->SetPaveBlocks(aLPBxN);
aCBx->SetFaces(aLF);
//
aItPB.Initialize(aLPBxN);
@@ -1695,8 +1679,8 @@ Standard_Boolean BOPDS_DS::CheckCoincidence
if (aNbPoints) {
aD=aPPC.LowerDistance();
//
aTol=BRep_Tool::Tolerance(aE1);
aTol = aTol + BRep_Tool::Tolerance(aE2) + Max(theFuzz, Precision::Confusion());
aTol = BRep_Tool::MaxTolerance(aE1, TopAbs_VERTEX);
aTol = aTol + BRep_Tool::MaxTolerance(aE2, TopAbs_VERTEX) + Max(theFuzz, Precision::Confusion());
if (aD<aTol) {
aT2x=aPPC.LowerDistanceParameter();
if (aT2x>aT21 && aT2x<aT22) {
@@ -1707,82 +1691,6 @@ Standard_Boolean BOPDS_DS::CheckCoincidence
return bRet;
}
//=======================================================================
// function: SortPaveBlocks
// purpose:
//=======================================================================
void BOPDS_DS::SortPaveBlocks(const Handle(BOPDS_CommonBlock)& aCB)
{
Standard_Integer theI;
Standard_Boolean bToSort;
bToSort = IsToSort(aCB, theI);
if (!bToSort) {
return;
}
Standard_Integer i(0);
const BOPDS_ListOfPaveBlock& aLPB = aCB->PaveBlocks();
BOPDS_ListOfPaveBlock aLPBN = aLPB;
Handle(BOPDS_PaveBlock) aPB;
BOPDS_ListIteratorOfListOfPaveBlock aIt;
//
aIt.Initialize(aLPBN);
for (aIt.Next(); aIt.More(); ) {
i++;
if(i == theI) {
aPB = aIt.Value();
aLPBN.Remove(aIt);
aLPBN.Prepend(aPB);
break;
}
aIt.Next();
}
//
aCB->AddPaveBlocks(aLPBN);
}
//=======================================================================
// function: IsToSort
// purpose:
//=======================================================================
Standard_Boolean BOPDS_DS::IsToSort
(const Handle(BOPDS_CommonBlock)& aCB,
Standard_Integer& theI)
{
Standard_Boolean bRet;
bRet = Standard_False;
const BOPDS_ListOfPaveBlock& aLPB = aCB->PaveBlocks();
if (aLPB.Extent()==1) {
return bRet;
}
Standard_Integer nE;
Standard_Real aTolMax, aTol;
Handle(BOPDS_PaveBlock) aPB;
TopoDS_Edge aE;
BOPDS_ListIteratorOfListOfPaveBlock aIt;
//
aPB = aLPB.First();
nE = aPB->OriginalEdge();
aE = (*(TopoDS_Edge *)(&Shape(nE)));
aTolMax = BRep_Tool::Tolerance(aE);
//
theI = 0;
aIt.Initialize(aLPB);
for (aIt.Next(); aIt.More(); aIt.Next()) {
theI++;
aPB = aIt.Value();
nE = aPB->OriginalEdge();
aE = (*(TopoDS_Edge *)(&Shape(nE)));
aTol = BRep_Tool::Tolerance(aE);
if (aTolMax < aTol) {
aTolMax = aTol;
bRet = Standard_True;
}
}
return bRet;
}
//=======================================================================
// function: IsSubShape
// purpose:
//=======================================================================

View File

@@ -436,10 +436,6 @@ Standard_EXPORT virtual ~BOPDS_DS();
Standard_EXPORT void Dump() const;
Standard_EXPORT void SortPaveBlocks (const Handle(BOPDS_CommonBlock)& theCB);
Standard_EXPORT Standard_Boolean IsToSort (const Handle(BOPDS_CommonBlock)& theCB, Standard_Integer& theI);
Standard_EXPORT Standard_Boolean IsSubShape (const Standard_Integer theI1, const Standard_Integer theI2);
//! Fills theLP with sorted paves

View File

@@ -18,6 +18,7 @@
#include <NCollection_IndexedDataMap.hxx>
#include <TColStd_MapTransientHasher.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPDS_PaveBlock.hxx>
typedef NCollection_IndexedDataMap<Handle(BOPDS_PaveBlock), BOPCol_ListOfInteger, TColStd_MapTransientHasher> BOPDS_IndexedDataMapOfPaveBlockListOfInteger;

View File

@@ -118,88 +118,53 @@ static
// function: MakeConnexityBlocks
// purpose:
//=======================================================================
void BOPTools_AlgoTools::MakeConnexityBlocks
void BOPTools_AlgoTools::MakeConnexityBlocks
(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theType1,
const TopAbs_ShapeEnum theType2,
BOPCol_ListOfShape& theLCB)
{
Standard_Integer aNbF, aNbAdd, aNbAdd1, i;
// Map shapes to find connected elements
BOPCol_IndexedDataMapOfShapeListOfShape aDMSLS;
BOPTools::MapShapesAndAncestors(theS, theType1, theType2, aDMSLS);
// Fence map
BOPCol_MapOfShape aMFence;
Standard_Integer i;
BRep_Builder aBB;
TopoDS_Compound aC;
TopoDS_Iterator aIt;
TopExp_Explorer aExp;
BOPCol_MapOfShape aMP;
BOPCol_IndexedMapOfShape aMCB, aMAdd, aMAdd1;
BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
BOPCol_ListIteratorOfListOfShape aItLF;
//
// 1. aMEF
BOPTools::MapShapesAndAncestors(theS, theType1, theType2, aMEF);
//
// 2. aMCB
aIt.Initialize(theS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF1=aIt.Value();
if (aMP.Contains(aF1)) {
TopExp_Explorer aExp(theS, theType2);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aS = aExp.Current();
if (!aMFence.Add(aS)) {
continue;
}
//
aMCB.Clear();
aMAdd.Clear();
aMAdd.Add(aF1);
//
for(;;) {
aMAdd1.Clear();
//
aNbAdd = aMAdd.Extent();
for (i=1; i<=aNbAdd; ++i) {
const TopoDS_Shape& aF=aMAdd(i);
//
aExp.Init(aF, theType1);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
//
const BOPCol_ListOfShape& aLF=aMEF.FindFromKey(aE);
aItLF.Initialize(aLF);
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Shape& aFx=aItLF.Value();
if (aFx.IsSame(aF)) {
continue;
}
if (aMCB.Contains(aFx)) {
continue;
}
aMAdd1.Add(aFx);
// The block
BOPCol_IndexedMapOfShape aMBlock;
TopoDS_Compound aBlock;
aBB.MakeCompound(aBlock);
// Start the block
aMBlock.Add(aS);
aBB.Add(aBlock, aS);
// Look for connected parts
for (i = 1; i <= aMBlock.Extent(); ++i) {
const TopoDS_Shape& aS1 = aMBlock(i);
TopExp_Explorer aExpSS(aS1, theType1);
for (; aExpSS.More(); aExpSS.Next()) {
const TopoDS_Shape& aSubS = aExpSS.Current();
const BOPCol_ListOfShape& aLS = aDMSLS.FindFromKey(aSubS);
BOPCol_ListIteratorOfListOfShape aItLS(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS2 = aItLS.Value();
if (aMFence.Add(aS2)) {
aMBlock.Add(aS2);
aBB.Add(aBlock, aS2);
}
}//for (; aExp.More(); aExp.Next()){
aMCB.Add(aF);
}// for (i=1; i<=aNbAdd; ++i) {
//
aNbAdd1=aMAdd1.Extent();
if (!aNbAdd1) {
break;// ->make new CB from aMCB
}
}
//
aMAdd.Clear();
for (i=1; i<=aNbAdd1; ++i) {
const TopoDS_Shape& aFAdd = aMAdd1(i);
aMAdd.Add(aFAdd);
}
}//while(1) {
//
aNbF=aMCB.Extent();
if (aNbF) {
aBB.MakeCompound(aC);
//
for (i=1; i<=aNbF; ++i) {
const TopoDS_Shape& aF=aMCB(i);
aBB.Add(aC, aF);
aMP.Add(aF);
}
theLCB.Append(aC);
}
}// for (; aIt.More(); aIt.Next())
// Add the block into result
theLCB.Append(aBlock);
}
}
//=======================================================================
// function: OrientEdgesOnWire

View File

@@ -203,31 +203,6 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E,
return VRes;
}
//=======================================================================
//function : RemoveFromMVE
//purpose :
//=======================================================================
static void RemoveFromMVE(TopTools_IndexedDataMapOfShapeListOfShape& MVE,
const TopoDS_Shape& theVertex)
{
// remove from the indexed data map by substituting last item instead of removed
Standard_Integer iV = MVE.FindIndex(theVertex);
if (iV > 0)
{
Standard_Integer iLast = MVE.Extent();
if (iV == iLast)
MVE.RemoveLast();
else
{
TopoDS_Shape aVertex = MVE.FindKey(iLast);
TopTools_ListOfShape anEdges = MVE(iLast);
MVE.RemoveLast();
MVE.Substitute(iV, aVertex, anEdges);
}
}
}
//=======================================================================
//function : RemovePendingEdges
//purpose :
@@ -267,7 +242,7 @@ static void RemovePendingEdges(TopTools_IndexedDataMapOfShapeListOfShape& MVE)
if (!VToRemove.IsEmpty()) {
YaSupress = Standard_True;
for (itl.Initialize(VToRemove); itl.More(); itl.Next()) {
RemoveFromMVE(MVE, itl.Value());
MVE.RemoveKey(itl.Value());
}
if (!EToRemove.IsEmpty()) {
for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++) {
@@ -667,7 +642,7 @@ void BRepAlgo_Loop::Perform()
if (!End) {
CE = NE;
if (MVE.FindFromKey(CV).IsEmpty())
RemoveFromMVE(MVE, CV);
MVE.RemoveKey(CV);
}
}
}

View File

@@ -98,12 +98,9 @@
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TopAbs.hxx>
@@ -120,13 +117,9 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
@@ -1438,7 +1431,6 @@ void BRepBuilderAPI_Sewing::AnalysisNearestEdges(const TopTools_SequenceOfShape&
}
}
}
}
Standard_Integer i2 = seqIndCandidate.Length();
@@ -1449,12 +1441,7 @@ void BRepBuilderAPI_Sewing::AnalysisNearestEdges(const TopTools_SequenceOfShape&
seqIndCandidate.Remove(i2);
seqOrientations.Remove(i2);
}
}
//for(TColStd_MapIteratorOfMapOfInteger IMap(MapIndex); IMap.More(); IMap.Next()) {
// seqIndCandidate.Remove(IMap.Key());
// seqOrientations.Remove(IMap.Key());
//}
}
//=======================================================================
@@ -2245,7 +2232,7 @@ void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)
BRep_Builder B;
TopTools_MapOfShape SmallEdges;
TopTools_DataMapOfShapeListOfShape GluedVertices;
TopTools_IndexedDataMapOfShapeListOfShape GluedVertices;
Standard_Integer i = 1;
Message_ProgressSentry aPS (thePI, "Shape analysis", 0, myOldShapes.Extent(), 1);
for (i = 1; i <= myOldShapes.Extent() && aPS.More(); i++, aPS.Next()) {
@@ -2336,18 +2323,18 @@ void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)
// Store glued vertices
if (!nv1.IsSame(v1)) {
TopTools_ListOfShape& vlist1 = GluedVertices(nv1);
TopTools_ListOfShape& vlist1 = GluedVertices.ChangeFromKey(nv1);
// First vertex was already glued
if (!nv2.IsSame(v2)) {
// Merge lists of glued vertices
if (!nv1.IsSame(nv2)) {
TopTools_ListIteratorOfListOfShape liter(GluedVertices(nv2));
TopTools_ListIteratorOfListOfShape liter(GluedVertices.FindFromKey(nv2));
for (; liter.More(); liter.Next()) {
TopoDS_Shape v = liter.Value();
myReShape->Replace(v,nv1.Oriented(v.Orientation()));
vlist1.Append(v);
}
GluedVertices.UnBind(nv2);
GluedVertices.RemoveKey(nv2);
}
}
else {
@@ -2358,7 +2345,7 @@ void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)
}
else if (!nv2.IsSame(v2)) {
// Add first vertex to the existing list
GluedVertices(nv2).Append(v1);
GluedVertices.ChangeFromKey(nv2).Append(v1);
myReShape->Replace(v1,nv2.Oriented(v1.Orientation()));
}
else if (!v1.IsSame(v2)) {
@@ -2368,7 +2355,7 @@ void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)
TopTools_ListOfShape vlist;
vlist.Append(v1);
vlist.Append(v2);
GluedVertices.Bind(nv,vlist);
GluedVertices.Add(nv,vlist);
myReShape->Replace(v1,nv.Oriented(v1.Orientation()));
myReShape->Replace(v2,nv.Oriented(v2.Orientation()));
}
@@ -2428,12 +2415,12 @@ void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)
}
// Update glued vertices
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape miter(GluedVertices);
for (; miter.More(); miter.Next()) {
TopoDS_Vertex vnew = TopoDS::Vertex(miter.Key());
TopTools_IndexedDataMapOfShapeListOfShape::Iterator aMIter(GluedVertices);
for (; aMIter.More(); aMIter.Next()) {
const TopoDS_Vertex& vnew = TopoDS::Vertex(aMIter.Key());
gp_XYZ coord(0.,0.,0.);
Standard_Integer nbPoints = 0;
const TopTools_ListOfShape& vlist = miter.Value();
const TopTools_ListOfShape& vlist = aMIter.Value();
TopTools_ListIteratorOfListOfShape liter1(vlist);
for (; liter1.More(); liter1.Next()) {
coord += BRep_Tool::Pnt(TopoDS::Vertex(liter1.Value())).XYZ();
@@ -2486,12 +2473,12 @@ void BRepBuilderAPI_Sewing::FindFreeBoundaries()
Standard_Integer i, nbShapes = myOldShapes.Extent();
for (i = 1; i <= nbShapes; i++) {
// Retrieve new shape
TopoDS_Shape shape = myOldShapes(i);
const TopoDS_Shape& shape = myOldShapes(i);
if (shape.IsNull()) continue;
NewShapes.Add(shape);
// Explore shape to find all boundaries
for (TopExp_Explorer eExp(shape,TopAbs_EDGE); eExp.More(); eExp.Next()) {
TopoDS_Shape edge = eExp.Current();
const TopoDS_Shape& edge = eExp.Current();
if (!EdgeFaces.Contains(edge)) {
TopTools_ListOfShape listFaces;
EdgeFaces.Add(edge,listFaces);
@@ -2500,12 +2487,12 @@ void BRepBuilderAPI_Sewing::FindFreeBoundaries()
}
// Fill map Edge -> Faces
nbShapes = NewShapes.Extent();
TopTools_MapOfShape mapFaces;
TopTools_MapOfShape mapFaces;
for (i = 1; i <= nbShapes; i++) {
// Explore shape to find all faces
TopExp_Explorer fExp(NewShapes.FindKey(i),TopAbs_FACE);
for (; fExp.More(); fExp.Next()) {
TopoDS_Shape face = fExp.Current();
const TopoDS_Shape& face = fExp.Current();
if(mapFaces.Contains(face)) continue;
else
mapFaces.Add(face);
@@ -2514,7 +2501,7 @@ void BRepBuilderAPI_Sewing::FindFreeBoundaries()
if(aIw.Value().ShapeType() != TopAbs_WIRE) continue;
for (TopoDS_Iterator aIIe(aIw.Value()); aIIe.More(); aIIe.Next()) {
TopoDS_Shape edge = aIIe.Value();
const TopoDS_Shape& edge = aIIe.Value();
if (EdgeFaces.Contains(edge)) {
EdgeFaces.ChangeFromKey(edge).Append(face);
@@ -2530,11 +2517,11 @@ void BRepBuilderAPI_Sewing::FindFreeBoundaries()
}
}
// Find free boundaries
nbShapes = EdgeFaces.Extent();
for (i = 1; i <= nbShapes; i++) {
TopTools_ListOfShape& listFaces = EdgeFaces(i);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterEF(EdgeFaces);
for (; anIterEF.More(); anIterEF.Next()) {
TopTools_ListOfShape& listFaces = anIterEF.ChangeValue();
Standard_Integer nbFaces = listFaces.Extent();
TopoDS_Shape edge = EdgeFaces.FindKey(i);
TopoDS_Shape edge = anIterEF.Key();
if(edge.Orientation() == TopAbs_INTERNAL)
continue;
Standard_Boolean isSeam = Standard_False;
@@ -2624,47 +2611,46 @@ static Standard_Boolean CreateNewNodes(const TopTools_IndexedDataMapOfShapeShape
TopTools_IndexedDataMapOfShapeShape& aVertexNode,
TopTools_DataMapOfShapeListOfShape& aNodeEdges)
{
Standard_Integer i, nbNearest = NodeNearestNode.Extent();
// Create new nodes
BRep_Builder B;
TopTools_DataMapOfShapeShape OldNodeNewNode;
TopTools_DataMapOfShapeListOfShape NewNodeOldNodes;
for (i = 1; i <= nbNearest; i++) {
TopTools_IndexedDataMapOfShapeListOfShape NewNodeOldNodes;
TopTools_IndexedDataMapOfShapeShape::Iterator anIter(NodeNearestNode);
for (; anIter.More(); anIter.Next()) {
// Retrieve a pair of nodes to merge
TopoDS_Shape oldnode1 = NodeNearestNode.FindKey(i);
TopoDS_Shape oldnode2 = NodeNearestNode(i);
const TopoDS_Shape& oldnode1 = anIter.Key();
const TopoDS_Shape& oldnode2 = anIter.Value();
// Second node should also be in the map
if (!NodeNearestNode.Contains(oldnode2)) continue;
// Get new node for old node #1
if (OldNodeNewNode.IsBound(oldnode1)) {
TopoDS_Shape newnode1 = OldNodeNewNode(oldnode1);
const TopoDS_Shape& newnode1 = OldNodeNewNode(oldnode1);
if (OldNodeNewNode.IsBound(oldnode2)) {
TopoDS_Shape newnode2 = OldNodeNewNode(oldnode2);
if (!newnode1.IsSame(newnode2)) {
// Change data for new node #2
TopTools_ListOfShape& lnode1 = NewNodeOldNodes(newnode1);
TopTools_ListIteratorOfListOfShape itn(NewNodeOldNodes(newnode2));
TopTools_ListOfShape& lnode1 = NewNodeOldNodes.ChangeFromKey(newnode1);
TopTools_ListIteratorOfListOfShape itn(NewNodeOldNodes.FindFromKey(newnode2));
for (; itn.More(); itn.Next()) {
TopoDS_Shape node2 = itn.Value();
const TopoDS_Shape& node2 = itn.Value();
lnode1.Append(node2);
OldNodeNewNode(node2) = newnode1;
}
NewNodeOldNodes.UnBind(newnode2);
NewNodeOldNodes.RemoveKey(newnode2);
}
}
else {
// Old node #2 is not bound - add to old node #1
OldNodeNewNode.Bind(oldnode2,newnode1);
NewNodeOldNodes(newnode1).Append(oldnode2);
NewNodeOldNodes.ChangeFromKey(newnode1).Append(oldnode2);
}
}
else {
if (OldNodeNewNode.IsBound(oldnode2)) {
// Old node #1 is not bound - add to old node #2
TopoDS_Shape newnode2 = OldNodeNewNode(oldnode2);
const TopoDS_Shape& newnode2 = OldNodeNewNode(oldnode2);
OldNodeNewNode.Bind(oldnode1,newnode2);
NewNodeOldNodes(newnode2).Append(oldnode1);
NewNodeOldNodes.ChangeFromKey(newnode2).Append(oldnode1);
}
else {
// Nodes are not bound - create new node
@@ -2675,7 +2661,7 @@ static Standard_Boolean CreateNewNodes(const TopTools_IndexedDataMapOfShapeShape
TopTools_ListOfShape lnodes;
lnodes.Append(oldnode1);
lnodes.Append(oldnode2);
NewNodeOldNodes.Bind(newnode,lnodes);
NewNodeOldNodes.Add(newnode,lnodes);
}
}
}
@@ -2683,22 +2669,22 @@ static Standard_Boolean CreateNewNodes(const TopTools_IndexedDataMapOfShapeShape
// Stop if no new nodes created
if (!NewNodeOldNodes.Extent()) return Standard_False;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape iter1(NewNodeOldNodes);
for (; iter1.More(); iter1.Next()) {
const TopoDS_Vertex& newnode = TopoDS::Vertex(iter1.Key());
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIter1(NewNodeOldNodes);
for (; anIter1.More(); anIter1.Next()) {
const TopoDS_Vertex& newnode = TopoDS::Vertex(anIter1.Key());
// Calculate new node center point
gp_XYZ theCoordinates(0.,0.,0.);
TopTools_ListOfShape lvert; // Accumulate node vertices
TopTools_MapOfShape medge;
TopTools_ListOfShape ledge; // Accumulate node edges
// Iterate on old nodes
TopTools_ListIteratorOfListOfShape itn(iter1.Value());
TopTools_ListIteratorOfListOfShape itn(anIter1.Value());
for (; itn.More(); itn.Next()) {
const TopoDS_Shape& oldnode = itn.Value();
// Iterate on node vertices
TopTools_ListIteratorOfListOfShape itv(NodeVertices.FindFromKey(oldnode));
for (; itv.More(); itv.Next()) {
TopoDS_Vertex vertex = TopoDS::Vertex(itv.Value());
const TopoDS_Vertex& vertex = TopoDS::Vertex(itv.Value());
// Change node for vertex
aVertexNode.ChangeFromKey(vertex) = newnode;
// Accumulate coordinates
@@ -2709,7 +2695,7 @@ static Standard_Boolean CreateNewNodes(const TopTools_IndexedDataMapOfShapeShape
const TopTools_ListOfShape& edges = aNodeEdges(oldnode);
TopTools_ListIteratorOfListOfShape ite(edges);
for (; ite.More(); ite.Next()) {
TopoDS_Shape edge = ite.Value();
const TopoDS_Shape& edge = ite.Value();
if (!medge.Contains(edge)) { medge.Add(edge); ledge.Append(edge); }
}
// Unbind old node edges
@@ -2781,14 +2767,14 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
const Standard_Real Tolerance,
const Handle(Message_ProgressIndicator)& theProgress)
{
Standard_Integer i, nbVertices = aVertexNode.Extent();
// Create map of node -> vertices
TopTools_IndexedDataMapOfShapeListOfShape NodeVertices;
BRepBuilderAPI_CellFilter aFilter (Tolerance);
BRepBuilderAPI_VertexInspector anInspector (Tolerance);
for (i = 1; i <= nbVertices; i++) {
TopoDS_Shape vertex = aVertexNode.FindKey(i);
TopoDS_Vertex node = TopoDS::Vertex(aVertexNode(i));
TopTools_IndexedDataMapOfShapeShape::Iterator anIter1(aVertexNode);
for (; anIter1.More(); anIter1.Next()) {
const TopoDS_Shape& vertex = anIter1.Key();
const TopoDS_Vertex& node = TopoDS::Vertex(anIter1.Value());
if (NodeVertices.Contains(node)) {
NodeVertices.ChangeFromKey(node).Append(vertex);
}
@@ -2808,8 +2794,8 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
// Merge nearest nodes
TopTools_IndexedDataMapOfShapeShape NodeNearestNode;
Message_ProgressSentry aPS (theProgress, "Glueing nodes", 0, nbNodes, 1, Standard_True);
for (i = 1; i <= nbNodes && aPS.More(); i++, aPS.Next()) {
TopoDS_Vertex node1 = TopoDS::Vertex(NodeVertices.FindKey(i));
for (Standard_Integer i = 1; i <= nbNodes && aPS.More(); i++, aPS.Next()) {
const TopoDS_Vertex& node1 = TopoDS::Vertex(NodeVertices.FindKey(i));
// Find near nodes
gp_Pnt pt1 = BRep_Tool::Pnt (node1);
anInspector.SetCurrent (pt1.XYZ());
@@ -2825,7 +2811,7 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
//gp_Pnt pt1 = BRep_Tool::Pnt(node1);
TColStd_ListIteratorOfListOfInteger iter1(anInspector.ResInd());
for (; iter1.More(); iter1.Next()) {
TopoDS_Vertex node2 = TopoDS::Vertex(NodeVertices.FindKey(iter1.Value()));
const TopoDS_Vertex& node2 = TopoDS::Vertex(NodeVertices.FindKey(iter1.Value()));
if (node1 == node2) continue;
// Retrieve list of edges for the second node
const TopTools_ListOfShape& ledges2 = aNodeEdges(node2);
@@ -3140,14 +3126,15 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
BRep_Builder B;
// TopTools_MapOfShape MergedEdges;
Message_ProgressSentry aPS (thePI, "Merging bounds", 0, myBoundFaces.Extent(), 1);
for (Standard_Integer i = 1; i <= myBoundFaces.Extent() && aPS.More(); i++, aPS.Next()) {
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
TopoDS_Shape bound = myBoundFaces.FindKey(i);
const TopoDS_Shape& bound = anIterB.Key();
// If bound was already merged - continue
if (myMergedEdges.Contains(bound)) continue;
if (!myBoundFaces(i).Extent()) {
if (!anIterB.Value().Extent()) {
// Merge free edge - only vertices
TopoDS_Vertex no1, no2;
TopExp::Vertices(TopoDS::Edge(bound),no1,no2);
@@ -3185,21 +3172,21 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
}
// Merge with bound
TopTools_DataMapOfShapeShape MergedWithBound;
TopTools_IndexedDataMapOfShapeShape MergedWithBound;
if (!isPrevSplit) {
// Obtain sequence of edges merged with bound
TopTools_SequenceOfShape seqMergedWithBound;
TColStd_SequenceOfBoolean seqMergedWithBoundOri;
if (MergedNearestEdges(bound,seqMergedWithBound,seqMergedWithBoundOri)) {
// Store bound in the map
MergedWithBound.Bind(bound,bound);
MergedWithBound.Add(bound,bound);
// Iterate on edges merged with bound
Standard_Integer ii = 1;
while (ii <= seqMergedWithBound.Length()) {
TopoDS_Shape iedge = seqMergedWithBound.Value(ii);
// Remove edge if recorded as merged
Standard_Boolean isRejected = (myMergedEdges.Contains(iedge) ||
MergedWithBound.IsBound(iedge));
MergedWithBound.Contains(iedge));
if (!isRejected) {
if (myBoundSections.IsBound(iedge)) {
// Edge is splitted - check sections
@@ -3207,7 +3194,7 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
for (; lit.More() && !isRejected; lit.Next()) {
const TopoDS_Shape& sec = lit.Value();
// Remove edge (bound) if at least one of its sections already merged
isRejected = (myMergedEdges.Contains(sec) || MergedWithBound.IsBound(sec));
isRejected = (myMergedEdges.Contains(sec) || MergedWithBound.Contains(sec));
}
}
if (!isRejected) {
@@ -3215,7 +3202,7 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
// Edge is a section - check bound
const TopoDS_Shape& bnd = mySectionBound(iedge);
// Remove edge (section) if its bound already merged
isRejected = (myMergedEdges.Contains(bnd) || MergedWithBound.IsBound(bnd));
isRejected = (myMergedEdges.Contains(bnd) || MergedWithBound.Contains(bnd));
}
}
}
@@ -3227,7 +3214,7 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
}
else {
// Process accepted edge
MergedWithBound.Bind(iedge,iedge);
MergedWithBound.Add(iedge,iedge);
ii++;
}
}
@@ -3243,34 +3230,36 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
// Process actually merged edges
Standard_Integer nbActuallyMerged = 0;
for (ii = 1; ii <= nbMerged; ii++) {
TopoDS_Shape iedge = seqMergedWithBound(ii);
const TopoDS_Shape& iedge = seqMergedWithBound(ii);
if (ActuallyMerged.Contains(iedge)) {
nbActuallyMerged++;
// Record merged edge in the map
TopAbs_Orientation orient = iedge.Orientation();
if (!isForward) orient = TopAbs::Reverse(orient);
if (!seqMergedWithBoundOri(ii)) orient = TopAbs::Reverse(orient);
MergedWithBound.ChangeFind(iedge) = MergedEdge.Oriented(orient);
MergedWithBound.ChangeFromKey(iedge) = MergedEdge.Oriented(orient);
}
else MergedWithBound.UnBind(iedge);
else
MergedWithBound.RemoveKey(iedge);
}
if (nbActuallyMerged) {
// Record merged bound in the map
TopAbs_Orientation orient = bound.Orientation();
if (!isForward) orient = TopAbs::Reverse(orient);
MergedWithBound.ChangeFind(bound) = MergedEdge.Oriented(orient);
MergedWithBound.ChangeFromKey(bound) = MergedEdge.Oriented(orient);
}
nbMerged = nbActuallyMerged;
}
// Remove bound from the map if not finally merged
if (!nbMerged) MergedWithBound.UnBind(bound);
if (!nbMerged)
MergedWithBound.RemoveKey(bound);
}
}
const Standard_Boolean isMerged = !MergedWithBound.IsEmpty();
// Merge with cutting sections
Handle(BRepTools_ReShape) SectionsReShape = new BRepTools_ReShape;
TopTools_DataMapOfShapeShape MergedWithSections;
TopTools_IndexedDataMapOfShapeShape MergedWithSections;
if (hasCuttingSections) {
// Iterate on cutting sections
TopTools_ListIteratorOfListOfShape its(myBoundSections(bound));
@@ -3284,13 +3273,14 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
TColStd_SequenceOfBoolean seqMergedWithSectionOri;
if (MergedNearestEdges(section,seqMergedWithSection,seqMergedWithSectionOri)) {
// Store section in the map
MergedWithSections.Bind(section,section);
MergedWithSections.Add(section,section);
// Iterate on edges merged with section
Standard_Integer ii = 1;
while (ii <= seqMergedWithSection.Length()) {
TopoDS_Shape iedge = seqMergedWithSection.Value(ii);
// Remove edge if recorded as merged
Standard_Boolean isRejected = (myMergedEdges.Contains(iedge) || MergedWithSections.IsBound(iedge));
Standard_Boolean isRejected = (myMergedEdges.Contains(iedge) ||
MergedWithSections.Contains(iedge));
if (!isRejected) {
if (myBoundSections.IsBound(iedge)) {
// Edge is splitted - check sections
@@ -3298,7 +3288,7 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
for (; lit.More() && !isRejected; lit.Next()) {
const TopoDS_Shape& sec = lit.Value();
// Remove edge (bound) if at least one of its sections already merged
isRejected = (myMergedEdges.Contains(sec) || MergedWithSections.IsBound(sec));
isRejected = (myMergedEdges.Contains(sec) || MergedWithSections.Contains(sec));
}
}
if (!isRejected) {
@@ -3306,7 +3296,7 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
// Edge is a section - check bound
const TopoDS_Shape& bnd = mySectionBound(iedge);
// Remove edge (section) if its bound already merged
isRejected = (myMergedEdges.Contains(bnd) || MergedWithSections.IsBound(bnd));
isRejected = (myMergedEdges.Contains(bnd) || MergedWithSections.Contains(bnd));
}
}
}
@@ -3318,7 +3308,7 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
}
else {
// Process accepted edge
MergedWithSections.Bind(iedge,iedge);
MergedWithSections.Add(iedge, iedge);
ii++;
}
}
@@ -3334,31 +3324,33 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
// Process actually merged edges
Standard_Integer nbActuallyMerged = 0;
for (ii = 1; ii <= nbMerged; ii++) {
TopoDS_Shape iedge = seqMergedWithSection(ii);
const TopoDS_Shape& iedge = seqMergedWithSection(ii);
if (ActuallyMerged.Contains(iedge)) {
nbActuallyMerged++;
// Record merged edge in the map
TopAbs_Orientation orient = iedge.Orientation();
if (!isForward) orient = TopAbs::Reverse(orient);
if (!seqMergedWithSectionOri(ii)) orient = TopAbs::Reverse(orient);
TopoDS_Shape oedge = MergedEdge.Oriented(orient);
MergedWithSections.ChangeFind(iedge) = oedge;
const TopoDS_Shape& oedge = MergedEdge.Oriented(orient);
MergedWithSections.ChangeFromKey(iedge) = oedge;
ReplaceEdge(myReShape->Apply(iedge),oedge,SectionsReShape);
}
else MergedWithSections.UnBind(iedge);
else
MergedWithSections.RemoveKey(iedge);
}
if (nbActuallyMerged) {
// Record merged section in the map
TopAbs_Orientation orient = section.Orientation();
if (!isForward) orient = TopAbs::Reverse(orient);
TopoDS_Shape oedge = MergedEdge.Oriented(orient);
MergedWithSections.ChangeFind(section) = oedge;
const TopoDS_Shape& oedge = MergedEdge.Oriented(orient);
MergedWithSections.ChangeFromKey(section) = oedge;
ReplaceEdge(myReShape->Apply(section),oedge,SectionsReShape);
}
nbMerged = nbActuallyMerged;
}
// Remove section from the map if not finally merged
if (!nbMerged) MergedWithSections.UnBind(section);
if (!nbMerged)
MergedWithSections.RemoveKey(section);
}
else if (isMerged) {
// Reject merging of sections
@@ -3387,37 +3379,40 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
// Choose between bound and sections merging
if (isMerged && isMergedSplit && !isPrevSplit) {
// Fill map of merged cutting sections
TopTools_MapOfShape MapSplitEdges;
TopTools_DataMapIteratorOfDataMapOfShapeShape itm;
for (itm.Initialize(MergedWithSections); itm.More(); itm.Next()) {
TopoDS_Shape edge = itm.Key();
TopTools_IndexedMapOfShape MapSplitEdges;
TopTools_IndexedDataMapOfShapeShape::Iterator anItm(MergedWithSections);
for (; anItm.More(); anItm.Next()) {
const TopoDS_Shape& edge = anItm.Key();
MapSplitEdges.Add(edge);
}
// Iterate on edges merged with bound
for (itm.Initialize(MergedWithBound); itm.More(); itm.Next()) {
TopTools_IndexedDataMapOfShapeShape::Iterator anItm1(MergedWithBound);
for (; anItm1.More(); anItm1.Next()) {
// Retrieve edge merged with bound
TopoDS_Shape edge = itm.Key();
const TopoDS_Shape& edge = anItm1.Key();
// Remove edge from the map
if (MapSplitEdges.Contains(edge)) MapSplitEdges.Remove(edge);
if (MapSplitEdges.Contains(edge))
MapSplitEdges.RemoveKey(edge);
if (myBoundSections.IsBound(edge)) {
// Edge has cutting sections
TopTools_ListIteratorOfListOfShape its(myBoundSections(edge));
for (; its.More(); its.Next()) {
TopoDS_Shape sec = its.Value();
const TopoDS_Shape& sec = its.Value();
// Remove section from the map
if (MapSplitEdges.Contains(sec)) MapSplitEdges.Remove(sec);
if (MapSplitEdges.Contains(sec))
MapSplitEdges.RemoveKey(sec);
}
}
}
// Calculate section merging tolerance
Standard_Real MinSplitTol = RealLast();
TopTools_MapIteratorOfMapOfShape im(MapSplitEdges);
for (; im.More(); im.Next()) {
TopoDS_Edge edge = TopoDS::Edge(MergedWithSections(im.Key()));
for (Standard_Integer ii = 1; ii <= MapSplitEdges.Extent(); ii++) {
const TopoDS_Edge& edge = TopoDS::Edge
(MergedWithSections.FindFromKey(MapSplitEdges.FindKey(ii)));
MinSplitTol = Min(MinSplitTol,BRep_Tool::Tolerance(edge));
}
// Calculate bound merging tolerance
TopoDS_Edge BoundEdge = TopoDS::Edge(MergedWithBound(bound));
const TopoDS_Edge& BoundEdge = TopoDS::Edge(MergedWithBound.FindFromKey(bound));
Standard_Real BoundEdgeTol = BRep_Tool::Tolerance(BoundEdge);
isSplitted = ((MinSplitTol < BoundEdgeTol+MinTolerance()) || myNonmanifold);
isSplitted = (!MapSplitEdges.IsEmpty() && isSplitted);
@@ -3427,28 +3422,30 @@ void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
// Merging of cutting sections
//myMergedEdges.Add(bound);
myReShape->Replace(myReShape->Apply(bound),myReShape->Apply(BoundWire));
TopTools_DataMapIteratorOfDataMapOfShapeShape itm(MergedWithSections);
for (; itm.More(); itm.Next()) {
TopoDS_Shape oldedge = itm.Key();
TopoDS_Shape newedge = SectionsReShape->Apply(itm.Value());
TopTools_IndexedDataMapOfShapeShape::Iterator anItm(MergedWithSections);
for (; anItm.More(); anItm.Next()) {
const TopoDS_Shape& oldedge = anItm.Key();
TopoDS_Shape newedge = SectionsReShape->Apply(anItm.Value());
ReplaceEdge(myReShape->Apply(oldedge),newedge,myReShape);
myMergedEdges.Add(oldedge);
if (myBoundSections.IsBound(oldedge)) myBoundSections.UnBind(oldedge);
if (myBoundSections.IsBound(oldedge))
myBoundSections.UnBind(oldedge);
}
}
else {
// Merging of initial bound
TopTools_DataMapIteratorOfDataMapOfShapeShape itm(MergedWithBound);
//myMergedEdges.Add(bound);
for (; itm.More(); itm.Next()) {
TopoDS_Shape oldedge = itm.Key();
TopoDS_Shape newedge = itm.Value();
TopTools_IndexedDataMapOfShapeShape::Iterator anItm(MergedWithBound);
for (; anItm.More(); anItm.Next()) {
const TopoDS_Shape& oldedge = anItm.Key();
const TopoDS_Shape& newedge = anItm.Value();
ReplaceEdge(myReShape->Apply(oldedge),newedge,myReShape);
myMergedEdges.Add(oldedge);
if (myBoundSections.IsBound(oldedge)) myBoundSections.UnBind(oldedge);
if (myBoundSections.IsBound(oldedge))
myBoundSections.UnBind(oldedge);
}
if (myBoundSections.IsBound(bound)) myBoundSections.UnBind(bound);
if (myBoundSections.IsBound(bound))
myBoundSections.UnBind(bound);
if(!myMergedEdges.Contains(bound))
myMergedEdges.Add(bound);
}
@@ -3480,7 +3477,7 @@ Standard_Boolean BRepBuilderAPI_Sewing::MergedNearestEdges(const TopoDS_Shape& e
if (isNode2) nno2 = myVertexNode.FindFromKey(no2);
// Fill map of nodes connected to the node #1
TopTools_MapOfShape mapVert1;
TopTools_IndexedMapOfShape mapVert1;
mapVert1.Add(nno1);
if (myCuttingNode.IsBound(nno1)) {
TopTools_ListIteratorOfListOfShape ilv(myCuttingNode(nno1));
@@ -3520,8 +3517,8 @@ Standard_Boolean BRepBuilderAPI_Sewing::MergedNearestEdges(const TopoDS_Shape& e
seqEdges.Append(edge);
TopTools_MapOfShape mapEdges;
mapEdges.Add(edge);
for (TopTools_MapIteratorOfMapOfShape imv1(mapVert1); imv1.More(); imv1.Next()) {
TopoDS_Shape node1 = imv1.Key();
for (Standard_Integer i = 1; i <= mapVert1.Extent(); i++) {
TopoDS_Shape node1 = mapVert1.FindKey(i);
if (!myNodeSections.IsBound(node1)) continue;
TopTools_ListIteratorOfListOfShape ilsec(myNodeSections(node1));
for (; ilsec.More(); ilsec.Next()) {
@@ -3638,10 +3635,11 @@ void BRepBuilderAPI_Sewing::Cutting(const Handle(Message_ProgressIndicator)& the
// Iterate on all boundaries
Standard_Integer nbBounds = myBoundFaces.Extent();
Message_ProgressSentry aPS (thePI, "Cutting bounds", 0, nbBounds, 1);
for (i = 1; i <= nbBounds && aPS.More(); i++, aPS.Next()) {
const TopoDS_Edge& bound = TopoDS::Edge(myBoundFaces.FindKey(i));
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Edge& bound = TopoDS::Edge(anIterB.Key());
// Do not cut floating edges
if (!myBoundFaces(i).Extent()) continue;
if (!anIterB.Value().Extent()) continue;
// Obtain bound curve
c3d = BRep_Tool::Curve(bound, loc, first, last);
if (c3d.IsNull()) continue;
@@ -3743,12 +3741,12 @@ static void GetSeqEdges(const TopoDS_Shape& edge,
{
Standard_Integer numV = 0;
for (TopoDS_Iterator Iv(edge,Standard_False); Iv.More(); Iv.Next()) {
TopoDS_Vertex V1 = TopoDS::Vertex(Iv.Value());
const TopoDS_Vertex& V1 = TopoDS::Vertex(Iv.Value());
numV++;
if (VertEdge.IsBound(V1)) {
const TopTools_ListOfShape& listEdges = VertEdge.Find(V1);
for (TopTools_ListIteratorOfListOfShape lIt(listEdges); lIt.More(); lIt.Next()) {
TopoDS_Shape edge1 = lIt.Value();
const TopoDS_Shape& edge1 = lIt.Value();
if (edge1.IsSame(edge)) continue;
Standard_Boolean isContained = Standard_False;
Standard_Integer i, index = 1;
@@ -3771,16 +3769,16 @@ static void GetSeqEdges(const TopoDS_Shape& edge,
//purpose :
//=======================================================================
void BRepBuilderAPI_Sewing::GetFreeWires(TopTools_MapOfShape& MapFreeEdges, TopTools_SequenceOfShape& seqWires)
void BRepBuilderAPI_Sewing::GetFreeWires(TopTools_IndexedMapOfShape& MapFreeEdges,
TopTools_SequenceOfShape& seqWires)
{
TopTools_DataMapOfShapeListOfShape VertEdge;
TopTools_MapIteratorOfMapOfShape itMap(MapFreeEdges);
TopTools_SequenceOfShape seqFreeEdges;
for (; itMap.More(); itMap.Next()) {
TopoDS_Shape edge = itMap.Key();
for (Standard_Integer i = 1; i <= MapFreeEdges.Extent(); i++) {
const TopoDS_Shape& edge = MapFreeEdges.FindKey(i);
seqFreeEdges.Append(edge);
for (TopoDS_Iterator Iv(edge,Standard_False); Iv.More(); Iv.Next()) {
TopoDS_Vertex V1 = TopoDS::Vertex(Iv.Value());
const TopoDS_Vertex& V1 = TopoDS::Vertex(Iv.Value());
if (VertEdge.IsBound(V1))
VertEdge.ChangeFind(V1).Append(edge);
else {
@@ -3794,7 +3792,7 @@ void BRepBuilderAPI_Sewing::GetFreeWires(TopTools_MapOfShape& MapFreeEdges, TopT
Standard_Integer i, j;
for (i = 1; i <= seqFreeEdges.Length(); i++) {
TopTools_SequenceOfShape seqEdges;
TopoDS_Shape edge = seqFreeEdges.Value(i);
const TopoDS_Shape& edge = seqFreeEdges.Value(i);
if (!MapFreeEdges.Contains(edge)) continue;
seqEdges.Append(edge);
GetSeqEdges(edge,seqEdges,VertEdge);
@@ -3802,7 +3800,7 @@ void BRepBuilderAPI_Sewing::GetFreeWires(TopTools_MapOfShape& MapFreeEdges, TopT
B.MakeWire(wire);
for (j = 1; j <= seqEdges.Length(); j++) {
B.Add(wire,seqEdges.Value(j));
MapFreeEdges.Remove(seqEdges.Value(j));
MapFreeEdges.RemoveKey(seqEdges.Value(j));
}
seqWires.Append(wire);
if (MapFreeEdges.IsEmpty()) break;
@@ -3979,20 +3977,21 @@ static TopoDS_Edge DegeneratedSection(const TopoDS_Shape& section, const TopoDS_
void BRepBuilderAPI_Sewing::EdgeProcessing(const Handle(Message_ProgressIndicator)& thePI)
{
// constructs sectionEdge
TopTools_MapOfShape MapFreeEdges;
TopTools_IndexedMapOfShape MapFreeEdges;
TopTools_DataMapOfShapeShape EdgeFace;
Message_ProgressSentry aPS (thePI, "Edge processing", 0, myBoundFaces.Extent(), 1);
for (Standard_Integer i = 1; i <= myBoundFaces.Extent() && aPS.More(); i++, aPS.Next()) {
const TopoDS_Shape& bound = myBoundFaces.FindKey(i);
const TopTools_ListOfShape& listFaces = myBoundFaces(i);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Shape& bound = anIterB.Key();
const TopTools_ListOfShape& listFaces = anIterB.Value();
if (listFaces.Extent() == 1) {
if (myBoundSections.IsBound(bound)) {
TopTools_ListIteratorOfListOfShape liter(myBoundSections(bound));
for (; liter.More(); liter.Next()) {
if (!myMergedEdges.Contains(liter.Value())) { //myReShape->IsRecorded(liter.Value())) {
TopoDS_Shape edge = myReShape->Apply(liter.Value());
const TopoDS_Shape& edge = myReShape->Apply(liter.Value());
if (!MapFreeEdges.Contains(edge)) {
TopoDS_Shape face = listFaces.First();
const TopoDS_Shape& face = listFaces.First();
EdgeFace.Bind(edge,face);
MapFreeEdges.Add(edge);
}
@@ -4001,9 +4000,9 @@ void BRepBuilderAPI_Sewing::EdgeProcessing(const Handle(Message_ProgressIndicato
}
else {
if (!myMergedEdges.Contains(bound)) {
TopoDS_Shape edge = myReShape->Apply(bound);
const TopoDS_Shape& edge = myReShape->Apply(bound);
if (!MapFreeEdges.Contains(edge)) {
TopoDS_Shape face = listFaces.First();
const TopoDS_Shape& face = listFaces.First();
EdgeFace.Bind(edge,face);
MapFreeEdges.Add(edge);
}
@@ -4016,11 +4015,11 @@ void BRepBuilderAPI_Sewing::EdgeProcessing(const Handle(Message_ProgressIndicato
TopTools_SequenceOfShape seqWires;
GetFreeWires(MapFreeEdges,seqWires);
for (Standard_Integer j = 1; j <= seqWires.Length(); j++) {
TopoDS_Wire wire = TopoDS::Wire(seqWires.Value(j));
const TopoDS_Wire& wire = TopoDS::Wire(seqWires.Value(j));
if (!IsDegeneratedWire(wire)) continue;
for (TopoDS_Iterator Ie(wire,Standard_False); Ie.More(); Ie.Next()) {
TopoDS_Shape aTmpShape = myReShape->Apply(Ie.Value()); //for porting
TopoDS_Edge edge = TopoDS::Edge(aTmpShape);
const TopoDS_Edge& edge = TopoDS::Edge(aTmpShape);
TopoDS_Shape face;
if (EdgeFace.IsBound(edge))
face = EdgeFace.Find(edge);
@@ -4075,12 +4074,12 @@ void BRepBuilderAPI_Sewing::CreateSewedShape()
TopoDS_Shape ns = myReShape->Apply(myShape);
aQuilt.Add(ns);
}
Standard_Integer i;
for (i = 1; i <= myOldShapes.Extent(); i++) {
TopoDS_Shape sh = myOldShapes(i);
TopTools_IndexedDataMapOfShapeShape::Iterator anIter(myOldShapes);
for (; anIter.More(); anIter.Next()) {
TopoDS_Shape sh = anIter.Value();
if (!sh.IsNull()) {
sh = myReShape->Apply(sh);
myOldShapes(i) = sh;
anIter.ChangeValue() = sh;
if (!isLocal) aQuilt.Add(sh);
}
}
@@ -4128,7 +4127,7 @@ void BRepBuilderAPI_Sewing::CreateSewedShape()
Standard_Integer nbOldShells = OldShells.Extent();
if (nbOldShells == 1) {
// Single shell - check for single face
TopoDS_Shape sh = OldShells.FindKey(1);
const TopoDS_Shape& sh = OldShells.FindKey(1);
TopoDS_Shape face;
Standard_Integer numf = 0;
for (TopExp_Explorer aExpF(sh,TopAbs_FACE); aExpF.More() && (numf < 2); aExpF.Next()) {
@@ -4145,9 +4144,9 @@ void BRepBuilderAPI_Sewing::CreateSewedShape()
while (IndexMerged.Extent() < nbOldShells) {
TopoDS_Shell NewShell;
TopTools_MapOfShape NewEdges;
for (i = 1; i <= nbOldShells; i++) {
for (Standard_Integer i = 1; i <= nbOldShells; i++) {
if (IndexMerged.Contains(i)) continue;
TopoDS_Shell shell = TopoDS::Shell(OldShells.FindKey(i));
const TopoDS_Shell& shell = TopoDS::Shell(OldShells.FindKey(i));
if (NewShell.IsNull()) {
aB.MakeShell(NewShell);
TopoDS_Iterator aItSS(shell) ;
@@ -4156,7 +4155,7 @@ void BRepBuilderAPI_Sewing::CreateSewedShape()
;
// Fill map of edges
for (TopExp_Explorer eexp(shell,TopAbs_EDGE); eexp.More(); eexp.Next()) {
TopoDS_Shape edge = eexp.Current();
const TopoDS_Shape& edge = eexp.Current();
NewEdges.Add(edge);
}
IndexMerged.Add(i);
@@ -4169,12 +4168,12 @@ void BRepBuilderAPI_Sewing::CreateSewedShape()
if (hasSharedEdge) {
// Add edges to the map
for (TopExp_Explorer eexp1(shell,TopAbs_EDGE); eexp1.More(); eexp1.Next()) {
TopoDS_Shape edge = eexp1.Current();
const TopoDS_Shape& edge = eexp1.Current();
NewEdges.Add(edge);
}
// Add faces to the shell
for (TopExp_Explorer fexp(shell,TopAbs_FACE); fexp.More(); fexp.Next()) {
TopoDS_Shape face = fexp.Current();
const TopoDS_Shape& face = fexp.Current();
aB.Add(NewShell,face);
}
IndexMerged.Add(i);
@@ -4227,7 +4226,8 @@ void BRepBuilderAPI_Sewing::CreateOutputInformations()
if (myBoundSections.IsBound(bound)) lsect = myBoundSections(bound);
TopExp_Explorer aExp(myReShape->Apply(bound),TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
TopoDS_Shape sec = bound, edge = aExp.Current();
TopoDS_Shape sec = bound;
const TopoDS_Shape& edge = aExp.Current();
TopTools_ListIteratorOfListOfShape aI(lsect);
for (; aI.More(); aI.Next()) {
const TopoDS_Shape& section = aI.Value();
@@ -4244,10 +4244,10 @@ void BRepBuilderAPI_Sewing::CreateOutputInformations()
}
// Fill maps of Free, Contigous and Multiple edges
//TopTools_DataMapIteratorOfDataMapOfShapeListOfShape iter2(edgeSections);
for (i = 1; i <= edgeSections.Extent(); i++) {
const TopoDS_Shape& edge = edgeSections.FindKey(i);
const TopTools_ListOfShape& listSection = edgeSections(i);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIter(edgeSections);
for (; anIter.More(); anIter.Next()) {
const TopoDS_Shape& edge = anIter.Key();
const TopTools_ListOfShape& listSection = anIter.Value();
if (listSection.Extent() == 1) {
if (BRep_Tool::Degenerated(TopoDS::Edge(edge)))
myDegenerated.Add(edge);
@@ -4265,11 +4265,11 @@ void BRepBuilderAPI_Sewing::CreateOutputInformations()
// constructs myContigSectBound
TopTools_DataMapOfShapeListOfShape aEdgeMap; //gka
for (i = 1; i <= myBoundFaces.Extent(); i++) {
TopoDS_Shape bound = myBoundFaces.FindKey(i);
const TopoDS_Shape& bound = myBoundFaces.FindKey(i);
if (myBoundSections.IsBound(bound)) {
TopTools_ListIteratorOfListOfShape iter(myBoundSections(bound));
for (; iter.More(); iter.Next()) {
TopoDS_Shape section = iter.Value();
const TopoDS_Shape& section = iter.Value();
if(!myMergedEdges.Contains(section)) continue;
//if (!myReShape->IsRecorded(section)) continue; // section is free
TopoDS_Shape nedge = myReShape->Apply(section);
@@ -4437,7 +4437,7 @@ void BRepBuilderAPI_Sewing::CreateCuttingNodes(const TopTools_IndexedMapOfShape&
seqPnt.Prepend(GAC.Value(first)); seqPnt.Append(GAC.Value(last));
}
TopTools_DataMapOfShapeShape NodeCuttingVertex;
TopTools_IndexedDataMapOfShapeShape NodeCuttingVertex;
for (i = 1; i <= nbProj; i++) {
const Standard_Integer index = seqOrderedIndex(i);
@@ -4446,7 +4446,7 @@ void BRepBuilderAPI_Sewing::CreateCuttingNodes(const TopTools_IndexedMapOfShape&
// Skip node if already bound to cutting vertex
TopoDS_Shape node = myVertexNode.FindFromKey(MapVert(index));
if (NodeCuttingVertex.IsBound(node)) continue;
if (NodeCuttingVertex.Contains(node)) continue;
// Find the closest vertex
Standard_Integer indexMin = 1;
@@ -4464,11 +4464,11 @@ void BRepBuilderAPI_Sewing::CreateCuttingNodes(const TopTools_IndexedMapOfShape&
// Bind new cutting node (end vertex only)
seqDist.SetValue(indexMin,disProj);
TopoDS_Shape cvertex = seqVert.Value(indexMin);
NodeCuttingVertex.Bind(node,cvertex);
NodeCuttingVertex.Add(node,cvertex);
}
else {
// Bind secondary cutting nodes
NodeCuttingVertex.Bind(node,TopoDS_Vertex());
NodeCuttingVertex.Add(node,TopoDS_Vertex());
}
}
else {
@@ -4476,7 +4476,7 @@ void BRepBuilderAPI_Sewing::CreateCuttingNodes(const TopTools_IndexedMapOfShape&
TopoDS_Vertex cvertex;
aBuilder.MakeVertex(cvertex, pntProj, Precision::Confusion());
// Bind new cutting vertex
NodeCuttingVertex.Bind(node,cvertex);
NodeCuttingVertex.Add(node,cvertex);
// Insert cutting vertex in the sequences
Standard_Real parProj = arrPara(index);
for (j = 2; j <= seqPara.Length(); j++) {
@@ -4492,13 +4492,13 @@ void BRepBuilderAPI_Sewing::CreateCuttingNodes(const TopTools_IndexedMapOfShape&
}
// filling map for cutting nodes
TopTools_DataMapIteratorOfDataMapOfShapeShape mit(NodeCuttingVertex);
for (; mit.More(); mit.Next()) {
TopoDS_Shape cnode = mit.Value();
TopTools_IndexedDataMapOfShapeShape::Iterator aMIt(NodeCuttingVertex);
for (; aMIt.More(); aMIt.Next()) {
TopoDS_Shape cnode = aMIt.Value();
// Skip secondary nodes
if (cnode.IsNull()) continue;
// Obtain vertex node
TopoDS_Shape node = mit.Key();
const TopoDS_Shape& node = aMIt.Key();
if (myVertexNode.Contains(cnode)) {
// This is an end vertex
cnode = myVertexNode.FindFromKey(cnode);

View File

@@ -295,7 +295,8 @@ protected:
//! Get wire from free edges.
//! This method is called from EdgeProcessing only
Standard_EXPORT virtual void GetFreeWires (TopTools_MapOfShape& MapFreeEdges, TopTools_SequenceOfShape& seqWires);
Standard_EXPORT virtual void GetFreeWires (TopTools_IndexedMapOfShape& MapFreeEdges,
TopTools_SequenceOfShape& seqWires);
//! This method is called from MergingOfSections only

View File

@@ -452,13 +452,7 @@ const TopTools_ListOfShape& BRepFill_OffsetWire::GeneratedShapes
}
if ( !it.Value().IsSame(it.Key())) {
myMap.ChangeFromKey(it.Value()).Append(myMap.ChangeFromKey(it.Key()));
//myMap.UnBind(it.Key());
TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
TopTools_ListOfShape LastList;
LastList.Append(myMap(myMap.Extent()));
myMap.RemoveLast();
if (myMap.FindIndex(it.Key()) != 0)
myMap.Substitute(myMap.FindIndex(it.Key()), LastShape, LastList);
myMap.RemoveKey(it.Key());
}
}
if (myMap.Contains(it.Key().Reversed())) {
@@ -468,13 +462,7 @@ const TopTools_ListOfShape& BRepFill_OffsetWire::GeneratedShapes
}
if ( !it.Value().IsSame(it.Key())) {
myMap.ChangeFromKey(it.Value().Reversed()).Append(myMap.ChangeFromKey(it.Key().Reversed()));
//myMap.UnBind(it.Key().Reversed());
TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
TopTools_ListOfShape LastList;
LastList.Append(myMap(myMap.Extent()));
myMap.RemoveLast();
if (myMap.FindIndex(it.Key().Reversed()) != 0)
myMap.Substitute(myMap.FindIndex(it.Key().Reversed()), LastShape, LastList);
myMap.RemoveKey(it.Key().Reversed());
}
}
}
@@ -821,13 +809,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
if (!myMap.IsEmpty() &&
myMap.FindKey(1).ShapeType() == TopAbs_VERTEX)
{
//myMap.RemoveFirst();
TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
TopTools_ListOfShape LastList;
LastList.Append(myMap(myMap.Extent()));
myMap.RemoveLast();
if (!myMap.IsEmpty())
myMap.Substitute(1, LastShape, LastList);
myMap.RemoveFromIndex(1);
}
if (!myMap.IsEmpty() &&
myMap.FindKey(myMap.Extent()).ShapeType() == TopAbs_VERTEX)
@@ -1447,13 +1429,7 @@ void BRepFill_OffsetWire::MakeWires()
if (myIsOpenResult && MVE.FindFromKey(CV).IsEmpty())
{
//MVE.UnBind(CV);
TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
TopTools_ListOfShape LastList;
LastList.Append(MVE(MVE.Extent()));
MVE.RemoveLast();
if (MVE.FindIndex(CV) != 0)
MVE.Substitute(MVE.FindIndex(CV), LastShape, LastList);
MVE.RemoveKey(CV);
}
@@ -1476,13 +1452,7 @@ void BRepFill_OffsetWire::MakeWires()
isClosed = VF.IsSame(CV);
// Modified by Sergey KHROMOV - Thu Mar 14 11:30:15 2002 End
End = Standard_True;
//MVE.UnBind(VF);
TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
TopTools_ListOfShape LastList;
LastList.Append(MVE(MVE.Extent()));
MVE.RemoveLast();
if (MVE.FindIndex(VF) != 0)
MVE.Substitute(MVE.FindIndex(VF), LastShape, LastList);
MVE.RemoveKey(VF);
}
if (!End) {
@@ -1504,13 +1474,7 @@ void BRepFill_OffsetWire::MakeWires()
if (MVE.FindFromKey(CV).IsEmpty())
{
//MVE.UnBind(CV);
TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
TopTools_ListOfShape LastList;
LastList.Append(MVE(MVE.Extent()));
MVE.RemoveLast();
if (MVE.FindIndex(CV) != 0)
MVE.Substitute(MVE.FindIndex(CV), LastShape, LastList);
MVE.RemoveKey(CV);
}
}
}

View File

@@ -223,8 +223,11 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
if (F1.IsSame(F2)) return;
if (IsDone(F1,F2)) return;
const TopoDS_Shape& InitF1 = InitOffsetFace.ImageFrom(F1);
const TopoDS_Shape& InitF2 = InitOffsetFace.ImageFrom(F2);
if (InitF1.IsSame(InitF2)) return;
Standard_Boolean InterPipes = (InitF2.ShapeType() == TopAbs_EDGE &&
InitF1.ShapeType() == TopAbs_EDGE );
Standard_Boolean InterFaces = (InitF1.ShapeType() == TopAbs_FACE &&

View File

@@ -314,6 +314,10 @@ static BRepOffset_Error checkSinglePoint(const Standard_Real theUParam,
//---------------------------------------------------------------------
static void UpdateTolerance ( TopoDS_Shape& myShape,
const TopTools_IndexedMapOfShape& myFaces);
static Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
const Handle(Geom_Curve)& theCrv,
const Standard_Real theFirst,
const Standard_Real theLast);
static void CorrectSolid(TopoDS_Solid& theSol, TopTools_ListOfShape& theSolList);
//---------------------------------------------------------------------
@@ -676,13 +680,7 @@ static void RemoveCorks (TopoDS_Shape& S,
B.Add(SS,Cork);
}
else {
//Faces.Remove (Cork);
//begin instead of Remove//
TopoDS_Shape LastShape = Faces(Faces.Extent());
Faces.RemoveLast();
if (Faces.FindIndex(Cork) != 0)
Faces.Substitute(Faces.FindIndex(Cork), LastShape);
//end instead of Remove //
Faces.RemoveKey(Cork);
Faces.Add(Cork); // to reset it with proper orientation.
}
}
@@ -727,7 +725,10 @@ static void MakeList (TopTools_ListOfShape& OffsetFaces,
const TopoDS_Shape& Root = itLOF.Value();
if (!myFaces.Contains(Root)) {
if (myInitOffsetFace.HasImage(Root)) {
OffsetFaces.Append(myInitOffsetFace.Image(Root).First());
TopTools_ListIteratorOfListOfShape aItLS(myInitOffsetFace.Image(Root));
for (; aItLS.More(); aItLS.Next()) {
OffsetFaces.Append(aItLS.Value());
}
}
}
}
@@ -3342,15 +3343,39 @@ void BRepOffset_MakeOffset::EncodeRegularity ()
#endif
}
//=======================================================================
//function : ComputeMaxDist
//purpose :
//=======================================================================
Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
const Handle(Geom_Curve)& theCrv,
const Standard_Real theFirst,
const Standard_Real theLast)
{
Standard_Real aMaxDist = 0.;
Standard_Integer i, NCONTROL = 23;
Standard_Real aPrm, aDist2;
gp_Pnt aP;
for (i = 0; i< NCONTROL; i++) {
aPrm = ((NCONTROL - 1 - i)*theFirst + i*theLast) / (NCONTROL - 1);
aP = theCrv->Value(aPrm);
if (Precision::IsInfinite(aP.X()) || Precision::IsInfinite(aP.Y())
|| Precision::IsInfinite(aP.Z()))
{
return Precision::Infinite();
}
aDist2 = thePlane.SquareDistance(aP);
if (aDist2 > aMaxDist) aMaxDist = aDist2;
}
return sqrt(aMaxDist)*1.05;
}
//=======================================================================
//function : UpDateTolerance
//purpose :
//=======================================================================
void UpdateTolerance (TopoDS_Shape& S,
const TopTools_IndexedMapOfShape& Faces)
const TopTools_IndexedMapOfShape& Faces)
{
BRep_Builder B;
TopTools_MapOfShape View;
@@ -3366,27 +3391,55 @@ void UpdateTolerance (TopoDS_Shape& S,
}
}
TopExp_Explorer Exp;
for (Exp.Init(S,TopAbs_EDGE); Exp.More(); Exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
if (View.Add(E)) {
Handle(BRepCheck_Edge) EdgeCorrector = new BRepCheck_Edge(E);
Standard_Real Tol = EdgeCorrector->Tolerance();
B.UpdateEdge (E,Tol);
// Update the vertices.
TopExp::Vertices(E,V[0],V[1]);
for (Standard_Integer i = 0 ; i <=1 ; i++) {
if (View.Add(V[i])) {
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V[i].TShape());
TV->Tolerance(0.);
Handle(BRepCheck_Vertex) VertexCorrector = new BRepCheck_Vertex(V[i]);
B.UpdateVertex (V[i],VertexCorrector->Tolerance());
// use the occasion to clean the vertices.
(TV->ChangePoints()).Clear();
Standard_Real Tol;
TopExp_Explorer ExpF;
for (ExpF.Init(S, TopAbs_FACE); ExpF.More(); ExpF.Next())
{
const TopoDS_Shape& F = ExpF.Current();
if (Faces.Contains(F))
{
continue;
}
BRepAdaptor_Surface aBAS(TopoDS::Face(F), Standard_False);
TopExp_Explorer Exp;
for (Exp.Init(F, TopAbs_EDGE); Exp.More(); Exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
Standard_Boolean isUpdated = Standard_False;
if (aBAS.GetType() == GeomAbs_Plane)
{
//Edge does not seem to have pcurve on plane,
//so EdgeCorrector does not include it in tolerance calculation
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCrv = BRep_Tool::Curve(E, aFirst, aLast);
Standard_Real aMaxDist = ComputeMaxDist(aBAS.Plane(), aCrv, aFirst, aLast);
B.UpdateEdge(E, aMaxDist);
isUpdated = Standard_True;
}
if (View.Add(E))
{
BRepCheck_Edge EdgeCorrector(E);
Tol = EdgeCorrector.Tolerance();
B.UpdateEdge(E, Tol);
isUpdated = Standard_True;
}
if (isUpdated)
{
Tol = BRep_Tool::Tolerance(E);
// Update the vertices.
TopExp::Vertices(E, V[0], V[1]);
for (Standard_Integer i = 0; i <= 1; i++) {
if (View.Add(V[i])) {
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V[i].TShape());
TV->Tolerance(0.);
BRepCheck_Vertex VertexCorrector(V[i]);
B.UpdateVertex(V[i], VertexCorrector.Tolerance());
// use the occasion to clean the vertices.
(TV->ChangePoints()).Clear();
}
B.UpdateVertex(V[i], Tol);
}
B.UpdateVertex(V[i],Tol);
}
}
}

View File

@@ -5205,8 +5205,14 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
//
// intersect valid splits with bounds and update both
BOPAlgo_Builder aGF;
aGF.AddArgument(aSplits);
// The order is important here, because we need to keep the
// unmodified edges from the Bounds in the resulting maps.
// In case of total coincidence of the edges with the same vertices
// the edges in the common block will not be split and no new
// edges will be created and the first pave block
// will be used as a real pave block.
aGF.AddArgument(aBounds);
aGF.AddArgument(aSplits);
aGF.Perform();
//
// update splits
@@ -5222,7 +5228,7 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
UpdateOrigins(aLABounds, theEdgesOrigins, aGF);
UpdateIntersectedEdges(aLABounds, theETrimEInf, aGF);
//
// update the edges to avoid with the splits
// update the EdgesToAvoid with the splits
TopTools_IndexedMapOfShape aNewEdges;
const TopTools_ListOfShape* pSplitsIm = aGF.Images().Seek(aSplits);
if (pSplitsIm) {
@@ -5240,7 +5246,7 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
for (; aItLEIm.More(); aItLEIm.Next()) {
const TopoDS_Shape& aEIm = aItLEIm.Value();
if (!aNewEdges.Contains(aEIm)) {
theEdgesToAvoid.Add(aItLEIm.Value());
theEdgesToAvoid.Add(aEIm);
}
}
}

View File

@@ -18,6 +18,9 @@
#include <BVH_QuadTree.hxx>
#include <deque>
#include <tuple>
//! Specialization of binary BVH tree.
template<class T, int N>
class BVH_Tree<T, N, BVH_BinaryTree> : public BVH_TreeBase<T, N>
@@ -32,59 +35,101 @@ public: //! @name methods for accessing individual nodes
BVH_Tree() : BVH_TreeBase<T, N>() { }
//! Sets node type to 'outer'.
void SetOuter (const int theNodeIndex);
void SetOuter (const int theNodeIndex) { BVH::Array<int, 4>::ChangeValue (this->myNodeInfoBuffer, theNodeIndex).x() = 1; }
//! Sets node type to 'inner'.
void SetInner (const int theNodeIndex);
void SetInner (const int theNodeIndex) { BVH::Array<int, 4>::ChangeValue (this->myNodeInfoBuffer, theNodeIndex).x() = 0; }
//! Returns index of the K-th child of the given inner node.
//! \tparam K the index of node child (0 or 1)
template<int K>
int Child (const int theNodeIndex) const;
int Child (const int theNodeIndex) const { return BVH::Array<int, 4>::Value (this->myNodeInfoBuffer, theNodeIndex)[K + 1]; }
//! Returns index of the K-th child of the given inner node.
//! \tparam K the index of node child (0 or 1)
template<int K>
int& Child (const int theNodeIndex);
int& ChangeChild (const int theNodeIndex) { return BVH::Array<int, 4>::ChangeValue (this->myNodeInfoBuffer, theNodeIndex)[K + 1]; }
//! Returns index of the K-th child of the given inner node.
//! \tparam K the index of node child (0 or 1)
template<int K>
int& Child (const int theNodeIndex) { return BVH::Array<int, 4>::ChangeValue (this->myNodeInfoBuffer, theNodeIndex)[K + 1]; }
public: //! @name methods for adding/removing tree nodes
//! Removes all nodes from the tree.
void Clear();
void Clear()
{
this->myDepth = 0;
BVH::Array<T, N>::Clear (this->myMinPointBuffer);
BVH::Array<T, N>::Clear (this->myMaxPointBuffer);
BVH::Array<int, 4>::Clear(this->myNodeInfoBuffer);
}
//! Reserves internal BVH storage, so that it
//! can contain the given number of BVH nodes.
void Reserve (const int theNbNodes);
void Reserve (const int theNbNodes)
{
BVH::Array<T, N>::Reserve (this->myMinPointBuffer, theNbNodes);
BVH::Array<T, N>::Reserve (this->myMaxPointBuffer, theNbNodes);
BVH::Array<int, 4>::Reserve (this->myNodeInfoBuffer, theNbNodes);
}
//! Adds new leaf node to the BVH.
int AddLeafNode (const BVH_VecNt& theMinPoint,
const BVH_VecNt& theMaxPoint,
const int theBegElem,
const int theEndElem);
const int theEndElem)
{
BVH::Array<T, N>::Append (this->myMinPointBuffer, theMinPoint);
BVH::Array<T, N>::Append (this->myMaxPointBuffer, theMaxPoint);
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
//! Adds new inner node to the BVH.
int AddInnerNode (const BVH_VecNt& theMinPoint,
const BVH_VecNt& theMaxPoint,
const int theLftChild,
const int theRghChild);
const int theRghChild)
{
BVH::Array<T, N>::Append (this->myMinPointBuffer, theMinPoint);
BVH::Array<T, N>::Append (this->myMaxPointBuffer, theMaxPoint);
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
//! Adds new leaf node to the BVH.
int AddLeafNode (const BVH_Box<T, N>& theAABB,
const int theBegElem,
const int theEndElem);
const int theEndElem)
{
return AddLeafNode (theAABB.CornerMin(), theAABB.CornerMax(), theBegElem, theEndElem);
}
//! Adds new inner node to the BVH.
int AddInnerNode (const BVH_Box<T, N>& theAABB,
const int theLftChild,
const int theRghChild);
const int theRghChild)
{
return AddInnerNode (theAABB.CornerMin(), theAABB.CornerMax(), theLftChild, theRghChild);
}
//! Adds new leaf node to the BVH with UNINITIALIZED bounds.
int AddLeafNode (const int theBegElem,
const int theEndElem);
const int theEndElem)
{
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
//! Adds new inner node to the BVH with UNINITIALIZED bounds.
int AddInnerNode (const int theLftChild,
const int theRghChild);
const int theRghChild)
{
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
public: //! @name methods specific to binary BVH
@@ -99,6 +144,130 @@ public: //! @name methods specific to binary BVH
};
#include <BVH_BinaryTree.lxx>
namespace BVH
{
//! Internal function for recursive calculation of
//! surface area heuristic (SAH) of the given tree.
template<class T, int N>
void EstimateSAH (const BVH_Tree<T, N, BVH_BinaryTree>* theTree, const int theNode, T theProb, T& theSAH)
{
BVH_Box<T, N> aBox (theTree->MinPoint (theNode),
theTree->MaxPoint (theNode));
if (theTree->IsOuter (theNode))
{
theSAH += theProb * (theTree->EndPrimitive (theNode) - theTree->BegPrimitive (theNode) + 1);
}
else
{
theSAH += theProb * static_cast<T> (2.0);
BVH_Box<T, N> aLftBox (theTree->MinPoint (theTree->template Child<0> (theNode)),
theTree->MaxPoint (theTree->template Child<0> (theNode)));
if (theProb > 0.0)
{
EstimateSAH (theTree, theTree->template Child<0> (theNode),
theProb * aLftBox.Area() / aBox.Area(), theSAH);
}
BVH_Box<T, N> aRghBox (theTree->MinPoint (theTree->template Child<1> (theNode)),
theTree->MaxPoint (theTree->template Child<1> (theNode)));
if (theProb > 0.0)
{
EstimateSAH (theTree, theTree->template Child<1> (theNode),
theProb * aRghBox.Area() / aBox.Area(), theSAH);
}
}
}
}
// =======================================================================
// function : EstimateSAH
// purpose :
// =======================================================================
template<class T, int N>
T BVH_Tree<T, N, BVH_BinaryTree>::EstimateSAH() const
{
T aSAH = static_cast<T> (0.0);
BVH::EstimateSAH<T, N> (this, 0, static_cast<T> (1.0), aSAH);
return aSAH;
}
// =======================================================================
// function : CollapseToQuadTree
// purpose :
// =======================================================================
template<class T, int N>
BVH_Tree<T, N, BVH_QuadTree>* BVH_Tree<T, N, BVH_BinaryTree>::CollapseToQuadTree() const
{
BVH_Tree<T, N, BVH_QuadTree>* aQBVH = new BVH_Tree<T, N, BVH_QuadTree>;
if (this->Length() == 0)
{
return aQBVH;
}
std::deque<std::pair<int, int> > aQueue (1, std::make_pair (0, 0));
for (int aNbNodes = 1; !aQueue.empty();)
{
const std::pair<int, int> aNode = aQueue.front();
BVH::Array<T, N>::Append (aQBVH->myMinPointBuffer, BVH::Array<T, N>::Value (this->myMinPointBuffer, std::get<0> (aNode)));
BVH::Array<T, N>::Append (aQBVH->myMaxPointBuffer, BVH::Array<T, N>::Value (this->myMaxPointBuffer, std::get<0> (aNode)));
BVH_Vec4i aNodeInfo;
if (this->IsOuter (std::get<0> (aNode))) // is leaf node
{
aNodeInfo = BVH_Vec4i (1 /* leaf flag */,
this->BegPrimitive (std::get<0> (aNode)), this->EndPrimitive (std::get<0> (aNode)), std::get<1> (aNode) /* level */);
}
else
{
NCollection_Vector<int> aGrandChildNodes;
const int aLftChild = Child<0> (std::get<0> (aNode));
const int aRghChild = Child<1> (std::get<0> (aNode));
if (this->IsOuter (aLftChild)) // is leaf node
{
aGrandChildNodes.Append (aLftChild);
}
else
{
aGrandChildNodes.Append (Child<0> (aLftChild));
aGrandChildNodes.Append (Child<1> (aLftChild));
}
if (this->IsOuter (aRghChild)) // is leaf node
{
aGrandChildNodes.Append (aRghChild);
}
else
{
aGrandChildNodes.Append (Child<0> (aRghChild));
aGrandChildNodes.Append (Child<1> (aRghChild));
}
for (int aNodeIdx = 0; aNodeIdx < aGrandChildNodes.Size(); ++aNodeIdx)
{
aQueue.push_back (std::make_pair (aGrandChildNodes (aNodeIdx), std::get<1> (aNode) + 1));
}
aNodeInfo = BVH_Vec4i (0 /* inner flag */,
aNbNodes, aGrandChildNodes.Size() - 1, std::get<1> (aNode) /* level */);
aQBVH->myDepth = Max (aQBVH->myDepth, std::get<1> (aNode) + 1);
aNbNodes += aGrandChildNodes.Size();
}
BVH::Array<int, 4>::Append (aQBVH->myNodeInfoBuffer, aNodeInfo);
aQueue.pop_front(); // node processing completed
}
return aQBVH;
}
#endif // _BVH_BinaryTree_Header

View File

@@ -1,307 +0,0 @@
// Created on: 2016-06-20
// Created by: Denis BOGOLEPOV
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <deque>
#include <tuple>
// =======================================================================
// function : Child
// purpose : Returns index of the K-th child of the given inner node
// =======================================================================
template<class T, int N> template<int K>
int& BVH_Tree<T, N, BVH_BinaryTree>::Child (const int theNodeIndex)
{
return BVH::Array<int, 4>::ChangeValue (this->myNodeInfoBuffer, theNodeIndex)[K + 1];
}
// =======================================================================
// function : Child
// purpose : Returns index of the K-th child of the given inner node
// =======================================================================
template<class T, int N> template<int K>
int BVH_Tree<T, N, BVH_BinaryTree>::Child (const int theNodeIndex) const
{
return BVH::Array<int, 4>::Value (this->myNodeInfoBuffer, theNodeIndex)[K + 1];
}
// =======================================================================
// function : SetOuter
// purpose : Sets node type to 'outer'
// =======================================================================
template<class T, int N>
void BVH_Tree<T, N, BVH_BinaryTree>::SetOuter (const int theNodeIndex)
{
BVH::Array<int, 4>::ChangeValue (this->myNodeInfoBuffer, theNodeIndex).x() = 1;
}
// =======================================================================
// function : SetOuter
// purpose : Sets node type to 'inner'
// =======================================================================
template<class T, int N>
void BVH_Tree<T, N, BVH_BinaryTree>::SetInner (const int theNodeIndex)
{
BVH::Array<int, 4>::ChangeValue (this->myNodeInfoBuffer, theNodeIndex).x() = 0;
}
// =======================================================================
// function : Clear
// purpose : Removes all BVH nodes
// =======================================================================
template<class T, int N>
void BVH_Tree<T, N, BVH_BinaryTree>::Clear()
{
this->myDepth = 0;
BVH::Array<T, N>::Clear (this->myMinPointBuffer);
BVH::Array<T, N>::Clear (this->myMaxPointBuffer);
BVH::Array<int, 4>::Clear (this->myNodeInfoBuffer);
}
// =======================================================================
// function : AddLeafNode
// purpose : Adds new leaf node to the BVH
// =======================================================================
template<class T, int N>
int BVH_Tree<T, N, BVH_BinaryTree>::AddLeafNode (const int theBegElem,
const int theEndElem)
{
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
// =======================================================================
// function : AddInnerNode
// purpose : Adds new inner node to the BVH
// =======================================================================
template<class T, int N>
int BVH_Tree<T, N, BVH_BinaryTree>::AddInnerNode (const int theLftChild,
const int theRghChild)
{
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
// =======================================================================
// function : AddLeafNode
// purpose : Adds new leaf node to the BVH
// =======================================================================
template<class T, int N>
int BVH_Tree<T, N, BVH_BinaryTree>::AddLeafNode (const BVH_VecNt& theMinPoint,
const BVH_VecNt& theMaxPoint,
const int theBegElem,
const int theEndElem)
{
BVH::Array<T, N>::Append (this->myMinPointBuffer, theMinPoint);
BVH::Array<T, N>::Append (this->myMaxPointBuffer, theMaxPoint);
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (1, theBegElem, theEndElem, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
// =======================================================================
// function : AddInnerNode
// purpose : Adds new inner node to the BVH
// =======================================================================
template<class T, int N>
int BVH_Tree<T, N, BVH_BinaryTree>::AddInnerNode (const BVH_VecNt& theMinPoint,
const BVH_VecNt& theMaxPoint,
const int theLftChild,
const int theRghChild)
{
BVH::Array<T, N>::Append (this->myMinPointBuffer, theMinPoint);
BVH::Array<T, N>::Append (this->myMaxPointBuffer, theMaxPoint);
BVH::Array<int, 4>::Append (this->myNodeInfoBuffer, BVH_Vec4i (0, theLftChild, theRghChild, 0));
return BVH::Array<int, 4>::Size (this->myNodeInfoBuffer) - 1;
}
// =======================================================================
// function : AddLeafNode
// purpose : Adds new leaf node to the BVH
// =======================================================================
template<class T, int N>
int BVH_Tree<T, N, BVH_BinaryTree>::AddLeafNode (const BVH_Box<T, N>& theAABB,
const int theBegElem,
const int theEndElem)
{
return AddLeafNode (theAABB.CornerMin(),
theAABB.CornerMax(),
theBegElem,
theEndElem);
}
// =======================================================================
// function : AddInnerNode
// purpose : Adds new inner node to the BVH
// =======================================================================
template<class T, int N>
int BVH_Tree<T, N, BVH_BinaryTree>::AddInnerNode (const BVH_Box<T, N>& theAABB,
const int theLftChild,
const int theRghChild)
{
return AddInnerNode (theAABB.CornerMin(),
theAABB.CornerMax(),
theLftChild,
theRghChild);
}
namespace BVH
{
//! Internal function for recursive calculation of
//! surface area heuristic (SAH) of the given tree.
template<class T, int N>
void EstimateSAH (const BVH_Tree<T, N, BVH_BinaryTree>* theTree, const int theNode, T theProb, T& theSAH)
{
BVH_Box<T, N> aBox (theTree->MinPoint (theNode),
theTree->MaxPoint (theNode));
if (theTree->IsOuter (theNode))
{
theSAH += theProb * (theTree->EndPrimitive (theNode) - theTree->BegPrimitive (theNode) + 1);
}
else
{
theSAH += theProb * static_cast<T> (2.0);
BVH_Box<T, N> aLftBox (theTree->MinPoint (theTree->template Child<0> (theNode)),
theTree->MaxPoint (theTree->template Child<0> (theNode)));
if (theProb > 0.0)
{
EstimateSAH (theTree, theTree->template Child<0> (theNode),
theProb * aLftBox.Area() / aBox.Area(), theSAH);
}
BVH_Box<T, N> aRghBox (theTree->MinPoint (theTree->template Child<1> (theNode)),
theTree->MaxPoint (theTree->template Child<1> (theNode)));
if (theProb > 0.0)
{
EstimateSAH (theTree, theTree->template Child<1> (theNode),
theProb * aRghBox.Area() / aBox.Area(), theSAH);
}
}
}
}
// =======================================================================
// function : EstimateSAH
// purpose :
// =======================================================================
template<class T, int N>
T BVH_Tree<T, N, BVH_BinaryTree>::EstimateSAH() const
{
T aSAH = static_cast<T> (0.0);
BVH::EstimateSAH<T, N> (this, 0, static_cast<T> (1.0), aSAH);
return aSAH;
}
// =======================================================================
// function : Reserve
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Tree<T, N, BVH_BinaryTree>::Reserve (const int theNbNodes)
{
BVH::Array<T, N>::Reserve (this->myMinPointBuffer, theNbNodes);
BVH::Array<T, N>::Reserve (this->myMaxPointBuffer, theNbNodes);
BVH::Array<int, 4>::Reserve (this->myNodeInfoBuffer, theNbNodes);
}
// =======================================================================
// function : CollapseToQuadTree
// purpose :
// =======================================================================
template<class T, int N>
BVH_Tree<T, N, BVH_QuadTree>* BVH_Tree<T, N, BVH_BinaryTree>::CollapseToQuadTree() const
{
BVH_Tree<T, N, BVH_QuadTree>* aQBVH = new BVH_Tree<T, N, BVH_QuadTree>;
if (this->Length() == 0)
{
return aQBVH;
}
std::deque<std::pair<int, int> > aQueue (1, std::make_pair (0, 0));
for (int aNbNodes = 1; !aQueue.empty();)
{
const std::pair<int, int> aNode = aQueue.front();
BVH::Array<T, N>::Append (aQBVH->myMinPointBuffer, BVH::Array<T, N>::Value (this->myMinPointBuffer, std::get<0> (aNode)));
BVH::Array<T, N>::Append (aQBVH->myMaxPointBuffer, BVH::Array<T, N>::Value (this->myMaxPointBuffer, std::get<0> (aNode)));
BVH_Vec4i aNodeInfo;
if (this->IsOuter (std::get<0> (aNode))) // is leaf node
{
aNodeInfo = BVH_Vec4i (1 /* leaf flag */,
this->BegPrimitive (std::get<0> (aNode)), this->EndPrimitive (std::get<0> (aNode)), std::get<1> (aNode) /* level */);
}
else
{
NCollection_Vector<int> aGrandChildNodes;
const int aLftChild = Child<0> (std::get<0> (aNode));
const int aRghChild = Child<1> (std::get<0> (aNode));
if (this->IsOuter (aLftChild)) // is leaf node
{
aGrandChildNodes.Append (aLftChild);
}
else
{
aGrandChildNodes.Append (Child<0> (aLftChild));
aGrandChildNodes.Append (Child<1> (aLftChild));
}
if (this->IsOuter (aRghChild)) // is leaf node
{
aGrandChildNodes.Append (aRghChild);
}
else
{
aGrandChildNodes.Append (Child<0> (aRghChild));
aGrandChildNodes.Append (Child<1> (aRghChild));
}
for (int aNodeIdx = 0; aNodeIdx < aGrandChildNodes.Size(); ++aNodeIdx)
{
aQueue.push_back (std::make_pair (aGrandChildNodes (aNodeIdx), std::get<1> (aNode) + 1));
}
aNodeInfo = BVH_Vec4i (0 /* inner flag */,
aNbNodes, aGrandChildNodes.Size() - 1, std::get<1> (aNode) /* level */);
aQBVH->myDepth = Max (aQBVH->myDepth, std::get<1> (aNode) + 1);
aNbNodes += aGrandChildNodes.Size();
}
BVH::Array<int, 4>::Append (aQBVH->myNodeInfoBuffer, aNodeInfo);
aQueue.pop_front(); // node processing completed
}
return aQBVH;
}

View File

@@ -20,6 +20,12 @@
#include <algorithm>
#if defined (_WIN32) && defined (max)
#undef max
#endif
#include <limits>
//! Stores parameters of single bin (slice of AABB).
template<class T, int N>
struct BVH_Bin
@@ -61,24 +67,29 @@ public:
BVH_BinnedBuilder (const Standard_Integer theLeafNodeSize = 5,
const Standard_Integer theMaxTreeDepth = 32,
const Standard_Boolean theDoMainSplits = 0,
const Standard_Integer theNumOfThreads = 1);
const Standard_Integer theNumOfThreads = 1)
: BVH_QueueBuilder<T, N> (theLeafNodeSize, theMaxTreeDepth, theNumOfThreads),
myUseMainAxis (theDoMainSplits)
{
//
}
//! Releases resources of binned SAH BVH builder.
virtual ~BVH_BinnedBuilder();
virtual ~BVH_BinnedBuilder() {}
protected:
//! Performs splitting of the given BVH node.
typename BVH_QueueBuilder<T, N>::BVH_ChildNodes BuildNode (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const Standard_Integer theNode);
virtual typename BVH_QueueBuilder<T, N>::BVH_ChildNodes buildNode (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const Standard_Integer theNode) const Standard_OVERRIDE;
//! Arranges node primitives into bins.
virtual void GetSubVolumes (BVH_Set<T, N>* theSet,
virtual void getSubVolumes (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const Standard_Integer theNode,
BVH_BinVector& theBins,
const Standard_Integer theAxis);
const Standard_Integer theAxis) const;
private:
@@ -86,6 +97,226 @@ private:
};
#include <BVH_BinnedBuilder.lxx>
// =======================================================================
// function : getSubVolumes
// purpose :
// =======================================================================
template<class T, int N, int Bins>
void BVH_BinnedBuilder<T, N, Bins>::getSubVolumes (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const Standard_Integer theNode,
BVH_BinVector& theBins,
const Standard_Integer theAxis) const
{
const T aMin = BVH::VecComp<T, N>::Get (theBVH->MinPoint (theNode), theAxis);
const T aMax = BVH::VecComp<T, N>::Get (theBVH->MaxPoint (theNode), theAxis);
const T anInverseStep = static_cast<T> (Bins) / (aMax - aMin);
for (Standard_Integer anIdx = theBVH->BegPrimitive (theNode); anIdx <= theBVH->EndPrimitive (theNode); ++anIdx)
{
typename BVH_Set<T, N>::BVH_BoxNt aBox = theSet->Box (anIdx);
Standard_Integer aBinIndex = BVH::IntFloor<T> ((theSet->Center (anIdx, theAxis) - aMin) * anInverseStep);
if (aBinIndex < 0)
{
aBinIndex = 0;
}
else if (aBinIndex >= Bins)
{
aBinIndex = Bins - 1;
}
theBins[aBinIndex].Count++;
theBins[aBinIndex].Box.Combine (aBox);
}
}
namespace BVH
{
template<class T, int N>
Standard_Integer SplitPrimitives (BVH_Set<T, N>* theSet,
const BVH_Box<T, N>& theBox,
const Standard_Integer theBeg,
const Standard_Integer theEnd,
const Standard_Integer theBin,
const Standard_Integer theAxis,
const Standard_Integer theBins)
{
const T aMin = BVH::VecComp<T, N>::Get (theBox.CornerMin(), theAxis);
const T aMax = BVH::VecComp<T, N>::Get (theBox.CornerMax(), theAxis);
const T anInverseStep = static_cast<T> (theBins) / (aMax - aMin);
Standard_Integer aLftIdx (theBeg);
Standard_Integer aRghIdx (theEnd);
do
{
while (BVH::IntFloor<T> ((theSet->Center (aLftIdx, theAxis) - aMin) * anInverseStep) <= theBin && aLftIdx < theEnd)
{
++aLftIdx;
}
while (BVH::IntFloor<T> ((theSet->Center (aRghIdx, theAxis) - aMin) * anInverseStep) > theBin && aRghIdx > theBeg)
{
--aRghIdx;
}
if (aLftIdx <= aRghIdx)
{
if (aLftIdx != aRghIdx)
{
theSet->Swap (aLftIdx, aRghIdx);
}
++aLftIdx;
--aRghIdx;
}
} while (aLftIdx <= aRghIdx);
return aLftIdx;
}
template<class T, int N>
struct BVH_AxisSelector
{
typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
static Standard_Integer MainAxis (const BVH_VecNt& theSize)
{
if (theSize.y() > theSize.x())
{
return theSize.y() > theSize.z() ? 1 : 2;
}
else
{
return theSize.z() > theSize.x() ? 2 : 0;
}
}
};
template<class T>
struct BVH_AxisSelector<T, 2>
{
typedef typename BVH::VectorType<T, 2>::Type BVH_VecNt;
static Standard_Integer MainAxis (const BVH_VecNt& theSize)
{
return theSize.x() > theSize.y() ? 0 : 1;
}
};
}
// =======================================================================
// function : buildNode
// purpose :
// =======================================================================
template<class T, int N, int Bins>
typename BVH_QueueBuilder<T, N>::BVH_ChildNodes BVH_BinnedBuilder<T, N, Bins>::buildNode (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const Standard_Integer theNode) const
{
const Standard_Integer aNodeBegPrimitive = theBVH->BegPrimitive (theNode);
const Standard_Integer aNodeEndPrimitive = theBVH->EndPrimitive (theNode);
if (aNodeEndPrimitive - aNodeBegPrimitive < BVH_Builder<T, N>::myLeafNodeSize)
{
return typename BVH_QueueBuilder<T, N>::BVH_ChildNodes(); // node does not require partitioning
}
const BVH_Box<T, N> anAABB (theBVH->MinPoint (theNode),
theBVH->MaxPoint (theNode));
const typename BVH_Box<T, N>::BVH_VecNt aSize = anAABB.Size();
// Parameters for storing best split
Standard_Integer aMinSplitAxis = -1;
Standard_Integer aMinSplitIndex = 0;
Standard_Integer aMinSplitNumLft = 0;
Standard_Integer aMinSplitNumRgh = 0;
BVH_Box<T, N> aMinSplitBoxLft;
BVH_Box<T, N> aMinSplitBoxRgh;
Standard_Real aMinSplitCost = std::numeric_limits<Standard_Real>::max();
const Standard_Integer aMainAxis = BVH::BVH_AxisSelector<T, N>::MainAxis (aSize);
// Find best split
for (Standard_Integer anAxis = myUseMainAxis ? aMainAxis : 0; anAxis <= (myUseMainAxis ? aMainAxis : Min (N - 1, 2)); ++anAxis)
{
if (BVH::VecComp<T, N>::Get (aSize, anAxis) <= BVH::THE_NODE_MIN_SIZE)
{
continue;
}
BVH_BinVector aBinVector;
getSubVolumes (theSet, theBVH, theNode, aBinVector, anAxis);
BVH_SplitPlanes aSplitPlanes;
for (Standard_Integer aLftSplit = 1, aRghSplit = Bins - 1; aLftSplit < Bins; ++aLftSplit, --aRghSplit)
{
aSplitPlanes[aLftSplit].LftVoxel.Count = aSplitPlanes[aLftSplit - 1].LftVoxel.Count + aBinVector[aLftSplit - 1].Count;
aSplitPlanes[aRghSplit].RghVoxel.Count = aSplitPlanes[aRghSplit + 1].RghVoxel.Count + aBinVector[aRghSplit + 0].Count;
aSplitPlanes[aLftSplit].LftVoxel.Box = aSplitPlanes[aLftSplit - 1].LftVoxel.Box;
aSplitPlanes[aRghSplit].RghVoxel.Box = aSplitPlanes[aRghSplit + 1].RghVoxel.Box;
aSplitPlanes[aLftSplit].LftVoxel.Box.Combine (aBinVector[aLftSplit - 1].Box);
aSplitPlanes[aRghSplit].RghVoxel.Box.Combine (aBinVector[aRghSplit + 0].Box);
}
// Choose the best split (with minimum SAH cost)
for (Standard_Integer aSplit = 1; aSplit < Bins; ++aSplit)
{
// Simple SAH evaluation
Standard_Real aCost =
(static_cast<Standard_Real> (aSplitPlanes[aSplit].LftVoxel.Box.Area()) /* / S(N) */) * aSplitPlanes[aSplit].LftVoxel.Count
+ (static_cast<Standard_Real> (aSplitPlanes[aSplit].RghVoxel.Box.Area()) /* / S(N) */) * aSplitPlanes[aSplit].RghVoxel.Count;
if (aCost <= aMinSplitCost)
{
aMinSplitCost = aCost;
aMinSplitAxis = anAxis;
aMinSplitIndex = aSplit;
aMinSplitBoxLft = aSplitPlanes[aSplit].LftVoxel.Box;
aMinSplitBoxRgh = aSplitPlanes[aSplit].RghVoxel.Box;
aMinSplitNumLft = aSplitPlanes[aSplit].LftVoxel.Count;
aMinSplitNumRgh = aSplitPlanes[aSplit].RghVoxel.Count;
}
}
}
theBVH->SetInner (theNode);
Standard_Integer aMiddle = -1;
if (aMinSplitNumLft == 0 || aMinSplitNumRgh == 0 || aMinSplitAxis == -1) // case of objects with the same center
{
aMinSplitBoxLft.Clear();
aMinSplitBoxRgh.Clear();
aMiddle = std::max (aNodeBegPrimitive + 1,
static_cast<Standard_Integer> ((aNodeBegPrimitive + aNodeEndPrimitive) / 2.f));
aMinSplitNumLft = aMiddle - aNodeBegPrimitive;
for (Standard_Integer anIndex = aNodeBegPrimitive; anIndex < aMiddle; ++anIndex)
{
aMinSplitBoxLft.Combine (theSet->Box (anIndex));
}
aMinSplitNumRgh = aNodeEndPrimitive - aMiddle + 1;
for (Standard_Integer anIndex = aNodeEndPrimitive; anIndex >= aMiddle; --anIndex)
{
aMinSplitBoxRgh.Combine (theSet->Box (anIndex));
}
}
else
{
aMiddle = BVH::SplitPrimitives<T, N> (theSet,
anAABB,
aNodeBegPrimitive,
aNodeEndPrimitive,
aMinSplitIndex - 1,
aMinSplitAxis,
Bins);
}
typedef typename BVH_QueueBuilder<T, N>::BVH_PrimitiveRange Range;
return typename BVH_QueueBuilder<T, N>::BVH_ChildNodes (aMinSplitBoxLft,
aMinSplitBoxRgh,
Range (aNodeBegPrimitive, aMiddle - 1),
Range (aMiddle, aNodeEndPrimitive));
}
#endif // _BVH_BinnedBuilder_Header

View File

@@ -1,299 +0,0 @@
// Created on: 2013-12-20
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// =======================================================================
// function : BVH_BinnedBuilder
// purpose :
// =======================================================================
template<class T, int N, int Bins>
BVH_BinnedBuilder<T, N, Bins>::BVH_BinnedBuilder (const Standard_Integer theLeafNodeSize,
const Standard_Integer theMaxTreeDepth,
const Standard_Boolean theDoMainSplits,
const Standard_Integer theNumOfThreads)
: BVH_QueueBuilder<T, N> (theLeafNodeSize,
theMaxTreeDepth,
theNumOfThreads),
myUseMainAxis (theDoMainSplits)
{
//
}
// =======================================================================
// function : ~BVH_BinnedBuilder
// purpose :
// =======================================================================
template<class T, int N, int Bins>
BVH_BinnedBuilder<T, N, Bins>::~BVH_BinnedBuilder()
{
//
}
// =======================================================================
// function : GetSubVolumes
// purpose :
// =======================================================================
template<class T, int N, int Bins>
void BVH_BinnedBuilder<T, N, Bins>::GetSubVolumes (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const Standard_Integer theNode,
BVH_BinVector& theBins,
const Standard_Integer theAxis)
{
const T aMin = BVH::VecComp<T, N>::Get (theBVH->MinPoint (theNode), theAxis);
const T aMax = BVH::VecComp<T, N>::Get (theBVH->MaxPoint (theNode), theAxis);
const T anInverseStep = static_cast<T> (Bins) / (aMax - aMin);
for (Standard_Integer anIdx = theBVH->BegPrimitive (theNode); anIdx <= theBVH->EndPrimitive (theNode); ++anIdx)
{
typename BVH_Set<T, N>::BVH_BoxNt aBox = theSet->Box (anIdx);
Standard_Integer aBinIndex = BVH::IntFloor<T> (
(theSet->Center (anIdx, theAxis) - aMin) * anInverseStep);
if (aBinIndex < 0)
{
aBinIndex = 0;
}
else if (aBinIndex >= Bins)
{
aBinIndex = Bins - 1;
}
theBins[aBinIndex].Count++;
theBins[aBinIndex].Box.Combine (aBox);
}
}
namespace BVH
{
// =======================================================================
// function : SplitPrimitives
// purpose :
// =======================================================================
template<class T, int N>
Standard_Integer SplitPrimitives (BVH_Set<T, N>* theSet,
const BVH_Box<T, N>& theBox,
const Standard_Integer theBeg,
const Standard_Integer theEnd,
const Standard_Integer theBin,
const Standard_Integer theAxis,
const Standard_Integer theBins)
{
const T aMin = BVH::VecComp<T, N>::Get (theBox.CornerMin(), theAxis);
const T aMax = BVH::VecComp<T, N>::Get (theBox.CornerMax(), theAxis);
const T anInverseStep = static_cast<T> (theBins) / (aMax - aMin);
Standard_Integer aLftIdx (theBeg);
Standard_Integer aRghIdx (theEnd);
do
{
while (BVH::IntFloor<T> ((theSet->Center (aLftIdx, theAxis) - aMin) * anInverseStep) <= theBin && aLftIdx < theEnd)
{
++aLftIdx;
}
while (BVH::IntFloor<T> ((theSet->Center (aRghIdx, theAxis) - aMin) * anInverseStep) > theBin && aRghIdx > theBeg)
{
--aRghIdx;
}
if (aLftIdx <= aRghIdx)
{
if (aLftIdx != aRghIdx)
{
theSet->Swap (aLftIdx, aRghIdx);
}
++aLftIdx;
--aRghIdx;
}
} while (aLftIdx <= aRghIdx);
return aLftIdx;
}
}
#if defined (_WIN32) && defined (max)
#undef max
#endif
#include <limits>
namespace BVH
{
template<class T, int N>
struct BVH_AxisSelector
{
typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
// =======================================================================
// function : MainAxis
// purpose :
// =======================================================================
static Standard_Integer MainAxis (const BVH_VecNt& theSize)
{
if (theSize.y() > theSize.x())
{
return theSize.y() > theSize.z() ? 1 : 2;
}
else
{
return theSize.z() > theSize.x() ? 2 : 0;
}
}
};
template<class T>
struct BVH_AxisSelector<T, 2>
{
typedef typename BVH::VectorType<T, 2>::Type BVH_VecNt;
// =======================================================================
// function : MainAxis
// purpose :
// =======================================================================
static Standard_Integer MainAxis (const BVH_VecNt& theSize)
{
return theSize.x() > theSize.y() ? 0 : 1;
}
};
}
// =======================================================================
// function : BuildNode
// purpose :
// =======================================================================
template<class T, int N, int Bins>
typename BVH_QueueBuilder<T, N>::BVH_ChildNodes BVH_BinnedBuilder<T, N, Bins>::BuildNode (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const Standard_Integer theNode)
{
const Standard_Integer aNodeBegPrimitive = theBVH->BegPrimitive (theNode);
const Standard_Integer aNodeEndPrimitive = theBVH->EndPrimitive (theNode);
if (aNodeEndPrimitive - aNodeBegPrimitive < BVH_Builder<T, N>::myLeafNodeSize)
{
return typename BVH_QueueBuilder<T, N>::BVH_ChildNodes(); // node does not require partitioning
}
const BVH_Box<T, N> anAABB (theBVH->MinPoint (theNode),
theBVH->MaxPoint (theNode));
const typename BVH_Box<T, N>::BVH_VecNt aSize = anAABB.Size();
// Parameters for storing best split
Standard_Integer aMinSplitAxis = -1;
Standard_Integer aMinSplitIndex = 0;
Standard_Integer aMinSplitNumLft = 0;
Standard_Integer aMinSplitNumRgh = 0;
BVH_Box<T, N> aMinSplitBoxLft;
BVH_Box<T, N> aMinSplitBoxRgh;
Standard_Real aMinSplitCost = std::numeric_limits<Standard_Real>::max();
const Standard_Integer aMainAxis = BVH::BVH_AxisSelector<T, N>::MainAxis (aSize);
// Find best split
for (Standard_Integer anAxis = myUseMainAxis ? aMainAxis : 0; anAxis <= (myUseMainAxis ? aMainAxis : Min (N - 1, 2)); ++anAxis)
{
if (BVH::VecComp<T, N>::Get (aSize, anAxis) <= BVH::THE_NODE_MIN_SIZE)
{
continue;
}
BVH_BinVector aBinVector;
GetSubVolumes (theSet, theBVH, theNode, aBinVector, anAxis);
BVH_SplitPlanes aSplitPlanes;
for (Standard_Integer aLftSplit = 1, aRghSplit = Bins - 1; aLftSplit < Bins; ++aLftSplit, --aRghSplit)
{
aSplitPlanes[aLftSplit].LftVoxel.Count = aSplitPlanes[aLftSplit - 1].LftVoxel.Count + aBinVector[aLftSplit - 1].Count;
aSplitPlanes[aRghSplit].RghVoxel.Count = aSplitPlanes[aRghSplit + 1].RghVoxel.Count + aBinVector[aRghSplit + 0].Count;
aSplitPlanes[aLftSplit].LftVoxel.Box = aSplitPlanes[aLftSplit - 1].LftVoxel.Box;
aSplitPlanes[aRghSplit].RghVoxel.Box = aSplitPlanes[aRghSplit + 1].RghVoxel.Box;
aSplitPlanes[aLftSplit].LftVoxel.Box.Combine (aBinVector[aLftSplit - 1].Box);
aSplitPlanes[aRghSplit].RghVoxel.Box.Combine (aBinVector[aRghSplit + 0].Box);
}
// Choose the best split (with minimum SAH cost)
for (Standard_Integer aSplit = 1; aSplit < Bins; ++aSplit)
{
// Simple SAH evaluation
Standard_Real aCost =
(static_cast<Standard_Real> (aSplitPlanes[aSplit].LftVoxel.Box.Area()) /* / S(N) */) * aSplitPlanes[aSplit].LftVoxel.Count
+ (static_cast<Standard_Real> (aSplitPlanes[aSplit].RghVoxel.Box.Area()) /* / S(N) */) * aSplitPlanes[aSplit].RghVoxel.Count;
if (aCost <= aMinSplitCost)
{
aMinSplitCost = aCost;
aMinSplitAxis = anAxis;
aMinSplitIndex = aSplit;
aMinSplitBoxLft = aSplitPlanes[aSplit].LftVoxel.Box;
aMinSplitBoxRgh = aSplitPlanes[aSplit].RghVoxel.Box;
aMinSplitNumLft = aSplitPlanes[aSplit].LftVoxel.Count;
aMinSplitNumRgh = aSplitPlanes[aSplit].RghVoxel.Count;
}
}
}
theBVH->SetInner (theNode);
Standard_Integer aMiddle = -1;
if (aMinSplitNumLft == 0 || aMinSplitNumRgh == 0 || aMinSplitAxis == -1) // case of objects with the same center
{
aMinSplitBoxLft.Clear();
aMinSplitBoxRgh.Clear();
aMiddle = std::max (aNodeBegPrimitive + 1,
static_cast<Standard_Integer> ((aNodeBegPrimitive + aNodeEndPrimitive) / 2.f));
aMinSplitNumLft = aMiddle - aNodeBegPrimitive;
for (Standard_Integer anIndex = aNodeBegPrimitive; anIndex < aMiddle; ++anIndex)
{
aMinSplitBoxLft.Combine (theSet->Box (anIndex));
}
aMinSplitNumRgh = aNodeEndPrimitive - aMiddle + 1;
for (Standard_Integer anIndex = aNodeEndPrimitive; anIndex >= aMiddle; --anIndex)
{
aMinSplitBoxRgh.Combine (theSet->Box (anIndex));
}
}
else
{
aMiddle = BVH::SplitPrimitives<T, N> (theSet,
anAABB,
aNodeBegPrimitive,
aNodeEndPrimitive,
aMinSplitIndex - 1,
aMinSplitAxis,
Bins);
}
typedef typename BVH_QueueBuilder<T, N>::BVH_PrimitiveRange Range;
return typename BVH_QueueBuilder<T, N>::BVH_ChildNodes (aMinSplitBoxLft,
aMinSplitBoxRgh,
Range (aNodeBegPrimitive, aMiddle - 1),
Range (aMiddle, aNodeEndPrimitive));
}

View File

@@ -17,6 +17,7 @@
#define _BVH_Box_Header
#include <BVH_Types.hxx>
#include <Standard_ShortReal.hxx>
#include <limits>
@@ -57,38 +58,51 @@ public:
public:
//! Clears bounding box.
void Clear();
void Clear() { myIsInited = Standard_False; }
//! Is bounding box valid?
Standard_Boolean IsValid() const;
Standard_Boolean IsValid() const { return myIsInited; }
//! Appends new point to the bounding box.
void Add (const BVH_VecNt& thePoint);
void Add (const BVH_VecNt& thePoint)
{
if (!myIsInited)
{
myMinPoint = thePoint;
myMaxPoint = thePoint;
myIsInited = Standard_True;
}
else
{
myMinPoint = myMinPoint.cwiseMin (thePoint);
myMaxPoint = myMaxPoint.cwiseMax (thePoint);
}
}
//! Combines bounding box with another one.
void Combine (const BVH_Box& theVolume);
void Combine (const BVH_Box& theBox);
//! Returns minimum point of bounding box.
const BVH_VecNt& CornerMin() const;
const BVH_VecNt& CornerMin() const { return myMinPoint; }
//! Returns maximum point of bounding box.
const BVH_VecNt& CornerMax() const;
const BVH_VecNt& CornerMax() const { return myMaxPoint; }
//! Returns minimum point of bounding box.
BVH_VecNt& CornerMin();
BVH_VecNt& CornerMin() { return myMinPoint; }
//! Returns maximum point of bounding box.
BVH_VecNt& CornerMax();
BVH_VecNt& CornerMax() { return myMaxPoint; }
//! Returns surface area of bounding box.
//! If the box is degenerated into line, returns the perimeter instead.
T Area() const;
//! Returns diagonal of bounding box.
BVH_VecNt Size() const;
BVH_VecNt Size() const { return myMaxPoint - myMinPoint; }
//! Returns center of bounding box.
BVH_VecNt Center() const;
BVH_VecNt Center() const { return (myMinPoint + myMaxPoint) * static_cast<T> (0.5); }
//! Returns center of bounding box along the given axis.
T Center (const Standard_Integer theAxis) const;
@@ -279,6 +293,47 @@ namespace BVH
};
}
#include <BVH_Box.lxx>
// =======================================================================
// function : Combine
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Box<T, N>::Combine (const BVH_Box& theBox)
{
if (theBox.myIsInited)
{
if (!myIsInited)
{
myMinPoint = theBox.myMinPoint;
myMaxPoint = theBox.myMaxPoint;
myIsInited = Standard_True;
}
else
{
BVH::BoxMinMax<T, N>::CwiseMin (myMinPoint, theBox.myMinPoint);
BVH::BoxMinMax<T, N>::CwiseMax (myMaxPoint, theBox.myMaxPoint);
}
}
}
// =======================================================================
// function : Area
// purpose :
// =======================================================================
template<class T, int N>
T BVH_Box<T, N>::Area() const
{
return !myIsInited ? static_cast<T> (0.0) : BVH::SurfaceCalculator<T, N>::Area (myMaxPoint - myMinPoint);
}
// =======================================================================
// function : Center
// purpose :
// =======================================================================
template<class T, int N>
T BVH_Box<T, N>::Center (const Standard_Integer theAxis) const
{
return BVH::CenterAxis<T, N>::Center (*this, theAxis);
}
#endif // _BVH_Box_Header

View File

@@ -1,162 +0,0 @@
// Created on: 2013-12-20
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_ShortReal.hxx>
// =======================================================================
// function : Clear
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Box<T, N>::Clear()
{
myIsInited = Standard_False;
}
// =======================================================================
// function : Clear
// purpose :
// =======================================================================
template<class T, int N>
Standard_Boolean BVH_Box<T, N>::IsValid() const
{
return myIsInited;
}
// =======================================================================
// function : Add
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Box<T, N>::Add (const BVH_VecNt& thePoint)
{
if (!myIsInited)
{
myMinPoint = thePoint;
myMaxPoint = thePoint;
myIsInited = Standard_True;
}
else
{
myMinPoint = myMinPoint.cwiseMin (thePoint);
myMaxPoint = myMaxPoint.cwiseMax (thePoint);
}
}
// =======================================================================
// function : Combine
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Box<T, N>::Combine (const BVH_Box& theBox)
{
if (theBox.myIsInited)
{
if (!myIsInited)
{
myMinPoint = theBox.myMinPoint;
myMaxPoint = theBox.myMaxPoint;
myIsInited = Standard_True;
}
else
{
BVH::BoxMinMax<T, N>::CwiseMin (myMinPoint, theBox.myMinPoint);
BVH::BoxMinMax<T, N>::CwiseMax (myMaxPoint, theBox.myMaxPoint);
}
}
}
// =======================================================================
// function : Area
// purpose :
// =======================================================================
template<class T, int N>
T BVH_Box<T, N>::Area() const
{
return !myIsInited ? static_cast<T> (0.0) :
BVH::SurfaceCalculator<T, N>::Area (myMaxPoint - myMinPoint);
}
// =======================================================================
// function : CornerMin
// purpose :
// =======================================================================
template<class T, int N>
const typename BVH_Box<T, N>::BVH_VecNt& BVH_Box<T, N>::CornerMin() const
{
return myMinPoint;
}
// =======================================================================
// function : CornerMax
// purpose :
// =======================================================================
template<class T, int N>
const typename BVH_Box<T, N>::BVH_VecNt& BVH_Box<T, N>::CornerMax() const
{
return myMaxPoint;
}
// =======================================================================
// function : CornerMin
// purpose :
// =======================================================================
template<class T, int N>
typename BVH_Box<T, N>::BVH_VecNt& BVH_Box<T, N>::CornerMin()
{
return myMinPoint;
}
// =======================================================================
// function : CornerMax
// purpose :
// =======================================================================
template<class T, int N>
typename BVH_Box<T, N>::BVH_VecNt& BVH_Box<T, N>::CornerMax()
{
return myMaxPoint;
}
// =======================================================================
// function : Size
// purpose :
// =======================================================================
template<class T, int N>
typename BVH_Box<T, N>::BVH_VecNt BVH_Box<T, N>::Size() const
{
return myMaxPoint - myMinPoint;
}
// =======================================================================
// function : Center
// purpose :
// =======================================================================
template<class T, int N>
typename BVH_Box<T, N>::BVH_VecNt BVH_Box<T, N>::Center() const
{
return (myMinPoint + myMaxPoint) * static_cast<T> (0.5);
}
// =======================================================================
// function : Center
// purpose :
// =======================================================================
template<class T, int N>
T BVH_Box<T, N>::Center (const Standard_Integer theAxis) const
{
return BVH::CenterAxis<T, N>::Center (*this, theAxis);
}

View File

@@ -36,21 +36,23 @@ public:
//! Creates new abstract BVH builder.
BVH_Builder (const Standard_Integer theLeafNodeSize,
const Standard_Integer theMaxTreeDepth);
const Standard_Integer theMaxTreeDepth)
: myMaxTreeDepth (theMaxTreeDepth),
myLeafNodeSize (theLeafNodeSize) {}
//! Releases resources of BVH builder.
virtual ~BVH_Builder();
virtual ~BVH_Builder() {}
//! Builds BVH using specific algorithm.
virtual void Build (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const BVH_Box<T, N>& theBox) = 0;
const BVH_Box<T, N>& theBox) const = 0;
protected:
//! Updates depth of constructed BVH tree.
void UpdateDepth (BVH_Tree<T, N>* theBVH,
const Standard_Integer theLevel)
void updateDepth (BVH_Tree<T, N>* theBVH,
const Standard_Integer theLevel) const
{
if (theLevel > theBVH->myDepth)
{
@@ -65,6 +67,4 @@ protected:
};
#include <BVH_Builder.lxx>
#endif // _BVH_Builder_Header

View File

@@ -1,37 +0,0 @@
// Created on: 2013-12-20
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// =======================================================================
// function : BVH_Builder
// purpose : Creates abstract BVH builder
// =======================================================================
template<class T, int N>
BVH_Builder<T, N>::BVH_Builder (const Standard_Integer theLeafNodeSize,
const Standard_Integer theMaxTreeDepth)
: myMaxTreeDepth (theMaxTreeDepth),
myLeafNodeSize (theLeafNodeSize)
{
//
}
// =======================================================================
// function : ~BVH_Builder
// purpose : Releases resources of BVH builder
// =======================================================================
template<class T, int N>
BVH_Builder<T, N>::~BVH_Builder()
{
//
}

View File

@@ -18,6 +18,7 @@
#include <BVH_ObjectSet.hxx>
#include <BVH_Builder.hxx>
#include <BVH_BinnedBuilder.hxx>
//! BVH geometry as a set of abstract geometric objects
//! organized with bounding volume hierarchy (BVH).
@@ -29,35 +30,66 @@ class BVH_Geometry : public BVH_ObjectSet<T, N>
public:
//! Creates uninitialized BVH geometry.
BVH_Geometry();
BVH_Geometry()
: myIsDirty (Standard_False),
myBVH (new BVH_Tree<T, N>())
{
// Set default builder - binned SAH split
myBuilder = new BVH_BinnedBuilder<T, N, 32> (1 /* primitive per leaf */);
}
//! Releases resources of BVH geometry.
virtual ~BVH_Geometry();
virtual ~BVH_Geometry()
{
myBVH.Nullify();
myBuilder.Nullify();
}
public:
//! Marks geometry as outdated.
virtual void MarkDirty();
virtual void MarkDirty() { myIsDirty = Standard_True; }
//! Returns AABB of the given object.
using BVH_ObjectSet<T, N>::Box;
//! Returns AABB of the whole geometry.
virtual BVH_Box<T, N> Box() const;
virtual BVH_Box<T, N> Box() const Standard_OVERRIDE
{
if (myIsDirty)
{
myBox = BVH_Set<T, N>::Box();
}
return myBox;
}
//! Returns BVH tree (and builds it if necessary).
virtual const NCollection_Handle<BVH_Tree<T, N> >& BVH();
virtual const NCollection_Handle<BVH_Tree<T, N> >& BVH()
{
if (myIsDirty)
{
Update();
}
return myBVH;
}
//! Returns the method (builder) used to construct BVH.
virtual const NCollection_Handle<BVH_Builder<T, N> >& Builder() const;
virtual const NCollection_Handle<BVH_Builder<T, N> >& Builder() const { return myBuilder; }
//! Sets the method (builder) used to construct BVH.
virtual void SetBuilder (NCollection_Handle<BVH_Builder<T, N> >& theBuilder);
virtual void SetBuilder (const NCollection_Handle<BVH_Builder<T, N> >& theBuilder) { myBuilder = theBuilder; }
protected:
//! Updates internal geometry state.
virtual void Update();
virtual void Update()
{
if (myIsDirty)
{
myBuilder->Build (this, myBVH.operator->(), Box());
myIsDirty = Standard_False;
}
}
protected:
@@ -69,6 +101,4 @@ protected:
};
#include <BVH_Geometry.lxx>
#endif // _BVH_Geometry_Header

View File

@@ -1,118 +0,0 @@
// Created on: 2013-12-20
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BVH_BinnedBuilder.hxx>
// =======================================================================
// function : BVH_Geometry
// purpose :
// =======================================================================
template<class T, int N>
BVH_Geometry<T, N>::BVH_Geometry()
: myIsDirty (Standard_False),
myBVH (new BVH_Tree<T, N>())
{
// Set default builder - binned SAH split
myBuilder = new BVH_BinnedBuilder<T, N, 32> (1 /* primitive per leaf */);
}
// =======================================================================
// function : ~BVH_Geometry
// purpose :
// =======================================================================
template<class T, int N>
BVH_Geometry<T, N>::~BVH_Geometry()
{
myBVH.Nullify();
myBuilder.Nullify();
}
// =======================================================================
// function : MarkDirty
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Geometry<T, N>::MarkDirty()
{
myIsDirty = Standard_True;
}
// =======================================================================
// function : Box
// purpose :
// =======================================================================
template<class T, int N>
BVH_Box<T, N> BVH_Geometry<T, N>::Box() const
{
if (!myIsDirty)
{
return myBox;
}
myBox = BVH_Set<T, N>::Box();
return myBox;
}
// =======================================================================
// function : BVH
// purpose :
// =======================================================================
template<class T, int N>
const NCollection_Handle<BVH_Tree<T, N> >& BVH_Geometry<T, N>::BVH()
{
if (myIsDirty)
{
Update();
}
return myBVH;
}
// =======================================================================
// function : Update
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Geometry<T, N>::Update()
{
if (!myIsDirty)
{
return;
}
myBuilder->Build (this, myBVH.operator->(), Box());
myIsDirty = Standard_False;
}
// =======================================================================
// function : Builder
// purpose :
// =======================================================================
template<class T, int N>
const NCollection_Handle<BVH_Builder<T, N> >& BVH_Geometry<T, N>::Builder() const
{
return myBuilder;
}
// =======================================================================
// function : SetBuilder
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Geometry<T, N>::SetBuilder (NCollection_Handle<BVH_Builder<T, N> >& theBuilder)
{
myBuilder = theBuilder;
}

View File

@@ -17,6 +17,7 @@
#define _BVH_LinearBuilder_Header
#include <BVH_RadixSorter.hxx>
#include <Standard_Assert.hxx>
//! Performs fast BVH construction using LBVH building approach.
//! Algorithm uses spatial Morton codes to reduce the BVH construction
@@ -45,35 +46,308 @@ public:
virtual ~BVH_LinearBuilder();
//! Builds BVH.
void Build (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const BVH_Box<T, N>& theBox);
virtual void Build (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const BVH_Box<T, N>& theBox) const Standard_OVERRIDE;
protected:
typedef NCollection_Array1<BVH_EncodedLink>::iterator LinkIterator;
typedef NCollection_Array1<BVH_EncodedLink>::iterator LinkIterator;
protected:
//! Emits hierarchy from sorted Morton codes.
Standard_Integer EmitHierachy (BVH_Tree<T, N>* theBVH,
Standard_Integer emitHierachy (BVH_Tree<T, N>* theBVH,
const NCollection_Array1<BVH_EncodedLink>& theEncodedLinks,
const Standard_Integer theBit,
const Standard_Integer theShift,
const Standard_Integer theStart,
const Standard_Integer theFinal);
const Standard_Integer theFinal) const;
//! Returns index of the first element which does not compare less than the given one.
Standard_Integer LowerBound (Standard_Integer theStart,
Standard_Integer lowerBound (const NCollection_Array1<BVH_EncodedLink>& theEncodedLinks,
Standard_Integer theStart,
Standard_Integer theFinal,
Standard_Integer theDigit);
protected:
//! Tool object to perform radix sort of BVH primitives.
NCollection_Handle<BVH_RadixSorter<T, N> > myRadixSorter;
Standard_Integer theDigit) const;
};
#include <BVH_LinearBuilder.lxx>
// =======================================================================
// function : BVH_LinearBuilder
// purpose :
// =======================================================================
template<class T, int N>
BVH_LinearBuilder<T, N>::BVH_LinearBuilder (const Standard_Integer theLeafNodeSize,
const Standard_Integer theMaxTreeDepth)
: BVH_Builder<T, N> (theLeafNodeSize,
theMaxTreeDepth)
{
//
}
// =======================================================================
// function : ~BVH_LinearBuilder
// purpose :
// =======================================================================
template<class T, int N>
BVH_LinearBuilder<T, N>::~BVH_LinearBuilder()
{
//
}
// =======================================================================
// function : lowerBound
// purpose : Returns index of first element greater than the given one
// =======================================================================
template<class T, int N>
Standard_Integer BVH_LinearBuilder<T, N>::lowerBound (const NCollection_Array1<BVH_EncodedLink>& theEncodedLinks,
Standard_Integer theStart,
Standard_Integer theFinal,
Standard_Integer theDigit) const
{
Standard_Integer aNbPrims = theFinal - theStart;
while (aNbPrims > 0)
{
const Standard_Integer aStep = aNbPrims / 2;
if (theEncodedLinks.Value (theStart + aStep).first & (1 << theDigit))
{
aNbPrims = aStep;
}
else
{
theStart += aStep + 1;
aNbPrims -= aStep + 1;
}
}
return theStart;
}
// =======================================================================
// function : emitHierachy
// purpose : Emits hierarchy from sorted Morton codes
// =======================================================================
template<class T, int N>
Standard_Integer BVH_LinearBuilder<T, N>::emitHierachy (BVH_Tree<T, N>* theBVH,
const NCollection_Array1<BVH_EncodedLink>& theEncodedLinks,
const Standard_Integer theBit,
const Standard_Integer theShift,
const Standard_Integer theStart,
const Standard_Integer theFinal) const
{
if (theFinal - theStart > BVH_Builder<T, N>::myLeafNodeSize)
{
const Standard_Integer aPosition = theBit < 0 ?
(theStart + theFinal) / 2 : lowerBound (theEncodedLinks, theStart, theFinal, theBit);
if (aPosition == theStart || aPosition == theFinal)
{
return emitHierachy (theBVH, theEncodedLinks, theBit - 1, theShift, theStart, theFinal);
}
// Build inner node
const Standard_Integer aNode = theBVH->AddInnerNode (0, 0);
const Standard_Integer aRghNode = theShift + aPosition - theStart;
const Standard_Integer aLftChild = emitHierachy (theBVH, theEncodedLinks, theBit - 1, theShift, theStart, aPosition);
const Standard_Integer aRghChild = emitHierachy (theBVH, theEncodedLinks, theBit - 1, aRghNode, aPosition, theFinal);
theBVH->NodeInfoBuffer()[aNode].y() = aLftChild;
theBVH->NodeInfoBuffer()[aNode].z() = aRghChild;
return aNode;
}
else
{
// Build leaf node
return theBVH->AddLeafNode (theShift, theShift + theFinal - theStart - 1);
}
}
namespace BVH
{
//! Calculates bounding boxes (AABBs) for the given BVH tree.
template<class T, int N>
Standard_Integer UpdateBounds (BVH_Set<T, N>* theSet, BVH_Tree<T, N>* theTree, const Standard_Integer theNode = 0)
{
const BVH_Vec4i aData = theTree->NodeInfoBuffer()[theNode];
if (aData.x() == 0)
{
const Standard_Integer aLftChild = theTree->NodeInfoBuffer()[theNode].y();
const Standard_Integer aRghChild = theTree->NodeInfoBuffer()[theNode].z();
const Standard_Integer aLftDepth = UpdateBounds (theSet, theTree, aLftChild);
const Standard_Integer aRghDepth = UpdateBounds (theSet, theTree, aRghChild);
typename BVH_Box<T, N>::BVH_VecNt aLftMinPoint = theTree->MinPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aLftMaxPoint = theTree->MaxPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMinPoint = theTree->MinPointBuffer()[aRghChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMaxPoint = theTree->MaxPointBuffer()[aRghChild];
BVH::BoxMinMax<T, N>::CwiseMin (aLftMinPoint, aRghMinPoint);
BVH::BoxMinMax<T, N>::CwiseMax (aLftMaxPoint, aRghMaxPoint);
theTree->MinPointBuffer()[theNode] = aLftMinPoint;
theTree->MaxPointBuffer()[theNode] = aLftMaxPoint;
return Max (aLftDepth, aRghDepth) + 1;
}
else
{
typename BVH_Box<T, N>::BVH_VecNt& aMinPoint = theTree->MinPointBuffer()[theNode];
typename BVH_Box<T, N>::BVH_VecNt& aMaxPoint = theTree->MaxPointBuffer()[theNode];
for (Standard_Integer aPrimIdx = aData.y(); aPrimIdx <= aData.z(); ++aPrimIdx)
{
const BVH_Box<T, N> aBox = theSet->Box (aPrimIdx);
if (aPrimIdx == aData.y())
{
aMinPoint = aBox.CornerMin();
aMaxPoint = aBox.CornerMax();
}
else
{
BVH::BoxMinMax<T, N>::CwiseMin (aMinPoint, aBox.CornerMin());
BVH::BoxMinMax<T, N>::CwiseMax (aMaxPoint, aBox.CornerMax());
}
}
}
return 0;
}
#ifdef HAVE_TBB
//! TBB task for parallel bounds updating.
template<class T, int N>
class UpdateBoundTask: public tbb::task
{
BVH_Set<T, N>* mySet; //!< Set of geometric objects
BVH_Tree<T, N>* myBVH; //!< BVH tree built over the set
Standard_Integer myNode; //!< BVH node to update bounding box
Standard_Integer myLevel; //!< Level of the processed BVH node
Standard_Integer* myHeight; //!< Height of the processed BVH node
public:
//! Creates new TBB parallel bound update task.
UpdateBoundTask (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
Standard_Integer theNode,
Standard_Integer theLevel,
Standard_Integer* theHeight)
: mySet (theSet), myBVH (theBVH), myNode (theNode), myLevel (theLevel), myHeight (theHeight) {}
//! Executes the task.
tbb::task* execute()
{
if (myBVH->IsOuter (myNode) || myLevel > 2)
{
*myHeight = BVH::UpdateBounds (mySet, myBVH, myNode);
}
else
{
Standard_Integer aLftHeight = 0;
Standard_Integer aRghHeight = 0;
const Standard_Integer aLftChild = myBVH->NodeInfoBuffer()[myNode].y();
const Standard_Integer aRghChild = myBVH->NodeInfoBuffer()[myNode].z();
Standard_Integer aCount = 1;
tbb::task_list aList;
if (!myBVH->IsOuter (aLftChild))
{
++aCount;
aList.push_back (*new ( allocate_child() )
UpdateBoundTask (mySet, myBVH, aLftChild, myLevel + 1, &aLftHeight));
}
else
{
aLftHeight = BVH::UpdateBounds (mySet, myBVH, aLftChild);
}
if (!myBVH->IsOuter (aRghChild))
{
++aCount;
aList.push_back (*new( allocate_child() )
UpdateBoundTask (mySet, myBVH, aRghChild, myLevel + 1, &aRghHeight));
}
else
{
aRghHeight = BVH::UpdateBounds (mySet, myBVH, aRghChild);
}
if (aCount > 1)
{
set_ref_count (aCount);
spawn_and_wait_for_all (aList);
}
typename BVH_Box<T, N>::BVH_VecNt aLftMinPoint = myBVH->MinPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aLftMaxPoint = myBVH->MaxPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMinPoint = myBVH->MinPointBuffer()[aRghChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMaxPoint = myBVH->MaxPointBuffer()[aRghChild];
BVH::BoxMinMax<T, N>::CwiseMin (aLftMinPoint, aRghMinPoint);
BVH::BoxMinMax<T, N>::CwiseMax (aLftMaxPoint, aRghMaxPoint);
myBVH->MinPointBuffer()[myNode] = aLftMinPoint;
myBVH->MaxPointBuffer()[myNode] = aLftMaxPoint;
*myHeight = Max (aLftHeight, aRghHeight) + 1;
}
return NULL;
}
};
#endif
}
// =======================================================================
// function : Build
// purpose :
// =======================================================================
template<class T, int N>
void BVH_LinearBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const BVH_Box<T, N>& theBox) const
{
Standard_STATIC_ASSERT (N == 3 || N == 4);
const Standard_Integer aSetSize = theSet->Size();
if (theBVH == NULL || aSetSize == 0)
{
return;
}
theBVH->Clear();
// Step 0 -- Initialize parameter of virtual grid
BVH_RadixSorter<T, N> aRadixSorter (theBox);
// Step 1 - Perform radix sorting of primitive set
aRadixSorter.Perform (theSet);
// Step 2 -- Emitting BVH hierarchy from sorted Morton codes
emitHierachy (theBVH, aRadixSorter.EncodedLinks(), 29, 0, 0, theSet->Size());
// Step 3 -- Compute bounding boxes of BVH nodes
theBVH->MinPointBuffer().resize (theBVH->NodeInfoBuffer().size());
theBVH->MaxPointBuffer().resize (theBVH->NodeInfoBuffer().size());
Standard_Integer aHeight = 0;
#ifdef HAVE_TBB
// Note: Although TBB tasks are allocated using placement
// new, we do not need to delete them explicitly
BVH::UpdateBoundTask<T, N>& aRootTask = *new ( tbb::task::allocate_root() )
BVH::UpdateBoundTask<T, N> (theSet, theBVH, 0, 0, &aHeight);
tbb::task::spawn_root_and_wait (aRootTask);
#else
aHeight = BVH::UpdateBounds (theSet, theBVH, 0);
#endif
BVH_Builder<T, N>::updateDepth (theBVH, aHeight);
}
#endif // _BVH_LinearBuilder_Header

View File

@@ -1,320 +0,0 @@
// Created on: 2014-09-11
// Created by: Danila ULYANOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_Assert.hxx>
// =======================================================================
// function : BVH_LinearBuilder
// purpose :
// =======================================================================
template<class T, int N>
BVH_LinearBuilder<T, N>::BVH_LinearBuilder (const Standard_Integer theLeafNodeSize,
const Standard_Integer theMaxTreeDepth)
: BVH_Builder<T, N> (theLeafNodeSize,
theMaxTreeDepth)
{
//
}
// =======================================================================
// function : ~BVH_LinearBuilder
// purpose :
// =======================================================================
template<class T, int N>
BVH_LinearBuilder<T, N>::~BVH_LinearBuilder()
{
//
}
// =======================================================================
// function : LowerBound
// purpose : Returns index of first element greater than the given one
// =======================================================================
template<class T, int N>
Standard_Integer BVH_LinearBuilder<T, N>::LowerBound (Standard_Integer theStart,
Standard_Integer theFinal,
Standard_Integer theDigit)
{
Standard_Integer aNbPrims = theFinal - theStart;
while (aNbPrims > 0)
{
const Standard_Integer aStep = aNbPrims / 2;
if (myRadixSorter->EncodedLinks().Value (theStart + aStep).first & (1 << theDigit))
{
aNbPrims = aStep;
}
else
{
theStart += aStep + 1;
aNbPrims -= aStep + 1;
}
}
return theStart;
}
// =======================================================================
// function : EmitHierachy
// purpose : Emits hierarchy from sorted Morton codes
// =======================================================================
template<class T, int N>
Standard_Integer BVH_LinearBuilder<T, N>::EmitHierachy (BVH_Tree<T, N>* theBVH,
const Standard_Integer theBit,
const Standard_Integer theShift,
const Standard_Integer theStart,
const Standard_Integer theFinal)
{
if (theFinal - theStart > BVH_Builder<T, N>::myLeafNodeSize)
{
const Standard_Integer aPosition = theBit < 0 ?
(theStart + theFinal) / 2 : LowerBound (theStart, theFinal, theBit);
if (aPosition == theStart || aPosition == theFinal)
{
return EmitHierachy (theBVH, theBit - 1, theShift, theStart, theFinal);
}
// Build inner node
const Standard_Integer aNode = theBVH->AddInnerNode (0, 0);
const Standard_Integer aRghNode = theShift + aPosition - theStart;
const Standard_Integer aLftChild = EmitHierachy (theBVH, theBit - 1, theShift, theStart, aPosition);
const Standard_Integer aRghChild = EmitHierachy (theBVH, theBit - 1, aRghNode, aPosition, theFinal);
theBVH->NodeInfoBuffer()[aNode].y() = aLftChild;
theBVH->NodeInfoBuffer()[aNode].z() = aRghChild;
return aNode;
}
else
{
// Build leaf node
return theBVH->AddLeafNode (theShift, theShift + theFinal - theStart - 1);
}
}
namespace BVH
{
//! Calculates bounding boxes (AABBs) for the given BVH tree.
template<class T, int N>
Standard_Integer UpdateBounds (BVH_Set<T, N>* theSet, BVH_Tree<T, N>* theTree, const Standard_Integer theNode = 0)
{
const BVH_Vec4i aData = theTree->NodeInfoBuffer()[theNode];
if (aData.x() == 0)
{
const Standard_Integer aLftChild = theTree->NodeInfoBuffer()[theNode].y();
const Standard_Integer aRghChild = theTree->NodeInfoBuffer()[theNode].z();
const Standard_Integer aLftDepth = UpdateBounds (theSet, theTree, aLftChild);
const Standard_Integer aRghDepth = UpdateBounds (theSet, theTree, aRghChild);
typename BVH_Box<T, N>::BVH_VecNt aLftMinPoint = theTree->MinPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aLftMaxPoint = theTree->MaxPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMinPoint = theTree->MinPointBuffer()[aRghChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMaxPoint = theTree->MaxPointBuffer()[aRghChild];
BVH::BoxMinMax<T, N>::CwiseMin (aLftMinPoint, aRghMinPoint);
BVH::BoxMinMax<T, N>::CwiseMax (aLftMaxPoint, aRghMaxPoint);
theTree->MinPointBuffer()[theNode] = aLftMinPoint;
theTree->MaxPointBuffer()[theNode] = aLftMaxPoint;
return Max (aLftDepth, aRghDepth) + 1;
}
else
{
typename BVH_Box<T, N>::BVH_VecNt& aMinPoint = theTree->MinPointBuffer()[theNode];
typename BVH_Box<T, N>::BVH_VecNt& aMaxPoint = theTree->MaxPointBuffer()[theNode];
for (Standard_Integer aPrimIdx = aData.y(); aPrimIdx <= aData.z(); ++aPrimIdx)
{
const BVH_Box<T, N> aBox = theSet->Box (aPrimIdx);
if (aPrimIdx == aData.y())
{
aMinPoint = aBox.CornerMin();
aMaxPoint = aBox.CornerMax();
}
else
{
BVH::BoxMinMax<T, N>::CwiseMin (aMinPoint, aBox.CornerMin());
BVH::BoxMinMax<T, N>::CwiseMax (aMaxPoint, aBox.CornerMax());
}
}
}
return 0;
}
#ifdef HAVE_TBB
//! TBB task for parallel bounds updating.
template<class T, int N>
class UpdateBoundTask: public tbb::task
{
//! Set of geometric objects.
BVH_Set<T, N>* mySet;
//! BVH tree built over the set.
BVH_Tree<T, N>* myBVH;
//! BVH node to update bounding box.
Standard_Integer myNode;
//! Level of the processed BVH node.
Standard_Integer myLevel;
//! Height of the processed BVH node.
Standard_Integer* myHeight;
public:
//! Creates new TBB parallel bound update task.
UpdateBoundTask (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
Standard_Integer theNode,
Standard_Integer theLevel,
Standard_Integer* theHeight)
: mySet (theSet),
myBVH (theBVH),
myNode (theNode),
myLevel (theLevel),
myHeight (theHeight)
{
//
}
//! Executes the task.
tbb::task* execute()
{
if (myBVH->IsOuter (myNode) || myLevel > 2)
{
*myHeight = BVH::UpdateBounds (mySet, myBVH, myNode);
}
else
{
Standard_Integer aLftHeight = 0;
Standard_Integer aRghHeight = 0;
tbb::task_list aList;
const Standard_Integer aLftChild = myBVH->NodeInfoBuffer()[myNode].y();
const Standard_Integer aRghChild = myBVH->NodeInfoBuffer()[myNode].z();
Standard_Integer aCount = 1;
if (!myBVH->IsOuter (aLftChild))
{
++aCount;
aList.push_back (*new ( allocate_child() )
UpdateBoundTask (mySet, myBVH, aLftChild, myLevel + 1, &aLftHeight));
}
else
{
aLftHeight = BVH::UpdateBounds (mySet, myBVH, aLftChild);
}
if (!myBVH->IsOuter (aRghChild))
{
++aCount;
aList.push_back (*new( allocate_child() )
UpdateBoundTask (mySet, myBVH, aRghChild, myLevel + 1, &aRghHeight));
}
else
{
aRghHeight = BVH::UpdateBounds (mySet, myBVH, aRghChild);
}
if (aCount > 1)
{
set_ref_count (aCount);
spawn_and_wait_for_all (aList);
}
typename BVH_Box<T, N>::BVH_VecNt aLftMinPoint = myBVH->MinPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aLftMaxPoint = myBVH->MaxPointBuffer()[aLftChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMinPoint = myBVH->MinPointBuffer()[aRghChild];
typename BVH_Box<T, N>::BVH_VecNt aRghMaxPoint = myBVH->MaxPointBuffer()[aRghChild];
BVH::BoxMinMax<T, N>::CwiseMin (aLftMinPoint, aRghMinPoint);
BVH::BoxMinMax<T, N>::CwiseMax (aLftMaxPoint, aRghMaxPoint);
myBVH->MinPointBuffer()[myNode] = aLftMinPoint;
myBVH->MaxPointBuffer()[myNode] = aLftMaxPoint;
*myHeight = Max (aLftHeight, aRghHeight) + 1;
}
return NULL;
}
};
#endif
}
// =======================================================================
// function : Build
// purpose :
// =======================================================================
template<class T, int N>
void BVH_LinearBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
BVH_Tree<T, N>* theBVH,
const BVH_Box<T, N>& theBox)
{
Standard_STATIC_ASSERT (N == 3 || N == 4);
const Standard_Integer aSetSize = theSet->Size();
if (theBVH == NULL || aSetSize == 0)
{
return;
}
theBVH->Clear();
// Step 0 -- Initialize parameter of virtual grid
myRadixSorter = new BVH_RadixSorter<T, N> (theBox);
// Step 1 - Perform radix sorting of primitive set
myRadixSorter->Perform (theSet);
// Step 2 -- Emitting BVH hierarchy from sorted Morton codes
EmitHierachy (theBVH, 29, 0, 0, theSet->Size());
// Step 3 -- Compute bounding boxes of BVH nodes
theBVH->MinPointBuffer().resize (theBVH->NodeInfoBuffer().size());
theBVH->MaxPointBuffer().resize (theBVH->NodeInfoBuffer().size());
Standard_Integer aHeight = 0;
#ifdef HAVE_TBB
// Note: Although TBB tasks are allocated using placement
// new, we do not need to delete them explicitly
BVH::UpdateBoundTask<T, N>& aRootTask = *new ( tbb::task::allocate_root() )
BVH::UpdateBoundTask<T, N> (theSet, theBVH, 0, 0, &aHeight);
tbb::task::spawn_root_and_wait (aRootTask);
#else
aHeight = BVH::UpdateBounds (theSet, theBVH, 0);
#endif
BVH_Builder<T, N>::UpdateDepth (theBVH, aHeight);
}

View File

@@ -30,7 +30,7 @@ class BVH_Object
public:
//! Creates new abstract geometric object.
BVH_Object();
BVH_Object() : myIsDirty (Standard_False) {}
//! Releases resources of geometric object.
virtual ~BVH_Object() = 0;
@@ -41,13 +41,13 @@ public:
virtual BVH_Box<T, N> Box() const = 0;
//! Returns properties of the geometric object.
virtual const NCollection_Handle<BVH_Properties>& Properties() const;
virtual const NCollection_Handle<BVH_Properties>& Properties() const { return myProperties; }
//! Sets properties of the geometric object.
virtual void SetProperties (const NCollection_Handle<BVH_Properties>& theProperties);
virtual void SetProperties (const NCollection_Handle<BVH_Properties>& theProperties) { myProperties = theProperties; }
//! Marks object state as outdated (needs BVH rebuilding).
virtual void MarkDirty();
virtual void MarkDirty() { myIsDirty = Standard_True; }
protected:
@@ -56,6 +56,14 @@ protected:
};
#include <BVH_Object.lxx>
// =======================================================================
// function : ~BVH_Object
// purpose :
// =======================================================================
template<class T, int N>
BVH_Object<T, N>::~BVH_Object()
{
//
}
#endif // _BVH_Object_Header

View File

@@ -1,65 +0,0 @@
// Created on: 2013-12-20
// Created by: Denis BOGOLEPOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// =======================================================================
// function : BVH_Object
// purpose :
// =======================================================================
template<class T, int N>
BVH_Object<T, N>::BVH_Object()
: myIsDirty (Standard_False)
{
//
}
// =======================================================================
// function : ~BVH_Object
// purpose :
// =======================================================================
template<class T, int N>
BVH_Object<T, N>::~BVH_Object()
{
//
}
// =======================================================================
// function : Properties
// purpose :
// =======================================================================
template<class T, int N>
const NCollection_Handle<BVH_Properties>& BVH_Object<T, N>::Properties() const
{
return myProperties;
}
// =======================================================================
// function : SetProperties
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Object<T, N>::SetProperties (const NCollection_Handle<BVH_Properties>& theProperties)
{
myProperties = theProperties;
}
// =======================================================================
// function : MarkDirty
// purpose :
// =======================================================================
template<class T, int N>
void BVH_Object<T, N>::MarkDirty()
{
myIsDirty = Standard_True;
}

Some files were not shown because too many files have changed in this diff Show More