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

Compare commits

..

24 Commits

Author SHA1 Message Date
isn
ed6cbce72b reading of multidomain stl files into separate Poly_Triangulation objects (draft) 2018-06-28 17:46:25 +03:00
abv
a820bd4f13 0029859: Coding - GCC compiler warning -Warray-bounds in IntPatch_InterferencePolyhedron.cxx
Code is corrected to avoid copying uninitialized element of the array
2018-06-14 14:03:14 +03:00
dipts
56cc44e0f5 0029847: Visualization, Image_Diff - Tolerance is not effective for 24/32bit image formats
Image_Color - removed semibroken summ/difference operators.
Image_Diff now uses signed integer for computing differnce between ubyte3 components;
properly compare squared tolerance.

Image_Diff - dropped declaration of Image_ColorXXX24.
RGB color difference is now computed using Chebyshev distance instead of Euclidean distance
Image_PixMap - added methods RawValue()/ChangeRawValue() returning a pointer
to image where specified pixel data is defined.
2018-06-14 14:03:13 +03:00
emv
cf12784f94 0029845: UnifySameDomain does not account the accumulated angle when unifying edges
Check that the accumulated angle does not exceed the given angular tolerance while merging the linear edges.
Test case for the issue.
2018-06-14 14:03:12 +03:00
nds
0c44027cb9 0029841: Test cases from tools/dfbrowser periodically hang on Windows platform
Do not start new thread if the thread has been already started. Restart the thread after the previous has finished.
2018-06-14 14:03:12 +03:00
kgv
bc37935836 0029825: Foundation Classes, NCollection_Vec4 - workaround gcc optimizer issues with xyz() method
Methods of NCollection_Vec3 and NCollection_Vec3 that returned reference to internal buffer as vector of lower dimension (non-const xy(), xyz() etc.) are eliminated.
Use of these methods could led to generation of incorrect binary code by GCC.
Instead added new method SetValues() accepting vector of lower dimension and additional value.

DRAW test command QANColTestVec4 reproducing one situation where the bug occurs is added, along with a test case.
2018-06-14 14:03:11 +03:00
abv
4e73d75b03 0029826: Tests - test case perf/fclasses/strtod is unstable
Check of performance of accelerated Strtod() vs. standard strtod() in the test is relaxed: now test passes if Strtod() is at least 1.5 times faster
2018-06-14 14:03:10 +03:00
vro
bd6f0d2ff9 0029116: [Regression] OCAF attributes insertion order is violated again 2018-06-14 14:03:10 +03:00
kgv
b2d1851c43 0029814: Modeling Data - add method TopoDS_Shape::NbChildren() for simple check of sub-shapes number
TopoDS_Shape::NbChildren() - new method has been introduced.
TopoDS_Shape.lxx, TopoDS_TShape.lxx - inline methods have been moved to hxx.
TopoDS_TShape_Flags has been redeclared as enumeration instead of preprocessor macros.

Cyclic dependency between headers TopoDS_Shape.hxx and TopoDS_TShape.hxx eliminated.

Places where TopoDS_Iterator is used only for calculation of number of sub-shapes are updated to use NbChildren() instead
2018-06-14 14:03:09 +03:00
jgv
e67e482d99 0029511: Section fails for these two faces
Modified method: Approx_ComputeLine::Compute
Check of multicurve is now always unconditional, the procedure of check is modified to avoid infinite loops.

Modified classes: GeomLib_CheckBSplineCurve and GeomLib_Check2dBSplineCurve
Correction of poles at the ends of curve is modified to fit the direction of tangent defined by two first points or two last points of walking line.

Also modified:

BOPAlgo_PaveFiller: modified methods PostTreatFF, RemoveUsedVertices - now unused vertices are included in the list of vertices to be absorbed by other ones.
2018-06-14 14:03:08 +03:00
jgv
d60e8ddedc 0029813: BRepFill_PipeShell algorithm produces invalid result
Modified method: BRepFill_Sweep::BuildShell
case of global closedness of path containing several C0-connected parts is corrected.
2018-06-14 14:03:08 +03:00
ika
f277ba3771 0029821: Data Exchange - Wrong processing of subshapes in ShapeTool
Improve FindSubShape method in ShapeTool.
Update Expand compounds, according to changes in ShapeTool.
Add FindSubShape and AddSubShape commands for Draw.
2018-06-14 14:03:07 +03:00
emv
948fe6ca88 0028747: Incorrect result of the section operation after edge refinement
Implementation of the method for simplification of the result of Boolean Operation on the API level.
The method BRepAlgoAPI_BuilderAlgo::SimplifyResult has been added, so the derived classes such as BooleanOpeation and Splitter can also use this method.
The result shape simplification should be called after the operation is done. The simplification is performed by the means of ShapeUpgrade_UnifySameDomain algorithm.

Draw command "bsimplify" has been added to control the simplification options.
Documentation for new functionality and draw commands controlling the options of Boolean operations.
Test cases for the new functionality.

Side-effect change:
The algorithms in Boolean component have been changed to use the BRepTools_History as a History tool.
Now it became possible to disable the collection of shapes modifications during Boolean Operations, which may be useful for performance sake (in draw the option is controlled by *setfillhistory* command).
Draw command "unifysamedom" has been changed to accept the angular tolerance in degrees instead of radians.
2018-06-14 14:03:06 +03:00
nbv
894dba72a3 0029694: Geom2dGcc_Circ2dTanCenGeo crash
The reason of this issue is in incorrectly interpreted the generic class "TheExtPC" (eliminated after the fix 0024773) as Extrema_ExtPC2d. Correct interpretation must be "Extrema_EPCOfExtPC2d" class.

Now this problem has been fixed in the class Geom2dGcc_Circ2dTanCenGeo.

New testgrid "lowalgos 2dgcc" has been created.
2018-06-14 14:03:06 +03:00
nbv
638ad7f3c5 0029712: Extrema algorithm raises exception
1. Extrema algorithm calls Curve-surface intersector. This intersector returns flag about infinite solution (in spite of extrema's returning not-parallel status correctly - axes of considered cylinder and circle are not parallel). In this case, attempt of obtaining number of intersection points leads to exception.

So, the fix adds check of infinite solution after the intersection algorithm.

2. The methods IsDone(), IsParallel(), NbExt(), SquareDistance() and Points() (of Extrema_* classes) have been corrected to make them consistent to the documentation.

3. Revision of some Extrema_* classes has been made in order to avoid places with uninitialized variables.

4. Currently Extrema does not store any points in case when the arguments are parallel. It stores the distance only.

5. Some cases on Extrema-algo have been moved from "fclasses"-group to "modalg"-group.
2018-06-14 14:03:05 +03:00
msv
395a5977d5 0029777: Foundation Classes - The methods of moving of one NCollection_Sequence to another are unsafe
Make the methods Append, Prepend, InsertBefore and InsertAfter, which take another sequence as an argument, copying the sequence instead of joining if the allocators are different.

Add test cases for collection classes.
2018-06-14 14:03:04 +03:00
nbv
ef33df518a 0029691: Constructor of BRepFill_MultiLine adjusts V-parameter of sphere in the range -PI/2 ... +PI/2 mistakenly.
1. Sphere is not V-periodic surface. See the section "Periodicity concept" written in frame of the fix 0029115. Therefore, applying ElCLib::AdjustPeriodic(...) method is unreasonable.

2. Default U work range of sphere is 0 ... 2*PI. Therefore, adjusting U parameter in range -PI/2 ... +PI/2 is unreasonable.
2018-06-14 14:03:04 +03:00
ifv
7e4ff64898 0029586: Revolution creates solid with degenerated edges shared among faces
Substitution of degenerated edges by their copies is implemented to make edges not shared
in BRepPrimAPI_MakeRevol::Build().
Method BRepPrimAPI_MakeRevol::Generated(...) is changed in order to use history of substitutions.
Test case is added.
2018-06-14 14:03:03 +03:00
drazmyslovich
9f785738a1 0029719: Modeling Algorithms - GeomPlate_BuildPlateSurface has no progress information and is not abortable
The Message_ProgressIndicator handle is added as a parameter to the function LU_Decompose and the the member functions of math_Gauss, Plate_Plate and GeomPlate_BuildPlateSurface classes.
2018-06-14 14:03:02 +03:00
kgv
25c35042b6 0029729: Visualization, Graphic3d_ClipPlane - add support of clipping plane chains
Graphic3d_ClipPlane now can define a Chain of Planes (logical AND).
OpenGl_ShaderManager - added new GLSL sub-programs for clipping plane chains.
Bnd_Range::TrimFrom(), ::TrimTo() - added auxiliary methods for trimming the range.
SelectMgr_ViewClipRange now handles non-continuous clipping range.
Graphic3d_SequenceOfHClipPlane now aggregates NCollection_Sequence instead of inheritance.
OpenGl_CappingPlaneResource - triangulation has been adjusted to make front face following CCW order.
2018-06-14 14:03:02 +03:00
Benjamin Bihler
012264339e 0029765: BOPTools_AlgoTools::MakeSplitEdge Creates Illegal Edge
Method MakeSplitEdge checks arguments order.
This makes the method more generic.
Taking vertex orientation into account.
2018-06-14 14:03:01 +03:00
kgv
e52ba46e3b 0029520: Visualization - drop deprecated V3d_View::Export() functionality and dependency from gl2ps 2018-06-14 14:03:00 +03:00
bugmaster
7775636a15 Switching #define OCC_VERSION_DEVELOPMENT "dev" 2018-06-14 14:03:00 +03:00
bugmaster
ec86d65faf Update version of OCCT up to 7.3.1 2018-06-14 14:02:59 +03:00
455 changed files with 6540 additions and 13057 deletions

View File

@@ -481,7 +481,6 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
@@ -609,24 +608,6 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
endif()
# GL2PS
if (NOT DEFINED ANDROID AND CAN_USE_GL2PS)
set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}")
if (USE_GL2PS)
add_definitions (-DHAVE_GL2PS)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_GL2PS")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
endif()
# TBB
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")

View File

@@ -1,17 +1,17 @@
wnt WOKSteps_exec_link DRAWEXE #WOKStep_EXELink(exec.tks)
lin WOKSteps_exec_link DRAWEXE #WOKStep_EXELink(exec.tks)
wnt cmplrs_cxx f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_cxx Aspect (wnt cmplrs_cxx b) -D_AFXDLL
wnt cmplrs_cxx (wnt cmplrs_cxx b) -D_AFXDLL -D_AFXDLL
wnt cmplrs_c f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c f -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c b -D_CRT_SECURE_NO_DEPRECATE -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
wnt cmplrs_c NIS (wnt cmplrs_c b) -DSILGL -DSILGL_VRS=50
lin cmplrs_cxx f -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_cxx b -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_GL2PS -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_cxx f -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_cxx b -DOCC_CONVERT_SIGNALS -D_GNU_SOURCE=1 -DHAVE_FREEIMAGE -DHAVE_TBB -DHAVE_OPENCL
lin cmplrs_c f -D_GNU_SOURCE=1 -fexceptions
lin cmplrs_c b -D_GNU_SOURCE=1 -fexceptions

View File

@@ -277,26 +277,6 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME
endif()
endif()
if("${PRODUCT_NAME}" STREQUAL "GL2PS")
get_filename_component(GL2PSLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}} NAME)
if (SINGLE_GENERATOR)
install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR_LIB}" RENAME ${GL2PSLIB}.1)
else()
install (FILES "${ABS_PATH}"
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i"
RENAME ${GL2PSLIB}.1)
install (FILES "${ABS_PATH}"
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d"
RENAME ${GL2PSLIB}.1)
endif()
endif()
endif()
else()
# the library directory for using by the executable

View File

@@ -1,3 +0,0 @@
#GL2PS
THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "CSF_GL2PS" "d")

View File

@@ -58,15 +58,6 @@ if (USE_TCL)
endif()
endif()
# GL2PS
if (NOT DEFINED ANDROID)
if (USE_GL2PS)
set (CSF_GL2PS "gl2ps")
else()
set (CSF_GL2PS)
endif()
endif()
if (WIN32)
set (CSF_advapi32 "advapi32.lib")
set (CSF_gdi32 "gdi32.lib")

View File

@@ -40,7 +40,7 @@ Precompiled headers are generated automatically by Cotire tool.")
# install variables
set (INSTALL_DIR_DESCR
"The place where built OCCT libraries, headers, test cases (INSTALL_TEST_CASES variable),
samples (INSTALL_SAMPLES_DESCR variable) and certain 3rdparties (INSTALL_GL2PS, INSTALL_TBB and
samples (INSTALL_SAMPLES_DESCR variable) and certain 3rdparties (INSTALL_TBB and
other similar variables) will be placed during the installation process (building INSTALL project)")
set (INSTALL_DIR_WITH_VERSION_DESCR
@@ -88,7 +88,6 @@ INSTALL_MESSAGE (INSTALL_EIGEN "EIGEN header files")
INSTALL_MESSAGE (INSTALL_EGL "EGL binaries")
INSTALL_MESSAGE (INSTALL_GLES2 "OpenGL ES 2.0 binaries")
INSTALL_MESSAGE (INSTALL_FREETYPE "FreeType binaries")
INSTALL_MESSAGE (INSTALL_GL2PS "GL2PS binaries")
INSTALL_MESSAGE (INSTALL_TBB "TBB binaries")
INSTALL_MESSAGE (INSTALL_TCL "TCL binaries")
INSTALL_MESSAGE (INSTALL_TK "TK binaries")
@@ -165,10 +164,6 @@ set (USE_GLES2_DESCR
"Indicates whether OpenGL ES 2.0 should be used in OCCT visualization
module instead of desktop OpenGL")
set (USE_GL2PS_DESCR
"Indicates whether GL2PS product should be used in OCCT visualization
module for support of vector image formats (PS, EPS etc)")
set (USE_TBB_DESCR
"Indicates whether TBB is used or not. TBB stands for Threading Building Blocks,
the technology of Intel Corp, which comes with different mechanisms and patterns for

View File

@@ -139,9 +139,6 @@ proc wokdep:gui:UpdateList {} {
wokdep:SearchFreeType anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
wokdep:SearchX11 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
if { "$::HAVE_GLES2" == "true" } {
if { "$::HAVE_GL2PS" == "true" } {
lappend anIncErrs "Error: gl2ps can not be used with OpenGL ES"
}
wokdep:SearchEGL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
wokdep:SearchGLES anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
@@ -151,9 +148,6 @@ proc wokdep:gui:UpdateList {} {
if { "$::HAVE_FFMPEG" == "true" } {
wokdep:SearchFFmpeg anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::HAVE_GL2PS" == "true" } {
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "gl2ps" "gl2ps.h" "gl2ps" {"gl2ps"}
}
if { "$::HAVE_TBB" == "true" } {
wokdep:SearchTBB anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
@@ -415,8 +409,6 @@ entry .myFrame.mySrchEntry -textvariable PRODUCTS_PATH -width 80
ttk::button .myFrame.mySrchBrowseBtn -text "Browse" -command wokdep:gui:BrowsePartiesRoot
checkbutton .myFrame.myChecks.myFImageCheck -offvalue "false" -onvalue "true" -variable HAVE_FREEIMAGE -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myFImageLbl -text "Use FreeImage"
checkbutton .myFrame.myChecks.myGl2psCheck -offvalue "false" -onvalue "true" -variable HAVE_GL2PS -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myGl2psLbl -text "Use GL2PS"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
if { "$::tcl_platform(os)" != "Darwin" } {
@@ -545,9 +537,6 @@ if { "$::tcl_platform(os)" != "Darwin" } {
grid .myFrame.myChecks.myZLibCheck -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myZLibLbl -row $aCheckRowIter -column 7 -sticky w
grid .myFrame.myChecks.myGl2psCheck -row $aCheckRowIter -column 8 -sticky e
grid .myFrame.myChecks.myGl2psLbl -row $aCheckRowIter -column 9 -sticky w
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 10 -sticky e
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 11 -sticky w

View File

@@ -65,7 +65,7 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
}
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_GL2PS HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
foreach anEnvIter $THE_ENV_VARIABLES {
set ${anEnvIter} "false"
if { [info exists ::env(${anEnvIter})] } {

View File

@@ -1318,9 +1318,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
if { "$::HAVE_FFMPEG" == "true" } {
set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
}
if { "$::HAVE_GL2PS" == "true" } {
set aLibsMap(CSF_GL2PS) "gl2ps"
}
if { "$::HAVE_TBB" == "true" } {
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
}

View File

@@ -58,7 +58,6 @@ set (OpenCASCADE_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
set (OpenCASCADE_WITH_TCL @USE_TCL@)
set (OpenCASCADE_WITH_FREETYPE @USE_FREETYPE@)
set (OpenCASCADE_WITH_FREEIMAGE @USE_FREEIMAGE@)
set (OpenCASCADE_WITH_GL2PS @USE_GL2PS@)
set (OpenCASCADE_WITH_TBB @USE_TBB@)
set (OpenCASCADE_WITH_VTK @USE_VTK@)
set (OpenCASCADE_WITH_FFMPEG @USE_FFMPEG@)

View File

@@ -11,7 +11,6 @@ if /I "%VCVER%" == "@COMPILER@" (
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIRS@"
set "EGL_DIR=@3RDPARTY_EGL_DLL_DIRS@"
set "GLES2_DIR=@3RDPARTY_GLES2_DLL_DIRS@"
set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIRS@"
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"

View File

@@ -9,7 +9,6 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TK_DIR="@3RDPARTY_TK_LIBRARY_DIR@"
export FREETYPE_DIR="@3RDPARTY_FREETYPE_LIBRARY_DIR@"
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIRS@"
export GL2PS_DIR="@3RDPARTY_GL2PS_LIBRARY_DIRS@"
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"

View File

@@ -13,7 +13,6 @@ if /I "%VCVER%" == "@COMPILER@" (
set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIRS@"
set "EGL_DIR=@USED_3RDPARTY_EGL_DIRS@"
set "GLES2_DIR=@USED_3RDPARTY_GLES2_DIRS@"
set "GL2PS_DIR=@USED_3RDPARTY_GL2PS_DIRS@"
set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
set "FFMPEG_DIR=@USED_3RDPARTY_FFMPEG_DIR@"

View File

@@ -9,7 +9,6 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TK_DIR="@USED_3RDPARTY_TK_DIR@"
export FREETYPE_DIR="@USED_3RDPARTY_FREETYPE_DIR@"
export FREEIMAGE_DIR="@USED_3RDPARTY_FREEIMAGE_DIRS@"
export GL2PS_DIR="@USED_3RDPARTY_GL2PS_DIRS@"
export TBB_DIR="@USED_3RDPARTY_TBB_DIR@"
export VTK_DIR="@USED_3RDPARTY_VTK_DIR@"
export FFMPEG_DIR="@USED_3RDPARTY_FFMPEG_DIR@"

View File

@@ -19,7 +19,6 @@ set "HAVE_TBB=false"
set "HAVE_OPENCL=false"
set "HAVE_FREEIMAGE=false"
set "HAVE_FFMPEG=false"
set "HAVE_GL2PS=false"
set "HAVE_VTK=false"
set "HAVE_GLES2=false"
set "HAVE_D3D=false"
@@ -156,7 +155,6 @@ set "CSF_OPT_CMPL="
set "PRODUCTS_DEFINES="
if ["%HAVE_TBB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB" & set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
if ["%HAVE_OPENCL%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL" & set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
if ["%HAVE_GL2PS%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GL2PS" & set "CSF_DEFINES=HAVE_GL2PS;%CSF_DEFINES%"
if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
if ["%HAVE_FFMPEG%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG" & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
if ["%HAVE_VTK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK" & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"

View File

@@ -126,7 +126,6 @@ if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
if not ["%EGL_DIR%"] == [""] set "PATH=%EGL_DIR%;%PATH%"
if not ["%GLES2_DIR%"] == [""] set "PATH=%GLES2_DIR%;%PATH%"
if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%"
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"

View File

@@ -11,7 +11,6 @@ export HAVE_TBB="false";
export HAVE_OPENCL="false";
export HAVE_FREEIMAGE="false";
export HAVE_FFMPEG="false";
export HAVE_GL2PS="false";
export HAVE_VTK="false";
export HAVE_GLES2="false";
export HAVE_ZLIB="false";
@@ -96,7 +95,6 @@ if [ "$HAVE_TBB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -D
if [ "$HAVE_OPENCL" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENCL"; fi
if [ "$HAVE_FREEIMAGE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREEIMAGE"; fi
if [ "$HAVE_FFMPEG" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FFMPEG"; fi
if [ "$HAVE_GL2PS" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GL2PS"; fi
if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2"; fi
if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_VTK"; fi
if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi

View File

@@ -57,10 +57,6 @@ if [ "$FREEIMAGE_DIR" != "" ]; then
THRDPARTY_PATH="${FREEIMAGE_DIR}:${THRDPARTY_PATH}"
fi
if [ "$GL2PS_DIR" != "" ]; then
THRDPARTY_PATH="${GL2PS_DIR}:${THRDPARTY_PATH}"
fi
if [ "$TBB_DIR" != "" ]; then
THRDPARTY_PATH="${TBB_DIR}:${THRDPARTY_PATH}"
fi

View File

@@ -19,7 +19,6 @@ There are two types of third-party products, which are necessary to build OCCT:
* FreeType 2.4.10 - 2.5.3;
* Optional products:
* TBB 3.x - 4.x;
* gl2ps 1.3.5 - 1.3.8;
* FreeImage 3.14.1 - 3.16.0;
* VTK 6.1.0.
@@ -108,32 +107,6 @@ This third-party product is installed with binaries from the archive that can b
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product.
@subsection dev_guides__building_3rdparty_linux_3_2 gl2ps
Download the necessary archive from http://geuz.org/gl2ps/ and unpack it.
1. Install or build *cmake* product from the source file.
2. Start *cmake* in GUI mode with the directory where the source files of gl2ps are located:
ccmake GL2PS_SRC_DIR
* Press <i>[c]</i> to make the initial configuration;
* Define the necessary options in *CMAKE_INSTALL_PREFIX*
* Press <i>[c]</i> to make the final configuration
* Press <i>[g]</i> to generate Makefile and exit
or just run the following command:
cmake DCMAKE_INSTALL_PREFIX=GL2PS_INSTALL_DIR DCMAKE_BUILD_TYPE=Release
3. Start the building of gl2ps:
make
4. Start the installation of gl2ps. Binaries will be installed according to the *CMAKE_INSTALL_PREFIX* option.
make install
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
Download the necessary archive from http://sourceforge.net/projects/freeimage/files/Source%20Distribution/
@@ -221,7 +194,7 @@ Download the necessary archive from http://www.vtk.org/VTK/resources/software.ht
make
4. Start the installation of gl2ps. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
4. Start the installation of VTK. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
make install
@@ -232,7 +205,7 @@ Download the necessary archive from http://www.vtk.org/VTK/resources/software.ht
All 3rd-party products required for building of OCCT could be installed
from official repositories. You may install them from console using apt-get utility:
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev libgl2ps-dev
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev
To launch binaries built with WOK you need to install C shell and 32-bit libraries on x86_64 distributives:

View File

@@ -17,7 +17,6 @@ There are two types of third-party products, which are necessary to build OCCT:
* FreeType 2.4.10 - 2.5.3.
* Optional products:
* TBB 3.x - 4.x;
* gl2ps 1.3.5 - 1.3.8;
* FreeImage 3.14.1 - 3.16.0
@section dev_guides__building_3rdparty_osx_2 Building Mandatory Third-party Products
@@ -106,33 +105,6 @@ Go to the **Download** page, find the release version you need (e.g. *tbb30_018o
and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_osx.tgz*).
@subsection dev_guides__building_3rdparty_osx_3_2 gl2ps 1.3.5
Download the necessary archive from http://geuz.org/gl2ps/ and unpack it.
1. Install or build cmake product from the source file.
2. Start cmake in GUI mode with the directory, where the source files of *fl2ps* are located:
ccmake GL2PS_SRC_DIR
* Press <i>[c]</i> to make the initial configuration;
* Define the necessary options in *CMAKE_INSTALL_PREFIX*;
* Press <i>[c]</i> to make the final configuration;
* Press <i>[g]</i> to generate Makefile and exit.
or just run the following command:
cmake DCMAKE_INSTALL_PREFIX=GL2PS_INSTALL_DIR DCMAKE_BUILD_TYPE=Release
3. Start the building of gl2ps
make
4. Start the installation of gl2ps. Binaries will be installed according to the *CMAKE_INSTALL_PREFIX* option
make install
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage 3.14.1 or 3.15.x
Download the necessary archive from

View File

@@ -17,7 +17,6 @@ There are two types of third-party products used by OCCT:
* FreeType 2.4.10 -- 2.5.3.
* Optional products:
* TBB 3.x -- 4.x;
* gl2ps 1.3.5 -- 1.3.8;
* FreeImage 3.14.1 -- 3.16.0;
* VTK 6.1.0.
@@ -156,85 +155,6 @@ Unpack the downloaded archive of TBB product into the *3rdparty* folder.
Further in this document, this folder is referred to as *tbb*.
@subsection dev_guides__building_3rdparty_win_3_2 gl2ps
This third-party product should be built as a dynamically loadable library (dll file).
You can download its sources from http://geuz.org/gl2ps/src/.
### The building procedure
1. Unpack the downloaded archive of gl2ps product (e.g. *gl2ps-1.3.5.tgz*) into the *3rdparty* folder.
As a result, you will get a folder named, for example, *3rdparty\\gl2ps-1.3.5-source*.
Rename it into <i>gl2ps-platform-compiler-building mode</i>, where
* **platform** -- *win32* or *win64*;
* **compiler** -- *vc8*, *vc9* or *vc10*;
* **building mode** -- *opt* (for release) or *deb* (for debug).
For example, <i>gl2ps-win64-vc10-deb</i>
Further in this document, this folder is referred to as *gl2ps*.
2. Download (from http://www.cmake.org/cmake/resources/software.html)
and install the *CMake* build system.
3. Edit the file *gl2ps\\CMakeLists.txt*.
After line 113 in *CMakeLists.txt*:
set_target_properties(shared PROPERTIES COMPILE_FLAGS \"-DGL2PSDLL -DGL2PSDLL_EXPORTS\")
add the following line:
add_definitions(-D_USE_MATH_DEFINES)
Attention: If Cygwin was installed on your computer, make sure that there is no path to it in the *PATH* variable to avoid possible conflicts during the configuration.
4. Launch CMake <i>(cmake-gui.exe)</i> using the Program menu.
In CMake:
* Define where the source code is.
This path must point to *gl2ps* folder.
* Define where to build the binaries.
This path must point to the folder where generated gl2ps project binaries will be placed
(for example, *gl2ps\\bin*).
Further in this document, this folder is referred to as *gl2ps_bin*.
* Press **Configure** button.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image004.png}
* Select the generator (the compiler and the target platform -- 32 or 64 bit) in the pop-up window.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image005.png}
* Press **Finish** button to return to the main CMake window.
Expand the ENABLE group and uncheck ENABLE_PNG and ENABLE_ZLIB check boxes.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image006.png}
* Expand the CMAKE group and define *CMAKE_INSTALL_PREFIX* which is the path where you want to install the build results, for example, *c:\\occ3rdparty\\gl2ps-1.3.5*.
@figure{/dev_guides/building/3rdparty/images/3rdparty_image007.png}
* Press **Configure** button again, then press **Generate** button to generate Visual Studio projects. After completion, close CMake application.
5. Open the solution file *gl2ps_bin\\gl2ps.sln* in Visual Studio.
* Select a configuration to build
* Choose **Release** to build Release binaries.
* Choose **Debug** to build Debug binaries.
* Select a platform to build.
* Choose **Win32** to build for a 32 bit platform.
* Choose **x64** to build for a 64 bit platform.
* Build the solution.
* Build the *INSTALL* project.
As a result, you should have the installed gl2ps product in the *CMAKE_INSTALL_PREFIX* path.
@subsection dev_guides__building_3rdparty_win_3_3 FreeImage
This third-party product should be built as a dynamically loadable library (.dll file).

View File

@@ -82,14 +82,12 @@ The following table gives the full list of environment variables used at the con
|----------|------|---------|
| CMAKE_BUILD_TYPE | String | Specifies the build type on single-configuration generators (such as make). Possible values are Debug, Release and RelWithDebInfo |
| USE_FREEIMAGE | Boolean flag | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) |
| USE_GL2PS | Boolean flag | Indicates whether GL2PS product should be used in OCCT visualization module for support of vector image formats (PS, EPS, etc.) |
| USE_TBB | Boolean flag | Indicates whether TBB 3rd party is used or not. TBB stands for Threading Building Blocks, the technology of Intel Corp, which comes with different mechanisms and patterns for injecting parallelism into your application. OCCT remains parallel even without TBB product |
| USE_VTK | Boolean flag | Indicates whether VTK 3rd party is used or not. VTK stands for Visualization ToolKit, the technology of Kitware Inc intended for general-purpose scientific visualization. OCCT comes with a bridge between CAD data representation and VTK by means of its dedicated VIS component (VTK Integration Services). You may skip this 3rd party unless you are planning to use VTK visualization for OCCT geometry. See the official documentation @ref occt_user_guides__vis for the details on VIS |
| 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products|
| 3RDPARTY_FREETYPE_* | Path | Path to Freetype binaries |
| 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries |
| 3RDPARTY_FREEIMAGE* | Path | Path to Freeimage binaries |
| 3RDPARTY_GL2PS_* | Path | Path to GL2PS binaries |
| 3RDPARTY_TBB* | Path | Path to TBB binaries |
| 3RDPARTY_VTK_* | Path | Path to VTK binaries |
| BUILD_MODULE_<MODULE>| Boolean flag | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides |
@@ -117,7 +115,6 @@ The following table gives the full list of environment variables used at the con
| INSTALL_DIR_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) |
| INSTALL_FREETYPE | Boolean flag | Indicates whether Freetype binaries should be installed into the installation directory |
| INSTALL_FREEIMAGE* | Boolean flag | Indicates whether Freeimage binaries should be installed into the installation directory |
| INSTALL_GL2PS | Boolean flag | Indicates whether GL2PS binaries should be installed into the installation directory |
| INSTALL_TBB | Boolean flag | Indicates whether TBB binaries should be installed into the installation directory |
| INSTALL_VTK | Boolean flag | Indicates whether VTK binaries should be installed into the installation directory |
| INSTALL_TCL | Boolean flag | Indicates whether TCL binaries should be installed into the installation directory |

View File

@@ -26,7 +26,7 @@ The environment is defined in the file *custom.sh* (on Linux and OS X) or *custo
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false
export HAVE_FREEIMAGE=false
~~~~~
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively:

View File

@@ -27,7 +27,7 @@ The environment is defined in the file *custom.sh* which can be edited directly:
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false
export HAVE_FREEIMAGE=false
~~~~~
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:

View File

@@ -1546,6 +1546,8 @@ Since the new version, the method *BRepAdaptor_CompCurve::IsPeriodic()* will alw
@subsection upgrade_730_removed Removed features
* The methods *SetDeflection*, *SetEpsilonT*, *SetDiscretize* of the class *IntTools_EdgeFace* have been removed as redundant.
* Deprecated functionality *V3d_View::Export()*, related enumerations Graphic3d_ExportFormat, Graphic3d_SortType
as well as optional dependency from gl2ps library have been removed.
@subsection upgrade_730_BuilderSolid Boolean Operations - Solid Builder algorithm
@@ -1579,6 +1581,13 @@ To use the custom printer in OCAF, it can be either added to default messenger o
@section upgrade_occt740 Upgrade to OCCT 7.4.0
@subsection upgrade_740_BRepPrimAPI_MakeRevol Changes in BRepPrimAPI_MakeRevol algorithm
Previously the algorithm could create a shape with the same degenerated edge shared between some faces. Now it is prevented. The algorithm creates the different copy of this edge for each face. The method *Generated(...)* has been changed in order to apply restriction to the input shape: input shape can be only of type VERTEX, EDGE, FACE or SOLID. For input shape of another type the method always returns empty list.
@subsection upgrade_740_extremaalgo Changes in behavior of Extrema algorithms
Since OCCT 7.4.0 exception is thrown on the attempt of taking points in case of infinite number of solution (IsParallel status). Request of distances is available as before. Method NbExt() always returns 1 in such cases.
@subsection upgrade_740_removed Removed features
* The following methods of the class *BRepAlgoAPI_BooleanOperation* have been removed as obsolete or replaced:
- *BuilderCanWork* can be replaced with *IsDone* or *HasErrors* method.

View File

@@ -90,10 +90,6 @@ the copyright allows you to use, modify, and redistribute Tcl/Tk for any purpose
explicit license agreement and without paying any license fees or royalties.
To use Tcl/Tk, please refer to the Licensing Terms (https://www.tcl.tk/software/tcltk/license.html).
**GL2PS** is developed by Christophe Geuzaine and others. It is optionally used by OCCT to
export content of OpenGL scene to vector graphics formats (PS, PDF, EMF, SVG).
The library is licensed under GL2PS license (http://www.geuz.org/gl2ps/COPYING.GL2PS).
**FreeType 2** is developed by Antoine Leca, David Turner, Werner Lemberg and others.
It is a software font engine that is designed to be small, efficient, highly customizable and
portable while capable of producing high-quality output (glyph images). This product
@@ -226,7 +222,6 @@ for which OCCT is certified to work.
| Freetype (for text rendering) | FreeType 2.4.11-2.7.1 https://sourceforge.net/projects/freetype/files/ |
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.17.0+ https://sourceforge.net/projects/freeimage/files |
| FFmpeg (optional, for video recording) | FFmpeg 3.1+ https://www.ffmpeg.org/download.html |
| gl2ps (optional, for export contents of OCCT viewer to vector formats) | gl2ps-1.3.8+ http://geuz.org/gl2ps/ |
| Intel TBB (optional, for multithreaded algorithms) | TBB 4.x or 5.x https://www.threadingbuildingblocks.org/ |
| VTK (for VTK Integration Services | VTK 6.1+ http://www.vtk.org/download/ |
| Doxygen (optional for building documentation) | Doxygen 1.8.5+ https://www.stack.nl/~dimitri/doxygen/download.html |

View File

@@ -5684,18 +5684,33 @@ projponf f pnt
Syntax:
~~~~~
cirtang cname curve/point/radius curve/point/radius curve/point/radius
cirtang result [-t <Tolerance>] -c <curve> -p <point> -r <Radius>...
~~~~~
Builds all circles satisfying the three constraints which are either a curve (the circle must be tangent to that curve), a point (the circle must pass through that point), or a radius for the circle. Only one constraint can be a radius. The solutions will be stored in variables *name_1*, *name_2*, etc.
Builds all circles satisfying the condition:
1. the circle must be tangent to every given curve;
2. the circle must pass through every given point;
3. the radius of the circle must be equal to the requested one.
Only following set of input data is supported: Curve-Curve-Curve, Curve-Curve-Point, Curve-Curve-Radius, Curve-Point-Point, Curve-Point-Radius, Point-Point-Point, Point-Point-Radius. The solutions will be stored in variables *result_1*, *result_2*, etc.
**Example:**
~~~~~
# a point, a line and a radius. 2 solutions
# a point, a line and a radius. 2 solutions of type Curve-Point-Radius (C-P-R)
point p 0 0
line 1 10 0 -1 1
cirtang c p 1 4
== c_1 c_2
line l 10 0 -1 1
cirtang c -p p -c l -r 4
== Solution of type C-P-R is: c_1 c_2
~~~~~
Additionally it is possible to create a circle(s) with given center and tangent to the given curve (Curve-Point type).
**Example:**
~~~~~
point pp 1 1
2dbsplinecurve cc 1 2 0 2 1 2 -10 -5 1 10 -5 1
cirtang r -p pp -c cc
== Solution of type C-P is: r_1 r_2
~~~~~
@subsubsection occt_draw_6_10_2 lintan
@@ -5845,8 +5860,6 @@ The following topics are covered in the eight sections of this chapter:
* Topological operations, or booleans.
* Drafting and blending.
* Defeaturing.
* Making shapes periodic in 3D space.
* Making shapes connected.
* Analysis of shapes.
@@ -7178,133 +7191,6 @@ parallel - enables the parallel processing mode.
~~~~
@subsection occt_draw_makeperiodic 3D Model Periodicity
Draw module for @ref occt_modalg_makeperiodic "making the shape periodic" includes the following commands:
* **makeperiodic** - makes the shape periodic in required directions;
* **repeatshape** - repeats the periodic shape in requested periodic direction;
* **periodictwins** - returns the periodic twins for the shape;
* **clearrepetitions** - clears all previous repetitions of the periodic shape.
@subsubsection occt_draw_makeperiodic_makeperiodic makeperiodic
The command makes the shape periodic in the required directions with the required period.
If trimming is given it trims the shape to fit the requested period.
Syntax:
~~~~
makeperiodic result shape [-x/y/z period [-trim first]]
Where:
result - resulting periodic shape;
shape - input shape to make it periodic:
-x/y/z period - option to make the shape periodic in X, Y or Z direction with the given period;
-trim first - option to trim the shape to fit the required period, starting the period in first.
~~~~
@subsubsection occt_draw_makeperiodic_repeatshape repeatshape
The command repeats the periodic shape in periodic direction requested number of time.
The result contains the all the repeated shapes glued together.
The command should be called after **makeperiodic** command.
Syntax:
~~~~
repeatshape result -x/y/z times
Where:
result - resulting shape;
-x/y/z times - direction for repetition and number of repetitions (negative number of times means the repetition in negative direction).
~~~~
@subsubsection occt_draw_makeperiodic_periodictwins periodictwins
For the given shape the command returns the identical shapes located on the opposite sides of the periodic direction.
All periodic twins should have the same geometry.
The command should be called after **makeperiodic** command.
Syntax:
~~~~
periodictwins twins shape
Where:
twins - periodic twins for the given shape
shape - shape to find the twins for
~~~~
@subsubsection occt_draw_makeperiodic_clearrepetitions clearrepetitions
The command clears all previous repetitions of the periodic shape allowing to start the repetitions over.
No arguments are needed for the command.
@subsection occt_draw_makeconnected Making the touching shapes connected
Draw module for @ref occt_modalg_makeconnected "making the touching same-dimensional shapes connected" includes the following commands:
* **makeconnected** - make the input shapes connected or glued, performs material associations;
* **cmaterialson** - returns the materials located on the requested side of a shape;
* **cmakeperiodic** - makes the connected shape periodic in requested directions;
* **crepeatshape** - repeats the periodic connected shape in requested directions requested number of times.
@subsubsection occt_draw_makeconnected_makeconnected makeconnected
The command makes the input touching shapes connected.
Syntax:
~~~~
makeconnected result shape1 shape2 ...
Where:
result - resulting connected shape.
shape1 shape2 ... - shapes to be made connected.
~~~~
@subsubsection occt_draw_makeconnected_cmaterialson cmaterialson
The command returns the materials located on the requested side of the shape.
The command should be called after the shapes have been made connected, i.e. after the command **makeconnected**.
Syntax:
~~~~
cmaterialson result +/- shape
Where:
result - material shapes
shape - shape for which the materials are needed
+/- - side of a given shape ('+' for positive side, '-' - for negative).
~~~~
@subsubsection occt_draw_makeconnected_cmakeperiodic cmakeperiodic
The command makes the connected shape periodic in the required directions with the required period.
The command should be called after the shapes have been made connected, i.e. after the command **makeconnected**.
Syntax:
~~~~
cmakeperiodic result [-x/y/z period [-trim first]]
Where:
result - resulting periodic shape;
shape - input shape to make it periodic:
-x/y/z period - option to make the shape periodic in X, Y or Z direction with the given period;
-trim first - option to trim the shape to fit the required period, starting the period in first.
~~~~
@subsubsection occt_draw_makeconnected_crepeatshape crepeatshape
The command repeats the connected periodic shape in the required periodic directions required number of times.
The command should be called after the shapes have been made connected and periodic, i.e. after the commands **makeconnected** and **cmakeperiodic**.
Syntax:
~~~~
crepeatshape result -x/y/z times
Where:
result - resulting shape;
-x/y/z times - direction for repetition and number of repetitions (negative number of times means the repetition in negative direction).
~~~~
@subsection occt_draw_7_9 Analysis of topology and geometry
Analysis of shapes includes commands to compute length, area, volumes and inertial properties, as well as to compute some aspects impacting shape validity.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -3315,310 +3315,3 @@ Here are the few examples of defeaturing of the model containing boxes with blen
<td>@figure{/user_guides/modeling_algos/images/modeling_algos_rf_im029.png,"Result",220}</td></td>
</tr>
</table>
@section occt_modalg_makeperiodic 3D Model Periodicity
Open CASCADE Technology provides tools for making an arbitrary 3D model (or just shape) periodic in 3D space in the specified directions.
Periodicity of the shape means that the shape can be repeated in any periodic direction any number of times without creation of the new geometry or splits.
The idea of this algorithm is to make the shape look similarly on the opposite sides or on the period bounds of periodic directions.
It does not mean that the opposite sides of the shape will be mirrored. It just means that the opposite sides of the shape should be split by each other and obtain the same geometry on opposite sides.
Such approach will allow repeating the shape, i.e. translating the copy of a shape on the period, without creation of new geometry because there will be no coinciding parts of different dimension.
For better understanding of what periodicity means lets create a simple prism and make it periodic.
The following draw script creates the L-shape prism with extensions 10x5x10:
~~~~
polyline p 0 0 0 0 0 10 5 0 10 5 0 5 10 0 5 10 0 0 0 0 0
mkplane f p
prism s f 0 5 0
~~~~
@figure{/user_guides/modeling_algos/images/modeling_algos_mkperiodic_im001.png,"Shape to make periodic",220}
Making this shape periodic in X, Y and Z directions with the periods matching the shape's extensions should make the splits of negative X and Z sides of the shape. The shape is already similar on opposite sides of Y directions, thus no new splits is expected.
Here is the shape after making it periodic:
@figure{/user_guides/modeling_algos/images/modeling_algos_mkperiodic_im002.png,"Periodic shape",220}
And here is the repetition of the shape once in X and Z directions:
@figure{/user_guides/modeling_algos/images/modeling_algos_mkperiodic_im003.png,"Repeated shape",220}
The OCCT Shape Periodicity tools also allows making the shape periodic with the period not matching the shape's extensions. Let's make the shape periodic with 11, 6 and 11 for X, Y, Z periods accordingly.
Such values of periods mean that there will be a gap between repeated shapes, and since during repetition the opposite sides do not touch the shape will not be split at all.
Here is the repetition of the shape once in X and Z directions:
@figure{/user_guides/modeling_algos/images/modeling_algos_mkperiodic_im004.png,"Repeated shape",220}
As expected, the shape is not split and the repeated elements do not touch.
If necessary the algorithm will trim the shape to fit into the requested period by splitting it with the planes limiting the shape's requested periods.
E.g. let's make the L-shape periodic only in X direction with the period 2 starting at X parameter 4:
@figure{/user_guides/modeling_algos/images/modeling_algos_mkperiodic_im005.png,"Periodic trimmed shape",220}
@subsection occt_modalg_makeperiodic_how_it_works How the shape is made periodic
For making the shape periodic in certain direction the algorithm performs the following steps:
* Creates the copy of the shape and moves it on the period into negative side of the requested direction;
* Splits the negative side of the shape by the moved copy, ensuring copying of the geometry from positive side to negative;
* Creates the copy of the shape (with already split negative side) and moves it on the period into the positive side of the requested direction;
* Splits the positive side of the shape by the moved copy, ensuring copying of the geometry from negative side to positive.
Repeated copying of the geometry ensures that the corner edges of the periodic shape will have the same geometry on opposite sides of all periodic directions.
Thus, in the periodic shape the geometry from positive side of the shape is always copied on the negative side of periodic directions.
@subsection occt_modalg_makeperiodic_association Opposite shapes association
The algorithm also associates the identical (or twin) shapes located on the opposite sides of the periodic shape. By the construction, the twin shapes should always have the same geometry and distanced from each other on the period.
It is possible that the shape does not have any twins. It means that when repeating this shape will not touch the opposite side of the shape. In the example when the periods of the shape are grater than its extensions, non of the sub-shapes has a twin.
@subsection occt_modalg_makeperiodic_repetition Periodic shape repetition
The algorithm also provides the methods to repeat the periodic shape in periodic directions. To repeat shape the algorithm makes the requested number of copies of the shape and translates them one by one on the time * period value.
After all copies are made and translated they are glued to have valid shape.
The subsequent repetitions are performed on the repeated shape, thus e.g. repeating the shape two times in any periodic direction will create result containing three shapes (original plus two copies).
Single subsequent repetition in any direction will result already in 6 shapes.
The repetitions can be cleared and started over.
@subsection occt_modalg_makeperiodic_history History support
The algorithm supports the history of shapes modifications, thus it is possible to track how the shapes have been changed to make it periodic and what new shapes have been created during repetitions.
Both split history and history of periodic shape repetition are available here. Note, that all repeated shapes are stored as generated into the history.
*BRepTools_History* is used for history support.
@subsection occt_modalg_makeperiodic_errors Errors/Warnings
The algorithm supports the Error/Warning reporting system which allows obtaining the extended overview of the errors and warning occurred during the operation.
As soon as any error appears the algorithm stops working. The warnings allow continuing the job, informing the user that something went wrong.
The algorithm returns the following alerts:
* *BOPAlgo_AlertNoPeriodicityRequired* - Error alert is given if no periodicity has been requested in any direction;
* *BOPAlgo_AlertUnableToTrim* - Error alert is given if the trimming of the shape for fitting it into requested period has failed;
* *BOPAlgo_AlertUnableToMakeIdentical* - Error alert is given if splitting of the shape by its moved copies has failed;
* *BOPAlgo_AlertUnableToRepeat* - Warning alert is given if the gluing of the repeated shapes has failed.
For more information on the error/warning reporting system please see the chapter @ref occt_algorithms_ers "Errors and warnings reporting system" of Boolean operations user guide.
@subsection occt_modalg_makeperiodic_usage Usage
The algorithm is implemented in the class *BOPAlgo_MakePeriodic*.
Here is the example of its usage on the API level:
~~~~
TopoDS_Shape aShape = ...; // The shape to make periodic
Standard_Boolean bMakeXPeriodic = ...; // Flag for making or not the shape periodic in X direction
Standard_Real aXPeriod = ...; // X period for the shape
Standard_Boolean isXTrimmed = ...; // Flag defining whether it is necessary to trimming
// the shape to fit to X period
Standard_Real aXFirst = ...; // Start of the X period
// (really necessary only if the trimming is requested)
Standard_Boolean bRunParallel = ...; // Parallel processing mode or single
BOPAlgo_MakePeriodic aPeriodicityMaker; // Periodicity maker
aPeriodicityMaker.SetShape(aShape); // Set the shape
aPeriodicityMaker.MakeXPeriodic(bMakePeriodic, aXPeriod); // Making the shape periodic in X direction
aPeriodicityMaker.SetTrimmed(isXTrimmed, aXFirst); // Trim the shape to fit X period
aPeriodicityMaker.SetRunParallel(bRunParallel); // Set the parallel processing mode
aPeriodicityMaker.Perform(); // Performing the operation
if (aPeriodicityMaker.HasErrors()) // Check for the errors
{
// errors treatment
Standard_SStream aSStream;
aPeriodicityMaker.DumpErrors(aSStream);
return;
}
if (aPeriodicityMaker.HasWarnings()) // Check for the warnings
{
// warnings treatment
Standard_SStream aSStream;
aPeriodicityMaker.DumpWarnings(aSStream);
}
const TopoDS_Shape& aPeriodicShape = aPeriodicityMaker.Shape(); // Result periodic shape
aPeriodicityMaker.XRepeat(2); // Making repetitions
const TopoDS_Shape& aRepeat = aPeriodicityMaker.RepeatedShape(); // Getting the repeated shape
aPeriodicityMaker.ClearRepetitions(); // Clearing the repetitions
~~~~
Please note, that the class is based on the options class *BOPAlgo_Options*, which provides the following options for the algorithm:
* Error/Warning reporting system;
* Parallel processing mode.
The other options of the base class are not supported here and will have no effect.
All the history information obtained during the operation is stored into *BRepTools_History* object and available through *History()* method:
~~~~
// Get the history object
const Handle(BRepTools_History)& BOPAlgo_MakePeriodic::History();
~~~~
For the usage of the MakePeriodic algorithm on the Draw level the following commands have been implemented:
* **makeperiodic**
* **repeatshape**
* **periodictwins**
* **clearrepetitions**
For more details on the periodicity commands please refer the @ref occt_draw_makeperiodic "Periodicity commands" of the Draw test harness user guide.
To track the history of a shape modification during MakePeriodic operation the @ref occt_draw_hist "standard history commands" can be used.
To have possibility to access the error/warning shapes of the operation use the *bdrawwarnshapes* command before running the algorithm (see command usage in the @ref occt_algorithms_ers "Errors and warnings reporting system" of Boolean operations user guide).
@subsection occt_modalg_makeperiodic_examples Examples
Imagine that you need to make the drills in the plate on the same distance from each other. To model this process it is necessary to make a lot of cylinders (simulating the drills) and cut these cylinders from the plate.
With the periodicity tool, the process looks very simple:
~~~~
# create plate 100 x 100
box plate -50 -50 0 100 100 1
# create a single drill with radius 1
pcylinder drill 1 1
# locate the drill in the left corner
ttranslate drill -48 -48 0
# make the drill periodic with 4 as X and Y periods, so the distance between drills will be 2
makeperiodic drill drill -x 4 -trim -50 -y 4 -trim -50
# repeat the drill to fill the plate, in result we get net of 25 x 25 drills
repeatshape drills -x 24 -y 24
# cut the drills from the plate
bcut result plate drills
~~~~
@figure{/user_guides/modeling_algos/images/modeling_algos_mkperiodic_im006.png,"Plate with drills",220}
@section occt_modalg_makeconnected Making touching shapes connected
Open CASCADE Technology provides tools for making the same-dimensional touching shapes connected (or glued), i.e. for making the coinciding geometries topologically shared among shapes.
To make the shapes connected they are glued by the means of @ref occt_algorithms_7 "General Fuse algorithm". The option BOPAlgo_GlueShift is used, thus if the input shapes have been interfering the algorithm will be unable to recognize this.
Making the group of shapes connected can be useful e.g. before meshing the group. It will allow making the resulting mesh conformal.
The algorithm for making the shapes connected is implemented in the class *BOPAlgo_MakeConnected*.
@subsection occt_modalg_makeconnected_materials Material association
In frames of this tool the input shapes are called materials, and each input shape has a unique material.
After making the shapes connected, the border elements of the input shapes are associated with the shapes to which the belong. At that, the orientation of the border elements in the shape is taken into account.
The associations are made for the following types:
* For input SOLIDS the resulting FACES are associated with the input solids;
* For input FACES the resulting EDGES are associated with the input faces;
* For input EDGES the resulting VERTICES are associated with the input edges.
The association process is called the material association. It allows finding the coinciding elements for the opposite input shapes. These elements will be associated to at least two materials (one on the positive side of the shape, the other - on negative).
For obtaining the material information the following methods should be used
* *MaterialsOnPositiveSide()* - returns the original shapes (materials) located on the positive side of the given shape (i.e. with FORWARD orientation);
* *MaterialsOnNegativeSide()* - returns the original shapes (materials) located on the negative side of the given shape (i.e. with REVERSED orientation);
~~~~
// Returns the original shapes which images contain the given shape with FORWARD orientation.
const TopTools_ListOfShape& BOPAlgo_MakeConnected::MaterialsOnPositiveSide(const TopoDS_Shape& theS)
// Returns the original shapes which images contain the given shape with REVERSED orientation.
const TopTools_ListOfShape& BOPAlgo_MakeConnected::MaterialsOnNegativeSide(const TopoDS_Shape& theS)
~~~~
@subsection occt_modalg_makeconnected_makeperiodic Making connected shape periodic
The tool provides possibility to make the connected shape @ref occt_modalg_makeperiodic "periodic".
Since by making the shape periodic it ensures that the geometry of coinciding shapes on the opposite sides will be the same it allows reusing the mesh of the shape for its periodic twins.
After making the shape periodic the material associations are updated to correspond to the actual state of the result shape. Repetition of the periodic shape is also possible from here. Material associations are not going to be lost.
@subsection occt_modalg_makeconnected_history History support
The algorithm supports history of shapes modifications during the operation. Additionally to standard history method provided by *BRepTools_History* and used here as a history tool, the algorithm also provides the method to track the back connection - from resulting shapes to the input ones.
The method is called *GetOrigins()*:
~~~~
// Returns the list of original shapes from which the current shape has been created.
const TopTools_ListOfShape& BOPAlgo_MakeConnected::GetOrigins(const TopoDS_Shape& theS);
~~~~
Both Gluing history and history of making the shape periodic and periodic shape repetition are available here. Note, that all repeated shapes are stored as generated into the history.
@subsection occt_modalg_makeconnected_errors Errors/Warnings
The algorithm supports the Error/Warning reporting system which allows obtaining the extended overview of the errors and warning occurred during the operation.
As soon as any error appears the algorithm stops working. The warnings allow continuing the job, informing the user that something went wrong.
The algorithm returns the following alerts:
* *BOPAlgo_AlertTooFewArguments* - error alert is given on the attempt to run the algorithm without the arguments;
* *BOPAlgo_AlertMultiDimensionalArguments* - error alert is given on the attempt to run the algorithm on multi-dimensional arguments;
* *BOPAlgo_AlertUnableToGlue* - error alert is given if the gluer algorithm is unable to glue the given arguments;
* *BOPAlgo_AlertUnableToMakePeriodic* - warning alert is given if the periodicity maker is unable to make the connected shape periodic with given options;
* *BOPAlgo_AlertShapeIsNotPeriodic* - warning alert is given on the attempt to repeat the shape before making it periodic.
For more information on the error/warning reporting system please see the chapter @ref occt_algorithms_ers "Errors and warnings reporting system" of Boolean operations user guide.
@subsection occt_modalg_makeconnected_usage Usage
Here is the example of usage of the *BOPAlgo_MakePeriodic* algorithm on the API level:
~~~~
TopTools_ListOfShape anArguments = ...; // Shapes to make connected
Standard_Boolean bRunParallel = ...; // Parallel processing mode
BOPAlgo_MakeConnected aMC; // Tool for making the shapes connected
aMC.SetArguments(anArguments); // Set the shapes
aMC.SetRunParallel(bRunParallel); // Set parallel processing mode
aMC.Perform(); // Perform the operation
if (aMC.HasErrors()) // Check for the errors
{
// errors treatment
Standard_SStream aSStream;
aMC.DumpErrors(aSStream);
return;
}
if (aMC.HasWarnings()) // Check for the warnings
{
// warnings treatment
Standard_SStream aSStream;
aMC.DumpWarnings(aSStream);
}
const TopoDS_Shape& aGluedShape = aMC.Shape(); // Connected shape
// Checking material associations
TopAbs_ShapeEnum anElemType = ...; // Type of border element
TopExp_Explorer anExp(anArguments.First(), anElemType);
for (; anExp.More(); anExp.Next())
{
const TopoDS_Shape& anElement = anExp.Current();
const TopTools_ListOfShape& aNegativeM = aMC.MaterialsOnNegativeSide(anElement);
const TopTools_ListOfShape& aPositiveM = aMC.MaterialsOnPositiveSide(anElement);
}
// Making the connected shape periodic
BOPAlgo_MakePeriodic::PeriodicityParams aParams = ...; // Options for periodicity of the connected shape
aMC.MakePeriodic(aParams);
// Shape repetition after making it periodic
// Check if the shape has been made periodic successfully
if (aMC.PeriodicityTool().HasErrors())
{
// Periodicity maker error treatment
}
// Shape repetition in periodic directions
aMC.RepeatShape(0, 2);
const TopoDS_Shape& aShape = aMC.PeriodicShape(); // Periodic and repeated shape
~~~~
Please note, that the class is based on the options class *BOPAlgo_Options*, which provides the following options for the algorithm:
* Error/Warning reporting system;
* Parallel processing mode.
The other options of the base class are not supported here and will have no effect.
All the history information obtained during the operation is stored into *BRepTools_History* object and available through *History()* method:
~~~~
// Get the history object
const Handle(BRepTools_History)& BOPAlgo_MakeConnected::History();
~~~~
For the usage of the MakeConnected algorithm on the Draw level the following commands have been implemented:
* **makeconnected**
* **cmaterialson**
* **cmakeperiodic**
* **crepeatshape**
For more details on the connexity commands please refer the @ref occt_draw_makeconnected "MakeConnected commands" of the Draw test harness user guide.
To track the history of a shape modification during MakeConnected operation the @ref occt_draw_hist "standard history commands" can be used.
To have possibility to access the error/warning shapes of the operation use the *bdrawwarnshapes* command before running the algorithm (see command usage in the @ref occt_algorithms_ers "Errors and warnings reporting system" of Boolean operations user guide).

View File

@@ -8,7 +8,6 @@
#include "OCC_3dBaseDoc.h"
#include <res\OCC_Resource.h>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_Camera.hxx>
#include <OpenGl_GraphicDriver.hxx>

View File

@@ -55,7 +55,6 @@
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectText3d.hxx>

View File

@@ -23,7 +23,6 @@
#include <Standard_WarningsRestore.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_TextureEnv.hxx>

View File

@@ -264,11 +264,11 @@ bfuse _model _model t_s
explode _model e
# Make a weld at joint edges of platform and wedge
blend _model _model 2 _model_26
blend _model _model 2 _model_27
blend _model _model 2 _model_28
blend _model _model 2 _model_29
blend _model _model 2 _model_30
blend _model _model 2 _model_32
blend _model _model 2 _model_31
# Cylinder on wedge
blend result _model 2 _model_161

View File

@@ -48,7 +48,6 @@
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>

View File

@@ -65,8 +65,6 @@
#include <StdSelect_DisplayMode.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Iterator.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
@@ -112,12 +110,9 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
aPrs->SetDisplayPriority(TheType+2);
}
// Shape vide -> Assemblage vide.
if (myshape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anExplor (myshape);
if (!anExplor.More()) {
return;
}
if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
{
return;
}
if (IsInfinite())
@@ -227,8 +222,7 @@ void AIS_Shape::computeHlrPresentation (const Handle(Prs3d_Projector)& theProjec
}
case TopAbs_COMPOUND:
{
TopoDS_Iterator anExplor (theShape);
if (!anExplor.More())
if (theShape.NbChildren() == 0)
{
return;
}
@@ -293,11 +287,10 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
{
if(myshape.IsNull()) return;
if (myshape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anExplor (myshape);
if (!anExplor.More()) // empty Shape -> empty Assembly.
return;
if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
{
// empty Shape -> empty Assembly.
return;
}
TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
@@ -982,13 +975,11 @@ void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
const Bnd_Box& AIS_Shape::BoundingBox()
{
if (myshape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anExplor (myshape);
if (!anExplor.More()) { // empty Shape -> empty Assembly.
myBB.SetVoid();
return myBB;
}
if (myshape.ShapeType() == TopAbs_COMPOUND && myshape.NbChildren() == 0)
{
// empty Shape -> empty Assembly.
myBB.SetVoid ();
return myBB;
}
if(myCompBB) {

View File

@@ -46,7 +46,6 @@
#include <SelectMgr_Selection.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_Type.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>

View File

@@ -181,7 +181,6 @@ private:
AppParCurves_Constraint myfirstC;
AppParCurves_Constraint mylastC;
Standard_Integer myMultiLineNb;
Standard_Integer myNbPlusOnePoint;
Standard_Boolean myIsClear;

View File

@@ -133,6 +133,8 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
{
const Standard_Integer nbp3d = LineTool::NbP3d(theLine);
const Standard_Integer nbp2d = LineTool::NbP2d(theLine);
const Standard_Real coeff = 4.; //2*2
if (nbp3d > 1) //only simple cases are analysed
return Standard_True;
@@ -207,6 +209,15 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
//Check: may be it is a real loop
if (LoopFound)
{
#ifdef DRAW
for (Standard_Integer ipoint = theIndfirst; ipoint <= theIndlast; ipoint++)
{
LineTool::Value(theLine, ipoint, tabP);
gp_Pnt aPnt = tabP(1);
sprintf(name, "p%d", ipoint);
DrawTrSurf::Set(name, aPnt);
}
#endif
for (Standard_Integer FirstInd = theIndfirst;
FirstInd <= theIndlast - 2; FirstInd++)
{
@@ -243,6 +254,7 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
{
//search <indbad>
Standard_Real MaxSqDist = 0.;
Standard_Real MinSqDist = RealLast();
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
{
LineTool::Value(theLine, k-1, tabP);
@@ -255,24 +267,31 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
MaxSqDist = aSqDist;
indbads[1] = k;
}
if (aSqDist > gp::Resolution() &&
aSqDist < MinSqDist)
MinSqDist = aSqDist;
}
for (Standard_Integer indcur = 2; indcur <= NbCur; indcur++)
{
MaxSqDist = 0.;
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
Standard_Real Relation = MaxSqDist / MinSqDist;
if (Relation < coeff)
LoopFound = Standard_False;
else
for (Standard_Integer indcur = 2; indcur <= NbCur; indcur++)
{
LineTool::Value(theLine, k-1, tabP2d);
gp_Pnt2d PrevPnt = tabP2d(indcur-1);
LineTool::Value(theLine, k, tabP2d);
gp_Pnt2d CurPnt = tabP2d(indcur-1);
Standard_Real aSqDist = PrevPnt.SquareDistance(CurPnt);
if (aSqDist > MaxSqDist)
MaxSqDist = 0.;
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
{
MaxSqDist = aSqDist;
indbads[indcur] = k;
LineTool::Value(theLine, k-1, tabP2d);
gp_Pnt2d PrevPnt = tabP2d(indcur-1);
LineTool::Value(theLine, k, tabP2d);
gp_Pnt2d CurPnt = tabP2d(indcur-1);
Standard_Real aSqDist = PrevPnt.SquareDistance(CurPnt);
if (aSqDist > MaxSqDist)
{
MaxSqDist = aSqDist;
indbads[indcur] = k;
}
}
}
}
}
} //if (myNbP3d == 1)
else //2d case
@@ -307,6 +326,15 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
//Check: may be it is a real loop
if (LoopFound)
{
#ifdef DRAW
for (Standard_Integer ipoint = theIndfirst; ipoint <= theIndlast; ipoint++)
{
LineTool::Value(theLine, ipoint, tabP2d);
gp_Pnt2d aPnt2d = tabP2d(1);
sprintf(name, "p%d", ipoint);
DrawTrSurf::Set(name, aPnt2d);
}
#endif
for (Standard_Integer FirstInd = theIndfirst;
FirstInd <= theIndlast - 2; FirstInd++)
{
@@ -345,6 +373,7 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
for (Standard_Integer indcur = 1; indcur <= NbCur; indcur++)
{
Standard_Real MaxSqDist = 0.;
Standard_Real MinSqDist = RealLast();
for (Standard_Integer k = theIndfirst+1; k <= theIndlast; k++)
{
LineTool::Value(theLine, k-1, tabP2d);
@@ -357,21 +386,27 @@ static Standard_Boolean CheckMultiCurve(const AppParCurves_MultiCurve& theMultiC
MaxSqDist = aSqDist;
indbads[indcur] = k;
}
if (aSqDist > gp::Resolution() &&
aSqDist < MinSqDist)
MinSqDist = aSqDist;
}
Standard_Real Relation = MaxSqDist / MinSqDist;
if (Relation < coeff)
LoopFound = Standard_False;
}
}
}
//Define <indbad>
if (indbads[1] != 0 && indbads[2] != 0)
{
if (indbads[1] != indbads[2])
LoopFound = Standard_False;
else if (indbads[3] != 0 && indbads[1] != indbads[3])
LoopFound = Standard_False;
}
if (LoopFound)
theIndbad = indbads[1];
for (Standard_Integer i = 1; i <= 3; i++)
if (indbads[i] != 0)
{
theIndbad = indbads[i];
break;
}
if (!LoopFound)
theIndbad = 0;
return (!LoopFound);
}
@@ -650,7 +685,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Standard_Boolean cutting,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(),
@@ -684,7 +718,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Standard_Boolean cutting,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(),
@@ -716,7 +749,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Approx_ParametrizationType parametrization,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
@@ -745,7 +777,6 @@ Approx_ComputeLine::Approx_ComputeLine
const Approx_ParametrizationType parametrization,
const Standard_Boolean Squares)
: myMultiLineNb (0),
myNbPlusOnePoint (0),
myIsClear (Standard_False)
{
myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
@@ -778,7 +809,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
Tolers3d.Clear();
Tolers2d.Clear();
myMultiLineNb = 0;
//myNbPlusOnePoint = 0;
}
else myIsClear = Standard_False;
@@ -825,7 +855,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform(anOtherLine0);
alldone = Standard_True;
}
@@ -927,7 +956,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Par = SavePar;
Perform(anOtherLine2);
Ok = Standard_True;
@@ -955,7 +983,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform (anOtherLine2);
Ok = Standard_True;
}
@@ -997,7 +1024,6 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform(anOtherLine3);
myfirstpt = mylastpt;
mylastpt = Thelastpt;
@@ -1108,22 +1134,8 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
}
TheMultiCurve = AppParCurves_MultiCurve();
MultiLine anOtherLine4;
Standard_Boolean isOtherLine4Made = Standard_False;
Standard_Integer indbad = 0;
Ok = Compute(Line, myfirstpt, mylastpt, Param, thetol3d, thetol2d, indbad);
if (indbad != 0)
{
isOtherLine4Made = LineTool::MakeMLOneMorePoint (Line, myfirstpt, mylastpt, indbad, anOtherLine4);
}
if (isOtherLine4Made)
{
myIsClear = Standard_True;
//++myMultiLineNb;
myNbPlusOnePoint++;
Perform (anOtherLine4);
Ok = Standard_True;
}
if (myfirstpt == Thelastpt)
{
Finish = Standard_True;
@@ -1310,8 +1322,7 @@ Standard_Boolean Approx_ComputeLine::Compute(const MultiLine& Line,
#ifdef OCCT_DEBUG
if (mydebug) DUMP(mySCU);
#endif
if (myNbPlusOnePoint != 0 &&
!CheckMultiCurve(mySCU, Line,
if (!CheckMultiCurve(mySCU, Line,
fpt, lpt,
indbad))
{

View File

@@ -94,27 +94,3 @@ Warning: Some of the faces passed to the Solid Builder algorithm have not been c
.BOPAlgo_AlertUnableToOrientTheShape
Warning: Unable to orient the shape correctly
.BOPAlgo_AlertNoPeriodicityRequired
Error: No periodicity has been requested for the shape
.BOPAlgo_AlertUnableToTrim
Error: Unable to trim the shape for making it periodic (BOP Common fails)
.BOPAlgo_AlertUnableToMakeIdentical
Error: Unable to make the shape to look identical on opposite sides (Splitter fails)
.BOPAlgo_AlertUnableToRepeat
Error: Unable to repeat the shape (Gluer fails)
.BOPAlgo_AlertMultiDimensionalArguments
Error: Multi-dimensional arguments
.BOPAlgo_AlertUnableToMakePeriodic
Warning: Unable to make the shape periodic
.BOPAlgo_AlertUnableToGlue
Error: Unable to glue the shapes
.BOPAlgo_AlertShapeIsNotPeriodic
Warning: The shape is not periodic

View File

@@ -30,7 +30,7 @@ DEFINE_SIMPLE_ALERT(BOPAlgo_AlertBuilderFailed)
//! The intersection of the arguments has failed
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertIntersectionFailed)
//! More than one argument is provided
//! The type of Boolean Operation is not set
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertMultipleArguments)
//! The Pave Filler (the intersection tool) has not been created
@@ -107,28 +107,4 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertSolidBuilderUnusedFaces)
//! Unable to orient the shape correctly
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToOrientTheShape)
//! No periodicity has been requested for the shape
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertNoPeriodicityRequired)
//! Unable to trim the shape for making it periodic (BOP Common fails)
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToTrim)
//! Unable to make the shape to look identical on opposite sides (Splitter fails)
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToMakeIdentical)
//! Unable to repeat the shape (Gluer fails)
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToRepeat)
//! Multi-dimensional arguments
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertMultiDimensionalArguments)
//! Unable to make the shape periodic
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToMakePeriodic)
//! Unable to glue the shapes
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToGlue)
//! The shape is not periodic
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShapeIsNotPeriodic)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

@@ -39,7 +39,6 @@
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>

View File

@@ -96,28 +96,4 @@ static const char BOPAlgo_BOPAlgo_msg[] =
"Warning: Some of the faces passed to the Solid Builder algorithm have not been classified and not used for solids creation\n"
"\n"
".BOPAlgo_AlertUnableToOrientTheShape\n"
"Warning: Unable to orient the shape correctly\n"
"\n"
".BOPAlgo_AlertNoPeriodicityRequired\n"
"Error: No periodicity has been requested for the shape\n"
"\n"
".BOPAlgo_AlertUnableToTrim\n"
"Error: Unable to trim the shape for making it periodic (BOP Common fails)\n"
"\n"
".BOPAlgo_AlertUnableToMakeIdentical\n"
"Error: Unable to make the shape to look identical on opposite sides (Splitter fails)\n"
"\n"
".BOPAlgo_AlertUnableToRepeat\n"
"Error: Unable to repeat the shape (Gluer fails)\n"
"\n"
".BOPAlgo_AlertMultiDimensionalArguments\n"
"Error: Multi-dimensional arguments\n"
"\n"
".BOPAlgo_AlertUnableToMakePeriodic\n"
"Warning: Unable to make the shape periodic\n"
"\n"
".BOPAlgo_AlertUnableToGlue\n"
"Error: Unable to glue the shapes\n"
"\n"
".BOPAlgo_AlertShapeIsNotPeriodic\n"
"Warning: The shape is not periodic\n";
"Warning: Unable to orient the shape correctly\n";

View File

@@ -24,8 +24,7 @@
#include <BOPAlgo_Alerts.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <BOPTools_BoxTree.hxx>
#include <Bnd_Tools.hxx>
#include <BOPTools_BoxSelector.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
@@ -39,7 +38,8 @@
#include <IntTools_Context.hxx>
#include <IntTools_FClass2d.hxx>
#include <NCollection_DataMap.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
@@ -443,33 +443,32 @@ void BOPAlgo_BuilderFace::PerformAreas()
{
// No holes, stop the analysis
myAreas.Append(aNewFaces);
return;
}
// Classify holes relatively faces
// Prepare tree filler with the boxes of the hole faces
Handle(BOPTools_Box2dTree) aBoxTree = new BOPTools_Box2dTree();
NCollection_UBTree<Standard_Integer, Bnd_Box2d> aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
Standard_Integer i, aNbH = aHoleFaces.Extent();
aBoxTree->SetSize (aNbH);
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Face& aHFace = TopoDS::Face(aHoleFaces(i));
//
Bnd_Box2d aBox;
BRepTools::AddUVBounds(aHFace, aBox);
aBoxTree->Add(i, Bnd_Tools::Bnd2BVH (aBox));
aTreeFiller.Add(i, aBox);
}
// Build BVH
aBoxTree->Build();
// Shake TreeFiller
aTreeFiller.Fill();
// Find outer growth face that is most close to each hole face
TopTools_IndexedDataMapOfShapeShape aHoleFaceMap;
// Selector
BOPTools_Box2dTreeSelector aSelector;
aSelector.SetBVHSet (aBoxTree.get());
BOPTools_BoxSelector<Bnd_Box2d> aSelector;
TopTools_ListIteratorOfListOfShape aItLS(aNewFaces);
for (; aItLS.More(); aItLS.Next())
@@ -481,8 +480,8 @@ void BOPAlgo_BuilderFace::PerformAreas()
BRepTools::AddUVBounds(aFace, aBox);
aSelector.Clear();
aSelector.SetBox(Bnd_Tools::Bnd2BVH (aBox));
aSelector.Select();
aSelector.SetBox(aBox);
aBBTree.Select(aSelector);
const TColStd_ListOfInteger& aLI = aSelector.Indices();
TColStd_ListIteratorOfListOfInteger aItLI(aLI);

View File

@@ -21,10 +21,9 @@
#include <BOPAlgo_Tools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BOPTools_BoxTree.hxx>
#include <BOPTools_BoxBndTree.hxx>
#include <BOPTools_CoupleOfShape.hxx>
#include <BOPTools_Parallel.hxx>
#include <Bnd_Tools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
@@ -40,6 +39,7 @@
#include <IntTools_Context.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_List.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <NCollection_Vector.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <TopAbs.hxx>
@@ -444,22 +444,23 @@ void BOPAlgo_BuilderSolid::PerformAreas()
// Classify holes relatively solids
// Prepare tree filler with the boxes of the hole shells
Handle(BOPTools_BoxTree) aBBTree = new BOPTools_BoxTree();
BOPTools_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
Standard_Integer i, aNbH = aHoleShells.Extent();
aBBTree->SetSize (aNbH);
for (i = 1; i <= aNbH; ++i)
{
const TopoDS_Shape& aHShell = aHoleShells(i);
//
Bnd_Box aBox;
BRepBndLib::Add(aHShell, aBox);
aBBTree->Add(i, Bnd_Tools::Bnd2BVH(aBox));
aTreeFiller.Add(i, aBox);
myBoxes.Bind(aHShell, aBox);
}
// Shake TreeFiller
aBBTree->Build();
aTreeFiller.Fill();
// Find outer growth shell that is most close to each hole shell
TopTools_IndexedDataMapOfShapeShape aHoleSolidMap;
@@ -475,10 +476,9 @@ void BOPAlgo_BuilderSolid::PerformAreas()
myBoxes.Bind(aSolid, aBox);
BOPTools_BoxTreeSelector aSelector;
aSelector.SetBox(Bnd_Tools::Bnd2BVH(aBox));
aSelector.SetBVHSet (aBBTree.get());
aSelector.Select();
BOPTools_BoxBndTreeSelector aSelector;
aSelector.SetBox(aBox);
aBBTree.Select(aSelector);
const TColStd_ListOfInteger& aLI = aSelector.Indices();
TColStd_ListIteratorOfListOfInteger aItLI(aLI);

View File

@@ -112,35 +112,32 @@ void BOPAlgo_Builder::FillImagesVertices()
//function : BuildResult
//purpose :
//=======================================================================
void BOPAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType)
void BOPAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType)
{
// Fence map
TopTools_MapOfShape aMFence;
// Iterate on all arguments of given type
// and add their images into result
TopTools_ListIteratorOfListOfShape aItA(myArguments);
for (; aItA.More(); aItA.Next())
{
const TopoDS_Shape& aS = aItA.Value();
if (aS.ShapeType() != theType)
continue;
// Get images
const TopTools_ListOfShape* pLSIm = myImages.Seek(aS);
if (!pLSIm)
{
// No images -> add the argument shape itself into result
if (aMFence.Add(aS))
BRep_Builder().Add(myShape, aS);
}
else
{
// Add images of the argument shape into result
TopTools_ListIteratorOfListOfShape aItIm(*pLSIm);
for (; aItIm.More(); aItIm.Next())
{
const TopoDS_Shape& aSIm = aItIm.Value();
if (aMFence.Add(aSIm))
BRep_Builder().Add(myShape, aSIm);
TopAbs_ShapeEnum aType;
BRep_Builder aBB;
TopTools_MapOfShape aM;
TopTools_ListIteratorOfListOfShape aIt, aItIm;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
aType=aS.ShapeType();
if (aType==theType) {
if (myImages.IsBound(aS)){
const TopTools_ListOfShape& aLSIm=myImages.Find(aS);
aItIm.Initialize(aLSIm);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aSIm=aItIm.Value();
if (aM.Add(aSIm)) {
aBB.Add(myShape, aSIm);
}
}
}
else {
if (aM.Add(aS)) {
aBB.Add(myShape, aS);
}
}
}
}

View File

@@ -292,52 +292,31 @@ void BOPAlgo_Builder::BuildSplitFaces()
if (!aNbPBIn && !aNbPBSc)
{
// If there are any alone vertices to be put in the face,
// the new face has to be created even if the wires of the
// face have not been modified.
// It is also necessary to check if the face contains any internal edges,
// as such edges may split the face on parts and it is better
// to send the face be treated by the BuilderFace algorithm.
// In case of alone vertices the check for internals will be performed
// in the BuildDraftFace method.
Standard_Boolean hasInternals = Standard_False;
if (!aNbAV)
{
// Check if any wires of the face have been modified.
// If no modified and internal wires present in the face
// there is no need to create the new face.
Standard_Boolean hasModified = Standard_False;
// If not, there is no need to create the new face.
TopoDS_Iterator aItW(aF);
for (; aItW.More(); aItW.Next())
{
TopoDS_Iterator itE(aItW.Value());
hasInternals = (itE.More() && (itE.Value().Orientation() == TopAbs_INTERNAL));
if (hasInternals)
if (myImages.IsBound(aItW.Value()))
break;
hasModified |= myImages.IsBound(aItW.Value());
}
if (!hasInternals && !hasModified)
if (!aItW.More())
continue;
}
if (!hasInternals)
// No internal parts for the face, so just build the draft face
// and keep it to pass directly into result.
// If the original face has any internal edges or multi-connected vertices,
// the draft face will be null, as such sub-shapes may split the face on parts
// (as in the case "bugs modalg_5 bug25245_1").
// The BuilderFace algorithm will be called in this case.
TopoDS_Face aFD = BuildDraftFace(aF, myImages, myContext, myReport);
if (!aFD.IsNull())
{
// No internal parts for the face, so just build the draft face
// and keep it to pass directly into result.
// If the original face has any internal edges or multi-connected vertices,
// the draft face will be null, as such sub-shapes may split the face on parts
// (as in the case "bugs modalg_5 bug25245_1").
// The BuilderFace algorithm will be called in this case.
TopoDS_Face aFD = BuildDraftFace(aF, myImages, myContext, myReport);
if (!aFD.IsNull())
{
aFacesIm(aFacesIm.Add(i, TopTools_ListOfShape())).Append(aFD);
continue;
}
aFacesIm(aFacesIm.Add(i, TopTools_ListOfShape())).Append(aFD);
continue;
}
}

View File

@@ -29,7 +29,6 @@
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Compound.hxx>
//

View File

@@ -1,333 +0,0 @@
// Created on: 2018-03-29
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2018 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 <BOPAlgo_MakeConnected.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Iterator.hxx>
//=======================================================================
//function : Perform
//purpose : Makes the shapes connected
//=======================================================================
void BOPAlgo_MakeConnected::Perform()
{
// Check the input data
CheckData();
if (HasErrors())
return;
if (myHistory.IsNull())
myHistory = new BRepTools_History;
// Glue the arguments
MakeConnected();
if (HasErrors())
return;
// Perform material associations for the faces
AssociateMaterials();
if (HasErrors())
return;
}
//=======================================================================
//function : CheckData
//purpose : Check the validity of input data
//=======================================================================
void BOPAlgo_MakeConnected::CheckData()
{
// Check the number of arguments
if (myArguments.IsEmpty())
{
// Not enough arguments
AddError(new BOPAlgo_AlertTooFewArguments());
return;
}
// Check that all shapes in arguments are of the same type
// Extract the shapes from the compound arguments
TopTools_ListOfShape aLA;
// Fence map
TopTools_MapOfShape aMFence;
TopTools_ListIteratorOfListOfShape itLA(myArguments);
for (; itLA.More(); itLA.Next())
BOPAlgo_Tools::TreatCompound(itLA.Value(), aMFence, aLA);
if (aLA.IsEmpty())
{
// It seems that all argument shapes are empty compounds
AddError(new BOPAlgo_AlertTooFewArguments());
return;
}
// Check dimensions of the extracted non-compound shapes
itLA.Initialize(aLA);
Standard_Integer iDim = BOPTools_AlgoTools::Dimension(itLA.Value());
for (itLA.Next(); itLA.More(); itLA.Next())
{
if (iDim != BOPTools_AlgoTools::Dimension(itLA.Value()))
{
// The arguments are of different type
AddError(new BOPAlgo_AlertMultiDimensionalArguments());
return;
}
}
}
//=======================================================================
//function : MakeConnected
//purpose : Glues the argument shapes
//=======================================================================
void BOPAlgo_MakeConnected::MakeConnected()
{
// Initialize the history
if (myGlueHistory.IsNull())
myGlueHistory = new BRepTools_History;
if (myArguments.Extent() == 1)
{
// No need to glue the single shape
myShape = myArguments.First();
}
else
{
// Glue the shapes
BOPAlgo_Builder aGluer;
aGluer.SetArguments(myArguments);
aGluer.SetGlue(BOPAlgo_GlueShift);
aGluer.SetRunParallel(myRunParallel);
aGluer.SetNonDestructive(Standard_True);
aGluer.Perform();
if (aGluer.HasErrors())
{
// Unable to glue the shapes
TopoDS_Compound aCW;
BRep_Builder().MakeCompound(aCW);
for (TopTools_ListIteratorOfListOfShape it(myArguments); it.More(); it.Next())
BRep_Builder().Add(aCW, it.Value());
AddError(new BOPAlgo_AlertUnableToGlue(aCW));
return;
}
myShape = aGluer.Shape();
// Save the gluing history
myGlueHistory->Merge(aGluer.Arguments(), aGluer);
myHistory->Merge(myGlueHistory);
}
// Keep the glued shape
myGlued = myShape;
// Fill the map of origins
FillOrigins();
}
//=======================================================================
//function : FillOrigins
//purpose : Fills the map of origins
//=======================================================================
void BOPAlgo_MakeConnected::FillOrigins()
{
myOrigins.Clear();
// Map the history shapes of the arguments
if (myAllInputsMap.IsEmpty())
{
TopTools_ListIteratorOfListOfShape itLA(myArguments);
for (; itLA.More(); itLA.Next())
TopExp::MapShapes(itLA.Value(), myAllInputsMap);
}
const Standard_Integer aNbS = myAllInputsMap.Extent();
for (Standard_Integer i = 1; i <= aNbS; ++i)
{
const TopoDS_Shape& aS = myAllInputsMap(i);
if (!BRepTools_History::IsSupportedType(aS))
continue;
// Get Modified & Generated shapes
for (Standard_Integer j = 0; j < 2; ++j)
{
const TopTools_ListOfShape& aLH = !j ? myHistory->Modified(aS) : myHistory->Generated(aS);
TopTools_ListIteratorOfListOfShape itLH(aLH);
for (; itLH.More(); itLH.Next())
{
const TopoDS_Shape& aHS = itLH.Value();
TopTools_ListOfShape* pLOr = myOrigins.ChangeSeek(aHS);
if (!pLOr)
pLOr = myOrigins.Bound(aHS, TopTools_ListOfShape());
if (!pLOr->Contains(aS))
pLOr->Append(aS);
}
}
}
}
//=======================================================================
//function : AssociateMaterials
//purpose : Associates the materials for the border elements
//=======================================================================
void BOPAlgo_MakeConnected::AssociateMaterials()
{
myMaterials.Clear();
// Extract all non-compound shapes from the result
TopTools_ListOfShape aLShapes;
TopTools_MapOfShape aMFence;
BOPAlgo_Tools::TreatCompound(myShape, aMFence, aLShapes);
if (aLShapes.IsEmpty())
return;
// Define the element type and the material type
TopAbs_ShapeEnum anElemType;
const TopAbs_ShapeEnum aMaterialType = aLShapes.First().ShapeType();
if (aMaterialType == TopAbs_SOLID || aMaterialType == TopAbs_COMPSOLID)
anElemType = TopAbs_FACE;
else if (aMaterialType == TopAbs_FACE || aMaterialType == TopAbs_SHELL)
anElemType = TopAbs_EDGE;
else if (aMaterialType == TopAbs_EDGE || aMaterialType == TopAbs_WIRE)
anElemType = TopAbs_VERTEX;
else
return;
TopTools_ListIteratorOfListOfShape itLS(aLShapes);
for (; itLS.More(); itLS.Next())
{
const TopoDS_Shape& aS = itLS.Value();
const TopTools_ListOfShape& aLOr = GetOrigins(aS);
const TopoDS_Shape& aSOr = aLOr.IsEmpty() ? aS : aLOr.First();
TopExp_Explorer anExp(aS, anElemType);
for (; anExp.More(); anExp.Next())
{
const TopoDS_Shape& anElement = anExp.Current();
TopTools_ListOfShape* pLM = myMaterials.ChangeSeek(anElement);
if (!pLM)
pLM = myMaterials.Bound(anElement, TopTools_ListOfShape());
pLM->Append(aSOr);
}
}
}
//=======================================================================
//function : Update
//purpose : Updates the history, material associations and origins map
// after periodicity operations
//=======================================================================
void BOPAlgo_MakeConnected::Update()
{
// Update history
myHistory->Clear();
if (!myGlueHistory.IsNull())
myHistory->Merge(myGlueHistory);
if (!myPeriodicityMaker.History().IsNull())
myHistory->Merge(myPeriodicityMaker.History());
// Fill the map of origins
FillOrigins();
// Update the material associations after making the shape periodic
AssociateMaterials();
}
//=======================================================================
//function : MakePeriodic
//purpose : Makes the shape periodic according to the given parameters
//=======================================================================
void BOPAlgo_MakeConnected::MakePeriodic(const BOPAlgo_MakePeriodic::PeriodicityParams& theParams)
{
if (HasErrors())
return;
// Make the shape periodic
myPeriodicityMaker.Clear();
myPeriodicityMaker.SetShape(myGlued);
myPeriodicityMaker.SetPeriodicityParameters(theParams);
myPeriodicityMaker.SetRunParallel(myRunParallel);
myPeriodicityMaker.Perform();
if (myPeriodicityMaker.HasErrors())
{
// Add warning informing the user that periodicity with
// given parameters is not possible
AddWarning(new BOPAlgo_AlertUnableToMakePeriodic(myShape));
return;
}
myShape = myPeriodicityMaker.Shape();
// Update history, materials, origins
Update();
}
//=======================================================================
//function : RepeatShape
//purpose : Repeats the shape in the given direction given number of times
//=======================================================================
void BOPAlgo_MakeConnected::RepeatShape(const Standard_Integer theDirectionID,
const Standard_Integer theTimes)
{
if (HasErrors())
return;
if (myPeriodicityMaker.Shape().IsNull() || myPeriodicityMaker.HasErrors())
{
// The shape has not been made periodic yet
AddWarning(new BOPAlgo_AlertShapeIsNotPeriodic(myShape));
return;
}
// Repeat the shape
myShape = myPeriodicityMaker.RepeatShape(theDirectionID, theTimes);
// Update history, materials, origins
Update();
}
//=======================================================================
//function : ClearRepetitions
//purpose : Clears the repetitions performed on the periodic shape
// keeping the shape periodic
//=======================================================================
void BOPAlgo_MakeConnected::ClearRepetitions()
{
if (HasErrors())
return;
if (myPeriodicityMaker.Shape().IsNull() || myPeriodicityMaker.HasErrors())
{
// The shape has not been made periodic yet
AddWarning(new BOPAlgo_AlertShapeIsNotPeriodic(myShape));
return;
}
// Clear repetitions
myPeriodicityMaker.ClearRepetitions();
myShape = myPeriodicityMaker.Shape();
// Update history, materials, origins
Update();
}

View File

@@ -1,338 +0,0 @@
// Created on: 2018-03-29
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2018 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.
#ifndef _BOPAlgo_MakeConnected_HeaderFile
#define _BOPAlgo_MakeConnected_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Options.hxx>
#include <BOPAlgo_MakePeriodic.hxx>
#include <BRepTools_History.hxx>
#include <NCollection_DataMap.hxx>
#include <TopTools_OrientedShapeMapHasher.hxx>
//! BOPAlgo_MakeConnected is the algorithm for making the touching
//! shapes connected or glued, i.e. for making the coinciding geometries
//! be topologically shared among the shapes.
//!
//! The input shapes should be of the same dimension, otherwise
//! the gluing will not make any sense.
//!
//! After the shapes are made connected, the border elements of input shapes
//! are associated with the shapes to which they belong. At that, the orientation of
//! the border element in the shape is taken into account.
//! The associations are made for the following types:
//! - For input SOLIDS, the resulting FACES are associated with the input solids;
//! - For input FACES, the resulting EDGES are associated with the input faces;
//! - For input EDGES, the resulting VERTICES are associated with the input edges.
//!
//! In frames of this algorithm the input shapes are called materials,
//! and the association process is called the material association.
//! The material association allows finding the coinciding elements for the opposite
//! input shapes. These elements will be associated to at least two materials.
//!
//! After making the shapes connected, it is possible to make the connected
//! shape periodic using the *BOPAlgo_MakePeriodic* tool.
//! After making the shape periodic, the material associations will be updated
//! to correspond to the actual state of the result shape.
//! Repetition of the periodic shape is also possible here. Material associations
//! are not going to be lost.
//!
//! The algorithm supports history of shapes modification, thus it is possible
//! to track the modification of the input shapes during the operations.
//! Additionally to standard history methods, the algorithm provides the
//! the method *GetOrigins()* which allows obtaining the input shapes from which
//! the resulting shape has been created.
//!
//! The algorithm supports the parallel processing mode, which allows faster
//! completion of the operations.
//!
//! The algorithm returns the following Error/Warning messages:
//! - *BOPAlgo_AlertTooFewArguments* - error alert is given on the attempt to run
//! the algorithm without the arguments;
//! - *BOPAlgo_AlertMultiDimensionalArguments* - error alert is given on the attempt
//! to run the algorithm on multi-dimensional arguments;
//! - *BOPAlgo_AlertUnableToGlue* - error alert is given if the gluer algorithm
//! is unable to glue the given arguments;
//! - *BOPAlgo_AlertUnableToMakePeriodic* - warning alert is given if the periodicity
//! maker is unable to make the connected shape periodic with given options;
//! - *BOPAlgo_AlertShapeIsNotPeriodic* - warning alert is given on the attempt to
//! repeat the shape before making it periodic.
//!
//! Here is the example of usage of the algorithm:
//! ~~~~
//! TopTools_ListOfShape anArguments = ...; // Shapes to make connected
//! Standard_Boolean bRunParallel = ...; // Parallel processing mode
//!
//! BOPAlgo_MakeConnected aMC; // Tool for making the shapes connected
//! aMC.SetArguments(anArguments); // Set the shapes
//! aMC.SetRunParallel(bRunParallel); // Set parallel processing mode
//! aMC.Perform(); // Perform the operation
//!
//! if (aMC.HasErrors()) // Check for the errors
//! {
//! // errors treatment
//! Standard_SStream aSStream;
//! aMC.DumpErrors(aSStream);
//! return;
//! }
//! if (aMC.HasWarnings()) // Check for the warnings
//! {
//! // warnings treatment
//! Standard_SStream aSStream;
//! aMC.DumpWarnings(aSStream);
//! }
//!
//! const TopoDS_Shape& aGluedShape = aMC.Shape(); // Connected shape
//!
//! // Checking material associations
//! TopAbs_ShapeEnum anElemType = ...; // Type of border element
//! TopExp_Explorer anExp(anArguments.First(), anElemType);
//! for (; anExp.More(); anExp.Next())
//! {
//! const TopoDS_Shape& anElement = anExp.Current();
//! const TopTools_ListOfShape& aNegativeM = aMC.MaterialsOnNegativeSide(anElement);
//! const TopTools_ListOfShape& aPositiveM = aMC.MaterialsOnPositiveSide(anElement);
//! }
//!
//! // Making the connected shape periodic
//! BOPAlgo_MakePeriodic::PeriodicityParams aParams = ...; // Options for periodicity of the connected shape
//! aMC.MakePeriodic(aParams);
//!
//! // Shape repetition after making it periodic
//! // Check if the shape has been made periodic successfully
//! if (aMC.PeriodicityTool().HasErrors())
//! {
//! // Periodicity maker error treatment
//! }
//!
//! // Shape repetition in periodic directions
//! aMC.RepeatShape(0, 2);
//!
//! const TopoDS_Shape& aShape = aMC.PeriodicShape(); // Periodic and repeated shape
//! ~~~~
//!
class BOPAlgo_MakeConnected : public BOPAlgo_Options
{
public:
DEFINE_STANDARD_ALLOC
public: //! @name Constructor
//! Empty constructor
BOPAlgo_MakeConnected() : BOPAlgo_Options()
{
}
public: //! @name Setters for the shapes to make connected
//! Sets the shape for making them connected.
//! @param theArgs [in] The arguments for the operation.
void SetArguments(const TopTools_ListOfShape& theArgs)
{
myArguments = theArgs;
}
//! Adds the shape to the arguments.
//! @param theS [in] One of the argument shapes.
void AddArgument(const TopoDS_Shape& theS)
{
myArguments.Append(theS);
}
//! Returns the list of arguments of the operation.
const TopTools_ListOfShape& Arguments() const
{
return myArguments;
}
public: //! @name Performing the operations
//! Performs the operation, i.e. makes the input shapes connected.
Standard_EXPORT void Perform();
public: //! @name Shape periodicity & repetition
//! Makes the connected shape periodic.
//! Repeated calls of this method overwrite the previous calls
//! working with the basis connected shape.
//! @param theParams [in] Periodic options.
Standard_EXPORT void MakePeriodic(const BOPAlgo_MakePeriodic::PeriodicityParams& theParams);
//! Performs repetition of the periodic shape in specified direction
//! required number of times.
//! @param theDirectionID [in] The direction's ID (0 for X, 1 for Y, 2 for Z);
//! @param theTimes [in] Requested number of repetitions (sign of the value defines
//! the side of the repetition direction (positive or negative)).
Standard_EXPORT void RepeatShape(const Standard_Integer theDirectionID,
const Standard_Integer theTimes);
//! Clears the repetitions performed on the periodic shape,
//! keeping the shape periodic.
Standard_EXPORT void ClearRepetitions();
//! Returns the periodicity tool.
const BOPAlgo_MakePeriodic& PeriodicityTool() const
{
return myPeriodicityMaker;
}
public: //! @name Material transitions
//! Returns the original shapes which images contain the
//! the given shape with FORWARD orientation.
//! @param theS [in] The shape for which the materials are necessary.
const TopTools_ListOfShape& MaterialsOnPositiveSide(const TopoDS_Shape& theS)
{
const TopTools_ListOfShape* pLM = myMaterials.Seek(theS.Oriented(TopAbs_FORWARD));
return (pLM ? *pLM : EmptyList());
}
//! Returns the original shapes which images contain the
//! the given shape with REVERSED orientation.
//! @param theS [in] The shape for which the materials are necessary.
const TopTools_ListOfShape& MaterialsOnNegativeSide(const TopoDS_Shape& theS)
{
const TopTools_ListOfShape* pLM = myMaterials.Seek(theS.Oriented(TopAbs_REVERSED));
return (pLM ? *pLM : EmptyList());
}
public: //! @name History methods
//! Returns the history of operations
const Handle(BRepTools_History)& History() const
{
return myHistory;
}
//! Returns the list of shapes modified from the given shape.
//! @param theS [in] The shape for which the modified shapes are necessary.
const TopTools_ListOfShape& GetModified(const TopoDS_Shape& theS)
{
return (myHistory.IsNull() ? EmptyList() : myHistory->Modified(theS));
}
//! Returns the list of original shapes from which the current shape has been created.
//! @param theS [in] The shape for which the origins are necessary.
const TopTools_ListOfShape& GetOrigins(const TopoDS_Shape& theS)
{
const TopTools_ListOfShape* pLOr = myOrigins.Seek(theS);
return (pLOr ? *pLOr : EmptyList());
}
public: //! @name Getting the result shapes
//! Returns the resulting connected shape
const TopoDS_Shape& Shape() const
{
return myGlued;
}
//! Returns the resulting periodic & repeated shape
const TopoDS_Shape& PeriodicShape() const
{
return myShape;
}
public: //! @name Clearing the contents of the algorithm from previous runs
//! Clears the contents of the algorithm.
void Clear()
{
BOPAlgo_Options::Clear();
myArguments.Clear();
myAllInputsMap.Clear();
myPeriodicityMaker.Clear();
myOrigins.Clear();
myMaterials.Clear();
if (!myGlueHistory.IsNull())
myGlueHistory->Clear();
if (!myHistory.IsNull())
myHistory->Clear();
myGlued.Nullify();
myShape.Nullify();
}
protected: //! @name Protected methods performing the operation
//! Checks the validity of input data.
Standard_EXPORT void CheckData();
//! Makes the argument shapes connected (or glued).
Standard_EXPORT void MakeConnected();
//! Associates the materials transitions for the border elements:
//! - For input Solids, associates the Faces to Solids;
//! - For input Faces, associates the Edges to Faces;
//! - For input Edges, associates the Vertices to Edges.
Standard_EXPORT void AssociateMaterials();
//! Fills the map of origins
Standard_EXPORT void FillOrigins();
//! Updates the history, material associations, origins map
//! after periodicity operations.
Standard_EXPORT void Update();
private:
//! Returns an empty list.
const TopTools_ListOfShape& EmptyList()
{
static const TopTools_ListOfShape anEmptyList;
return anEmptyList;
}
protected: //! @name Fields
// Inputs
TopTools_ListOfShape myArguments; //!< Input shapes for making them connected
TopTools_IndexedMapOfShape myAllInputsMap; //!< Map of all BRep sub-elements of the input shapes
// Tools
BOPAlgo_MakePeriodic myPeriodicityMaker; //!< Tool for making the shape periodic
// Results
NCollection_DataMap
<TopoDS_Shape,
TopTools_ListOfShape,
TopTools_OrientedShapeMapHasher> myMaterials; //!< Map of the materials associations
//! for the border elements
TopTools_DataMapOfShapeListOfShape myOrigins; //!< Map of origins
//! (allows tracking the shape's ancestors)
Handle(BRepTools_History) myGlueHistory; //!< Gluing History
Handle(BRepTools_History) myHistory; //!< Final History of shapes modifications
//! (including making the shape periodic and repetitions)
TopoDS_Shape myGlued; //!< The resulting connected (glued) shape
TopoDS_Shape myShape; //!< The resulting shape
};
#endif // _BOPAlgo_MakeConnected_HeaderFile

View File

@@ -1,617 +0,0 @@
// Created on: 2018-03-16
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2018 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 <BOPAlgo_MakePeriodic.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <Bnd_Box.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Splitter.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <gp_Pln.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
// Periodic/Trim/Repeat directions
static const gp_Dir MY_DIRECTIONS[3] = { gp::DX(),
gp::DY(),
gp::DZ() };
//=======================================================================
//function : Perform
//purpose : Performs the operation
//=======================================================================
void BOPAlgo_MakePeriodic::Perform()
{
// Check the validity of input data
CheckData();
if (HasErrors())
return;
// Trim the shape to fit to the required period in
// required periodic directions
Trim();
if (HasErrors())
return;
// Make the shape identical on the opposite sides in
// required periodic directions
MakeIdentical();
if (HasErrors())
return;
}
//=======================================================================
//function : CheckData
//purpose : Checks the validity of input data
//=======================================================================
void BOPAlgo_MakePeriodic::CheckData()
{
if ( (!IsXPeriodic() || XPeriod() < Precision::Confusion())
&& (!IsYPeriodic() || YPeriod() < Precision::Confusion())
&& (!IsZPeriodic() || ZPeriod() < Precision::Confusion()))
{
// Add error informing the user that no periodicity is required
// or no valid period is set.
AddError(new BOPAlgo_AlertNoPeriodicityRequired());
return;
}
}
//=======================================================================
//function : AddToShape
//purpose : Adds the shape <theWhat> to the shape <theWhere>
//=======================================================================
static void AddToShape(const TopoDS_Shape& theWhat,
TopoDS_Shape& theWhere)
{
if (theWhere.IsNull())
BRep_Builder().MakeCompound(TopoDS::Compound(theWhere));
BRep_Builder().Add(theWhere, theWhat);
}
//=======================================================================
//function : AddToShape
//purpose : Adds the shape in the list <theLWhat> to the shape <theWhere>
//=======================================================================
static void AddToShape(const TopTools_ListOfShape& theLWhat,
TopoDS_Shape& theWhere)
{
TopTools_ListIteratorOfListOfShape it(theLWhat);
for (; it.More(); it.Next())
AddToShape(it.Value(), theWhere);
}
//=======================================================================
//function : Trim
//purpose : Make the trim of the shape to fit to the periodic bounds.
//=======================================================================
void BOPAlgo_MakePeriodic::Trim()
{
// Check if trim is required at all
if (IsInputXTrimmed() &&
IsInputYTrimmed() &&
IsInputZTrimmed())
return;
// Compute bounding box for the shape to use it as a starting
// volume for trimming. If required, the volume will be modified
// to the requested trimming size in requested directions.
Bnd_Box aBox;
BRepBndLib::Add(myInputShape, aBox);
// Enlarge box to avoid overlapping with the shape
aBox.Enlarge(0.1 * sqrt(aBox.SquareExtent()));
// Get Corner points of the bounding box
gp_Pnt aPMin = aBox.CornerMin();
gp_Pnt aPMax = aBox.CornerMax();
// Update corner points according to the requested trim parameters
for (Standard_Integer i = 0; i < 3; ++i)
{
if (IsInputTrimmed(i))
continue;
aPMin.SetCoord(i + 1, PeriodFirst(i));
aPMax.SetCoord(i + 1, PeriodFirst(i) + Period(i));
}
// Build Trimming solid using corner points
BRepPrimAPI_MakeBox aMBox(aPMin, aPMax);
const TopoDS_Shape& aTrimBox = aMBox.Solid();
// Perform trimming of the shape by solid
BRepAlgoAPI_Common aCommon;
// Set Object
TopTools_ListOfShape anObj;
anObj.Append(myInputShape);
aCommon.SetArguments(anObj);
// Set Tool
TopTools_ListOfShape aTool;
aTool.Append(aTrimBox);
aCommon.SetTools(aTool);
// Set the parallel processing mode
aCommon.SetRunParallel(myRunParallel);
// Build
aCommon.Build();
if (aCommon.HasErrors())
{
// Unable to trim the shape
// Merge errors from Common operation
myReport->Merge(aCommon.GetReport());
// Add new error saving the shapes for analysis
TopoDS_Compound aWS;
AddToShape(myInputShape, aWS);
AddToShape(aTrimBox, aWS);
AddError(new BOPAlgo_AlertUnableToTrim(aWS));
return;
}
// Get the trimmed shape
myShape = aCommon.Shape();
// Fill the History for the object only
mySplitHistory = new BRepTools_History();
mySplitHistory->Merge(anObj, aCommon);
}
//=======================================================================
//function : MakeIdentical
//purpose : Make the shape look the same on the opposite sides in the
// required periodic directions.
//=======================================================================
void BOPAlgo_MakePeriodic::MakeIdentical()
{
if (myShape.IsNull())
myShape = myInputShape;
if (mySplitHistory.IsNull())
mySplitHistory = new BRepTools_History;
// Split the negative side of the shape with the geometry
// located on the positive side
SplitNegative();
if (HasErrors())
return;
// Split the positive side of the shape with the geometry
// located on the negative side.
// Make sure that the opposite sides have identical geometries.
// Make associations between identical opposite shapes.
SplitPositive();
myHistory = new BRepTools_History();
myHistory->Merge(mySplitHistory);
}
//=======================================================================
//function : SplitNegative
//purpose : Split the negative side of the shape with the geometry
// located on the positive side.
//=======================================================================
void BOPAlgo_MakePeriodic::SplitNegative()
{
// Copy geometry from positive side of the shape to the negative first.
// So, translate the shape in negative periodic directions only.
//
// To avoid conflicts when copying geometries from positive periodic sides
// perform split of each periodic side in a separate operation.
for (Standard_Integer i = 0; i < 3; ++i)
{
if (!IsPeriodic(i))
continue;
// Translate the shape to the negative side
gp_Trsf aNegTrsf;
aNegTrsf.SetTranslationPart(Period(i) * MY_DIRECTIONS[i].Reversed());
BRepBuilderAPI_Transform aNegT(myShape, aNegTrsf, Standard_False);
// Split the negative side of the shape.
TopTools_ListOfShape aTools;
aTools.Append(aNegT.Shape());
SplitShape(aTools, mySplitHistory);
}
}
//=======================================================================
//function : AddTwin
//purpose : Associates the shape <theS> with the shape <theTwin> in the map.
//=======================================================================
static void AddTwin(const TopoDS_Shape& theS,
const TopoDS_Shape& theTwin,
TopTools_DataMapOfShapeListOfShape& theMap)
{
TopTools_ListOfShape *aTwins = theMap.ChangeSeek(theS);
if (!aTwins)
{
theMap.Bound(theS, TopTools_ListOfShape())->Append(theTwin);
return;
}
// Check if the twin shape is not yet present in the list
TopTools_ListIteratorOfListOfShape itLT(*aTwins);
for (; itLT.More(); itLT.Next())
{
if (theTwin.IsSame(itLT.Value()))
break;
}
if (!itLT.More())
aTwins->Append(theTwin);
}
//=======================================================================
//function : SplitPositive
//purpose : Split the positive side of the shape with the geometry of the
// negative side. Associate the identical opposite sub-shapes.
//=======================================================================
void BOPAlgo_MakePeriodic::SplitPositive()
{
// Prepare map of the sub-shapes of the input shape to make
// associations of the opposite shapes
TopTools_IndexedMapOfShape aSubShapesMap;
TopExp::MapShapes(myShape, aSubShapesMap);
const Standard_Integer aNbS = aSubShapesMap.Extent();
// Translate the shape to the positive periodic directions to make the
// shapes look identical on the opposite sides.
TopTools_ListOfShape aTools;
// Remember the history of shapes translation
TopTools_IndexedDataMapOfShapeListOfShape aTranslationHistMap;
// Make translations for all periodic directions
for (Standard_Integer i = 0; i < 3; ++i)
{
if (!IsPeriodic(i))
continue;
// Translate the shape to the positive side
gp_Trsf aPosTrsf;
aPosTrsf.SetTranslationPart(Period(i) * MY_DIRECTIONS[i]);
BRepBuilderAPI_Transform aTranslator(myShape, aPosTrsf, Standard_False);
aTools.Append(aTranslator.Shape());
// Fill the translation history map
for (Standard_Integer j = 1; j <= aNbS; ++j)
{
const TopoDS_Shape& aS = aSubShapesMap(j);
if (BRepTools_History::IsSupportedType(aS))
{
const TopTools_ListOfShape& aSM = aTranslator.Modified(aS);
TopTools_ListOfShape* pTS = aTranslationHistMap.ChangeSeek(aS);
if (!pTS)
pTS = &aTranslationHistMap(aTranslationHistMap.Add(aS, TopTools_ListOfShape()));
pTS->Append(aSM.First());
}
}
}
// Keep the split shape history and history of tools modifications
// during the split for making association of the opposite identical shapes
Handle(BRepTools_History) aSplitShapeHist = new BRepTools_History,
aSplitToolsHist = new BRepTools_History;
// Split the positive side of the shape
SplitShape(aTools, aSplitShapeHist, aSplitToolsHist);
if (HasErrors())
return;
mySplitHistory->Merge(aSplitShapeHist);
// Make associations between identical opposite sub-shapes
const Standard_Integer aNbSH = aTranslationHistMap.Extent();
for (Standard_Integer i = 1; i <= aNbSH; ++i)
{
const TopoDS_Shape* pS = &aTranslationHistMap.FindKey(i);
const TopTools_ListOfShape& aSIm = aSplitShapeHist->Modified(*pS);
if (aSIm.Extent() == 1)
pS = &aSIm.First();
else if (aSIm.Extent() > 1)
continue;
const TopTools_ListOfShape& aLTranslated = aTranslationHistMap(i);
TopTools_ListIteratorOfListOfShape itLT(aLTranslated);
for (; itLT.More(); itLT.Next())
{
const TopoDS_Shape& aT = itLT.Value();
// Get shapes modifications during the split
const TopTools_ListOfShape& aTSplits = aSplitToolsHist->Modified(aT);
// Associate the shapes to each other
TopTools_ListIteratorOfListOfShape itSp(aTSplits);
for (; itSp.More(); itSp.Next())
{
const TopoDS_Shape& aSp = itSp.Value();
AddTwin(*pS, aSp, myTwins);
AddTwin(aSp, *pS, myTwins);
}
}
}
}
//=======================================================================
//function : SplitShape
//purpose : Splits the shape by the given tools
//=======================================================================
void BOPAlgo_MakePeriodic::SplitShape(const TopTools_ListOfShape& theTools,
Handle(BRepTools_History) theSplitShapeHistory,
Handle(BRepTools_History) theSplitToolsHistory)
{
// Make sure that the geometry from the tools will be copied to the split
// shape. For that, the tool shapes should be given to the Boolean Operations
// algorithm before the shape itself. This will make all coinciding parts
// use the geometry of the first argument.
// Intersection tool for passing ordered arguments
BOPAlgo_PaveFiller anIntersector;
anIntersector.SetArguments(theTools);
// Add the shape
anIntersector.AddArgument(myShape);
// Use gluing to speed-up intersections
anIntersector.SetGlue(BOPAlgo_GlueShift);
// Use safe input mode, to avoid reusing geometry of the shape
anIntersector.SetNonDestructive(Standard_True);
// Set parallel processing mode
anIntersector.SetRunParallel(myRunParallel);
// Perform Intersection of the arguments
anIntersector.Perform();
// Check for the errors
if (anIntersector.HasErrors())
{
// Unable to split the shape on opposite sides
// Copy the intersection errors
myReport->Merge(anIntersector.GetReport());
// Add new error saving the shapes for analysis
TopoDS_Compound aWS;
AddToShape(theTools, aWS);
AddToShape(myShape, aWS);
AddError(new BOPAlgo_AlertUnableToMakeIdentical(aWS));
return;
}
// Perform the splitting of the shape with the precomputed intersection results
BRepAlgoAPI_Splitter aSplitter(anIntersector);
// Set Object
TopTools_ListOfShape anObj;
anObj.Append(myShape);
aSplitter.SetArguments(anObj);
// Set Tools
aSplitter.SetTools(theTools);
// Use Gluing
aSplitter.SetGlue(BOPAlgo_GlueShift);
// Set parallel processing mode
aSplitter.SetRunParallel(myRunParallel);
// Perform splitting
aSplitter.Build();
// Check for the errors
if (aSplitter.HasErrors())
{
// Unable to split the shape on opposite sides
// Copy the splitter errors
myReport->Merge(aSplitter.GetReport());
// Add new error saving the shape for analysis
TopoDS_Compound aWS;
AddToShape(theTools, aWS);
AddToShape(myShape, aWS);
AddError(new BOPAlgo_AlertUnableToMakeIdentical(aWS));
return;
}
// Get the split shape
myShape = aSplitter.Shape();
// Remember the split history
if (!theSplitShapeHistory.IsNull())
theSplitShapeHistory->Merge(anObj, aSplitter);
if (!theSplitToolsHistory.IsNull())
theSplitToolsHistory->Merge(theTools, aSplitter);
}
//=======================================================================
//function : RepeatShape
//purpose : Repeats the shape in the required periodic direction
//=======================================================================
const TopoDS_Shape& BOPAlgo_MakePeriodic::RepeatShape(const Standard_Integer theDir,
const Standard_Integer theTimes)
{
if (myRepeatedShape.IsNull())
myRepeatedShape = myShape;
if (!IsPeriodic(theDir))
return myRepeatedShape;
if (theTimes == 0)
return myRepeatedShape;
// Get the shape's period in the required direction
const Standard_Integer id = BOPAlgo_MakePeriodic::ToDirectionID(theDir);
if (myRepeatPeriod[id] < Precision::Confusion())
myRepeatPeriod[id] = Period(id);
const Standard_Real aPeriod = myRepeatPeriod[id];
// Coefficient to define in which direction the repetition will be performed:
// theTimes is positive - in positive direction;
// theTimes is negative - in negative direction.
const Standard_Integer iDir = theTimes > 0 ? 1 : -1;
// Create the translation history - all translated shapes will be
// created as Generated from the shape.
BRepTools_History aTranslationHistory;
TopTools_IndexedMapOfShape aSubShapesMap;
TopExp::MapShapes(myRepeatedShape, aSubShapesMap);
const Standard_Integer aNbS = aSubShapesMap.Extent();
// Add shapes for gluing
TopTools_ListOfShape aShapes;
// Add the shape itself
aShapes.Append(myRepeatedShape);
for (Standard_Integer i = 1; i <= aNbS; ++i)
{
const TopoDS_Shape& aS = aSubShapesMap(i);
if (BRepTools_History::IsSupportedType(aS))
aTranslationHistory.AddGenerated(aS, aS);
}
// Create translated copies of the shape
for (Standard_Integer i = 1; i <= Abs(theTimes); ++i)
{
gp_Trsf aTrsf;
aTrsf.SetTranslationPart(iDir * i * aPeriod * MY_DIRECTIONS[id]);
BRepBuilderAPI_Transform aTranslator(myRepeatedShape, aTrsf, Standard_False);
aShapes.Append(aTranslator.Shape());
// Fill the translation history
for (Standard_Integer j = 1; j <= aNbS; ++j)
{
const TopoDS_Shape& aS = aSubShapesMap(j);
if (BRepTools_History::IsSupportedType(aS))
{
const TopTools_ListOfShape& aLT = aTranslator.Modified(aS);
aTranslationHistory.AddGenerated(aS, aLT.First());
}
}
}
// Update the history with the translation History
myHistory->Merge(aTranslationHistory);
// Glue the translated shapes all together
BOPAlgo_Builder aGluer;
aGluer.SetArguments(aShapes);
// Avoid intersections of the sub-shapes
aGluer.SetGlue(BOPAlgo_GlueFull);
// Set parallel processing mode
aGluer.SetRunParallel(myRunParallel);
// Perform gluing
aGluer.Perform();
if (aGluer.HasErrors())
{
// Repetition in this direction is not possible
// Add warning saving the shapes for analysis
TopoDS_Compound aWS;
AddToShape(aShapes, aWS);
AddWarning(new BOPAlgo_AlertUnableToRepeat(aWS));
return myRepeatedShape;
}
// Get glued shape
myRepeatedShape = aGluer.Shape();
// Update repetition period for the next repetitions
myRepeatPeriod[id] += Abs(theTimes) * myRepeatPeriod[id];
// Update history with the Gluing history
BRepTools_History aGluingHistory(aShapes, aGluer);
myHistory->Merge(aGluingHistory);
// Update the map of twins after repetition
UpdateTwins(aTranslationHistory, aGluingHistory);
return myRepeatedShape;
}
//=======================================================================
//function : UpdateTwins
//purpose : Updates the map of twins after repetition
//=======================================================================
void BOPAlgo_MakePeriodic::UpdateTwins(const BRepTools_History& theTranslationHistory,
const BRepTools_History& theGluingHistory)
{
if (myTwins.IsEmpty())
return;
if (myRepeatedTwins.IsEmpty())
myRepeatedTwins = myTwins;
// New twins
TopTools_DataMapOfShapeListOfShape aNewTwinsMap;
// Fence map to avoid repeated fill for the twins
TopTools_MapOfShape aMTwinsDone;
// Update the map of twins with the new repeated shapes
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itDMap(myRepeatedTwins);
for (; itDMap.More(); itDMap.Next())
{
const TopoDS_Shape& aS = itDMap.Key();
aMTwinsDone.Add(aS);
const TopTools_ListOfShape& aLTwins = itDMap.Value();
// Check if the twins have not been already processed
TopTools_ListIteratorOfListOfShape itLT(aLTwins);
for (; itLT.More(); itLT.Next())
{
if (aMTwinsDone.Contains(itLT.Value()))
break;
}
if (itLT.More())
// Group of twins has already been processed
continue;
// All shapes generated from the shape itself and generated
// from its twins will be the new twins for the shape
TopTools_IndexedMapOfShape aNewGroup;
itLT.Initialize(aLTwins);
for (Standard_Boolean bShape = Standard_True; itLT.More();)
{
const TopoDS_Shape& aTwin = bShape ? aS : itLT.Value();
const TopTools_ListOfShape& aLG = theTranslationHistory.Generated(aTwin);
TopTools_ListIteratorOfListOfShape itLG(aLG);
for (; itLG.More(); itLG.Next())
{
const TopoDS_Shape& aG = itLG.Value();
const TopTools_ListOfShape& aLM = theGluingHistory.Modified(aG);
if (aLM.IsEmpty())
aNewGroup.Add(aG);
else
{
TopTools_ListIteratorOfListOfShape itLM(aLM);
for (; itLM.More(); itLM.Next())
aNewGroup.Add(itLM.Value());
}
}
if (bShape)
bShape = Standard_False;
else
itLT.Next();
}
// Associate the twins to each other
const Standard_Integer aNbTwins = aNewGroup.Extent();
for (Standard_Integer i = 1; i <= aNbTwins; ++i)
{
TopTools_ListOfShape* pTwins = aNewTwinsMap.Bound(aNewGroup(i), TopTools_ListOfShape());
for (Standard_Integer j = 1; j <= aNbTwins; ++j)
if (i != j) pTwins->Append(aNewGroup(j));
}
}
myRepeatedTwins = aNewTwinsMap;
}

View File

@@ -1,603 +0,0 @@
// Created on: 2018-03-16
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2018 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.
#ifndef _BOPAlgo_MakePeriodic_HeaderFile
#define _BOPAlgo_MakePeriodic_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Options.hxx>
#include <BRepTools_History.hxx>
#include <Standard_Boolean.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
//! BOPAlgo_MakePeriodic is the tool for making an arbitrary shape periodic
//! in 3D space in specified directions.
//!
//! Periodicity of the shape means that the shape can be repeated in any
//! periodic direction any number of times without creation of the new
//! geometry or splits.
//!
//! The idea is to make the shape look identical on the opposite sides of the
//! periodic directions, so when translating the copy of a shape on the period
//! there will be no coinciding parts of different dimensions.
//!
//! If necessary the algorithm will trim the shape to fit it into the
//! requested period by splitting it by the planes limiting the shape's
//! requested period.
//!
//! For making the shape periodic in certain direction the algorithm performs
//! the following steps:
//! * Creates the copy of the shape and moves it on the period into negative
//! side of the requested direction;
//! * Splits the negative side of the shape by the moved copy, ensuring copying
//! of the geometry from positive side to negative;
//! * Creates the copy of the shape (with already split negative side) and moves
//! it on the period into the positive side of the requested direction;
//! * Splits the positive side of the shape by the moved copy, ensuring copying
//! of the geometry from negative side to positive.
//!
//! The algorithm also associates the identical (or twin) shapes located
//! on the opposite sides of the result shape.
//! Using the *GetTwins()* method it is possible to get the twin shapes from
//! the opposite sides.
//!
//! Algorithm also provides the methods to repeat the periodic shape in
//! periodic directions. The subsequent repetitions are performed on the
//! repeated shape, thus repeating the shape two times in X direction will
//! create result in three shapes (original plus two copies).
//! Single subsequent repetition will result already in 6 shapes.
//! The repetitions can be cleared and started over.
//!
//! The algorithm supports History of shapes modifications, thus
//! it is possible to track how the shape has been changed to make it periodic
//! and what new shapes have been created during repetitions.
//!
//! The algorithm supports the parallel processing mode, which allows faster
//! completion of the operations.
//!
//! The algorithm supports the Error/Warning system and returns the following alerts:
//! - *BOPAlgo_AlertNoPeriodicityRequired* - Error alert is given if no periodicity
//! has been requested in any direction;
//! - *BOPAlgo_AlertUnableToTrim* - Error alert is given if the trimming of the shape
//! for fitting it into requested period has failed;
//! - *BOPAlgo_AlertUnableToMakeIdentical* - Error alert is given if splitting of the
//! shape by its moved copies has failed;
//! - *BOPAlgo_AlertUnableToRepeat* - Warning alert is given if the gluing of the repeated
//! shapes has failed.
//!
//! Example of usage of the algorithm:
//! ~~~~
//! TopoDS_Shape aShape = ...; // The shape to make periodic
//! Standard_Boolean bMakeXPeriodic = ...; // Flag for making or not the shape periodic in X direction
//! Standard_Real aXPeriod = ...; // X period for the shape
//! Standard_Boolean isXTrimmed = ...; // Flag defining whether it is necessary to trimming
//! // the shape to fit to X period
//! Standard_Real aXFirst = ...; // Start of the X period
//! // (really necessary only if the trimming is requested)
//! Standard_Boolean bRunParallel = ...; // Parallel processing mode or single
//!
//! BOPAlgo_MakePeriodic aPeriodicityMaker; // Periodicity maker
//! aPeriodicityMaker.SetShape(aShape); // Set the shape
//! aPeriodicityMaker.MakeXPeriodic(bMakePeriodic, aXPeriod); // Making the shape periodic in X direction
//! aPeriodicityMaker.SetTrimmed(isXTrimmed, aXFirst); // Trim the shape to fit X period
//! aPeriodicityMaker.SetRunParallel(bRunParallel); // Set the parallel processing mode
//! aPeriodicityMaker.Perform(); // Performing the operation
//!
//! if (aPeriodicityMaker.HasErrors()) // Check for the errors
//! {
//! // errors treatment
//! Standard_SStream aSStream;
//! aPeriodicityMaker.DumpErrors(aSStream);
//! return;
//! }
//! if (aPeriodicityMaker.HasWarnings()) // Check for the warnings
//! {
//! // warnings treatment
//! Standard_SStream aSStream;
//! aPeriodicityMaker.DumpWarnings(aSStream);
//! }
//! const TopoDS_Shape& aPeriodicShape = aPeriodicityMaker.Shape(); // Result periodic shape
//!
//!
//! aPeriodicityMaker.XRepeat(2); // Making repetitions
//! const TopoDS_Shape& aRepeat = aPeriodicityMaker.RepeatedShape(); // Getting the repeated shape
//! aPeriodicityMaker.ClearRepetitions(); // Clearing the repetitions
//! ~~~~
//!
class BOPAlgo_MakePeriodic : public BOPAlgo_Options
{
public:
DEFINE_STANDARD_ALLOC
public: //! @name Constructor
//! Empty constructor
BOPAlgo_MakePeriodic() : BOPAlgo_Options()
{
myRepeatPeriod[0] = myRepeatPeriod[1] = myRepeatPeriod[2] = 0.0;
}
public: //! @name Setting the shape to make it periodic
//! Sets the shape to make it periodic.
//! @param theShape [in] The shape to make periodic.
void SetShape(const TopoDS_Shape& theShape)
{
myInputShape = theShape;
}
public: //! @name Definition of the structure to keep all periodicity parameters
//! Structure to keep all periodicity parameters:
struct PeriodicityParams
{
PeriodicityParams()
{
Clear();
}
//! Returns all previously set parameters to default values
void Clear()
{
myPeriodic[0] = myPeriodic[1] = myPeriodic[2] = Standard_False;
myPeriod[0] = myPeriod[1] = myPeriod[2] = 0.0;
myIsTrimmed[0] = myIsTrimmed[1] = myIsTrimmed[2] = Standard_True;
myPeriodFirst[0] = myPeriodFirst[1] = myPeriodFirst[2] = 0.0;
}
Standard_Boolean myPeriodic[3]; //!< Array of flags defining whether the shape should be
//! periodic in XYZ directions
Standard_Real myPeriod[3]; //!< Array of XYZ period values. Defining the period for any
//! direction the corresponding flag for that direction in
//! myPeriodic should be set to true
Standard_Boolean myIsTrimmed[3]; //!< Array of flags defining whether the input shape has to be
//! trimmed to fit the required period in the required direction
Standard_Real myPeriodFirst[3]; //!< Array of start parameters of the XYZ periods: required for trimming
};
public: //! @name Setters/Getters for periodicity parameters structure
//! Sets the periodicity parameters.
//! @param theParams [in] Periodicity parameters
void SetPeriodicityParameters(const PeriodicityParams& theParams)
{
myPeriodicityParams = theParams;
}
const PeriodicityParams& PeriodicityParameters() const
{
return myPeriodicityParams;
}
public: //! @name Methods for setting/getting periodicity info using ID as a direction
//! Sets the flag to make the shape periodic in specified direction:
//! - 0 - X direction;
//! - 1 - Y direction;
//! - 2 - Z direction.
//!
//! @param theDirectionID [in] The direction's ID;
//! @param theIsPeriodic [in] Flag defining periodicity in given direction;
//! @param thePeriod [in] Required period in given direction.
void MakePeriodic(const Standard_Integer theDirectionID,
const Standard_Boolean theIsPeriodic,
const Standard_Real thePeriod = 0.0)
{
Standard_Integer id = ToDirectionID(theDirectionID);
myPeriodicityParams.myPeriodic[id] = theIsPeriodic;
myPeriodicityParams.myPeriod[id] = theIsPeriodic ? thePeriod : 0.0;
}
//! Returns the info about Periodicity of the shape in specified direction.
//! @param theDirectionID [in] The direction's ID.
Standard_Boolean IsPeriodic(const Standard_Integer theDirectionID) const
{
return myPeriodicityParams.myPeriodic[ToDirectionID(theDirectionID)];
}
//! Returns the Period of the shape in specified direction.
//! @param theDirectionID [in] The direction's ID.
Standard_Real Period(const Standard_Integer theDirectionID) const
{
Standard_Integer id = ToDirectionID(theDirectionID);
return myPeriodicityParams.myPeriodic[id] ? myPeriodicityParams.myPeriod[id] : 0.0;
}
public: //! @name Named methods for setting/getting info about shape's periodicity
//! Sets the flag to make the shape periodic in X direction.
//! @param theIsPeriodic [in] Flag defining periodicity in X direction;
//! @param thePeriod [in] Required period in X direction.
void MakeXPeriodic(const Standard_Boolean theIsPeriodic,
const Standard_Real thePeriod = 0.0)
{
MakePeriodic(0, theIsPeriodic, thePeriod);
}
//! Returns the info about periodicity of the shape in X direction.
Standard_Boolean IsXPeriodic() const { return IsPeriodic(0); }
//! Returns the XPeriod of the shape
Standard_Real XPeriod() const { return Period(0); }
//! Sets the flag to make the shape periodic in Y direction.
//! @param theIsPeriodic [in] Flag defining periodicity in Y direction;
//! @param thePeriod [in] Required period in Y direction.
void MakeYPeriodic(const Standard_Boolean theIsPeriodic,
const Standard_Real thePeriod = 0.0)
{
MakePeriodic(1, theIsPeriodic, thePeriod);
}
//! Returns the info about periodicity of the shape in Y direction.
Standard_Boolean IsYPeriodic() const { return IsPeriodic(1); }
//! Returns the YPeriod of the shape.
Standard_Real YPeriod() const { return Period(1); }
//! Sets the flag to make the shape periodic in Z direction.
//! @param theIsPeriodic [in] Flag defining periodicity in Z direction;
//! @param thePeriod [in] Required period in Z direction.
void MakeZPeriodic(const Standard_Boolean theIsPeriodic,
const Standard_Real thePeriod = 0.0)
{
MakePeriodic(2, theIsPeriodic, thePeriod);
}
//! Returns the info about periodicity of the shape in Z direction.
Standard_Boolean IsZPeriodic() const { return IsPeriodic(2); }
//! Returns the ZPeriod of the shape.
Standard_Real ZPeriod() const { return Period(2); }
public: //! @name Methods for setting/getting trimming info taking Direction ID as a parameter
//! Defines whether the input shape is already trimmed in specified direction
//! to fit the period in this direction.
//! Direction is defined by an ID:
//! - 0 - X direction;
//! - 1 - Y direction;
//! - 2 - Z direction.
//!
//! If the shape is not trimmed it is required to set the first parameter
//! of the period in that direction.
//! The algorithm will make the shape fit into the period.
//!
//! Before calling this method, the shape has to be set to be periodic in this direction.
//!
//! @param theDirectionID [in] The direction's ID;
//! @param theIsTrimmed [in] The flag defining trimming of the shape in given direction;
//! @param theFirst [in] The first periodic parameter in the given direction.
void SetTrimmed(const Standard_Integer theDirectionID,
const Standard_Boolean theIsTrimmed,
const Standard_Real theFirst = 0.0)
{
Standard_Integer id = ToDirectionID(theDirectionID);
if (IsPeriodic(id))
{
myPeriodicityParams.myIsTrimmed[id] = theIsTrimmed;
myPeriodicityParams.myPeriodFirst[id] = !theIsTrimmed ? theFirst : 0.0;
}
}
//! Returns whether the input shape was trimmed in the specified direction.
//! @param theDirectionID [in] The direction's ID.
Standard_Boolean IsInputTrimmed(const Standard_Integer theDirectionID) const
{
return myPeriodicityParams.myIsTrimmed[ToDirectionID(theDirectionID)];
}
//! Returns the first periodic parameter in the specified direction.
//! @param theDirectionID [in] The direction's ID.
Standard_Real PeriodFirst(const Standard_Integer theDirectionID) const
{
Standard_Integer id = ToDirectionID(theDirectionID);
return !myPeriodicityParams.myIsTrimmed[id] ? myPeriodicityParams.myPeriodFirst[id] : 0.0;
}
public: //! @name Named methods for setting/getting trimming info
//! Defines whether the input shape is already trimmed in X direction
//! to fit the X period. If the shape is not trimmed it is required
//! to set the first parameter for the X period.
//! The algorithm will make the shape fit into the period.
//!
//! Before calling this method, the shape has to be set to be periodic in this direction.
//!
//! @param theIsTrimmed [in] Flag defining whether the shape is already trimmed
//! in X direction to fit the X period;
//! @param theFirst [in] The first X periodic parameter.
void SetXTrimmed(const Standard_Boolean theIsTrimmed,
const Standard_Boolean theFirst = 0.0)
{
SetTrimmed(0, theIsTrimmed, theFirst);
}
//! Returns whether the input shape was already trimmed for X period.
Standard_Boolean IsInputXTrimmed() const
{
return IsInputTrimmed(0);
}
//! Returns the first parameter for the X period.
Standard_Real XPeriodFirst() const
{
return PeriodFirst(0);
}
//! Defines whether the input shape is already trimmed in Y direction
//! to fit the Y period. If the shape is not trimmed it is required
//! to set the first parameter for the Y period.
//! The algorithm will make the shape fit into the period.
//!
//! Before calling this method, the shape has to be set to be periodic in this direction.
//!
//! @param theIsTrimmed [in] Flag defining whether the shape is already trimmed
//! in Y direction to fit the Y period;
//! @param theFirst [in] The first Y periodic parameter.
void SetYTrimmed(const Standard_Boolean theIsTrimmed,
const Standard_Boolean theFirst = 0.0)
{
SetTrimmed(1, theIsTrimmed, theFirst);
}
//! Returns whether the input shape was already trimmed for Y period.
Standard_Boolean IsInputYTrimmed() const
{
return IsInputTrimmed(1);
}
//! Returns the first parameter for the Y period.
Standard_Real YPeriodFirst() const
{
return PeriodFirst(1);
}
//! Defines whether the input shape is already trimmed in Z direction
//! to fit the Z period. If the shape is not trimmed it is required
//! to set the first parameter for the Z period.
//! The algorithm will make the shape fit into the period.
//!
//! Before calling this method, the shape has to be set to be periodic in this direction.
//!
//! @param theIsTrimmed [in] Flag defining whether the shape is already trimmed
//! in Z direction to fit the Z period;
//! @param theFirst [in] The first Z periodic parameter.
void SetZTrimmed(const Standard_Boolean theIsTrimmed,
const Standard_Boolean theFirst = 0.0)
{
SetTrimmed(2, theIsTrimmed, theFirst);
}
//! Returns whether the input shape was already trimmed for Z period.
Standard_Boolean IsInputZTrimmed() const
{
return IsInputTrimmed(2);
}
//! Returns the first parameter for the Z period.
Standard_Real ZPeriodFirst() const
{
return PeriodFirst(2);
}
public: //! @name Performing the operation
//! Makes the shape periodic in necessary directions
Standard_EXPORT void Perform();
public: //! @name Using the algorithm to repeat the shape
//! Performs repetition of the shape in specified direction
//! required number of times.
//! Negative value of times means that the repetition should
//! be perform in negative direction.
//! Makes the repeated shape a base for following repetitions.
//!
//! @param theDirectionID [in] The direction's ID;
//! @param theTimes [in] Requested number of repetitions.
Standard_EXPORT const TopoDS_Shape& RepeatShape(const Standard_Integer theDirectionID,
const Standard_Integer theTimes);
//! Repeats the shape in X direction specified number of times.
//! Negative value of times means that the repetition should be
//! perform in negative X direction.
//! Makes the repeated shape a base for following repetitions.
//!
//! @param theTimes [in] Requested number of repetitions.
const TopoDS_Shape& XRepeat(const Standard_Integer theTimes)
{
return RepeatShape(0, theTimes);
}
//! Repeats the shape in Y direction specified number of times.
//! Negative value of times means that the repetition should be
//! perform in negative Y direction.
//! Makes the repeated shape a base for following repetitions.
//!
//! @param theTimes [in] Requested number of repetitions.
const TopoDS_Shape& YRepeat(const Standard_Integer theTimes)
{
return RepeatShape(1, theTimes);
}
//! Repeats the shape in Z direction specified number of times.
//! Negative value of times means that the repetition should be
//! perform in negative Z direction.
//! Makes the repeated shape a base for following repetitions.
//!
//! @param theTimes [in] Requested number of repetitions.
const TopoDS_Shape& ZRepeat(const Standard_Integer theTimes)
{
return RepeatShape(2, theTimes);
}
public: //! @name Starting the repetitions over
//! Returns the repeated shape
const TopoDS_Shape& RepeatedShape() const { return myRepeatedShape; }
//! Clears all performed repetitions.
//! The next repetition will be performed on the base shape.
void ClearRepetitions()
{
myRepeatPeriod[0] = myRepeatPeriod[1] = myRepeatPeriod[2] = 0.0;
myRepeatedShape.Nullify();
myRepeatedTwins.Clear();
if (!myHistory.IsNull())
{
myHistory->Clear();
if (!mySplitHistory.IsNull())
myHistory->Merge(mySplitHistory);
}
}
public: //! @name Obtaining the result shape
//! Returns the resulting periodic shape
const TopoDS_Shape& Shape() const { return myShape; }
public: //! @name Getting the identical shapes
//! Returns the identical shapes for the given shape located
//! on the opposite periodic side.
//! Returns empty list in case the shape has no twin.
//!
//! @param theS [in] Shape to get the twins for.
const TopTools_ListOfShape& GetTwins(const TopoDS_Shape& theS) const
{
static TopTools_ListOfShape empty;
const TopTools_ListOfShape* aTwins =
myRepeatedTwins.IsEmpty() ? myTwins.Seek(theS) : myRepeatedTwins.Seek(theS);
return (aTwins ? *aTwins : empty);
}
public: //! @name Getting the History of the algorithm
//! Returns the History of the algorithm
const Handle(BRepTools_History)& History() const
{
return myHistory;
}
public: //! @name Clearing the algorithm from previous runs
//! Clears the algorithm from previous runs
void Clear()
{
BOPAlgo_Options::Clear();
myPeriodicityParams.Clear();
myShape.Nullify();
if (!mySplitHistory.IsNull())
mySplitHistory->Clear();
if (!myHistory.IsNull())
myHistory->Clear();
ClearRepetitions();
}
public: //! @name Conversion of the integer to ID of periodic direction
//! Converts the integer to ID of periodic direction
static Standard_Integer ToDirectionID(const Standard_Integer theDirectionID)
{
return Abs(theDirectionID % 3);
}
protected: //! @name Protected methods performing the operation
//! Checks the validity of input data
Standard_EXPORT void CheckData();
//! Trims the shape to fit to the periodic bounds
Standard_EXPORT void Trim();
//! Makes the shape identical on opposite sides
Standard_EXPORT void MakeIdentical();
//! Splits the negative side of the shape with the geometry
//! located on the positive side copying the geometry from
//! positive side to the negative.
Standard_EXPORT void SplitNegative();
//! Splits the positive side of the shape with the geometry
//! located on the negative side of the shape.
//! Ensures that the geometries on the opposite sides will
//! be identical.
//! Associates the identical opposite sub-shapes.
Standard_EXPORT void SplitPositive();
//! Splits the shape by the given tools, copying the geometry of coinciding
//! parts from the given tools to the split shape.
//! @param theTools [in] The tools to split the shape and take the geometry
//! for coinciding parts.
//! @param theSplitShapeHistory [out] The history of shape split
//! @param theSplitToolsHistory [out] The history of tools modifications during the split
Standard_EXPORT void SplitShape(const TopTools_ListOfShape& theTools,
Handle(BRepTools_History) theSplitShapeHistory = NULL,
Handle(BRepTools_History) theSplitToolsHistory = NULL);
//! Updates the map of twins after periodic shape repetition.
//! @param theTranslationHistory [in] The history of translation of the periodic shape.
//! @param theGluingHistory [in] The history of gluing of the repeated shapes.
Standard_EXPORT void UpdateTwins(const BRepTools_History& theTranslationHistory,
const BRepTools_History& theGluingHistory);
protected: //! @name Fields
// Inputs
TopoDS_Shape myInputShape; //!< Input shape to make periodic
PeriodicityParams myPeriodicityParams; //!< Periodicity parameters
// Results
TopoDS_Shape myShape; //!< Resulting periodic shape (base for repetitions)
TopoDS_Shape myRepeatedShape; //!< Resulting shape after making repetitions of the base
Standard_Real myRepeatPeriod[3]; //!< XYZ repeat period
TopTools_DataMapOfShapeListOfShape myRepeatedTwins; //!< Map of associations of the identical sub-shapes
//! after repetition of the periodic shape
// Twins
TopTools_DataMapOfShapeListOfShape myTwins; //!< Map of associations of the identical sub-shapes
//! located on the opposite sides of the shape
// History
Handle(BRepTools_History) mySplitHistory; //!< Split history - history of shapes modification
//! after the split for making the shape periodic
Handle(BRepTools_History) myHistory; //!< Final history of shapes modifications
//! (to include the history of shape repetition)
};
#endif // _BOPAlgo_MakePeriodic_HeaderFile

View File

@@ -169,6 +169,22 @@ void BOPAlgo_PaveFiller::SetSectionAttribute
mySectionAttribute = theSecAttr;
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
{
myArguments=theLS;
}
//=======================================================================
//function : Arguments
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
{
return myArguments;
}
//=======================================================================
// function: Init
// purpose:
//=======================================================================
@@ -284,7 +300,7 @@ void BOPAlgo_PaveFiller::PerformInternal()
//
MakeSplitEdges();
if (HasErrors()) {
return;
return;
}
//
UpdatePaveBlocksWithSDVertices();

View File

@@ -125,23 +125,9 @@ public:
Standard_EXPORT const BOPDS_PIterator& Iterator();
//! Sets the arguments for operation
void SetArguments (const TopTools_ListOfShape& theLS)
{
myArguments = theLS;
}
//! Adds the argument for operation
void AddArgument(const TopoDS_Shape& theShape)
{
myArguments.Append(theShape);
}
//! Returns the list of arguments
const TopTools_ListOfShape& Arguments() const
{
return myArguments;
}
Standard_EXPORT void SetArguments (const TopTools_ListOfShape& theLS);
Standard_EXPORT const TopTools_ListOfShape& Arguments() const;
Standard_EXPORT const Handle(IntTools_Context)& Context();
@@ -355,7 +341,7 @@ protected:
//! Removes indices of vertices that are already on the
//! curve <theNC> from the map <theMV>.
//! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods.
Standard_EXPORT void RemoveUsedVertices (BOPDS_Curve& theNC, TColStd_MapOfInteger& theMV);
Standard_EXPORT void RemoveUsedVertices (const BOPDS_Curve& theNC, TColStd_MapOfInteger& theMV);
//! Puts the pave nV on the curve theNC.

View File

@@ -457,8 +457,12 @@ void BOPAlgo_PaveFiller::PerformEF()
PerformNewVertices(aMVCPB, aAllocator, Standard_False);
//
// Update FaceInfoIn for all faces having EF common parts
myDS->UpdateFaceInfoIn (aMIEFC);
TColStd_MapIteratorOfMapOfInteger aItMI;
aItMI.Initialize(aMIEFC);
for (; aItMI.More(); aItMI.Next()) {
nF=aItMI.Value();
myDS->UpdateFaceInfoIn(nF);
}
//-----------------------------------------------------scope t
aMIEFC.Clear();
aMVCPB.Clear();

View File

@@ -208,18 +208,36 @@ void BOPAlgo_PaveFiller::PerformFF()
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nF1, nF2);
aMIFence.Add (nF1);
aMIFence.Add (nF2);
}
// Update face info
myDS->UpdateFaceInfoOn (aMIFence);
myDS->UpdateFaceInfoIn (aMIFence);
// Initialize interferences
myIterator->Initialize(TopAbs_FACE, TopAbs_FACE);
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nF1, nF2);
// Update/Initialize FaceInfo structure for first face
if (myDS->HasFaceInfo(nF1))
{
if (aMIFence.Add(nF1))
{
myDS->UpdateFaceInfoOn(nF1);
myDS->UpdateFaceInfoIn(nF1);
}
}
else if (myDS->HasInterfShapeSubShapes(nF2, nF1))
{
myDS->ChangeFaceInfo(nF1);
aMIFence.Add(nF1);
}
// Update/Initialize FaceInfo structure for second face
if (myDS->HasFaceInfo(nF2))
{
if (aMIFence.Add(nF2))
{
myDS->UpdateFaceInfoOn(nF2);
myDS->UpdateFaceInfoIn(nF2);
}
}
else if (myDS->HasInterfShapeSubShapes(nF1, nF2))
{
myDS->ChangeFaceInfo(nF2);
aMIFence.Add(nF2);
}
//
if (myGlue == BOPAlgo_GlueOff)
{
const TopoDS_Face& aF1 = (*(TopoDS_Face *)(&myDS->Shape(nF1)));
@@ -763,11 +781,45 @@ void BOPAlgo_PaveFiller::PostTreatFF
aPF.SetNonDestructive(myNonDestructive);
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
Standard_Integer aNbFF = aFFs.Length();
//
//Find unused vertices
TopTools_IndexedMapOfShape VertsUnused;
TColStd_MapOfInteger IndMap;
for (Standard_Integer i = 0; i < aNbFF; i++)
{
BOPDS_InterfFF& aFF = aFFs(i);
Standard_Integer nF1, nF2;
aFF.Indices(nF1, nF2);
TColStd_MapOfInteger aMV, aMVEF, aMI;
GetStickVertices(nF1, nF2, aMV, aMVEF, aMI);
BOPDS_VectorOfCurve& aVC = aFF.ChangeCurves();
Standard_Integer aNbC = aVC.Length();
for (j = 0; j < aNbC; j++)
{
BOPDS_Curve& aNC = aVC.ChangeValue(j);
RemoveUsedVertices(aNC, aMV);
}
TColStd_MapIteratorOfMapOfInteger itmap(aMV);
for(; itmap.More(); itmap.Next())
{
Standard_Integer indV = itmap.Value();
const TopoDS_Shape& aVertex = myDS->Shape(indV);
if (IndMap.Add(indV))
VertsUnused.Add(aVertex);
else
VertsUnused.RemoveKey(aVertex);
}
}
/////////////////////
Standard_Integer aNbME = theMicroEdges.Extent();
Standard_Integer aNbVOnRPB = theVertsOnRejectedPB.Extent();
// 0
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0)) {
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0) && VertsUnused.IsEmpty()) {
const TopoDS_Shape& aS=theMSCPB.FindKey(1);
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromIndex(1);
//
@@ -869,16 +921,22 @@ void BOPAlgo_PaveFiller::PostTreatFF
// Add vertices put on the real section curves to unify them with the
// vertices of the edges, by which these sections curves have been rejected
for (Standard_Integer i = 1; i <= aNbVOnRPB; ++i)
// and with unused vertices
const TopTools_IndexedMapOfShape* VerMap [2] = {&theVertsOnRejectedPB, &VertsUnused};
for (Standard_Integer imap = 0; imap < 2; imap++)
{
TopoDS_Shape aVer = theVertsOnRejectedPB(i);
Standard_Integer iVer = myDS->Index(aVer);
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
if (pSD)
aVer = myDS->Shape(*pSD);
if (anAddedSD.Add(aVer))
aLS.Append(aVer);
Standard_Integer NbVer = VerMap[imap]->Extent();
for (Standard_Integer i = 1; i <= NbVer; ++i)
{
TopoDS_Shape aVer = VerMap[imap]->FindKey(i);
Standard_Integer iVer = myDS->Index(aVer);
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
if (pSD)
aVer = myDS->Shape(*pSD);
if (anAddedSD.Add(aVer))
aLS.Append(aVer);
}
}
//
// 2 Fuse shapes
@@ -2073,23 +2131,24 @@ void BOPAlgo_PaveFiller::GetFullShapeMap(const Standard_Integer nF,
// function: RemoveUsedVertices
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
void BOPAlgo_PaveFiller::RemoveUsedVertices(const BOPDS_Curve& aNC,
TColStd_MapOfInteger& aMV)
{
if (!aMV.Extent()) {
return;
}
Standard_Integer nV;
BOPDS_Pave aPave;
BOPDS_ListIteratorOfListOfPave aItLP;
//
Handle(BOPDS_PaveBlock)& aPB=aNC.ChangePaveBlock1();
const BOPDS_ListOfPave& aLP = aPB->ExtPaves();
aItLP.Initialize(aLP);
for (;aItLP.More();aItLP.Next()) {
aPave = aItLP.Value();
nV = aPave.Index();
aMV.Remove(nV);
const BOPDS_ListOfPaveBlock& aLPBC = aNC.PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock itPB(aLPBC);
for (; itPB.More(); itPB.Next())
{
const BOPDS_ListOfPave& aLP = itPB.Value()->ExtPaves();
BOPDS_ListIteratorOfListOfPave aItLP(aLP);
for (;aItLP.More();aItLP.Next()) {
BOPDS_Pave aPave = aItLP.Value();
Standard_Integer nV = aPave.Index();
aMV.Remove(nV);
}
}
}

View File

@@ -17,8 +17,6 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <TopoDS_Iterator.hxx>
//=======================================================================
//function :
//purpose :
@@ -100,31 +98,3 @@ void BOPAlgo_Splitter::Perform()
myEntryPoint = 1;
PerformInternal(*pPF);
}
//=======================================================================
//function : BuildResult
//purpose :
//=======================================================================
void BOPAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType)
{
BOPAlgo_Builder::BuildResult(theType);
if (theType == TopAbs_COMPOUND)
{
// The method is called for the last time for this operation.
// If there is only one argument shape and it has been modified into
// a single shape, or has not been modified at all, the result shape
// has to be overwritten to avoid the unnecessary enclosure into compound.
if (myArguments.Extent() == 1)
{
TopoDS_Iterator it(myShape);
if (it.More())
{
const TopoDS_Shape& aSFirst = it.Value();
it.Next();
if (!it.More())
myShape = aSFirst;
}
}
}
}

View File

@@ -66,12 +66,6 @@ protected:
//! Checks the input data
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
//! Adds images of the argument shapes into result.
//! When called the for the last time (for compound) it rebuilds the result
//! shape to avoid multiple enclosure into compounds.
Standard_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType) Standard_OVERRIDE;
};
#endif // _BOPAlgo_Splitter_HeaderFile

View File

@@ -25,7 +25,7 @@
#include <BOPDS_PaveBlock.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <BOPTools_BoxTree.hxx>
#include <BOPTools_BoxBndTree.hxx>
#include <BOPTools_Parallel.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
@@ -33,7 +33,6 @@
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepLib.hxx>
#include <Bnd_Tools.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <gp_Circ.hxx>
@@ -46,6 +45,7 @@
#include <gp_Vec.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <NCollection_Vector.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
@@ -712,8 +712,7 @@ Standard_Boolean BOPAlgo_Tools::WiresToFaces(const TopoDS_Shape& theWires,
BOPTools_AlgoTools::CorrectShapeTolerances(aRFaces, aMEmpty, Standard_False);
//
theFaces = aRFaces;
TopoDS_Iterator aItF(theFaces);
return aItF.More();
return theFaces.NbChildren() > 0;
}
//=======================================================================
@@ -957,14 +956,14 @@ typedef BOPTools_Cnt
<BOPAlgo_TNVFunctor,
BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
//=======================================================================
class BOPAlgo_TNV : public BOPTools_BoxTreeSelector{
class BOPAlgo_TNV : public BOPTools_BoxBndTreeSelector{
public:
BOPAlgo_TNV()
: BOPTools_BoxTreeSelector(),
myTol (0.), myFuzzyValue(0.), myVecTNV(NULL) {
: BOPTools_BoxBndTreeSelector(),
myTol (0.), myFuzzyValue(0.), myTree(NULL), myVecTNV(NULL) {
};
//
virtual ~BOPAlgo_TNV(){
~BOPAlgo_TNV(){
};
//
void SetVertex(const TopoDS_Vertex& aV) {
@@ -976,6 +975,10 @@ class BOPAlgo_TNV : public BOPTools_BoxTreeSelector{
return myV;
}
//
void SetTree(BOPTools_BoxBndTree& aTree) {
myTree=&aTree;
}
//
void SetTolerance(const Standard_Real theTol) {
myTol = theTol;
}
@@ -996,24 +999,19 @@ class BOPAlgo_TNV : public BOPTools_BoxTreeSelector{
myVecTNV = &theVec;
}
//
virtual Standard_Boolean Accept(const Standard_Integer theIndex,
const Standard_Boolean& theIsInside) override
virtual Standard_Boolean Accept(const Standard_Integer& theIndex)
{
if (theIsInside || !RejectElement (theIndex))
{
const Standard_Integer anInd = myBVHSet->Element (theIndex);
const BOPAlgo_TNV& aTNV = myVecTNV->Value(anInd - 1);
Standard_Real aTolSum2 = myTol + aTNV.Tolerance() + myFuzzyValue;
aTolSum2 *= aTolSum2;
Standard_Real aD2 = myPnt.SquareDistance(aTNV.Pnt());
if (aD2 < aTolSum2)
return BOPTools_BoxTreeSelector::Accept(theIndex, Standard_True);
}
const BOPAlgo_TNV& aTNV = myVecTNV->Value(theIndex - 1);
Standard_Real aTolSum2 = myTol + aTNV.Tolerance() + myFuzzyValue;
aTolSum2 *= aTolSum2;
Standard_Real aD2 = myPnt.SquareDistance(aTNV.Pnt());
if (aD2 < aTolSum2)
return BOPTools_BoxBndTreeSelector::Accept(theIndex);
return Standard_False;
}
//
void Perform() {
Select();
myTree->Select(*this);
}
//
protected:
@@ -1021,6 +1019,7 @@ class BOPAlgo_TNV : public BOPTools_BoxTreeSelector{
Standard_Real myFuzzyValue;
gp_Pnt myPnt;
TopoDS_Vertex myV;
BOPTools_BoxBndTree *myTree;
const BOPAlgo_VectorOfTNV *myVecTNV;
};
//
@@ -1044,8 +1043,9 @@ void BOPAlgo_Tools::IntersectVertices(const TopTools_IndexedDataMapOfShapeReal&
}
//
// Use unbalanced binary tree of bounding boxes for sorting of the vertices.
Handle(BOPTools_BoxTree) aBBTree = new BOPTools_BoxTree();
aBBTree->SetSize (aNbV);
BOPTools_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer,
Bnd_Box> aTreeFiller(aBBTree);
// Perform intersection of the vertices
BOPAlgo_VectorOfTNV aVTNV;
//
@@ -1063,18 +1063,18 @@ void BOPAlgo_Tools::IntersectVertices(const TopTools_IndexedDataMapOfShapeReal&
aBox.Add(BRep_Tool::Pnt(aV));
aBox.SetGap(aTol + aTolAdd);
//
aBBTree->Add(i, Bnd_Tools::Bnd2BVH(aBox));
aTreeFiller.Add(i, aBox);
//
BOPAlgo_TNV& aTNV=aVTNV.Appended();
aTNV.SetBVHSet (aBBTree.get());
aTNV.SetBox(Bnd_Tools::Bnd2BVH(aBox));
aTNV.SetTree(aBBTree);
aTNV.SetBox(aBox);
aTNV.SetVertex(aV);
aTNV.SetTolerance(aTol);
aTNV.SetFuzzyValue(theFuzzyValue);
aTNV.SetVectorOfTNV(aVTNV);
}
// Shake the tree
aBBTree->Build();
aTreeFiller.Fill();
//
// Perform intersection
BOPAlgo_TNVCnt::Perform(theRunParallel, aVTNV);
@@ -1231,9 +1231,9 @@ public:
};
//! Sets the Bounding Box tree
void SetBBTree(const Handle(BOPTools_BoxTree)& theBBTree)
void SetBBTree(const BOPTools_BoxBndTree& theBBTree)
{
myBBTree = theBBTree;
myBBTree = (BOPTools_BoxBndTree*)&theBBTree;
};
//! Sets the ShapeBox structure
@@ -1283,7 +1283,7 @@ private:
TopTools_ListOfShape myOwnIF; //! Own INTERNAL faces of the solid
TopTools_ListOfShape myInFaces; //! Faces classified as IN
Handle(BOPTools_BoxTree) myBBTree; //! UB tree of bounding boxes
BOPTools_BoxBndTree* myBBTree; //! UB tree of bounding boxes
BOPAlgo_VectorOfShapeBox* myVShapeBox; //! ShapeBoxMap
TopoDS_Iterator myItF; //! Iterators
@@ -1303,11 +1303,10 @@ void BOPAlgo_FillIn3DParts::Perform()
myInFaces.Clear();
// 1. Select boxes of faces that are not out of aBoxS
BOPTools_BoxTreeSelector aSelector;
aSelector.SetBox(Bnd_Tools::Bnd2BVH(myBoxS));
aSelector.SetBVHSet (myBBTree.get());
BOPTools_BoxBndTreeSelector aSelector;
aSelector.SetBox(myBoxS);
//
if (!aSelector.Select())
if (!myBBTree->Select(aSelector))
return;
const TColStd_ListOfInteger& aLIFP = aSelector.Indices();
@@ -1567,16 +1566,17 @@ void BOPAlgo_Tools::ClassifyFaces(const TopTools_ListOfShape& theFaces,
// Prepare UB tree of bounding boxes of the faces to classify
// taking the bounding boxes from the just prepared vector
Handle(BOPTools_BoxTree) aBBTree = new BOPTools_BoxTree();
BOPTools_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
Standard_Integer aNbF = aVSB.Length();
for (Standard_Integer i = 0; i < aNbF; ++i)
{
aBBTree->Add(i, Bnd_Tools::Bnd2BVH(aVSB(i).Box()));
aTreeFiller.Add(i, aVSB(i).Box());
}
// Shake tree filler
aBBTree->Build();
aTreeFiller.Fill();
// Prepare vector of solids to classify
BOPAlgo_VectorOfFillIn3DParts aVFIP;

View File

@@ -25,7 +25,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>

View File

@@ -27,10 +27,6 @@ BOPAlgo_CheckResult.cxx
BOPAlgo_CheckResult.hxx
BOPAlgo_CheckStatus.hxx
BOPAlgo_ListOfCheckResult.hxx
BOPAlgo_MakeConnected.cxx
BOPAlgo_MakeConnected.hxx
BOPAlgo_MakePeriodic.cxx
BOPAlgo_MakePeriodic.hxx
BOPAlgo_MakerVolume.cxx
BOPAlgo_MakerVolume.hxx
BOPAlgo_MakerVolume.lxx

View File

@@ -1224,33 +1224,9 @@ void BOPDS_DS::InitFaceInfo(const Standard_Integer theI)
aSI.SetReference(iRef);
//
aFI.SetIndex(theI);
InitFaceInfoIn(theI);
UpdateFaceInfoIn(theI);
UpdateFaceInfoOn(theI);
}
//=======================================================================
//function : InitFaceInfoIn
//purpose :
//=======================================================================
void BOPDS_DS::InitFaceInfoIn (const Standard_Integer theI)
{
BOPDS_ShapeInfo& aSI = ChangeShapeInfo (theI);
if (aSI.HasReference())
{
BOPDS_FaceInfo& aFI = myFaceInfoPool (aSI.Reference());
const TopoDS_Shape& aF = Shape (theI);
for (TopoDS_Iterator itS (aF); itS.More(); itS.Next())
{
const TopoDS_Shape& aV = itS.Value();
if (aV.ShapeType() == TopAbs_VERTEX)
{
Standard_Integer nV = Index (aV);
HasShapeSD (nV, nV);
aFI.ChangeVerticesIn().Add (nV);
}
}
}
}
//=======================================================================
//function : UpdateFaceInfoIn
//purpose :
@@ -1401,105 +1377,6 @@ void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
}// for (i=0; i<aNbEF; ++i) {
}
//=======================================================================
//function : UpdateFaceInfoIn
//purpose :
//=======================================================================
void BOPDS_DS::UpdateFaceInfoIn (const TColStd_MapOfInteger& theFaces)
{
for (TColStd_MapOfInteger::Iterator itM (theFaces); itM.More(); itM.Next())
{
const Standard_Integer nF = itM.Value();
BOPDS_ShapeInfo& aSI = ChangeShapeInfo (nF);
if (!aSI.HasReference())
{
myFaceInfoPool.Appended().SetIndex (nF);
aSI.SetReference (myFaceInfoPool.Length() - 1);
}
BOPDS_FaceInfo& aFI = myFaceInfoPool (aSI.Reference());
aFI.ChangePaveBlocksIn().Clear();
aFI.ChangeVerticesIn().Clear();
// 1. Add pure internal vertices on the face
InitFaceInfoIn (nF);
}
// 2. Analyze Vertex-Face interferences
BOPDS_VectorOfInterfVF& aVFs = InterfVF();
const Standard_Integer aNbVF = aVFs.Length();
for (Standard_Integer iVF = 0; iVF < aNbVF; ++iVF)
{
BOPDS_InterfVF& aVF = aVFs (iVF);
const Standard_Integer nF = aVF.Index2();
if (theFaces.Contains (nF))
{
Standard_Integer nV = aVF.Index1();
HasShapeSD (nV, nV);
myFaceInfoPool (ShapeInfo (nF).Reference()).ChangeVerticesIn().Add (nV);
}
}
//
// 3. Analyze Edge-Face interferences
BOPDS_VectorOfInterfEF& aEFs = InterfEF();
const Standard_Integer aNbEF = aEFs.Length();
for (Standard_Integer iEF = 0; iEF < aNbEF; ++iEF)
{
BOPDS_InterfEF& aEF = aEFs (iEF);
const Standard_Integer nF = aEF.Index2();
if (theFaces.Contains (nF))
{
BOPDS_FaceInfo& aFI = myFaceInfoPool (ShapeInfo (nF).Reference());
Standard_Integer nVNew;
if (aEF.HasIndexNew (nVNew))
{
HasShapeSD (nVNew, nVNew);
aFI.ChangeVerticesIn().Add (nVNew);
}
else
{
const Standard_Integer nE = aEF.Index1();
const BOPDS_ListOfPaveBlock& aLPB = PaveBlocks (nE);
for (BOPDS_ListOfPaveBlock::Iterator itPB (aLPB); itPB.More(); itPB.Next())
{
const Handle(BOPDS_PaveBlock)& aPB = itPB.Value();
const Handle(BOPDS_CommonBlock)& aCB = CommonBlock (aPB);
if (!aCB.IsNull())
{
if (aCB->Contains (nF))
{
const Handle(BOPDS_PaveBlock)& aPBR = aCB->PaveBlock1();
aFI.ChangePaveBlocksIn().Add(aPBR);
}
}
}
}
}
}
}
//=======================================================================
//function : UpdateFaceInfoOn
//purpose :
//=======================================================================
void BOPDS_DS::UpdateFaceInfoOn (const TColStd_MapOfInteger& theFaces)
{
for (TColStd_MapOfInteger::Iterator itM (theFaces); itM.More(); itM.Next())
{
const Standard_Integer nF = itM.Value();
BOPDS_ShapeInfo& aSI = ChangeShapeInfo (nF);
if (!aSI.HasReference())
{
myFaceInfoPool.Appended().SetIndex (nF);
aSI.SetReference (myFaceInfoPool.Length() - 1);
}
BOPDS_FaceInfo& aFI = myFaceInfoPool (aSI.Reference());
aFI.ChangePaveBlocksOn().Clear();
aFI.ChangeVerticesOn().Clear();
FaceInfoOn (nF, aFI.ChangePaveBlocksOn(), aFI.ChangeVerticesOn());
}
}
//=======================================================================
//function : RefineFaceInfoOn
//purpose :

View File

@@ -274,14 +274,10 @@ Standard_EXPORT virtual ~BOPDS_DS();
//! Update the state In of face with index theIndex
Standard_EXPORT void UpdateFaceInfoIn (const Standard_Integer theIndex);
//! Update the state IN for all faces in the given map
Standard_EXPORT void UpdateFaceInfoIn (const TColStd_MapOfInteger& theFaces);
//! Update the state On of face with index theIndex
Standard_EXPORT void UpdateFaceInfoOn (const Standard_Integer theIndex);
//! Update the state ON for all faces in the given map
Standard_EXPORT void UpdateFaceInfoOn (const TColStd_MapOfInteger& theFaces);
//! Selector
//! Returns the state On
@@ -491,10 +487,6 @@ protected:
//! Initializes the state of face with index theIndex
Standard_EXPORT void InitFaceInfo (const Standard_Integer theIndex);
//! Initializes the FaceInfo structure for face with index theIndex with elements
//! having IN state for the face
Standard_EXPORT void InitFaceInfoIn (const Standard_Integer theIndex);
Standard_EXPORT void InitShape (const Standard_Integer theIndex, const TopoDS_Shape& theS);

View File

@@ -18,20 +18,62 @@
#include <Bnd_Box.hxx>
#include <Bnd_OBB.hxx>
#include <Bnd_Tools.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_IndexRange.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_Pair.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_Tools.hxx>
#include <BOPTools_BoxTree.hxx>
#include <BOPTools_BoxBndTree.hxx>
#include <BOPTools_Parallel.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <NCollection_Vector.hxx>
#include <TopoDS_Shape.hxx>
#include <algorithm>
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPDS_TreeSelector
//purpose :
//=======================================================================
class BOPDS_TSR : public BOPTools_BoxBndTreeSelector{
public:
BOPDS_TSR() :
BOPTools_BoxBndTreeSelector(),
myHasBRep(Standard_False),
myTree(NULL) {
}
//
virtual ~BOPDS_TSR() {
}
//
void SetHasBRep(const Standard_Boolean bFlag) {
myHasBRep=bFlag;
}
//
void SetTree(BOPTools_BoxBndTree& aTree) {
myTree=&aTree;
}
//
void Perform() {
if (myHasBRep) {
myTree->Select(*this);
}
}
//
protected:
Standard_Boolean myHasBRep;
BOPTools_BoxBndTree *myTree;
};
//
//=======================================================================
typedef NCollection_Vector <BOPDS_TSR> BOPDS_VectorOfTSR;
typedef BOPTools_Functor <BOPDS_TSR,BOPDS_VectorOfTSR> BOPDS_TSRFunctor;
typedef BOPTools_Cnt <BOPDS_TSRFunctor, BOPDS_VectorOfTSR> BOPDS_TSRCnt;
/////////////////////////////////////////////////////////////////////////
//=======================================================================
//function :
//purpose :
@@ -226,80 +268,101 @@ void BOPDS_Iterator::Intersect(const Handle(IntTools_Context)& theCtx,
const Standard_Boolean theCheckOBB,
const Standard_Real theFuzzyValue)
{
const Standard_Integer aNb = myDS->NbSourceShapes();
// Prepare BVH
Handle(BOPTools_BoxTree) aBoxTree = new BOPTools_BoxTree();
aBoxTree->SetSize (aNb);
for (Standard_Integer i = 0; i < aNb; ++i)
{
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
if (!aSI.HasBRep())
Standard_Integer i, j, iX, i1, i2, iR, aNb, aNbR;
Standard_Integer iTi, iTj;
TopAbs_ShapeEnum aTi, aTj;
//
BOPTools_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
aNb = myDS->NbSourceShapes();
BOPDS_VectorOfTSR aVTSR(aNb);
//
for (i=0; i<aNb; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
Standard_Boolean bHasBrep = aSI.IsInterfering() && !(aSI.ShapeType() == TopAbs_SOLID);
//
BOPDS_TSR& aTSR=aVTSR.Appended();
//
aTSR.SetHasBRep(bHasBrep);
if (!bHasBrep) {
continue;
const Bnd_Box& aBox = aSI.Box();
aBoxTree->Add (i, Bnd_Tools::Bnd2BVH (aBox));
}
// Build BVH
aBoxTree->Build();
// Select pairs of shapes with interfering bounding boxes
BOPTools_BoxPairSelector aPairSelector;
aPairSelector.SetBVHSets (aBoxTree.get(), aBoxTree.get());
aPairSelector.SetSame (Standard_True);
aPairSelector.Select();
aPairSelector.Sort();
// Treat the selected pairs
const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aPairSelector.Pairs();
const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size());
Standard_Integer iPair = 0;
const Standard_Integer aNbR = myDS->NbRanges();
for (Standard_Integer iR = 0; iR < aNbR; ++iR)
{
const BOPDS_IndexRange& aRange = myDS->Range(iR);
for (; iPair < aNbPairs; ++iPair)
{
const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair];
if (!aRange.Contains (aPair.ID1))
// Go to the next range
break;
if (aRange.Contains (aPair.ID2))
// Go to the next pair
continue;
const BOPDS_ShapeInfo& aSI1 = myDS->ShapeInfo (aPair.ID1);
const BOPDS_ShapeInfo& aSI2 = myDS->ShapeInfo (aPair.ID2);
const TopAbs_ShapeEnum aType1 = aSI1.ShapeType();
const TopAbs_ShapeEnum aType2 = aSI2.ShapeType();
Standard_Integer iType1 = BOPDS_Tools::TypeToInteger (aType1);
Standard_Integer iType2 = BOPDS_Tools::TypeToInteger (aType2);
// avoid interfering of the same shapes and shape with its sub-shapes
if (((iType1 < iType2) && aSI1.HasSubShape (aPair.ID2)) ||
((iType1 > iType2) && aSI2.HasSubShape (aPair.ID1)))
continue;
if (theCheckOBB)
{
// Check intersection of Oriented bounding boxes of the shapes
Bnd_OBB& anOBB1 = theCtx->OBB (aSI1.Shape(), theFuzzyValue);
Bnd_OBB& anOBB2 = theCtx->OBB (aSI2.Shape(), theFuzzyValue);
if (anOBB1.IsOut (anOBB2))
continue;
}
Standard_Integer iX = BOPDS_Tools::TypeToInteger (aType1, aType2);
myLists(iX).Append (BOPDS_Pair (Min (aPair.ID1, aPair.ID2),
Max (aPair.ID1, aPair.ID2)));
}
//
const Bnd_Box& aBoxEx=aSI.Box();
aTSR.SetTree(aBBTree);
aTSR.SetBox(aBoxEx);
//
aTreeFiller.Add(i, aBoxEx);
}
}
//
aTreeFiller.Fill();
//
//===========================================
BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
//===========================================
//
BOPDS_MapOfPair aMPFence;
//
aNbR = myDS->NbRanges() - 1;
for (iR = 0; iR < aNbR; ++iR) {
const BOPDS_IndexRange& aR = myDS->Range(iR);
i1 = aR.First();
i2 = aR.Last();
for (i = i1; i <= i2; ++i) {
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
//
if (!aSI.IsInterfering() || (aSI.ShapeType() == TopAbs_SOLID)) {
continue;
}
//
BOPDS_TSR& aTSRi = aVTSR(i);
const TColStd_ListOfInteger& aLI = aTSRi.Indices();
Standard_Integer aNbSD = aLI.Extent();
if (!aNbSD) {
continue;
}
//
aTi = aSI.ShapeType();
iTi = BOPDS_Tools::TypeToInteger(aTi);
//
TColStd_ListIteratorOfListOfInteger aIt(aLI);
for (; aIt.More(); aIt.Next()) {
j = aIt.Value(); // DS index
if (j >= i1 && j <= i2) {
continue;// same range
}
//
const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
aTj = aSJ.ShapeType();
iTj = BOPDS_Tools::TypeToInteger(aTj);
//
// avoid interfering of the same shapes and shape with its sub-shapes
if (((iTi < iTj) && aSI.HasSubShape(j)) ||
((iTi > iTj) && aSJ.HasSubShape(i))) {
continue;
}
//
BOPDS_Pair aPair(i, j);
if (aMPFence.Add(aPair)) {
if (theCheckOBB)
{
// Check intersection of Oriented bounding boxes of the shapes
Bnd_OBB& anOBBi = theCtx->OBB(aSI.Shape(), theFuzzyValue);
Bnd_OBB& anOBBj = theCtx->OBB(aSJ.Shape(), theFuzzyValue);
if (anOBBi.IsOut(anOBBj))
continue;
}
iX = BOPDS_Tools::TypeToInteger(aTi, aTj);
myLists(iX).Append(aPair);
}// if (aMPFence.Add(aPair)) {
}// for (; aIt.More(); aIt.Next()) {
}//for (i=i1; i<=i2; ++i) {
}//for (iR=1; iR<aNbR; ++iR) {
//
aMPFence.Clear();
aVTSR.Clear();
//-----------------------------------------------------scope_1 t
}

View File

@@ -14,7 +14,6 @@
#include <Bnd_Box.hxx>
#include <Bnd_OBB.hxx>
#include <Bnd_Tools.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_IndexRange.hxx>
#include <BOPDS_IteratorSI.hxx>
@@ -22,10 +21,11 @@
#include <BOPDS_Pair.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_Tools.hxx>
#include <BOPTools_BoxTree.hxx>
#include <BOPTools_BoxBndTree.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
@@ -87,9 +87,11 @@ void BOPDS_IteratorSI::Intersect(const Handle(IntTools_Context)& theCtx,
Standard_Integer iTi, iTj;
TopAbs_ShapeEnum aTi, aTj;
//
Handle(BOPTools_BoxTree) aBBTree = new BOPTools_BoxTree();
BOPTools_BoxBndTreeSelector aSelector;
BOPTools_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
aNbS = myDS->NbSourceShapes();
aBBTree->SetSize (aNbS);
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
if (!aSI.IsInterfering()) {
@@ -97,10 +99,10 @@ void BOPDS_IteratorSI::Intersect(const Handle(IntTools_Context)& theCtx,
}
//
const Bnd_Box& aBoxEx = aSI.Box();
aBBTree->Add(i, Bnd_Tools::Bnd2BVH(aBoxEx));
aTreeFiller.Add(i, aBoxEx);
}
//
aBBTree->Build();
aTreeFiller.Fill();
//
BOPDS_MapOfPair aMPFence;
//
@@ -112,11 +114,10 @@ void BOPDS_IteratorSI::Intersect(const Handle(IntTools_Context)& theCtx,
//
const Bnd_Box& aBoxEx = aSI.Box();
//
BOPTools_BoxTreeSelector aSelector;
aSelector.SetBox (Bnd_Tools::Bnd2BVH (aBoxEx));
aSelector.SetBVHSet (aBBTree.get());
aSelector.Clear();
aSelector.SetBox(aBoxEx);
//
Standard_Integer aNbSD = aSelector.Select();
Standard_Integer aNbSD = aBBTree.Select(aSelector);
if (!aNbSD) {
continue;
}

View File

@@ -126,7 +126,18 @@ inline TColStd_ListOfInteger& BOPDS_ShapeInfo::ChangeSubShapes()
inline Standard_Boolean BOPDS_ShapeInfo::HasSubShape
(const Standard_Integer theI)const
{
return mySubShapes.Contains (theI);
Standard_Boolean bRet;
TColStd_ListIteratorOfListOfInteger aIt;
//
bRet=Standard_False;
aIt.Initialize(mySubShapes);
for (; aIt.More(); aIt.Next()) {
bRet=(theI==aIt.Value());
if (bRet) {
return bRet;
}
}
return bRet;
}
//=======================================================================
//function : HasReference

View File

@@ -16,13 +16,14 @@
#include <BOPDS_SubIterator.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_Tools.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Pair.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPTools_BoxTree.hxx>
#include <BOPTools_BoxBndTree.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <TopoDS_Shape.hxx>
@@ -117,9 +118,9 @@ void BOPDS_SubIterator::Initialize()
void BOPDS_SubIterator::Intersect()
{
Standard_Integer i, j, iTi, iTj;
Handle(BOPTools_BoxTree) aBBTree = new BOPTools_BoxTree();
aBBTree->SetSize (mySubSet1->Extent());
BOPTools_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
TColStd_ListIteratorOfListOfInteger aIt(*mySubSet1);
for (; aIt.More(); aIt.Next()) {
i = aIt.Value();
@@ -127,10 +128,10 @@ void BOPDS_SubIterator::Initialize()
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
const Bnd_Box& aBoxEx = aSI.Box();
//
aBBTree->Add(i, Bnd_Tools::Bnd2BVH (aBoxEx));
aTreeFiller.Add(i, aBoxEx);
}
//
aBBTree->Build();
aTreeFiller.Fill();
//
BOPDS_MapOfPair aMPKFence;
//
@@ -141,10 +142,9 @@ void BOPDS_SubIterator::Initialize()
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
const Bnd_Box& aBoxEx = aSI.Box();
//
BOPTools_BoxTreeSelector aSelector;
aSelector.SetBox(Bnd_Tools::Bnd2BVH(aBoxEx));
aSelector.SetBVHSet (aBBTree.get());
Standard_Integer aNbSD = aSelector.Select();
BOPTools_BoxBndTreeSelector aSelector;
aSelector.SetBox(aBoxEx);
Standard_Integer aNbSD = aBBTree.Select(aSelector);
if (!aNbSD) {
continue;
}

View File

@@ -57,8 +57,6 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands)
BOPTest::CellsCommands (theCommands);
BOPTest::UtilityCommands (theCommands);
BOPTest::RemoveFeaturesCommands(theCommands);
BOPTest::PeriodicityCommands(theCommands);
BOPTest::MkConnectedCommands(theCommands);
}
//=======================================================================
//function : Factory

View File

@@ -60,10 +60,6 @@ public:
Standard_EXPORT static void RemoveFeaturesCommands (Draw_Interpretor& aDI);
Standard_EXPORT static void PeriodicityCommands (Draw_Interpretor& aDI);
Standard_EXPORT static void MkConnectedCommands (Draw_Interpretor& aDI);
//! Prints errors and warnings if any and draws attached shapes
//! if flag BOPTest_Objects::DrawWarnShapes() is set
Standard_EXPORT static void ReportAlerts (const Handle(Message_Report)& theReport);

View File

@@ -1,413 +0,0 @@
// Created on: 04/02/2018
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2018 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 <BOPTest.hxx>
#include <BOPAlgo_MakeConnected.hxx>
#include <BOPTest_DrawableShape.hxx>
#include <BOPTest_Objects.hxx>
#include <BRep_Builder.hxx>
#include <BRepTest_Objects.hxx>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
static Standard_Integer MakeConnected(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer MakePeriodic(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer MaterialsOn(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer RepeatShape(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer GetTwins(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, const char**);
namespace
{
static BOPAlgo_MakeConnected TheMakeConnectedTool;
}
//=======================================================================
//function : MkConnectedCommands
//purpose :
//=======================================================================
void BOPTest::MkConnectedCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* group = "BOPTest commands";
// Commands
theCommands.Add("makeconnected", "makeconnected result shape1 shape2 ...\n"
"\t\tMake the given shapes connected (glued).",
__FILE__, MakeConnected, group);
theCommands.Add("cmakeperiodic", "cmakeperiodic result [-x/y/z period [-trim first]]\n"
"\t\tMake the connected shape periodic in the required directions.\n"
"\t\tresult - resulting periodic shape;\n"
"\t\t-x/y/z period - option to make the shape periodic in X, Y or Z\n "
"\t\t direction with the given period;\n"
"\t\t-trim first - option to trim the shape to fit the required period,\n"
"\t\t starting the period in first.",
__FILE__, MakePeriodic, group);
theCommands.Add("cmaterialson", "cmaterialson result +/- shape\n"
"\t\tReturns the original shapes located on the required side of a shape:\n"
"\t\t'+' - on a positive side of a shape (containing the shape with orientation FORWARD)\n"
"\t\t'-' - on a negative side of a shape (containing the shape with orientation REVERSED).",
__FILE__, MaterialsOn, group);
theCommands.Add("crepeatshape", "crepeatshape result -x/y/z times\n"
"\t\tRepeats the periodic connected shape in periodic directions required number of times.\n"
"\t\tresult - resulting shape;\n"
"\t\t-x/y/z times - direction for repetition and number of repetitions.",
__FILE__, RepeatShape, group);
theCommands.Add("cperiodictwins", "cperiodictwins twins shape\n"
"\t\tReturns the twins for the shape located on the opposite side of the periodic shape.",
__FILE__, GetTwins, group);
theCommands.Add("cclearrepetitions", "cclearrepetitions [result]\n"
"\t\tClears all previous repetitions of the periodic shape.",
__FILE__, ClearRepetitions, group);
}
//=======================================================================
//function : MakeConnected
//purpose :
//=======================================================================
Standard_Integer MakeConnected(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc < 3)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
TheMakeConnectedTool.Clear();
for (Standard_Integer i = 2; i < theArgc; ++i)
{
TopoDS_Shape aS = DBRep::Get(theArgv[i]);
if (aS.IsNull())
{
theDI << "Error: " << theArgv[i] << " is a null shape. Skip it.\n";
continue;
}
TheMakeConnectedTool.AddArgument(aS);
}
TheMakeConnectedTool.SetRunParallel(BOPTest_Objects::RunParallel());
TheMakeConnectedTool.Perform();
// Print Error/Warning messages
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (TheMakeConnectedTool.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = TheMakeConnectedTool.Shape();
DBRep::Set(theArgv[1], aResult);
return 0;
}
//=======================================================================
//function : MakePeriodic
//purpose :
//=======================================================================
Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc < 4)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
if (TheMakeConnectedTool.Shape().IsNull() || TheMakeConnectedTool.HasErrors())
{
theDI << "Make the shapes connected first.\n";
return 1;
}
BOPAlgo_MakePeriodic::PeriodicityParams aParams;
for (Standard_Integer i = 2; i < theArgc;)
{
Standard_Integer aDirID = -1;
if (!strcasecmp(theArgv[i], "-x"))
aDirID = 0;
else if (!strcasecmp(theArgv[i], "-y"))
aDirID = 1;
else if (!strcasecmp(theArgv[i], "-z"))
aDirID = 2;
else
{
theDI << theArgv[i] << " - Invalid key\n";
return 1;
}
char cDirName[2];
sprintf(cDirName, "%c", theArgv[i][1]);
Standard_Real aPeriod = 0;
if (theArgc > i + 1)
aPeriod = Draw::Atof(theArgv[++i]);
if (aPeriod <= Precision::Confusion())
{
theDI << "Period for " << cDirName << " direction is not set\n";
return 1;
}
aParams.myPeriodic[aDirID] = Standard_True;
aParams.myPeriod[aDirID] = aPeriod;
++i;
if (theArgc > i + 1)
{
// Check if trimming is necessary
if (!strcmp(theArgv[i], "-trim"))
{
if (theArgc == (i + 1))
{
theDI << "Trim bounds for " << cDirName << " direction are not set\n";
return 1;
}
Standard_Real aFirst = Draw::Atof(theArgv[++i]);
aParams.myIsTrimmed[aDirID] = Standard_False;
aParams.myPeriodFirst[aDirID] = aFirst;
++i;
}
}
}
TheMakeConnectedTool.MakePeriodic(aParams);
// Print Error/Warning messages
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (TheMakeConnectedTool.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
DBRep::Set(theArgv[1], aResult);
return 0;
}
//=======================================================================
//function : RepeatShape
//purpose :
//=======================================================================
Standard_Integer RepeatShape(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc < 4)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
if (TheMakeConnectedTool.PeriodicityTool().HasErrors())
{
theDI << "The shapes have not been made periodic yet.\n";
return 1;
}
for (Standard_Integer i = 2; i < theArgc; ++i)
{
Standard_Integer aDirID = -1;
if (!strcasecmp(theArgv[i], "-x"))
aDirID = 0;
else if (!strcasecmp(theArgv[i], "-y"))
aDirID = 1;
else if (!strcasecmp(theArgv[i], "-z"))
aDirID = 2;
else
{
theDI << theArgv[i] << " - Invalid key\n";
return 1;
}
char cDirName[2];
sprintf(cDirName, "%c", theArgv[i][1]);
Standard_Integer aTimes = 0;
if (theArgc > i + 1)
aTimes = Draw::Atoi(theArgv[++i]);
if (aTimes == 0)
{
theDI << "Number of repetitions for " << cDirName << " direction is not set\n";
return 1;
}
TheMakeConnectedTool.RepeatShape(aDirID, aTimes);
}
// Print Error/Warning messages
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (TheMakeConnectedTool.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
DBRep::Set(theArgv[1], aResult);
return 0;
}
//=======================================================================
//function : MaterialsOn
//purpose :
//=======================================================================
Standard_Integer MaterialsOn(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc != 4)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
// Get the shape to get materials
TopoDS_Shape aShape = DBRep::Get(theArgv[3]);
if (aShape.IsNull())
{
theDI << "Error: " << theArgv[3] << " is a null shape.\n";
return 1;
}
// Get the sign of a shape
Standard_Boolean bPositive;
if (!strcmp("+", theArgv[2]))
bPositive = Standard_True;
else if (!strcmp("-", theArgv[2]))
bPositive = Standard_False;
else
{
theDI << theArgv[2] << " - invalid key.\n";
return 1;
}
const TopTools_ListOfShape& aLS = bPositive ?
TheMakeConnectedTool.MaterialsOnPositiveSide(aShape) :
TheMakeConnectedTool.MaterialsOnNegativeSide(aShape);
TopoDS_Shape aResult;
if (aLS.IsEmpty())
theDI << "No materials on this side.\n";
else if (aLS.Extent() == 1)
aResult = aLS.First();
else
{
BRep_Builder().MakeCompound(TopoDS::Compound(aResult));
for (TopTools_ListIteratorOfListOfShape it(aLS); it.More(); it.Next())
BRep_Builder().Add(aResult, it.Value());
}
DBRep::Set(theArgv[1], aResult);
return 0;
}
//=======================================================================
//function : GetTwin
//purpose :
//=======================================================================
Standard_Integer GetTwins(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc != 3)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
// Get the shape to find twins
TopoDS_Shape aShape = DBRep::Get(theArgv[2]);
if (aShape.IsNull())
{
theDI << "Error: " << theArgv[2] << " is a null shape.\n";
return 1;
}
const TopTools_ListOfShape& aTwins = TheMakeConnectedTool.PeriodicityTool().GetTwins(aShape);
TopoDS_Shape aCTwins;
if (aTwins.IsEmpty())
theDI << "No twins for the shape.\n";
else if (aTwins.Extent() == 1)
aCTwins = aTwins.First();
else
{
BRep_Builder().MakeCompound(TopoDS::Compound(aCTwins));
for (TopTools_ListIteratorOfListOfShape it(aTwins); it.More(); it.Next())
BRep_Builder().Add(aCTwins, it.Value());
}
DBRep::Set(theArgv[1], aCTwins);
return 0;
}
//=======================================================================
//function : ClearRepetitions
//purpose :
//=======================================================================
Standard_Integer ClearRepetitions(Draw_Interpretor&,
Standard_Integer theArgc,
const char **theArgv)
{
// Clear all previous repetitions
TheMakeConnectedTool.ClearRepetitions();
// Set the history of the operation in session
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
if (theArgc > 1)
DBRep::Set(theArgv[1], TheMakeConnectedTool.PeriodicShape());
return 0;
}

View File

@@ -1,296 +0,0 @@
// Created on: 03/19/2018
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2018 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 <BOPTest.hxx>
#include <BOPAlgo_MakePeriodic.hxx>
#include <BOPTest_DrawableShape.hxx>
#include <BOPTest_Objects.hxx>
#include <BRep_Builder.hxx>
#include <BRepTest_Objects.hxx>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
static Standard_Integer MakePeriodic(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer GetTwins(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer RepeatShape(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, const char**);
namespace
{
static BOPAlgo_MakePeriodic ThePeriodicityMaker;
}
//=======================================================================
//function : PeriodicityCommands
//purpose :
//=======================================================================
void BOPTest::PeriodicityCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* group = "BOPTest commands";
// Commands
theCommands.Add("makeperiodic", "makeperiodic result shape [-x/y/z period [-trim first]]\n"
"\t\tMake the shape periodic in the required directions.\n"
"\t\tresult - resulting periodic shape;\n"
"\t\t-x/y/z period - option to make the shape periodic in X, Y or Z\n "
"\t\t direction with the given period;\n"
"\t\t-trim first - option to trim the shape to fit the required period,\n"
"\t\t starting the period in first.",
__FILE__, MakePeriodic, group);
theCommands.Add("periodictwins", "periodictwins twins shape\n"
"\t\tReturns the twins for the shape located on the opposite side of the periodic shape.",
__FILE__, GetTwins, group);
// Repetition commands
theCommands.Add("repeatshape", "repeatshape result -x/y/z times\n"
"\t\tRepeats the periodic shape in periodic directions required number of times.\n"
"\t\tresult - resulting shape;\n"
"\t\t-x/y/z times - direction for repetition and number of repetitions.",
__FILE__, RepeatShape, group);
theCommands.Add("clearrepetitions", "clearrepetitions [result]\n"
"\t\tClears all previous repetitions of the periodic shape.",
__FILE__, ClearRepetitions, group);
}
//=======================================================================
//function : MakePeriodic
//purpose :
//=======================================================================
Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc < 5)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
// Get the shape to make periodic
TopoDS_Shape aShape = DBRep::Get(theArgv[2]);
if (aShape.IsNull())
{
theDI << "Error: " << theArgv[2] << " is a null shape.\n";
return 1;
}
ThePeriodicityMaker.Clear();
ThePeriodicityMaker.SetShape(aShape);
for (Standard_Integer i = 3; i < theArgc;)
{
// Get periodicity
Standard_Integer iDir = i;
Standard_Integer aDirID = -1;
if (!strcasecmp(theArgv[i], "-x"))
aDirID = 0;
else if (!strcasecmp(theArgv[i], "-y"))
aDirID = 1;
else if (!strcasecmp(theArgv[i], "-z"))
aDirID = 2;
else
{
theDI << theArgv[i] << " - Invalid key\n";
return 1;
}
char cDirName[2];
sprintf(cDirName, "%c", theArgv[iDir][1]);
if (theArgc == (i + 1))
{
theDI << "Period for " << cDirName << " direction is not set\n";
return 1;
}
Standard_Real aPeriod = Draw::Atof(theArgv[++i]);
ThePeriodicityMaker.MakePeriodic(aDirID, Standard_True, aPeriod);
++i;
if (theArgc > i + 1)
{
// Check if trimming is necessary
if (!strcmp(theArgv[i], "-trim"))
{
if (theArgc == (i + 1))
{
theDI << "Trim bounds for " << cDirName << " direction are not set\n";
return 1;
}
Standard_Real aFirst = Draw::Atof(theArgv[++i]);
ThePeriodicityMaker.SetTrimmed(aDirID, Standard_False, aFirst);
++i;
}
}
}
ThePeriodicityMaker.SetRunParallel(BOPTest_Objects::RunParallel());
// Perform operation
ThePeriodicityMaker.Perform();
// Print Error/Warning messages
BOPTest::ReportAlerts(ThePeriodicityMaker.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
if (ThePeriodicityMaker.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = ThePeriodicityMaker.Shape();
DBRep::Set(theArgv[1], aResult);
return 0;
}
//=======================================================================
//function : GetTwin
//purpose :
//=======================================================================
Standard_Integer GetTwins(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc != 3)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
// Get the shape to find twins
TopoDS_Shape aShape = DBRep::Get(theArgv[2]);
if (aShape.IsNull())
{
theDI << "Error: " << theArgv[2] << " is a null shape.\n";
return 1;
}
const TopTools_ListOfShape& aTwins = ThePeriodicityMaker.GetTwins(aShape);
TopoDS_Shape aCTwins;
if (aTwins.IsEmpty())
theDI << "No twins for the shape.\n";
else if (aTwins.Extent() == 1)
aCTwins = aTwins.First();
else
{
BRep_Builder().MakeCompound(TopoDS::Compound(aCTwins));
for (TopTools_ListIteratorOfListOfShape it(aTwins); it.More(); it.Next())
BRep_Builder().Add(aCTwins, it.Value());
}
DBRep::Set(theArgv[1], aCTwins);
return 0;
}
//=======================================================================
//function : RepeatShape
//purpose :
//=======================================================================
Standard_Integer RepeatShape(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char ** theArgv)
{
if (theArgc < 4)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
for (Standard_Integer i = 2; i < theArgc; ++i)
{
Standard_Integer aDirID = -1;
if (!strcasecmp(theArgv[i], "-x"))
aDirID = 0;
else if (!strcasecmp(theArgv[i], "-y"))
aDirID = 1;
else if (!strcasecmp(theArgv[i], "-z"))
aDirID = 2;
else
{
theDI << theArgv[i] << " - Invalid key\n";
return 1;
}
char cDirName[2];
sprintf(cDirName, "%c", theArgv[i][1]);
Standard_Integer aTimes = 0;
if (theArgc > i + 1)
aTimes = Draw::Atoi(theArgv[++i]);
if (aTimes == 0)
{
theDI << "Number of repetitions for " << cDirName << " direction is not set\n";
return 1;
}
ThePeriodicityMaker.RepeatShape(aDirID, aTimes);
}
// Print Error/Warning messages
BOPTest::ReportAlerts(ThePeriodicityMaker.GetReport());
// Set the history of the operation in session
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
if (ThePeriodicityMaker.HasErrors())
return 0;
// Draw the result shape
const TopoDS_Shape& aResult = ThePeriodicityMaker.RepeatedShape();
DBRep::Set(theArgv[1], aResult);
return 0;
}
//=======================================================================
//function : ClearRepetitions
//purpose :
//=======================================================================
Standard_Integer ClearRepetitions(Draw_Interpretor&,
Standard_Integer theArgc,
const char **theArgv)
{
// Clear all previous repetitions
ThePeriodicityMaker.ClearRepetitions();
// Set the history of the operation in session
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
if (theArgc > 1)
DBRep::Set(theArgv[1], ThePeriodicityMaker.Shape());
return 0;
}

View File

@@ -6,13 +6,11 @@ BOPTest_CheckCommands.cxx
BOPTest_DrawableShape.cxx
BOPTest_DrawableShape.hxx
BOPTest_LowCommands.cxx
BOPTest_MkConnectedCommands.cxx
BOPTest_ObjCommands.cxx
BOPTest_Objects.cxx
BOPTest_Objects.hxx
BOPTest_OptionCommands.cxx
BOPTest_PartitionCommands.cxx
BOPTest_PeriodicityCommands.cxx
BOPTest_TolerCommands.cxx
BOPTest_DebugCommands.cxx
BOPTest_CellsCommands.cxx

View File

@@ -162,12 +162,29 @@ void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
//
BRep_Builder BB;
if (!aV1.IsNull()) {
BB.Add (E, aV1);
if (aP1 < aP2) {
BB.Add (E, TopoDS::Vertex(aV1.Oriented(TopAbs_FORWARD)));
}
else {
BB.Add (E, TopoDS::Vertex(aV1.Oriented(TopAbs_REVERSED)));
}
}
if (!aV2.IsNull()) {
BB.Add (E, aV2);
if (aP1 < aP2) {
BB.Add (E, TopoDS::Vertex(aV2.Oriented(TopAbs_REVERSED)));
}
else {
BB.Add (E, TopoDS::Vertex(aV2.Oriented(TopAbs_FORWARD)));
}
}
BB.Range(E, aP1, aP2);
if (aP1 < aP2) {
BB.Range(E, aP1, aP2);
}
else {
BB.Range(E, aP2, aP1);
}
aNewEdge=E;
aNewEdge.Orientation(aE.Orientation());
}

View File

@@ -1,7 +1,5 @@
// Created on: 1993-03-31
// Created by: NW,JPB,CAL
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -14,14 +12,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_SortType_HeaderFile
#define _Graphic3d_SortType_HeaderFile
#ifndef BOPTools_BoxBndTree_HeaderFile
#define BOPTools_BoxBndTree_HeaderFile
#include <Bnd_Box.hxx>
#include <BOPTools_BoxSelector.hxx>
#include <NCollection_UBTree.hxx>
#include <Standard_Integer.hxx>
enum Graphic3d_SortType
{
Graphic3d_ST_Simple,
Graphic3d_ST_BSP_Tree
};
typedef NCollection_UBTree<Standard_Integer, Bnd_Box> BOPTools_BoxBndTree;
typedef BOPTools_BoxSelector<Bnd_Box> BOPTools_BoxBndTreeSelector;
#endif // _Graphic3d_SortType_HeaderFile
#endif

View File

@@ -15,27 +15,32 @@
#ifndef BOPTools_BoxSelector_HeaderFile
#define BOPTools_BoxSelector_HeaderFile
#include <BVH_Traverse.hxx>
#include <BVH_BoxSet.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <NCollection_UBTree.hxx>
#include <Standard_Integer.hxx>
//! Template Selector for elements selection from BVH tree.
template <int Dimension>
class BOPTools_BoxSelector :
public BVH_Traverse <Standard_Real, Dimension, BVH_BoxSet <Standard_Real, Dimension, Standard_Integer>, Standard_Boolean>
//! Template Selector for the unbalanced binary tree
//! of overlapped bounding boxes.
template <class BoxType> class BOPTools_BoxSelector :
public NCollection_UBTree<Standard_Integer, BoxType>::Selector
{
public:
typedef typename BVH::VectorType<Standard_Real, Dimension>::Type BVH_VecNd;
public: //! @name Constructor
//! Empty constructor
BOPTools_BoxSelector() {};
public: //! @name public interfaces
//! Checks if the box should be rejected
virtual Standard_Boolean Reject(const BoxType& theOther) const
{
return myBox.IsOut(theOther);
}
//! Accepts the index
virtual Standard_Boolean Accept(const Standard_Integer& theIndex)
{
myIndices.Append(theIndex);
return Standard_True;
}
//! Clears the indices
void Clear()
@@ -44,7 +49,7 @@ public: //! @name public interfaces
}
//! Sets the box
void SetBox (const BVH_Box <Standard_Real, Dimension>& theBox)
void SetBox(const BoxType& theBox)
{
myBox = theBox;
}
@@ -55,46 +60,11 @@ public: //! @name public interfaces
return myIndices;
}
public: //! @name Rejection/Acceptance rules
private:
//! Checks if the box should be rejected
virtual Standard_Boolean RejectNode (const BVH_VecNd& theCMin,
const BVH_VecNd& theCMax,
Standard_Boolean& theIsInside) const Standard_OVERRIDE
{
Standard_Boolean hasOverlap;
theIsInside = myBox.Contains (theCMin, theCMax, hasOverlap);
return !hasOverlap;
}
BoxType myBox;
TColStd_ListOfInteger myIndices;
//! Rejects the element by the index
Standard_Boolean RejectElement (const Standard_Integer theIndex)
{
return myBox.IsOut (this->myBVHSet->Box (theIndex));
}
//! Accepts the index
virtual Standard_Boolean AcceptMetric (const Standard_Boolean& theIsInside) const Standard_OVERRIDE
{
return theIsInside;
}
//! Accepts the index
virtual Standard_Boolean Accept (const Standard_Integer theIndex,
const Standard_Boolean& theIsInside) Standard_OVERRIDE
{
if (theIsInside || !RejectElement (theIndex))
{
myIndices.Append (this->myBVHSet->Element (theIndex));
return Standard_True;
}
return Standard_False;
}
protected: //! @name Fields
BVH_Box <Standard_Real, Dimension> myBox; //!< Selection box
TColStd_ListOfInteger myIndices; //!< Selected indices
};
#endif

View File

@@ -1,47 +0,0 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2017 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.
#ifndef BOPTools_BoxTree_HeaderFile
#define BOPTools_BoxTree_HeaderFile
#include <BVH_BoxSet.hxx>
#include <BOPTools_BoxSelector.hxx>
#include <BOPTools_PairSelector.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <BVH_LinearBuilder.hxx>
//! Redefines BoxSet to use the Linear builder by default
template <class NumType, int Dimension, class DataType>
class BOPTools_BoxSet : public BVH_BoxSet <NumType, Dimension, DataType>
{
public: //! @name Constructors
//! Empty constructor for use the default BVH_Builder
BOPTools_BoxSet (const opencascade::handle <BVH_Builder <NumType, Dimension> >& theBuilder = NULL)
: BVH_BoxSet <NumType, Dimension, DataType> (theBuilder.IsNull() ? new BVH_LinearBuilder<NumType, Dimension>() : theBuilder)
{}
};
//! 2D definitions
typedef BOPTools_BoxSet <Standard_Real, 2, Standard_Integer> BOPTools_Box2dTree;
typedef BOPTools_BoxSelector<2> BOPTools_Box2dTreeSelector;
typedef BOPTools_PairSelector<2> BOPTools_Box2dPairSelector;
//! 3D definitions
typedef BOPTools_BoxSet <Standard_Real, 3, Standard_Integer> BOPTools_BoxTree;
typedef BOPTools_BoxSelector<3> BOPTools_BoxTreeSelector;
typedef BOPTools_PairSelector<3> BOPTools_BoxPairSelector;
#endif

View File

@@ -1,125 +0,0 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2017 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.
#ifndef BOPTools_PairSelector_HeaderFile
#define BOPTools_PairSelector_HeaderFile
#include <BVH_Traverse.hxx>
#include <BVH_BoxSet.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <algorithm>
//! Template Selector for elements selection from BVH tree.
template <int Dimension>
class BOPTools_PairSelector :
public BVH_PairTraverse <Standard_Real, Dimension, BVH_BoxSet <Standard_Real, Dimension, Standard_Integer>>
{
public: //! @name public types
//! Auxiliary structure to keep the pair of indices
struct PairIDs
{
PairIDs (const Standard_Integer theId1 = -1,
const Standard_Integer theId2 = -1)
: ID1 (theId1), ID2 (theId2)
{}
Standard_Boolean operator< (const PairIDs& theOther) const
{
return ID1 < theOther.ID1 ||
(ID1 == theOther.ID1 && ID2 < theOther.ID2);
}
Standard_Integer ID1;
Standard_Integer ID2;
};
typedef typename BVH::VectorType<Standard_Real, Dimension>::Type BVH_VecNd;
public: //! @name Constructor
//! Empty constructor
BOPTools_PairSelector()
: mySameBVHs (Standard_False)
{}
public: //! @name public interfaces
//! Clears the indices
void Clear()
{
myPairs.Clear();
}
//! Sorts the indices
void Sort()
{
std::sort (myPairs.begin(), myPairs.end());
}
//! Tells to selector that BVH trees are the same
void SetSame (const Standard_Boolean theIsSame)
{
mySameBVHs = theIsSame;
}
//! Returns the list of accepted indices
const std::vector<PairIDs>& Pairs() const
{
return myPairs;
}
public: //! @name Rejection/Acceptance rules
//! Checks if the box should be rejected
virtual Standard_Boolean RejectNode (const BVH_VecNd& theCMin1,
const BVH_VecNd& theCMax1,
const BVH_VecNd& theCMin2,
const BVH_VecNd& theCMax2,
Standard_Real&) const Standard_OVERRIDE
{
return BVH_Box<Standard_Real, 3> (theCMin1, theCMax1).IsOut (theCMin2, theCMax2);
}
//! Rejects the element by the index
Standard_Boolean RejectElement (const Standard_Integer theID1,
const Standard_Integer theID2)
{
return (mySameBVHs && theID1 >= theID2) ||
this->myBVHSet1->Box (theID1).IsOut(
this->myBVHSet2->Box (theID2));
}
//! Accepts the index
virtual Standard_Boolean Accept (const Standard_Integer theID1,
const Standard_Integer theID2) Standard_OVERRIDE
{
if (!RejectElement (theID1, theID2))
{
myPairs.push_back (PairIDs (this->myBVHSet1->Element (theID1),
this->myBVHSet2->Element (theID2)));
return Standard_True;
}
return Standard_False;
}
protected: //! @name Fields
std::vector<PairIDs> myPairs; //!< Selected pairs of indices
Standard_Boolean mySameBVHs; //!< Selection is performed from the same BVH trees
};
#endif

View File

@@ -8,14 +8,13 @@ BOPTools_AlgoTools3D.hxx
BOPTools_AlgoTools_1.cxx
BOPTools_AlgoTools_2.cxx
BOPTools_BoxSelector.hxx
BOPTools_BoxTree.hxx
BOPTools_BoxBndTree.hxx
BOPTools_ConnexityBlock.hxx
BOPTools_CoupleOfShape.hxx
BOPTools_IndexedDataMapOfSetShape.hxx
BOPTools_ListOfConnexityBlock.hxx
BOPTools_ListOfCoupleOfShape.hxx
BOPTools_MapOfSet.hxx
BOPTools_PairSelector.hxx
BOPTools_Parallel.hxx
BOPTools_Set.cxx
BOPTools_Set.hxx

View File

@@ -23,7 +23,7 @@
#include <BRep_TEdge.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TShape.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TEdge,TopoDS_TEdge)

View File

@@ -21,7 +21,7 @@
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_TShape.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TFace,TopoDS_TFace)

View File

@@ -19,7 +19,7 @@
#include <gp_Pnt.hxx>
#include <Standard_Type.hxx>
#include <TopAbs.hxx>
#include <TopoDS_TShape.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRep_TVertex,TopoDS_TVertex)

View File

@@ -179,7 +179,6 @@ private:
AppParCurves_Constraint myfirstC;
AppParCurves_Constraint mylastC;
Standard_Integer myMultiLineNb;
Standard_Integer myNbPlusOnePoint;
Standard_Boolean myIsClear;

View File

@@ -22,7 +22,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Wire.hxx>
//=======================================================================

View File

@@ -97,7 +97,7 @@ void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
aMaxDist=RealLast();
aIndice=0;
//
BRepAdaptor_Surface aSurf(aF, Standard_False);
BRepAdaptor_Surface aSurf(aF);
BRepTools::UVBounds(aF, aU1, aU2, aV1, aV2);
aExtrema.Initialize(aSurf, aU1, aU2, aV1, aV2, aTol, aTol);
//
@@ -128,3 +128,10 @@ void BRepClass_FaceClassifier::Perform(const TopoDS_Face& aF,
Perform(aF, aPuv, aTol);
}
}

View File

@@ -40,61 +40,45 @@ static const Standard_Real Probing_Step = 0.2111;
BRepClass_FaceExplorer::BRepClass_FaceExplorer(const TopoDS_Face& F) :
myFace(F),
myCurEdgeInd(1),
myCurEdgePar(Probing_Start),
myUMin (Precision::Infinite()),
myUMax (-Precision::Infinite()),
myVMin (Precision::Infinite()),
myVMax (-Precision::Infinite())
myCurEdgePar(Probing_Start)
{
myFace.Orientation(TopAbs_FORWARD);
}
//=======================================================================
//function : ComputeFaceBounds
//purpose :
//=======================================================================
void BRepClass_FaceExplorer::ComputeFaceBounds()
{
TopLoc_Location aLocation;
const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface (myFace, aLocation);
aSurface->Bounds (myUMin, myUMax, myVMin, myVMax);
if (Precision::IsInfinite (myUMin) || Precision::IsInfinite (myUMax) ||
Precision::IsInfinite (myVMin) || Precision::IsInfinite (myVMax))
{
BRepTools::UVBounds(myFace, myUMin, myUMax, myVMin, myVMax);
}
}
//=======================================================================
//function : CheckPoint
//purpose :
//=======================================================================
Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
Standard_Boolean BRepClass_FaceExplorer::CheckPoint(gp_Pnt2d& thePoint)
{
if (myUMin > myUMax)
Standard_Real anUMin = 0.0, anUMax = 0.0, aVMin = 0.0, aVMax = 0.0;
TopLoc_Location aLocation;
const Handle(Geom_Surface)& aSurface = BRep_Tool::Surface(myFace, aLocation);
aSurface->Bounds(anUMin, anUMax, aVMin, aVMax);
if (Precision::IsInfinite(anUMin) || Precision::IsInfinite(anUMax) ||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
{
ComputeFaceBounds();
BRepTools::UVBounds(myFace, anUMin, anUMax, aVMin, aVMax);
if (Precision::IsInfinite(anUMin) || Precision::IsInfinite(anUMax) ||
Precision::IsInfinite(aVMin) || Precision::IsInfinite(aVMax))
{
return Standard_True;
}
}
if (Precision::IsInfinite(myUMin) || Precision::IsInfinite(myUMax) ||
Precision::IsInfinite(myVMin) || Precision::IsInfinite(myVMax))
{
return Standard_True;
}
gp_Pnt2d aCenterPnt(( myUMin + myUMax ) / 2, ( myVMin + myVMax ) / 2);
gp_Pnt2d aCenterPnt(( anUMin + anUMax ) / 2, ( aVMin + aVMax ) / 2);
Standard_Real aDistance = aCenterPnt.Distance(thePoint);
if (Precision::IsInfinite(aDistance))
{
thePoint.SetCoord (myUMin - (myUMax - myUMin ),
myVMin - (myVMax - myVMin ));
thePoint.SetCoord(anUMin - ( anUMax - anUMin ),
aVMin - ( aVMax - aVMin ));
return Standard_False;
}
else
{
Standard_Real anEpsilon = Epsilon(aDistance);
if (anEpsilon > Max (myUMax - myUMin, myVMax - myVMin))
if (anEpsilon > Max(anUMax - anUMin, aVMax - aVMin))
{
gp_Vec2d aLinVec(aCenterPnt, thePoint);
gp_Dir2d aLinDir(aLinVec);

View File

@@ -99,8 +99,8 @@ public:
protected:
//! Computes UV bounds of a face
Standard_EXPORT void ComputeFaceBounds();
private:
@@ -113,10 +113,7 @@ private:
Standard_Integer myCurEdgeInd;
Standard_Real myCurEdgePar;
Standard_Real myUMin;
Standard_Real myUMax;
Standard_Real myVMin;
Standard_Real myVMax;
};

View File

@@ -37,7 +37,7 @@
static
void RefineTolerance(const TopoDS_Face& aF,
const Geom2dAdaptor_Curve& aC,
const BRepAdaptor_Curve2d& aC,
const Standard_Real aT,
Standard_Real& aTolZ);
@@ -72,7 +72,7 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
return;
}
//
Geom2dAdaptor_Curve C(aC2D, deb, fin);
BRepAdaptor_Curve2d C(EE, F);
//
deb = C.FirstParameter();
fin = C.LastParameter();
@@ -185,7 +185,7 @@ void BRepClass_Intersector::LocalGeometry(const BRepClass_Edge& E,
//purpose :
//=======================================================================
void RefineTolerance(const TopoDS_Face& aF,
const Geom2dAdaptor_Curve& aC,
const BRepAdaptor_Curve2d& aC,
const Standard_Real aT,
Standard_Real& aTolZ)
{

View File

@@ -83,35 +83,43 @@ Standard_Boolean BRepClass3d_BndBoxTreeSelectorLine::Accept (const Standard_Inte
if (sht == TopAbs_EDGE)
{
const TopoDS_Edge& E = TopoDS::Edge(shp);
Standard_Real EdgeTSq = BRep_Tool::Tolerance(E);
Standard_Real EdgeTSq = BRep_Tool::Tolerance(E);
EdgeTSq *= EdgeTSq;
Standard_Real f, l;
BRepAdaptor_Curve C(E);
BRep_Tool::Range(E,f,l);
BRep_Tool::Range(E, f, l);
// Edge-Line interference.
Extrema_ExtCC ExtCC(C, myLC, f, l, myLC.FirstParameter(), myLC.LastParameter());
if (ExtCC.IsDone() && ExtCC.NbExt() > 0)
{
Standard_Boolean IsInside = Standard_False;
for (Standard_Integer i = 1; i <= ExtCC.NbExt(); i++)
if (ExtCC.IsDone())
{
if (ExtCC.IsParallel())
{
if (ExtCC.SquareDistance(i) < EdgeTSq)
{
Extrema_POnCurv P1, P2;
ExtCC.Points(i,P1, P2);
EdgeParam EP;
EP.myE = E;
EP.myParam = P1.Parameter(); // Original curve is the first parameter.
EP.myLParam = P2.Parameter(); // Linear curve is the second parameter.
myEP.Append(EP);
IsInside = Standard_True;
}
// Tangent case is invalid for classification
myIsValid = Standard_False;
}
else if (ExtCC.NbExt() > 0)
{
Standard_Boolean IsInside = Standard_False;
for (Standard_Integer i = 1; i <= ExtCC.NbExt(); i++)
{
if (ExtCC.SquareDistance(i) < EdgeTSq)
{
Extrema_POnCurv P1, P2;
ExtCC.Points(i, P1, P2);
EdgeParam EP;
EP.myE = E;
EP.myParam = P1.Parameter(); // Original curve is the first parameter.
EP.myLParam = P2.Parameter(); // Linear curve is the second parameter.
myEP.Append(EP);
IsInside = Standard_True;
}
}
if (IsInside)
return Standard_True;
}
if (IsInside)
return Standard_True;
}
}
else if (sht == TopAbs_VERTEX)

View File

@@ -83,7 +83,9 @@ public:
public:
BRepClass3d_BndBoxTreeSelectorLine(const TopTools_IndexedMapOfShape& theMapOfShape)
: BRepClass3d_BndBoxTreeSelectorLine::Selector(), myMapOfShape (theMapOfShape)
: BRepClass3d_BndBoxTreeSelectorLine::Selector(),
myMapOfShape(theMapOfShape),
myIsValid(Standard_True)
{}
Standard_Boolean Reject (const Bnd_Box& theBox) const
@@ -135,6 +137,13 @@ public:
{
myEP.Clear();
myVP.Clear();
myIsValid = Standard_True;
}
//! Returns TRUE if correct classification is possible
Standard_Boolean IsCorrect() const
{
return myIsValid;
}
private:
@@ -147,6 +156,7 @@ private:
NCollection_Sequence<EdgeParam> myEP; //output result (edge vs line)
NCollection_Sequence<VertParam> myVP; //output result (vertex vs line)
GeomAdaptor_Curve myLC;
Standard_Boolean myIsValid;
};
#endif

View File

@@ -285,6 +285,14 @@ void BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer& SolidExplorer,
aSelectorLine.SetCurrentLine(L, Par);
Standard_Integer SelsEVL = 0;
SelsEVL = aTree.Select(aSelectorLine); //SelsEE > 0 => Line/Edges & Line/Vertex intersection
if (!aSelectorLine.IsCorrect())
{
// Go to the next segment
isFaultyLine = Standard_True;
continue;
}
if (SelsEVL > 0 )
{
// Line and edges / vertices interference.

View File

@@ -22,8 +22,7 @@
//purpose :
//=======================================================================
BRepExtrema_OverlapTool::BRepExtrema_OverlapTool()
: myFilter (NULL),
myTolerance (0.0)
: myFilter (NULL)
{
myIsDone = Standard_False;
}
@@ -34,8 +33,7 @@ BRepExtrema_OverlapTool::BRepExtrema_OverlapTool()
//=======================================================================
BRepExtrema_OverlapTool::BRepExtrema_OverlapTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Handle(BRepExtrema_TriangleSet)& theSet2)
: myFilter (NULL),
myTolerance (0.0)
: myFilter (NULL)
{
LoadTriangleSets (theSet1, theSet2);
}
@@ -59,6 +57,21 @@ void BRepExtrema_OverlapTool::LoadTriangleSets (const Handle(BRepExtrema_Triangl
namespace
{
//! Tool class to describe stack item in traverse function.
struct BRepExtrema_StackItem
{
Standard_Integer Node1;
Standard_Integer Node2;
BRepExtrema_StackItem (const Standard_Integer theNode1 = 0,
const Standard_Integer theNode2 = 0)
: Node1 (theNode1),
Node2 (theNode2)
{
//
}
};
//! Bounding triangular prism for specified triangle.
class BRepExtrema_BoundingPrism
{
@@ -504,163 +517,175 @@ namespace
}
//=======================================================================
//function : intersectTrianglesExact
//function : intersectTriangleRangesExact
//purpose :
//=======================================================================
void BRepExtrema_OverlapTool::intersectTrianglesExact (const Standard_Integer theTrgIdx1,
const Standard_Integer theTrgIdx2)
void BRepExtrema_OverlapTool::intersectTriangleRangesExact (const BVH_Vec4i& theLeaf1,
const BVH_Vec4i& theLeaf2)
{
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (theTrgIdx1);
BVH_Vec3d aTrg1Vert1;
BVH_Vec3d aTrg1Vert2;
BVH_Vec3d aTrg1Vert3;
mySet1->GetVertices (theTrgIdx1,
aTrg1Vert1,
aTrg1Vert2,
aTrg1Vert3);
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (theTrgIdx2);
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
for (Standard_Integer aTrgIdx1 = theLeaf1.y(); aTrgIdx1 <= theLeaf1.z(); ++aTrgIdx1)
{
return;
}
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (aTrgIdx1);
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (theTrgIdx1, theTrgIdx2);
BVH_Vec3d aTrg1Vert1;
BVH_Vec3d aTrg1Vert2;
BVH_Vec3d aTrg1Vert3;
if (aResult == BRepExtrema_ElementFilter::Overlap)
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
mySet1->GetVertices (aTrgIdx1,
aTrg1Vert1,
aTrg1Vert2,
aTrg1Vert3);
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
for (Standard_Integer aTrgIdx2 = theLeaf2.y(); aTrgIdx2 <= theLeaf2.z(); ++aTrgIdx2)
{
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (aTrgIdx2);
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
{
continue;
}
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (aTrgIdx1, aTrgIdx2);
if (aResult == BRepExtrema_ElementFilter::Overlap)
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
#ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES
if (mySet1 == mySet2)
{
myOverlapTriangles1.Add (theTrgIdx1);
myOverlapTriangles1.Add (theTrgIdx2);
}
else
{
myOverlapTriangles1.Add (theTrgIdx1);
myOverlapTriangles2.Add (theTrgIdx2);
}
if (mySet1 == mySet2)
{
myOverlapTriangles1.Add (aTrgIdx1);
myOverlapTriangles1.Add (aTrgIdx2);
}
else
{
myOverlapTriangles1.Add (aTrgIdx1);
myOverlapTriangles2.Add (aTrgIdx2);
}
#endif
}
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
{
BVH_Vec3d aTrg2Vert1;
BVH_Vec3d aTrg2Vert2;
BVH_Vec3d aTrg2Vert3;
}
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
{
BVH_Vec3d aTrg2Vert1;
BVH_Vec3d aTrg2Vert2;
BVH_Vec3d aTrg2Vert3;
mySet2->GetVertices (theTrgIdx2, aTrg2Vert1, aTrg2Vert2, aTrg2Vert3);
mySet2->GetVertices (aTrgIdx2, aTrg2Vert1, aTrg2Vert2, aTrg2Vert3);
if (trianglesIntersected (aTrg1Vert1,
aTrg1Vert2,
aTrg1Vert3,
aTrg2Vert1,
aTrg2Vert2,
aTrg2Vert3))
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
if (trianglesIntersected (aTrg1Vert1,
aTrg1Vert2,
aTrg1Vert3,
aTrg2Vert1,
aTrg2Vert2,
aTrg2Vert3))
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
#ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES
if (mySet1 == mySet2)
{
myOverlapTriangles1.Add (theTrgIdx1);
myOverlapTriangles1.Add (theTrgIdx2);
}
else
{
myOverlapTriangles1.Add (theTrgIdx1);
myOverlapTriangles2.Add (theTrgIdx2);
}
if (mySet1 == mySet2)
{
myOverlapTriangles1.Add (aTrgIdx1);
myOverlapTriangles1.Add (aTrgIdx2);
}
else
{
myOverlapTriangles1.Add (aTrgIdx1);
myOverlapTriangles2.Add (aTrgIdx2);
}
#endif
}
}
}
}
}
//=======================================================================
//function : intersectTrianglesToler
//function : intersectTriangleRangesToler
//purpose :
//=======================================================================
void BRepExtrema_OverlapTool::intersectTrianglesToler (const Standard_Integer theTrgIdx1,
const Standard_Integer theTrgIdx2,
const Standard_Real theToler)
void BRepExtrema_OverlapTool::intersectTriangleRangesToler (const BVH_Vec4i& theLeaf1,
const BVH_Vec4i& theLeaf2,
const Standard_Real theToler)
{
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (theTrgIdx1);
BVH_Vec3d aTrg1Vert1;
BVH_Vec3d aTrg1Vert2;
BVH_Vec3d aTrg1Vert3;
mySet1->GetVertices (theTrgIdx1,
aTrg1Vert1,
aTrg1Vert2,
aTrg1Vert3);
BRepExtrema_BoundingPrism aPrism1; // not initialized
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (theTrgIdx2);
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
for (Standard_Integer aTrgIdx1 = theLeaf1.y(); aTrgIdx1 <= theLeaf1.z(); ++aTrgIdx1)
{
return;
}
const Standard_Integer aFaceIdx1 = mySet1->GetFaceID (aTrgIdx1);
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (theTrgIdx1, theTrgIdx2);
BVH_Vec3d aTrg1Vert1;
BVH_Vec3d aTrg1Vert2;
BVH_Vec3d aTrg1Vert3;
if (aResult == BRepExtrema_ElementFilter::Overlap)
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
mySet1->GetVertices (aTrgIdx1,
aTrg1Vert1,
aTrg1Vert2,
aTrg1Vert3);
BRepExtrema_BoundingPrism aPrism1; // not initialized
const Standard_Boolean aIsInSet = myOverlapSubShapes1.IsBound (aFaceIdx1);
for (Standard_Integer aTrgIdx2 = theLeaf2.y(); aTrgIdx2 <= theLeaf2.z(); ++aTrgIdx2)
{
const Standard_Integer aFaceIdx2 = mySet2->GetFaceID (aTrgIdx2);
if (aIsInSet && myOverlapSubShapes1.Find (aFaceIdx1).Contains (aFaceIdx2))
{
continue;
}
BRepExtrema_ElementFilter::FilterResult aResult = myFilter == NULL ?
BRepExtrema_ElementFilter::DoCheck : myFilter->PreCheckElements (aTrgIdx1, aTrgIdx2);
if (aResult == BRepExtrema_ElementFilter::Overlap)
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
#ifdef OVERLAP_TOOL_OUTPUT_TRIANGLES
if (mySet1 == mySet2)
{
myOverlapTriangles1.Add (theTrgIdx1);
myOverlapTriangles1.Add (theTrgIdx2);
}
else
{
myOverlapTriangles1.Add (theTrgIdx1);
myOverlapTriangles2.Add (theTrgIdx2);
}
if (mySet1 == mySet2)
{
myOverlapTriangles1.Add (aTrgIdx1);
myOverlapTriangles1.Add (aTrgIdx2);
}
else
{
myOverlapTriangles1.Add (aTrgIdx1);
myOverlapTriangles2.Add (aTrgIdx2);
}
#endif
}
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
{
if (!aPrism1.IsInited)
{
aPrism1.Init (aTrg1Vert1, aTrg1Vert2, aTrg1Vert3, theToler);
}
}
else if (aResult == BRepExtrema_ElementFilter::DoCheck)
{
if (!aPrism1.IsInited)
{
aPrism1.Init (aTrg1Vert1, aTrg1Vert2, aTrg1Vert3, theToler);
}
BVH_Vec3d aTrg2Vert1;
BVH_Vec3d aTrg2Vert2;
BVH_Vec3d aTrg2Vert3;
BVH_Vec3d aTrg2Vert1;
BVH_Vec3d aTrg2Vert2;
BVH_Vec3d aTrg2Vert3;
mySet2->GetVertices (theTrgIdx2,
aTrg2Vert1,
aTrg2Vert2,
aTrg2Vert3);
mySet2->GetVertices (aTrgIdx2,
aTrg2Vert1,
aTrg2Vert2,
aTrg2Vert3);
BRepExtrema_BoundingPrism aPrism2 (aTrg2Vert1,
aTrg2Vert2,
aTrg2Vert3,
theToler);
BRepExtrema_BoundingPrism aPrism2 (aTrg2Vert1,
aTrg2Vert2,
aTrg2Vert3,
theToler);
if (prismsIntersected (aPrism1, aPrism2))
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
if (prismsIntersected (aPrism1, aPrism2))
{
getSetOfFaces (myOverlapSubShapes1, aFaceIdx1).Add (aFaceIdx2);
getSetOfFaces (myOverlapSubShapes2, aFaceIdx2).Add (aFaceIdx1);
}
}
}
}
}
@@ -671,38 +696,136 @@ void BRepExtrema_OverlapTool::intersectTrianglesToler (const Standard_Integer th
//=======================================================================
void BRepExtrema_OverlapTool::Perform (const Standard_Real theTolerance)
{
myTolerance = theTolerance;
myIsDone = (this->Select(mySet1->BVH(), mySet2->BVH()) > 0);
}
//=======================================================================
//function : Branch rejection
//purpose :
//=======================================================================
Standard_Boolean BRepExtrema_OverlapTool::RejectNode (const BVH_Vec3d& theCornerMin1,
const BVH_Vec3d& theCornerMax1,
const BVH_Vec3d& theCornerMin2,
const BVH_Vec3d& theCornerMax2,
Standard_Real&) const
{
return !overlapBoxes (theCornerMin1, theCornerMax1, theCornerMin2, theCornerMax2, myTolerance);
}
//=======================================================================
//function : Leaf acceptance
//purpose :
//=======================================================================
Standard_Boolean BRepExtrema_OverlapTool::Accept (const Standard_Integer theTrgIdx1,
const Standard_Integer theTrgIdx2)
{
if (myTolerance == 0.0)
if (mySet1.IsNull() || mySet2.IsNull())
{
intersectTrianglesExact (theTrgIdx1, theTrgIdx2);
return;
}
else
BRepExtrema_StackItem aStack[96];
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVH1 = mySet1->BVH();
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVH2 = mySet2->BVH();
if (aBVH1.IsNull() || aBVH2.IsNull())
{
intersectTrianglesToler (theTrgIdx1, theTrgIdx2, myTolerance);
return;
}
return Standard_True;
BRepExtrema_StackItem aNodes; // current pair of nodes
Standard_Integer aHead = -1; // stack head position
for (;;)
{
BVH_Vec4i aNodeData1 = aBVH1->NodeInfoBuffer()[aNodes.Node1];
BVH_Vec4i aNodeData2 = aBVH2->NodeInfoBuffer()[aNodes.Node2];
if (aNodeData1.x() != 0 && aNodeData2.x() != 0) // leaves
{
if (theTolerance == 0.0)
{
intersectTriangleRangesExact (aNodeData1, aNodeData2);
}
else
{
intersectTriangleRangesToler (aNodeData1, aNodeData2, theTolerance);
}
if (aHead < 0)
break;
aNodes = aStack[aHead--];
}
else
{
BRepExtrema_StackItem aPairsToProcess[4];
Standard_Integer aNbPairs = 0;
if (aNodeData1.x() == 0) // inner node
{
const BVH_Vec3d& aMinPntLft1 = aBVH1->MinPoint (aNodeData1.y());
const BVH_Vec3d& aMaxPntLft1 = aBVH1->MaxPoint (aNodeData1.y());
const BVH_Vec3d& aMinPntRgh1 = aBVH1->MinPoint (aNodeData1.z());
const BVH_Vec3d& aMaxPntRgh1 = aBVH1->MaxPoint (aNodeData1.z());
if (aNodeData2.x() == 0) // inner node
{
const BVH_Vec3d& aMinPntLft2 = aBVH2->MinPoint (aNodeData2.y());
const BVH_Vec3d& aMaxPntLft2 = aBVH2->MaxPoint (aNodeData2.y());
const BVH_Vec3d& aMinPntRgh2 = aBVH2->MinPoint (aNodeData2.z());
const BVH_Vec3d& aMaxPntRgh2 = aBVH2->MaxPoint (aNodeData2.z());
if (overlapBoxes (aMinPntLft1, aMaxPntLft1, aMinPntLft2, aMaxPntLft2, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.y(), aNodeData2.y());
}
if (overlapBoxes (aMinPntLft1, aMaxPntLft1, aMinPntRgh2, aMaxPntRgh2, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.y(), aNodeData2.z());
}
if (overlapBoxes (aMinPntRgh1, aMaxPntRgh1, aMinPntLft2, aMaxPntLft2, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.z(), aNodeData2.y());
}
if (overlapBoxes (aMinPntRgh1, aMaxPntRgh1, aMinPntRgh2, aMaxPntRgh2, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.z(), aNodeData2.z());
}
}
else
{
const BVH_Vec3d& aMinPntLeaf = aBVH2->MinPoint (aNodes.Node2);
const BVH_Vec3d& aMaxPntLeaf = aBVH2->MaxPoint (aNodes.Node2);
if (overlapBoxes (aMinPntLft1, aMaxPntLft1, aMinPntLeaf, aMaxPntLeaf, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.y(), aNodes.Node2);
}
if (overlapBoxes (aMinPntRgh1, aMaxPntRgh1, aMinPntLeaf, aMaxPntLeaf, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodeData1.z(), aNodes.Node2);
}
}
}
else
{
const BVH_Vec3d& aMinPntLeaf = aBVH1->MinPoint (aNodes.Node1);
const BVH_Vec3d& aMaxPntLeaf = aBVH1->MaxPoint (aNodes.Node1);
const BVH_Vec3d& aMinPntLft2 = aBVH2->MinPoint (aNodeData2.y());
const BVH_Vec3d& aMaxPntLft2 = aBVH2->MaxPoint (aNodeData2.y());
const BVH_Vec3d& aMinPntRgh2 = aBVH2->MinPoint (aNodeData2.z());
const BVH_Vec3d& aMaxPntRgh2 = aBVH2->MaxPoint (aNodeData2.z());
if (overlapBoxes (aMinPntLft2, aMaxPntLft2, aMinPntLeaf, aMaxPntLeaf, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodes.Node1, aNodeData2.y());
}
if (overlapBoxes (aMinPntRgh2, aMaxPntRgh2, aMinPntLeaf, aMaxPntLeaf, theTolerance))
{
aPairsToProcess[aNbPairs++] = BRepExtrema_StackItem (aNodes.Node1, aNodeData2.z());
}
}
if (aNbPairs > 0)
{
aNodes = aPairsToProcess[0];
for (Standard_Integer anIdx = 1; anIdx < aNbPairs; ++anIdx)
{
aStack[++aHead] = aPairsToProcess[anIdx];
}
}
else
{
if (aHead < 0)
break;
aNodes = aStack[aHead--];
}
}
}
myIsDone = Standard_True;
}

View File

@@ -16,10 +16,10 @@
#ifndef _BRepExtrema_OverlapTool_HeaderFile
#define _BRepExtrema_OverlapTool_HeaderFile
#include <BVH_Geometry.hxx>
#include <BRepExtrema_TriangleSet.hxx>
#include <BRepExtrema_ElementFilter.hxx>
#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
#include <BVH_Traverse.hxx>
//! Enables storing of individual overlapped triangles (useful for debug).
// #define OVERLAP_TOOL_OUTPUT_TRIANGLES
@@ -35,7 +35,7 @@
//! In second case, tessellation of single shape will be tested for self-
//! intersections. Please note that algorithm results are approximate and
//! depend greatly on the quality of input tessellation(s).
class BRepExtrema_OverlapTool : public BVH_PairTraverse <Standard_Real, 3>
class BRepExtrema_OverlapTool
{
public:
@@ -78,30 +78,16 @@ public:
//! Sets filtering tool for preliminary checking pairs of mesh elements.
void SetElementFilter (BRepExtrema_ElementFilter* theFilter) { myFilter = theFilter; }
public: //! @name Reject/Accept implementations
//! Defines the rules for node rejection by bounding box
Standard_EXPORT virtual Standard_Boolean RejectNode (const BVH_Vec3d& theCornerMin1,
const BVH_Vec3d& theCornerMax1,
const BVH_Vec3d& theCornerMin2,
const BVH_Vec3d& theCornerMax2,
Standard_Real&) const Standard_OVERRIDE;
//! Defines the rules for leaf acceptance
Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theLeaf1,
const Standard_Integer theLeaf2) Standard_OVERRIDE;
protected:
//! Performs narrow-phase of overlap test (exact intersection).
void intersectTrianglesExact (const Standard_Integer theTrgIdx1,
const Standard_Integer theTrgIdx2);
void intersectTriangleRangesExact (const BVH_Vec4i& theLeaf1,
const BVH_Vec4i& theLeaf2);
//! Performs narrow-phase of overlap test (intersection with non-zero tolerance).
void intersectTrianglesToler (const Standard_Integer theTrgIdx1,
const Standard_Integer theTrgIdx2,
const Standard_Real theToler);
void intersectTriangleRangesToler (const BVH_Vec4i& theLeaf1,
const BVH_Vec4i& theLeaf2,
const Standard_Real theToler);
private:
@@ -127,8 +113,6 @@ private:
//! Is overlap test test completed?
Standard_Boolean myIsDone;
Standard_Real myTolerance;
};
#endif // _BRepExtrema_OverlapTool_HeaderFile

View File

@@ -16,6 +16,7 @@
#ifndef _BRepExtrema_ShapeProximity_HeaderFile
#define _BRepExtrema_ShapeProximity_HeaderFile
#include <BVH_Geometry.hxx>
#include <NCollection_DataMap.hxx>
#include <TColStd_PackedMapOfInteger.hxx>

View File

@@ -227,16 +227,6 @@ BRepFill_MultiLine::BRepFill_MultiLine(const TopoDS_Face& Face1,
Precision::PConfusion(),
Vmin, Vmax);
}
if (GAS1.GetType() == GeomAbs_Sphere) {
if (myIsoU1)
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Umin, Umax);
else
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Vmin, Vmax);
}
// end try duplication
myU1 = Geom2dAdaptor_Curve(GeomProjLib::Curve2d(UU1, BasisPlane),
@@ -343,16 +333,6 @@ BRepFill_MultiLine::BRepFill_MultiLine(const TopoDS_Face& Face1,
Precision::PConfusion(),
Vmin, Vmax);
}
if (GAS2.GetType() == GeomAbs_Sphere) {
if (myIsoU2)
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Umin, Umax);
else
ElCLib::AdjustPeriodic(-M_PI/2.,M_PI/2.,
Precision::PConfusion(),
Vmin, Vmax);
}
// end try duplication
myU2 = Geom2dAdaptor_Curve(GeomProjLib::Curve2d(UU2, BasisPlane),

View File

@@ -2092,11 +2092,11 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
BRep_Builder B;
Standard_Integer NbPath = ILast - IFirst;
Standard_Integer NbLaw = mySec->NbLaw();
Standard_Boolean uclose, vclose, constSection, hasdegen = Standard_False;
Standard_Boolean uclose, vclose, global_vclose, constSection, hasdegen = Standard_False;
constSection = mySec->IsConstant();
uclose = mySec->IsUClosed();
vclose = (mySec->IsVClosed() && myLoc->IsClosed()) &&
(NbPath == myLoc->NbLaw()) && (myLoc->IsG1(0, myTol3d)>= 0);
global_vclose = (myLoc->IsClosed()) && (myLoc->IsG1(0, myTol3d)>= 0);
vclose = global_vclose && (mySec->IsVClosed()) && (NbPath == myLoc->NbLaw());
Error = 0.;
// (1) Construction of all surfaces
@@ -2675,7 +2675,10 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
myTol3d);
else
{
if (ipath != NbPath || vclose)
if (ipath != NbPath ||
vclose ||
(global_vclose && ILast == myLoc->NbLaw()+1))
UpdateEdge(TopoDS::Edge(VEdge(isec, ipath+1)),
S, exuv, VLast);
else //ipath == NbPath && !vclose => rebuild last edge

View File

@@ -2182,15 +2182,12 @@ static Standard_Real ComputeAveragePlaneAndMaxDeviation(const TopoDS_Shape& aWir
gp_Pln& thePlane,
Standard_Boolean& IsSingular)
{
Standard_Integer N = 40, nedges = 0;
TopoDS_Iterator iter( aWire );
for (; iter.More(); iter.Next())
nedges++;
Standard_Integer N = 40;
Standard_Integer nedges = aWire.NbChildren();
TColgp_Array1OfPnt Pnts( 1, nedges*N );
Standard_Integer ind = 1, i;
for (iter.Initialize(aWire); iter.More(); iter.Next())
for (TopoDS_Iterator iter (aWire); iter.More(); iter.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge( iter.Value() );
BRepAdaptor_Curve aCurve(anEdge);

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