mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
70 Commits
CR27319
...
V7_0_winwe
Author | SHA1 | Date | |
---|---|---|---|
|
913295d5dd | ||
|
9c1519c4c5 | ||
|
6f21399c0d | ||
|
9d1bf7ae05 | ||
|
1b9f5d9504 | ||
|
907fb7a5e0 | ||
|
9d671cd1b0 | ||
|
bd80ecfa61 | ||
|
747db83cdd | ||
|
6728599615 | ||
|
f117cc5a81 | ||
|
67e26cc101 | ||
|
77a6c8313f | ||
|
473cddc1d9 | ||
|
854e0d4a27 | ||
|
f84bf635f0 | ||
|
1ec75a485b | ||
|
c1609fbea6 | ||
|
91d9637224 | ||
|
be5c360207 | ||
|
83b0f13a58 | ||
|
52db475165 | ||
|
93dc7934db | ||
|
34e4e9f26e | ||
|
a3d2cb2425 | ||
|
4b445d1848 | ||
|
b819ae67ce | ||
|
c574faecb9 | ||
|
b0fbc5796a | ||
|
625e195819 | ||
|
402cfabc21 | ||
|
1e7ac41bf8 | ||
|
77887d30d8 | ||
|
b94d48585b | ||
|
50d06d8fcf | ||
|
5ae6e53dec | ||
|
41e08b4df8 | ||
|
a002d297f7 | ||
|
f2b6318110 | ||
|
7d46a9ed8b | ||
|
88d533be65 | ||
|
6b52f1253e | ||
|
38c2acd423 | ||
|
55fb31dae4 | ||
|
882e1d11aa | ||
|
871776ea38 | ||
|
09eca2b5b3 | ||
|
5501f9a946 | ||
|
e64622331f | ||
|
264abd72f2 | ||
|
e5260e1dfa | ||
|
e1c1b6b9f4 | ||
|
f02e43eb35 | ||
|
0911d065ff | ||
|
3d370858dd | ||
|
3e6a4cd02a | ||
|
38f24151f6 | ||
|
4613a51fd4 | ||
|
aa1b48c7dd | ||
|
18151f1aa1 | ||
|
15a954deb5 | ||
|
8d0b864941 | ||
|
c9de149dec | ||
|
a1530ab1b8 | ||
|
c59fcd1186 | ||
|
b7b2f85ac1 | ||
|
8e509b0ba1 | ||
|
a9b51f4977 | ||
|
5951a08873 | ||
|
5950d7816e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -49,6 +49,7 @@ Release
|
||||
/*.m4
|
||||
/*.ac
|
||||
/*.sh
|
||||
/codeblocks.bat
|
||||
/custom.bat
|
||||
/autom4te.cache
|
||||
/build_configure
|
||||
|
@@ -294,6 +294,10 @@ else()
|
||||
OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set (INSTALL_NAME_DIR "" CACHE STRING "install_name library suffix on OS X (e.g. @executable_path/../Frameworks)")
|
||||
endif()
|
||||
|
||||
# a directory recognized as a 'patch' for OCCT
|
||||
set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}")
|
||||
|
||||
@@ -800,6 +804,8 @@ endif()
|
||||
set (OCCT_MODULES_ENABLED)
|
||||
set (OCCT_LIBRARIES)
|
||||
set (SET_OpenCASCADE_MODULES_TOOLKITS "\n# List of available OpenCASCADE libraries for each module\n")
|
||||
set (OCCT_COMPILE_DEFINITIONS)
|
||||
|
||||
foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
|
||||
if (TARGET ${OCCT_TOOLKIT})
|
||||
|
||||
@@ -812,10 +818,33 @@ foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
|
||||
get_target_property (${OCCT_TOOLKIT}_MODULE ${OCCT_TOOLKIT} "MODULE")
|
||||
list (APPEND OCCT_MODULES_ENABLED ${${OCCT_TOOLKIT}_MODULE})
|
||||
list (APPEND OpenCASCADE_${${OCCT_TOOLKIT}_MODULE}_TOOLKITS ${OCCT_TOOLKIT})
|
||||
|
||||
# get compile definitions of target directory
|
||||
get_directory_property (COMPILE_DEFINITIONS DIRECTORY "${${OCCT_TOOLKIT}_SOURCE_DIR}" "COMPILE_DEFINITIONS")
|
||||
list (APPEND OCCT_COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED)
|
||||
list (REMOVE_DUPLICATES OCCT_COMPILE_DEFINITIONS)
|
||||
|
||||
# export compile definitions and C/C++ flags for each configuration to OpenCASCADE config files
|
||||
foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
|
||||
set (SET_OpenCASCADE_COMPILE_DEFINITIONS)
|
||||
string (TOUPPER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_UPPER)
|
||||
string (TOLOWER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_LOWER)
|
||||
foreach(COMPILE_DEFINITION ${OCCT_COMPILE_DEFINITIONS})
|
||||
string(REPLACE "(" "\\(" COMPILE_DEFINITION "${COMPILE_DEFINITION}")
|
||||
string(REPLACE ")" "\\)" COMPILE_DEFINITION "${COMPILE_DEFINITION}")
|
||||
set (SET_OpenCASCADE_COMPILE_DEFINITIONS "${SET_OpenCASCADE_COMPILE_DEFINITIONS}set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${OCCT_CONFIGURATION}>:${COMPILE_DEFINITION}>)\n")
|
||||
endforeach()
|
||||
set (SET_OpenCASCADE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
|
||||
set (SET_OpenCASCADE_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in" "OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" @ONLY)
|
||||
endforeach()
|
||||
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
|
||||
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
|
||||
install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
|
||||
|
||||
foreach (OCCT_MODULE ${OCCT_MODULES})
|
||||
if (BUILD_MODULE_${OCCT_MODULE})
|
||||
|
@@ -176,6 +176,11 @@ endif()
|
||||
if (CURRENT_MODULE)
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Modules/${CURRENT_MODULE}")
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
|
||||
if (APPLE)
|
||||
if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
|
||||
set_target_properties (${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "${INSTALL_NAME_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
|
||||
@@ -230,6 +235,21 @@ if (APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Update list of used VTK libraries if OpenGL2 Rendering BackEnd is used.
|
||||
# Add VTK_OPENGL2_BACKEND definition.
|
||||
if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
|
||||
add_definitions(-DVTK_OPENGL2_BACKEND)
|
||||
foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
|
||||
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
|
||||
if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
|
||||
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
|
||||
if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
|
||||
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
|
||||
endif()
|
||||
|
@@ -231,7 +231,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_NAME)
|
||||
endif()
|
||||
|
||||
# install tbb/tbbmalloc
|
||||
if (INSTALL_${PRODUCT_NAME})
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
|
||||
|
@@ -55,7 +55,7 @@ endif()
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TCL)
|
||||
|
||||
# use default (CMake) TCL search
|
||||
find_package(TCL)
|
||||
find_package(TCL QUIET)
|
||||
|
||||
# tcl include dir
|
||||
if (NOT 3RDPARTY_TCL_INCLUDE_DIR)
|
||||
@@ -291,4 +291,4 @@ if (NOT BUILD_SHARED_LIBS)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TCL_DLL_DIR)
|
||||
OCCT_CHECK_AND_UNSET (INSTALL_TCL)
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -59,7 +59,7 @@ endif()
|
||||
COMPLIANCE_PRODUCT_CONSISTENCY(TK)
|
||||
|
||||
# use default (CMake) TCL search
|
||||
find_package(TCL)
|
||||
find_package(TCL QUIET)
|
||||
|
||||
# tk include dir
|
||||
if (NOT 3RDPARTY_TK_INCLUDE_DIR)
|
||||
@@ -283,4 +283,4 @@ if (NOT BUILD_SHARED_LIBS)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL)
|
||||
OCCT_CHECK_AND_UNSET (3RDPARTY_TK_DLL_DIR)
|
||||
OCCT_CHECK_AND_UNSET (INSTALL_TK)
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -371,8 +371,8 @@ entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
|
||||
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
|
||||
|
||||
#
|
||||
checkbutton .myFrame.myHxxChecks.myScutsCheck -offvalue "false" -onvalue "true" -variable SHORTCUT_HEADERS
|
||||
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Create short-cuts to headers in inc folder instead of copying"
|
||||
ttk::combobox .myFrame.myHxxChecks.myScutsCombo -values { {ShortCut} {Copy} {HardLink} } -textvariable SHORTCUT_HEADERS -state readonly -width 12
|
||||
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Strategy for filling headers folder inc:"
|
||||
|
||||
#
|
||||
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
|
||||
@@ -384,6 +384,10 @@ checkbutton .myFrame.myChecks.myGl2psCheck -offvalue "false" -onvalue "true
|
||||
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(platform)" == "windows" } {
|
||||
checkbutton .myFrame.myChecks.myD3dCheck -offvalue "false" -onvalue "true" -variable HAVE_D3D -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myD3dLbl -text "Use Direct3D"
|
||||
}
|
||||
#checkbutton .myFrame.myChecks.myOpenClCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENCL -command wokdep:gui:UpdateList
|
||||
#ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL"
|
||||
checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX
|
||||
@@ -465,8 +469,8 @@ if { "$tcl_platform(platform)" == "windows" } {
|
||||
|
||||
#
|
||||
grid .myFrame.myHxxChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
grid .myFrame.myHxxChecks.myScutsCheck -row 0 -column 0
|
||||
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 1
|
||||
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 0
|
||||
grid .myFrame.myHxxChecks.myScutsCombo -row 0 -column 1
|
||||
incr aRowIter
|
||||
#
|
||||
grid .myFrame.mySrchLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
@@ -483,6 +487,10 @@ grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
|
||||
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
|
||||
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 4 -sticky e
|
||||
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 5 -sticky w
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
}
|
||||
#grid .myFrame.myChecks.myOpenClCheck -row $aCheckRowIter -column 6 -sticky e
|
||||
#grid .myFrame.myChecks.myOpenClLbl -row $aCheckRowIter -column 7 -sticky w
|
||||
incr aCheckRowIter
|
||||
|
@@ -41,11 +41,12 @@ if { "$tcl_platform(platform)" == "unix" } {
|
||||
set VCVARS ""
|
||||
}
|
||||
|
||||
set SHORTCUT_HEADERS "true"
|
||||
set SHORTCUT_HEADERS "ShortCut"
|
||||
|
||||
set HAVE_FREEIMAGE "false"
|
||||
set HAVE_GL2PS "false"
|
||||
set HAVE_TBB "false"
|
||||
set HAVE_D3D "false"
|
||||
set HAVE_OPENCL "false"
|
||||
set HAVE_VTK "false"
|
||||
set MACOSX_USE_GLX "false"
|
||||
@@ -72,6 +73,9 @@ if { [info exists ::env(VCVARS)] } {
|
||||
}
|
||||
if { [info exists ::env(SHORTCUT_HEADERS)] } {
|
||||
set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
|
||||
if { $SHORTCUT_HEADERS == "true" } {
|
||||
set SHORTCUT_HEADERS "ShortCut"
|
||||
}
|
||||
}
|
||||
if { [info exists ::env(HAVE_FREEIMAGE)] } {
|
||||
set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)"
|
||||
@@ -82,6 +86,9 @@ if { [info exists ::env(HAVE_GL2PS)] } {
|
||||
if { [info exists ::env(HAVE_TBB)] } {
|
||||
set HAVE_TBB "$::env(HAVE_TBB)"
|
||||
}
|
||||
if { [info exists ::env(HAVE_D3D)] } {
|
||||
set HAVE_D3D "$::env(HAVE_D3D)"
|
||||
}
|
||||
if { [info exists ::env(HAVE_OPENCL)] } {
|
||||
set HAVE_OPENCL "$::env(HAVE_OPENCL)"
|
||||
}
|
||||
@@ -949,6 +956,7 @@ proc wokdep:SaveCustom {} {
|
||||
puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
|
||||
puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
|
||||
puts $aFile "set HAVE_TBB=$::HAVE_TBB"
|
||||
puts $aFile "set HAVE_D3D=$::HAVE_D3D"
|
||||
puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
|
||||
puts $aFile "set HAVE_VTK=$::HAVE_VTK"
|
||||
puts $aFile "set CHECK_QT4=$::CHECK_QT4"
|
||||
|
@@ -639,16 +639,27 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
}
|
||||
}
|
||||
}
|
||||
lsort -unique $anUsedToolKits
|
||||
set anUsedToolKits [lsort -unique $anUsedToolKits]
|
||||
|
||||
set anUnits {}
|
||||
foreach anUsedToolKit $anUsedToolKits {
|
||||
set anUnits [concat $anUnits [osutils:tk:units $anUsedToolKit]]
|
||||
}
|
||||
lsort -unique $anUnits
|
||||
set anUnits [lsort -unique $anUnits]
|
||||
|
||||
if { [info exists ::env(SHORTCUT_HEADERS)] &&
|
||||
$::env(SHORTCUT_HEADERS) == "true" } {
|
||||
# define copying style
|
||||
set aCopyType "copy"
|
||||
if { [info exists ::env(SHORTCUT_HEADERS)] } {
|
||||
if { [string equal -nocase $::env(SHORTCUT_HEADERS) "hard"]
|
||||
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "hardlink"] } {
|
||||
set aCopyType "hardlink"
|
||||
} elseif { [string equal -nocase $::env(SHORTCUT_HEADERS) "true"]
|
||||
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "shortcut"] } {
|
||||
set aCopyType "shortcut"
|
||||
}
|
||||
}
|
||||
|
||||
if { $aCopyType == "shortcut" } {
|
||||
# template preparation
|
||||
if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
|
||||
puts "template file does not exist: $::THE_CASROOT/adm/templates/header.in"
|
||||
@@ -683,6 +694,7 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
continue
|
||||
}
|
||||
}
|
||||
file delete -force "$theIncPath/$aHeaderFileName"
|
||||
}
|
||||
|
||||
set aShortCutHeaderFile [open "$theIncPath/$aHeaderFileName" "w"]
|
||||
@@ -690,7 +702,7 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
puts $aShortCutHeaderFile $aShortCutHeaderFileContent
|
||||
close $aShortCutHeaderFile
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set nbcopied 0
|
||||
foreach anUnit $anUnits {
|
||||
@@ -700,14 +712,20 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
|
||||
# copy file only if target does not exist or is older than original
|
||||
set torig [file mtime $aHeaderFile]
|
||||
if { ! [file isfile $anIncPath/$aHeaderFileName] } {
|
||||
set tcopy 0
|
||||
} else {
|
||||
set tcopy 0
|
||||
if { [file isfile $anIncPath/$aHeaderFileName] } {
|
||||
set tcopy [file mtime $anIncPath/$aHeaderFileName]
|
||||
}
|
||||
if { $tcopy < $torig } {
|
||||
incr nbcopied
|
||||
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
|
||||
if { $aCopyType == "hardlink" } {
|
||||
if { $tcopy != 0 } {
|
||||
file delete -force "$theIncPath/$aHeaderFileName"
|
||||
}
|
||||
file link -hard $anIncPath/$aHeaderFileName $aHeaderFile
|
||||
} else {
|
||||
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
|
||||
}
|
||||
} elseif { $tcopy != $torig } {
|
||||
puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aHeaderFile, not changed!"
|
||||
}
|
||||
@@ -2136,6 +2154,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
}
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
|
||||
if { "$aWokStation" == "lin" } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/lib\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t</Linker>"
|
||||
|
||||
puts $aFile "\t\t\t</Target>"
|
||||
@@ -2183,6 +2204,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
|
||||
}
|
||||
}
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
|
||||
if { "$aWokStation" == "lin" } {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/libd\" />"
|
||||
}
|
||||
puts $aFile "\t\t\t\t</Linker>"
|
||||
|
||||
puts $aFile "\t\t\t</Target>"
|
||||
|
14
adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in
Normal file
14
adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in
Normal file
@@ -0,0 +1,14 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# OpenCASCADECompileDefinitionsAndFlags-@OCCT_CONFIGURATION_LOWER@.cmake - OpenCASCADE CMake file
|
||||
# with compile definitions and C/C++ flags for @OCCT_CONFIGURATION@ configuration.
|
||||
#
|
||||
# This file is configured by OpenCASCADE.
|
||||
#
|
||||
|
||||
# The C and C++ flags added by OpenCASCADE to the cmake-configured flags.
|
||||
set (OpenCASCADE_C_FLAGS_@OCCT_CONFIGURATION_UPPER@ "@SET_OpenCASCADE_CMAKE_C_FLAGS@")
|
||||
set (OpenCASCADE_CXX_FLAGS_@OCCT_CONFIGURATION_UPPER@ "@SET_OpenCASCADE_CMAKE_CXX_FLAGS@")
|
||||
|
||||
# The compile definitions used by OpenCASCADE.
|
||||
@SET_OpenCASCADE_COMPILE_DEFINITIONS@
|
@@ -54,7 +54,7 @@ set (OpenCASCADE_BUILD_WITH_DEBUG @BUILD_WITH_DEBUG@)
|
||||
set (OpenCASCADE_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
|
||||
@SET_OpenCASCADE_BUILD_TYPE@
|
||||
|
||||
# Use of third-party libraries
|
||||
# Use of third-party libraries.
|
||||
set (OpenCASCADE_WITH_TCL @USE_TCL@)
|
||||
set (OpenCASCADE_WITH_FREETYPE @USE_FREETYPE@)
|
||||
set (OpenCASCADE_WITH_FREEIMAGE @USE_FREEIMAGE@)
|
||||
@@ -64,6 +64,12 @@ set (OpenCASCADE_WITH_VTK @USE_VTK@)
|
||||
@SET_OpenCASCADE_WITH_D3D@
|
||||
@SET_OpenCASCADE_WITH_GLX@
|
||||
|
||||
# Import OpenCASCADE compile definitions, C and C++ flags for each installed configuration.
|
||||
file(GLOB CONFIG_FILES "${CMAKE_CURRENT_LIST_DIR}/OpenCASCADECompileDefinitionsAndFlags-*.cmake")
|
||||
foreach(f ${CONFIG_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
|
||||
if (NOT OpenCASCADE_FIND_COMPONENTS)
|
||||
set (OpenCASCADE_FIND_COMPONENTS ${OpenCASCADE_MODULES})
|
||||
endif ()
|
||||
|
521
dox/LICENSE.md
521
dox/LICENSE.md
@@ -1,521 +0,0 @@
|
||||
License {#occt_public_license}
|
||||
=======
|
||||
|
||||
Open CASCADE Technology is available under GNU Lesser General Public License
|
||||
(LGPL) version 2.1 with additional exception.
|
||||
|
||||
@section license_lgpl_21 GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
### Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
- 0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
1. The modified work must itself be a software library.
|
||||
|
||||
2. You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
3. You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
4. If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
1. Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
2. Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
3. Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
4. If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
5. Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
1. Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
2. Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
**NO** **WARRANTY**
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
### END OF TERMS AND CONDITIONS
|
||||
|
||||
### How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
@section occt_lgpl_exception OPEN CASCADE EXCEPTION
|
||||
|
||||
### Open CASCADE Exception (version 1.0) to GNU LGPL version 2.1.
|
||||
|
||||
The object code (i.e. not a source) form of a "work that uses the Library"
|
||||
can incorporate material from a header file that is part of the Library.
|
||||
As a special exception to the GNU Lesser General Public License version 2.1,
|
||||
you may distribute such object code incorporating material from header files
|
||||
provided with the Open CASCADE Technology libraries (including code of CDL
|
||||
generic classes) under terms of your choice, provided that you give
|
||||
prominent notice in supporting documentation to this code that it makes use
|
||||
of or is based on facilities provided by the Open CASCADE Technology software.
|
Binary file not shown.
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 60 KiB |
@@ -20,7 +20,10 @@ The environment is defined in the file *custom.sh* (on Linux and OS X) or *custo
|
||||
|
||||
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
|
||||
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
|
||||
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
|
||||
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
|
||||
* *Copy* - headers will be copied from *src*;
|
||||
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
|
||||
* "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
|
||||
|
@@ -30,13 +30,16 @@ If you have Visual Studio projects already available (pre-installed or generated
|
||||
* *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution
|
||||
* <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products
|
||||
* <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products
|
||||
* *SHORTCUT_HEADERS* -- if set to "true", folder *inc* will be populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
|
||||
* *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are:
|
||||
* *Copy* - headers will be copied from *src*;
|
||||
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
|
||||
* "HardLink* - hard links to headers located in *src* will be created.
|
||||
|
||||
Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
|
||||
That tool will analyze your environment and propose you to choose available options:
|
||||
|
||||
* Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*)
|
||||
* Option to use short-cuts to header files in folder *inc* (enabled by default).
|
||||
* Method to populate folder *inc* (short-cuts by default).
|
||||
* Location of third-party libraries (usually downloaded from OCCT web site, see above).
|
||||
* Path to common directory where third-party libraries are located (optional)
|
||||
* Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).
|
||||
|
@@ -21,7 +21,10 @@ The environment is defined in the file *custom.sh* which can be edited directly:
|
||||
|
||||
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator).
|
||||
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
|
||||
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
|
||||
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
|
||||
* *Copy* - headers will be copied from *src*;
|
||||
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
|
||||
* "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
|
||||
|
@@ -247,6 +247,10 @@ The class *Select3D_Projector* now supports both orientation and projection tran
|
||||
|
||||
Porting of user applications from an earlier OCCT version to version 6.9.0 requires taking into account the following major changes.
|
||||
|
||||
@subsection upgrade_690_shaders 3D Viewer initialization
|
||||
|
||||
3D Viewer now uses GLSL programs for managing frame buffer and stereoscopic output.
|
||||
For proper initialization, application should configure **CSF_ShadersDirectory** environment variable pointing to a folder with GLSL resources - files from folder **CASROOT**/src/Shaders.
|
||||
|
||||
@subsection upgrade_690_selection Changes in Selection
|
||||
|
||||
@@ -972,8 +976,18 @@ Zoom persistent selection introduces a new structure *Graphic3d_TransformPers* f
|
||||
* Matrix stack utilities from *OpenGl_Utils* namespace have been moved to *OpenGl_MatrixStack* class and *OpenGl_MatrixStack.hxx* header respectively.
|
||||
* *OpenGl_View* methods *Begin/EndTransformPersistence* have been removed. Please, use *Graphic3d_TransformPers::Apply()* instead to apply persistence to perspective and world-view projection matrices.
|
||||
|
||||
@subsection Correction of texture mapping of objects
|
||||
@subsection upgrade_occt700_correction_of_texture Correction of texture mapping of objects
|
||||
|
||||
Interaction of texture and environment texture is fixed. Textured objects have priority over the environment mapping.
|
||||
Redundant enumerations V3d_TypeOfSurface and Graphic3d_TypeOfSurface, class OpenGl_SurfaceDetailState, corresponding methods from Graphic3d_CView, OpenGl_ShaderManager, OpenGl_View, V3d_View, V3d_Viewer are deleted.
|
||||
Draw command VSetTextureMode is deleted.
|
||||
|
||||
@section upgrade_occt710 Upgrade to OCCT 7.1.0
|
||||
|
||||
@subsection upgrade_occt710_correction_of_Parab2d Correction in gp_Parab2d, gce_MakeParab2d and GCE2d_MakeParabola classes
|
||||
|
||||
1. Constructors GCE2d_MakeParabola(const gp_Ax22d& D, const gp_Pnt2d& F), gce_MakeParab2d(const gp_Ax22d& D, const gp_Pnt2d& F) and gp_Parab2d(const gp_Ax22d& D, const gp_Pnt2d& F) have been deleted.
|
||||
|
||||
2. Objects created with some constructors of gp_Parab2d class may be differ from previous version. Please see updated documentation for gp_Parab2d class (file gp_Parab2d.hxx).
|
||||
|
||||
3. Result returned by gp_Parab2d::Directrix() method has another direction in compare with previous OCCT-version.
|
@@ -86,7 +86,6 @@ bfuse w w w5
|
||||
shape wsh Sh
|
||||
foreach f [explode w f] {add $f wsh}
|
||||
renamevar wsh w
|
||||
save w w.brep
|
||||
unifysamedom r w
|
||||
|
||||
# keep only wires in compound
|
||||
|
@@ -310,14 +310,8 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
{
|
||||
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
|
||||
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
|
||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev);
|
||||
if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
|
||||
|| (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion()))
|
||||
{
|
||||
BRepTools::Clean (myshape);
|
||||
}
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
|
||||
// After this call if type of deflection is relative
|
||||
// computed deflection coefficient is stored as absolute.
|
||||
Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
|
||||
@@ -331,6 +325,8 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
}
|
||||
else // WireFrame mode
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
|
||||
// After this call if type of deflection is relative
|
||||
// computed deflection coefficient is stored as absolute.
|
||||
Prs3d::GetDeflection (myshape, myDrawer);
|
||||
|
@@ -449,7 +449,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
return;
|
||||
}
|
||||
|
||||
// Erase presentations for all display modes different from aDispMode.
|
||||
// Mark the presentation modes hidden of interactive object different from aDispMode.
|
||||
// Then make sure aDispMode is displayed and maybe highlighted.
|
||||
// Finally, activate selection mode <SelMode> if not yet activated.
|
||||
TColStd_ListOfInteger aModesToRemove;
|
||||
@@ -463,7 +463,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
{
|
||||
myMainPM->Unhighlight (theIObj, anOldMode);
|
||||
}
|
||||
myMainPM->Erase (theIObj, anOldMode);
|
||||
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -349,10 +349,10 @@ public:
|
||||
Standard_Boolean HasWidth() const;
|
||||
|
||||
//! Returns the width setting of the Interactive Object.
|
||||
Standard_EXPORT Standard_Real Width() const;
|
||||
Standard_Real Width() const;
|
||||
|
||||
//! Returns true if the Interactive Object has a setting for material.
|
||||
Standard_EXPORT Standard_Boolean HasMaterial() const;
|
||||
Standard_Boolean HasMaterial() const;
|
||||
|
||||
//! Returns the current material setting.
|
||||
//! This will be on of the following materials:
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
//! - Pewter
|
||||
//! - Silver
|
||||
//! - Stone.
|
||||
Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const;
|
||||
virtual Graphic3d_NameOfMaterial Material() const;
|
||||
|
||||
//! Sets the name aName for material defining this
|
||||
//! display attribute for the interactive object.
|
||||
|
1219
src/AIS/AIS_Manipulator.cxx
Normal file
1219
src/AIS/AIS_Manipulator.cxx
Normal file
File diff suppressed because it is too large
Load Diff
670
src/AIS/AIS_Manipulator.hxx
Normal file
670
src/AIS/AIS_Manipulator.hxx
Normal file
@@ -0,0 +1,670 @@
|
||||
// Created on: 2015-12-23
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 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 _AIS_Manipulator_HeaderFile
|
||||
#define _AIS_Manipulator_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_ManipulatorMode.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfQuadrangles.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <NCollection_HSequence.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <Standard_Version.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject));
|
||||
|
||||
DEFINE_STANDARD_HANDLE (AIS_Manipulator, AIS_InteractiveObject)
|
||||
|
||||
//! Interactive object class to manipulate local transformation of another interactive
|
||||
//! object or a group of objects via mouse.
|
||||
//! It manages three types of manipulations in 3D space:
|
||||
//! - translation through axis
|
||||
//! - scaling within axis
|
||||
//! - rotation around axis
|
||||
//! To enable one of this modes, selection mode (from 1 to 3) is to be activated.
|
||||
//! There are three orthogonal transformation axes defined by position property of
|
||||
//! the manipulator. Particular transformation mode can be disabled for each
|
||||
//! of the axes or all of them. Furthermore each of the axes can be hidden or
|
||||
//! made visible.
|
||||
//! The following steps demonstrate how to attach, configure and use manipulator
|
||||
//! for an interactive object:
|
||||
//! Step 1. Create manipulator object and adjust it appearance:
|
||||
//! @code
|
||||
//! Handle(AIS_Manipulator) aManipulator = new AIS_Manipulator();
|
||||
//! aManipulator->SetPart (0, AIS_Manipulator::Scaling, Standard_False);
|
||||
//! aManipulator->SetPart (1, AIS_Manipulator::Rotation, Standard_False);
|
||||
//! // Attach manipulator to already displayed object and manage manipulation modes
|
||||
//! aManipulator->AttachToObject (anAISObject);
|
||||
//! aManipulator->EnableMode (AIS_Manipulator::Translation);
|
||||
//! aManipulator->EnableMode (AIS_Manipulator::Rotation);
|
||||
//! aManipulator->EnableMode (AIS_Manipulator::Scaling);
|
||||
//! @endcode
|
||||
//! Note that you can enable only one manipulation mode but have all visual parts displayed.
|
||||
//! This code allows you to view manipulator and select its manipulation parts.
|
||||
//! Note that manipulator activates mode on part selection.
|
||||
//! If this mode is activated, no selection will be performed for manipulator.
|
||||
//! It can be activated with highlighting. To enable this:
|
||||
//! @code
|
||||
//! aManipulator->SetModeActivationOnDetection (Standard_True);
|
||||
//! @endcode
|
||||
//! Step 2. To perform transformation of object use next code in your event processing chain:
|
||||
//! @code
|
||||
//! // catch mouse button down event
|
||||
//! if (aManipulator->HasActiveMode())
|
||||
//! {
|
||||
//! aManipulator->StartTransform (anXPix, anYPix, aV3dView);
|
||||
//! }
|
||||
//! ...
|
||||
//! // or track mouse move event
|
||||
//! if (aManipulator->HasActiveMode())
|
||||
//! {
|
||||
//! aManipulator->Transform (anXPix, anYPix, aV3dView);
|
||||
//! aV3dView->Redraw();
|
||||
//! }
|
||||
//! ...
|
||||
//! // or catch mouse button up event (apply) or escape event (cancel)
|
||||
//! aManipulator->StopTransform(/*Standard_Boolean toApply*/);
|
||||
//! @endcode
|
||||
//! Step 3. To deactivate current manipulation mode use:
|
||||
//! @code aManipulator->DeactivateCurrentMode();
|
||||
//! @endcode
|
||||
//! Step 4. To detach manipulator from object use:
|
||||
//! @code
|
||||
//! aManipulator->Detach();
|
||||
//! @endcode
|
||||
//! The last method erases manipulator object.
|
||||
//! @warning
|
||||
//! On construction an instance of AIS_Manipulator object is bound to Graphic3d_ZLayerId_Topmost layer,
|
||||
//! so make sure to call for your AIS_InteractiveContext the method MainSelector()->SetPickClosest (Standard_False)
|
||||
//! otherwise you may notice issues with activation of modes.
|
||||
class AIS_Manipulator : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructs a manipulator object with default placement and all parts to be displayed.
|
||||
Standard_EXPORT AIS_Manipulator();
|
||||
|
||||
//! Constructs a manipulator object with input location and positions of axes and all parts to be displayed.
|
||||
Standard_EXPORT AIS_Manipulator (const gp_Ax2& thePosition);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~AIS_Manipulator() {}
|
||||
|
||||
//! Disable or enable visual parts for translation, rotation or scaling for some axis.
|
||||
//! By default all parts are enabled (will be displayed).
|
||||
//! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation (selection) mode.
|
||||
//! @warning Raises program error if axis index is < 0 or > 2.
|
||||
Standard_EXPORT void SetPart (const Standard_Integer theAxisIndex, const AIS_ManipulatorMode theMode, const Standard_Boolean theIsEnabled);
|
||||
|
||||
//! Behavior settings to be applied when performing transformation:
|
||||
//! - FollowTranslation - whether the manipulator will be moved together with an object.
|
||||
//! - FollowRotation - whether the manipulator will be rotated together with an object.
|
||||
struct OptionsForAttach {
|
||||
|
||||
OptionsForAttach() : AdjustPosition (Standard_True), AdjustSize (Standard_False), EnableModes (Standard_True) {}
|
||||
OptionsForAttach& SetAdjustPosition (const Standard_Boolean theApply) { AdjustPosition = theApply; return *this; }
|
||||
OptionsForAttach& SetAdjustSize (const Standard_Boolean theApply) { AdjustSize = theApply; return *this; }
|
||||
OptionsForAttach& SetEnableModes (const Standard_Boolean theApply) { EnableModes = theApply; return *this; }
|
||||
|
||||
Standard_Boolean AdjustPosition;
|
||||
Standard_Boolean AdjustSize;
|
||||
Standard_Boolean EnableModes;
|
||||
};
|
||||
|
||||
//! Attaches himself to the input interactive object and become displayed in the same context.
|
||||
//! It is placed in the center of object bounding box, and its size is adjusted to the object bounding box.
|
||||
Standard_EXPORT void Attach (const Handle(AIS_InteractiveObject)& theObject, const OptionsForAttach& theOptions = OptionsForAttach());
|
||||
|
||||
//! Attaches himself to the input interactive object group and become displayed in the same context.
|
||||
//! It become attached to the first object, baut manage manipulation of the whole group.
|
||||
//! It is placed in the center of object bounding box, and its size is adjusted to the object bounding box.
|
||||
Standard_EXPORT void Attach (const Handle(AIS_ManipulatorObjectSequence)& theObject, const OptionsForAttach& theOptions = OptionsForAttach());
|
||||
|
||||
//! Enable manipualtion mode.
|
||||
//! @warning It activates selection mode in the current context.
|
||||
//! If manipulator is not displayed, no mode will be activated.
|
||||
Standard_EXPORT void EnableMode (const AIS_ManipulatorMode theMode);
|
||||
|
||||
//! Enables mode activation on detection (highlighting).
|
||||
//! By default, mode is activated on selection of manipulator part.
|
||||
//! @warning If this mode is enabled, selection of parts does nothing.
|
||||
void SetModeActivationOnDetection (const Standard_Boolean theToEnable)
|
||||
{
|
||||
myIsActivationOnDetection = theToEnable;
|
||||
}
|
||||
|
||||
//! @return true if manual mode activation is enabled.
|
||||
Standard_Boolean IsModeActivationOnDetection() const
|
||||
{
|
||||
return myIsActivationOnDetection;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Init start (reference) transformation.
|
||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||
//! and is used only for custom transform set. If Transform(const Standard_Integer, const Standard_Integer) is used,
|
||||
//! initial data is set automatically, and it is reset on DeactivateCurrentMode call if it is not reset yet.
|
||||
Standard_EXPORT void StartTransform (const Standard_Integer theX, const Standard_Integer theY, const Handle(V3d_View)& theView);
|
||||
|
||||
//! Apply to the owning objects the input transformation.
|
||||
//! @remark The transformation is set using SetLocalTransformation for owning objects.
|
||||
//! The location of the manipulator is stored also in Local Transformation,
|
||||
//! so that there's no need to redisplay objects.
|
||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||
//! and is used only for custom transform set.
|
||||
//! @warning It will does nothing if transformation is not initiated (with StartTransform() call).
|
||||
Standard_EXPORT void Transform (const gp_Trsf& aTrsf);
|
||||
|
||||
//! Reset start (reference) transformation.
|
||||
//! @param theToApply [in] option to apply or to cancel the started transformation.
|
||||
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
|
||||
//! and is used only for custom transform set.
|
||||
Standard_EXPORT void StopTransform (const Standard_Boolean theToApply = Standard_True);
|
||||
|
||||
//! Apply transformation made from mouse moving from start position
|
||||
//! (save on the first Tranform() call and reset on DeactivateCurrentMode() call.)
|
||||
//! to the in/out mouse position (theX, theY)
|
||||
Standard_EXPORT gp_Trsf Transform (const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Computes transformation of parent object according to the active mode and input motion vector.
|
||||
//! You can use this method to get object transformation according to current mode or use own algorithm
|
||||
//! to implement any other tranformation for modes.
|
||||
//! @return transformation of parent object.
|
||||
Standard_EXPORT Standard_Boolean ObjectTransformation (const Standard_Integer theX, const Standard_Integer theY,
|
||||
const Handle(V3d_View)& theView, gp_Trsf& theTrsf);
|
||||
|
||||
//! Make inactive the current selected manipulator part and reset current axis index and current mode.
|
||||
//! After its call HasActiveMode() returns false.
|
||||
//! @sa HasActiveMode()
|
||||
Standard_EXPORT void DeactivateCurrentMode();
|
||||
|
||||
//! Detaches himself from the owner object, and removes itself from context.
|
||||
Standard_EXPORT void Detach();
|
||||
|
||||
//! @return all owning objects.
|
||||
Standard_EXPORT Handle(AIS_ManipulatorObjectSequence) Objects() const;
|
||||
|
||||
//! @return the first (leading) object of the owning objects.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Object() const;
|
||||
|
||||
//! @return one of the owning objects.
|
||||
//! @warning raises program error if theIndex is more than owning objects count or less than 1.
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) Object (const Standard_Integer theIndex) const;
|
||||
|
||||
//! @return true if manipulator is attached to some interactive object (has owning object).
|
||||
Standard_Boolean IsAttached() const { return HasOwner(); }
|
||||
|
||||
//! @return true if some part of manipulator is selected (tranformation mode is active, and owning object can be rtansformated).
|
||||
Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; }
|
||||
|
||||
Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; }
|
||||
|
||||
gp_Trsf StartTransformation() const { return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs(1); }
|
||||
|
||||
gp_Trsf StartTransformation (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_ProgramError_Raise_if (theIndex < 1 || theIndex > Objects()->Upper(),
|
||||
"AIS_Manipulator::StartTransformation(): theIndex is out of bounds");
|
||||
return myStartTrsfs.Size() < 1 ? gp_Trsf() : myStartTrsfs (theIndex);
|
||||
}
|
||||
|
||||
public: //! @name Configuration of graphical transformations
|
||||
|
||||
//! Enable or disable zoom persistence mode for the manipulator. With
|
||||
//! this mode turned on the presentation will keep fixed screen size.
|
||||
//! @warning when turned on this option overrides transform persistence
|
||||
//! properties and local transformation to achieve necessary visual effect.
|
||||
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
|
||||
//! when enabling zoom persistence.
|
||||
Standard_EXPORT void SetZoomPersistence (const Standard_Boolean theToEnable);
|
||||
|
||||
//! Returns state of zoom persistence mode, whether it turned on or off.
|
||||
Standard_Boolean ZoomPersistence() const { return myIsZoomPersistentMode; }
|
||||
|
||||
//! Redefines transform persistence management to setup transformation for sub-presentation of axes.
|
||||
//! @warning this interactive object does not support custom transformation persistence when
|
||||
//! using \sa ZoomPersistence mode. In this mode the transformation persistence flags for
|
||||
//! presentations are overriden by this class.
|
||||
//! @warning Invokes debug assertion to catch incompatible usage of the method with \sa ZoomPersistence mode,
|
||||
//! silently does nothing in release mode.
|
||||
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
|
||||
//! when enabling zoom persistence.
|
||||
Standard_EXPORT virtual void SetTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint) Standard_OVERRIDE;
|
||||
|
||||
//! Redefines local transformation management method to inform user of inproper use.
|
||||
//! @warning this interactive object does not support setting custom local transformation,
|
||||
//! this class solely uses this property to implement visual positioning of the manipulator
|
||||
//! without need for recomputing presentation.
|
||||
//! @warning Invokes debug assertion in debug to catch incompatible usage of the
|
||||
//! method, silently does nothing in release mode.
|
||||
Standard_EXPORT virtual void SetLocalTransformation (const gp_Trsf& theTransformation) Standard_OVERRIDE;
|
||||
|
||||
public: //! @name Setters for parameters
|
||||
|
||||
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
|
||||
|
||||
//! @return poition of manipulator interactive object.
|
||||
const gp_Ax2& Position() const { return myPosition; }
|
||||
|
||||
//! Sets position of the manipulator object.
|
||||
Standard_EXPORT void SetPosition (const gp_Ax2& thePosition);
|
||||
|
||||
Standard_ShortReal Size() const { return myAxes[0].Size(); }
|
||||
|
||||
//! Sets size (length of side of the manipulator cubic bounding box.
|
||||
Standard_EXPORT void SetSize (const Standard_ShortReal theSideLength);
|
||||
|
||||
//! Sets gaps between translator, scaler and rotator sub-presentations.
|
||||
Standard_EXPORT void SetGap (const Standard_ShortReal theValue);
|
||||
|
||||
public:
|
||||
|
||||
//! Behavior settings to be applied when performing transformation:
|
||||
//! - FollowTranslation - whether the manipulator will be moved together with an object.
|
||||
//! - FollowRotation - whether the manipulator will be rotated together with an object.
|
||||
struct BehaviorOnTransform {
|
||||
|
||||
BehaviorOnTransform() : FollowTranslation (Standard_True), FollowRotation (Standard_True) {}
|
||||
BehaviorOnTransform& SetFollowTranslation (const Standard_Boolean theApply) { FollowTranslation = theApply; return *this; }
|
||||
BehaviorOnTransform& SetFollowRotation (const Standard_Boolean theApply) { FollowRotation = theApply; return *this; }
|
||||
|
||||
Standard_Boolean FollowTranslation;
|
||||
Standard_Boolean FollowRotation;
|
||||
};
|
||||
|
||||
//! Sets behavior settings for transformation action carried on the manipulator,
|
||||
//! whether it translates, rotates together with the transformed object or not.
|
||||
void SetTransformBehavior (const BehaviorOnTransform& theSettings) { myBehaviorOnTransform = theSettings; }
|
||||
|
||||
//! @return behavior settings for transformation action of the manipulator.
|
||||
BehaviorOnTransform& ChangeTransformBehavior() { return myBehaviorOnTransform; }
|
||||
|
||||
//! @return behavior settings for transformation action of the manipulator.
|
||||
const BehaviorOnTransform& TransformBehavior() const { return myBehaviorOnTransform; }
|
||||
|
||||
public: //! @name Presentation computation
|
||||
|
||||
//! Fills presentation.
|
||||
//! @note Manipulator presentation does not use display mode and for all modes has the same presenatation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||
|
||||
//! Computes selection sensitive zones (triangulation) for manipulator.
|
||||
//! @param theNode [in] Seldction mode that is treated as transformation mode.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overriden methods.
|
||||
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//! Method which clear all selected owners belonging
|
||||
//! to this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
||||
|
||||
//! Method which draws selected owners ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM, const SelectMgr_SequenceOfOwner& theSeq) Standard_OVERRIDE;
|
||||
|
||||
//! Method which hilight an owner belonging to
|
||||
//! this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT void init();
|
||||
|
||||
Standard_EXPORT void updateTransformation();
|
||||
|
||||
Standard_EXPORT Handle(Prs3d_Presentation) getHighlightPresentation (const Handle(SelectMgr_EntityOwner)& theOwner) const;
|
||||
|
||||
Standard_EXPORT Handle(Graphic3d_Group) getGroup (const Standard_Integer theIndex, const AIS_ManipulatorMode theMode) const;
|
||||
|
||||
Standard_EXPORT void attachToBox (const Bnd_Box& theBox);
|
||||
|
||||
Standard_EXPORT void adjustSize (const Bnd_Box& theBox);
|
||||
|
||||
Standard_EXPORT void setTransformPersistence (const Graphic3d_TransModeFlags& theFlag, const gp_Pnt& thePoint);
|
||||
|
||||
protected: //! @name Auxilliary classes to fill presentation with proper primitives
|
||||
|
||||
class Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~Quadric()
|
||||
{
|
||||
myTriangulation.Nullify();
|
||||
myArray.Nullify();
|
||||
}
|
||||
|
||||
|
||||
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; }
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Poly_Triangulation) myTriangulation;
|
||||
Handle(Graphic3d_ArrayOfTriangles) myArray;
|
||||
};
|
||||
|
||||
class Cylinder : public Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
Cylinder()
|
||||
: Quadric(),
|
||||
myBottomRad(1.0f),
|
||||
myTopRad(1.0f),
|
||||
myHeight(1.0f)
|
||||
{ }
|
||||
|
||||
virtual ~Cylinder() {}
|
||||
|
||||
void Init (const Standard_ShortReal theBotRad, const Standard_ShortReal theTopRad,
|
||||
const Standard_ShortReal theHeight,
|
||||
const Standard_Integer theSlicesNb, const Standard_Integer theStacksNb,
|
||||
const gp_Ax1& thePosition);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myPosition;
|
||||
Standard_ShortReal myBottomRad;
|
||||
Standard_ShortReal myTopRad;
|
||||
Standard_ShortReal myHeight;
|
||||
};
|
||||
|
||||
class Disk : public Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
Disk()
|
||||
: Quadric(),
|
||||
myInnerRad(0.0f),
|
||||
myOuterRad(1.0f)
|
||||
{ }
|
||||
|
||||
~Disk() { }
|
||||
|
||||
void Init (const Standard_ShortReal theInnerRadius,
|
||||
const Standard_ShortReal theOuterRadius,
|
||||
const gp_Ax1& thePosition,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myPosition;
|
||||
Standard_ShortReal myInnerRad;
|
||||
Standard_ShortReal myOuterRad;
|
||||
};
|
||||
|
||||
class Sphere : public Quadric
|
||||
{
|
||||
public:
|
||||
Sphere()
|
||||
: Quadric(),
|
||||
myRadius(1.0f)
|
||||
{}
|
||||
|
||||
void Init (const Standard_ShortReal theRadius,
|
||||
const gp_Pnt& thePosition,
|
||||
const Standard_Integer theSlicesNb = 20,
|
||||
const Standard_Integer theStacksNb = 20);
|
||||
|
||||
protected:
|
||||
|
||||
gp_Pnt myPosition;
|
||||
Standard_ShortReal myRadius;
|
||||
};
|
||||
|
||||
class Cube
|
||||
{
|
||||
public:
|
||||
|
||||
Cube() { }
|
||||
~Cube() { }
|
||||
|
||||
void Init (const gp_Ax1& thePosition, const Standard_ShortReal myBoxSize);
|
||||
|
||||
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
|
||||
|
||||
const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; }
|
||||
|
||||
private:
|
||||
|
||||
void addTriangle (const Standard_Integer theIndex, const gp_Pnt& theP1, const gp_Pnt& theP2, const gp_Pnt& theP3,
|
||||
const gp_Dir& theNormal);
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Poly_Triangulation) myTriangulation;
|
||||
Handle(Graphic3d_ArrayOfTriangles) myArray;
|
||||
};
|
||||
|
||||
//! The class describes on axis sub-object.
|
||||
//! It includes sub-objects itself:
|
||||
//! -rotator
|
||||
//! -translator
|
||||
//! -scaler
|
||||
class Axis
|
||||
{
|
||||
public:
|
||||
|
||||
Axis (const gp_Ax1& theAxis = gp_Ax1(),
|
||||
const Quantity_Color& theColor = Quantity_Color(),
|
||||
const Standard_ShortReal theLength = 10.0f);
|
||||
|
||||
void Compute (const Handle_PrsMgr_PresentationManager3d& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Handle(Prs3d_ShadingAspect)& theAspect);
|
||||
|
||||
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
|
||||
|
||||
void SetPosition (const gp_Ax1& thePosition) { myPosition = thePosition; }
|
||||
|
||||
const gp_Ax1& Position() const { return myPosition; }
|
||||
|
||||
void SetTransformPersistence (const Graphic3d_TransModeFlags& theFlags, const gp_Pnt& thePoint)
|
||||
{
|
||||
if (!myHighlightTranslator.IsNull())
|
||||
{
|
||||
myHighlightTranslator->SetTransformPersistence (theFlags, thePoint);
|
||||
}
|
||||
|
||||
if (!myHighlightScaler.IsNull())
|
||||
{
|
||||
myHighlightScaler->SetTransformPersistence (theFlags, thePoint);
|
||||
}
|
||||
|
||||
if (!myHighlightRotator.IsNull())
|
||||
{
|
||||
myHighlightRotator->SetTransformPersistence (theFlags, thePoint);
|
||||
}
|
||||
}
|
||||
|
||||
Graphic3d_TransModeFlags GetTransformPersistenceMode() const { return myHighlightTranslator->TransformPersistenceMode(); }
|
||||
|
||||
gp_Pnt GetTransformPersistencePoint() const { return myHighlightTranslator->TransformPersistencePoint(); }
|
||||
|
||||
void Transform (const Handle(Geom_Transformation)& theTransformation)
|
||||
{
|
||||
if (!myHighlightTranslator.IsNull())
|
||||
{
|
||||
myHighlightTranslator->Transform (theTransformation);
|
||||
}
|
||||
|
||||
if (!myHighlightScaler.IsNull())
|
||||
{
|
||||
myHighlightScaler->Transform (theTransformation);
|
||||
}
|
||||
|
||||
if (!myHighlightRotator.IsNull())
|
||||
{
|
||||
myHighlightRotator->Transform (theTransformation);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean HasTranslation() const { return myHasTranslation; }
|
||||
|
||||
Standard_Boolean HasRotation() const { return myHasRotation; }
|
||||
|
||||
Standard_Boolean HasScaling() const { return myHasScaling; }
|
||||
|
||||
void SetTranslation (const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; }
|
||||
|
||||
void SetRotation (const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; }
|
||||
|
||||
void SetScaling (const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
|
||||
|
||||
Quantity_Color Color() const { return myColor; }
|
||||
|
||||
Standard_ShortReal AxisLength() const { return myLength; }
|
||||
|
||||
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
|
||||
|
||||
void SetAxisRadius (const Standard_ShortReal theValue) { myAxisRadius = theValue; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const { return myHighlightTranslator; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& RotatorHighlightPrs() const { return myHighlightRotator; }
|
||||
|
||||
const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; }
|
||||
|
||||
const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; }
|
||||
|
||||
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
|
||||
|
||||
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
|
||||
|
||||
Standard_ShortReal Size() const { return myLength + myBoxSize + myDiskThickness + myIndent * 2.0f; }
|
||||
|
||||
gp_Pnt ScalerCenter (const gp_Pnt& theLocation) const { return theLocation.XYZ() + myPosition.Direction().XYZ() * (myLength + myIndent + myBoxSize * 0.5f); }
|
||||
|
||||
void SetSize (const Standard_ShortReal theValue)
|
||||
{
|
||||
if (myIndent > theValue * 0.1f)
|
||||
{
|
||||
myLength = theValue * 0.7f;
|
||||
myBoxSize = theValue * 0.15f;
|
||||
myDiskThickness = theValue * 0.05f;
|
||||
myIndent = theValue * 0.05f;
|
||||
}
|
||||
else // use pre-set value of predent
|
||||
{
|
||||
Standard_ShortReal aLength = theValue - 2 * myIndent;
|
||||
myLength = aLength * 0.8f;
|
||||
myBoxSize = aLength * 0.15f;
|
||||
myDiskThickness = aLength * 0.05f;
|
||||
}
|
||||
myInnerRadius = myIndent * 2 + myBoxSize + myLength;
|
||||
myAxisRadius = myBoxSize / 4.0f;
|
||||
}
|
||||
|
||||
Standard_Integer FacettesNumber() const { return myFacettesNumber; }
|
||||
|
||||
public:
|
||||
|
||||
const Cylinder& TranslatorCylinder() const { return myCylinder; }
|
||||
const Cylinder& TranslatorArrow() const { return myArrow; }
|
||||
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
|
||||
const Disk& TranslatorArrowBottom() const { return myArrowBottom; }
|
||||
const Disk& RotatorDisk() const { return myCircle; }
|
||||
float RotatorDiskRadius() const { return myCircleRadius; }
|
||||
const Cube& ScalerCube() const { return myCube; }
|
||||
const gp_Pnt& ScalerCubePosition() const { return myCubePos; }
|
||||
|
||||
protected:
|
||||
|
||||
gp_Ax1 myReferenceAxis; //!< Returns reference axis assignment.
|
||||
gp_Ax1 myPosition; //!< Position of the axis including local transformation.
|
||||
Quantity_Color myColor;
|
||||
|
||||
Standard_Boolean myHasTranslation;
|
||||
Standard_ShortReal myLength; //!< Length of translation axis.
|
||||
Standard_ShortReal myAxisRadius;
|
||||
|
||||
Standard_Boolean myHasScaling;
|
||||
Standard_ShortReal myBoxSize; //!< Size of scaling cube.
|
||||
|
||||
Standard_Boolean myHasRotation;
|
||||
Standard_ShortReal myInnerRadius; //!< Radius of rotation circle.
|
||||
Standard_ShortReal myDiskThickness;
|
||||
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Integer myFacettesNumber;
|
||||
|
||||
Cylinder myCylinder;
|
||||
Cylinder myArrow;
|
||||
gp_Pnt myArrowTipPos;
|
||||
Disk myArrowBottom;
|
||||
Disk myCircle;
|
||||
float myCircleRadius;
|
||||
Cube myCube;
|
||||
gp_Pnt myCubePos;
|
||||
|
||||
Handle(Graphic3d_Group) myTranslatorGroup;
|
||||
Handle(Graphic3d_Group) myScalerGroup;
|
||||
Handle(Graphic3d_Group) myRotatorGroup;
|
||||
|
||||
Handle(Prs3d_Presentation) myHighlightTranslator;
|
||||
Handle(Prs3d_Presentation) myHighlightScaler;
|
||||
Handle(Prs3d_Presentation) myHighlightRotator;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
Axis myAxes[3]; //!< Tree axes of the manipulator.
|
||||
Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator.
|
||||
gp_Ax2 myPosition; //!< Position of the manipualtor object. it displayes its location and position of its axes.
|
||||
|
||||
Standard_Integer myCurrentIndex; //!< Index of active axis.
|
||||
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipualtion mode.
|
||||
|
||||
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
|
||||
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
|
||||
BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
|
||||
|
||||
protected: //! @name Fields for interactive trnasformation. Fields only for internal needs. They do not have public interface.
|
||||
|
||||
NCollection_Sequence<gp_Trsf> myStartTrsfs; //!< Owning object transformation for start. It is used internally.
|
||||
Standard_Boolean myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()).
|
||||
gp_Ax2 myStartPosition; //! Start position of manipulator.
|
||||
gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick.
|
||||
Standard_Real myPrevState; //! Previous value of angle during rotation.
|
||||
|
||||
//! Aspect used to colour current detected part and current selected part.
|
||||
Handle(Prs3d_ShadingAspect) myHighlightAspect;
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
|
||||
};
|
||||
#endif // _AIS_Manipulator_HeaderFile
|
28
src/AIS/AIS_ManipulatorMode.hxx
Normal file
28
src/AIS/AIS_ManipulatorMode.hxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Created on: 2015-02-05
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 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 _AIS_ManipulatorMode_HeaderFile
|
||||
#define _AIS_ManipulatorMode_HeaderFile
|
||||
|
||||
//! Mode to make definite kind of transformations with AIS_Manipulator object.
|
||||
enum AIS_ManipulatorMode
|
||||
{
|
||||
AIS_MM_None = 0,
|
||||
AIS_MM_Translation = 1,
|
||||
AIS_MM_Rotation,
|
||||
AIS_MM_Scaling
|
||||
};
|
||||
|
||||
#endif
|
94
src/AIS/AIS_ManipulatorOwner.cxx
Normal file
94
src/AIS/AIS_ManipulatorOwner.cxx
Normal file
@@ -0,0 +1,94 @@
|
||||
// Created on: 2015-12-23
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 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 <AIS_ManipulatorOwner.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ManipulatorOwner,SelectMgr_EntityOwner)
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_ManipulatorOwner::AIS_ManipulatorOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Standard_Integer theIndex,
|
||||
const AIS_ManipulatorMode theMode,
|
||||
const Standard_Integer thePriority)
|
||||
: SelectMgr_EntityOwner(theSelObject, thePriority),
|
||||
myIndex (theIndex),
|
||||
myMode (theMode)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ManipulatorOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Quantity_NameOfColor theColor,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode == 0)
|
||||
{
|
||||
SelectMgr_EntityOwner::HilightWithColor (thePM, theColor, theMode);
|
||||
return;
|
||||
}
|
||||
|
||||
Selectable()->HilightOwnerWithColor (thePM, theColor, this);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_ManipulatorOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer /*theMode*/) const
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return thePM->IsHighlighted (Selectable(), myMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ManipulatorOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Highlight (Selectable(), myMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unhilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ManipulatorOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Unhighlight (Selectable(), myMode);
|
||||
}
|
60
src/AIS/AIS_ManipulatorOwner.hxx
Normal file
60
src/AIS/AIS_ManipulatorOwner.hxx
Normal file
@@ -0,0 +1,60 @@
|
||||
// Created on: 2015-12-23
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2015 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 _AIS_ManipulatorOwner_HeaderFile
|
||||
#define _AIS_ManipulatorOwner_HeaderFile
|
||||
|
||||
#include <AIS_Manipulator.hxx>
|
||||
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_ManipulatorOwner, SelectMgr_EntityOwner)
|
||||
|
||||
//! Entity owner for selection management of AIS_Manipulator object.
|
||||
class AIS_ManipulatorOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ManipulatorOwner, SelectMgr_EntityOwner)
|
||||
|
||||
Standard_EXPORT AIS_ManipulatorOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Standard_Integer theIndex,
|
||||
const AIS_ManipulatorMode theMode,
|
||||
const Standard_Integer thePriority = 0);
|
||||
|
||||
Standard_EXPORT virtual ~AIS_ManipulatorOwner() {}
|
||||
|
||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, const Quantity_NameOfColor theColor, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM, const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT AIS_ManipulatorMode Mode() const { return myMode; }
|
||||
|
||||
//! @return index of manipulator axis.
|
||||
Standard_EXPORT Standard_Integer Index() const { return myIndex; }
|
||||
|
||||
protected:
|
||||
|
||||
Standard_Integer myIndex; //!< index of manipulator axis.
|
||||
AIS_ManipulatorMode myMode;//!< manipulation (highlight) mode.
|
||||
};
|
||||
|
||||
#endif // _AIS_ManipulatorOwner_HeaderFile
|
@@ -324,7 +324,7 @@ Standard_Boolean AIS_RubberBand::fillTriangles()
|
||||
|
||||
|
||||
Standard_Boolean toFill = Standard_False;
|
||||
if (myTriangles.IsNull() || myTriangles->VertexNumber() != myPoints.Length() + 1)
|
||||
if (myTriangles.IsNull() || myTriangles->VertexNumber() != aTriangles.Extent() * 3)
|
||||
{
|
||||
toFill = Standard_True;
|
||||
myTriangles = new Graphic3d_ArrayOfTriangles (aTriangles.Extent() * 3, 0, Standard_True);
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <Graphic3d_Vec2.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_RubberBand, AIS_InteractiveObject)
|
||||
|
||||
//! Presentation for drawing rubber band selection.
|
||||
//! It supports rectangle and polygonal selection.
|
||||
//! It is constructed in 2d overlay.
|
||||
@@ -130,8 +132,8 @@ protected:
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Does not fill selection primitives for rubber band.
|
||||
void virtual ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/,
|
||||
const Standard_Integer /*aMode*/) Standard_OVERRIDE { };
|
||||
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/,
|
||||
const Standard_Integer /*aMode*/) Standard_OVERRIDE { };
|
||||
|
||||
//! Fills triangles primitive array for rubber band filling.
|
||||
//! It uses Delaunay triangulation.
|
||||
|
@@ -122,7 +122,7 @@ Standard_Boolean AIS_Shape::AcceptShapeDecomposition() const
|
||||
//=======================================================================
|
||||
void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPrs,
|
||||
const Standard_Integer aMode)
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
aPrs->Clear();
|
||||
if(myshape.IsNull()) return;
|
||||
@@ -144,13 +144,14 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
|
||||
if (IsInfinite())
|
||||
{
|
||||
aPrs->SetInfiniteState (Standard_True); //not taken in account duting FITALL
|
||||
aPrs->SetInfiniteState (Standard_True); //not taken in account during FITALL
|
||||
}
|
||||
|
||||
switch (aMode)
|
||||
switch (theMode)
|
||||
{
|
||||
case AIS_WireFrame:
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
@@ -169,18 +170,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
}
|
||||
case AIS_Shaded:
|
||||
{
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
{
|
||||
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
|
||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
|
||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev);
|
||||
if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
|
||||
|| (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion()))
|
||||
{
|
||||
BRepTools::Clean (myshape);
|
||||
}
|
||||
}
|
||||
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
if ((Standard_Integer) myshape.ShapeType() > 4)
|
||||
{
|
||||
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
|
||||
|
@@ -440,28 +440,14 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
||||
{
|
||||
case AIS_WireFrame:
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
StdPrs_WFShape::Add (thePrs, myshape, myDrawer);
|
||||
break;
|
||||
}
|
||||
case AIS_Shaded:
|
||||
case 3: // texture mapping on triangulation
|
||||
{
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
{
|
||||
Standard_Real aPrevAngle;
|
||||
Standard_Real aNewAngle;
|
||||
Standard_Real aPrevCoeff;
|
||||
Standard_Real aNewCoeff;
|
||||
|
||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (aNewAngle, aPrevAngle);
|
||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient (aNewCoeff,aPrevCoeff);
|
||||
if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnDeviationAngle) ||
|
||||
((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnDeviationCoefficient))
|
||||
{
|
||||
BRepTools::Clean (myshape);
|
||||
}
|
||||
}
|
||||
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
if (myshape.ShapeType() > TopAbs_FACE)
|
||||
{
|
||||
StdPrs_WFShape::Add (thePrs, myshape, myDrawer);
|
||||
|
@@ -99,6 +99,11 @@ AIS_LocalContext_1.cxx
|
||||
AIS_LocalStatus.cxx
|
||||
AIS_LocalStatus.hxx
|
||||
AIS_LocalStatus.lxx
|
||||
AIS_Manipulator.hxx
|
||||
AIS_Manipulator.cxx
|
||||
AIS_ManipulatorMode.hxx
|
||||
AIS_ManipulatorOwner.hxx
|
||||
AIS_ManipulatorOwner.cxx
|
||||
AIS_MapIteratorOfMapOfInteractive.hxx
|
||||
AIS_MapOfInteractive.hxx
|
||||
AIS_MaxRadiusDimension.cxx
|
||||
|
@@ -49,6 +49,10 @@ class Geom2d_BSplineCurve;
|
||||
//! the curve by algorithms, which use it.
|
||||
//! A derived concrete class is provided:
|
||||
//! Geom2dAdaptor_Curve for a curve from the Geom2d package.
|
||||
//!
|
||||
//! Polynomial coefficients of BSpline curves used for their evaluation are
|
||||
//! cached for better performance. Therefore these evaluations are not
|
||||
//! thread-safe and parallel evaluations need to be prevented.
|
||||
class Adaptor2d_Curve2d
|
||||
{
|
||||
public:
|
||||
|
@@ -51,6 +51,10 @@ class Geom_BSplineCurve;
|
||||
//! - GeomAdaptor_Curve for a curve from the Geom package
|
||||
//! - Adaptor3d_CurveOnSurface for a curve lying on
|
||||
//! a surface from the Geom package.
|
||||
//!
|
||||
//! Polynomial coefficients of BSpline curves used for their evaluation are
|
||||
//! cached for better performance. Therefore these evaluations are not
|
||||
//! thread-safe and parallel evaluations need to be prevented.
|
||||
class Adaptor3d_Curve
|
||||
{
|
||||
public:
|
||||
|
@@ -846,16 +846,19 @@ Standard_Integer Adaptor3d_CurveOnSurface::NbIntervals (const GeomAbs_Shape S) c
|
||||
Standard_Integer nu,nv,nc;
|
||||
nu=mySurface->NbUIntervals(S);
|
||||
nv=mySurface->NbVIntervals(S);
|
||||
nc=myCurve->NbIntervals(S);
|
||||
|
||||
// Allocate the memory for arrays TabU, TabV, TabC only once using the buffer TabBuf.
|
||||
TColStd_Array1OfReal TabBuf(1, nu + nv + nc + 3);
|
||||
TColStd_Array1OfReal TabU(TabBuf(1), 1, nu+1);
|
||||
TColStd_Array1OfReal TabV(TabBuf(nu + 2), 1, nv+1);
|
||||
TColStd_Array1OfReal TabC(TabBuf(nu + nv + 3), 1, nc+1);
|
||||
|
||||
TColStd_Array1OfReal TabU(1,nu+1);
|
||||
TColStd_Array1OfReal TabV(1,nv+1);
|
||||
Standard_Integer NbSample = 20;
|
||||
Standard_Real U,V,Tdeb,Tfin;
|
||||
Tdeb=myCurve->FirstParameter();
|
||||
Tfin=myCurve->LastParameter();
|
||||
|
||||
nc=myCurve->NbIntervals(S);
|
||||
TColStd_Array1OfReal TabC(1,nc+1);
|
||||
myCurve->Intervals(TabC,S);
|
||||
|
||||
Standard_Real Tol= Precision::PConfusion()/10;
|
||||
|
@@ -61,6 +61,10 @@ class Adaptor3d_HCurve;
|
||||
//! Warning: All the methods are virtual and implemented with a
|
||||
//! raise to allow to redefined only the methods realy
|
||||
//! used.
|
||||
//!
|
||||
//! Polynomial coefficients of BSpline surfaces used for their evaluation are
|
||||
//! cached for better performance. Therefore these evaluations are not
|
||||
//! thread-safe and parallel evaluations need to be prevented.
|
||||
class Adaptor3d_Surface
|
||||
{
|
||||
public:
|
||||
|
@@ -42,92 +42,26 @@
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
#ifdef DRAW
|
||||
#include <DrawTrSurf.hxx>
|
||||
#endif
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <stdio.h>
|
||||
static Standard_Boolean Voir = Standard_False;
|
||||
static Standard_Boolean AffichFw = Standard_False;
|
||||
static Standard_Integer NbCurve = 0;
|
||||
#endif
|
||||
//
|
||||
// allows testing if Extrema produces correct results/
|
||||
|
||||
|
||||
static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
const gp_Pnt APoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NumIteration,
|
||||
const Adaptor3d_Curve& Curve,
|
||||
Standard_Boolean& Status,
|
||||
Standard_Real& Result)
|
||||
{
|
||||
Standard_Integer num_iter = 0,
|
||||
not_done = 1,
|
||||
ii ;
|
||||
|
||||
gp_Pnt a_point ;
|
||||
gp_Vec vector,
|
||||
d1,
|
||||
d2 ;
|
||||
Standard_Real func,
|
||||
func_derivative,
|
||||
param = InitValue ;
|
||||
Status = Standard_False ;
|
||||
Standard_Real Toler = 1.0e-12;
|
||||
do {
|
||||
num_iter += 1 ;
|
||||
Curve.D2(param,
|
||||
a_point,
|
||||
d1,
|
||||
d2) ;
|
||||
for (ii = 1 ; ii <= 3 ; ii++) {
|
||||
vector.SetCoord(ii, APoint.Coord(ii) - a_point.Coord(ii)) ;
|
||||
}
|
||||
func = vector.Dot(d1) ;
|
||||
func_derivative = vector.Dot(d2) ;
|
||||
func_derivative -= d1.Dot(d1) ;
|
||||
if ( Abs(func) < Tolerance * d1.Magnitude()) {
|
||||
not_done = 0 ;
|
||||
Status = Standard_True ;
|
||||
}
|
||||
else
|
||||
{ // fixing a bug PRO18577 : avoid divizion by zero
|
||||
if( Abs(func_derivative) > Toler ) {
|
||||
param -= func / func_derivative ;
|
||||
}
|
||||
param = Max(param,Curve.FirstParameter()) ;
|
||||
param = Min(param,Curve.LastParameter()) ;
|
||||
//Status = Standard_True ;
|
||||
}
|
||||
}
|
||||
while (not_done && num_iter <= NumIteration) ;
|
||||
Result = param ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//class : Approx_SameParameter_Evaluator
|
||||
//purpose :
|
||||
//class : Approx_SameParameter_Evaluator
|
||||
//purpose : Used in same parameterization curve approximation.
|
||||
//=======================================================================
|
||||
|
||||
class Approx_SameParameter_Evaluator : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
Approx_SameParameter_Evaluator (const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColStd_Array1OfReal& thePoles,
|
||||
const Handle(Adaptor2d_HCurve2d)& theHCurve2d)
|
||||
: FlatKnots(theFlatKnots), Poles(thePoles), HCurve2d(theHCurve2d) {}
|
||||
Approx_SameParameter_Evaluator (const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColStd_Array1OfReal& thePoles,
|
||||
const Handle(Adaptor2d_HCurve2d)& theHCurve2d)
|
||||
: FlatKnots(theFlatKnots),
|
||||
Poles(thePoles),
|
||||
HCurve2d(theHCurve2d) {}
|
||||
|
||||
virtual void Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
|
||||
private:
|
||||
const TColStd_Array1OfReal& FlatKnots;
|
||||
@@ -135,166 +69,183 @@ private:
|
||||
Handle(Adaptor2d_HCurve2d) HCurve2d;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : Evaluate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Approx_SameParameter_Evaluator::Evaluate (Standard_Integer *,/*Dimension*/
|
||||
Standard_Real /*StartEnd*/[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result,
|
||||
Standard_Integer *ReturnCode)
|
||||
{
|
||||
gp_Pnt2d Point ;
|
||||
gp_Vec2d Vector ;
|
||||
Standard_Integer extrap_mode[2] ;
|
||||
extrap_mode[0] = extrap_mode[1] = 3;
|
||||
Standard_Real eval_result[2] ;
|
||||
Standard_Real *PolesArray =
|
||||
(Standard_Real *) &Poles(Poles.Lower()) ;
|
||||
//
|
||||
// evaluate the 1D bspline that represents the change in parameterization
|
||||
//
|
||||
Standard_Real /*StartEnd*/[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result,
|
||||
Standard_Integer *ReturnCode)
|
||||
{
|
||||
const Standard_Integer aDegree = 3;
|
||||
Standard_Integer extrap_mode[2] = {aDegree, aDegree};
|
||||
Standard_Real eval_result[2];
|
||||
Standard_Real *PolesArray = (Standard_Real *) &Poles(Poles.Lower()) ;
|
||||
|
||||
// Evaluate the 1D B-Spline that represents the change in parameterization.
|
||||
BSplCLib::Eval(*Parameter,
|
||||
Standard_False,
|
||||
*DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
3,
|
||||
FlatKnots,
|
||||
1,
|
||||
PolesArray[0],
|
||||
eval_result[0]) ;
|
||||
Standard_False,
|
||||
*DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
aDegree,
|
||||
FlatKnots,
|
||||
1,
|
||||
PolesArray[0],
|
||||
eval_result[0]);
|
||||
|
||||
gp_Pnt2d aPoint;
|
||||
gp_Vec2d aVector;
|
||||
if (*DerivativeRequest == 0)
|
||||
{
|
||||
HCurve2d->D0(eval_result[0], aPoint);
|
||||
aPoint.Coord(Result[0],Result[1]);
|
||||
}
|
||||
else if (*DerivativeRequest == 1)
|
||||
{
|
||||
HCurve2d->D1(eval_result[0], aPoint, aVector);
|
||||
aVector.Multiply(eval_result[1]);
|
||||
aVector.Coord(Result[0],Result[1]);
|
||||
}
|
||||
|
||||
if (*DerivativeRequest == 0){
|
||||
HCurve2d->D0(eval_result[0],Point);
|
||||
Point.Coord(Result[0],Result[1]);
|
||||
}
|
||||
else if (*DerivativeRequest == 1){
|
||||
HCurve2d->D1(eval_result[0], Point, Vector);
|
||||
Vector.Multiply(eval_result[1]);
|
||||
Vector.Coord(Result[0],Result[1]);
|
||||
}
|
||||
ReturnCode[0] = 0 ;
|
||||
ReturnCode[0] = 0;
|
||||
}
|
||||
|
||||
static Standard_Real ComputeTolReached(const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
const Standard_Integer nbp)
|
||||
//=======================================================================
|
||||
//function : ProjectPointOnCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void ProjectPointOnCurve(const Standard_Real InitValue,
|
||||
const gp_Pnt APoint,
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Integer NumIteration,
|
||||
const Adaptor3d_Curve& Curve,
|
||||
Standard_Boolean& Status,
|
||||
Standard_Real& Result)
|
||||
{
|
||||
Standard_Real d2 = 0.;
|
||||
Standard_Integer num_iter = 0, not_done = 1, ii;
|
||||
|
||||
gp_Pnt a_point;
|
||||
gp_Vec vector, d1, d2;
|
||||
Standard_Real func, func_derivative,
|
||||
param = InitValue;
|
||||
Status = Standard_False;
|
||||
do
|
||||
{
|
||||
num_iter++;
|
||||
Curve.D2(param, a_point, d1, d2);
|
||||
for (ii = 1 ; ii <= 3 ; ii++)
|
||||
vector.SetCoord(ii, APoint.Coord(ii) - a_point.Coord(ii));
|
||||
|
||||
func = vector.Dot(d1);
|
||||
if ( Abs(func) < Tolerance * d1.Magnitude())
|
||||
{
|
||||
not_done = 0;
|
||||
Status = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
func_derivative = vector.Dot(d2) - d1.Dot(d1);
|
||||
|
||||
// Avoid division by zero.
|
||||
const Standard_Real Toler = 1.0e-12;
|
||||
if( Abs(func_derivative) > Toler )
|
||||
param -= func / func_derivative;
|
||||
|
||||
param = Max(param,Curve.FirstParameter());
|
||||
param = Min(param,Curve.LastParameter());
|
||||
}
|
||||
} while (not_done && num_iter <= NumIteration);
|
||||
|
||||
Result = param;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeTolReached
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Real ComputeTolReached(const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
const Standard_Integer nbp)
|
||||
{
|
||||
Standard_Real d2 = 0.0; // Square max discrete deviation.
|
||||
const Standard_Real first = c3d->FirstParameter();
|
||||
const Standard_Real last = c3d->LastParameter();
|
||||
for(Standard_Integer i = 0; i <= nbp; i++){
|
||||
Standard_Real t = IntToReal(i)/IntToReal(nbp);
|
||||
Standard_Real u = first*(1.-t) + last*t;
|
||||
for(Standard_Integer i = 0; i <= nbp; i++)
|
||||
{
|
||||
Standard_Real t = IntToReal(i) / IntToReal(nbp);
|
||||
Standard_Real u = first * (1.0 - t) + last * t;
|
||||
gp_Pnt Pc3d = c3d->Value(u);
|
||||
gp_Pnt Pcons = cons.Value(u);
|
||||
if (Precision::IsInfinite(Pcons.X()) ||
|
||||
Precision::IsInfinite(Pcons.Y()) ||
|
||||
Precision::IsInfinite(Pcons.Z())) {
|
||||
Precision::IsInfinite(Pcons.Y()) ||
|
||||
Precision::IsInfinite(Pcons.Z()))
|
||||
{
|
||||
d2=Precision::Infinite();
|
||||
break;
|
||||
}
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp > d2) d2 = temp;
|
||||
d2 = Max(d2, Pc3d.SquareDistance(Pcons));
|
||||
}
|
||||
d2 = 1.5*sqrt(d2);
|
||||
if(d2<1.e-7) d2 = 1.e-7;
|
||||
return d2;
|
||||
|
||||
const Standard_Real aMult = 1.5; // To be tolerant to discrete tolerance computing.
|
||||
Standard_Real aDeviation = aMult * sqrt(d2);
|
||||
aDeviation = Max(aDeviation, Precision::Confusion()); // Tolerance in modeling space.
|
||||
return aDeviation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Check
|
||||
//purpose : Check current interpolation for validity.
|
||||
//=======================================================================
|
||||
static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
const TColStd_Array1OfReal& Poles,
|
||||
const Standard_Integer nbp,
|
||||
const TColStd_Array1OfReal& pc3d,
|
||||
// const TColStd_Array1OfReal& pcons,
|
||||
const TColStd_Array1OfReal& ,
|
||||
const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
Standard_Real& tol,
|
||||
const Standard_Real oldtol)
|
||||
const TColStd_Array1OfReal& Poles,
|
||||
const Standard_Integer nbp,
|
||||
const TColStd_Array1OfReal& pc3d,
|
||||
const TColStd_Array1OfReal& ,
|
||||
const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
Standard_Real& tol,
|
||||
const Standard_Real oldtol)
|
||||
{
|
||||
Standard_Real d = tol;
|
||||
Standard_Integer extrap_mode[2] ;
|
||||
extrap_mode[0] = extrap_mode[1] = 3;
|
||||
Standard_Integer i;
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir) {
|
||||
cout<<endl;
|
||||
cout<<"Control the change of variable : "<<endl;
|
||||
cout<<"yawn mesured by projection : "<<d<<endl;
|
||||
cout<<"Number of points : "<<nbp<<endl;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
Standard_Real glis = 0., dglis = 0.;
|
||||
for(i = 1; i <= nbp; i++){
|
||||
Standard_Real tc3d = pc3d(i);
|
||||
gp_Pnt Pc3d = c3d->Value(tc3d);
|
||||
Standard_Real tcons;
|
||||
BSplCLib::Eval(tc3d,Standard_False,0,extrap_mode[0],
|
||||
3,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp >= dglis) dglis = temp;
|
||||
temp = Abs(tcons-pcons(i));
|
||||
if(temp >= glis) glis = temp;
|
||||
}
|
||||
dglis = sqrt(dglis);
|
||||
#ifdef OCCT_DEBUG
|
||||
if ( Voir) {
|
||||
cout<<"shift of parameter to the imposed points : "<<glis<<endl;
|
||||
cout<<"shift distance at the imposed points : "<<dglis<<endl;
|
||||
}
|
||||
#endif
|
||||
dglis = 0.;
|
||||
for(i = 1; i < nbp; i++){
|
||||
Standard_Real tc3d = 0.5*(pc3d(i)+pc3d(i+1));
|
||||
gp_Pnt Pc3d = c3d->Value(tc3d);
|
||||
Standard_Real tcons;
|
||||
BSplCLib::Eval(tc3d,Standard_False,0,extrap_mode[0],
|
||||
3,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp >= dglis) dglis = temp;
|
||||
}
|
||||
dglis = sqrt(dglis);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir)
|
||||
cout<<"distance de glissement en milieu d intervals : "<<dglis<<endl;
|
||||
#endif
|
||||
#endif
|
||||
const Standard_Integer aDegree = 3;
|
||||
Standard_Integer extrap_mode[2] = {aDegree, aDegree};
|
||||
|
||||
Standard_Real d2 = 0.;
|
||||
Standard_Integer nn = 2*nbp;
|
||||
Standard_Real unsurnn = 1./nn;
|
||||
// Modified by skv - Wed Jun 2 11:49:59 2004 OCC5898 Begin
|
||||
// Correction of the interval of valid values. This condition has no sensible
|
||||
// grounds. But it is better then the old one (which is commented out) because
|
||||
// it fixes the bug OCC5898. To develop more or less sensible criterion it is
|
||||
// necessary to deeply investigate this problem which is not possible in frames
|
||||
// of debugging.
|
||||
Standard_Real aParamFirst = 3.0 * pc3d(1) - 2.0 * pc3d(nbp);
|
||||
Standard_Real aParamLast = 3.0 * pc3d(nbp) - 2.0 * pc3d(1);
|
||||
|
||||
// Standard_Real firstborne= 2*pc3d(1)-pc3d(nbp);
|
||||
// Standard_Real lastborne= 2*pc3d(nbp)-pc3d(1);
|
||||
Standard_Real firstborne= 3.*pc3d(1) - 2.*pc3d(nbp);
|
||||
Standard_Real lastborne = 3.*pc3d(nbp) - 2.*pc3d(1);
|
||||
// Modified by skv - Wed Jun 2 11:50:03 2004 OCC5898 End
|
||||
//jgv
|
||||
Standard_Real FirstPar = cons.FirstParameter();
|
||||
Standard_Real LastPar = cons.LastParameter();
|
||||
if (firstborne < FirstPar)
|
||||
firstborne = FirstPar;
|
||||
if (lastborne > LastPar)
|
||||
lastborne = LastPar;
|
||||
/////
|
||||
for(i = 0; i <= nn; i++){
|
||||
if (aParamFirst < FirstPar)
|
||||
aParamFirst = FirstPar;
|
||||
if (aParamLast > LastPar)
|
||||
aParamLast = LastPar;
|
||||
|
||||
|
||||
Standard_Real d2 = 0.0; // Maximum square deviation on the samples.
|
||||
const Standard_Real d = tol;
|
||||
const Standard_Integer nn = 2 * nbp;
|
||||
const Standard_Real unsurnn = 1.0/nn;
|
||||
for(Standard_Integer i = 0; i <= nn; i++)
|
||||
{
|
||||
// Compute corresponding parameter on 2d curve.
|
||||
// It should be inside of 3d curve parameter space.
|
||||
Standard_Real t = unsurnn*i;
|
||||
Standard_Real tc3d = pc3d(1)*(1.-t) + pc3d(nbp)*t;
|
||||
gp_Pnt Pc3d = c3d->Value(tc3d);
|
||||
Standard_Real tcons;
|
||||
BSplCLib::Eval(tc3d,Standard_False,0,extrap_mode[0],
|
||||
3,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
if (tcons < firstborne || tcons > lastborne) {
|
||||
tol=Precision::Infinite();
|
||||
aDegree,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
if (tcons < aParamFirst ||
|
||||
tcons > aParamLast)
|
||||
{
|
||||
tol = Precision::Infinite();
|
||||
return Standard_False;
|
||||
}
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
@@ -302,24 +253,30 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
tol = sqrt(d2);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir)
|
||||
cout<<"distance max on "<<nn<<" points : "<<tol<<endl<<endl;
|
||||
#endif
|
||||
return ((tol <= d) || (tol > 0.8 * oldtol));
|
||||
}
|
||||
|
||||
// Check poles parameters to be ordered.
|
||||
for(Standard_Integer i = Poles.Lower() + 1; i <= Poles.Upper(); ++i)
|
||||
{
|
||||
const Standard_Real aPreviousParam = Poles(i - 1);
|
||||
const Standard_Real aCurrentParam = Poles(i);
|
||||
|
||||
if (aPreviousParam > aCurrentParam)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return (tol <= d || tol > 0.8 * oldtol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Approx_SameParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Approx_SameParameter::Approx_SameParameter(const Handle(Geom_Curve)& C3D,
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Geom_Surface)& S,
|
||||
const Standard_Real Tol):
|
||||
mySameParameter(Standard_True), myDone(Standard_False)
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Geom_Surface)& S,
|
||||
const Standard_Real Tol)
|
||||
: mySameParameter(Standard_True),
|
||||
myDone(Standard_False)
|
||||
{
|
||||
myHCurve2d = new Geom2dAdaptor_HCurve(C2D);
|
||||
myC3d = new GeomAdaptor_HCurve(C3D);
|
||||
@@ -327,17 +284,16 @@ mySameParameter(Standard_True), myDone(Standard_False)
|
||||
Build(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Approx_SameParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol):
|
||||
mySameParameter(Standard_True), myDone(Standard_False)
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol)
|
||||
: mySameParameter(Standard_True),
|
||||
myDone(Standard_False)
|
||||
{
|
||||
myC3d = C3D;
|
||||
mySurf = S;
|
||||
@@ -345,17 +301,16 @@ mySameParameter(Standard_True), myDone(Standard_False)
|
||||
Build(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Approx_SameParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D,
|
||||
const Handle(Adaptor2d_HCurve2d)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol):
|
||||
mySameParameter(Standard_True), myDone(Standard_False)
|
||||
const Handle(Adaptor2d_HCurve2d)& C2D,
|
||||
const Handle(Adaptor3d_HSurface)& S,
|
||||
const Standard_Real Tol)
|
||||
: mySameParameter(Standard_True),
|
||||
myDone(Standard_False)
|
||||
{
|
||||
myC3d = C3D;
|
||||
mySurf = S;
|
||||
@@ -363,7 +318,6 @@ mySameParameter(Standard_True), myDone(Standard_False)
|
||||
Build(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//purpose :
|
||||
@@ -381,10 +335,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
Standard_Real fc3d = myC3d->FirstParameter();
|
||||
Standard_Real lc3d = myC3d->LastParameter();
|
||||
|
||||
GeomAbs_Shape Continuity = myHCurve2d->Continuity();
|
||||
|
||||
if(Continuity > GeomAbs_C1) Continuity = GeomAbs_C1;
|
||||
|
||||
//Control tangents at the extremities to know if the
|
||||
//reparametring is possible and calculate the tangents
|
||||
//at the extremities of the function of change of variable.
|
||||
@@ -392,46 +342,38 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
gp_Pnt Pcons,Pc3d;
|
||||
gp_Vec Vcons,Vc3d;
|
||||
|
||||
Standard_Real Tol = Tolerance;
|
||||
Standard_Real Tol2 = Tol * Tol;
|
||||
Standard_Real deltamin = Precision::PConfusion();//50*Tolp;
|
||||
const Standard_Real Tol = Tolerance;
|
||||
const Standard_Real Tol2 = Tol * Tol;
|
||||
Standard_Real deltamin = Precision::PConfusion();
|
||||
|
||||
Standard_Real besttol2 = Tol2;
|
||||
Standard_Boolean extrok = 0;
|
||||
|
||||
extrok = 1;
|
||||
// Check tangency on curve border.
|
||||
Standard_Boolean extrok = 1;
|
||||
CurveOnSurface.D1(fcons,Pcons,Vcons);
|
||||
myC3d->D1(fc3d,Pc3d,Vc3d);
|
||||
Standard_Real dist2 = Pcons.SquareDistance(Pc3d);
|
||||
Standard_Real dmax2 = dist2;
|
||||
|
||||
Standard_Real magVcons = Vcons.Magnitude();
|
||||
if (magVcons > 1.e-12){
|
||||
if (magVcons > 1.e-12)
|
||||
tangent[0] = Vc3d.Magnitude() / magVcons;
|
||||
}
|
||||
else extrok = 0;
|
||||
|
||||
CurveOnSurface.D1(lcons,Pcons,Vcons);
|
||||
myC3d->D1(lc3d,Pc3d,Vc3d);
|
||||
dist2 = Pcons.SquareDistance(Pc3d);
|
||||
|
||||
if(dist2 > dmax2) dmax2 = dist2;
|
||||
dmax2 = Max(dmax2, dist2);
|
||||
magVcons = Vcons.Magnitude();
|
||||
if (magVcons > 1.e-12){
|
||||
if (magVcons > 1.e-12)
|
||||
tangent[1] = Vc3d.Magnitude() / magVcons;
|
||||
}
|
||||
else extrok = 0;
|
||||
|
||||
|
||||
//if(dmax2 > besttol2) besttol2 = dmax2;
|
||||
|
||||
//Take a multiple of the sample pof CheckShape,
|
||||
//at least the control points will be correct. No comment!!!
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
Standard_Integer nbcoups = 0;
|
||||
#endif
|
||||
|
||||
Standard_Boolean interpolok = 0;
|
||||
Standard_Real tolsov = 1.e200;
|
||||
//Take parameters with constant step on the curve on surface
|
||||
@@ -445,7 +387,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
Standard_Real wc3d = fc3d;
|
||||
|
||||
Standard_Real qpcons[aMaxArraySize], qnewpcons[aMaxArraySize],
|
||||
qpc3d[aMaxArraySize], qnewpc3d[aMaxArraySize];
|
||||
qpc3d[aMaxArraySize], qnewpc3d[aMaxArraySize];
|
||||
Standard_Real * pcons = qpcons; Standard_Real * newpcons = qnewpcons;
|
||||
Standard_Real * pc3d = qpc3d; Standard_Real * newpc3d = qnewpc3d;
|
||||
|
||||
@@ -458,8 +400,12 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons[NCONTROL] = lcons;
|
||||
pc3d[NCONTROL] = lc3d;
|
||||
|
||||
// Change number of points in case of C0 continuity.
|
||||
Standard_Integer New_NCONTROL = NCONTROL;
|
||||
if(Continuity < GeomAbs_C1) {
|
||||
GeomAbs_Shape Continuity = myHCurve2d->Continuity();
|
||||
if(Continuity > GeomAbs_C1) Continuity = GeomAbs_C1;
|
||||
if(Continuity < GeomAbs_C1)
|
||||
{
|
||||
Standard_Integer NbInt = myHCurve2d->NbIntervals(GeomAbs_C1) + 1;
|
||||
TColStd_Array1OfReal Param_de_decoupeC1 (1, NbInt);
|
||||
myHCurve2d->Intervals(Param_de_decoupeC1, GeomAbs_C1);
|
||||
@@ -502,12 +448,12 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pc3d[New_NCONTROL] = lc3d;
|
||||
}
|
||||
|
||||
|
||||
// Check existing same parameter state.
|
||||
Extrema_LocateExtPC Projector;
|
||||
Projector.Initialize(myC3d->Curve(),fc3d,lc3d,Tol);
|
||||
|
||||
Standard_Integer count = 1;
|
||||
Standard_Real previousp = fc3d, initp=0, curp;//, deltamin = 50*Tolp;
|
||||
Standard_Real previousp = fc3d, initp=0, curp;
|
||||
Standard_Real bornesup = lc3d - deltamin;
|
||||
Standard_Boolean projok = 0,
|
||||
use_parameter ;
|
||||
@@ -596,7 +542,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
{
|
||||
//Projector
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -608,7 +553,9 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!extrok) { // If not already SameP and tangent to mill, abandon.
|
||||
if(!extrok)
|
||||
{
|
||||
// If not already SameP and tangent to mill, abandon.
|
||||
mySameParameter = Standard_False;
|
||||
#ifdef OCCT_DEBUG
|
||||
cout<<"SameParameter problem : zero tangent to extremities"<<endl;
|
||||
@@ -619,30 +566,11 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons[count] = lcons;
|
||||
pc3d[count] = lc3d;
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
if (AffichFw) {
|
||||
char Name[17];
|
||||
Name[0]='\0';
|
||||
TColgp_Array1OfPnt2d DEBP2d (0,count);
|
||||
TColStd_Array1OfInteger DEBMults(0,count);
|
||||
DEBMults.Init(1); DEBMults(0) = 2; DEBMults(count) = 2;
|
||||
TColStd_Array1OfReal DEBKnots(0,count);
|
||||
for (Standard_Integer DEBi = 0; DEBi <= count; DEBi++) {
|
||||
DEBKnots(DEBi) = DEBi;
|
||||
DEBP2d (DEBi) = gp_Pnt2d(pc3d[DEBi],pcons[DEBi]);
|
||||
}
|
||||
Handle(Geom2d_BSplineCurve) DEBBS =
|
||||
new Geom2d_BSplineCurve(DEBP2d,DEBKnots,DEBMults,1);
|
||||
Sprintf(Name,"DEBC2d_%d",++NbCurve);
|
||||
#ifdef DRAW
|
||||
DrawTrSurf::Set(Name,DEBBS);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// There is at least one point where same parameter is broken.
|
||||
// Try to build B-spline interpolation curve with degree 3.
|
||||
// The loop is organized over number of poles.
|
||||
Standard_Boolean hasCountChanged = Standard_False;
|
||||
|
||||
while(!interpolok)
|
||||
do
|
||||
{
|
||||
// The tables and their limits for the interpolation.
|
||||
Standard_Integer num_knots = count + 7;
|
||||
@@ -679,53 +607,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
Standard_ConstructionError::Raise();
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
#ifdef OCCT_DEBUG
|
||||
if (AffichFw) {
|
||||
nbcoups ++;
|
||||
char Name[17];
|
||||
Name[0] = '\0';
|
||||
Standard_Integer nnn = 100;
|
||||
TColgp_Array1OfPnt2d DEBP2d (0,nnn);
|
||||
TColStd_Array1OfInteger DEBMults(0,nnn);
|
||||
DEBMults.Init(1); DEBMults(0) = 2; DEBMults(nnn) = 2;
|
||||
TColStd_Array1OfReal DEBKnots(0,nnn);
|
||||
Standard_Real du = (lc3d - fc3d) / nnn;
|
||||
Standard_Real u3d = fc3d;
|
||||
Standard_Integer extrap_mode[2] ;
|
||||
extrap_mode[0] = extrap_mode[1] = 3;
|
||||
Standard_Real eval_result[2] ;
|
||||
Standard_Integer DerivativeRequest = 0;
|
||||
Standard_Real *PolesArray =
|
||||
(Standard_Real *) &Poles(Poles.Lower()) ;
|
||||
|
||||
for (Standard_Integer DEBi = 0; DEBi <= nnn; DEBi++) {
|
||||
DEBKnots(DEBi) = DEBi;
|
||||
BSplCLib::Eval(u3d,
|
||||
Standard_False,
|
||||
DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
3,
|
||||
FlatKnots,
|
||||
1,
|
||||
PolesArray[0],
|
||||
eval_result[0]) ;
|
||||
|
||||
DEBP2d (DEBi) = gp_Pnt2d(u3d,eval_result[0]);
|
||||
u3d += du;
|
||||
}
|
||||
|
||||
Handle(Geom2d_BSplineCurve) DEBBS =
|
||||
new Geom2d_BSplineCurve(DEBP2d,DEBKnots,DEBMults,1);
|
||||
Sprintf(Name,"DEBC2d_%d_%d",NbCurve,nbcoups );
|
||||
#ifdef DRAW
|
||||
DrawTrSurf::Set(Name,DEBBS);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
//-------------------------------------------
|
||||
|
||||
//-------------------------------------------
|
||||
// Test if par2d(par3d) is monotonous function or not ----- IFV, Jan 2000
|
||||
// and try to insert new point to improve BSpline interpolation
|
||||
|
||||
@@ -772,7 +653,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -790,14 +670,19 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons = newpcons;
|
||||
newpcons = temp;
|
||||
|
||||
if((count != newcount) && newcount < aMaxArraySize) { count = newcount; continue;}
|
||||
if((count != newcount) && newcount < aMaxArraySize)
|
||||
{
|
||||
hasCountChanged = Standard_True;
|
||||
count = newcount;
|
||||
continue;
|
||||
}
|
||||
|
||||
count = newcount;
|
||||
|
||||
Standard_Real algtol = sqrt(besttol2);
|
||||
|
||||
interpolok = Check (FlatKnots, Poles, count+1, Paramc3d, Paramcons,
|
||||
myC3d, CurveOnSurface, algtol, tolsov);
|
||||
myC3d, CurveOnSurface, algtol, tolsov);
|
||||
|
||||
if (Precision::IsInfinite(algtol)) {
|
||||
mySameParameter = Standard_False;
|
||||
@@ -809,17 +694,12 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
tolsov = algtol;
|
||||
|
||||
interpolok = (interpolok || count >= aMaxArraySize);
|
||||
interpolok = (interpolok || // Good result.
|
||||
count >= aMaxArraySize - 1 ); // Number of points.
|
||||
|
||||
if(interpolok) {
|
||||
Standard_Real besttol = sqrt(besttol2);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir) {
|
||||
if(algtol > besttol){
|
||||
cout<<"SameParameter : Tol can't be reached before approx"<<endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
|
||||
tol1d = new TColStd_HArray1OfReal(1,2) ;
|
||||
tol1d->SetValue(1, mySurf->UResolution(besttol));
|
||||
@@ -840,7 +720,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
if(myTolReached > anErrorMAX)
|
||||
{
|
||||
//This tolerance is too big. Probably, we will not can get
|
||||
//This tolerance is too big. Probably, we will not be able to get
|
||||
//edge with sameparameter in this case.
|
||||
|
||||
myDone = Standard_False;
|
||||
@@ -853,7 +733,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
//(else we can have circularity)
|
||||
{
|
||||
myCurve2d = aC2d;
|
||||
myHCurve2d = new Geom2dAdaptor_HCurve(myCurve2d);
|
||||
myHCurve2d = aHCurve2d;
|
||||
myDone = Standard_True;
|
||||
}
|
||||
else
|
||||
@@ -866,10 +746,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
if(!interpolok)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir)
|
||||
cout<<"SameParameter : Not enough points, enrich"<<endl;
|
||||
#endif
|
||||
|
||||
newcount = 0;
|
||||
for(Standard_Integer n = 0; n < count; n++){
|
||||
@@ -902,7 +778,6 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -927,5 +802,82 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
hasCountChanged = Standard_False;
|
||||
}
|
||||
}
|
||||
} while(!interpolok && hasCountChanged);
|
||||
|
||||
if (!myDone)
|
||||
{
|
||||
// Loop is finished unsuccessfully. Fix tolerance by maximal deviation,
|
||||
// using data from the last loop iteration.
|
||||
Standard_Integer num_knots = count + 7;
|
||||
Standard_Integer num_poles = count + 3;
|
||||
TColStd_Array1OfReal Paramc3d(*pc3d,1,count + 1);
|
||||
TColStd_Array1OfReal Paramcons(*pcons,1,count + 1);
|
||||
TColStd_Array1OfInteger ContactOrder(1,num_poles) ;
|
||||
TColStd_Array1OfReal Poles(1,num_poles) ;
|
||||
TColStd_Array1OfReal InterpolationParameters(1,num_poles) ;
|
||||
TColStd_Array1OfReal FlatKnots(1,num_knots) ;
|
||||
|
||||
// Fill tables taking attention to end values.
|
||||
ContactOrder.Init(0);
|
||||
ContactOrder(2) = ContactOrder(num_poles - 1) = 1;
|
||||
|
||||
FlatKnots(1) = FlatKnots(2) = FlatKnots(3) = FlatKnots(4) = fc3d;
|
||||
FlatKnots(num_poles + 1) = FlatKnots(num_poles + 2) =
|
||||
FlatKnots(num_poles + 3) = FlatKnots(num_poles + 4) = lc3d;
|
||||
|
||||
Poles(1) = fcons; Poles(num_poles) = lcons;
|
||||
Poles(2) = tangent[0]; Poles(num_poles - 1) = tangent[1];
|
||||
|
||||
InterpolationParameters(1) = InterpolationParameters(2) = fc3d;
|
||||
InterpolationParameters(num_poles - 1) = InterpolationParameters(num_poles) = lc3d;
|
||||
|
||||
for (ii = 3; ii <= num_poles - 2; ii++)
|
||||
{
|
||||
Poles(ii) = Paramcons(ii - 1);
|
||||
InterpolationParameters(ii) = FlatKnots(ii+2) = Paramc3d(ii - 1);
|
||||
}
|
||||
Standard_Integer inversion_problem;
|
||||
BSplCLib::Interpolate(3,FlatKnots,InterpolationParameters,ContactOrder,
|
||||
1,Poles(1),inversion_problem);
|
||||
if(inversion_problem)
|
||||
{
|
||||
Standard_ConstructionError::Raise();
|
||||
}
|
||||
|
||||
Standard_Real besttol = sqrt(besttol2);
|
||||
Handle(TColStd_HArray1OfReal) tol1d,tol2d,tol3d;
|
||||
tol1d = new TColStd_HArray1OfReal(1,2) ;
|
||||
tol1d->SetValue(1, mySurf->UResolution(besttol));
|
||||
tol1d->SetValue(2, mySurf->VResolution(besttol));
|
||||
|
||||
Approx_SameParameter_Evaluator ev (FlatKnots, Poles, myHCurve2d);
|
||||
AdvApprox_ApproxAFunction anApproximator(2,0,0,tol1d,tol2d,tol3d,fc3d,lc3d,
|
||||
Continuity,11,40,ev);
|
||||
|
||||
if (!anApproximator.IsDone() &&
|
||||
!anApproximator.HasResult() )
|
||||
{
|
||||
myDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
GeomLib_MakeCurvefromApprox aCurveBuilder(anApproximator) ;
|
||||
Handle(Geom2d_BSplineCurve) aC2d = aCurveBuilder.Curve2dFromTwo1d(1,2) ;
|
||||
Handle(Adaptor2d_HCurve2d) aHCurve2d = new Geom2dAdaptor_HCurve(aC2d);
|
||||
CurveOnSurface.Load(aHCurve2d);
|
||||
|
||||
myTolReached = ComputeTolReached(myC3d,CurveOnSurface,NCONTROL);
|
||||
|
||||
if(myTolReached > anErrorMAX)
|
||||
{
|
||||
//This tolerance is too big. Probably, we will not be able to get
|
||||
//edge with sameparameter in this case.
|
||||
myDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
myCurve2d = aC2d;
|
||||
myHCurve2d = aHCurve2d;
|
||||
myDone = Standard_True;
|
||||
}
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ protected:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
|
||||
Quantity_Color MyColor;
|
||||
|
@@ -63,17 +63,9 @@
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <algorithm>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
static
|
||||
Standard_Real AngleWithRef(const gp_Dir& theD1,
|
||||
@@ -115,6 +107,25 @@ static
|
||||
const BOPTools_ListOfCoupleOfShape& theLCS,
|
||||
const gp_Pnt& aP);
|
||||
|
||||
//=======================================================================
|
||||
// function: BOPTools_AlgoTools_ComparePoints
|
||||
// purpose: implementation of IsLess() function for two points
|
||||
//=======================================================================
|
||||
struct BOPTools_AlgoTools_ComparePoints {
|
||||
bool operator()(const gp_Pnt& theP1, const gp_Pnt& theP2)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= 3; ++i) {
|
||||
if (theP1.Coord(i) < theP2.Coord(i)) {
|
||||
return Standard_True;
|
||||
}
|
||||
else if (theP1.Coord(i) > theP2.Coord(i)) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
// function: MakeConnexityBlocks
|
||||
// purpose:
|
||||
@@ -1525,8 +1536,8 @@ void BOPTools_AlgoTools::MakeVertex(const BOPCol_ListOfShape& aLV,
|
||||
aEps=RealEpsilon();
|
||||
for (m=0; m<aNb; ++m) {
|
||||
aV[m]=(!m)?
|
||||
*((TopoDS_Vertex*)(&aLV.First())):
|
||||
*((TopoDS_Vertex*)(&aLV.Last()));
|
||||
*((TopoDS_Vertex*)(&aLV.First())):
|
||||
*((TopoDS_Vertex*)(&aLV.Last()));
|
||||
aP[m]=BRep_Tool::Pnt(aV[m]);
|
||||
aR[m]=BRep_Tool::Tolerance(aV[m]);
|
||||
}
|
||||
@@ -1559,28 +1570,38 @@ void BOPTools_AlgoTools::MakeVertex(const BOPCol_ListOfShape& aLV,
|
||||
return;
|
||||
}// else if (aNb==2) {
|
||||
//
|
||||
else { // if (aNb>2)
|
||||
Standard_Real aTi, aDi, aDmax;
|
||||
gp_Pnt aPi, aP;
|
||||
gp_XYZ aXYZ(0.,0.,0.), aXYZi;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
else { // if (aNb>2)
|
||||
// compute the point
|
||||
//
|
||||
aIt.Initialize(aLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Vertex& aVi=*((TopoDS_Vertex*)(&aIt.Value()));
|
||||
aPi=BRep_Tool::Pnt(aVi);
|
||||
aXYZi=aPi.XYZ();
|
||||
aXYZ=aXYZ+aXYZi;
|
||||
// issue 0027540 - sum of doubles may depend on the order
|
||||
// of addition, thus sort the coordinates for stable result
|
||||
Standard_Integer i;
|
||||
NCollection_Array1<gp_Pnt> aPoints(0, aNb-1);
|
||||
BOPCol_ListIteratorOfListOfShape aIt(aLV);
|
||||
for (i = 0; aIt.More(); aIt.Next(), ++i) {
|
||||
const TopoDS_Vertex& aVi = *((TopoDS_Vertex*)(&aIt.Value()));
|
||||
gp_Pnt aPi = BRep_Tool::Pnt(aVi);
|
||||
aPoints(i) = aPi;
|
||||
}
|
||||
//
|
||||
std::sort(aPoints.begin(), aPoints.end(), BOPTools_AlgoTools_ComparePoints());
|
||||
//
|
||||
gp_XYZ aXYZ(0., 0., 0.);
|
||||
for (i = 0; i < aNb; ++i) {
|
||||
aXYZ += aPoints(i).XYZ();
|
||||
}
|
||||
aXYZ.Divide((Standard_Real)aNb);
|
||||
aP.SetXYZ(aXYZ);
|
||||
//
|
||||
gp_Pnt aP(aXYZ);
|
||||
//
|
||||
// compute the tolerance for the new vertex
|
||||
Standard_Real aTi, aDi, aDmax;
|
||||
//
|
||||
aDmax=-1.;
|
||||
aIt.Initialize(aLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Vertex& aVi=*((TopoDS_Vertex*)(&aIt.Value()));
|
||||
aPi=BRep_Tool::Pnt(aVi);
|
||||
gp_Pnt aPi=BRep_Tool::Pnt(aVi);
|
||||
aTi=BRep_Tool::Tolerance(aVi);
|
||||
aDi=aP.SquareDistance(aPi);
|
||||
aDi=sqrt(aDi);
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapOfOrientedShape.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepAlgo_AsDes,MMgt_TShared)
|
||||
|
||||
@@ -149,12 +150,18 @@ static void ReplaceInList(const TopoDS_Shape& OldS,
|
||||
const TopoDS_Shape& NewS,
|
||||
TopTools_ListOfShape& L)
|
||||
{
|
||||
TopTools_MapOfOrientedShape aMS;
|
||||
TopTools_ListIteratorOfListOfShape it(L);
|
||||
|
||||
for (; it.More(); it.Next()) {
|
||||
aMS.Add(it.Value());
|
||||
}
|
||||
it.Initialize(L);
|
||||
while(it.More()) {
|
||||
if (it.Value().IsSame(OldS)) {
|
||||
TopAbs_Orientation O = it.Value().Orientation();
|
||||
L.InsertBefore(NewS.Oriented(O),it);
|
||||
if (aMS.Add(NewS.Oriented(O))) {
|
||||
L.InsertBefore(NewS.Oriented(O),it);
|
||||
}
|
||||
L.Remove(it);
|
||||
}
|
||||
else it.Next();
|
||||
@@ -235,34 +242,52 @@ void BRepAlgo_AsDes::BackReplace(const TopoDS_Shape& OldS,
|
||||
//function : Replace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepAlgo_AsDes::Replace(const TopoDS_Shape& OldS,
|
||||
const TopoDS_Shape& NewS)
|
||||
const TopoDS_Shape& NewS)
|
||||
{
|
||||
Standard_Boolean InUp;
|
||||
|
||||
if (up.IsBound(OldS)) {
|
||||
InUp = Standard_False;
|
||||
BackReplace (OldS,NewS,up(OldS),InUp);
|
||||
if (up.IsBound(NewS)) {
|
||||
up(NewS).Append(up(OldS));
|
||||
for (Standard_Integer i = 0; i < 2; ++i) {
|
||||
TopTools_DataMapOfShapeListOfShape& aMap = !i ? up : down;
|
||||
TopTools_ListOfShape* pLSOld = aMap.ChangeSeek(OldS);
|
||||
if (!pLSOld) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
Standard_Boolean InUp = !i ? Standard_False : Standard_True;
|
||||
BackReplace(OldS, NewS, *pLSOld, InUp);
|
||||
//
|
||||
TopTools_ListOfShape* pLSNew = aMap.ChangeSeek(NewS);
|
||||
if (!pLSNew) {
|
||||
// filter the list
|
||||
TopTools_MapOfOrientedShape aMS;
|
||||
TopTools_ListIteratorOfListOfShape aIt(*pLSOld);
|
||||
for (; aIt.More(); ) {
|
||||
if (!aMS.Add(aIt.Value())) {
|
||||
pLSOld->Remove(aIt);
|
||||
}
|
||||
else {
|
||||
aIt.Next();
|
||||
}
|
||||
}
|
||||
aMap.Bind(NewS, *pLSOld);
|
||||
}
|
||||
else {
|
||||
up.Bind(NewS,up(OldS));
|
||||
// avoid duplicates
|
||||
TopTools_MapOfOrientedShape aMS;
|
||||
TopTools_ListIteratorOfListOfShape aIt(*pLSNew);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aMS.Add(aIt.Value());
|
||||
}
|
||||
//
|
||||
aIt.Initialize(*pLSOld);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS = aIt.Value();
|
||||
if (aMS.Add(aS)) {
|
||||
pLSNew->Append(aS);
|
||||
}
|
||||
}
|
||||
}
|
||||
up.UnBind(OldS);
|
||||
}
|
||||
|
||||
if (down.IsBound(OldS)) {
|
||||
InUp = Standard_True;
|
||||
BackReplace(OldS,NewS,down (OldS),InUp);
|
||||
if (down.IsBound(NewS)) {
|
||||
down(NewS).Append(down(OldS));
|
||||
}
|
||||
else {
|
||||
down.Bind(NewS,down(OldS));
|
||||
}
|
||||
down.UnBind(OldS);
|
||||
//
|
||||
aMap.UnBind(OldS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ class BRepExtrema_DistShapeShape
|
||||
//! create tool and load both shapes into it <br>
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void SetDeflection(const Standard_Real theDeflection)
|
||||
void SetDeflection(const Standard_Real theDeflection)
|
||||
{
|
||||
myEps = theDeflection;
|
||||
}
|
||||
@@ -58,12 +58,12 @@ class BRepExtrema_DistShapeShape
|
||||
//! Returns IsDone status. <br>
|
||||
Standard_EXPORT Standard_Boolean Perform();
|
||||
//! True if the minimum distance is found. <br>
|
||||
Standard_EXPORT Standard_Boolean IsDone() const
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
//! Returns the number of solutions satisfying the minimum distance. <br>
|
||||
Standard_EXPORT Standard_Integer NbSolution() const
|
||||
Standard_Integer NbSolution() const
|
||||
{
|
||||
return mySolutionsShape1.Length();
|
||||
}
|
||||
@@ -71,17 +71,17 @@ class BRepExtrema_DistShapeShape
|
||||
Standard_EXPORT Standard_Real Value() const;
|
||||
//! True if one of the shapes is a solid and the other shape <br>
|
||||
//! is completely or partially inside the solid. <br>
|
||||
Standard_EXPORT Standard_Boolean InnerSolution() const
|
||||
Standard_Boolean InnerSolution() const
|
||||
{
|
||||
return myInnerSol;
|
||||
}
|
||||
//! Returns the Point corresponding to the <N>th solution on the first Shape <br>
|
||||
Standard_EXPORT const gp_Pnt & PointOnShape1(const Standard_Integer N) const
|
||||
const gp_Pnt & PointOnShape1(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape1.Value(N).Point();
|
||||
}
|
||||
//! Returns the Point corresponding to the <N>th solution on the second Shape <br>
|
||||
Standard_EXPORT const gp_Pnt & PointOnShape2(const Standard_Integer N) const
|
||||
const gp_Pnt & PointOnShape2(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape2.Value(N).Point();
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class BRepExtrema_DistShapeShape
|
||||
//! IsOnEdge => the Nth soluion on the first shape is on a Edge <br>
|
||||
//! IsInFace => the Nth solution on the first shape is inside a face <br>
|
||||
//! the corresponding support is obtained by the method SupportOnShape1 <br>
|
||||
Standard_EXPORT BRepExtrema_SupportType SupportTypeShape1(const Standard_Integer N) const
|
||||
BRepExtrema_SupportType SupportTypeShape1(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape1.Value(N).SupportKind();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class BRepExtrema_DistShapeShape
|
||||
//! IsOnEdge => the Nth soluion on the secondt shape is on a Edge <br>
|
||||
//! IsInFace => the Nth solution on the second shape is inside a face <br>
|
||||
//! the corresponding support is obtained by the method SupportOnShape2 <br>
|
||||
Standard_EXPORT BRepExtrema_SupportType SupportTypeShape2(const Standard_Integer N) const
|
||||
BRepExtrema_SupportType SupportTypeShape2(const Standard_Integer N) const
|
||||
{
|
||||
return mySolutionsShape2.Value(N).SupportKind();
|
||||
}
|
||||
@@ -124,12 +124,12 @@ class BRepExtrema_DistShapeShape
|
||||
//! Prints on the stream o information on the current state of the object. <br>
|
||||
Standard_EXPORT void Dump(Standard_OStream& o) const;
|
||||
|
||||
Standard_EXPORT void SetFlag(const Extrema_ExtFlag F)
|
||||
void SetFlag(const Extrema_ExtFlag F)
|
||||
{
|
||||
myFlag = F;
|
||||
}
|
||||
|
||||
Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A)
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myAlgo = A;
|
||||
}
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <BRepBuilderAPI_MakeShape.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
class LocOpe_WiresOnShape;
|
||||
class StdFail_NotDone;
|
||||
class Standard_ConstructionError;
|
||||
@@ -60,7 +62,12 @@ public:
|
||||
BRepFeat_SplitShape();
|
||||
|
||||
//! Creates the process with the shape <S>.
|
||||
BRepFeat_SplitShape(const TopoDS_Shape& S);
|
||||
BRepFeat_SplitShape(const TopoDS_Shape& S);
|
||||
|
||||
//! Add splitting edges or wires for whole initial shape
|
||||
//! withot additional specification edge->face, edge->edge
|
||||
//! This method puts edge on the corresponding faces from initial shape
|
||||
Standard_EXPORT Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges);
|
||||
|
||||
//! Initializes the process on the shape <S>.
|
||||
void Init (const TopoDS_Shape& S);
|
||||
|
@@ -38,6 +38,14 @@ inline BRepFeat_SplitShape::BRepFeat_SplitShape (const TopoDS_Shape& S) :
|
||||
myWOnShape = new LocOpe_WiresOnShape(S);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean BRepFeat_SplitShape::Add(const TopTools_SequenceOfShape& theEdges)
|
||||
{
|
||||
return myWOnShape->Add(theEdges);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
|
@@ -1247,7 +1247,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
}
|
||||
else if (SameP.IsDone()) {
|
||||
Standard_Real tolreached = SameP.TolReached();
|
||||
if(tolreached < error) {
|
||||
if(tolreached <= error) {
|
||||
curPC = SameP.Curve2d();
|
||||
updatepc = Standard_True;
|
||||
maxdist = Max(maxdist,tolreached);
|
||||
@@ -1280,7 +1280,7 @@ void BRepLib::SameParameter(const TopoDS_Edge& AnEdge,
|
||||
|
||||
// Modified by skv - Thu Jun 3 12:39:19 2004 OCC5898 Begin
|
||||
if (!IsSameP) {
|
||||
if (anEdgeTol > error) {
|
||||
if (anEdgeTol >= error) {
|
||||
maxdist = Max(maxdist, anEdgeTol);
|
||||
IsSameP = Standard_True;
|
||||
}
|
||||
@@ -1899,6 +1899,10 @@ Standard_Boolean BRepLib::
|
||||
TShort_Array1OfShortReal& aNormArr1 = aPT1->ChangeNormals();
|
||||
TShort_Array1OfShortReal& aNormArr2 = aPT2->ChangeNormals();
|
||||
|
||||
if (aPTEF1->Nodes().Lower() != aPTEF2->Nodes().Lower() ||
|
||||
aPTEF1->Nodes().Upper() != aPTEF2->Nodes().Upper())
|
||||
continue;
|
||||
|
||||
for(Standard_Integer anEdgNode = aPTEF1->Nodes().Lower();
|
||||
anEdgNode <= aPTEF1->Nodes().Upper(); anEdgNode++)
|
||||
{
|
||||
@@ -2006,18 +2010,17 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh,
|
||||
TopTools_ListOfShape& LF)
|
||||
{
|
||||
LF.Clear();
|
||||
TopTools_ListOfShape LTri,LPlan,LCyl,LCon,LSphere,LTor,LOther;
|
||||
// Use the allocator of the result LF for intermediate results
|
||||
TopTools_ListOfShape LTri(LF.Allocator()), LPlan(LF.Allocator()),
|
||||
LCyl(LF.Allocator()), LCon(LF.Allocator()), LSphere(LF.Allocator()),
|
||||
LTor(LF.Allocator()), LOther(LF.Allocator());
|
||||
TopExp_Explorer exp(Sh,TopAbs_FACE);
|
||||
TopLoc_Location l;
|
||||
Handle(Geom_Surface) S;
|
||||
|
||||
for (; exp.More(); exp.Next()) {
|
||||
const TopoDS_Face& F = TopoDS::Face(exp.Current());
|
||||
S = BRep_Tool::Surface(F, l);
|
||||
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F, l);
|
||||
if (!S.IsNull()) {
|
||||
if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
|
||||
S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
|
||||
}
|
||||
GeomAdaptor_Surface AS(S);
|
||||
switch (AS.GetType()) {
|
||||
case GeomAbs_Plane:
|
||||
|
@@ -56,8 +56,16 @@ class BRepMesh_VertexTool;
|
||||
|
||||
namespace BRepMesh
|
||||
{
|
||||
//! Default size for memory block allocated by IncAllocator.
|
||||
//! Default size for memory block allocated by IncAllocator.
|
||||
/**
|
||||
* The idea here is that blocks of the given size are returned to the system
|
||||
* rather than retained in the malloc heap, at least on WIN32 and WIN64 platforms.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
const size_t MEMORY_BLOCK_SIZE_HUGE = 1024 * 1024;
|
||||
#else
|
||||
const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
|
||||
#endif
|
||||
|
||||
//! Structure keeping parameters of segment.
|
||||
struct Segment
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
//! @param theTolerance tolerance to be used for identification of shot circles.
|
||||
//! @param theReservedSize size to be reserved for vector of circles.
|
||||
//! @param theAllocator memory allocator to be used by internal collections.
|
||||
Standard_EXPORT BRepMesh_CircleInspector(
|
||||
BRepMesh_CircleInspector(
|
||||
const Standard_Real theTolerance,
|
||||
const Standard_Integer theReservedSize,
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
const Standard_Integer theTargetIndex);
|
||||
|
||||
//! Checks indices for equlity.
|
||||
Standard_EXPORT static Standard_Boolean IsEqual(
|
||||
static Standard_Boolean IsEqual(
|
||||
const Standard_Integer theIndex,
|
||||
const Standard_Integer theTargetIndex)
|
||||
{
|
||||
|
@@ -35,7 +35,8 @@ BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(
|
||||
const Handle(NCollection_IncAllocator)& theAllocator,
|
||||
const Standard_Integer theReservedNodeSize)
|
||||
: myAllocator (theAllocator),
|
||||
myNodes (new BRepMesh_VertexTool(theReservedNodeSize, myAllocator)),
|
||||
myNodes (new BRepMesh_VertexTool(myAllocator)),
|
||||
myNodeLinks (theReservedNodeSize * 3, myAllocator),
|
||||
myLinks (theReservedNodeSize * 3, myAllocator),
|
||||
myDelLinks (myAllocator),
|
||||
myElements (theReservedNodeSize * 2, myAllocator),
|
||||
|
@@ -63,7 +63,7 @@ public: //! @name API for accessing mesh nodes.
|
||||
//! Finds the index of the given node.
|
||||
//! @param theNode node to find.
|
||||
//! @return index of the given element of zero if node is not in the mesh.
|
||||
Standard_EXPORT Standard_Integer IndexOf(const BRepMesh_Vertex& theNode)
|
||||
Standard_Integer IndexOf(const BRepMesh_Vertex& theNode)
|
||||
{
|
||||
return myNodes->FindIndex(theNode);
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public: //! @name API for accessing mesh nodes.
|
||||
//! @param theIndex index of node to be removed.
|
||||
//! @param isForce if TRUE node will be removed even if movability
|
||||
//! is not Free.
|
||||
Standard_EXPORT void RemoveNode(const Standard_Integer theIndex,
|
||||
const Standard_Boolean isForce = Standard_False)
|
||||
void RemoveNode(const Standard_Integer theIndex,
|
||||
const Standard_Boolean isForce = Standard_False)
|
||||
{
|
||||
if (isForce || myNodes->FindKey(theIndex).Movability() == BRepMesh_Free)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ public: //! @name API for accessing mesh links.
|
||||
//! Finds the index of the given link.
|
||||
//! @param theLink link to find.
|
||||
//! @return index of the given element of zero if link is not in the mesh.
|
||||
Standard_EXPORT Standard_Integer IndexOf(const BRepMesh_Edge& theLink) const
|
||||
Standard_Integer IndexOf(const BRepMesh_Edge& theLink) const
|
||||
{
|
||||
return myLinks.FindIndex(theLink);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public: //! @name API for accessing mesh links.
|
||||
//! Get link by the index.
|
||||
//! @param theIndex index of a link.
|
||||
//! @return link with the given index.
|
||||
Standard_EXPORT const BRepMesh_Edge& GetLink(const Standard_Integer theIndex)
|
||||
const BRepMesh_Edge& GetLink(const Standard_Integer theIndex)
|
||||
{
|
||||
return myLinks.FindKey(theIndex);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public: //! @name API for accessing mesh links.
|
||||
//! Returns indices of elements conected to the link with the given index.
|
||||
//! @param theLinkIndex index of link whose data should be retrieved.
|
||||
//! @return indices of elements conected to the link.
|
||||
Standard_EXPORT const BRepMesh_PairOfIndex& ElementsConnectedTo(
|
||||
const BRepMesh_PairOfIndex& ElementsConnectedTo(
|
||||
const Standard_Integer theLinkIndex) const
|
||||
{
|
||||
return myLinks.FindFromIndex(theLinkIndex);
|
||||
@@ -192,7 +192,7 @@ public: //! @name API for accessing mesh elements.
|
||||
//! Finds the index of the given element.
|
||||
//! @param theElement element to find.
|
||||
//! @return index of the given element of zero if element is not in the mesh.
|
||||
Standard_EXPORT Standard_Integer IndexOf(const BRepMesh_Triangle& theElement) const
|
||||
Standard_Integer IndexOf(const BRepMesh_Triangle& theElement) const
|
||||
{
|
||||
return myElements.FindIndex(theElement);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public: //! @name API for accessing mesh elements.
|
||||
//! Get element by the index.
|
||||
//! @param theIndex index of an element.
|
||||
//! @return element with the given index.
|
||||
Standard_EXPORT const BRepMesh_Triangle& GetElement(const Standard_Integer theIndex)
|
||||
const BRepMesh_Triangle& GetElement(const Standard_Integer theIndex)
|
||||
{
|
||||
return myElements.FindKey(theIndex);
|
||||
}
|
||||
@@ -254,7 +254,7 @@ public: //! @name Auxilary API
|
||||
|
||||
//! Substitutes deleted items by the last one from corresponding map
|
||||
//! to have only non-deleted elements, links or nodes in the structure.
|
||||
Standard_EXPORT void ClearDeleted()
|
||||
void ClearDeleted()
|
||||
{
|
||||
clearDeletedLinks();
|
||||
clearDeletedNodes();
|
||||
|
@@ -429,8 +429,6 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
|
||||
Standard_Real aTolU, aTolV;
|
||||
myMeshData->Data()->GetTolerance(aTolU, aTolV);
|
||||
const Standard_Real aSqTol = aTolU * aTolU + aTolV * aTolV;
|
||||
@@ -442,8 +440,8 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
Standard_Integer anUpper = theVertexIndexes.Upper();
|
||||
for( ; anIndex <= anUpper; ++anIndex )
|
||||
{
|
||||
aLoopEdges.Clear();
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
|
||||
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
|
||||
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
|
||||
@@ -598,6 +596,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
|
||||
for(;;)
|
||||
{
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
|
||||
|
||||
@@ -679,7 +678,6 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
myMeshData->RemoveLink( aLoopEdgesIt.Key() );
|
||||
}
|
||||
|
||||
aAllocator->Reset(Standard_False);
|
||||
if ( aDeletedTrianglesNb == 0 )
|
||||
break;
|
||||
}
|
||||
@@ -2173,7 +2171,8 @@ Standard_Boolean BRepMesh_Delaun::UseEdge( const Standard_Integer /*theIndex*/ )
|
||||
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
|
||||
const BRepMesh_DegreeOfFreedom theEdgeType ) const
|
||||
{
|
||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger;
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
|
||||
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
|
||||
|
||||
for ( ; anEdgeIt.More(); anEdgeIt.Next() )
|
||||
|
@@ -26,14 +26,14 @@ class BRepMesh_Edge : public BRepMesh_OrientedEdge
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT BRepMesh_Edge()
|
||||
BRepMesh_Edge()
|
||||
: BRepMesh_OrientedEdge(),
|
||||
myMovability(BRepMesh_Deleted)
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructs a link between two vertices.
|
||||
Standard_EXPORT BRepMesh_Edge(
|
||||
BRepMesh_Edge(
|
||||
const Standard_Integer theFirstNode,
|
||||
const Standard_Integer theLastNode,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute,Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
@@ -141,14 +140,12 @@ void BRepMesh_FaceAttribute::init()
|
||||
// between vertices
|
||||
|
||||
myMinStep = RealLast();
|
||||
for (TopExp_Explorer anExp(myFace, TopAbs_WIRE); anExp.More(); anExp.Next())
|
||||
for (TopoDS_Iterator aFaceIt(myFace); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
|
||||
|
||||
for (TopoDS_Iterator aWireExp(aWire); aWireExp.More(); aWireExp.Next())
|
||||
for (TopoDS_Iterator aWireIt(aFaceIt.Value()); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aWireExp.Value());
|
||||
if (BRep_Tool::IsClosed(anEdge))
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aWireIt.Value());
|
||||
if (anEdge.IsNull() || BRep_Tool::IsClosed(anEdge))
|
||||
continue;
|
||||
|
||||
// Get end points on 2d curve
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfCharacter.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColGeom2d_SequenceOfCurve.hxx>
|
||||
@@ -82,6 +83,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret,Standard_Transient)
|
||||
BRepMesh_FastDiscret::BRepMesh_FastDiscret( const Bnd_Box& theBox,
|
||||
const BRepMesh_FastDiscret::Parameters& theParams)
|
||||
:
|
||||
myMapdefle(1000, new NCollection_IncAllocator()),
|
||||
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
|
||||
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
|
||||
myParameters(theParams),
|
||||
@@ -195,7 +197,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
|
||||
resetDataStructure();
|
||||
|
||||
Standard_Real defedge;
|
||||
Standard_Real defedge = myParameters.Deflection;
|
||||
Standard_Integer nbEdge = 0;
|
||||
Standard_Real savangle = myParameters.Angle;
|
||||
Standard_Real cdef;
|
||||
@@ -205,18 +207,14 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
if (!myParameters.Relative)
|
||||
defface = Max(myParameters.Deflection, maxdef);
|
||||
|
||||
NCollection_Sequence<EdgePCurve> aPCurves;
|
||||
NCollection_Sequence<TopoDS_Edge> aFaceEdges;
|
||||
|
||||
const TopoDS_Face& aFace = myAttribute->Face();
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
TopExp_Explorer aWireIt(aFace, TopAbs_WIRE);
|
||||
for (; aWireIt.More(); aWireIt.Next())
|
||||
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
TopExp_Explorer aEdgeIt(aWireIt.Current(), TopAbs_EDGE);
|
||||
for (; aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
{
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Value());
|
||||
if (aEdge.IsNull())
|
||||
continue;
|
||||
if (!myMapdefle.IsBound(aEdge))
|
||||
{
|
||||
if (myParameters.Relative)
|
||||
@@ -265,8 +263,6 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
continue;
|
||||
|
||||
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
|
||||
aPCurves.Append(aPCurve);
|
||||
aFaceEdges.Append(aEdge);
|
||||
|
||||
add(aEdge, aPCurve, defedge);
|
||||
myParameters.Angle = savangle;
|
||||
@@ -293,6 +289,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
|
||||
if ( aTriangulation.IsNull() )
|
||||
{
|
||||
@@ -401,16 +398,29 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
++nbmaill;
|
||||
|
||||
resetDataStructure();
|
||||
for (Standard_Integer j = 1; j <= aFaceEdges.Length(); ++j)
|
||||
|
||||
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = aFaceEdges(j);
|
||||
if (myEdges.IsBound(anEdge))
|
||||
myEdges.UnBind(anEdge);
|
||||
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aEdgeIt.Value());
|
||||
if (anEdge.IsNull())
|
||||
continue;
|
||||
if (myEdges.IsBound(anEdge))
|
||||
myEdges.UnBind(anEdge);
|
||||
|
||||
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
|
||||
myMapdefle.Bind(anEdge, defedge);
|
||||
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
|
||||
myMapdefle.Bind(anEdge, defedge);
|
||||
|
||||
add(anEdge, aPCurves(j), defedge);
|
||||
Standard_Real aFirstParam, aLastParam;
|
||||
Handle(Geom2d_Curve) aCurve2d =
|
||||
BRep_Tool::CurveOnSurface(anEdge, aFace, aFirstParam, aLastParam);
|
||||
if (aCurve2d.IsNull())
|
||||
continue;
|
||||
|
||||
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
|
||||
add(anEdge, aPCurve, defedge);
|
||||
}
|
||||
}
|
||||
|
||||
aDFaceChecker.ReCompute(aClassifier);
|
||||
@@ -806,18 +816,13 @@ void BRepMesh_FastDiscret::update(
|
||||
Handle(Poly_PolygonOnTriangulation) P1, P2;
|
||||
if (BRepMesh_ShapeTool::IsDegenerated(theEdge, aFace))
|
||||
{
|
||||
const Standard_Integer aNodesNb = 2;
|
||||
TColStd_Array1OfInteger aNewNodes (1, aNodesNb);
|
||||
TColStd_Array1OfInteger aNewNodInStruct(1, aNodesNb);
|
||||
TColStd_Array1OfReal aNewParams (1, aNodesNb);
|
||||
|
||||
aNewNodInStruct(1) = ipf;
|
||||
aNewNodes (1) = isvf;
|
||||
aNewParams (1) = aEAttr.FirstParam;
|
||||
|
||||
aNewNodInStruct(aNodesNb) = ipl;
|
||||
aNewNodes (aNodesNb) = isvl;
|
||||
aNewParams (aNodesNb) = aEAttr.LastParam;
|
||||
// two nodes
|
||||
Standard_Integer aNewNodesArr[] = {isvf, isvl};
|
||||
Standard_Integer aNewNodInStructArr[] = {ipf, ipl};
|
||||
Standard_Real aNewParamsArr[] = {aEAttr.FirstParam, aEAttr.LastParam};
|
||||
TColStd_Array1OfInteger aNewNodes (aNewNodesArr[0], 1, 2);
|
||||
TColStd_Array1OfInteger aNewNodInStruct(aNewNodInStructArr[0], 1, 2);
|
||||
TColStd_Array1OfReal aNewParams (aNewParamsArr[0], 1, 2);
|
||||
|
||||
P1 = new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
|
||||
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
|
||||
@@ -825,9 +830,15 @@ void BRepMesh_FastDiscret::update(
|
||||
else
|
||||
{
|
||||
const Standard_Integer aNodesNb = aEdgeTool->NbPoints();
|
||||
TColStd_Array1OfInteger aNewNodesVec (1, aNodesNb);
|
||||
TColStd_Array1OfInteger aNewNodesInStructVec(1, aNodesNb);
|
||||
TColStd_Array1OfReal aNewParamsVec (1, aNodesNb);
|
||||
// Allocate the memory for arrays aNewNodesVec, aNewNodesInStructVec, aNewParamsVec
|
||||
// only once using the buffer aBuf.
|
||||
TColStd_Array1OfCharacter aBuf(1, aNodesNb * (2*sizeof(Standard_Integer) + sizeof(Standard_Real)));
|
||||
TColStd_Array1OfInteger aNewNodesVec(*reinterpret_cast<const Standard_Integer*>
|
||||
(&aBuf(1)), 1, aNodesNb);
|
||||
TColStd_Array1OfInteger aNewNodesInStructVec(*reinterpret_cast<const Standard_Integer*>
|
||||
(&aBuf(1 + aNodesNb*sizeof(Standard_Integer))), 1, aNodesNb);
|
||||
TColStd_Array1OfReal aNewParamsVec(*reinterpret_cast<const Standard_Real*>
|
||||
(&aBuf(1 + aNodesNb*2*sizeof(Standard_Integer))), 1, aNodesNb);
|
||||
|
||||
Standard_Integer aNodesCount = 1;
|
||||
aNewNodesInStructVec(aNodesCount) = ipf;
|
||||
|
@@ -207,8 +207,8 @@ void BRepMesh_FastDiscretFace::initDataStructure()
|
||||
myStructure->Data()->SetTolerance( aTolU / deltaX, aTolV / deltaY);
|
||||
|
||||
myAttribute->ChangeStructure() = myStructure;
|
||||
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt;
|
||||
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger;
|
||||
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt(1, aAllocator);
|
||||
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger(1, aAllocator);
|
||||
|
||||
// Check the necessity to fill the map of parameters
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
@@ -217,8 +217,8 @@ void BRepMesh_FastDiscretFace::initDataStructure()
|
||||
thetype == GeomAbs_BSplineSurface);
|
||||
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus || IsCompexSurface (thetype));
|
||||
|
||||
myUParam.Clear();
|
||||
myVParam.Clear();
|
||||
myUParam.Clear(aAllocator);
|
||||
myVParam.Clear(aAllocator);
|
||||
|
||||
// essai de determination de la longueur vraie:
|
||||
// akm (bug OCC16) : We must calculate these measures in non-singular
|
||||
@@ -393,7 +393,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
|
||||
Standard_Real aDef = -1;
|
||||
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
|
||||
{
|
||||
BRepMesh::ListOfVertex aNewVertices;
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::ListOfVertex aNewVertices(anAlloc);
|
||||
if (!rajout)
|
||||
{
|
||||
aDef = control(aNewVertices, trigu, Standard_True);
|
||||
@@ -463,8 +464,6 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
BRepMesh::SequenceOfReal& theResult)
|
||||
{
|
||||
// Sort sequence of parameters
|
||||
BRepMesh::SequenceOfReal aParamTmp;
|
||||
Standard_Integer aParamLength = 1;
|
||||
const Standard_Integer anInitLen = theParams.Extent();
|
||||
|
||||
TColStd_Array1OfReal aParamArray(1, anInitLen);
|
||||
@@ -475,37 +474,26 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
std::sort (aParamArray.begin(), aParamArray.end());
|
||||
|
||||
// mandatory pre-filtering using the first (minimal) filter value
|
||||
Standard_Real aP1, aP2;
|
||||
aP1 = aParamArray(1);
|
||||
aParamTmp.Append(aP1);
|
||||
Standard_Integer aParamLength = 1;
|
||||
for (j = 2; j <= anInitLen; j++)
|
||||
{
|
||||
aP2 = aParamArray(j);
|
||||
if ((aP2-aP1) > theMinDist)
|
||||
if ((aParamArray(j)-aParamArray(aParamLength)) > theMinDist)
|
||||
{
|
||||
aParamTmp.Append(aP2);
|
||||
aP1 = aP2;
|
||||
aParamLength++;
|
||||
if (++aParamLength < j)
|
||||
aParamArray(aParamLength) = aParamArray(j);
|
||||
}
|
||||
}
|
||||
|
||||
//add last point if required
|
||||
if(aParamArray(anInitLen)-theParams(aParamLength) > theMinDist)
|
||||
{
|
||||
aParamTmp.Append(aParamArray(anInitLen));
|
||||
aParamLength++;
|
||||
}
|
||||
|
||||
//perform filtering on series
|
||||
Standard_Real aLastAdded, aLastCandidate;
|
||||
Standard_Boolean isCandidateDefined = Standard_False;
|
||||
aLastAdded = aParamTmp.First();
|
||||
aLastAdded = aParamArray(1);
|
||||
aLastCandidate = aLastAdded;
|
||||
theResult.Append(aParamTmp.First());
|
||||
theResult.Append(aLastAdded);
|
||||
|
||||
for(j=2;j<aParamTmp.Length();j++)
|
||||
for(j=2; j < aParamLength; j++)
|
||||
{
|
||||
Standard_Real aVal = aParamTmp.Value(j);
|
||||
Standard_Real aVal = aParamArray(j);
|
||||
if(aVal-aLastAdded > theFilterDist)
|
||||
{
|
||||
//adds the parameter
|
||||
@@ -525,7 +513,7 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
aLastCandidate = aVal;
|
||||
isCandidateDefined = Standard_True;
|
||||
}
|
||||
theResult.Append(aParamTmp.Last());
|
||||
theResult.Append(aParamArray(aParamLength));
|
||||
}
|
||||
|
||||
void BRepMesh_FastDiscretFace::insertInternalVertices(
|
||||
@@ -617,19 +605,29 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesCylinder(
|
||||
gp_Cylinder aCylinder = myAttribute->Surface()->Cylinder();
|
||||
const Standard_Real aRadius = aCylinder.Radius();
|
||||
|
||||
// Calculate parameters for iteration in U direction
|
||||
Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep(
|
||||
aRadius, myAttribute->GetDefFace(), myAngle, myMinSize);
|
||||
|
||||
Standard_Integer nbU = 0;
|
||||
Standard_Integer nbV = 0;
|
||||
const Standard_Real su = umax - umin;
|
||||
const Standard_Integer nbU = (Standard_Integer)(su / Du);
|
||||
Du = su / (nbU + 1);
|
||||
|
||||
// Calculate parameters for iteration in V direction
|
||||
const Standard_Real sv = vmax - vmin;
|
||||
Standard_Integer nbV = (Standard_Integer)(nbU*sv / (su*aRadius));
|
||||
nbV = Min(nbV, 100 * nbU);
|
||||
Standard_Real Dv = sv / (nbV + 1);
|
||||
const Standard_Real aArcLen = su * aRadius;
|
||||
if (aArcLen > myAttribute->GetDefFace ())
|
||||
{
|
||||
// Calculate parameters for iteration in U direction
|
||||
const Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep (
|
||||
aRadius, myAttribute->GetDefFace (), myAngle, myMinSize);
|
||||
nbU = (Standard_Integer)(su / Du);
|
||||
|
||||
// Calculate parameters for iteration in V direction
|
||||
const Standard_Real aDv = nbU*sv / aArcLen;
|
||||
// Protection against overflow during casting to int in case
|
||||
// of long cylinder with small radius.
|
||||
nbV = aDv > static_cast<Standard_Real> (IntegerLast ()) ?
|
||||
0 : (Standard_Integer)(aDv);
|
||||
nbV = Min (nbV, 100 * nbU);
|
||||
}
|
||||
|
||||
const Standard_Real Du = su / (nbU + 1);
|
||||
const Standard_Real Dv = sv / (nbV + 1);
|
||||
|
||||
Standard_Real pasu, pasv, pasvmax = vmax - Dv*0.5, pasumax = umax - Du*0.5;
|
||||
for (pasv = vmin + Dv; pasv < pasvmax; pasv += Dv)
|
||||
@@ -832,7 +830,9 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
||||
const Standard_Real aDefFace = myAttribute->GetDefFace();
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
|
||||
BRepMesh::SequenceOfReal aParams[2];
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::SequenceOfReal aParams[2] = { BRepMesh::SequenceOfReal(anAlloc),
|
||||
BRepMesh::SequenceOfReal(anAlloc) };
|
||||
for (Standard_Integer i = 0; i < 2; ++i)
|
||||
{
|
||||
Standard_Boolean isU = (i == 0);
|
||||
@@ -858,8 +858,10 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
||||
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
|
||||
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
||||
|
||||
BRepMesh::MapOfReal aParamsToRemove[2];
|
||||
BRepMesh::MapOfReal aParamsForbiddenToRemove[2];
|
||||
BRepMesh::MapOfReal aParamsToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||
BRepMesh::MapOfReal(1, anAlloc) };
|
||||
BRepMesh::MapOfReal aParamsForbiddenToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||
BRepMesh::MapOfReal(1, anAlloc) };
|
||||
|
||||
// precision for compare square distances
|
||||
const Standard_Real aPrecision = Precision::Confusion();
|
||||
@@ -1033,7 +1035,8 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
||||
const Standard_Real theFaceDeflection,
|
||||
const BRepMesh_CircleTool& theCircleTool,
|
||||
BRepMesh::ListOfVertex& theVertices,
|
||||
Standard_Real& theMaxTriangleDeflection)
|
||||
Standard_Real& theMaxTriangleDeflection,
|
||||
const Handle(NCollection_IncAllocator)& theTempAlloc)
|
||||
{
|
||||
if (theTriangleDeflection > theMaxTriangleDeflection)
|
||||
theMaxTriangleDeflection = theTriangleDeflection;
|
||||
@@ -1048,9 +1051,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
||||
const_cast<BRepMesh_CircleTool&>(theCircleTool).Select(
|
||||
myAttribute->Scale(theUV, Standard_True));
|
||||
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
BRepMesh::MapOfInteger aUsedNodes(10, aAllocator);
|
||||
BRepMesh::MapOfInteger aUsedNodes(10, theTempAlloc);
|
||||
BRepMesh::ListOfInteger::Iterator aCircleIt(aCirclesList);
|
||||
for (; aCircleIt.More(); aCircleIt.Next())
|
||||
{
|
||||
@@ -1108,9 +1109,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
|
||||
aBSpline = gFace->ChangeSurface ().Surface().Surface();
|
||||
|
||||
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap;
|
||||
BRepMesh::MapOfIntegerInteger aStatMap;
|
||||
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb);
|
||||
Handle(NCollection_IncAllocator) anAlloc =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap(1, anAlloc);
|
||||
BRepMesh::MapOfIntegerInteger aStatMap(1, anAlloc);
|
||||
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb, anAlloc);
|
||||
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
|
||||
|
||||
// Perform refinement passes
|
||||
@@ -1121,8 +1124,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
Standard_Real aMaxSqDef = -1.;
|
||||
Standard_Integer aPass = 1, aInsertedNb = 1;
|
||||
Standard_Boolean isAllDegenerated = Standard_False;
|
||||
Handle(NCollection_IncAllocator) aTempAlloc =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
|
||||
{
|
||||
aTempAlloc->Reset(Standard_False);
|
||||
theNewVertices.Clear();
|
||||
|
||||
// Reset stop condition
|
||||
@@ -1198,7 +1204,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
aSqDef *= aSqDef;
|
||||
|
||||
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||
|
||||
if (isSkipped)
|
||||
break;
|
||||
@@ -1232,7 +1238,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
aSqDef = aLin.SquareDistance(pDef);
|
||||
|
||||
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1399,6 +1405,8 @@ void BRepMesh_FastDiscretFace::commitSurfaceTriangulation()
|
||||
BRepMesh_ShapeTool::AddInFace(aFace, aNewTriangulation);
|
||||
|
||||
// Delete unused data
|
||||
myUParam.Clear(0L);
|
||||
myVParam.Clear(0L);
|
||||
myAttribute->ChangeStructure().Nullify();
|
||||
myAttribute->ChangeSurfacePoints().Nullify();
|
||||
myAttribute->ChangeSurfaceVertices().Nullify();
|
||||
|
@@ -174,7 +174,8 @@ private:
|
||||
const Standard_Real theFaceDeflection,
|
||||
const BRepMesh_CircleTool& theCircleTool,
|
||||
BRepMesh::ListOfVertex& theVertices,
|
||||
Standard_Real& theMaxTriangleDeflection);
|
||||
Standard_Real& theMaxTriangleDeflection,
|
||||
const Handle(NCollection_IncAllocator)& theTempAlloc);
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_MapOfTransient.hxx>
|
||||
#include <TopTools_HArray1OfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
@@ -125,8 +126,11 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::clear()
|
||||
{
|
||||
myEdges.Clear();
|
||||
myEdgeDeflection.Clear();
|
||||
// the allocator will be alive while the structures are alive
|
||||
Handle(NCollection_IncAllocator) anAlloc =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
myEdges.Clear(anAlloc);
|
||||
myEdgeDeflection.Clear(anAlloc);
|
||||
myFaces.Clear();
|
||||
myMesh.Nullify();
|
||||
}
|
||||
@@ -146,15 +150,18 @@ void BRepMesh_IncrementalMesh::init()
|
||||
collectFaces();
|
||||
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add(myShape, aBox, Standard_False);
|
||||
|
||||
if (aBox.IsVoid())
|
||||
if ( myParameters.Relative )
|
||||
{
|
||||
// Nothing to mesh.
|
||||
return;
|
||||
}
|
||||
BRepBndLib::Add(myShape, aBox, Standard_False);
|
||||
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||
if (aBox.IsVoid())
|
||||
{
|
||||
// Nothing to mesh.
|
||||
return;
|
||||
}
|
||||
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||
}
|
||||
|
||||
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
|
||||
|
||||
@@ -167,22 +174,21 @@ void BRepMesh_IncrementalMesh::init()
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::collectFaces()
|
||||
{
|
||||
TopTools_ListOfShape aFaceList;
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
TopTools_ListOfShape aFaceList(anAlloc);
|
||||
BRepLib::ReverseSortFaces(myShape, aFaceList);
|
||||
TopTools_MapOfShape aFaceMap;
|
||||
TColStd_MapOfTransient aTFaceMap(1, anAlloc);
|
||||
|
||||
// make array of faces suitable for processing (excluding faces without surface)
|
||||
TopLoc_Location aDummyLoc;
|
||||
const TopLoc_Location aEmptyLoc;
|
||||
TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
|
||||
for (; aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
TopoDS_Shape aFaceNoLoc = aFaceIter.Value();
|
||||
aFaceNoLoc.Location(aEmptyLoc);
|
||||
if (!aFaceMap.Add (aFaceNoLoc))
|
||||
const TopoDS_Face& aFace = TopoDS::Face(aFaceIter.Value());
|
||||
const Handle(TopoDS_TShape)& aTFace = aFace.TShape();
|
||||
if (!aTFaceMap.Add (aTFace))
|
||||
continue; // already processed
|
||||
|
||||
TopoDS_Face aFace = TopoDS::Face(aFaceIter.Value());
|
||||
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
|
||||
if (aSurf.IsNull())
|
||||
continue;
|
||||
@@ -282,8 +288,9 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
|
||||
Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
|
||||
const TopoDS_Edge& theEdge)
|
||||
{
|
||||
if (myEdgeDeflection.IsBound(theEdge))
|
||||
return myEdgeDeflection(theEdge);
|
||||
const Standard_Real* pDef = myEdgeDeflection.Seek(theEdge);
|
||||
if (pDef)
|
||||
return *pDef;
|
||||
|
||||
Standard_Real aEdgeDeflection;
|
||||
if ( myParameters.Relative )
|
||||
@@ -329,7 +336,7 @@ Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
|
||||
void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
|
||||
{
|
||||
if (!myEdges.IsBound(theEdge))
|
||||
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool());
|
||||
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool(3, myEdges.Allocator()));
|
||||
|
||||
Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
|
||||
// Check that triangulation relies to face of the given shape.
|
||||
|
@@ -27,14 +27,14 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT BRepMesh_OrientedEdge()
|
||||
BRepMesh_OrientedEdge()
|
||||
: myFirstNode(-1),
|
||||
myLastNode(-1)
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructs a link between two vertices.
|
||||
Standard_EXPORT BRepMesh_OrientedEdge(
|
||||
BRepMesh_OrientedEdge(
|
||||
const Standard_Integer theFirstNode,
|
||||
const Standard_Integer theLastNode)
|
||||
: myFirstNode(theFirstNode),
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
//! Returns hash code for this edge.
|
||||
//! @param theUpper upper index in the container.
|
||||
//! @return hash code.
|
||||
Standard_EXPORT Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
{
|
||||
return ::HashCode(myFirstNode + myLastNode, theUpper);
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class BRepMesh_PairOfIndex
|
||||
public:
|
||||
|
||||
//! Default constructor
|
||||
Standard_EXPORT BRepMesh_PairOfIndex()
|
||||
BRepMesh_PairOfIndex()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor. Creates empty pair with null fileds.
|
||||
Standard_EXPORT BRepMesh_PairOfPolygon()
|
||||
BRepMesh_PairOfPolygon()
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT BRepMesh_Triangle()
|
||||
BRepMesh_Triangle()
|
||||
: myEdge1(0),
|
||||
myEdge2(0),
|
||||
myEdge3(0),
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
//! @param theEdges array of edges of triangle.
|
||||
//! @param theOrientations array of edge's orientations.
|
||||
//! @param theMovability movability of triangle.
|
||||
Standard_EXPORT BRepMesh_Triangle(
|
||||
BRepMesh_Triangle(
|
||||
const Standard_Integer (&theEdges)[3],
|
||||
const Standard_Boolean (&theOrientations)[3],
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
//! Returns hash code for this triangle.
|
||||
//! @param theUpper upper index in the container.
|
||||
//! @return hash code.
|
||||
Standard_EXPORT Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
{
|
||||
return ::HashCode(myEdge1 + myEdge2 + myEdge3, theUpper);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
//! Checks for equality with another triangle.
|
||||
//! @param theOther triangle to be checked against this one.
|
||||
//! @return TRUE if equal, FALSE if not.
|
||||
Standard_EXPORT Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
|
||||
{
|
||||
if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
|
||||
return Standard_False;
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
Standard_EXPORT Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
{
|
||||
return IsEqual(theOther);
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor
|
||||
Standard_EXPORT BRepMesh_Vertex()
|
||||
BRepMesh_Vertex()
|
||||
: myLocation3d(0),
|
||||
myMovability(BRepMesh_Free)
|
||||
{
|
||||
@@ -41,9 +41,9 @@ public:
|
||||
//! @param theUV position of vertex in parametric space.
|
||||
//! @param theLocation3d index of 3d point to be associated with vertex.
|
||||
//! @param theMovability movability of the vertex.
|
||||
Standard_EXPORT BRepMesh_Vertex(const gp_XY& theUV,
|
||||
const Standard_Integer theLocation3d,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
BRepMesh_Vertex(const gp_XY& theUV,
|
||||
const Standard_Integer theLocation3d,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
{
|
||||
Initialize(theUV, theLocation3d, theMovability);
|
||||
}
|
||||
@@ -52,9 +52,9 @@ public:
|
||||
//! @param theU U position of vertex in parametric space.
|
||||
//! @param theV V position of vertex in parametric space.
|
||||
//! @param theMovability movability of the vertex.
|
||||
Standard_EXPORT BRepMesh_Vertex(const Standard_Real theU,
|
||||
const Standard_Real theV,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
BRepMesh_Vertex(const Standard_Real theU,
|
||||
const Standard_Real theV,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
: myUV(theU, theV),
|
||||
myLocation3d(0),
|
||||
myMovability(theMovability)
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
//! Returns hash code for this vertex.
|
||||
//! @param theUpper upper index in the container.
|
||||
//! @return hash code.
|
||||
Standard_EXPORT Standard_Integer HashCode(const Standard_Integer Upper) const
|
||||
Standard_Integer HashCode(const Standard_Integer Upper) const
|
||||
{
|
||||
return ::HashCode(Floor(1e5 * myUV.X()) * Floor(1e5 * myUV.Y()), Upper);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
//! Checks for equality with another vertex.
|
||||
//! @param theOther vertex to be checked against this one.
|
||||
//! @return TRUE if equal, FALSE if not.
|
||||
Standard_EXPORT Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
|
||||
Standard_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
|
||||
{
|
||||
if (myMovability == BRepMesh_Deleted ||
|
||||
theOther.myMovability == BRepMesh_Deleted)
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
}
|
||||
|
||||
//! Alias for IsEqual.
|
||||
Standard_EXPORT Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
@@ -30,13 +30,11 @@ public:
|
||||
typedef Standard_Integer Target;
|
||||
|
||||
//! Constructor.
|
||||
//! @param theReservedSize size to be reserved for vector of vertices.
|
||||
//! @param theAllocator memory allocator to be used by internal collections.
|
||||
Standard_EXPORT BRepMesh_VertexInspector (
|
||||
const Standard_Integer theReservedSize,
|
||||
BRepMesh_VertexInspector (
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myResIndices(theAllocator),
|
||||
myVertices (new BRepMesh::VectorOfVertex(theReservedSize)),
|
||||
myVertices (new BRepMesh::VectorOfVertex),
|
||||
myDelNodes (theAllocator)
|
||||
{
|
||||
SetTolerance( Precision::Confusion() );
|
||||
@@ -44,7 +42,7 @@ public:
|
||||
|
||||
//! Registers the given vertex.
|
||||
//! @param theVertex vertex to be registered.
|
||||
Standard_EXPORT Standard_Integer Add(const BRepMesh_Vertex& theVertex)
|
||||
Standard_Integer Add(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
if( myDelNodes.IsEmpty() )
|
||||
{
|
||||
@@ -147,7 +145,7 @@ public:
|
||||
Standard_EXPORT NCollection_CellFilter_Action Inspect(const Standard_Integer theTargetIndex);
|
||||
|
||||
//! Checks indices for equlity.
|
||||
Standard_EXPORT static Standard_Boolean IsEqual(const Standard_Integer theIndex,
|
||||
static Standard_Boolean IsEqual(const Standard_Integer theIndex,
|
||||
const Standard_Integer theTargetIndex)
|
||||
{
|
||||
return (theIndex == theTargetIndex);
|
||||
|
@@ -56,11 +56,10 @@ NCollection_CellFilter_Action BRepMesh_VertexInspector::Inspect(
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepMesh_VertexTool::BRepMesh_VertexTool(
|
||||
const Standard_Integer theReservedSize,
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myAllocator (theAllocator),
|
||||
myCellFilter(0., myAllocator),
|
||||
mySelector (Max(theReservedSize, 64),myAllocator)
|
||||
mySelector (myAllocator)
|
||||
{
|
||||
const Standard_Real aTol = Precision::Confusion();
|
||||
SetCellSize ( aTol + 0.05 * aTol );
|
||||
|
@@ -36,14 +36,12 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
//! @param theReservedSize size to be reserved for vector of vertices.
|
||||
//! @param theAllocator memory allocator to be used by internal collections.
|
||||
Standard_EXPORT BRepMesh_VertexTool(
|
||||
const Standard_Integer theReservedSize,
|
||||
const Handle(NCollection_IncAllocator)& theAllocator);
|
||||
|
||||
//! Sets new size of cell for cellfilter equal in both directions.
|
||||
Standard_EXPORT void SetCellSize(const Standard_Real theSize)
|
||||
void SetCellSize(const Standard_Real theSize)
|
||||
{
|
||||
myCellFilter.Reset(theSize, myAllocator);
|
||||
mySelector.Clear();
|
||||
@@ -52,8 +50,8 @@ public:
|
||||
//! Sets new size of cell for cellfilter.
|
||||
//! @param theSizeX size for X dimension.
|
||||
//! @param theSizeY size for Y dimension.
|
||||
Standard_EXPORT void SetCellSize(const Standard_Real theSizeX,
|
||||
const Standard_Real theSizeY)
|
||||
void SetCellSize(const Standard_Real theSizeX,
|
||||
const Standard_Real theSizeY)
|
||||
{
|
||||
Standard_Real aCellSizeC[2] = { theSizeX, theSizeY };
|
||||
NCollection_Array1<Standard_Real> aCellSize(aCellSizeC[0], 1, 2);
|
||||
@@ -63,7 +61,7 @@ public:
|
||||
|
||||
//! Sets the tolerance to be used for identification of
|
||||
//! coincident vertices equal for both dimensions.
|
||||
Standard_EXPORT void SetTolerance(const Standard_Real theTolerance)
|
||||
void SetTolerance(const Standard_Real theTolerance)
|
||||
{
|
||||
mySelector.SetTolerance( theTolerance );
|
||||
myTolerance[0] = theTolerance;
|
||||
@@ -74,8 +72,8 @@ public:
|
||||
//! coincident vertices.
|
||||
//! @param theToleranceX tolerance for X dimension.
|
||||
//! @param theToleranceY tolerance for Y dimension.
|
||||
Standard_EXPORT void SetTolerance(const Standard_Real theToleranceX,
|
||||
const Standard_Real theToleranceY)
|
||||
void SetTolerance(const Standard_Real theToleranceX,
|
||||
const Standard_Real theToleranceY)
|
||||
{
|
||||
mySelector.SetTolerance( theToleranceX, theToleranceY );
|
||||
myTolerance[0] = theToleranceX;
|
||||
@@ -86,8 +84,8 @@ public:
|
||||
//! coincident vertices.
|
||||
//! @param theToleranceX tolerance for X dimension.
|
||||
//! @param theToleranceY tolerance for Y dimension.
|
||||
Standard_EXPORT void GetTolerance(Standard_Real& theToleranceX,
|
||||
Standard_Real& theToleranceY)
|
||||
void GetTolerance(Standard_Real& theToleranceX,
|
||||
Standard_Real& theToleranceY)
|
||||
{
|
||||
theToleranceX = myTolerance[0];
|
||||
theToleranceY = myTolerance[1];
|
||||
@@ -124,7 +122,7 @@ public:
|
||||
}
|
||||
|
||||
//! Returns index of the given vertex.
|
||||
Standard_EXPORT Standard_Integer FindIndex(const BRepMesh_Vertex& theVertex)
|
||||
Standard_Integer FindIndex(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
mySelector.SetPoint(theVertex.Coord());
|
||||
myCellFilter.Inspect (theVertex.Coord(), mySelector);
|
||||
|
@@ -22,7 +22,8 @@
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
#include <BRepMesh_PairOfPolygon.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
@@ -147,10 +148,11 @@ BRepMesh_WireChecker::BRepMesh_WireChecker(
|
||||
TopoDS_Face aFace = theFace;
|
||||
aFace.Orientation(TopAbs_FORWARD);
|
||||
|
||||
TopExp_Explorer aFaceExplorer(aFace, TopAbs_WIRE);
|
||||
for (; aFaceExplorer.More(); aFaceExplorer.Next())
|
||||
for (TopoDS_Iterator aFaceIt(aFace); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceExplorer.Current());
|
||||
if (aFaceIt.Value().IsNull() || aFaceIt.Value().ShapeType() != TopAbs_WIRE) // may be inner vertex
|
||||
continue;
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceIt.Value());
|
||||
|
||||
myWiresEdges.Append(ListOfEdges());
|
||||
ListOfEdges& aEdges = myWiresEdges.ChangeLast();
|
||||
|
@@ -76,6 +76,8 @@
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef DRAW
|
||||
@@ -100,167 +102,100 @@ static TopoDS_Vertex CommonVertex(TopoDS_Edge& E1,
|
||||
TopoDS_Edge& E2)
|
||||
{
|
||||
TopoDS_Vertex V1[2],V2[2],V;
|
||||
// Modified by skv - Wed Dec 24 18:08:39 2003 OCC4455 Begin
|
||||
// TopExp::Vertices(E1,V1[0],V1[1]);
|
||||
// TopExp::Vertices(E2,V2[0],V2[1]);
|
||||
|
||||
//
|
||||
TopExp::Vertices(E1,V1[0],V1[1], Standard_True);
|
||||
TopExp::Vertices(E2,V2[0],V2[1], Standard_True);
|
||||
// The first edge is the current one, the second edge is the next one.
|
||||
// We check last vertex of the first edge first.
|
||||
// if (V1[0].IsSame(V2[0]) || V1[0].IsSame(V2[1])) return V1[0];
|
||||
// if (V1[1].IsSame(V2[0]) || V1[1].IsSame(V2[1])) return V1[1];
|
||||
if (V1[1].IsSame(V2[0]) || V1[1].IsSame(V2[1])) return V1[1];
|
||||
if (V1[0].IsSame(V2[0]) || V1[0].IsSame(V2[1])) return V1[0];
|
||||
// Modified by skv - Wed Dec 24 18:08:40 2003 OCC4455 End
|
||||
//
|
||||
return V;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Store
|
||||
//purpose :
|
||||
//purpose : The vertices are added despite of the coincidence with
|
||||
// already added vertices. When all vertices for all edges
|
||||
// are added the coinciding chains of vertices should be fused
|
||||
// using FuseVertices() method.
|
||||
//=======================================================================
|
||||
|
||||
static void Store (const TopoDS_Edge& E1,
|
||||
const TopoDS_Edge& E2,
|
||||
TopTools_ListOfShape& LV1,
|
||||
TopTools_ListOfShape& LV2,
|
||||
Handle(BRepAlgo_AsDes) AsDes,
|
||||
Standard_Real Tol)
|
||||
static void Store (const TopoDS_Edge& E1,
|
||||
const TopoDS_Edge& E2,
|
||||
const TopTools_ListOfShape& LV1,
|
||||
const TopTools_ListOfShape& LV2,
|
||||
Handle(BRepAlgo_AsDes) AsDes,
|
||||
Standard_Real Tol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV)
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// Test if the points of intersection correspond to existing
|
||||
// vertices. Otherwise add edges in the descendants.
|
||||
// Note: at this stage only vertices of intersection are in the descendants.
|
||||
//-------------------------------------------------------------
|
||||
const TopTools_ListOfShape& VOnE1 = AsDes->Descendant(E1);
|
||||
const TopTools_ListOfShape& VOnE2 = AsDes->Descendant(E2);
|
||||
TopTools_ListOfShape NewVOnE1;
|
||||
TopTools_ListOfShape NewVOnE2;
|
||||
gp_Pnt P,P1,P2;
|
||||
TopoDS_Vertex V1,V2;
|
||||
TopTools_ListIteratorOfListOfShape it, itLV1, itLV2;
|
||||
BRep_Builder B;
|
||||
TopAbs_Orientation O1,O2;
|
||||
Standard_Real U1,U2;
|
||||
Standard_Boolean OnE1,OnE2;
|
||||
|
||||
for (itLV1.Initialize(LV1),itLV2.Initialize(LV2);
|
||||
itLV1.More();
|
||||
itLV1.Next() ,itLV2.Next()) {
|
||||
|
||||
TopoDS_Vertex V = TopoDS::Vertex(itLV1.Value());
|
||||
|
||||
U1 = (BRep_Tool::Degenerated(E1))?
|
||||
BRep_Tool::Parameter(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)), E1) :
|
||||
BRep_Tool::Parameter(V, E1);
|
||||
U2 = (BRep_Tool::Degenerated(E2))?
|
||||
BRep_Tool::Parameter(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)), E2) :
|
||||
BRep_Tool::Parameter(V, E2);
|
||||
O1 = V.Orientation();
|
||||
O2 = itLV2.Value().Orientation();
|
||||
P = BRep_Tool::Pnt(V);
|
||||
OnE1 = OnE2 = Standard_False;
|
||||
|
||||
if (!VOnE1.IsEmpty()) {
|
||||
//-----------------------------------------------------------------
|
||||
// Find if the point of intersection corresponds to a vertex of E1.
|
||||
//-----------------------------------------------------------------
|
||||
for (it.Initialize(VOnE1); it.More(); it.Next()) {
|
||||
P1 = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
|
||||
if (P.IsEqual(P1,Tol)) {
|
||||
V = TopoDS::Vertex(it.Value());
|
||||
V1 = V;
|
||||
OnE1 = Standard_True;
|
||||
BRep_Builder aBB;
|
||||
for (Standard_Integer i = 0; i < 2; ++i) {
|
||||
const TopoDS_Edge& aE = !i ? E1 : E2;
|
||||
const TopTools_ListOfShape& aLV = !i ? LV1 : LV2;
|
||||
const TopTools_ListOfShape& aLVEx = AsDes->Descendant(aE);
|
||||
if (aLVEx.IsEmpty()) {
|
||||
if (aLV.Extent()) AsDes->Add(aE, aLV);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
TopTools_MapOfShape aMV;
|
||||
TopTools_ListIteratorOfListOfShape aIt(aLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value());
|
||||
if (!aMV.Add(aV)) {
|
||||
continue;
|
||||
}
|
||||
gp_Pnt aP = BRep_Tool::Pnt(aV);
|
||||
//
|
||||
TopTools_ListOfShape aLVC;
|
||||
TopTools_ListIteratorOfListOfShape aItEx(aLVEx);
|
||||
for (; aItEx.More(); aItEx.Next()) {
|
||||
const TopoDS_Vertex& aVEx = TopoDS::Vertex(aItEx.Value());
|
||||
if (aV.IsSame(aVEx)) {
|
||||
break;
|
||||
}
|
||||
gp_Pnt aPEx = BRep_Tool::Pnt(aVEx);
|
||||
//
|
||||
if (aP.IsEqual(aPEx, Tol)) {
|
||||
aLVC.Append(aVEx);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!VOnE2.IsEmpty()) {
|
||||
if (OnE1) {
|
||||
//-----------------------------------------------------------------
|
||||
// Find if the vertex found on E1 is not already on E2.
|
||||
//-----------------------------------------------------------------
|
||||
for (it.Initialize(VOnE2); it.More(); it.Next()) {
|
||||
if (it.Value().IsSame(V)) {
|
||||
OnE2 = Standard_True;
|
||||
V2 = V;
|
||||
break;
|
||||
//
|
||||
if (aItEx.More()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (aLVC.Extent()) {
|
||||
TopTools_ListOfShape aLVN;
|
||||
aLVN.Append(aV);
|
||||
//
|
||||
TopTools_ListIteratorOfListOfShape aItLV(aLVC);
|
||||
for (; aItLV.More(); aItLV.Next()) {
|
||||
const TopoDS_Shape& aVC = aItLV.Value();
|
||||
TopTools_ListOfShape* pLV = aDMVV.ChangeSeek(aVC);
|
||||
if (!pLV) {
|
||||
aDMVV.Add(aVC, aLVN);
|
||||
}
|
||||
else {
|
||||
pLV->Append(aV);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (it.Initialize(VOnE2); it.More(); it.Next()) {
|
||||
//-----------------------------------------------------------------
|
||||
// Find if the point of intersection corresponds to a vertex of E2.
|
||||
//-----------------------------------------------------------------
|
||||
P2 = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
|
||||
if (P.IsEqual(P2,Tol)) {
|
||||
V = TopoDS::Vertex(it.Value());
|
||||
V2 = V;
|
||||
OnE2 = Standard_True;
|
||||
break;
|
||||
//
|
||||
TopTools_ListOfShape* pLV = aDMVV.ChangeSeek(aV);
|
||||
if (!pLV) {
|
||||
aDMVV.Add(aV, aLVC);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OnE1 && OnE2) {
|
||||
if (!V1.IsSame(V2)) {
|
||||
//---------------------------------------------------------------
|
||||
// Two vertices are actually the same.
|
||||
// V2 will be replaced by V1.
|
||||
// update the parameters of vertex on edges.
|
||||
//---------------------------------------------------------------
|
||||
Standard_Real UV2;
|
||||
TopoDS_Edge EWE2;
|
||||
const TopTools_ListOfShape& EdgeWithV2 = AsDes->Ascendant(V2);
|
||||
|
||||
for (it.Initialize(EdgeWithV2); it.More(); it.Next()) {
|
||||
EWE2 = TopoDS::Edge(it.Value());
|
||||
TopoDS_Shape aLocalShape =V2.Oriented(TopAbs_INTERNAL);
|
||||
UV2 = BRep_Tool::Parameter(TopoDS::Vertex(aLocalShape),EWE2);
|
||||
// UV2 =
|
||||
// BRep_Tool::Parameter(TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),EWE2);
|
||||
aLocalShape = V1.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),UV2,EWE2,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),
|
||||
// UV2,EWE2,Tol);
|
||||
else {
|
||||
pLV->Append(aLVC);
|
||||
}
|
||||
AsDes->Replace(V2,V1);
|
||||
}
|
||||
//
|
||||
aBB.UpdateVertex(aV, Tol);
|
||||
AsDes->Add(aE, aV);
|
||||
}
|
||||
if (!OnE1) {
|
||||
if (OnE2) {
|
||||
TopoDS_Shape aLocalShape = V.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),U1,E1,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)),
|
||||
// U1,E1,Tol);
|
||||
}
|
||||
NewVOnE1.Append(V.Oriented(O1));
|
||||
}
|
||||
if (!OnE2) {
|
||||
if (OnE1) {
|
||||
TopoDS_Shape aLocalShape = V.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),U2,E2,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)),
|
||||
// U2,E2,Tol);
|
||||
}
|
||||
NewVOnE2.Append(V.Oriented(O2));
|
||||
}
|
||||
|
||||
#ifdef DRAW
|
||||
if (Inter2dAffichInt2d) {
|
||||
if (!OnE1 && !OnE2) {
|
||||
char name[256];
|
||||
sprintf(name,"VV_%d",NbNewVertices++);
|
||||
DBRep::Set(name,V);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!NewVOnE1.IsEmpty()) AsDes->Add(E1,NewVOnE1);
|
||||
if (!NewVOnE2.IsEmpty()) AsDes->Add(E2,NewVOnE2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : EdgeInter
|
||||
//purpose :
|
||||
@@ -272,7 +207,8 @@ static void EdgeInter(const TopoDS_Face& F,
|
||||
const TopoDS_Edge& E2,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
Standard_Real Tol,
|
||||
Standard_Boolean WithOri)
|
||||
Standard_Boolean WithOri,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV)
|
||||
{
|
||||
#ifdef DRAW
|
||||
if (Inter2dAffichInt2d) {
|
||||
@@ -444,32 +380,26 @@ static void EdgeInter(const TopoDS_Face& F,
|
||||
if (V1[j].IsNull()) continue;
|
||||
for (Standard_Integer k = 0; k < 2; k++) {
|
||||
if (V2[k].IsNull()) continue;
|
||||
if (V1[j].IsSame(V2[k])) {
|
||||
if (AsDes->HasAscendant(V1[j])) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//
|
||||
gp_Pnt P1 = BRep_Tool::Pnt(V1[j]);
|
||||
gp_Pnt P2 = BRep_Tool::Pnt(V2[k]);
|
||||
Standard_Real Dist = P1.Distance(P2);
|
||||
if (Dist < TolConf) {
|
||||
Standard_Real aTol =
|
||||
Max(BRep_Tool::Tolerance(V1[j]), BRep_Tool::Tolerance(V2[k]));
|
||||
TopoDS_Vertex V = BRepLib_MakeVertex(P1);
|
||||
U1 = (j == 0) ? f[1] : l[1];
|
||||
U2 = (k == 0) ? f[2] : l[2];
|
||||
//
|
||||
TopoDS_Shape aLocalShape = V.Oriented(TopAbs_INTERNAL);
|
||||
// Modified by skv - Thu Jan 22 18:16:01 2004 OCC4455 Begin
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(V1[j]);
|
||||
|
||||
if (!V1[j].IsSame(V2[k])) {
|
||||
Standard_Real aTol2 = BRep_Tool::Tolerance(V2[k]);
|
||||
|
||||
aTol = Max(aTol, aTol2);
|
||||
}
|
||||
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),U1,E1,aTol);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),U2,E2,aTol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(aLocalShape),U1,E1,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(aLocalShape),U2,E2,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)),
|
||||
// U1,E1,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)),
|
||||
// U2,E2,Tol);
|
||||
// Modified by skv - Thu Jan 22 18:16:01 2004 OCC4455 End
|
||||
//
|
||||
LV1.Prepend(V.Oriented(V1[j].Orientation()));
|
||||
LV2.Prepend(V.Oriented(V2[k].Orientation()));
|
||||
}
|
||||
@@ -521,15 +451,9 @@ static void EdgeInter(const TopoDS_Face& F,
|
||||
//---------------------------------
|
||||
// Vertex storage in DS.
|
||||
//---------------------------------
|
||||
// Modified by skv - Tue Jan 13 15:14:30 2004 Begin
|
||||
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
|
||||
TolStore = Max(TolStore, 10.*Tol);
|
||||
|
||||
Store (E1,E2,LV1,LV2,AsDes,TolStore);
|
||||
// Store (E1,E2,LV1,LV2,AsDes,10.*Tol);
|
||||
// Store (E1,E2,LV1,LV2,AsDes,Tol);
|
||||
// Modified by skv - Tue Jan 13 15:14:30 2004 End
|
||||
Store (E1,E2,LV1,LV2,AsDes,TolStore, aDMVV);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -544,7 +468,8 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
Standard_Real Tol,
|
||||
Standard_Boolean WithOri,
|
||||
gp_Pnt& Pref)
|
||||
gp_Pnt& Pref,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV)
|
||||
{
|
||||
#ifdef DRAW
|
||||
if (Inter2dAffichInt2d) {
|
||||
@@ -712,6 +637,12 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
if (V1[j].IsNull()) continue;
|
||||
for (Standard_Integer k = 0; k < 2; k++) {
|
||||
if (V2[k].IsNull()) continue;
|
||||
if (V1[j].IsSame(V2[k])) {
|
||||
if (AsDes->HasAscendant(V1[j])) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//
|
||||
gp_Pnt P1 = BRep_Tool::Pnt(V1[j]);
|
||||
gp_Pnt P2 = BRep_Tool::Pnt(V2[k]);
|
||||
Standard_Real Dist = P1.Distance(P2);
|
||||
@@ -722,10 +653,6 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
TopoDS_Shape aLocalShape = V.Oriented(TopAbs_INTERNAL);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),U1,E1,Tol);
|
||||
B.UpdateVertex(TopoDS::Vertex(aLocalShape),U2,E2,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)),
|
||||
// U1,E1,Tol);
|
||||
// B.UpdateVertex(TopoDS::Vertex(V.Oriented(TopAbs_INTERNAL)),
|
||||
// U2,E2,Tol);
|
||||
LV1.Prepend(V.Oriented(V1[j].Orientation()));
|
||||
LV2.Prepend(V.Oriented(V2[k].Orientation()));
|
||||
}
|
||||
@@ -794,16 +721,9 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
}
|
||||
|
||||
////-----------------------------------------------------
|
||||
|
||||
// Modified by skv - Tue Jan 13 15:14:30 2004 Begin
|
||||
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
|
||||
|
||||
TolStore = Max(TolStore, 10.*Tol);
|
||||
|
||||
Store (E1,E2,LV1,LV2,AsDes,TolStore);
|
||||
// Store (E1,E2,LV1,LV2,AsDes,10.*Tol);
|
||||
// Store (E1,E2,LV1,LV2,AsDes,Tol);
|
||||
// Modified by skv - Tue Jan 13 15:14:30 2004 End
|
||||
Store (E1,E2,LV1,LV2,AsDes,TolStore, aDMVV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1403,7 +1323,8 @@ static Standard_Boolean UpdateVertex(TopoDS_Vertex V,
|
||||
void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const TopoDS_Face& F,
|
||||
const TopTools_IndexedMapOfShape& NewEdges,
|
||||
const Standard_Real Tol)
|
||||
const Standard_Real Tol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
{
|
||||
#ifdef DRAW
|
||||
NbF2d++;
|
||||
@@ -1445,7 +1366,7 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
|
||||
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
|
||||
TopoDS_Shape aLocalShape = F.Oriented(TopAbs_FORWARD);
|
||||
EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True);
|
||||
EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True, theDMVV);
|
||||
// EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True);
|
||||
}
|
||||
it2LE.Next();
|
||||
@@ -1470,7 +1391,8 @@ void BRepOffset_Inter2d::ConnexIntByInt
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||
const Standard_Real Offset,
|
||||
const Standard_Real Tol)
|
||||
const Standard_Real Tol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
// Modified by skv - Fri Dec 26 16:53:18 2003 OCC4455 End
|
||||
{
|
||||
|
||||
@@ -1584,7 +1506,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
|
||||
for (Exp1.Init(NE1,TopAbs_EDGE) ; Exp1.More(); Exp1.Next()) {
|
||||
for (Exp2.Init(NE2,TopAbs_EDGE) ; Exp2.More(); Exp2.Next()) {
|
||||
RefEdgeInter(FIO,BAsurf,TopoDS::Edge(Exp1.Current()),TopoDS::Edge(Exp2.Current()),
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref, theDMVV);
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -1599,12 +1521,12 @@ void BRepOffset_Inter2d::ConnexIntByInt
|
||||
//
|
||||
for (Exp1.Init(NE1,TopAbs_EDGE) ; Exp1.More(); Exp1.Next()) {
|
||||
RefEdgeInter(FIO,BAsurf,TopoDS::Edge(Exp1.Current()),aE3,
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref, theDMVV);
|
||||
}
|
||||
//
|
||||
for (Exp1.Init(NE2,TopAbs_EDGE) ; Exp1.More(); Exp1.Next()) {
|
||||
RefEdgeInter(FIO,BAsurf,TopoDS::Edge(Exp1.Current()),aE3,
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref, theDMVV);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1625,3 +1547,71 @@ void BRepOffset_Inter2d::ConnexIntByInt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeChain
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void MakeChain(const TopoDS_Shape& theV,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
||||
TopTools_MapOfShape& theMDone,
|
||||
BOPCol_ListOfShape& theChain)
|
||||
{
|
||||
if (theMDone.Add(theV)) {
|
||||
theChain.Append(theV);
|
||||
const TopTools_ListOfShape* pLV = theDMVV.Seek(theV);
|
||||
if (pLV) {
|
||||
TopTools_ListIteratorOfListOfShape aIt(*pLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
MakeChain(aIt.Value(), theDMVV, theMDone, theChain);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FuseVertices
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepOffset_Inter2d::FuseVertices(const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes)
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
TopTools_MapOfShape aMVDone;
|
||||
Standard_Integer i, aNb = theDMVV.Extent();
|
||||
for (i = 1; i <= aNb; ++i) {
|
||||
const TopoDS_Vertex& aV = TopoDS::Vertex(theDMVV.FindKey(i));
|
||||
//
|
||||
// find chain of vertices
|
||||
BOPCol_ListOfShape aLVChain;
|
||||
MakeChain(aV, theDMVV, aMVDone, aLVChain);
|
||||
//
|
||||
if (aLVChain.Extent() < 2) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// make new vertex
|
||||
TopoDS_Vertex aVNew;
|
||||
BOPTools_AlgoTools::MakeVertex(aLVChain, aVNew);
|
||||
//
|
||||
TopoDS_Vertex aVNewInt = TopoDS::Vertex(aVNew.Oriented(TopAbs_INTERNAL));
|
||||
//
|
||||
BOPCol_ListIteratorOfListOfShape aIt(aLVChain);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aVOld = aIt.Value();
|
||||
// update the parameters on edges
|
||||
TopoDS_Vertex aVOldInt = TopoDS::Vertex(aVOld.Oriented(TopAbs_INTERNAL));
|
||||
const TopTools_ListOfShape& aLE = theAsDes->Ascendant(aVOld);
|
||||
//
|
||||
TopTools_ListIteratorOfListOfShape aItLE(aLE);
|
||||
for (; aItLE.More(); aItLE.Next()) {
|
||||
const TopoDS_Edge& aE = TopoDS::Edge(aItLE.Value());
|
||||
Standard_Real aTolE = BRep_Tool::Tolerance(aE);
|
||||
Standard_Real aT = BRep_Tool::Parameter(aVOldInt, aE);
|
||||
aBB.UpdateVertex(aVNewInt, aT, aE, aTolE);
|
||||
}
|
||||
// and replace the vertex
|
||||
theAsDes->Replace(aVOld, aVNew);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
class BRepAlgo_AsDes;
|
||||
class TopoDS_Face;
|
||||
class BRepOffset_Offset;
|
||||
@@ -41,11 +42,21 @@ public:
|
||||
//! Computes the intersections between the edges stored
|
||||
//! is AsDes as descendants of <F> . Intersections is computed
|
||||
//! between two edges if one of them is bound in NewEdges.
|
||||
//! When all faces of the shape are treated the intersection
|
||||
//! vertices have to be fused using the FuseVertices method.
|
||||
//! theDMVV contains the vertices that should be fused
|
||||
Standard_EXPORT static void Compute (const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const TopoDS_Face& F,
|
||||
const TopTools_IndexedMapOfShape& NewEdges,
|
||||
const Standard_Real Tol);
|
||||
|
||||
const Standard_Real Tol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
|
||||
|
||||
//! Computes the intersection between the offset edges
|
||||
//! stored in AsDes as descendatnds on <F>. All intersection
|
||||
//! vertices will be stored in AsDes2d. When all faces of the
|
||||
//! shape are treated the intersection vertices have to be fused
|
||||
//! using the FuseVertices method.
|
||||
//! theDMVV contains the vertices that should be fused.
|
||||
Standard_EXPORT static void ConnexIntByInt (const TopoDS_Face& FI,
|
||||
BRepOffset_Offset& OFI,
|
||||
TopTools_DataMapOfShapeShape& MES,
|
||||
@@ -53,10 +64,14 @@ public:
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||
const Standard_Real Offset,
|
||||
const Standard_Real Tol);
|
||||
|
||||
|
||||
const Standard_Real Tol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
|
||||
|
||||
//! Fuses the chains of vertices in the theDMVV
|
||||
//! and updates AsDes by replacing the old vertices
|
||||
//! with the new ones.
|
||||
Standard_EXPORT static void FuseVertices(const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
|
||||
const Handle(BRepAlgo_AsDes)& theAsDes);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -1189,14 +1189,18 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
//---------------------------------------------------------------------------------
|
||||
// Extension of neighbor edges of new edges and intersection between neighbors.
|
||||
//--------------------------------------------------------------------------------
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aDMVV;
|
||||
Handle(BRepAlgo_AsDes) AsDes2d = new BRepAlgo_AsDes();
|
||||
for (Exp.Init(myShape,TopAbs_FACE) ; Exp.More(); Exp.Next())
|
||||
{
|
||||
const TopoDS_Face& FI = TopoDS::Face(Exp.Current());
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(FI);
|
||||
BRepOffset_Inter2d::ConnexIntByInt (FI, MapSF(FI), MES, Build,
|
||||
AsDes, AsDes2d, myOffset, aCurrFaceTol);
|
||||
AsDes, AsDes2d, myOffset, aCurrFaceTol, aDMVV);
|
||||
}
|
||||
//
|
||||
// fuse vertices on edges
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes2d);
|
||||
//-----------------------------------------------------------
|
||||
// Great restriction of new edges and update of AsDes.
|
||||
//------------------------------------------ ----------------
|
||||
@@ -1326,12 +1330,13 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
}
|
||||
}
|
||||
|
||||
aDMVV.Clear();
|
||||
TopTools_ListIteratorOfListOfShape itLFE(LFE);
|
||||
for (; itLFE.More(); itLFE.Next())
|
||||
{
|
||||
const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value());
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF);
|
||||
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol);
|
||||
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, aDMVV);
|
||||
}
|
||||
//----------------------------------------------
|
||||
// Intersections 2d on caps.
|
||||
@@ -1341,9 +1346,10 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
|
||||
{
|
||||
const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
|
||||
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork);
|
||||
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol);
|
||||
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, aDMVV);
|
||||
}
|
||||
|
||||
//
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes);
|
||||
//-------------------------------
|
||||
// Unwinding of extended Faces.
|
||||
//-------------------------------
|
||||
@@ -2909,12 +2915,15 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Mod
|
||||
//-----------------------------------------------
|
||||
// Intersection of edges 2 by 2.
|
||||
//-----------------------------------------------
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aDMVV;
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= Modif.Extent(); i++) {
|
||||
const TopoDS_Face& F = TopoDS::Face(Modif(i));
|
||||
BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol);
|
||||
BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol, aDMVV);
|
||||
}
|
||||
|
||||
//
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes);
|
||||
//
|
||||
#ifdef OCCT_DEBUG
|
||||
if (AffichInt2d) {
|
||||
DEBVerticesControl (NewEdges,myAsDes);
|
||||
|
@@ -1792,7 +1792,7 @@ Standard_Integer build3d(Draw_Interpretor& di,
|
||||
}
|
||||
|
||||
Standard_Boolean Ok;
|
||||
TopoDS_Shape S = DBRep::Get(a[1],TopAbs_FACE);
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 1;
|
||||
|
||||
if (n==2) { Ok = BRepLib::BuildCurves3d(S); }
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
//#ifdef _MSC_VER
|
||||
@@ -65,16 +66,18 @@ static Standard_Integer distance (Draw_Interpretor& di,
|
||||
}
|
||||
|
||||
static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
Standard_Integer i1;
|
||||
// gp_Pnt P;
|
||||
|
||||
if (n != 4) return 1;
|
||||
{
|
||||
if (n != 4 && n != 5 )
|
||||
return 1;
|
||||
|
||||
const char *ns1 = (a[2]), *ns2 = (a[3]), *ns0 = (a[1]);
|
||||
TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ;
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2 );
|
||||
TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
|
||||
|
||||
Standard_Real aDeflection = Precision::Confusion();
|
||||
if (n == 5)
|
||||
aDeflection = Draw::Atoi(a[4]);
|
||||
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
|
||||
|
||||
if (dst.IsDone())
|
||||
{
|
||||
@@ -95,7 +98,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
|
||||
Draw::Set(tempd,dst.Value());
|
||||
di << named << " ";
|
||||
|
||||
for (i1=1; i1<= dst.NbSolution(); i1++)
|
||||
for (Standard_Integer i1 = 1; i1<= dst.NbSolution(); i1++)
|
||||
{
|
||||
gp_Pnt P1,P2;
|
||||
P1 = (dst.PointOnShape1(i1));
|
||||
@@ -416,7 +419,7 @@ void BRepTest::ExtremaCommands (Draw_Interpretor& theCommands)
|
||||
aGroup);
|
||||
|
||||
theCommands.Add ("distmini",
|
||||
"distmini name Shape1 Shape2",
|
||||
"distmini name Shape1 Shape2 [deflection]",
|
||||
__FILE__,
|
||||
distmini,
|
||||
aGroup);
|
||||
|
@@ -732,10 +732,22 @@ static Standard_Integer PRF(Draw_Interpretor& theCommands,
|
||||
static Standard_Integer SPLS(Draw_Interpretor& ,
|
||||
Standard_Integer narg, const char** a)
|
||||
{
|
||||
Standard_Integer newnarg ;
|
||||
Standard_Integer newnarg;
|
||||
|
||||
if (narg<3) return 1;
|
||||
if (narg < 3)
|
||||
{
|
||||
cout << "Invalid number of arguments. Should be : splitshape result shape [splitedges] \
|
||||
[face wire/edge/compound [wire/edge/compound ...] \
|
||||
[face wire/edge/compound [wire/edge/compound...] ...] \
|
||||
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]" << endl;
|
||||
return 1;
|
||||
}
|
||||
TopoDS_Shape S = DBRep::Get(a[2]);
|
||||
if (S.IsNull())
|
||||
{
|
||||
cout << "Invalid input shape " << a[2]<<endl;
|
||||
return 1;
|
||||
}
|
||||
BRepFeat_SplitShape Spls(S);
|
||||
Standard_Boolean pick = Standard_False;
|
||||
TopoDS_Shape EF;
|
||||
@@ -752,20 +764,42 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
|
||||
(newnarg !=narg && ((narg-newnarg)<=2 || (narg-newnarg)%2 != 1))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (i<newnarg) {
|
||||
Standard_Boolean isSplittingEdges = Standard_False;
|
||||
TopTools_SequenceOfShape aSplitEdges;
|
||||
if (i < newnarg) {
|
||||
pick = (a[i][0] == '.');
|
||||
EF = DBRep::Get(a[i],TopAbs_FACE);
|
||||
if (EF.IsNull()) return 1;
|
||||
|
||||
TopoDS_Shape aSh = DBRep::Get(a[i]);
|
||||
if (aSh.IsNull())
|
||||
{
|
||||
cout << "Invalid input shape " <<a[i]<<endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (aSh.ShapeType() == TopAbs_FACE)
|
||||
EF = TopoDS::Face(aSh);
|
||||
else
|
||||
{
|
||||
if (aSh.ShapeType() == TopAbs_COMPOUND || aSh.ShapeType() == TopAbs_WIRE || aSh.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
|
||||
for (; aExpE.More(); aExpE.Next())
|
||||
aSplitEdges.Append(aExpE.Current());
|
||||
|
||||
isSplittingEdges = (aSplitEdges.Length());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
i++;
|
||||
while (i < newnarg) {
|
||||
if (pick) {
|
||||
DBRep_DrawableShape::LastPick(EF,u,v);
|
||||
}
|
||||
if (EF.ShapeType() == TopAbs_FACE) {
|
||||
if (!isSplittingEdges && !EF.IsNull() && EF.ShapeType() == TopAbs_FACE) {
|
||||
// face wire/edge ...
|
||||
i++;
|
||||
|
||||
while (i < newnarg) {
|
||||
TopoDS_Shape W;
|
||||
Standard_Boolean rever = Standard_False;
|
||||
@@ -811,11 +845,36 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
|
||||
}
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
{
|
||||
if (isSplittingEdges)
|
||||
{
|
||||
TopoDS_Shape aSh = DBRep::Get(a[i]);
|
||||
if (aSh.IsNull())
|
||||
{
|
||||
cout << "Invalid input shape " <<a[i]<< endl;
|
||||
return 1;
|
||||
}
|
||||
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
|
||||
for (; aExpE.More(); aExpE.Next())
|
||||
aSplitEdges.Append(aExpE.Current());
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Invalid input arguments. Should be : splitshape result shape [splitedges] \
|
||||
[face wire/edge/compound [wire/edge/compound ...] \
|
||||
[face wire/edge/compound [wire/edge/compound...] ...] \
|
||||
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]"<<endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (isSplittingEdges)
|
||||
Spls.Add(aSplitEdges);
|
||||
|
||||
// ici, i vaut newnarg
|
||||
for (i++; i<narg; i+=2) {
|
||||
for (; i < narg; i += 2) {
|
||||
TopoDS_Shape Ew,Es;
|
||||
TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_EDGE));
|
||||
Es = TopoDS::Edge(aLocalShape);
|
||||
@@ -827,6 +886,7 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
|
||||
Ew = TopoDS::Edge(aLocalShape);
|
||||
// Ew = TopoDS::Edge(DBRep::Get(a[i+1],TopAbs_EDGE));
|
||||
if (Ew.IsNull()) {
|
||||
cout << "Invalid input shape " <<a[i+1]<< endl;
|
||||
return 1;
|
||||
}
|
||||
Spls.Add(TopoDS::Edge(Ew),TopoDS::Edge(Es));
|
||||
@@ -2250,8 +2310,8 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
|
||||
|
||||
|
||||
theCommands.Add("splitshape",
|
||||
"splitshape result shape face wire/edge/compound [wire/edge/compound ...][face wire/edge/compound [wire/edge/compound...] ...] [@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]",
|
||||
__FILE__,SPLS,g);
|
||||
"splitshape result shape [splitedges] [face wire/edge/compound [wire/edge/compound ...][face wire/edge/compound [wire/edge/compound...] ...] [@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]",
|
||||
__FILE__, SPLS, g);
|
||||
|
||||
|
||||
theCommands.Add("thickshell",
|
||||
|
@@ -495,18 +495,21 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
|
||||
Standard_Integer locStatus = myStatus;
|
||||
|
||||
// apply recorded modifications to subshapes
|
||||
Standard_Boolean isEmpty = Standard_True;
|
||||
for ( TopoDS_Iterator it(shape,Standard_False); it.More(); it.Next() ) {
|
||||
TopoDS_Shape sh = it.Value();
|
||||
newsh = Apply ( sh, until );
|
||||
if ( newsh != sh ) {
|
||||
if ( myStatus & EncodeStatus(4)) //ShapeExtend::DecodeStatus ( myStatus, ShapeExtend_DONE4 ) )
|
||||
locStatus |= EncodeStatus(4); //|= ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
|
||||
locStatus |= EncodeStatus(4); //|= ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
|
||||
modif = 1;
|
||||
}
|
||||
if ( newsh.IsNull() ) {
|
||||
locStatus |= EncodeStatus(4); //ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
|
||||
continue;
|
||||
}
|
||||
if ( isEmpty )
|
||||
isEmpty = Standard_False;
|
||||
locStatus |= EncodeStatus(3);//ShapeExtend::EncodeStatus ( ShapeExtend_DONE3 );
|
||||
if ( st == TopAbs_COMPOUND || newsh.ShapeType() == sh.ShapeType()) { //fix for SAMTECH bug OCC322 about abcense internal vertices after sewing.
|
||||
B.Add ( result, newsh );
|
||||
@@ -522,23 +525,33 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
|
||||
}
|
||||
if ( ! modif ) return shape;
|
||||
|
||||
// restore Range on edge broken by EmptyCopied()
|
||||
if ( st == TopAbs_EDGE ) {
|
||||
CopyRanges (result, shape, 0, 1);
|
||||
// For empty topological containers (any kind of shape except vertex, edge
|
||||
// and face) we have to produce an empty result
|
||||
if ( isEmpty && st != TopAbs_VERTEX && st != TopAbs_EDGE && st != TopAbs_FACE )
|
||||
{
|
||||
result = TopoDS_Shape();
|
||||
}
|
||||
else if (st == TopAbs_FACE) {
|
||||
TopoDS_Face face = TopoDS::Face ( shape );
|
||||
if( BRep_Tool::NaturalRestriction( face ) ) {
|
||||
BRep_Builder aB;
|
||||
aB.NaturalRestriction( TopoDS::Face ( result ), Standard_True );
|
||||
else
|
||||
{
|
||||
// restore Range on edge broken by EmptyCopied()
|
||||
if ( st == TopAbs_EDGE ) {
|
||||
CopyRanges (result, shape, 0, 1);
|
||||
}
|
||||
}
|
||||
else if (st == TopAbs_WIRE || st == TopAbs_SHELL)
|
||||
result.Closed (BRep_Tool::IsClosed (result));
|
||||
else if (st == TopAbs_FACE) {
|
||||
TopoDS_Face face = TopoDS::Face ( shape );
|
||||
if( BRep_Tool::NaturalRestriction( face ) ) {
|
||||
BRep_Builder aB;
|
||||
aB.NaturalRestriction( TopoDS::Face ( result ), Standard_True );
|
||||
}
|
||||
}
|
||||
else if (st == TopAbs_WIRE || st == TopAbs_SHELL)
|
||||
result.Closed (BRep_Tool::IsClosed (result));
|
||||
|
||||
result.Orientation(orien);
|
||||
}
|
||||
|
||||
result.Orientation(orien);
|
||||
myStatus = locStatus;
|
||||
Replace ( shape, result );
|
||||
myStatus = locStatus;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -1726,7 +1726,7 @@ void BiTgte_Blend::ComputeCenters()
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// Proceed with MakeLoops
|
||||
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aDMVV;
|
||||
BRepOffset_Type OT = BRepOffset_Concave;
|
||||
if (myRadius < 0.) OT = BRepOffset_Convex;
|
||||
|
||||
@@ -1779,7 +1779,8 @@ void BiTgte_Blend::ComputeCenters()
|
||||
BRepOffset_Inter2d::Compute(myAsDes,
|
||||
CurOF,
|
||||
myEdges,
|
||||
myTol);
|
||||
myTol,
|
||||
aDMVV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1811,8 +1812,12 @@ void BiTgte_Blend::ComputeCenters()
|
||||
BRepOffset_Inter2d::Compute(myAsDes,
|
||||
CurOF,
|
||||
myEdges,
|
||||
myTol);
|
||||
myTol,
|
||||
aDMVV);
|
||||
}
|
||||
//
|
||||
// fuse vertices on edges stored in AsDes
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes);
|
||||
// ------------
|
||||
// unwinding
|
||||
// ------------
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
Standard_EXPORT void Add (const gp_XY& thePnt);
|
||||
|
||||
//! Update the box by a point.
|
||||
Standard_EXPORT void Add (const gp_Pnt2d& thePnt);
|
||||
void Add (const gp_Pnt2d& thePnt);
|
||||
|
||||
//! Update the box by another box.
|
||||
void Add (const Bnd_B2d& theBox);
|
||||
|
@@ -21,8 +21,8 @@
|
||||
inline Standard_Real Bnd_Box::SquareExtent() const
|
||||
{
|
||||
if ( IsVoid() ) return 0.;
|
||||
Standard_Real dx = Xmax-Xmin+Gap;
|
||||
Standard_Real dy = Ymax-Ymin+Gap;
|
||||
Standard_Real dz = Zmax-Zmin+Gap;
|
||||
return dx*dx + dy*dy + dz*dz;
|
||||
const Standard_Real aDx = Xmax - Xmin + Gap + Gap;
|
||||
const Standard_Real aDy = Ymax - Ymin + Gap + Gap;
|
||||
const Standard_Real aDz = Zmax - Zmin + Gap + Gap;
|
||||
return aDx*aDx + aDy*aDy + aDz*aDz;
|
||||
}
|
||||
|
@@ -238,8 +238,8 @@ inline Standard_Boolean Bnd_Box2d::IsOut (const gp_Trsf2d& T1,
|
||||
inline Standard_Real Bnd_Box2d::SquareExtent() const
|
||||
{
|
||||
if ( IsVoid() ) return 0.;
|
||||
Standard_Real dx = Xmax-Xmin+Gap;
|
||||
Standard_Real dy = Ymax-Ymin+Gap;
|
||||
return dx*dx + dy*dy;
|
||||
const Standard_Real aDx = Xmax - Xmin + Gap + Gap;
|
||||
const Standard_Real aDy = Ymax - Ymin + Gap + Gap;
|
||||
return aDx*aDx + aDy*aDy;
|
||||
}
|
||||
|
||||
|
@@ -1332,8 +1332,11 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
|
||||
proj1.Perform(pt1, SolDep(1), SolDep(2));
|
||||
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
|
||||
proj2.Perform(pt2, SolDep(3), SolDep(4));
|
||||
|
||||
if( proj1.IsDone() ){
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
@@ -1389,8 +1392,12 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
|
||||
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
|
||||
proj1.Perform(pt1, SolDep(1), SolDep(2));
|
||||
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
|
||||
proj2.Perform(pt2, SolDep(3), SolDep(4));
|
||||
|
||||
if( proj1.IsDone() ){
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
@@ -1457,8 +1464,10 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
|
||||
proj1.Perform(pt1, SolDep(1), SolDep(2));
|
||||
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
|
||||
proj2.Perform(pt2, SolDep(3), SolDep(4));
|
||||
if( proj1.IsDone() ){
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
@@ -1525,8 +1534,10 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
Extrema_GenLocateExtPS proj1(pt1,S2->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S1->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
Extrema_GenLocateExtPS proj1(S2->Surface(), tol, tol);
|
||||
proj1.Perform(pt1, SolDep(1), SolDep(2));
|
||||
Extrema_GenLocateExtPS proj2(S1->Surface(), tol, tol);
|
||||
proj2.Perform(pt2, SolDep(3), SolDep(4));
|
||||
if( proj1.IsDone() ) {
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
|
@@ -584,6 +584,11 @@ static Standard_Integer nexplode(Draw_Interpretor& di,
|
||||
typ = TopAbs_EDGE;
|
||||
break;
|
||||
|
||||
case 'V' :
|
||||
case 'v' :
|
||||
typ = TopAbs_VERTEX;
|
||||
break;
|
||||
|
||||
default :
|
||||
return 1;
|
||||
}
|
||||
@@ -604,20 +609,26 @@ static Standard_Integer nexplode(Draw_Interpretor& di,
|
||||
}
|
||||
Exp.Next();
|
||||
}
|
||||
|
||||
//
|
||||
TColStd_Array1OfInteger OrderInd(1,MaxShapes);
|
||||
// gp_Pnt GPoint;
|
||||
gp_Pnt GPoint;
|
||||
GProp_GProps GPr;
|
||||
// Standard_Integer InOfminX = 1,aTemp;
|
||||
Standard_Integer aTemp;
|
||||
TColStd_Array1OfReal MidXYZ(1,MaxShapes); //X,Y,Z;
|
||||
Standard_Boolean NoSort = Standard_True;
|
||||
|
||||
// Computing of CentreOfMass
|
||||
//
|
||||
// Computing of CentreOfMass for edge and face
|
||||
// and for vertex use its point
|
||||
for (Index=1; Index <= MaxShapes; Index++) {
|
||||
OrderInd.SetValue(Index,Index);
|
||||
BRepGProp::LinearProperties(aShapes(Index),GPr);
|
||||
gp_Pnt GPoint = GPr.CentreOfMass();
|
||||
const TopoDS_Shape& aS = aShapes(Index);
|
||||
if (aS.ShapeType() != TopAbs_VERTEX) {
|
||||
BRepGProp::LinearProperties(aS, GPr);
|
||||
GPoint = GPr.CentreOfMass();
|
||||
}
|
||||
else {
|
||||
GPoint = BRep_Tool::Pnt(TopoDS::Vertex(aS));
|
||||
}
|
||||
MidXYZ.SetValue(Index, GPoint.X()*999 + GPoint.Y()*99 +
|
||||
GPoint.Z()*0.9);
|
||||
}
|
||||
@@ -1288,7 +1299,7 @@ void DBRep::BasicCommands(Draw_Interpretor& theCommands)
|
||||
theCommands.Add("compound","compound [name1 name2 ..] compound",__FILE__,compound,g);
|
||||
theCommands.Add("add","add name1 name2",__FILE__,add,g);
|
||||
theCommands.Add("explode","explode name [Cd/C/So/Sh/F/W/E/V]",__FILE__,explode,g);
|
||||
theCommands.Add("nexplode","stable numbered explode for edge and face: nexplode name [F/E]",__FILE__,nexplode,g);
|
||||
theCommands.Add("nexplode","stable numbered explode for vertex, edge and face: nexplode name [V/E/F]",__FILE__,nexplode,g);
|
||||
theCommands.Add("exwire","exwire wirename",__FILE__,exwire,g);
|
||||
theCommands.Add("emptycopy","emptycopy [copyshape] originalshape",__FILE__,emptycopy,g);
|
||||
theCommands.Add("check","check shape1 shape2 ...",__FILE__,check,g);
|
||||
|
@@ -543,21 +543,15 @@ proc checkprops {shape args} {
|
||||
_check_args ${args} ${options} "checkprops"
|
||||
|
||||
if { ${length} != -1 || ${equal_check} == 1 } {
|
||||
set CommandName lprops
|
||||
set mass $length
|
||||
set prop "length"
|
||||
lappend CommandNames {lprops}
|
||||
set equal_check 0
|
||||
}
|
||||
if { ${area} != -1 || ${equal_check} == 1 } {
|
||||
set CommandName sprops
|
||||
set mass $area
|
||||
set prop "area"
|
||||
lappend CommandNames {sprops}
|
||||
set equal_check 0
|
||||
}
|
||||
if { ${volume} != -1 || ${equal_check} == 1 } {
|
||||
set CommandName vprops
|
||||
set mass $volume
|
||||
set prop "volume"
|
||||
lappend CommandNames {vprops}
|
||||
set equal_check 0
|
||||
}
|
||||
|
||||
@@ -565,41 +559,47 @@ proc checkprops {shape args} {
|
||||
if { $skip } {
|
||||
set skip_option "-skip"
|
||||
}
|
||||
|
||||
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${shape} ${epsilon} $skip_option] full m
|
||||
|
||||
if { ${compared_equal_shape} != -1 } {
|
||||
upvar ${compared_equal_shape} ${compared_equal_shape}
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_equal_shape} ${epsilon} $skip_option] full compared_m
|
||||
if { $compared_m != $m } {
|
||||
puts "Error: Shape ${compared_equal_shape} is not equal to shape ${shape}"
|
||||
foreach CommandName ${CommandNames} {
|
||||
switch $CommandName {
|
||||
"lprops" { set mass ${length}; set prop "length" }
|
||||
"sprops" { set mass ${area}; set prop "area" }
|
||||
"vprops" { set mass ${volume}; set prop "volume" }
|
||||
}
|
||||
}
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${shape} ${epsilon} $skip_option] full m
|
||||
|
||||
if { ${compared_notequal_shape} != -1 } {
|
||||
upvar ${compared_notequal_shape} ${compared_notequal_shape}
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_notequal_shape} ${epsilon} $skip_option] full compared_m
|
||||
if { $compared_m == $m } {
|
||||
puts "Error: Shape ${compared_notequal_shape} is equal shape to ${shape}"
|
||||
if { ${compared_equal_shape} != -1 } {
|
||||
upvar ${compared_equal_shape} ${compared_equal_shape}
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_equal_shape} ${epsilon} $skip_option] full compared_m
|
||||
if { $compared_m != $m } {
|
||||
puts "Error: Shape ${compared_equal_shape} is not equal to shape ${shape}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if { ${compared_equal_shape} == -1 && ${compared_notequal_shape} == -1 } {
|
||||
if { [string compare "$mass" "empty"] != 0 } {
|
||||
if { $m == 0 } {
|
||||
puts "Error : The command is not valid. The $prop is 0."
|
||||
if { ${compared_notequal_shape} != -1 } {
|
||||
upvar ${compared_notequal_shape} ${compared_notequal_shape}
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_notequal_shape} ${epsilon} $skip_option] full compared_m
|
||||
if { $compared_m == $m } {
|
||||
puts "Error: Shape ${compared_notequal_shape} is equal shape to ${shape}"
|
||||
}
|
||||
if { $mass > 0 } {
|
||||
puts "The expected $prop is $mass"
|
||||
}
|
||||
#check of change of area is < 1%
|
||||
if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
|
||||
puts "Error : The $prop of result shape is $m"
|
||||
}
|
||||
} else {
|
||||
if { $m != 0 } {
|
||||
puts "Error : The command is not valid. The $prop is $m"
|
||||
}
|
||||
|
||||
if { ${compared_equal_shape} == -1 && ${compared_notequal_shape} == -1 } {
|
||||
if { [string compare "$mass" "empty"] != 0 } {
|
||||
if { $m == 0 } {
|
||||
puts "Error : The command is not valid. The $prop is 0."
|
||||
}
|
||||
if { $mass > 0 } {
|
||||
puts "The expected $prop is $mass"
|
||||
}
|
||||
#check of change of area is < 1%
|
||||
if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
|
||||
puts "Error : The $prop of result shape is $m"
|
||||
}
|
||||
} else {
|
||||
if { $m != 0 } {
|
||||
puts "Error : The command is not valid. The $prop is $m"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1428,7 +1428,7 @@ proc _html_color {status} {
|
||||
if { $status == "OK" } {
|
||||
return lightgreen
|
||||
} elseif { [regexp -nocase {^FAIL} $status] } {
|
||||
return red
|
||||
return ff8080
|
||||
} elseif { [regexp -nocase {^BAD} $status] } {
|
||||
return yellow
|
||||
} elseif { [regexp -nocase {^IMP} $status] } {
|
||||
@@ -1976,7 +1976,7 @@ proc _log_html_diff {file log dir1 dir2 highlight_percent} {
|
||||
# put a line; highlight considerable (> ${highlight_percent}%) deviations of CPU and memory
|
||||
if { [regexp "\[\\\[](\[0-9.e+-]+)%\[\]]" $line res value] &&
|
||||
[expr abs($value)] > ${highlight_percent} } {
|
||||
puts $fd "<table><tr><td bgcolor=\"[expr $value > 0 ? \"red\" : \"lightgreen\"]\">$line</td></tr></table>"
|
||||
puts $fd "<table><tr><td bgcolor=\"[expr $value > 0 ? \"ff8080\" : \"lightgreen\"]\">$line</td></tr></table>"
|
||||
} else {
|
||||
puts $fd $line
|
||||
}
|
||||
|
@@ -339,7 +339,7 @@ public:
|
||||
//! The point P must be on the curve. These functions are
|
||||
//! not protected, however, and if point P is not on the
|
||||
//! curve, an exception may be raised.
|
||||
Standard_EXPORT static Standard_Real Parameter (const gp_Lin& L, const gp_Pnt& P);
|
||||
static Standard_Real Parameter (const gp_Lin& L, const gp_Pnt& P);
|
||||
|
||||
//! parametrization
|
||||
//! P (U) = L.Location() + U * L.Direction()
|
||||
|
@@ -36,9 +36,13 @@
|
||||
Extrema_ExtElC2d::Extrema_ExtElC2d () { myDone = Standard_False; }
|
||||
//=============================================================================
|
||||
|
||||
Extrema_ExtElC2d::Extrema_ExtElC2d (const gp_Lin2d& C1,
|
||||
const gp_Lin2d& C2,
|
||||
const Standard_Real)
|
||||
//=======================================================================
|
||||
//function : Extrema_ExtElC2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Extrema_ExtElC2d::Extrema_ExtElC2d (const gp_Lin2d& C1,
|
||||
const gp_Lin2d& C2,
|
||||
const Standard_Real)
|
||||
/*-----------------------------------------------------------------------------
|
||||
Function:
|
||||
Find min distance between 2 straight lines.
|
||||
@@ -57,15 +61,37 @@ Method:
|
||||
myIsPar = Standard_False;
|
||||
myNbExt = 0;
|
||||
|
||||
gp_Dir2d D1 = C1.Direction();
|
||||
gp_Dir2d D2 = C2.Direction();
|
||||
if (D1.IsParallel(D2, Precision::Angular())) {
|
||||
gp_Vec2d D1(C1.Direction());
|
||||
gp_Vec2d D2(C2.Direction());
|
||||
if (D1.IsParallel(D2, Precision::Angular()))
|
||||
{
|
||||
myIsPar = Standard_True;
|
||||
mySqDist[0] = C2.SquareDistance(C1.Location());
|
||||
}
|
||||
else {
|
||||
myNbExt = 0;
|
||||
else
|
||||
{
|
||||
// Vector from P1 to P2 (P2 - P1).
|
||||
gp_Vec2d aP1P2(C1.Location(), C2.Location());
|
||||
|
||||
// Solve linear system using Cramer's rule:
|
||||
// D1.X * t1 + D2.X * (-t2) = P2.X - P1.X
|
||||
// D1.Y * t1 + D2.Y * (-t2) = P2.Y - P1.Y
|
||||
|
||||
// There is no division by zero since lines are not parallel.
|
||||
Standard_Real aDelim = 1 / (D1^D2);
|
||||
|
||||
Standard_Real aParam1 = (aP1P2 ^ D2) * aDelim;
|
||||
Standard_Real aParam2 = -(D1 ^ aP1P2) * aDelim; // -1.0 coefficient before t2.
|
||||
|
||||
gp_Pnt2d P1 = ElCLib::Value(aParam1, C1);
|
||||
gp_Pnt2d P2 = ElCLib::Value(aParam2, C2);
|
||||
|
||||
mySqDist[myNbExt] = 0.0;
|
||||
myPoint[myNbExt][0] = Extrema_POnCurv2d(aParam1,P1);
|
||||
myPoint[myNbExt][1] = Extrema_POnCurv2d(aParam2,P2);
|
||||
myNbExt = 1;
|
||||
}
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
//=============================================================================
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Extrema_FuncExtPS.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Extrema_GenExtPS.hxx>
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
Standard_Real myvinf;
|
||||
Standard_Real myvsup;
|
||||
Standard_Real mytolv;
|
||||
Extrema_FuncExtPS myF;
|
||||
Extrema_FuncPSNorm myF;
|
||||
Handle(Adaptor3d_HCurve) myC;
|
||||
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) myS;
|
||||
gp_Vec myDirection;
|
||||
|
119
src/Extrema/Extrema_FuncPSDist.cxx
Normal file
119
src/Extrema/Extrema_FuncPSDist.cxx
Normal file
@@ -0,0 +1,119 @@
|
||||
// Created on: 2016-05-10
|
||||
// Created by: Alexander MALYSHEV
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Extrema_FuncPSDist.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Extrema_FuncPSDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Extrema_FuncPSDist::Extrema_FuncPSDist(const Adaptor3d_Surface& theS,
|
||||
const gp_Pnt& theP)
|
||||
: mySurf(theS),
|
||||
myP(theP)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer Extrema_FuncPSDist::NbVariables () const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Extrema_FuncPSDist::Value(const math_Vector& X,Standard_Real& F)
|
||||
{
|
||||
if (!IsInside(X))
|
||||
return Standard_False;
|
||||
|
||||
F = mySurf.Value(X(1), X(2)).SquareDistance(myP);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Gradient
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Extrema_FuncPSDist::Gradient(const math_Vector& X,math_Vector& G)
|
||||
|
||||
{
|
||||
if (!IsInside(X))
|
||||
return Standard_False;
|
||||
|
||||
gp_Pnt aP;
|
||||
gp_Vec Du1s, Dv1s;
|
||||
mySurf.D1(X(1),X(2),aP,Du1s,Dv1s);
|
||||
|
||||
gp_Vec P1P2 (aP, myP);
|
||||
|
||||
G(1) = P1P2.Dot(Du1s);
|
||||
G(2) = P1P2.Dot(Dv1s);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Extrema_FuncPSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
||||
{
|
||||
if (!IsInside(X))
|
||||
return Standard_False;
|
||||
|
||||
gp_Pnt aP;
|
||||
gp_Vec Du1s, Dv1s;
|
||||
mySurf.D1(X(1),X(2),aP,Du1s,Dv1s);
|
||||
|
||||
gp_Vec P1P2 (aP, myP);
|
||||
|
||||
G(1) = P1P2.Dot(Du1s);
|
||||
G(2) = P1P2.Dot(Dv1s);
|
||||
|
||||
F = mySurf.Value(X(1), X(2)).SquareDistance(myP);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsInside
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Extrema_FuncPSDist::IsInside(const math_Vector& X)
|
||||
{
|
||||
if (X(1) < mySurf.FirstUParameter() ||
|
||||
X(1) > mySurf.LastUParameter() ||
|
||||
X(2) < mySurf.FirstUParameter() ||
|
||||
X(2) > mySurf.LastUParameter() )
|
||||
{
|
||||
// Point out of borders.
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Point is inside.
|
||||
return Standard_True;
|
||||
}
|
82
src/Extrema/Extrema_FuncPSDist.hxx
Normal file
82
src/Extrema/Extrema_FuncPSDist.hxx
Normal file
@@ -0,0 +1,82 @@
|
||||
// Created on: 2016-05-10
|
||||
// Created by: Alexander MALYSHEV
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Extrema_FuncPSDsit_HeaderFile
|
||||
#define _Extrema_FuncPSDsit_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <math_MultipleVarFunctionWithGradient.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
class math_Vector;
|
||||
|
||||
//! Functional for search of extremum of the square Euclidean distance between point P and
|
||||
//! surface S, starting from approximate solution (u0, v0).
|
||||
//!
|
||||
//! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
|
||||
//! for use in math_BFGS algorithm.
|
||||
//!
|
||||
//! The criteria is:
|
||||
//! F = SquareDist(P, S(u, v)) - > min
|
||||
//!
|
||||
//! The first derivative are:
|
||||
//! F1(u,v) = (S(u,v) - P) * Su
|
||||
//! F2(u,v) = (S(u,v) - P) * Sv
|
||||
//!
|
||||
//! Su and Sv are first derivatives of the surface, * symbol means dot product.
|
||||
class Extrema_FuncPSDist : public math_MultipleVarFunctionWithGradient
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT Extrema_FuncPSDist(const Adaptor3d_Surface& theS,
|
||||
const gp_Pnt& theP);
|
||||
|
||||
//! Number of variables.
|
||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
||||
|
||||
//! Value.
|
||||
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
|
||||
|
||||
//! Gradient.
|
||||
Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
|
||||
|
||||
//! Value and gradient.
|
||||
Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Check point is inside of the surface parameter space.
|
||||
//! Returns true if inside and false otherwise.
|
||||
Standard_Boolean IsInside(const math_Vector& X);
|
||||
|
||||
const Extrema_FuncPSDist& operator=(const Extrema_FuncPSDist&);
|
||||
Extrema_FuncPSDist(const Extrema_FuncPSDist&);
|
||||
|
||||
const Adaptor3d_Surface &mySurf;
|
||||
const gp_Pnt &myP;
|
||||
};
|
||||
#endif // _Extrema_FuncPSDsit_HeaderFile
|
@@ -14,27 +14,25 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
// Modified by skv - Thu Sep 30 15:21:07 2004 OCC593
|
||||
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <Extrema_FuncExtPS.hxx>
|
||||
#include <Extrema_POnSurf.hxx>
|
||||
#include <GeomAbs_IsoType.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
|
||||
Extrema_FuncExtPS::Extrema_FuncExtPS ()
|
||||
Extrema_FuncPSNorm::Extrema_FuncPSNorm ()
|
||||
{
|
||||
myPinit = Standard_False;
|
||||
mySinit = Standard_False;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
Extrema_FuncExtPS::Extrema_FuncExtPS (const gp_Pnt& P,
|
||||
Extrema_FuncPSNorm::Extrema_FuncPSNorm (const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S)
|
||||
{
|
||||
myP = P;
|
||||
@@ -44,7 +42,7 @@ Extrema_FuncExtPS::Extrema_FuncExtPS (const gp_Pnt& P,
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
void Extrema_FuncExtPS::Initialize(const Adaptor3d_Surface& S)
|
||||
void Extrema_FuncPSNorm::Initialize(const Adaptor3d_Surface& S)
|
||||
{
|
||||
myS = (Adaptor3d_SurfacePtr)&S;
|
||||
mySinit = Standard_True;
|
||||
@@ -54,7 +52,7 @@ void Extrema_FuncExtPS::Initialize(const Adaptor3d_Surface& S)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Extrema_FuncExtPS::SetPoint(const gp_Pnt& P)
|
||||
void Extrema_FuncPSNorm::SetPoint(const gp_Pnt& P)
|
||||
{
|
||||
myP = P;
|
||||
myPinit = Standard_True;
|
||||
@@ -66,13 +64,13 @@ void Extrema_FuncExtPS::SetPoint(const gp_Pnt& P)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncExtPS::NbVariables () const { return 2;}
|
||||
Standard_Integer Extrema_FuncPSNorm::NbVariables () const { return 2;}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncExtPS::NbEquations () const { return 2;}
|
||||
Standard_Integer Extrema_FuncPSNorm::NbEquations () const { return 2;}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_FuncExtPS::Value (const math_Vector& UV,
|
||||
Standard_Boolean Extrema_FuncPSNorm::Value (const math_Vector& UV,
|
||||
math_Vector& F)
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
@@ -90,7 +88,7 @@ Standard_Boolean Extrema_FuncExtPS::Value (const math_Vector& UV,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_FuncExtPS::Derivatives (const math_Vector& UV,
|
||||
Standard_Boolean Extrema_FuncPSNorm::Derivatives (const math_Vector& UV,
|
||||
math_Matrix& Df)
|
||||
{
|
||||
math_Vector F(1,2);
|
||||
@@ -98,7 +96,7 @@ Standard_Boolean Extrema_FuncExtPS::Derivatives (const math_Vector& UV,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_FuncExtPS::Values (const math_Vector& UV,
|
||||
Standard_Boolean Extrema_FuncPSNorm::Values (const math_Vector& UV,
|
||||
math_Vector& F,
|
||||
math_Matrix& Df)
|
||||
{
|
||||
@@ -123,7 +121,7 @@ Standard_Boolean Extrema_FuncExtPS::Values (const math_Vector& UV,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncExtPS::GetStateNumber ()
|
||||
Standard_Integer Extrema_FuncPSNorm::GetStateNumber ()
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
//comparison of solution with previous solutions
|
||||
@@ -145,20 +143,20 @@ Standard_Integer Extrema_FuncExtPS::GetStateNumber ()
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncExtPS::NbExt () const
|
||||
Standard_Integer Extrema_FuncPSNorm::NbExt () const
|
||||
{
|
||||
return mySqDist.Length();
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Real Extrema_FuncExtPS::SquareDistance (const Standard_Integer N) const
|
||||
Standard_Real Extrema_FuncPSNorm::SquareDistance (const Standard_Integer N) const
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
return mySqDist.Value(N);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
const Extrema_POnSurf& Extrema_FuncExtPS::Point (const Standard_Integer N) const
|
||||
const Extrema_POnSurf& Extrema_FuncPSNorm::Point (const Standard_Integer N) const
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
return myPoint.Value(N);
|
@@ -14,12 +14,11 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Extrema_FuncExtPS_HeaderFile
|
||||
#define _Extrema_FuncExtPS_HeaderFile
|
||||
#ifndef _Extrema_FunctPSNorm_HeaderFile
|
||||
#define _Extrema_FunctPSNorm_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
@@ -58,16 +57,16 @@ class Extrema_POnSurf;
|
||||
//! Dvf2(u,v) = Sv^2 + (S-P) * Svv
|
||||
//!
|
||||
//! Here * denotes scalar product, and ^2 is square power.
|
||||
class Extrema_FuncExtPS : public math_FunctionSetWithDerivatives
|
||||
class Extrema_FuncPSNorm : public math_FunctionSetWithDerivatives
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT Extrema_FuncExtPS();
|
||||
Standard_EXPORT Extrema_FuncPSNorm();
|
||||
|
||||
Standard_EXPORT Extrema_FuncExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S);
|
||||
Standard_EXPORT Extrema_FuncPSNorm(const gp_Pnt& P, const Adaptor3d_Surface& S);
|
||||
|
||||
//! sets the field mysurf of the function.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S);
|
||||
@@ -100,19 +99,8 @@ public:
|
||||
//! Returns the Nth extremum.
|
||||
Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
gp_Pnt myP;
|
||||
Adaptor3d_SurfacePtr myS;
|
||||
Standard_Real myU;
|
||||
@@ -122,14 +110,5 @@ private:
|
||||
Extrema_SequenceOfPOnSurf myPoint;
|
||||
Standard_Boolean myPinit;
|
||||
Standard_Boolean mySinit;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Extrema_FuncExtPS_HeaderFile
|
||||
#endif // _Extrema_FunctPSNorm_HeaderFile
|
@@ -250,10 +250,10 @@ void Extrema_GenExtCC::Perform()
|
||||
aFinder.SetFunctionalMinimalValue(0.0); // Best distance cannot be lower than 0.0.
|
||||
|
||||
// Size computed to have cell index inside of int32 value.
|
||||
const Standard_Real aCellSize = Max(anIntervals1.Upper() - anIntervals1.Lower(),
|
||||
anIntervals2.Upper() - anIntervals2.Lower())
|
||||
const Standard_Real aCellSize = Max(anIntervals1.Last() - anIntervals1.First(),
|
||||
anIntervals2.Last() - anIntervals2.First())
|
||||
* Precision::PConfusion() / (2.0 * Sqrt(2.0));
|
||||
Extrema_CCPointsInspector anInspector(Precision::PConfusion());
|
||||
Extrema_CCPointsInspector anInspector(aCellSize);
|
||||
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(aCellSize);
|
||||
NCollection_Vector<gp_XY> aPnts;
|
||||
|
||||
@@ -335,8 +335,7 @@ void Extrema_GenExtCC::Perform()
|
||||
|
||||
// Avoid mark parallel case when have duplicates out of tolerance.
|
||||
// Bad conditioned task: bug25635_1, bug23706_10, bug23706_13.
|
||||
const Standard_Integer aMinNbInfSol = 100;
|
||||
if (aPnts.Size() >= aMinNbInfSol)
|
||||
if (aPnts.Size() >= 2)
|
||||
{
|
||||
isParallel = Standard_True;
|
||||
for(Standard_Integer anIdx = aPnts.Lower(); anIdx <= aPnts.Upper() - 1; anIdx++)
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include <Extrema_HArray2OfPOnSurfParams.hxx>
|
||||
#include <Extrema_HUBTreeOfSphere.hxx>
|
||||
#include <Bnd_HArray1OfSphere.hxx>
|
||||
#include <Extrema_FuncExtPS.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
@@ -148,7 +148,7 @@ private:
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myPoints;
|
||||
Extrema_HUBTreeOfSphere mySphereUBTree;
|
||||
Handle(Bnd_HArray1OfSphere) mySphereArray;
|
||||
Extrema_FuncExtPS myF;
|
||||
Extrema_FuncPSNorm myF;
|
||||
Adaptor3d_SurfacePtr myS;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
|
@@ -15,94 +15,117 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <Extrema_FuncExtPS.hxx>
|
||||
#include <Extrema_GenLocateExtPS.hxx>
|
||||
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Extrema_FuncPSDist.hxx>
|
||||
#include <Extrema_POnSurf.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
#include <math_NewtonFunctionSetRoot.hxx>
|
||||
#include <math_BFGS.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=============================================================================
|
||||
Extrema_GenLocateExtPS::Extrema_GenLocateExtPS () { myDone = Standard_False; }
|
||||
//=============================================================================
|
||||
//=======================================================================
|
||||
//function : Extrema_GenLocateExtPS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Extrema_GenLocateExtPS::Extrema_GenLocateExtPS(const Adaptor3d_Surface& theS,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV)
|
||||
: mySurf(theS),
|
||||
myTolU(theTolU), myTolV(theTolV),
|
||||
myDone(Standard_False),
|
||||
mySqDist(-1.0)
|
||||
{
|
||||
}
|
||||
|
||||
Extrema_GenLocateExtPS::Extrema_GenLocateExtPS (const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real V0,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV)
|
||||
/*-----------------------------------------------------------------------------
|
||||
Function:
|
||||
Find (U,V) close to (U0,V0) so that dist(S(U,V),P) was extreme.
|
||||
|
||||
Method:
|
||||
If (u,v) is a solution, it is possible to write:
|
||||
{ F1(u,v) = (S(u,v)-P).dS/du(u,v) = 0.
|
||||
{ F2(u,v) = (S(u,v)-P).dS/dv(u,v) = 0.
|
||||
The problem consists in finding, in the interval of surface definition,
|
||||
the root of the system closest to (U0,V0).
|
||||
Use class math_FunctionSetRoot with the following construction arguments:
|
||||
- F: Extrema_FuncExtPS created from P and S,
|
||||
- U0V0: math_Vector (U0,V0),
|
||||
- Tol: Min(TolU,TolV),
|
||||
|
||||
- math_Vector (Uinf,Usup),
|
||||
- math_Vector (Vinf,Vsup),
|
||||
- 100. .
|
||||
---------------------------------------------------------------------------*/
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Extrema_GenLocateExtPS::Perform(const gp_Pnt& theP,
|
||||
const Standard_Real theU0,
|
||||
const Standard_Real theV0,
|
||||
const Standard_Boolean isDistanceCriteria)
|
||||
{
|
||||
myDone = Standard_False;
|
||||
|
||||
Standard_Real Uinf, Usup, Vinf, Vsup;
|
||||
Uinf = S.FirstUParameter();
|
||||
Usup = S.LastUParameter();
|
||||
Vinf = S.FirstVParameter();
|
||||
Vsup = S.LastVParameter();
|
||||
// Prepare initial data structures.
|
||||
math_Vector aTol(1, 2), aStart(1, 2), aBoundInf(1, 2), aBoundSup(1, 2);
|
||||
|
||||
Extrema_FuncExtPS F (P,S);
|
||||
math_Vector Tol(1, 2), Start(1, 2), BInf(1, 2), BSup(1, 2);
|
||||
// Tolerance.
|
||||
aTol(1) = myTolU;
|
||||
aTol(2) = myTolV;
|
||||
|
||||
Tol(1) = TolU;
|
||||
Tol(2) = TolV;
|
||||
// Initial solution approximation.
|
||||
aStart(1) = theU0;
|
||||
aStart(2) = theV0;
|
||||
|
||||
Start(1) = U0;
|
||||
Start(2) = V0;
|
||||
// Borders.
|
||||
aBoundInf(1) = mySurf.FirstUParameter();
|
||||
aBoundInf(2) = mySurf.FirstVParameter();
|
||||
aBoundSup(1) = mySurf.LastUParameter();
|
||||
aBoundSup(2) = mySurf.LastVParameter();
|
||||
|
||||
BInf(1) = Uinf;
|
||||
BInf(2) = Vinf;
|
||||
BSup(1) = Usup;
|
||||
BSup(2) = Vsup;
|
||||
if (isDistanceCriteria == Standard_False)
|
||||
{
|
||||
// Normal projection criteria.
|
||||
Extrema_FuncPSNorm F(theP,mySurf);
|
||||
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
math_FunctionSetRoot SR (F, aTol);
|
||||
SR.Perform(F, aStart, aBoundInf, aBoundSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
mySqDist = F.SquareDistance(1);
|
||||
myPoint = F.Point(1);
|
||||
myDone = Standard_True;
|
||||
mySqDist = F.SquareDistance(1);
|
||||
myPoint = F.Point(1);
|
||||
myDone = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Distance criteria.
|
||||
Extrema_FuncPSDist F(mySurf, theP);
|
||||
math_BFGS aSolver(2);
|
||||
aSolver.Perform(F, aStart);
|
||||
|
||||
if (!aSolver.IsDone())
|
||||
return;
|
||||
|
||||
math_Vector aResPnt(1,2);
|
||||
aSolver.Location(aResPnt);
|
||||
mySqDist = aSolver.Minimum();
|
||||
myPoint.SetParameters(aResPnt(1), aResPnt(2), mySurf.Value(aResPnt(1), aResPnt(2)));
|
||||
myDone = Standard_True;
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_GenLocateExtPS::IsDone () const { return myDone; }
|
||||
//=============================================================================
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Extrema_GenLocateExtPS::IsDone () const
|
||||
{
|
||||
return myDone;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SquareDistance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real Extrema_GenLocateExtPS::SquareDistance () const
|
||||
{
|
||||
if (!IsDone()) { StdFail_NotDone::Raise(); }
|
||||
return mySqDist;
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Extrema_POnSurf& Extrema_GenLocateExtPS::Point () const
|
||||
{
|
||||
if (!IsDone()) { StdFail_NotDone::Raise(); }
|
||||
return myPoint;
|
||||
}
|
||||
//=============================================================================
|
||||
|
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
@@ -33,23 +32,27 @@ class Extrema_POnSurf;
|
||||
|
||||
//! With a close point, it calculates the distance
|
||||
//! between a point and a surface.
|
||||
//! This distance can be a minimum or a maximum.
|
||||
//! Criteria type is defined in "Perform" method.
|
||||
class Extrema_GenLocateExtPS
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT Extrema_GenLocateExtPS(const Adaptor3d_Surface& theS,
|
||||
const Standard_Real theTolU = Precision::PConfusion(),
|
||||
const Standard_Real theTolV = Precision::PConfusion());
|
||||
|
||||
Standard_EXPORT Extrema_GenLocateExtPS();
|
||||
|
||||
//! Calculates the distance with a close point.
|
||||
//! The close point is defined by the parameter values
|
||||
//! U0 and V0.
|
||||
//! The function F(u,v)=distance(S(u,v),p) has an
|
||||
//! extremun when gradient(F)=0. The algorithm searchs
|
||||
//! a zero near the close point.
|
||||
Standard_EXPORT Extrema_GenLocateExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real U0, const Standard_Real V0, const Standard_Real TolU, const Standard_Real TolV);
|
||||
//! Calculates the extrema between the point and the surface using a close point.
|
||||
//! The close point is defined by the parameter values theU0 and theV0.
|
||||
//! Type of the algorithm depends on the isDistanceCriteria flag.
|
||||
//! If flag value is false - normal projection criteria will be used.
|
||||
//! If flag value is true - distance criteria will be used.
|
||||
Standard_EXPORT void Perform(const gp_Pnt& theP,
|
||||
const Standard_Real theU0,
|
||||
const Standard_Real theV0,
|
||||
const Standard_Boolean isDistanceCriteria = Standard_False);
|
||||
|
||||
//! Returns True if the distance is found.
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
@@ -60,20 +63,19 @@ public:
|
||||
//! Returns the point of the extremum distance.
|
||||
Standard_EXPORT const Extrema_POnSurf& Point() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
const Extrema_GenLocateExtPS& operator=(const Extrema_GenLocateExtPS&);
|
||||
Extrema_GenLocateExtPS(const Extrema_GenLocateExtPS&);
|
||||
|
||||
// Input.
|
||||
const Adaptor3d_Surface& mySurf;
|
||||
Standard_Real myTolU, myTolV;
|
||||
|
||||
// State.
|
||||
Standard_Boolean myDone;
|
||||
|
||||
// Result.
|
||||
Standard_Real mySqDist;
|
||||
Extrema_POnSurf myPoint;
|
||||
|
||||
|
@@ -72,8 +72,10 @@ Extrema_FuncExtCC.lxx
|
||||
Extrema_FuncExtCS.cxx
|
||||
Extrema_FuncExtCS.hxx
|
||||
Extrema_FuncExtPC.gxx
|
||||
Extrema_FuncExtPS.cxx
|
||||
Extrema_FuncExtPS.hxx
|
||||
Extrema_FuncPSNorm.cxx
|
||||
Extrema_FuncPSNorm.hxx
|
||||
Extrema_FuncPSDist.cxx
|
||||
Extrema_FuncPSDist.hxx
|
||||
Extrema_FuncExtSS.cxx
|
||||
Extrema_FuncExtSS.hxx
|
||||
Extrema_GenExtCC.gxx
|
||||
|
@@ -1639,13 +1639,13 @@ void FSD_BinaryFile::ReadExtendedString (Standard_IStream& theIStream, TCollecti
|
||||
Storage_StreamReadError::Raise();
|
||||
}
|
||||
|
||||
theIStream.read ((char *)c, size*sizeof(Standard_ExtCharacter));
|
||||
|
||||
if (theIStream.gcount() != size)
|
||||
const std::streamsize aNbBytes = std::streamsize(sizeof(Standard_ExtCharacter) * size);
|
||||
theIStream.read ((char *)c, aNbBytes);
|
||||
if (theIStream.gcount() != aNbBytes)
|
||||
{
|
||||
Storage_StreamReadError::Raise();
|
||||
}
|
||||
|
||||
|
||||
c[size] = '\0';
|
||||
|
||||
#if OCCT_BINARY_FILE_DO_INVERSE
|
||||
|
@@ -38,7 +38,7 @@ struct Font_FontMgr_FontAliasMapNode
|
||||
static const Font_FontMgr_FontAliasMapNode Font_FontMgr_MapOfFontsAliases[] =
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
|
||||
{ "Courier" , "Courier New" , Font_FA_Regular },
|
||||
{ "Times-Roman" , "Times New Roman", Font_FA_Regular },
|
||||
@@ -122,15 +122,21 @@ static const Font_FontMgr_FontAliasMapNode Font_FontMgr_MapOfFontsAliases[] =
|
||||
"ttc",
|
||||
"pfa",
|
||||
"pfb",
|
||||
#ifdef __APPLE__
|
||||
// Datafork TrueType (OS X), obsolete
|
||||
//"dfont",
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__)
|
||||
// X11 configuration file in plain text format (obsolete - doesn't exists in modern distributives)
|
||||
static Standard_CString myFontServiceConf[] = {"/etc/X11/fs/config",
|
||||
"/usr/X11R6/lib/X11/fs/config",
|
||||
"/usr/X11/lib/X11/fs/config",
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// default fonts paths in Mac OS X
|
||||
@@ -384,6 +390,7 @@ void Font_FontMgr::InitFontDataBase()
|
||||
#else
|
||||
|
||||
NCollection_Map<TCollection_AsciiString> aMapOfFontsDirs;
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__)
|
||||
const OSD_Protection aProtectRead (OSD_R, OSD_R, OSD_R, OSD_R);
|
||||
|
||||
// read fonts directories from font service config file (obsolete)
|
||||
@@ -440,6 +447,7 @@ void Font_FontMgr::InitFontDataBase()
|
||||
}
|
||||
aFile.Close();
|
||||
}
|
||||
#endif
|
||||
|
||||
// append default directories
|
||||
for (Standard_Integer anIter = 0; myDefaultFontsDirs[anIter] != NULL; ++anIter)
|
||||
@@ -461,7 +469,7 @@ void Font_FontMgr::InitFontDataBase()
|
||||
for (NCollection_Map<TCollection_AsciiString>::Iterator anIter (aMapOfFontsDirs);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(__APPLE__)
|
||||
OSD_Path aFolderPath (anIter.Value());
|
||||
for (OSD_FileIterator aFileIter (aFolderPath, "*"); aFileIter.More(); aFileIter.Next())
|
||||
{
|
||||
|
@@ -51,14 +51,6 @@ GCE2d_MakeParabola::GCE2d_MakeParabola(const gp_Ax22d& Axis ,
|
||||
}
|
||||
}
|
||||
|
||||
GCE2d_MakeParabola::GCE2d_MakeParabola(const gp_Ax22d& Axis ,
|
||||
const gp_Pnt2d& F )
|
||||
{
|
||||
TheError = gce_Done;
|
||||
gp_Parab2d para(Axis,F);
|
||||
TheParabola = new Geom2d_Parabola(para);
|
||||
}
|
||||
|
||||
GCE2d_MakeParabola::GCE2d_MakeParabola(const gp_Ax2d& D ,
|
||||
const gp_Pnt2d& F ,
|
||||
const Standard_Boolean Sense )
|
||||
|
@@ -70,11 +70,6 @@ public:
|
||||
//! Status is "NegativeFocusLength" if Focal < 0.0
|
||||
Standard_EXPORT GCE2d_MakeParabola(const gp_Ax2d& MirrorAxis, const Standard_Real Focal, const Standard_Boolean Sense);
|
||||
|
||||
//! Creates a parabola with the local coordinate system and the focus point.
|
||||
//! The sense of parametrization is given by Sense.
|
||||
Standard_EXPORT GCE2d_MakeParabola(const gp_Ax22d& D, const gp_Pnt2d& F);
|
||||
|
||||
|
||||
//! D is the directrix of the parabola and F the focus point.
|
||||
//! The symmetry axis "XAxis" of the parabola is normal to the
|
||||
//! directrix and pass through the focus point F, but its
|
||||
|
@@ -24,3 +24,7 @@ GCPnts_UniformDeflection.cxx
|
||||
GCPnts_UniformDeflection.gxx
|
||||
GCPnts_UniformDeflection.hxx
|
||||
GCPnts_UniformDeflection.lxx
|
||||
GCPnts_DistFunction.hxx
|
||||
GCPnts_DistFunction.cxx
|
||||
GCPnts_DistFunction2d.hxx
|
||||
GCPnts_DistFunction2d.cxx
|
||||
|
73
src/GCPnts/GCPnts_DistFunction.cxx
Normal file
73
src/GCPnts/GCPnts_DistFunction.cxx
Normal file
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) 2014-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GCPnts_DistFunction.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxCurvLinDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_DistFunction::GCPnts_DistFunction(const Adaptor3d_Curve& theCurve,
|
||||
const Standard_Real U1, const Standard_Real U2)
|
||||
: myCurve(theCurve),
|
||||
myU1(U1), myU2(U2)
|
||||
{
|
||||
gp_Pnt P1 = theCurve.Value(U1), P2 = theCurve.Value(U2);
|
||||
myLin = gp_Lin(P1, P2.XYZ() - P1.XYZ());
|
||||
}
|
||||
//
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GCPnts_DistFunction::Value (const Standard_Real X,
|
||||
Standard_Real& F)
|
||||
{
|
||||
if (X < myU1 || X > myU2)
|
||||
return Standard_False;
|
||||
//
|
||||
F = -myLin.SquareDistance(myCurve.Value(X));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxCurvLinDistMV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_DistFunctionMV::GCPnts_DistFunctionMV(GCPnts_DistFunction& theCurvLinDist)
|
||||
: myMaxCurvLinDist(theCurvLinDist)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GCPnts_DistFunctionMV::Value (const math_Vector& X,
|
||||
Standard_Real& F)
|
||||
{
|
||||
Standard_Boolean Ok = myMaxCurvLinDist.Value(X(1), F);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GCPnts_DistFunctionMV::NbVariables() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
67
src/GCPnts/GCPnts_DistFunction.hxx
Normal file
67
src/GCPnts/GCPnts_DistFunction.hxx
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright (c) 2014-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _GCPnts_DistFunction_HeaderFile
|
||||
#define _GCPnts_DistFunction_HeaderFile
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <math_Function.hxx>
|
||||
#include <math_MultipleVarFunction.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
|
||||
class gp_Pnt;
|
||||
|
||||
//! Class to define function, which calculates square distance between point on curve
|
||||
//! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2)
|
||||
//! This function is used in any minimisation algorithm to define maximal deviation between curve and line,
|
||||
//! which required one variable function without derivative (for ex. math_BrentMinimum)
|
||||
class GCPnts_DistFunction : public math_Function
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT GCPnts_DistFunction(const Adaptor3d_Curve& theCurve,
|
||||
const Standard_Real U1, const Standard_Real U2);
|
||||
//
|
||||
Standard_EXPORT GCPnts_DistFunction(const GCPnts_DistFunction& theOther);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X,
|
||||
Standard_Real& F);
|
||||
private:
|
||||
GCPnts_DistFunction & operator = (const GCPnts_DistFunction & theOther);
|
||||
|
||||
const Adaptor3d_Curve& myCurve;
|
||||
gp_Lin myLin;
|
||||
Standard_Real myU1;
|
||||
Standard_Real myU2;
|
||||
};
|
||||
//
|
||||
//! The same as class GCPnts_DistFunction, but it can be used in minimization algorithms that
|
||||
//! requires multi variable function
|
||||
class GCPnts_DistFunctionMV : public math_MultipleVarFunction
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT GCPnts_DistFunctionMV(GCPnts_DistFunction& theCurvLinDist);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X,
|
||||
Standard_Real& F);
|
||||
|
||||
Standard_EXPORT virtual Standard_Integer NbVariables() const;
|
||||
|
||||
private:
|
||||
GCPnts_DistFunctionMV & operator = (const GCPnts_DistFunctionMV & theOther);
|
||||
GCPnts_DistFunction& myMaxCurvLinDist;
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
|
||||
#endif // _GCPnts_DistFunction_HeaderFile
|
76
src/GCPnts/GCPnts_DistFunction2d.cxx
Normal file
76
src/GCPnts/GCPnts_DistFunction2d.cxx
Normal file
@@ -0,0 +1,76 @@
|
||||
// Copyright (c) 2014-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GCPnts_DistFunction2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_DistFunction2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_DistFunction2d::GCPnts_DistFunction2d(const Adaptor2d_Curve2d& theCurve,
|
||||
const Standard_Real U1, const Standard_Real U2)
|
||||
: myCurve(theCurve),
|
||||
myU1(U1), myU2(U2)
|
||||
{
|
||||
gp_Pnt2d P2d1 = theCurve.Value(U1), P2d2 = theCurve.Value(U2);
|
||||
myLin = gp_Lin2d(P2d1, P2d2.XY() - P2d1.XY());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean GCPnts_DistFunction2d::Value (const Standard_Real X,
|
||||
Standard_Real& F)
|
||||
{
|
||||
if (X < myU1 || X > myU2)
|
||||
return Standard_False;
|
||||
//
|
||||
gp_Pnt2d aP2d = myCurve.Value(X);
|
||||
F = -myLin.SquareDistance(aP2d);
|
||||
return Standard_True;
|
||||
}
|
||||
//
|
||||
//=======================================================================
|
||||
//function : GCPnts_DistFunction2dMV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_DistFunction2dMV::GCPnts_DistFunction2dMV(GCPnts_DistFunction2d& theCurvLinDist)
|
||||
: myMaxCurvLinDist(theCurvLinDist)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GCPnts_DistFunction2dMV::Value (const math_Vector& X,
|
||||
Standard_Real& F)
|
||||
{
|
||||
Standard_Boolean Ok = myMaxCurvLinDist.Value(X(1), F);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GCPnts_DistFunction2dMV::NbVariables() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
68
src/GCPnts/GCPnts_DistFunction2d.hxx
Normal file
68
src/GCPnts/GCPnts_DistFunction2d.hxx
Normal file
@@ -0,0 +1,68 @@
|
||||
// Copyright (c) 2014-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _GCPnts_DistFunction2d_HeaderFile
|
||||
#define _GCPnts_DistFunction2d_HeaderFile
|
||||
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <math_Function.hxx>
|
||||
#include <math_MultipleVarFunction.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
|
||||
class gp_Pnt2d;
|
||||
|
||||
//! Class to define function, which calculates square distance between point on curve
|
||||
//! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2)
|
||||
//! This function is used in any minimisation algorithm to define maximal deviation between curve and line,
|
||||
//! which required one variable function without derivative (for ex. math_BrentMinimum)
|
||||
class GCPnts_DistFunction2d : public math_Function
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT GCPnts_DistFunction2d(const Adaptor2d_Curve2d& theCurve,
|
||||
const Standard_Real U1, const Standard_Real U2);
|
||||
//
|
||||
Standard_EXPORT GCPnts_DistFunction2d(const GCPnts_DistFunction2d& theOther);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X,
|
||||
Standard_Real& F);
|
||||
private:
|
||||
GCPnts_DistFunction2d & operator = (const GCPnts_DistFunction2d & theOther);
|
||||
|
||||
const Adaptor2d_Curve2d& myCurve;
|
||||
gp_Lin2d myLin;
|
||||
Standard_Real myU1;
|
||||
Standard_Real myU2;
|
||||
};
|
||||
//
|
||||
//! The same as class GCPnts_DistFunction2d,
|
||||
//! but it can be used in minimization algorithms that
|
||||
//! requires multi variable function
|
||||
class GCPnts_DistFunction2dMV : public math_MultipleVarFunction
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT GCPnts_DistFunction2dMV(GCPnts_DistFunction2d& theCurvLinDist);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X,
|
||||
Standard_Real& F);
|
||||
|
||||
|
||||
Standard_EXPORT virtual Standard_Integer NbVariables() const;
|
||||
|
||||
private:
|
||||
GCPnts_DistFunction2dMV & operator = (const GCPnts_DistFunction2dMV & theOther);
|
||||
GCPnts_DistFunction2d& myMaxCurvLinDist;
|
||||
};
|
||||
//
|
||||
|
||||
|
||||
#endif // _GCPnts_DistFunction2d_HeaderFile
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user