mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7472882f0b |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -49,7 +49,6 @@ Release
|
||||
/*.m4
|
||||
/*.ac
|
||||
/*.sh
|
||||
/codeblocks.bat
|
||||
/custom.bat
|
||||
/autom4te.cache
|
||||
/build_configure
|
||||
|
@@ -294,10 +294,6 @@ 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}")
|
||||
|
||||
@@ -804,8 +800,6 @@ 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})
|
||||
|
||||
@@ -818,33 +812,10 @@ 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})
|
||||
|
@@ -5,104 +5,124 @@ if(FLAGS_ALREADY_INCLUDED)
|
||||
endif()
|
||||
set(FLAGS_ALREADY_INCLUDED 1)
|
||||
|
||||
# force option /fp:precise for Visual Studio projects.
|
||||
# this macro adds new flag to a cache variable is being connected with compiler
|
||||
macro (ADD_CONTENT_IF_IT_ABSENT USER_VARIABLE USER_CONTENT)
|
||||
|
||||
separate_arguments (USER_CONTENT)
|
||||
|
||||
foreach (CURRENT_USER_CONTENT ${USER_CONTENT})
|
||||
if (NOT "${CURRENT_USER_CONTENT}" STREQUAL "")
|
||||
set (HAS_CONTENT OFF)
|
||||
foreach (COMPILER_OPTION_SPECIFICATOR "/" "-") # there are two compiler option specificators / (msvc) and - (msvc and others)
|
||||
set (FULL_USER_CONTENT "${COMPILER_OPTION_SPECIFICATOR}${CURRENT_USER_CONTENT}")
|
||||
string (REGEX MATCH "${FULL_USER_CONTENT}" HAS_CURRENT_CONTENT "${${USER_VARIABLE}}")
|
||||
if (HAS_CURRENT_CONTENT)
|
||||
set (HAS_CONTENT ON)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT HAS_CONTENT)
|
||||
if (MSVC)
|
||||
set (FULL_USER_CONTENT "/${CURRENT_USER_CONTENT}")
|
||||
else()
|
||||
set (FULL_USER_CONTENT "-${CURRENT_USER_CONTENT}")
|
||||
endif()
|
||||
|
||||
message (STATUS "Info: ${FULL_USER_CONTENT} added to ${USER_VARIABLE}")
|
||||
get_property(USER_VARIABLE_DOCSTRING CACHE ${USER_VARIABLE} PROPERTY HELPSTRING)
|
||||
set (${USER_VARIABLE} "${${USER_VARIABLE}} ${FULL_USER_CONTENT}" CACHE STRING "${USER_VARIABLE_DOCSTRING}" FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# this macro replaces a specific flag with new one in a cache variable is being connected with compiler
|
||||
macro (REPLACE_CONTENT_IF_IT_IS USER_VARIABLE USER_CONTENT NEW_USER_CONTENT)
|
||||
foreach (COMPILER_OPTION_SPECIFICATOR "/" "-") # there are two compiler option specificators / (msvc) and - (msvc and others)
|
||||
set (FULL_USER_CONTENT "${COMPILER_OPTION_SPECIFICATOR}${USER_CONTENT}")
|
||||
string (REGEX MATCH "${FULL_USER_CONTENT}" HAS_CONTENT "${${USER_VARIABLE}}")
|
||||
if (HAS_CONTENT)
|
||||
if ("${NEW_USER_CONTENT}" STREQUAL "")
|
||||
message (STATUS "Info: ${FULL_USER_CONTENT} removed from ${USER_VARIABLE}")
|
||||
set (FULL_NEW_USER_CONTENT "${NEW_USER_CONTENT}")
|
||||
else()
|
||||
set (FULL_NEW_USER_CONTENT "${COMPILER_OPTION_SPECIFICATOR}${NEW_USER_CONTENT}")
|
||||
message (STATUS "Info: ${FULL_USER_CONTENT} replaced with ${FULL_NEW_USER_CONTENT} in ${USER_VARIABLE}")
|
||||
endif()
|
||||
|
||||
string (REGEX REPLACE "${FULL_USER_CONTENT}" "${FULL_NEW_USER_CONTENT}" ${USER_VARIABLE} "${${USER_VARIABLE}}")
|
||||
|
||||
get_property(USER_VARIABLE_DOCSTRING CACHE ${USER_VARIABLE} PROPERTY HELPSTRING)
|
||||
set (${USER_VARIABLE} "${${USER_VARIABLE}}" CACHE STRING "${USER_VARIABLE_DOCSTRING}" FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# force option -fp:precise for Visual Studio projects.
|
||||
#
|
||||
# Note that while this option is default for MSVC compiler, Visual Studio
|
||||
# project can be switched later to use Intel Compiler (ICC).
|
||||
# Enforcing -fp:precise ensures that in such case ICC will use correct
|
||||
# option instead of its default -fp:fast which is harmful for OCCT.
|
||||
if (MSVC)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "fp:precise")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS "fp:precise")
|
||||
endif()
|
||||
|
||||
# set compiler short name and choose SSE2 option for appropriate MSVC compilers
|
||||
# ONLY for 32-bit
|
||||
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if (MSVC80 OR MSVC90 OR MSVC10)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "arch:SSE2")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS "arch:SSE2")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions -fPIC")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "fPIC fexceptions")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS "fPIC fexceptions")
|
||||
|
||||
add_definitions(-DOCC_CONVERT_SIGNALS)
|
||||
endif()
|
||||
|
||||
# enable structured exceptions for MSVC
|
||||
string (REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
|
||||
if (ISFLAG)
|
||||
string (REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
elseif (MSVC)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "EHsc" "EHa")
|
||||
if (MSVC)
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "EHa")
|
||||
endif()
|
||||
|
||||
# remove _WINDOWS flag if it exists
|
||||
string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_CXX_FLAGS}")
|
||||
if (IS_WINDOWSFLAG)
|
||||
message (STATUS "Info: /D_WINDOWS has been removed from CMAKE_CXX_FLAGS")
|
||||
string (REGEX REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
# remove _WINDOWS, WIN32 flag if they are
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "D_WINDOWS" "")
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "DWIN32" "")
|
||||
|
||||
# remove WIN32 flag if it exists
|
||||
string (REGEX MATCH "/DWIN32" IS_WIN32FLAG "${CMAKE_CXX_FLAGS}")
|
||||
if (IS_WIN32FLAG)
|
||||
message (STATUS "Info: /DWIN32 has been removed from CMAKE_CXX_FLAGS")
|
||||
string (REGEX REPLACE "/DWIN32" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
# remove _WINDOWS flag if it exists
|
||||
string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_C_FLAGS}")
|
||||
if (IS_WINDOWSFLAG)
|
||||
message (STATUS "Info: /D_WINDOWS has been removed from CMAKE_C_FLAGS")
|
||||
string (REGEX REPLACE "/D_WINDOWS" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
|
||||
# remove WIN32 flag if it exists
|
||||
string (REGEX MATCH "/DWIN32" IS_WIN32FLAG "${CMAKE_C_FLAGS}")
|
||||
if (IS_WIN32FLAG)
|
||||
message (STATUS "Info: /DWIN32 has been removed from CMAKE_C_FLAGS")
|
||||
string (REGEX REPLACE "/DWIN32" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_C_FLAGS "D_WINDOWS" "")
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_C_FLAGS "DWIN32" "")
|
||||
|
||||
# remove DEBUG flag if it exists
|
||||
string (REGEX MATCH "-DDEBUG" IS_DEBUG_CXX "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
if (IS_DEBUG_CXX)
|
||||
message (STATUS "Info: -DDEBUG has been removed from CMAKE_CXX_FLAGS_DEBUG")
|
||||
string (REGEX REPLACE "-DDEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
endif()
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS_DEBUG "DDEBUG" "")
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_C_FLAGS_DEBUG "DDEBUG" "")
|
||||
|
||||
string (REGEX MATCH "-DDEBUG" IS_DEBUG_C "${CMAKE_C_FLAGS_DEBUG}")
|
||||
if (IS_DEBUG_C)
|
||||
message (STATUS "Info: -DDEBUG has been removed from CMAKE_C_FLAGS_DEBUG")
|
||||
string (REGEX REPLACE "-DDEBUG" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
endif()
|
||||
# enable parallel compilation on MSVC 9 and above
|
||||
|
||||
if (MSVC AND NOT MSVC70 AND NOT MSVC80)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "MP")
|
||||
endif()
|
||||
|
||||
# generate a single response file which enlist all of the object files
|
||||
SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
|
||||
# increase compiler warnings level (-W4 for MSVC, -Wextra for GCC)
|
||||
if (MSVC)
|
||||
if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||
string (REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||
endif()
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "W[0-3]" "")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "W4")
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "Wextra Wall")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (APPLE)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
elseif(NOT WIN32)
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
if(NOT WIN32)
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_SHARED_LINKER_FLAGS "lm")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -111,26 +131,25 @@ if(MINGW)
|
||||
# Set default release optimization option to O2 instead of O3, since in
|
||||
# some OCCT related examples, this gives significantly smaller binaries
|
||||
# at comparable performace with MinGW-w64.
|
||||
string (REGEX MATCH "-O3" IS_O3_CXX "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
if (IS_O3_CXX)
|
||||
string (REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||
endif()
|
||||
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS_RELEASE "O3" "O2")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS_RELEASE "O2")
|
||||
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "std=gnu++0x")
|
||||
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||
|
||||
# workaround bugs in mingw with vtable export
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_SHARED_LINKER_FLAGS "Wl,--export-all-symbols")
|
||||
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "std=c++0x")
|
||||
endif()
|
||||
|
||||
# Optimize size of binaries
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS_RELEASE "s")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS_RELEASE "s")
|
||||
endif()
|
||||
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS_RELEASE "DNo_Exception")
|
||||
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS_RELEASE "DNo_Exception")
|
||||
|
@@ -176,11 +176,6 @@ 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)
|
||||
@@ -235,21 +230,6 @@ 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_TBB)
|
||||
if (INSTALL_${PRODUCT_NAME})
|
||||
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 QUIET)
|
||||
find_package(TCL)
|
||||
|
||||
# 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 QUIET)
|
||||
find_package(TCL)
|
||||
|
||||
# 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
|
||||
|
||||
#
|
||||
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:"
|
||||
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::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
|
||||
@@ -384,10 +384,6 @@ 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
|
||||
@@ -469,8 +465,8 @@ if { "$tcl_platform(platform)" == "windows" } {
|
||||
|
||||
#
|
||||
grid .myFrame.myHxxChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 0
|
||||
grid .myFrame.myHxxChecks.myScutsCombo -row 0 -column 1
|
||||
grid .myFrame.myHxxChecks.myScutsCheck -row 0 -column 0
|
||||
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 1
|
||||
incr aRowIter
|
||||
#
|
||||
grid .myFrame.mySrchLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
@@ -487,10 +483,6 @@ 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,12 +41,11 @@ if { "$tcl_platform(platform)" == "unix" } {
|
||||
set VCVARS ""
|
||||
}
|
||||
|
||||
set SHORTCUT_HEADERS "ShortCut"
|
||||
set SHORTCUT_HEADERS "true"
|
||||
|
||||
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"
|
||||
@@ -73,9 +72,6 @@ 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)"
|
||||
@@ -86,9 +82,6 @@ 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)"
|
||||
}
|
||||
@@ -956,7 +949,6 @@ 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,27 +639,16 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
}
|
||||
}
|
||||
}
|
||||
set anUsedToolKits [lsort -unique $anUsedToolKits]
|
||||
lsort -unique $anUsedToolKits
|
||||
|
||||
set anUnits {}
|
||||
foreach anUsedToolKit $anUsedToolKits {
|
||||
set anUnits [concat $anUnits [osutils:tk:units $anUsedToolKit]]
|
||||
}
|
||||
set anUnits [lsort -unique $anUnits]
|
||||
lsort -unique $anUnits
|
||||
|
||||
# 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" } {
|
||||
if { [info exists ::env(SHORTCUT_HEADERS)] &&
|
||||
$::env(SHORTCUT_HEADERS) == "true" } {
|
||||
# template preparation
|
||||
if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
|
||||
puts "template file does not exist: $::THE_CASROOT/adm/templates/header.in"
|
||||
@@ -694,7 +683,6 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
continue
|
||||
}
|
||||
}
|
||||
file delete -force "$theIncPath/$aHeaderFileName"
|
||||
}
|
||||
|
||||
set aShortCutHeaderFile [open "$theIncPath/$aHeaderFileName" "w"]
|
||||
@@ -702,7 +690,7 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
puts $aShortCutHeaderFile $aShortCutHeaderFileContent
|
||||
close $aShortCutHeaderFile
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set nbcopied 0
|
||||
foreach anUnit $anUnits {
|
||||
@@ -712,20 +700,14 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
|
||||
# copy file only if target does not exist or is older than original
|
||||
set torig [file mtime $aHeaderFile]
|
||||
set tcopy 0
|
||||
if { [file isfile $anIncPath/$aHeaderFileName] } {
|
||||
if { ! [file isfile $anIncPath/$aHeaderFileName] } {
|
||||
set tcopy 0
|
||||
} else {
|
||||
set tcopy [file mtime $anIncPath/$aHeaderFileName]
|
||||
}
|
||||
if { $tcopy < $torig } {
|
||||
incr nbcopied
|
||||
if { $aCopyType == "hardlink" } {
|
||||
if { $tcopy != 0 } {
|
||||
file delete -force "$theIncPath/$aHeaderFileName"
|
||||
}
|
||||
file link -hard $anIncPath/$aHeaderFileName $aHeaderFile
|
||||
} else {
|
||||
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
|
||||
}
|
||||
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
|
||||
} elseif { $tcopy != $torig } {
|
||||
puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aHeaderFile, not changed!"
|
||||
}
|
||||
@@ -2154,9 +2136,6 @@ 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>"
|
||||
@@ -2204,9 +2183,6 @@ 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>"
|
||||
|
@@ -1,14 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 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,12 +64,6 @@ 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 ()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 157 KiB |
Binary file not shown.
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 48 KiB |
@@ -20,10 +20,7 @@ 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 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.
|
||||
* 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*.
|
||||
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
|
||||
~~~~~
|
||||
export HAVE_GL2PS=false
|
||||
|
@@ -30,16 +30,13 @@ 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* -- 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.
|
||||
* *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*.
|
||||
|
||||
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*)
|
||||
* Method to populate folder *inc* (short-cuts by default).
|
||||
* Option to use short-cuts to header files in folder *inc* (enabled 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,10 +21,7 @@ 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 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.
|
||||
* 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*.
|
||||
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
|
||||
~~~~~
|
||||
export HAVE_GL2PS=false
|
||||
|
@@ -247,10 +247,6 @@ 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
|
||||
|
||||
@@ -976,18 +972,8 @@ 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 upgrade_occt700_correction_of_texture Correction of texture mapping of objects
|
||||
@subsection 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.
|
@@ -310,8 +310,14 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
if (myDrawer->IsAutoTriangulation())
|
||||
{
|
||||
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
|
||||
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);
|
||||
}
|
||||
// After this call if type of deflection is relative
|
||||
// computed deflection coefficient is stored as absolute.
|
||||
Standard_Boolean wasRecomputed = StdPrs_ToolTriangulatedShape::Tessellate (myshape, myDrawer);
|
||||
@@ -325,8 +331,6 @@ 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;
|
||||
}
|
||||
|
||||
// Mark the presentation modes hidden of interactive object different from aDispMode.
|
||||
// Erase presentations for all display modes 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->SetVisibility (theIObj, anOldMode, Standard_False);
|
||||
myMainPM->Erase (theIObj, anOldMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -349,10 +349,10 @@ public:
|
||||
Standard_Boolean HasWidth() const;
|
||||
|
||||
//! Returns the width setting of the Interactive Object.
|
||||
Standard_Real Width() const;
|
||||
Standard_EXPORT Standard_Real Width() const;
|
||||
|
||||
//! Returns true if the Interactive Object has a setting for material.
|
||||
Standard_Boolean HasMaterial() const;
|
||||
Standard_EXPORT 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.
|
||||
virtual Graphic3d_NameOfMaterial Material() const;
|
||||
Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const;
|
||||
|
||||
//! Sets the name aName for material defining this
|
||||
//! display attribute for the interactive object.
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,670 +0,0 @@
|
||||
// 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
|
@@ -1,28 +0,0 @@
|
||||
// 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
|
@@ -1,94 +0,0 @@
|
||||
// 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);
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
// 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
|
@@ -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 theMode)
|
||||
const Standard_Integer aMode)
|
||||
{
|
||||
aPrs->Clear();
|
||||
if(myshape.IsNull()) return;
|
||||
@@ -144,14 +144,13 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
|
||||
if (IsInfinite())
|
||||
{
|
||||
aPrs->SetInfiniteState (Standard_True); //not taken in account during FITALL
|
||||
aPrs->SetInfiniteState (Standard_True); //not taken in account duting FITALL
|
||||
}
|
||||
|
||||
switch (theMode)
|
||||
switch (aMode)
|
||||
{
|
||||
case AIS_WireFrame:
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
@@ -170,7 +169,18 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
}
|
||||
case AIS_Shaded:
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if ((Standard_Integer) myshape.ShapeType() > 4)
|
||||
{
|
||||
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
|
||||
|
@@ -440,14 +440,28 @@ 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
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (myshape.ShapeType() > TopAbs_FACE)
|
||||
{
|
||||
StdPrs_WFShape::Add (thePrs, myshape, myDrawer);
|
||||
|
@@ -99,11 +99,6 @@ 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,10 +49,6 @@ 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,10 +51,6 @@ 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,19 +846,16 @@ 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,10 +61,6 @@ 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,26 +42,92 @@
|
||||
#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 : Used in same parameterization curve approximation.
|
||||
//class : Approx_SameParameter_Evaluator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
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;
|
||||
@@ -69,183 +135,166 @@ 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)
|
||||
{
|
||||
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.
|
||||
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
|
||||
//
|
||||
BSplCLib::Eval(*Parameter,
|
||||
Standard_False,
|
||||
*DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
aDegree,
|
||||
FlatKnots,
|
||||
1,
|
||||
PolesArray[0],
|
||||
eval_result[0]);
|
||||
Standard_False,
|
||||
*DerivativeRequest,
|
||||
extrap_mode[0],
|
||||
3,
|
||||
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]);
|
||||
}
|
||||
|
||||
ReturnCode[0] = 0;
|
||||
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 ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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_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)
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
const Standard_Integer nbp)
|
||||
{
|
||||
Standard_Real d2 = 0.0; // Square max discrete deviation.
|
||||
Standard_Real d2 = 0.;
|
||||
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.0 - t) + last * t;
|
||||
for(Standard_Integer i = 0; i <= nbp; i++){
|
||||
Standard_Real t = IntToReal(i)/IntToReal(nbp);
|
||||
Standard_Real u = first*(1.-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;
|
||||
}
|
||||
d2 = Max(d2, Pc3d.SquareDistance(Pcons));
|
||||
Standard_Real temp = Pc3d.SquareDistance(Pcons);
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
|
||||
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;
|
||||
d2 = 1.5*sqrt(d2);
|
||||
if(d2<1.e-7) d2 = 1.e-7;
|
||||
return d2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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& ,
|
||||
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& pcons,
|
||||
const TColStd_Array1OfReal& ,
|
||||
const Handle(Adaptor3d_HCurve)& c3d,
|
||||
const Adaptor3d_CurveOnSurface& cons,
|
||||
Standard_Real& tol,
|
||||
const Standard_Real oldtol)
|
||||
{
|
||||
const Standard_Integer aDegree = 3;
|
||||
Standard_Integer extrap_mode[2] = {aDegree, aDegree};
|
||||
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
|
||||
|
||||
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 (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.
|
||||
if (firstborne < FirstPar)
|
||||
firstborne = FirstPar;
|
||||
if (lastborne > LastPar)
|
||||
lastborne = LastPar;
|
||||
/////
|
||||
for(i = 0; i <= nn; i++){
|
||||
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],
|
||||
aDegree,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
if (tcons < aParamFirst ||
|
||||
tcons > aParamLast)
|
||||
{
|
||||
tol = Precision::Infinite();
|
||||
3,FlatKnots,1, (Standard_Real&)Poles(1),tcons);
|
||||
if (tcons < firstborne || tcons > lastborne) {
|
||||
tol=Precision::Infinite();
|
||||
return Standard_False;
|
||||
}
|
||||
gp_Pnt Pcons = cons.Value(tcons);
|
||||
@@ -253,30 +302,24 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
|
||||
if(temp > d2) d2 = temp;
|
||||
}
|
||||
tol = sqrt(d2);
|
||||
|
||||
// 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);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Voir)
|
||||
cout<<"distance max on "<<nn<<" points : "<<tol<<endl<<endl;
|
||||
#endif
|
||||
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);
|
||||
@@ -284,16 +327,17 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Geom_Curve)& C3D,
|
||||
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;
|
||||
@@ -301,16 +345,17 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D
|
||||
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;
|
||||
@@ -318,6 +363,7 @@ Approx_SameParameter::Approx_SameParameter(const Handle(Adaptor3d_HCurve)& C3D
|
||||
Build(Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//purpose :
|
||||
@@ -335,6 +381,10 @@ 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.
|
||||
@@ -342,38 +392,46 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
gp_Pnt Pcons,Pc3d;
|
||||
gp_Vec Vcons,Vc3d;
|
||||
|
||||
const Standard_Real Tol = Tolerance;
|
||||
const Standard_Real Tol2 = Tol * Tol;
|
||||
Standard_Real deltamin = Precision::PConfusion();
|
||||
Standard_Real Tol = Tolerance;
|
||||
Standard_Real Tol2 = Tol * Tol;
|
||||
Standard_Real deltamin = Precision::PConfusion();//50*Tolp;
|
||||
|
||||
Standard_Real besttol2 = Tol2;
|
||||
Standard_Boolean extrok = 0;
|
||||
|
||||
// Check tangency on curve border.
|
||||
Standard_Boolean extrok = 1;
|
||||
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);
|
||||
|
||||
dmax2 = Max(dmax2, dist2);
|
||||
if(dist2 > dmax2) 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
|
||||
@@ -387,7 +445,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;
|
||||
|
||||
@@ -400,12 +458,8 @@ 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;
|
||||
GeomAbs_Shape Continuity = myHCurve2d->Continuity();
|
||||
if(Continuity > GeomAbs_C1) Continuity = GeomAbs_C1;
|
||||
if(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);
|
||||
@@ -448,12 +502,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;
|
||||
Standard_Real previousp = fc3d, initp=0, curp;//, deltamin = 50*Tolp;
|
||||
Standard_Real bornesup = lc3d - deltamin;
|
||||
Standard_Boolean projok = 0,
|
||||
use_parameter ;
|
||||
@@ -542,6 +596,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
{
|
||||
//Projector
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -553,9 +608,7 @@ 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;
|
||||
@@ -566,11 +619,30 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons[count] = lcons;
|
||||
pc3d[count] = lc3d;
|
||||
|
||||
// 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.
|
||||
#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
|
||||
|
||||
Standard_Boolean hasCountChanged = Standard_False;
|
||||
do
|
||||
|
||||
while(!interpolok)
|
||||
{
|
||||
// The tables and their limits for the interpolation.
|
||||
Standard_Integer num_knots = count + 7;
|
||||
@@ -607,6 +679,53 @@ 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
|
||||
|
||||
@@ -653,6 +772,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -670,19 +790,14 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
pcons = newpcons;
|
||||
newpcons = temp;
|
||||
|
||||
if((count != newcount) && newcount < aMaxArraySize)
|
||||
{
|
||||
hasCountChanged = Standard_True;
|
||||
count = newcount;
|
||||
continue;
|
||||
}
|
||||
if((count != newcount) && newcount < aMaxArraySize) { 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;
|
||||
@@ -694,12 +809,17 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
tolsov = algtol;
|
||||
|
||||
interpolok = (interpolok || // Good result.
|
||||
count >= aMaxArraySize - 1 ); // Number of points.
|
||||
interpolok = (interpolok || count >= aMaxArraySize);
|
||||
|
||||
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));
|
||||
@@ -720,7 +840,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
|
||||
if(myTolReached > anErrorMAX)
|
||||
{
|
||||
//This tolerance is too big. Probably, we will not be able to get
|
||||
//This tolerance is too big. Probably, we will not can get
|
||||
//edge with sameparameter in this case.
|
||||
|
||||
myDone = Standard_False;
|
||||
@@ -733,7 +853,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
//(else we can have circularity)
|
||||
{
|
||||
myCurve2d = aC2d;
|
||||
myHCurve2d = aHCurve2d;
|
||||
myHCurve2d = new Geom2dAdaptor_HCurve(myCurve2d);
|
||||
myDone = Standard_True;
|
||||
}
|
||||
else
|
||||
@@ -746,6 +866,10 @@ 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++){
|
||||
@@ -778,6 +902,7 @@ void Approx_SameParameter::Build(const Standard_Real Tolerance)
|
||||
}
|
||||
else {
|
||||
#ifdef OCCT_DEBUG
|
||||
// JAG
|
||||
cout << "Projection not done" << endl;
|
||||
#endif
|
||||
}
|
||||
@@ -802,82 +927,5 @@ 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;
|
||||
}
|
||||
}
|
||||
|
@@ -63,9 +63,17 @@
|
||||
#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,
|
||||
@@ -107,25 +115,6 @@ 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:
|
||||
@@ -1536,8 +1525,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]);
|
||||
}
|
||||
@@ -1570,38 +1559,28 @@ void BOPTools_AlgoTools::MakeVertex(const BOPCol_ListOfShape& aLV,
|
||||
return;
|
||||
}// else if (aNb==2) {
|
||||
//
|
||||
else { // if (aNb>2)
|
||||
// compute the point
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
gp_Pnt aP(aXYZ);
|
||||
//
|
||||
// compute the tolerance for the new vertex
|
||||
else { // if (aNb>2)
|
||||
Standard_Real aTi, aDi, aDmax;
|
||||
gp_Pnt aPi, aP;
|
||||
gp_XYZ aXYZ(0.,0.,0.), aXYZi;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
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;
|
||||
}
|
||||
//
|
||||
aXYZ.Divide((Standard_Real)aNb);
|
||||
aP.SetXYZ(aXYZ);
|
||||
//
|
||||
aDmax=-1.;
|
||||
aIt.Initialize(aLV);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Vertex& aVi=*((TopoDS_Vertex*)(&aIt.Value()));
|
||||
gp_Pnt aPi=BRep_Tool::Pnt(aVi);
|
||||
aPi=BRep_Tool::Pnt(aVi);
|
||||
aTi=BRep_Tool::Tolerance(aVi);
|
||||
aDi=aP.SquareDistance(aPi);
|
||||
aDi=sqrt(aDi);
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_MapOfOrientedShape.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepAlgo_AsDes,MMgt_TShared)
|
||||
|
||||
@@ -150,18 +149,12 @@ 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();
|
||||
if (aMS.Add(NewS.Oriented(O))) {
|
||||
L.InsertBefore(NewS.Oriented(O),it);
|
||||
}
|
||||
L.InsertBefore(NewS.Oriented(O),it);
|
||||
L.Remove(it);
|
||||
}
|
||||
else it.Next();
|
||||
@@ -242,52 +235,34 @@ 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)
|
||||
{
|
||||
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);
|
||||
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));
|
||||
}
|
||||
else {
|
||||
// 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.Bind(NewS,up(OldS));
|
||||
}
|
||||
//
|
||||
aMap.UnBind(OldS);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
void SetDeflection(const Standard_Real theDeflection)
|
||||
Standard_EXPORT 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_Boolean IsDone() const
|
||||
Standard_EXPORT Standard_Boolean IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
//! Returns the number of solutions satisfying the minimum distance. <br>
|
||||
Standard_Integer NbSolution() const
|
||||
Standard_EXPORT 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_Boolean InnerSolution() const
|
||||
Standard_EXPORT Standard_Boolean InnerSolution() const
|
||||
{
|
||||
return myInnerSol;
|
||||
}
|
||||
//! Returns the Point corresponding to the <N>th solution on the first Shape <br>
|
||||
const gp_Pnt & PointOnShape1(const Standard_Integer N) const
|
||||
Standard_EXPORT 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>
|
||||
const gp_Pnt & PointOnShape2(const Standard_Integer N) const
|
||||
Standard_EXPORT 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>
|
||||
BRepExtrema_SupportType SupportTypeShape1(const Standard_Integer N) const
|
||||
Standard_EXPORT 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>
|
||||
BRepExtrema_SupportType SupportTypeShape2(const Standard_Integer N) const
|
||||
Standard_EXPORT 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;
|
||||
|
||||
void SetFlag(const Extrema_ExtFlag F)
|
||||
Standard_EXPORT void SetFlag(const Extrema_ExtFlag F)
|
||||
{
|
||||
myFlag = F;
|
||||
}
|
||||
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myAlgo = A;
|
||||
}
|
||||
|
@@ -25,8 +25,6 @@
|
||||
#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;
|
||||
@@ -62,12 +60,7 @@ public:
|
||||
BRepFeat_SplitShape();
|
||||
|
||||
//! Creates the process with the 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);
|
||||
BRepFeat_SplitShape(const TopoDS_Shape& S);
|
||||
|
||||
//! Initializes the process on the shape <S>.
|
||||
void Init (const TopoDS_Shape& S);
|
||||
|
@@ -38,14 +38,6 @@ 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;
|
||||
}
|
||||
@@ -2006,17 +2006,18 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh,
|
||||
TopTools_ListOfShape& LF)
|
||||
{
|
||||
LF.Clear();
|
||||
// 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());
|
||||
TopTools_ListOfShape LTri,LPlan,LCyl,LCon,LSphere,LTor,LOther;
|
||||
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());
|
||||
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F, l);
|
||||
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,16 +56,8 @@ class BRepMesh_VertexTool;
|
||||
|
||||
namespace BRepMesh
|
||||
{
|
||||
//! 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
|
||||
//! Default size for memory block allocated by IncAllocator.
|
||||
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.
|
||||
BRepMesh_CircleInspector(
|
||||
Standard_EXPORT 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.
|
||||
static Standard_Boolean IsEqual(
|
||||
Standard_EXPORT static Standard_Boolean IsEqual(
|
||||
const Standard_Integer theIndex,
|
||||
const Standard_Integer theTargetIndex)
|
||||
{
|
||||
|
@@ -35,8 +35,7 @@ BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(
|
||||
const Handle(NCollection_IncAllocator)& theAllocator,
|
||||
const Standard_Integer theReservedNodeSize)
|
||||
: myAllocator (theAllocator),
|
||||
myNodes (new BRepMesh_VertexTool(myAllocator)),
|
||||
myNodeLinks (theReservedNodeSize * 3, myAllocator),
|
||||
myNodes (new BRepMesh_VertexTool(theReservedNodeSize, 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_Integer IndexOf(const BRepMesh_Vertex& theNode)
|
||||
Standard_EXPORT 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.
|
||||
void RemoveNode(const Standard_Integer theIndex,
|
||||
const Standard_Boolean isForce = Standard_False)
|
||||
Standard_EXPORT 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_Integer IndexOf(const BRepMesh_Edge& theLink) const
|
||||
Standard_EXPORT 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.
|
||||
const BRepMesh_Edge& GetLink(const Standard_Integer theIndex)
|
||||
Standard_EXPORT 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.
|
||||
const BRepMesh_PairOfIndex& ElementsConnectedTo(
|
||||
Standard_EXPORT 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_Integer IndexOf(const BRepMesh_Triangle& theElement) const
|
||||
Standard_EXPORT 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.
|
||||
const BRepMesh_Triangle& GetElement(const Standard_Integer theIndex)
|
||||
Standard_EXPORT 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.
|
||||
void ClearDeleted()
|
||||
Standard_EXPORT void ClearDeleted()
|
||||
{
|
||||
clearDeletedLinks();
|
||||
clearDeletedNodes();
|
||||
|
@@ -429,6 +429,8 @@ 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;
|
||||
@@ -440,8 +442,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 );
|
||||
@@ -596,7 +598,6 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
|
||||
for(;;)
|
||||
{
|
||||
aAllocator->Reset(Standard_False);
|
||||
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
|
||||
|
||||
@@ -678,6 +679,7 @@ void BRepMesh_Delaun::cleanupMesh()
|
||||
myMeshData->RemoveLink( aLoopEdgesIt.Key() );
|
||||
}
|
||||
|
||||
aAllocator->Reset(Standard_False);
|
||||
if ( aDeletedTrianglesNb == 0 )
|
||||
break;
|
||||
}
|
||||
@@ -2171,8 +2173,7 @@ Standard_Boolean BRepMesh_Delaun::UseEdge( const Standard_Integer /*theIndex*/ )
|
||||
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
|
||||
const BRepMesh_DegreeOfFreedom theEdgeType ) const
|
||||
{
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
|
||||
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger;
|
||||
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
|
||||
|
||||
for ( ; anEdgeIt.More(); anEdgeIt.Next() )
|
||||
|
@@ -26,14 +26,14 @@ class BRepMesh_Edge : public BRepMesh_OrientedEdge
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
BRepMesh_Edge()
|
||||
Standard_EXPORT BRepMesh_Edge()
|
||||
: BRepMesh_OrientedEdge(),
|
||||
myMovability(BRepMesh_Deleted)
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructs a link between two vertices.
|
||||
BRepMesh_Edge(
|
||||
Standard_EXPORT BRepMesh_Edge(
|
||||
const Standard_Integer theFirstNode,
|
||||
const Standard_Integer theLastNode,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute,Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
@@ -140,12 +141,14 @@ void BRepMesh_FaceAttribute::init()
|
||||
// between vertices
|
||||
|
||||
myMinStep = RealLast();
|
||||
for (TopoDS_Iterator aFaceIt(myFace); aFaceIt.More(); aFaceIt.Next())
|
||||
for (TopExp_Explorer anExp(myFace, TopAbs_WIRE); anExp.More(); anExp.Next())
|
||||
{
|
||||
for (TopoDS_Iterator aWireIt(aFaceIt.Value()); aWireIt.More(); aWireIt.Next())
|
||||
TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
|
||||
|
||||
for (TopoDS_Iterator aWireExp(aWire); aWireExp.More(); aWireExp.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aWireIt.Value());
|
||||
if (anEdge.IsNull() || BRep_Tool::IsClosed(anEdge))
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aWireExp.Value());
|
||||
if (BRep_Tool::IsClosed(anEdge))
|
||||
continue;
|
||||
|
||||
// Get end points on 2d curve
|
||||
|
@@ -47,7 +47,6 @@
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfCharacter.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColGeom2d_SequenceOfCurve.hxx>
|
||||
@@ -83,7 +82,6 @@ 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),
|
||||
@@ -197,7 +195,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
|
||||
resetDataStructure();
|
||||
|
||||
Standard_Real defedge = myParameters.Deflection;
|
||||
Standard_Real defedge;
|
||||
Standard_Integer nbEdge = 0;
|
||||
Standard_Real savangle = myParameters.Angle;
|
||||
Standard_Real cdef;
|
||||
@@ -207,14 +205,18 @@ 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();
|
||||
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
TopExp_Explorer aWireIt(aFace, TopAbs_WIRE);
|
||||
for (; aWireIt.More(); aWireIt.Next())
|
||||
{
|
||||
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
TopExp_Explorer aEdgeIt(aWireIt.Current(), TopAbs_EDGE);
|
||||
for (; aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
|
||||
{
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Value());
|
||||
if (aEdge.IsNull())
|
||||
continue;
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
|
||||
if (!myMapdefle.IsBound(aEdge))
|
||||
{
|
||||
if (myParameters.Relative)
|
||||
@@ -263,6 +265,8 @@ 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;
|
||||
@@ -289,7 +293,6 @@ 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() )
|
||||
{
|
||||
@@ -398,29 +401,16 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
|
||||
++nbmaill;
|
||||
|
||||
resetDataStructure();
|
||||
|
||||
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
|
||||
for (Standard_Integer j = 1; j <= aFaceEdges.Length(); ++j)
|
||||
{
|
||||
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);
|
||||
const TopoDS_Edge& anEdge = aFaceEdges(j);
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
add(anEdge, aPCurves(j), defedge);
|
||||
}
|
||||
|
||||
aDFaceChecker.ReCompute(aClassifier);
|
||||
@@ -816,13 +806,18 @@ void BRepMesh_FastDiscret::update(
|
||||
Handle(Poly_PolygonOnTriangulation) P1, P2;
|
||||
if (BRepMesh_ShapeTool::IsDegenerated(theEdge, aFace))
|
||||
{
|
||||
// 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);
|
||||
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;
|
||||
|
||||
P1 = new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
|
||||
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
|
||||
@@ -830,15 +825,9 @@ void BRepMesh_FastDiscret::update(
|
||||
else
|
||||
{
|
||||
const Standard_Integer aNodesNb = aEdgeTool->NbPoints();
|
||||
// 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);
|
||||
TColStd_Array1OfInteger aNewNodesVec (1, aNodesNb);
|
||||
TColStd_Array1OfInteger aNewNodesInStructVec(1, aNodesNb);
|
||||
TColStd_Array1OfReal aNewParamsVec (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(1, aAllocator);
|
||||
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger(1, aAllocator);
|
||||
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt;
|
||||
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger;
|
||||
|
||||
// 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(aAllocator);
|
||||
myVParam.Clear(aAllocator);
|
||||
myUParam.Clear();
|
||||
myVParam.Clear();
|
||||
|
||||
// essai de determination de la longueur vraie:
|
||||
// akm (bug OCC16) : We must calculate these measures in non-singular
|
||||
@@ -393,8 +393,7 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
|
||||
Standard_Real aDef = -1;
|
||||
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
|
||||
{
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::ListOfVertex aNewVertices(anAlloc);
|
||||
BRepMesh::ListOfVertex aNewVertices;
|
||||
if (!rajout)
|
||||
{
|
||||
aDef = control(aNewVertices, trigu, Standard_True);
|
||||
@@ -464,6 +463,8 @@ 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);
|
||||
@@ -474,26 +475,37 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
std::sort (aParamArray.begin(), aParamArray.end());
|
||||
|
||||
// mandatory pre-filtering using the first (minimal) filter value
|
||||
Standard_Integer aParamLength = 1;
|
||||
Standard_Real aP1, aP2;
|
||||
aP1 = aParamArray(1);
|
||||
aParamTmp.Append(aP1);
|
||||
for (j = 2; j <= anInitLen; j++)
|
||||
{
|
||||
if ((aParamArray(j)-aParamArray(aParamLength)) > theMinDist)
|
||||
aP2 = aParamArray(j);
|
||||
if ((aP2-aP1) > theMinDist)
|
||||
{
|
||||
if (++aParamLength < j)
|
||||
aParamArray(aParamLength) = aParamArray(j);
|
||||
aParamTmp.Append(aP2);
|
||||
aP1 = aP2;
|
||||
aParamLength++;
|
||||
}
|
||||
}
|
||||
|
||||
//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 = aParamArray(1);
|
||||
aLastAdded = aParamTmp.First();
|
||||
aLastCandidate = aLastAdded;
|
||||
theResult.Append(aLastAdded);
|
||||
theResult.Append(aParamTmp.First());
|
||||
|
||||
for(j=2; j < aParamLength; j++)
|
||||
for(j=2;j<aParamTmp.Length();j++)
|
||||
{
|
||||
Standard_Real aVal = aParamArray(j);
|
||||
Standard_Real aVal = aParamTmp.Value(j);
|
||||
if(aVal-aLastAdded > theFilterDist)
|
||||
{
|
||||
//adds the parameter
|
||||
@@ -513,7 +525,7 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
|
||||
aLastCandidate = aVal;
|
||||
isCandidateDefined = Standard_True;
|
||||
}
|
||||
theResult.Append(aParamArray(aParamLength));
|
||||
theResult.Append(aParamTmp.Last());
|
||||
}
|
||||
|
||||
void BRepMesh_FastDiscretFace::insertInternalVertices(
|
||||
@@ -605,29 +617,19 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesCylinder(
|
||||
gp_Cylinder aCylinder = myAttribute->Surface()->Cylinder();
|
||||
const Standard_Real aRadius = aCylinder.Radius();
|
||||
|
||||
Standard_Integer nbU = 0;
|
||||
Standard_Integer nbV = 0;
|
||||
// Calculate parameters for iteration in U direction
|
||||
Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep(
|
||||
aRadius, myAttribute->GetDefFace(), myAngle, myMinSize);
|
||||
|
||||
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;
|
||||
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_Integer nbV = (Standard_Integer)(nbU*sv / (su*aRadius));
|
||||
nbV = Min(nbV, 100 * nbU);
|
||||
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)
|
||||
@@ -830,9 +832,7 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
||||
const Standard_Real aDefFace = myAttribute->GetDefFace();
|
||||
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
|
||||
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
BRepMesh::SequenceOfReal aParams[2] = { BRepMesh::SequenceOfReal(anAlloc),
|
||||
BRepMesh::SequenceOfReal(anAlloc) };
|
||||
BRepMesh::SequenceOfReal aParams[2];
|
||||
for (Standard_Integer i = 0; i < 2; ++i)
|
||||
{
|
||||
Standard_Boolean isU = (i == 0);
|
||||
@@ -858,10 +858,8 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
|
||||
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
|
||||
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
|
||||
|
||||
BRepMesh::MapOfReal aParamsToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||
BRepMesh::MapOfReal(1, anAlloc) };
|
||||
BRepMesh::MapOfReal aParamsForbiddenToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
|
||||
BRepMesh::MapOfReal(1, anAlloc) };
|
||||
BRepMesh::MapOfReal aParamsToRemove[2];
|
||||
BRepMesh::MapOfReal aParamsForbiddenToRemove[2];
|
||||
|
||||
// precision for compare square distances
|
||||
const Standard_Real aPrecision = Precision::Confusion();
|
||||
@@ -1035,8 +1033,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
||||
const Standard_Real theFaceDeflection,
|
||||
const BRepMesh_CircleTool& theCircleTool,
|
||||
BRepMesh::ListOfVertex& theVertices,
|
||||
Standard_Real& theMaxTriangleDeflection,
|
||||
const Handle(NCollection_IncAllocator)& theTempAlloc)
|
||||
Standard_Real& theMaxTriangleDeflection)
|
||||
{
|
||||
if (theTriangleDeflection > theMaxTriangleDeflection)
|
||||
theMaxTriangleDeflection = theTriangleDeflection;
|
||||
@@ -1051,7 +1048,9 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
|
||||
const_cast<BRepMesh_CircleTool&>(theCircleTool).Select(
|
||||
myAttribute->Scale(theUV, Standard_True));
|
||||
|
||||
BRepMesh::MapOfInteger aUsedNodes(10, theTempAlloc);
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
|
||||
BRepMesh::MapOfInteger aUsedNodes(10, aAllocator);
|
||||
BRepMesh::ListOfInteger::Iterator aCircleIt(aCirclesList);
|
||||
for (; aCircleIt.More(); aCircleIt.Next())
|
||||
{
|
||||
@@ -1109,11 +1108,9 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
|
||||
aBSpline = gFace->ChangeSurface ().Surface().Surface();
|
||||
|
||||
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);
|
||||
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap;
|
||||
BRepMesh::MapOfIntegerInteger aStatMap;
|
||||
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb);
|
||||
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
|
||||
|
||||
// Perform refinement passes
|
||||
@@ -1124,11 +1121,8 @@ 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
|
||||
@@ -1204,7 +1198,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
aSqDef *= aSqDef;
|
||||
|
||||
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
||||
|
||||
if (isSkipped)
|
||||
break;
|
||||
@@ -1238,7 +1232,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
|
||||
aSqDef = aLin.SquareDistance(pDef);
|
||||
|
||||
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
|
||||
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1405,8 +1399,6 @@ 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,8 +174,7 @@ private:
|
||||
const Standard_Real theFaceDeflection,
|
||||
const BRepMesh_CircleTool& theCircleTool,
|
||||
BRepMesh::ListOfVertex& theVertices,
|
||||
Standard_Real& theMaxTriangleDeflection,
|
||||
const Handle(NCollection_IncAllocator)& theTempAlloc);
|
||||
Standard_Real& theMaxTriangleDeflection);
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -48,7 +48,6 @@
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_MapOfTransient.hxx>
|
||||
#include <TopTools_HArray1OfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
@@ -126,11 +125,8 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::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);
|
||||
myEdges.Clear();
|
||||
myEdgeDeflection.Clear();
|
||||
myFaces.Clear();
|
||||
myMesh.Nullify();
|
||||
}
|
||||
@@ -150,19 +146,16 @@ void BRepMesh_IncrementalMesh::init()
|
||||
collectFaces();
|
||||
|
||||
Bnd_Box aBox;
|
||||
if ( myParameters.Relative )
|
||||
BRepBndLib::Add(myShape, aBox, Standard_False);
|
||||
|
||||
if (aBox.IsVoid())
|
||||
{
|
||||
BRepBndLib::Add(myShape, aBox, Standard_False);
|
||||
|
||||
if (aBox.IsVoid())
|
||||
{
|
||||
// Nothing to mesh.
|
||||
return;
|
||||
}
|
||||
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||
// Nothing to mesh.
|
||||
return;
|
||||
}
|
||||
|
||||
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
|
||||
|
||||
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
|
||||
|
||||
myMesh->InitSharedFaces(myShape);
|
||||
@@ -174,21 +167,22 @@ void BRepMesh_IncrementalMesh::init()
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::collectFaces()
|
||||
{
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
TopTools_ListOfShape aFaceList(anAlloc);
|
||||
TopTools_ListOfShape aFaceList;
|
||||
BRepLib::ReverseSortFaces(myShape, aFaceList);
|
||||
TColStd_MapOfTransient aTFaceMap(1, anAlloc);
|
||||
TopTools_MapOfShape aFaceMap;
|
||||
|
||||
// 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())
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face(aFaceIter.Value());
|
||||
const Handle(TopoDS_TShape)& aTFace = aFace.TShape();
|
||||
if (!aTFaceMap.Add (aTFace))
|
||||
TopoDS_Shape aFaceNoLoc = aFaceIter.Value();
|
||||
aFaceNoLoc.Location(aEmptyLoc);
|
||||
if (!aFaceMap.Add (aFaceNoLoc))
|
||||
continue; // already processed
|
||||
|
||||
TopoDS_Face aFace = TopoDS::Face(aFaceIter.Value());
|
||||
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
|
||||
if (aSurf.IsNull())
|
||||
continue;
|
||||
@@ -288,9 +282,8 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
|
||||
Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
|
||||
const TopoDS_Edge& theEdge)
|
||||
{
|
||||
const Standard_Real* pDef = myEdgeDeflection.Seek(theEdge);
|
||||
if (pDef)
|
||||
return *pDef;
|
||||
if (myEdgeDeflection.IsBound(theEdge))
|
||||
return myEdgeDeflection(theEdge);
|
||||
|
||||
Standard_Real aEdgeDeflection;
|
||||
if ( myParameters.Relative )
|
||||
@@ -336,7 +329,7 @@ Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
|
||||
void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
|
||||
{
|
||||
if (!myEdges.IsBound(theEdge))
|
||||
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool(3, myEdges.Allocator()));
|
||||
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool());
|
||||
|
||||
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.
|
||||
BRepMesh_OrientedEdge()
|
||||
Standard_EXPORT BRepMesh_OrientedEdge()
|
||||
: myFirstNode(-1),
|
||||
myLastNode(-1)
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructs a link between two vertices.
|
||||
BRepMesh_OrientedEdge(
|
||||
Standard_EXPORT 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_Integer HashCode(const Standard_Integer theUpper) const
|
||||
Standard_EXPORT Standard_Integer HashCode(const Standard_Integer theUpper) const
|
||||
{
|
||||
return ::HashCode(myFirstNode + myLastNode, theUpper);
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class BRepMesh_PairOfIndex
|
||||
public:
|
||||
|
||||
//! Default constructor
|
||||
BRepMesh_PairOfIndex()
|
||||
Standard_EXPORT BRepMesh_PairOfIndex()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor. Creates empty pair with null fileds.
|
||||
BRepMesh_PairOfPolygon()
|
||||
Standard_EXPORT BRepMesh_PairOfPolygon()
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor.
|
||||
BRepMesh_Triangle()
|
||||
Standard_EXPORT 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.
|
||||
BRepMesh_Triangle(
|
||||
Standard_EXPORT 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_Integer HashCode(const Standard_Integer theUpper) const
|
||||
Standard_EXPORT 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_Boolean IsEqual(const BRepMesh_Triangle& theOther) const
|
||||
Standard_EXPORT 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_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
Standard_EXPORT Standard_Boolean operator ==(const BRepMesh_Triangle& theOther) const
|
||||
{
|
||||
return IsEqual(theOther);
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Default constructor
|
||||
BRepMesh_Vertex()
|
||||
Standard_EXPORT 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.
|
||||
BRepMesh_Vertex(const gp_XY& theUV,
|
||||
const Standard_Integer theLocation3d,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
Standard_EXPORT 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.
|
||||
BRepMesh_Vertex(const Standard_Real theU,
|
||||
const Standard_Real theV,
|
||||
const BRepMesh_DegreeOfFreedom theMovability)
|
||||
Standard_EXPORT 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_Integer HashCode(const Standard_Integer Upper) const
|
||||
Standard_EXPORT 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_Boolean IsEqual(const BRepMesh_Vertex& theOther) const
|
||||
Standard_EXPORT 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_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
Standard_EXPORT Standard_Boolean operator ==(const BRepMesh_Vertex& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
@@ -30,11 +30,13 @@ 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.
|
||||
BRepMesh_VertexInspector (
|
||||
Standard_EXPORT BRepMesh_VertexInspector (
|
||||
const Standard_Integer theReservedSize,
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myResIndices(theAllocator),
|
||||
myVertices (new BRepMesh::VectorOfVertex),
|
||||
myVertices (new BRepMesh::VectorOfVertex(theReservedSize)),
|
||||
myDelNodes (theAllocator)
|
||||
{
|
||||
SetTolerance( Precision::Confusion() );
|
||||
@@ -42,7 +44,7 @@ public:
|
||||
|
||||
//! Registers the given vertex.
|
||||
//! @param theVertex vertex to be registered.
|
||||
Standard_Integer Add(const BRepMesh_Vertex& theVertex)
|
||||
Standard_EXPORT Standard_Integer Add(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
if( myDelNodes.IsEmpty() )
|
||||
{
|
||||
@@ -145,7 +147,7 @@ public:
|
||||
Standard_EXPORT NCollection_CellFilter_Action Inspect(const Standard_Integer theTargetIndex);
|
||||
|
||||
//! Checks indices for equlity.
|
||||
static Standard_Boolean IsEqual(const Standard_Integer theIndex,
|
||||
Standard_EXPORT static Standard_Boolean IsEqual(const Standard_Integer theIndex,
|
||||
const Standard_Integer theTargetIndex)
|
||||
{
|
||||
return (theIndex == theTargetIndex);
|
||||
|
@@ -56,10 +56,11 @@ 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 (myAllocator)
|
||||
mySelector (Max(theReservedSize, 64),myAllocator)
|
||||
{
|
||||
const Standard_Real aTol = Precision::Confusion();
|
||||
SetCellSize ( aTol + 0.05 * aTol );
|
||||
|
@@ -36,12 +36,14 @@ 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.
|
||||
void SetCellSize(const Standard_Real theSize)
|
||||
Standard_EXPORT void SetCellSize(const Standard_Real theSize)
|
||||
{
|
||||
myCellFilter.Reset(theSize, myAllocator);
|
||||
mySelector.Clear();
|
||||
@@ -50,8 +52,8 @@ public:
|
||||
//! Sets new size of cell for cellfilter.
|
||||
//! @param theSizeX size for X dimension.
|
||||
//! @param theSizeY size for Y dimension.
|
||||
void SetCellSize(const Standard_Real theSizeX,
|
||||
const Standard_Real theSizeY)
|
||||
Standard_EXPORT 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);
|
||||
@@ -61,7 +63,7 @@ public:
|
||||
|
||||
//! Sets the tolerance to be used for identification of
|
||||
//! coincident vertices equal for both dimensions.
|
||||
void SetTolerance(const Standard_Real theTolerance)
|
||||
Standard_EXPORT void SetTolerance(const Standard_Real theTolerance)
|
||||
{
|
||||
mySelector.SetTolerance( theTolerance );
|
||||
myTolerance[0] = theTolerance;
|
||||
@@ -72,8 +74,8 @@ public:
|
||||
//! coincident vertices.
|
||||
//! @param theToleranceX tolerance for X dimension.
|
||||
//! @param theToleranceY tolerance for Y dimension.
|
||||
void SetTolerance(const Standard_Real theToleranceX,
|
||||
const Standard_Real theToleranceY)
|
||||
Standard_EXPORT void SetTolerance(const Standard_Real theToleranceX,
|
||||
const Standard_Real theToleranceY)
|
||||
{
|
||||
mySelector.SetTolerance( theToleranceX, theToleranceY );
|
||||
myTolerance[0] = theToleranceX;
|
||||
@@ -84,8 +86,8 @@ public:
|
||||
//! coincident vertices.
|
||||
//! @param theToleranceX tolerance for X dimension.
|
||||
//! @param theToleranceY tolerance for Y dimension.
|
||||
void GetTolerance(Standard_Real& theToleranceX,
|
||||
Standard_Real& theToleranceY)
|
||||
Standard_EXPORT void GetTolerance(Standard_Real& theToleranceX,
|
||||
Standard_Real& theToleranceY)
|
||||
{
|
||||
theToleranceX = myTolerance[0];
|
||||
theToleranceY = myTolerance[1];
|
||||
@@ -122,7 +124,7 @@ public:
|
||||
}
|
||||
|
||||
//! Returns index of the given vertex.
|
||||
Standard_Integer FindIndex(const BRepMesh_Vertex& theVertex)
|
||||
Standard_EXPORT Standard_Integer FindIndex(const BRepMesh_Vertex& theVertex)
|
||||
{
|
||||
mySelector.SetPoint(theVertex.Coord());
|
||||
myCellFilter.Inspect (theVertex.Coord(), mySelector);
|
||||
|
@@ -22,8 +22,7 @@
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
#include <BRepMesh_PairOfPolygon.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
@@ -148,11 +147,10 @@ BRepMesh_WireChecker::BRepMesh_WireChecker(
|
||||
TopoDS_Face aFace = theFace;
|
||||
aFace.Orientation(TopAbs_FORWARD);
|
||||
|
||||
for (TopoDS_Iterator aFaceIt(aFace); aFaceIt.More(); aFaceIt.Next())
|
||||
TopExp_Explorer aFaceExplorer(aFace, TopAbs_WIRE);
|
||||
for (; aFaceExplorer.More(); aFaceExplorer.Next())
|
||||
{
|
||||
if (aFaceIt.Value().IsNull() || aFaceIt.Value().ShapeType() != TopAbs_WIRE) // may be inner vertex
|
||||
continue;
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceIt.Value());
|
||||
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceExplorer.Current());
|
||||
|
||||
myWiresEdges.Append(ListOfEdges());
|
||||
ListOfEdges& aEdges = myWiresEdges.ChangeLast();
|
||||
|
@@ -76,8 +76,6 @@
|
||||
#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
|
||||
@@ -102,100 +100,167 @@ 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 : 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.
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
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)
|
||||
|
||||
static void Store (const TopoDS_Edge& E1,
|
||||
const TopoDS_Edge& E2,
|
||||
TopTools_ListOfShape& LV1,
|
||||
TopTools_ListOfShape& LV2,
|
||||
Handle(BRepAlgo_AsDes) AsDes,
|
||||
Standard_Real Tol)
|
||||
{
|
||||
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)) {
|
||||
//-------------------------------------------------------------
|
||||
// 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;
|
||||
break;
|
||||
}
|
||||
gp_Pnt aPEx = BRep_Tool::Pnt(aVEx);
|
||||
//
|
||||
if (aP.IsEqual(aPEx, Tol)) {
|
||||
aLVC.Append(aVEx);
|
||||
}
|
||||
}
|
||||
//
|
||||
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);
|
||||
}
|
||||
}
|
||||
//
|
||||
TopTools_ListOfShape* pLV = aDMVV.ChangeSeek(aV);
|
||||
if (!pLV) {
|
||||
aDMVV.Add(aV, aLVC);
|
||||
}
|
||||
else {
|
||||
pLV->Append(aLVC);
|
||||
}
|
||||
}
|
||||
//
|
||||
aBB.UpdateVertex(aV, Tol);
|
||||
AsDes->Add(aE, aV);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
AsDes->Replace(V2,V1);
|
||||
}
|
||||
}
|
||||
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 :
|
||||
@@ -207,8 +272,7 @@ static void EdgeInter(const TopoDS_Face& F,
|
||||
const TopoDS_Edge& E2,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
Standard_Real Tol,
|
||||
Standard_Boolean WithOri,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV)
|
||||
Standard_Boolean WithOri)
|
||||
{
|
||||
#ifdef DRAW
|
||||
if (Inter2dAffichInt2d) {
|
||||
@@ -380,26 +444,32 @@ 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()));
|
||||
}
|
||||
@@ -451,9 +521,15 @@ 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, aDMVV);
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -468,8 +544,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
Standard_Real Tol,
|
||||
Standard_Boolean WithOri,
|
||||
gp_Pnt& Pref,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV)
|
||||
gp_Pnt& Pref)
|
||||
{
|
||||
#ifdef DRAW
|
||||
if (Inter2dAffichInt2d) {
|
||||
@@ -637,12 +712,6 @@ 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);
|
||||
@@ -653,6 +722,10 @@ 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()));
|
||||
}
|
||||
@@ -721,9 +794,16 @@ 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, aDMVV);
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1323,8 +1403,7 @@ 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,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
#ifdef DRAW
|
||||
NbF2d++;
|
||||
@@ -1366,7 +1445,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, theDMVV);
|
||||
EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True);
|
||||
// EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True);
|
||||
}
|
||||
it2LE.Next();
|
||||
@@ -1391,8 +1470,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||
const Standard_Real Offset,
|
||||
const Standard_Real Tol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
|
||||
const Standard_Real Tol)
|
||||
// Modified by skv - Fri Dec 26 16:53:18 2003 OCC4455 End
|
||||
{
|
||||
|
||||
@@ -1506,7 +1584,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, theDMVV);
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -1521,12 +1599,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, theDMVV);
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
|
||||
}
|
||||
//
|
||||
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, theDMVV);
|
||||
AsDes2d,Tol,Standard_True/*Standard_False*/, Pref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1547,71 +1625,3 @@ 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,7 +24,6 @@
|
||||
#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;
|
||||
@@ -42,21 +41,11 @@ 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,
|
||||
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.
|
||||
const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT static void ConnexIntByInt (const TopoDS_Face& FI,
|
||||
BRepOffset_Offset& OFI,
|
||||
TopTools_DataMapOfShapeShape& MES,
|
||||
@@ -64,14 +53,10 @@ public:
|
||||
const Handle(BRepAlgo_AsDes)& AsDes,
|
||||
const Handle(BRepAlgo_AsDes)& AsDes2d,
|
||||
const Standard_Real Offset,
|
||||
const Standard_Real Tol,
|
||||
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
|
||||
const Standard_Real Tol);
|
||||
|
||||
|
||||
|
||||
//! 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,18 +1189,14 @@ 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, aDMVV);
|
||||
AsDes, AsDes2d, myOffset, aCurrFaceTol);
|
||||
}
|
||||
//
|
||||
// fuse vertices on edges
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes2d);
|
||||
//-----------------------------------------------------------
|
||||
// Great restriction of new edges and update of AsDes.
|
||||
//------------------------------------------ ----------------
|
||||
@@ -1330,13 +1326,12 @@ 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, aDMVV);
|
||||
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol);
|
||||
}
|
||||
//----------------------------------------------
|
||||
// Intersections 2d on caps.
|
||||
@@ -1346,10 +1341,9 @@ 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, aDMVV);
|
||||
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol);
|
||||
}
|
||||
//
|
||||
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes);
|
||||
|
||||
//-------------------------------
|
||||
// Unwinding of extended Faces.
|
||||
//-------------------------------
|
||||
@@ -2915,15 +2909,12 @@ 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, aDMVV);
|
||||
BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol);
|
||||
}
|
||||
//
|
||||
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]);
|
||||
TopoDS_Shape S = DBRep::Get(a[1],TopAbs_FACE);
|
||||
if (S.IsNull()) return 1;
|
||||
|
||||
if (n==2) { Ok = BRepLib::BuildCurves3d(S); }
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
//#ifdef _MSC_VER
|
||||
@@ -66,18 +65,16 @@ static Standard_Integer distance (Draw_Interpretor& di,
|
||||
}
|
||||
|
||||
static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n != 4 && n != 5 )
|
||||
return 1;
|
||||
{
|
||||
Standard_Integer i1;
|
||||
// gp_Pnt P;
|
||||
|
||||
if (n != 4) return 1;
|
||||
|
||||
const char *ns1 = (a[2]), *ns2 = (a[3]), *ns0 = (a[1]);
|
||||
TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
|
||||
TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ;
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2 );
|
||||
|
||||
Standard_Real aDeflection = Precision::Confusion();
|
||||
if (n == 5)
|
||||
aDeflection = Draw::Atoi(a[4]);
|
||||
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
|
||||
|
||||
if (dst.IsDone())
|
||||
{
|
||||
@@ -98,7 +95,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
|
||||
Draw::Set(tempd,dst.Value());
|
||||
di << named << " ";
|
||||
|
||||
for (Standard_Integer i1 = 1; i1<= dst.NbSolution(); i1++)
|
||||
for (i1=1; i1<= dst.NbSolution(); i1++)
|
||||
{
|
||||
gp_Pnt P1,P2;
|
||||
P1 = (dst.PointOnShape1(i1));
|
||||
@@ -419,7 +416,7 @@ void BRepTest::ExtremaCommands (Draw_Interpretor& theCommands)
|
||||
aGroup);
|
||||
|
||||
theCommands.Add ("distmini",
|
||||
"distmini name Shape1 Shape2 [deflection]",
|
||||
"distmini name Shape1 Shape2",
|
||||
__FILE__,
|
||||
distmini,
|
||||
aGroup);
|
||||
|
@@ -732,22 +732,10 @@ 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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
if (narg<3) 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;
|
||||
@@ -764,42 +752,20 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
|
||||
(newnarg !=narg && ((narg-newnarg)<=2 || (narg-newnarg)%2 != 1))) {
|
||||
return 1;
|
||||
}
|
||||
Standard_Boolean isSplittingEdges = Standard_False;
|
||||
TopTools_SequenceOfShape aSplitEdges;
|
||||
if (i < newnarg) {
|
||||
|
||||
if (i<newnarg) {
|
||||
pick = (a[i][0] == '.');
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
EF = DBRep::Get(a[i],TopAbs_FACE);
|
||||
if (EF.IsNull()) return 1;
|
||||
}
|
||||
i++;
|
||||
|
||||
while (i < newnarg) {
|
||||
if (pick) {
|
||||
DBRep_DrawableShape::LastPick(EF,u,v);
|
||||
}
|
||||
if (!isSplittingEdges && !EF.IsNull() && EF.ShapeType() == TopAbs_FACE) {
|
||||
if (EF.ShapeType() == TopAbs_FACE) {
|
||||
// face wire/edge ...
|
||||
|
||||
i++;
|
||||
while (i < newnarg) {
|
||||
TopoDS_Shape W;
|
||||
Standard_Boolean rever = Standard_False;
|
||||
@@ -845,36 +811,11 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (isSplittingEdges)
|
||||
Spls.Add(aSplitEdges);
|
||||
|
||||
// ici, i vaut newnarg
|
||||
for (; i < narg; i += 2) {
|
||||
for (i++; i<narg; i+=2) {
|
||||
TopoDS_Shape Ew,Es;
|
||||
TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_EDGE));
|
||||
Es = TopoDS::Edge(aLocalShape);
|
||||
@@ -886,7 +827,6 @@ 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));
|
||||
@@ -2310,8 +2250,8 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
|
||||
|
||||
|
||||
theCommands.Add("splitshape",
|
||||
"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);
|
||||
"splitshape result shape 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,21 +495,18 @@ 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 );
|
||||
@@ -525,33 +522,23 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
|
||||
}
|
||||
if ( ! modif ) return shape;
|
||||
|
||||
// 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();
|
||||
// restore Range on edge broken by EmptyCopied()
|
||||
if ( st == TopAbs_EDGE ) {
|
||||
CopyRanges (result, shape, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore Range on edge broken by EmptyCopied()
|
||||
if ( st == TopAbs_EDGE ) {
|
||||
CopyRanges (result, shape, 0, 1);
|
||||
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_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);
|
||||
}
|
||||
else if (st == TopAbs_WIRE || st == TopAbs_SHELL)
|
||||
result.Closed (BRep_Tool::IsClosed (result));
|
||||
|
||||
Replace ( shape, result );
|
||||
result.Orientation(orien);
|
||||
myStatus = locStatus;
|
||||
Replace ( shape, result );
|
||||
|
||||
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,8 +1779,7 @@ void BiTgte_Blend::ComputeCenters()
|
||||
BRepOffset_Inter2d::Compute(myAsDes,
|
||||
CurOF,
|
||||
myEdges,
|
||||
myTol,
|
||||
aDMVV);
|
||||
myTol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1812,12 +1811,8 @@ void BiTgte_Blend::ComputeCenters()
|
||||
BRepOffset_Inter2d::Compute(myAsDes,
|
||||
CurOF,
|
||||
myEdges,
|
||||
myTol,
|
||||
aDMVV);
|
||||
myTol);
|
||||
}
|
||||
//
|
||||
// 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.
|
||||
void Add (const gp_Pnt2d& thePnt);
|
||||
Standard_EXPORT void Add (const gp_Pnt2d& thePnt);
|
||||
|
||||
//! Update the box by another box.
|
||||
void Add (const Bnd_B2d& theBox);
|
||||
|
@@ -1332,11 +1332,8 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
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));
|
||||
|
||||
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
if( proj1.IsDone() ){
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
@@ -1392,12 +1389,8 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
|
||||
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));
|
||||
|
||||
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
if( proj1.IsDone() ){
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
@@ -1464,10 +1457,8 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
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));
|
||||
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
if( proj1.IsDone() ){
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
@@ -1534,10 +1525,8 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
|
||||
|
||||
Standard_Real tol = tolesp*1.e2;
|
||||
// Standard_Real u,v;
|
||||
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));
|
||||
Extrema_GenLocateExtPS proj1(pt1,S2->Surface(),SolDep(1),SolDep(2),tol,tol);
|
||||
Extrema_GenLocateExtPS proj2(pt2,S1->Surface(),SolDep(3),SolDep(4),tol,tol);
|
||||
if( proj1.IsDone() ) {
|
||||
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
|
||||
}
|
||||
|
@@ -584,11 +584,6 @@ static Standard_Integer nexplode(Draw_Interpretor& di,
|
||||
typ = TopAbs_EDGE;
|
||||
break;
|
||||
|
||||
case 'V' :
|
||||
case 'v' :
|
||||
typ = TopAbs_VERTEX;
|
||||
break;
|
||||
|
||||
default :
|
||||
return 1;
|
||||
}
|
||||
@@ -609,26 +604,20 @@ 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 for edge and face
|
||||
// and for vertex use its point
|
||||
|
||||
// Computing of CentreOfMass
|
||||
for (Index=1; Index <= MaxShapes; Index++) {
|
||||
OrderInd.SetValue(Index,Index);
|
||||
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));
|
||||
}
|
||||
BRepGProp::LinearProperties(aShapes(Index),GPr);
|
||||
gp_Pnt GPoint = GPr.CentreOfMass();
|
||||
MidXYZ.SetValue(Index, GPoint.X()*999 + GPoint.Y()*99 +
|
||||
GPoint.Z()*0.9);
|
||||
}
|
||||
@@ -1299,7 +1288,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 vertex, edge and face: nexplode name [V/E/F]",__FILE__,nexplode,g);
|
||||
theCommands.Add("nexplode","stable numbered explode for edge and face: nexplode name [F/E]",__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,15 +543,21 @@ proc checkprops {shape args} {
|
||||
_check_args ${args} ${options} "checkprops"
|
||||
|
||||
if { ${length} != -1 || ${equal_check} == 1 } {
|
||||
lappend CommandNames {lprops}
|
||||
set CommandName lprops
|
||||
set mass $length
|
||||
set prop "length"
|
||||
set equal_check 0
|
||||
}
|
||||
if { ${area} != -1 || ${equal_check} == 1 } {
|
||||
lappend CommandNames {sprops}
|
||||
set CommandName sprops
|
||||
set mass $area
|
||||
set prop "area"
|
||||
set equal_check 0
|
||||
}
|
||||
if { ${volume} != -1 || ${equal_check} == 1 } {
|
||||
lappend CommandNames {vprops}
|
||||
set CommandName vprops
|
||||
set mass $volume
|
||||
set prop "volume"
|
||||
set equal_check 0
|
||||
}
|
||||
|
||||
@@ -559,47 +565,41 @@ proc checkprops {shape args} {
|
||||
if { $skip } {
|
||||
set skip_option "-skip"
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
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}"
|
||||
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_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 && ${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"
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
#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 ff8080
|
||||
return red
|
||||
} 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 ? \"ff8080\" : \"lightgreen\"]\">$line</td></tr></table>"
|
||||
puts $fd "<table><tr><td bgcolor=\"[expr $value > 0 ? \"red\" : \"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.
|
||||
static Standard_Real Parameter (const gp_Lin& L, const gp_Pnt& P);
|
||||
Standard_EXPORT static Standard_Real Parameter (const gp_Lin& L, const gp_Pnt& P);
|
||||
|
||||
//! parametrization
|
||||
//! P (U) = L.Location() + U * L.Direction()
|
||||
|
@@ -36,13 +36,9 @@
|
||||
Extrema_ExtElC2d::Extrema_ExtElC2d () { myDone = Standard_False; }
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Extrema_ExtElC2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Extrema_ExtElC2d::Extrema_ExtElC2d (const gp_Lin2d& C1,
|
||||
const gp_Lin2d& C2,
|
||||
const Standard_Real)
|
||||
Extrema_ExtElC2d::Extrema_ExtElC2d (const gp_Lin2d& C1,
|
||||
const gp_Lin2d& C2,
|
||||
const Standard_Real)
|
||||
/*-----------------------------------------------------------------------------
|
||||
Function:
|
||||
Find min distance between 2 straight lines.
|
||||
@@ -61,37 +57,15 @@ Method:
|
||||
myIsPar = Standard_False;
|
||||
myNbExt = 0;
|
||||
|
||||
gp_Vec2d D1(C1.Direction());
|
||||
gp_Vec2d D2(C2.Direction());
|
||||
if (D1.IsParallel(D2, Precision::Angular()))
|
||||
{
|
||||
gp_Dir2d D1 = C1.Direction();
|
||||
gp_Dir2d D2 = C2.Direction();
|
||||
if (D1.IsParallel(D2, Precision::Angular())) {
|
||||
myIsPar = Standard_True;
|
||||
mySqDist[0] = C2.SquareDistance(C1.Location());
|
||||
}
|
||||
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;
|
||||
else {
|
||||
myNbExt = 0;
|
||||
}
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
//=============================================================================
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Extrema_FuncExtPS.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_FuncPSNorm myF;
|
||||
Extrema_FuncExtPS myF;
|
||||
Handle(Adaptor3d_HCurve) myC;
|
||||
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) myS;
|
||||
gp_Vec myDirection;
|
||||
|
@@ -14,25 +14,27 @@
|
||||
// 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_FuncPSNorm::Extrema_FuncPSNorm ()
|
||||
Extrema_FuncExtPS::Extrema_FuncExtPS ()
|
||||
{
|
||||
myPinit = Standard_False;
|
||||
mySinit = Standard_False;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
Extrema_FuncPSNorm::Extrema_FuncPSNorm (const gp_Pnt& P,
|
||||
Extrema_FuncExtPS::Extrema_FuncExtPS (const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S)
|
||||
{
|
||||
myP = P;
|
||||
@@ -42,7 +44,7 @@ Extrema_FuncPSNorm::Extrema_FuncPSNorm (const gp_Pnt& P,
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
void Extrema_FuncPSNorm::Initialize(const Adaptor3d_Surface& S)
|
||||
void Extrema_FuncExtPS::Initialize(const Adaptor3d_Surface& S)
|
||||
{
|
||||
myS = (Adaptor3d_SurfacePtr)&S;
|
||||
mySinit = Standard_True;
|
||||
@@ -52,7 +54,7 @@ void Extrema_FuncPSNorm::Initialize(const Adaptor3d_Surface& S)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Extrema_FuncPSNorm::SetPoint(const gp_Pnt& P)
|
||||
void Extrema_FuncExtPS::SetPoint(const gp_Pnt& P)
|
||||
{
|
||||
myP = P;
|
||||
myPinit = Standard_True;
|
||||
@@ -64,13 +66,13 @@ void Extrema_FuncPSNorm::SetPoint(const gp_Pnt& P)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncPSNorm::NbVariables () const { return 2;}
|
||||
Standard_Integer Extrema_FuncExtPS::NbVariables () const { return 2;}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncPSNorm::NbEquations () const { return 2;}
|
||||
Standard_Integer Extrema_FuncExtPS::NbEquations () const { return 2;}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_FuncPSNorm::Value (const math_Vector& UV,
|
||||
Standard_Boolean Extrema_FuncExtPS::Value (const math_Vector& UV,
|
||||
math_Vector& F)
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
@@ -88,7 +90,7 @@ Standard_Boolean Extrema_FuncPSNorm::Value (const math_Vector& UV,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_FuncPSNorm::Derivatives (const math_Vector& UV,
|
||||
Standard_Boolean Extrema_FuncExtPS::Derivatives (const math_Vector& UV,
|
||||
math_Matrix& Df)
|
||||
{
|
||||
math_Vector F(1,2);
|
||||
@@ -96,7 +98,7 @@ Standard_Boolean Extrema_FuncPSNorm::Derivatives (const math_Vector& UV,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_FuncPSNorm::Values (const math_Vector& UV,
|
||||
Standard_Boolean Extrema_FuncExtPS::Values (const math_Vector& UV,
|
||||
math_Vector& F,
|
||||
math_Matrix& Df)
|
||||
{
|
||||
@@ -121,7 +123,7 @@ Standard_Boolean Extrema_FuncPSNorm::Values (const math_Vector& UV,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncPSNorm::GetStateNumber ()
|
||||
Standard_Integer Extrema_FuncExtPS::GetStateNumber ()
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
//comparison of solution with previous solutions
|
||||
@@ -143,20 +145,20 @@ Standard_Integer Extrema_FuncPSNorm::GetStateNumber ()
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncPSNorm::NbExt () const
|
||||
Standard_Integer Extrema_FuncExtPS::NbExt () const
|
||||
{
|
||||
return mySqDist.Length();
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Real Extrema_FuncPSNorm::SquareDistance (const Standard_Integer N) const
|
||||
Standard_Real Extrema_FuncExtPS::SquareDistance (const Standard_Integer N) const
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
return mySqDist.Value(N);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
const Extrema_POnSurf& Extrema_FuncPSNorm::Point (const Standard_Integer N) const
|
||||
const Extrema_POnSurf& Extrema_FuncExtPS::Point (const Standard_Integer N) const
|
||||
{
|
||||
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
|
||||
return myPoint.Value(N);
|
@@ -14,11 +14,12 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Extrema_FunctPSNorm_HeaderFile
|
||||
#define _Extrema_FunctPSNorm_HeaderFile
|
||||
#ifndef _Extrema_FuncExtPS_HeaderFile
|
||||
#define _Extrema_FuncExtPS_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
@@ -57,16 +58,16 @@ class Extrema_POnSurf;
|
||||
//! Dvf2(u,v) = Sv^2 + (S-P) * Svv
|
||||
//!
|
||||
//! Here * denotes scalar product, and ^2 is square power.
|
||||
class Extrema_FuncPSNorm : public math_FunctionSetWithDerivatives
|
||||
class Extrema_FuncExtPS : public math_FunctionSetWithDerivatives
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT Extrema_FuncPSNorm();
|
||||
Standard_EXPORT Extrema_FuncExtPS();
|
||||
|
||||
Standard_EXPORT Extrema_FuncPSNorm(const gp_Pnt& P, const Adaptor3d_Surface& S);
|
||||
Standard_EXPORT Extrema_FuncExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S);
|
||||
|
||||
//! sets the field mysurf of the function.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S);
|
||||
@@ -99,8 +100,19 @@ 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;
|
||||
@@ -110,5 +122,14 @@ private:
|
||||
Extrema_SequenceOfPOnSurf myPoint;
|
||||
Standard_Boolean myPinit;
|
||||
Standard_Boolean mySinit;
|
||||
|
||||
|
||||
};
|
||||
#endif // _Extrema_FunctPSNorm_HeaderFile
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Extrema_FuncExtPS_HeaderFile
|
@@ -1,119 +0,0 @@
|
||||
// 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;
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
// 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
|
@@ -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.Last() - anIntervals1.First(),
|
||||
anIntervals2.Last() - anIntervals2.First())
|
||||
const Standard_Real aCellSize = Max(anIntervals1.Upper() - anIntervals1.Lower(),
|
||||
anIntervals2.Upper() - anIntervals2.Lower())
|
||||
* Precision::PConfusion() / (2.0 * Sqrt(2.0));
|
||||
Extrema_CCPointsInspector anInspector(aCellSize);
|
||||
Extrema_CCPointsInspector anInspector(Precision::PConfusion());
|
||||
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(aCellSize);
|
||||
NCollection_Vector<gp_XY> aPnts;
|
||||
|
||||
@@ -335,7 +335,8 @@ void Extrema_GenExtCC::Perform()
|
||||
|
||||
// Avoid mark parallel case when have duplicates out of tolerance.
|
||||
// Bad conditioned task: bug25635_1, bug23706_10, bug23706_13.
|
||||
if (aPnts.Size() >= 2)
|
||||
const Standard_Integer aMinNbInfSol = 100;
|
||||
if (aPnts.Size() >= aMinNbInfSol)
|
||||
{
|
||||
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_FuncPSNorm.hxx>
|
||||
#include <Extrema_FuncExtPS.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_FuncPSNorm myF;
|
||||
Extrema_FuncExtPS myF;
|
||||
Adaptor3d_SurfacePtr myS;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
|
@@ -15,117 +15,94 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Extrema_GenLocateExtPS.hxx>
|
||||
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Extrema_FuncPSDist.hxx>
|
||||
#include <Extrema_FuncExtPS.hxx>
|
||||
#include <Extrema_GenLocateExtPS.hxx>
|
||||
#include <Extrema_POnSurf.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
#include <math_BFGS.hxx>
|
||||
#include <math_NewtonFunctionSetRoot.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//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 () { myDone = Standard_False; }
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Extrema_GenLocateExtPS::Perform(const gp_Pnt& theP,
|
||||
const Standard_Real theU0,
|
||||
const Standard_Real theV0,
|
||||
const Standard_Boolean isDistanceCriteria)
|
||||
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. .
|
||||
---------------------------------------------------------------------------*/
|
||||
{
|
||||
myDone = Standard_False;
|
||||
|
||||
// Prepare initial data structures.
|
||||
math_Vector aTol(1, 2), aStart(1, 2), aBoundInf(1, 2), aBoundSup(1, 2);
|
||||
Standard_Real Uinf, Usup, Vinf, Vsup;
|
||||
Uinf = S.FirstUParameter();
|
||||
Usup = S.LastUParameter();
|
||||
Vinf = S.FirstVParameter();
|
||||
Vsup = S.LastVParameter();
|
||||
|
||||
// Tolerance.
|
||||
aTol(1) = myTolU;
|
||||
aTol(2) = myTolV;
|
||||
Extrema_FuncExtPS F (P,S);
|
||||
math_Vector Tol(1, 2), Start(1, 2), BInf(1, 2), BSup(1, 2);
|
||||
|
||||
// Initial solution approximation.
|
||||
aStart(1) = theU0;
|
||||
aStart(2) = theV0;
|
||||
Tol(1) = TolU;
|
||||
Tol(2) = TolV;
|
||||
|
||||
// Borders.
|
||||
aBoundInf(1) = mySurf.FirstUParameter();
|
||||
aBoundInf(2) = mySurf.FirstVParameter();
|
||||
aBoundSup(1) = mySurf.LastUParameter();
|
||||
aBoundSup(2) = mySurf.LastVParameter();
|
||||
Start(1) = U0;
|
||||
Start(2) = V0;
|
||||
|
||||
if (isDistanceCriteria == Standard_False)
|
||||
{
|
||||
// Normal projection criteria.
|
||||
Extrema_FuncPSNorm F(theP,mySurf);
|
||||
BInf(1) = Uinf;
|
||||
BInf(2) = Vinf;
|
||||
BSup(1) = Usup;
|
||||
BSup(2) = Vsup;
|
||||
|
||||
math_FunctionSetRoot SR (F, aTol);
|
||||
SR.Perform(F, aStart, aBoundInf, aBoundSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
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;
|
||||
}
|
||||
mySqDist = F.SquareDistance(1);
|
||||
myPoint = F.Point(1);
|
||||
myDone = Standard_True;
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Extrema_GenLocateExtPS::IsDone () const
|
||||
{
|
||||
return myDone;
|
||||
}
|
||||
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,6 +19,7 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
@@ -32,27 +33,23 @@ class Extrema_POnSurf;
|
||||
|
||||
//! With a close point, it calculates the distance
|
||||
//! between a point and a surface.
|
||||
//! Criteria type is defined in "Perform" method.
|
||||
//! This distance can be a minimum or a maximum.
|
||||
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());
|
||||
|
||||
//! 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);
|
||||
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);
|
||||
|
||||
//! Returns True if the distance is found.
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
@@ -63,19 +60,20 @@ 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,10 +72,8 @@ Extrema_FuncExtCC.lxx
|
||||
Extrema_FuncExtCS.cxx
|
||||
Extrema_FuncExtCS.hxx
|
||||
Extrema_FuncExtPC.gxx
|
||||
Extrema_FuncPSNorm.cxx
|
||||
Extrema_FuncPSNorm.hxx
|
||||
Extrema_FuncPSDist.cxx
|
||||
Extrema_FuncPSDist.hxx
|
||||
Extrema_FuncExtPS.cxx
|
||||
Extrema_FuncExtPS.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();
|
||||
}
|
||||
|
||||
const std::streamsize aNbBytes = std::streamsize(sizeof(Standard_ExtCharacter) * size);
|
||||
theIStream.read ((char *)c, aNbBytes);
|
||||
if (theIStream.gcount() != aNbBytes)
|
||||
theIStream.read ((char *)c, size*sizeof(Standard_ExtCharacter));
|
||||
|
||||
if (theIStream.gcount() != size)
|
||||
{
|
||||
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[] =
|
||||
{
|
||||
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
#ifdef _WIN32
|
||||
|
||||
{ "Courier" , "Courier New" , Font_FA_Regular },
|
||||
{ "Times-Roman" , "Times New Roman", Font_FA_Regular },
|
||||
@@ -122,21 +122,15 @@ 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
|
||||
@@ -390,7 +384,6 @@ 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)
|
||||
@@ -447,7 +440,6 @@ void Font_FontMgr::InitFontDataBase()
|
||||
}
|
||||
aFile.Close();
|
||||
}
|
||||
#endif
|
||||
|
||||
// append default directories
|
||||
for (Standard_Integer anIter = 0; myDefaultFontsDirs[anIter] != NULL; ++anIter)
|
||||
@@ -469,7 +461,7 @@ void Font_FontMgr::InitFontDataBase()
|
||||
for (NCollection_Map<TCollection_AsciiString>::Iterator anIter (aMapOfFontsDirs);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
#if defined(__ANDROID__) || defined(__APPLE__)
|
||||
#ifdef __ANDROID__
|
||||
OSD_Path aFolderPath (anIter.Value());
|
||||
for (OSD_FileIterator aFileIter (aFolderPath, "*"); aFileIter.More(); aFileIter.Next())
|
||||
{
|
||||
|
@@ -51,6 +51,14 @@ 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,6 +70,11 @@ 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
|
||||
|
@@ -219,8 +219,7 @@ void GCPnts_TangentialDeflection::PerformCircular (const TheCurve& C)
|
||||
dfR, curvatureDeflection, angularDeflection, myMinLen);
|
||||
|
||||
const Standard_Real aDiff = lastu - firstu;
|
||||
// Round up number of points to satisfy curvatureDeflection more precisely
|
||||
Standard_Integer NbPoints = (Standard_Integer)Ceiling(aDiff / Du);
|
||||
Standard_Integer NbPoints = (Standard_Integer)(aDiff / Du);
|
||||
NbPoints = Max(NbPoints, minNbPnts - 1);
|
||||
Du = aDiff / NbPoints;
|
||||
|
||||
|
@@ -991,7 +991,7 @@ Handle(Geom2d_BSplineCurve) Geom2dAdaptor_Curve::BSpline() const
|
||||
static Standard_Integer nbPoints(const Handle(Geom2d_Curve)& theCurve)
|
||||
{
|
||||
|
||||
Standard_Integer nbs = 20;
|
||||
Standard_Integer nbs = 10;
|
||||
|
||||
if(theCurve->IsKind(STANDARD_TYPE( Geom2d_Line)) )
|
||||
nbs = 2;
|
||||
|
@@ -51,10 +51,6 @@ class Geom2d_BSplineCurve;
|
||||
//! An interface between the services provided by any
|
||||
//! curve from the package Geom2d and those required
|
||||
//! of the curve by algorithms which use it.
|
||||
//!
|
||||
//! 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 Geom2dAdaptor_Curve : public Adaptor2d_Curve2d
|
||||
{
|
||||
public:
|
||||
|
@@ -95,9 +95,7 @@ public:
|
||||
//! Create a domain from a curve
|
||||
Standard_EXPORT IntRes2d_Domain ComputeDomain (const Adaptor2d_Curve2d& C1, const Standard_Real TolDomain) const;
|
||||
|
||||
//! Set / get minimum number of points in polygon intersection.
|
||||
Standard_EXPORT void SetMinNbSamples (const Standard_Integer theMinNbSamples);
|
||||
Standard_EXPORT Standard_Integer GetMinNbSamples () const;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -25,25 +25,21 @@
|
||||
|
||||
//============================================================
|
||||
Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& C,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1)
|
||||
const Standard_Real U0,
|
||||
const Standard_Real U1)
|
||||
{
|
||||
GeomAbs_CurveType typC = C.GetType();
|
||||
Standard_Integer nbs = C.NbSamples();
|
||||
|
||||
if(typC == GeomAbs_BSplineCurve)
|
||||
{
|
||||
Standard_Real t = C.LastParameter() - C.FirstParameter();
|
||||
Standard_Real t1 = U1 - U0;
|
||||
if(t1 < 0.0) t1 = -t1;
|
||||
if(typC == GeomAbs_BSplineCurve) {
|
||||
Standard_Real t=C.LastParameter()-C.FirstParameter();
|
||||
Standard_Real t1=U1-U0;
|
||||
if(t1<0.0) t1=-t1;
|
||||
nbs = C.NbKnots();
|
||||
nbs*= C.Degree();
|
||||
Standard_Real anb = t1 / t * nbs;
|
||||
Standard_Real anb = t1/t * nbs;
|
||||
nbs = (Standard_Integer)anb;
|
||||
|
||||
Standard_Integer aMinPntNb = Max(C.Degree() + 1, 4);
|
||||
if(nbs < aMinPntNb)
|
||||
nbs = aMinPntNb;
|
||||
if(nbs < 4) nbs=4;
|
||||
}
|
||||
else if (typC == GeomAbs_Circle)
|
||||
{
|
||||
|
@@ -42,15 +42,14 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT Geom2dInt_TheIntPCurvePCurveOfGInter();
|
||||
|
||||
|
||||
Standard_EXPORT void Perform (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Adaptor2d_Curve2d& Curve2, const IntRes2d_Domain& Domain2, const Standard_Real TolConf, const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT void Perform (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Standard_Real TolConf, const Standard_Real Tol);
|
||||
|
||||
//! Set / get minimum number of points in polygon for intersection.
|
||||
Standard_EXPORT void SetMinNbSamples (const Standard_Integer theMinNbSamples);
|
||||
Standard_EXPORT Standard_Integer GetMinNbSamples () const;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
@@ -60,6 +59,9 @@ protected:
|
||||
|
||||
Standard_EXPORT void Perform (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Standard_Real TolConf, const Standard_Real Tol, const Standard_Integer NbIter, const Standard_Real DeltaU, const Standard_Real DeltaV);
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -70,11 +72,10 @@ private:
|
||||
//! : during prelimanary search for line (case of bad paramerization of Bspline for example).
|
||||
Standard_EXPORT Standard_Boolean findIntersect (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Adaptor2d_Curve2d& Curve2, const IntRes2d_Domain& Domain2, const Standard_Real TolConf, const Standard_Real Tol, const Standard_Integer NbIter, const Standard_Real DeltaU, const Standard_Real DeltaV, const Geom2dInt_ThePolygon2dOfTheIntPCurvePCurveOfGInter& thePoly1, const Geom2dInt_ThePolygon2dOfTheIntPCurvePCurveOfGInter& thePoly2, const Standard_Boolean isFullRepresentation);
|
||||
|
||||
|
||||
IntRes2d_Domain DomainOnCurve1;
|
||||
IntRes2d_Domain DomainOnCurve2;
|
||||
|
||||
//! Minimal number of sample points
|
||||
Standard_Integer myMinPntNb;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -81,8 +81,10 @@ GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
TColStd_Array1OfReal TK(1,Nb);
|
||||
TColStd_Array1OfInteger TM(1,Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U1,myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index1,newFirst);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U2,myBSplineCurve->IsPeriodic(),
|
||||
@@ -291,8 +293,10 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
TColStd_Array1OfReal TK(1,Nb);
|
||||
TColStd_Array1OfInteger TM(1,Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index1,newFirst);
|
||||
@@ -414,8 +418,10 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
|
||||
Standard_Integer Index1 = 0;
|
||||
Standard_Integer Index2 = 0;
|
||||
Standard_Real newFirst, newLast;
|
||||
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
|
||||
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
|
||||
TColStd_Array1OfReal TK(1,Nb);
|
||||
TColStd_Array1OfInteger TM(1,Nb);
|
||||
myBSplineCurve->Knots(TK);
|
||||
myBSplineCurve->Multiplicities(TM);
|
||||
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
|
||||
myBSplineCurve->IsPeriodic(),
|
||||
1,Nb,Index1,newFirst);
|
||||
|
@@ -52,10 +52,6 @@ class Geom_BSplineCurve;
|
||||
//! This class provides an interface between the services provided by any
|
||||
//! curve from the package Geom and those required of the curve by algorithms which use it.
|
||||
//! Creation of the loaded curve the curve is C1 by piece.
|
||||
//!
|
||||
//! 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 GeomAdaptor_Curve : public Adaptor3d_Curve
|
||||
{
|
||||
public:
|
||||
|
@@ -54,10 +54,6 @@ class Adaptor3d_HCurve;
|
||||
//! surface from the package Geom and those required
|
||||
//! of the surface by algorithms which use it.
|
||||
//! Creation of the loaded surface the surface is C1 by piece
|
||||
//!
|
||||
//! 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 GeomAdaptor_Surface : public Adaptor3d_Surface
|
||||
{
|
||||
public:
|
||||
|
@@ -17,29 +17,6 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CView,Graphic3d_DataStructureManager)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const int THE_DEFAULT_LAYERS[] = { Graphic3d_ZLayerId_Top,
|
||||
Graphic3d_ZLayerId_Topmost,
|
||||
Graphic3d_ZLayerId_BotOSD,
|
||||
Graphic3d_ZLayerId_TopOSD };
|
||||
|
||||
static const int THE_NB_DEFAULT_LAYERS = sizeof(THE_DEFAULT_LAYERS) / sizeof(*THE_DEFAULT_LAYERS);
|
||||
|
||||
void combineBox (Bnd_Box& aCombined, const Graphic3d_BndBox4f& theBox)
|
||||
{
|
||||
if (theBox.IsValid())
|
||||
{
|
||||
aCombined.Add (gp_Pnt (theBox.CornerMin().x(),
|
||||
theBox.CornerMin().y(),
|
||||
theBox.CornerMin().z()));
|
||||
aCombined.Add (gp_Pnt (theBox.CornerMax().x(),
|
||||
theBox.CornerMax().y(),
|
||||
theBox.CornerMax().z()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
@@ -372,11 +349,9 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
||||
// function : Update
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::Update (const Aspect_TypeOfUpdate theUpdateMode,
|
||||
const Graphic3d_ZLayerId theLayerId)
|
||||
void Graphic3d_CView::Update (const Aspect_TypeOfUpdate theUpdateMode)
|
||||
{
|
||||
InvalidateZLayerBoundingBox (theLayerId);
|
||||
|
||||
myMinMax.Invalidate();
|
||||
if (theUpdateMode == Aspect_TOU_ASAP)
|
||||
{
|
||||
Compute();
|
||||
@@ -434,68 +409,13 @@ void Graphic3d_CView::DisplayedStructures (Graphic3d_MapOfStructure& theStructur
|
||||
// =======================================================================
|
||||
Bnd_Box Graphic3d_CView::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag) const
|
||||
{
|
||||
Bnd_Box aResult;
|
||||
|
||||
if (!IsDefined())
|
||||
if (myMinMax.IsOutdated (theToIgnoreInfiniteFlag))
|
||||
{
|
||||
return aResult;
|
||||
myMinMax.BoundingBox (theToIgnoreInfiniteFlag) = MinMaxValues (myStructsDisplayed, theToIgnoreInfiniteFlag);
|
||||
myMinMax.IsOutdated (theToIgnoreInfiniteFlag) = Standard_False;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Camera) aCamera = Camera();
|
||||
Standard_Integer aWinWidth = 0;
|
||||
Standard_Integer aWinHeight = 0;
|
||||
|
||||
Window()->Size (aWinWidth, aWinHeight);
|
||||
|
||||
for (Standard_Integer aLayer = 0; aLayer < THE_NB_DEFAULT_LAYERS; ++aLayer)
|
||||
{
|
||||
Graphic3d_BndBox4f aBox = ZLayerBoundingBox (THE_DEFAULT_LAYERS[aLayer],
|
||||
aCamera,
|
||||
aWinWidth,
|
||||
aWinHeight,
|
||||
theToIgnoreInfiniteFlag);
|
||||
combineBox (aResult, aBox);
|
||||
}
|
||||
|
||||
Standard_Integer aMaxZLayer = ZLayerMax();
|
||||
for (Standard_Integer aLayerId = Graphic3d_ZLayerId_Default; aLayerId <= aMaxZLayer; ++aLayerId)
|
||||
{
|
||||
Graphic3d_BndBox4f aBox = ZLayerBoundingBox (aLayerId, aCamera, aWinWidth, aWinHeight, theToIgnoreInfiniteFlag);
|
||||
combineBox (aResult, aBox);
|
||||
}
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ConsiderZoomPersistenceObjects
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Real Graphic3d_CView::ConsiderZoomPersistenceObjects()
|
||||
{
|
||||
if (!IsDefined())
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Camera) aCamera = Camera();
|
||||
Standard_Integer aWinWidth = 0;
|
||||
Standard_Integer aWinHeight = 0;
|
||||
|
||||
Window()->Size (aWinWidth, aWinHeight);
|
||||
|
||||
Standard_Real aMaxCoef = 1.0;
|
||||
for (Standard_Integer aLayer = 0; aLayer < THE_NB_DEFAULT_LAYERS; ++aLayer)
|
||||
{
|
||||
aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (THE_DEFAULT_LAYERS[aLayer], aCamera, aWinWidth, aWinHeight, Standard_False));
|
||||
}
|
||||
|
||||
for (Standard_Integer aLayer = Graphic3d_ZLayerId_Default; aLayer <= ZLayerMax(); ++aLayer)
|
||||
{
|
||||
aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (aLayer, aCamera, aWinWidth, aWinHeight, Standard_False));
|
||||
}
|
||||
|
||||
return aMaxCoef;
|
||||
return myMinMax.BoundingBox (theToIgnoreInfiniteFlag);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -752,7 +672,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
|
||||
theStructure->CalculateBoundBox();
|
||||
displayStructure (theStructure->CStructure(), theStructure->DisplayPriority());
|
||||
Update (theUpdateMode, theStructure->GetZLayer());
|
||||
Update (theUpdateMode);
|
||||
return;
|
||||
}
|
||||
else if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
@@ -773,7 +693,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
}
|
||||
|
||||
displayStructure (anOldStruct->CStructure(), theStructure->DisplayPriority());
|
||||
Update (theUpdateMode, anOldStruct->GetZLayer());
|
||||
Update (theUpdateMode);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -796,7 +716,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const Handle(Graphic3d_Structure)& aNewStruct = myStructsComputed.Value (aNewIndex);
|
||||
myStructsComputed.SetValue (anIndex, aNewStruct);
|
||||
displayStructure (aNewStruct->CStructure(), theStructure->DisplayPriority());
|
||||
Update (theUpdateMode, aNewStruct->GetZLayer());
|
||||
Update (theUpdateMode);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -887,7 +807,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
myStructsDisplayed.Add (theStructure);
|
||||
displayStructure (aStruct->CStructure(), theStructure->DisplayPriority());
|
||||
|
||||
Update (theUpdateMode, aStruct->GetZLayer());
|
||||
Update (theUpdateMode);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -931,7 +851,7 @@ void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure,
|
||||
}
|
||||
}
|
||||
myStructsDisplayed.Remove (theStructure);
|
||||
Update (theUpdateMode, theStructure->GetZLayer());
|
||||
Update (theUpdateMode);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -108,10 +108,8 @@ public:
|
||||
//! Computes the new presentation of the structure displayed in this view with the type Graphic3d_TOS_COMPUTED.
|
||||
Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
|
||||
|
||||
//! Updates screen in function of modifications of the structures
|
||||
//! and invalidates bounding box of specified ZLayerId.
|
||||
Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode,
|
||||
const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN);
|
||||
//! Updates screen in function of modifications of the structures.
|
||||
Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode);
|
||||
|
||||
//! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles.
|
||||
Standard_EXPORT Standard_Boolean ContainsFacet() const;
|
||||
@@ -136,7 +134,8 @@ public:
|
||||
Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId,
|
||||
Handle(Graphic3d_Structure)& theComputedStruct) const;
|
||||
|
||||
//! Returns the bounding box of all structures displayed in the view.
|
||||
//! Returns the coordinates of the boundary box of all
|
||||
//! structures displayed in the view.
|
||||
//! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
|
||||
//! also includes minimum and maximum limits of graphical elements
|
||||
//! forming parts of infinite structures.
|
||||
@@ -337,20 +336,6 @@ public:
|
||||
//! ID for the structure.
|
||||
virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
|
||||
|
||||
//! Returns the maximum Z layer ID.
|
||||
//! First layer ID is Graphic3d_ZLayerId_Default, last ID is ZLayerMax().
|
||||
virtual Standard_Integer ZLayerMax() const = 0;
|
||||
|
||||
//! Returns the bounding box of all structures displayed in the Z layer.
|
||||
virtual void InvalidateZLayerBoundingBox (const Graphic3d_ZLayerId theLayerId) const = 0;
|
||||
|
||||
//! Returns the bounding box of all structures displayed in the Z layer.
|
||||
virtual Graphic3d_BndBox4f ZLayerBoundingBox (const Graphic3d_ZLayerId theLayerId,
|
||||
const Handle(Graphic3d_Camera)& theCamera,
|
||||
const Standard_Integer theWindowWidth,
|
||||
const Standard_Integer theWindowHeight,
|
||||
const Standard_Boolean theToIgnoreInfiniteFlag) const = 0;
|
||||
|
||||
//! Remove Z layer from the specified view. All structures
|
||||
//! displayed at the moment in layer will be displayed in default layer
|
||||
//! ( the bottom-level z layer ). To unset layer ID from associated
|
||||
@@ -361,9 +346,6 @@ public:
|
||||
virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
|
||||
const Graphic3d_ZLayerSettings& theSettings) = 0;
|
||||
|
||||
//! Returns zoom-scale factor.
|
||||
Standard_EXPORT Standard_Real ConsiderZoomPersistenceObjects();
|
||||
|
||||
//! Returns pointer to an assigned framebuffer object.
|
||||
virtual Handle(Standard_Transient) FBO() const = 0;
|
||||
|
||||
@@ -540,12 +522,29 @@ private:
|
||||
virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure,
|
||||
const Standard_Integer theNewPriority) = 0;
|
||||
|
||||
//! Returns zoom-scale factor.
|
||||
virtual Standard_Real considerZoomPersistenceObjects (const Graphic3d_ZLayerId theLayerId,
|
||||
const Handle(Graphic3d_Camera)& theCamera,
|
||||
const Standard_Integer theWindowWidth,
|
||||
const Standard_Integer theWindowHeight,
|
||||
const Standard_Boolean theToIgnoreInfiniteFlag) const = 0;
|
||||
protected:
|
||||
|
||||
struct CachedMinMax
|
||||
{
|
||||
CachedMinMax() { Invalidate(); }
|
||||
|
||||
Bnd_Box& BoundingBox (const Standard_Boolean theToIgnoreInfiniteFlag)
|
||||
{
|
||||
return !theToIgnoreInfiniteFlag ? myBoundingBox[0] : myBoundingBox[1];
|
||||
}
|
||||
Standard_Boolean& IsOutdated (const Standard_Boolean theToIgnoreInfiniteFlag)
|
||||
{
|
||||
return !theToIgnoreInfiniteFlag ? myIsOutdated[0] : myIsOutdated[1];
|
||||
}
|
||||
void Invalidate()
|
||||
{
|
||||
myIsOutdated[0] = Standard_True;
|
||||
myIsOutdated[1] = Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean myIsOutdated [2];
|
||||
Bnd_Box myBoundingBox[2];
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
@@ -560,6 +559,7 @@ protected:
|
||||
Standard_Boolean myIsActive;
|
||||
Standard_Boolean myIsRemoved;
|
||||
Graphic3d_TypeOfVisualization myVisualization;
|
||||
mutable CachedMinMax myMinMax;
|
||||
|
||||
private:
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user