mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c0418c96db | ||
|
83cc25e05b | ||
|
8b536fff48 | ||
|
ac76263667 | ||
|
efc007f044 | ||
|
c45ac27846 | ||
|
4a1eddc2c9 | ||
|
f001c6f012 | ||
|
8271ac6728 | ||
|
293b9f436b | ||
|
acac44d571 | ||
|
7aaed2ce3b | ||
|
da76ea432b | ||
|
53152e6dd9 | ||
|
1a1739b200 | ||
|
fd5c113a03 | ||
|
f74f684b16 | ||
|
621ed3bc36 | ||
|
81d569625e | ||
|
6072d3093c |
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
|
||||
|
||||
@@ -6,6 +6,10 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
|
||||
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
|
||||
|
||||
# set using C++ standard
|
||||
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
|
||||
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
|
||||
|
||||
# macro: include patched file if it exists
|
||||
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
|
||||
@@ -713,14 +717,14 @@ if (NOT DEFINED ANDROID AND CAN_USE_TBB)
|
||||
add_definitions (-DHAVE_TBB)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB12")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_TBB")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB12")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
|
@@ -32,15 +32,13 @@ if(__COTIRE_INCLUDED)
|
||||
endif()
|
||||
set(__COTIRE_INCLUDED TRUE)
|
||||
|
||||
# call cmake_minimum_required, but prevent modification of the CMake policy stack in include mode
|
||||
# cmake_minimum_required also sets the policy version as a side effect, which we have to avoid
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(PUSH)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
if (NOT CMAKE_SCRIPT_MODE_FILE)
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
|
||||
|
@@ -12,7 +12,7 @@ endif()
|
||||
|
||||
# TBB
|
||||
if (USE_TBB)
|
||||
set (CSF_TBB "tbb tbbmalloc")
|
||||
set (CSF_TBB "tbb12 tbbmalloc")
|
||||
else()
|
||||
set (CSF_TBB)
|
||||
endif()
|
||||
|
@@ -116,9 +116,9 @@ if (MSVC)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||
endif()
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]"))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
|
||||
endif()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
@@ -130,14 +130,26 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
# Set desired C++ standard
|
||||
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
|
||||
set (CMAKE_CXX_STANDARD 20)
|
||||
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
|
||||
set (CMAKE_CXX_STANDARD 23)
|
||||
else ()
|
||||
message (FATAL_ERROR, "misprint in c++ standard name")
|
||||
endif()
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
if (APPLE)
|
||||
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
elseif(NOT WIN32)
|
||||
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
|
||||
# does not support option "-std=c++0x"
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
@@ -148,14 +160,10 @@ elseif(MINGW)
|
||||
# workaround bugs in mingw with vtable export
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
|
||||
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Require C++11
|
||||
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
|
||||
|
@@ -80,9 +80,9 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
|
||||
set (COMPILER gcc)
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (COMPILER gxx)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set (COMPILER clang)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
set (COMPILER icc)
|
||||
else()
|
||||
set (COMPILER ${CMAKE_GENERATOR})
|
||||
@@ -589,9 +589,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
|
||||
endif()
|
||||
|
||||
install (CODE
|
||||
"cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
|
||||
"string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
|
||||
file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
|
||||
foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES})
|
||||
file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT)
|
||||
@@ -600,8 +598,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
|
||||
string (REGEX REPLACE \"[\\\\]?[\\\$]{OCCT_INSTALL_BIN_LETTER}\" \"\${OCCT_INSTALL_BIN_LETTER}\" line \"\${line}\")
|
||||
file (APPEND \"\${TARGET_FILENAME}\" \"\${line}\\n\")
|
||||
endforeach()
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
endforeach()")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
@@ -615,17 +612,14 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
|
||||
install(CODE "cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
|
||||
install(CODE "set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
|
||||
file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
|
||||
file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
|
||||
foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
|
||||
string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
|
||||
string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
|
||||
file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
endforeach()")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)
|
||||
|
@@ -320,10 +320,10 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
|
||||
else() # get CSF_ value
|
||||
set (CURRENT_CSF ${${USED_ITEM}})
|
||||
if (NOT "x${CURRENT_CSF}" STREQUAL "x")
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs")
|
||||
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlLibs}")
|
||||
add_definitions (-DHAVE_OPENGL)
|
||||
endif()
|
||||
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs")
|
||||
if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlesLibs}")
|
||||
add_definitions (-DHAVE_GLES2)
|
||||
endif()
|
||||
|
||||
|
@@ -69,12 +69,12 @@ else()
|
||||
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
|
||||
endif()
|
||||
|
||||
# common steps for tbb and tbbmalloc
|
||||
# common steps for tbb12 and tbbmalloc
|
||||
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
|
||||
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
|
||||
|
||||
# define required tbb/tbbmalloc variables
|
||||
# define required tbb12/tbbmalloc variables
|
||||
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
@@ -126,7 +126,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64)
|
||||
endif()
|
||||
|
||||
# tbb/tbbmalloc library
|
||||
# tbb12/tbbmalloc library
|
||||
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
|
||||
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
@@ -178,7 +178,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
|
||||
endif()
|
||||
|
||||
# tbb/tbbmalloc shared library
|
||||
# tbb12/tbbmalloc shared library
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
|
||||
@@ -230,7 +230,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# install tbb/tbbmalloc
|
||||
# install tbb12/tbbmalloc
|
||||
if (INSTALL_TBB)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
@@ -286,9 +286,9 @@ endmacro()
|
||||
else()
|
||||
# the library directory for using by the executable
|
||||
if (WIN32)
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB12_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB12_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
#endif()
|
||||
|
@@ -775,19 +775,19 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
|
||||
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/$aVcLib"
|
||||
}
|
||||
if { "$aTbbLibPath" == "" } {
|
||||
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
|
||||
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb12.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
|
||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||
}
|
||||
}
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
|
||||
if { "$aTbbDllPath" == "" } {
|
||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
if { "$aTbbDllPath" != "" } {
|
||||
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
|
||||
} else {
|
||||
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
|
||||
lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
|
||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||
}
|
||||
}
|
||||
|
@@ -1437,7 +1437,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
|
||||
set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
|
||||
}
|
||||
if { "$::HAVE_TBB" == "true" } {
|
||||
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
|
||||
set aLibsMap(CSF_TBB) "tbb12 tbbmalloc"
|
||||
}
|
||||
if { "$::HAVE_VTK" == "true" } {
|
||||
if { "$theOS" == "wnt" } {
|
||||
|
@@ -23,7 +23,7 @@ CSF_TclLibs = -ltcl8.6
|
||||
CSF_TclTkLibs = -ltk8.6
|
||||
HAVE_FREEIMAGE { CSF_FreeImagePlus = -lfreeimage } else:win32 { CSF_FreeImagePlus = -lwindowscodecs -lole32 }
|
||||
HAVE_FFMPEG { CSF_FFmpeg = -lavcodec -lavformat -lswscale -lavutil }
|
||||
HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc }
|
||||
HAVE_TBB { CSF_TBB = -ltbb12 -ltbbmalloc }
|
||||
HAVE_ZLIB { CSF_ZLIB = -lzlib }
|
||||
HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma }
|
||||
HAVE_DRACO { CSF_Draco = -ldraco }
|
||||
|
@@ -11,7 +11,7 @@ if /I "%VCVER%" == "@COMPILER@" (
|
||||
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIRS@"
|
||||
set "EGL_DIR=@3RDPARTY_EGL_DLL_DIRS@"
|
||||
set "GLES2_DIR=@3RDPARTY_GLES2_DLL_DIRS@"
|
||||
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
|
||||
set "TBB_DIR=@3RDPARTY_TBB12_DLL_DIR@"
|
||||
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
|
||||
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"
|
||||
set "OPENVR_DIR=@3RDPARTY_OPENVR_DLL_DIRS@"
|
||||
|
@@ -9,7 +9,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
|
||||
export TK_DIR="@3RDPARTY_TK_LIBRARY_DIR@"
|
||||
export FREETYPE_DIR="@3RDPARTY_FREETYPE_LIBRARY_DIR@"
|
||||
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIRS@"
|
||||
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
|
||||
export TBB_DIR="@3RDPARTY_TBB12_LIBRARY_DIR@"
|
||||
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
|
||||
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"
|
||||
|
||||
|
17
dox/build/build_3rdparty/building_3rdparty.md
vendored
17
dox/build/build_3rdparty/building_3rdparty.md
vendored
@@ -128,8 +128,9 @@ You can download its sources from https://freetype.org/
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Windows platform.
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Windows platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-win.zip`)
|
||||
|
||||
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
|
||||
|
||||
@@ -304,9 +305,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
|
||||
To install, unpack the downloaded archive of TBB product.
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Linux platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-lin.tgz`).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
|
||||
|
||||
@@ -477,9 +478,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB product (`tbb30_018oss_osx.tgz`).
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
|
||||
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-mac.tgz`).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage
|
||||
|
||||
|
@@ -17,7 +17,7 @@ On Linux and macOS we recommend to use libraries maintained by distributive deve
|
||||
@section build_occt_win_cmake Building with CMake tool
|
||||
|
||||
This chapter describes the [CMake](https://cmake.org/download/)-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources.
|
||||
OCCT requires CMake version 2.8.12 or later.
|
||||
OCCT requires CMake version 3.1 or later.
|
||||
|
||||
CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
|
||||
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
|
||||
@@ -113,6 +113,7 @@ The following table gives the full list of environment variables used at the con
|
||||
| BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
|
||||
| BUILD_WITH_DEBUG | Boolean | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. |
|
||||
| BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. |
|
||||
| BUILD_CPP_STANDARD | String | Employ corresponding c++ standard (C++11, C++14, ..C++23) for building OCCT |
|
||||
| CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
|
||||
| INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* |
|
||||
| INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) |
|
||||
|
@@ -359,8 +359,8 @@ https://dev.opencascade.org/resources/download/3rd-party-components
|
||||
|
||||
| Component | Where to find | Used for | Purpose |
|
||||
| --------- | ------------- | -------- | -------------------- |
|
||||
| CMake 2.8+ | https://cmake.org/ | Configuration | Build from sources |
|
||||
| Intel TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) |
|
||||
| CMake 3.1+ | https://cmake.org/ | Configuration | Build from sources |
|
||||
| Intel oneTBB 2021.5.0 | https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0 | All | Parallelization of algorithms (alternative to built-in thread pool) |
|
||||
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
|
||||
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
|
||||
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer |
|
||||
@@ -572,7 +572,7 @@ FreeType 2 is released under two open-source licenses: BSD-like FreeType License
|
||||
It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert.
|
||||
Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that
|
||||
abstracts platform details and threading mechanisms for scalability and performance.
|
||||
TBB version 2017 is available under Apache 2.0 license, while older versions
|
||||
oneTBB 2021.5.0 is available under Apache 2.0 license, while older versions
|
||||
until 4.4 are available under GPLv2 license with the runtime exception (https://www.threadingbuildingblocks.org).
|
||||
|
||||
**OpenGL** is an industry standard API for 3D graphics used by OCCT for
|
||||
|
@@ -91,6 +91,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -121,6 +122,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -145,6 +147,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -172,6 +175,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
|
@@ -92,6 +92,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -123,6 +124,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -147,6 +149,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -174,6 +177,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IE_WPF_D3D</RootNamespace>
|
||||
<AssemblyName>IE_WPF_D3D</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IE_WPF_WinForms</RootNamespace>
|
||||
<AssemblyName>IE_WPF_WinForms</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
|
@@ -35,4 +35,4 @@
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
|
@@ -4,7 +4,6 @@ project(glfw-occt-demo)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
set(APP_TARGET glfwocct)
|
||||
|
@@ -39,9 +39,9 @@ elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (MY_COMPILER gcc)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
set (MY_COMPILER clang)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
set (MY_COMPILER icc)
|
||||
else()
|
||||
set (MY_COMPILER ${CMAKE_GENERATOR})
|
||||
|
@@ -37,7 +37,7 @@ list(APPEND aLibDeps lib_FreeType)
|
||||
# system libraries
|
||||
list(APPEND aLibDeps EGL GLESv2 log android)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -frtti -fexceptions -fpermissive")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -frtti -fexceptions -fpermissive")
|
||||
|
||||
add_library(TKJniSample SHARED ${SOURCE_FILES})
|
||||
target_link_libraries(TKJniSample ${aLibDeps})
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (Geometry)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (Modeling)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (ImportExport)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (HLR)
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
# Caution! Be careful, when increase minimal cmake version:
|
||||
# using of newer version may leads (by default) to applying
|
||||
# of some new policies. It may break compilation.
|
||||
# For canceling of applying new policies use:
|
||||
# cmake_policy(PUSH) before `cmake_minimum_required`
|
||||
# and cmake_policy(POP) after.
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
project (mfcsample)
|
||||
|
||||
|
@@ -51,7 +51,7 @@ unix {
|
||||
DEFINES += OCC_CONVERT_SIGNALS QT_NO_STL
|
||||
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
|
||||
LIBS += -lfreeimageplus
|
||||
LIBS += -ltbb -ltbbmalloc
|
||||
LIBS += -ltbb12 -ltbbmalloc
|
||||
QMAKE_CXXFLAGS += -std=gnu++11
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(occt-webgl-sample)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(APP_VERSION_MAJOR 1)
|
||||
set(APP_VERSION_MINOR 0)
|
||||
set(APP_TARGET occt-webgl-sample)
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveCircle.hxx>
|
||||
#include <Select3D_SensitivePoly.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -41,9 +42,9 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Circle,AIS_InteractiveObject)
|
||||
AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& aComponent):
|
||||
AIS_InteractiveObject(PrsMgr_TOP_AllView),
|
||||
myComponent(aComponent),
|
||||
myUStart(0.),
|
||||
myUEnd(2*M_PI),
|
||||
myCircleIsArc(Standard_False),
|
||||
myUStart (0.0),
|
||||
myUEnd (2.0 * M_PI),
|
||||
myCircleIsArc (Standard_False),
|
||||
myIsFilledCircleSens (Standard_False)
|
||||
{
|
||||
}
|
||||
@@ -60,7 +61,7 @@ AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& theComponent,
|
||||
myComponent (theComponent),
|
||||
myUStart (theUStart),
|
||||
myUEnd (theUEnd),
|
||||
myCircleIsArc (Standard_True),
|
||||
myCircleIsArc (Abs (Abs (theUEnd - theUStart) - 2.0 * M_PI) > gp::Resolution()),
|
||||
myIsFilledCircleSens (theIsFilledCircleSens)
|
||||
{
|
||||
}
|
||||
@@ -207,14 +208,14 @@ void AIS_Circle::UnsetWidth()
|
||||
//function : ComputeCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
{
|
||||
|
||||
GeomAdaptor_Curve curv(myComponent);
|
||||
Standard_Real prevdev = myDrawer->DeviationCoefficient();
|
||||
myDrawer->SetDeviationCoefficient(1.e-5);
|
||||
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
|
||||
myDrawer->SetDeviationCoefficient(prevdev);
|
||||
myDrawer->SetDeviationCoefficient (1.e-5);
|
||||
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
|
||||
myDrawer->SetDeviationCoefficient (prevdev);
|
||||
|
||||
}
|
||||
|
||||
@@ -223,13 +224,13 @@ void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::ComputeArc( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
void AIS_Circle::ComputeArc (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
{
|
||||
GeomAdaptor_Curve curv(myComponent,myUStart,myUEnd);
|
||||
GeomAdaptor_Curve curv(myComponent, myUStart, myUEnd);
|
||||
Standard_Real prevdev = myDrawer->DeviationCoefficient();
|
||||
myDrawer->SetDeviationCoefficient(1.e-5);
|
||||
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
|
||||
myDrawer->SetDeviationCoefficient(prevdev);
|
||||
myDrawer->SetDeviationCoefficient (1.e-5);
|
||||
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
|
||||
myDrawer->SetDeviationCoefficient (prevdev);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -237,27 +238,25 @@ void AIS_Circle::ComputeArc( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Circle::ComputeCircleSelection(const Handle(SelectMgr_Selection)& aSelection)
|
||||
void AIS_Circle::ComputeCircleSelection (const Handle(SelectMgr_Selection)& theSelection)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
|
||||
myComponent->Circ(),
|
||||
myIsFilledCircleSens);
|
||||
aSelection->Add(seg);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) aCirc = new Select3D_SensitiveCircle (anOwner,
|
||||
myComponent->Circ(),
|
||||
myIsFilledCircleSens);
|
||||
theSelection->Add (aCirc);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeArcSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Circle::ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection)
|
||||
void AIS_Circle::ComputeArcSelection (const Handle(SelectMgr_Selection)& theSelection)
|
||||
{
|
||||
|
||||
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
|
||||
myComponent->Circ(),
|
||||
myUStart, myUEnd,
|
||||
myIsFilledCircleSens);
|
||||
aSelection->Add(seg);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitivePoly) aSeg = new Select3D_SensitivePoly (anOwner,
|
||||
myComponent->Circ(),
|
||||
myUStart, myUEnd,
|
||||
myIsFilledCircleSens);
|
||||
theSelection->Add (aSeg);
|
||||
}
|
||||
|
@@ -84,9 +84,8 @@ namespace
|
||||
public:
|
||||
//! Main constructor.
|
||||
ManipSensCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False, theNbPnts),
|
||||
const gp_Circ& theCircle)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False),
|
||||
ManipSensRotation (theCircle.Position().Direction()) {}
|
||||
|
||||
//! Checks whether the circle overlaps current selecting volume
|
||||
@@ -1168,7 +1167,7 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
}
|
||||
// define sensitivity by circle
|
||||
const gp_Circ aGeomCircle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, anAxis.FacettesNumber());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle);
|
||||
aCircle->SetSensitivityFactor (15);
|
||||
theSelection->Add (aCircle);
|
||||
// enlarge sensitivity by triangulation
|
||||
|
@@ -371,7 +371,7 @@ bool D3DHost_View::d3dSwap()
|
||||
}
|
||||
|
||||
const HRESULT isOK = myD3dDevice->Present (NULL, NULL, NULL, NULL);
|
||||
if (isOK != D3D_OK)
|
||||
if (isOK != D3D_OK && isOK != S_PRESENT_OCCLUDED)
|
||||
{
|
||||
myWorkspace->GetGlContext()->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString("Direct3D9, Present device failed, ") + d3dFormatError (isOK));
|
||||
|
@@ -60,6 +60,7 @@ Font_TextFormatter::Font_TextFormatter()
|
||||
myAlignY (Graphic3d_VTA_TOP),
|
||||
myTabSize (8),
|
||||
myWrappingWidth (0.0f),
|
||||
myIsWordWrapping (true),
|
||||
myLastSymbolWidth (0.0f),
|
||||
myMaxSymbolWidth (0.0f),
|
||||
//
|
||||
@@ -249,6 +250,7 @@ void Font_TextFormatter::Format()
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Utf32Char aCharPrev = 0;
|
||||
for (Font_TextFormatter::Iterator aFormatterIt(*this);
|
||||
aFormatterIt.More(); aFormatterIt.Next())
|
||||
{
|
||||
@@ -269,12 +271,30 @@ void Font_TextFormatter::Format()
|
||||
Font_Rect aBndBox;
|
||||
GlyphBoundingBox (aRectIter, aBndBox);
|
||||
const Standard_ShortReal aNextXPos = aBndBox.Right - BottomLeft (aFirstCornerId).x();
|
||||
if (aNextXPos > aMaxLineWidth) // wrap the line and do processing of the symbol
|
||||
Standard_Boolean isCurWordFits = true;
|
||||
if(myIsWordWrapping && IsSeparatorSymbol(aCharPrev))
|
||||
{
|
||||
for (Font_TextFormatter::Iterator aWordIt = aFormatterIt; aWordIt.More(); aWordIt.Next())
|
||||
{
|
||||
if (IsSeparatorSymbol(aWordIt.Symbol()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
float aWordWidthPx = myCorners[aWordIt.SymbolPosition()].x() - myCorners[aRectIter].x();
|
||||
if (aNextXPos + aWordWidthPx > aMaxLineWidth)
|
||||
{
|
||||
isCurWordFits = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aNextXPos > aMaxLineWidth || !isCurWordFits) // wrap the line and do processing of the symbol
|
||||
{
|
||||
const Standard_Integer aLastRect = aRectIter - 1; // last rect on current line
|
||||
newLine (aLastRect, aMaxLineWidth);
|
||||
}
|
||||
}
|
||||
aCharPrev = aCharThis;
|
||||
}
|
||||
|
||||
myBndWidth = aMaxLineWidth;
|
||||
|
@@ -220,6 +220,12 @@ public:
|
||||
//! Returns text maximum width, zero means that the text is not bounded by width
|
||||
Standard_ShortReal Wrapping() const { return myWrappingWidth; }
|
||||
|
||||
//! returns TRUE when trying not to break words when wrapping text
|
||||
Standard_Boolean WordWrapping () const { return myIsWordWrapping; }
|
||||
|
||||
//! returns TRUE when trying not to break words when wrapping text
|
||||
void SetWordWrapping (const Standard_Boolean theIsWordWrapping) { myIsWordWrapping = theIsWordWrapping; }
|
||||
|
||||
//! @return width of formatted text.
|
||||
inline Standard_ShortReal ResultWidth() const
|
||||
{
|
||||
@@ -274,6 +280,14 @@ public:
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//! Returns true if the symbol separates words when wrapping is enabled
|
||||
static Standard_Boolean IsSeparatorSymbol (const Standard_Utf32Char& theSymbol)
|
||||
{
|
||||
return theSymbol == '\x0A' // new line
|
||||
|| theSymbol == ' ' // space
|
||||
|| theSymbol == '\x09'; // tab
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT (Font_TextFormatter, Standard_Transient)
|
||||
|
||||
protected: //! @name class auxiliary methods
|
||||
@@ -288,6 +302,7 @@ protected: //! @name configuration
|
||||
Graphic3d_VerticalTextAlignment myAlignY; //!< vertical alignment style
|
||||
Standard_Integer myTabSize; //!< horizontal tabulation width (number of space symbols)
|
||||
Standard_ShortReal myWrappingWidth; //!< text is wrapped by the width if defined (more 0)
|
||||
Standard_Boolean myIsWordWrapping; //!< if TRUE try not to break words when wrapping text (true by default)
|
||||
Standard_ShortReal myLastSymbolWidth; //!< width of the last symbol
|
||||
Standard_ShortReal myMaxSymbolWidth; //!< maximum symbol width of the formatter string
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <Standard_OutOfMemory.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
//! Defines an array of values of configurable size.
|
||||
//! For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime.
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
}
|
||||
|
||||
//! Move constructor
|
||||
NCollection_AliasedArray (NCollection_AliasedArray&& theOther) noexcept
|
||||
NCollection_AliasedArray (NCollection_AliasedArray&& theOther) Standard_Noexcept
|
||||
: myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable)
|
||||
{
|
||||
theOther.myDeletable = false;
|
||||
|
@@ -125,10 +125,10 @@ protected:
|
||||
|
||||
// Since C++20 inheritance from std::iterator is deprecated, so define predefined types manually:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = UniversalIterator;
|
||||
using value_type = IteratorInterface*;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = UniversalIterator*;
|
||||
using reference = UniversalIterator&;
|
||||
using pointer = value_type;
|
||||
using reference = value_type;
|
||||
|
||||
UniversalIterator() {}
|
||||
|
||||
@@ -171,18 +171,8 @@ protected:
|
||||
return aValue;
|
||||
}
|
||||
|
||||
const UniversalIterator& operator* () const { return *this; }
|
||||
UniversalIterator& operator* () { return *this; }
|
||||
|
||||
const UniversalIterator* operator->() const { return this; }
|
||||
UniversalIterator* operator->() { return this; }
|
||||
|
||||
// type cast to actual iterator
|
||||
template <typename Iterator>
|
||||
const Iterator& DownCast () const
|
||||
{
|
||||
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(myPtr.get())->Value();
|
||||
}
|
||||
const reference operator* () const { return myPtr.get(); }
|
||||
reference operator* () { return myPtr.get(); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<IteratorInterface> myPtr;
|
||||
@@ -196,7 +186,14 @@ protected:
|
||||
public:
|
||||
virtual ~FunctorInterface() {}
|
||||
|
||||
virtual void operator () (UniversalIterator& theIterator) const = 0;
|
||||
virtual void operator () (IteratorInterface* theIterator) const = 0;
|
||||
|
||||
// type cast to actual iterator
|
||||
template <typename Iterator>
|
||||
static const Iterator& DownCast(IteratorInterface* theIterator)
|
||||
{
|
||||
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(theIterator)->Value();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -211,9 +208,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
|
||||
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
|
||||
{
|
||||
const Iterator& anIt = theIterator.DownCast<Iterator>();
|
||||
const Iterator& anIt = DownCast<Iterator>(theIterator);
|
||||
myFunctor(*anIt);
|
||||
}
|
||||
|
||||
@@ -233,9 +230,9 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
|
||||
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
|
||||
{
|
||||
Standard_Integer anIndex = theIterator.DownCast<Standard_Integer>();
|
||||
Standard_Integer anIndex = DownCast<Standard_Integer>(theIterator);
|
||||
myFunctor(anIndex);
|
||||
}
|
||||
|
||||
|
@@ -100,7 +100,7 @@ namespace
|
||||
{
|
||||
for (OSD_Parallel::UniversalIterator anIter = myRange.It(); anIter != myRange.End(); anIter = myRange.It())
|
||||
{
|
||||
myPerformer (anIter);
|
||||
myPerformer (*anIter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <NCollection_AliasedArray.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec3f.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
//! Defines an array of 3D nodes of single/double precision configurable at construction time.
|
||||
class Poly_ArrayOfNodes : public NCollection_AliasedArray<>
|
||||
@@ -85,14 +86,14 @@ public:
|
||||
Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); }
|
||||
|
||||
//! Move constructor
|
||||
Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) noexcept
|
||||
Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
|
||||
: NCollection_AliasedArray (std::move (theOther))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//! Move assignment operator; @sa Move()
|
||||
Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) noexcept
|
||||
Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) Standard_Noexcept
|
||||
{
|
||||
return Move (theOther);
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <NCollection_AliasedArray.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2f.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
//! Defines an array of 2D nodes of single/double precision configurable at construction time.
|
||||
class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<>
|
||||
@@ -85,14 +86,14 @@ public:
|
||||
Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); }
|
||||
|
||||
//! Move constructor
|
||||
Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) noexcept
|
||||
Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
|
||||
: NCollection_AliasedArray (std::move (theOther))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//! Move assignment operator; @sa Move()
|
||||
Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) noexcept
|
||||
Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
|
||||
{
|
||||
return Move (theOther);
|
||||
}
|
||||
|
@@ -213,37 +213,39 @@ void PrsDim_ConcentricRelation::ComputeTwoEdgesConcentric(const Handle(Prs3d_Pre
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsDim_ConcentricRelation::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer)
|
||||
void PrsDim_ConcentricRelation::ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) own = new SelectMgr_EntityOwner(this,7);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this,7);
|
||||
|
||||
//Creation of 2 sensitive circles
|
||||
// the greater
|
||||
gp_Ax2 ax(myCenter, myDir);
|
||||
gp_Circ aCirc (ax, myRad);
|
||||
Handle(Select3D_SensitiveCircle) sensit = new Select3D_SensitiveCircle (own, aCirc);
|
||||
aSelection->Add(sensit);
|
||||
// the smaller
|
||||
aCirc.SetRadius(myRad/2);
|
||||
sensit = new Select3D_SensitiveCircle (own, aCirc);
|
||||
aSelection->Add(sensit);
|
||||
|
||||
// the greater
|
||||
gp_Ax2 anAx (myCenter, myDir);
|
||||
gp_Circ aCirc (anAx, myRad);
|
||||
Handle(Select3D_SensitiveCircle) sensit = new Select3D_SensitiveCircle (anOwner, aCirc);
|
||||
aSelection->Add (sensit);
|
||||
|
||||
// the smaller
|
||||
aCirc.SetRadius (myRad / 2);
|
||||
sensit = new Select3D_SensitiveCircle (anOwner, aCirc);
|
||||
aSelection->Add (sensit);
|
||||
|
||||
//Creation of 2 segments sensitive for the cross
|
||||
Handle(Select3D_SensitiveSegment) seg;
|
||||
gp_Pnt otherPnt = myPnt.Mirrored(myCenter);
|
||||
seg = new Select3D_SensitiveSegment(own,
|
||||
otherPnt,
|
||||
myPnt);
|
||||
aSelection->Add(seg);
|
||||
seg = new Select3D_SensitiveSegment(anOwner,
|
||||
otherPnt,
|
||||
myPnt);
|
||||
aSelection->Add (seg);
|
||||
|
||||
gp_Ax1 RotateAxis(myCenter, myDir);
|
||||
gp_Pnt FPnt = myCenter.Rotated(RotateAxis, M_PI/2);
|
||||
gp_Pnt SPnt = myCenter.Rotated(RotateAxis, -M_PI/2);
|
||||
seg = new Select3D_SensitiveSegment(own,
|
||||
FPnt,
|
||||
SPnt);
|
||||
aSelection->Add(seg);
|
||||
gp_Pnt FPnt = myCenter.Rotated (RotateAxis, M_PI_2);
|
||||
gp_Pnt SPnt = myCenter.Rotated (RotateAxis, -M_PI_2);
|
||||
seg = new Select3D_SensitiveSegment(anOwner,
|
||||
FPnt,
|
||||
SPnt);
|
||||
aSelection->Add (seg);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitiveCircle.hxx>
|
||||
#include <Select3D_SensitivePoly.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@@ -202,124 +202,141 @@ void PrsDim_EqualDistanceRelation::Compute (const Handle(PrsMgr_PresentationMana
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void PrsDim_EqualDistanceRelation::ComputeSelection( const Handle( SelectMgr_Selection )& aSelection,
|
||||
const Standard_Integer )
|
||||
void PrsDim_EqualDistanceRelation::ComputeSelection (const Handle( SelectMgr_Selection )& aSelection,
|
||||
const Standard_Integer)
|
||||
{
|
||||
Handle( SelectMgr_EntityOwner ) own = new SelectMgr_EntityOwner( this, 7 );
|
||||
Handle( Select3D_SensitiveSegment ) seg;
|
||||
|
||||
seg = new Select3D_SensitiveSegment( own, myPoint1, myPoint2 );
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
|
||||
seg = new Select3D_SensitiveSegment( own, myPoint3, myPoint4 );
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
|
||||
// Line between two middles
|
||||
gp_Pnt Middle12( (myPoint1.XYZ() + myPoint2.XYZ()) * 0.5 ),
|
||||
gp_Pnt Middle12( (myPoint1.XYZ() + myPoint2.XYZ()) * 0.5 ),
|
||||
Middle34( (myPoint3.XYZ() + myPoint4.XYZ()) *0.5 );
|
||||
seg = new Select3D_SensitiveSegment( own, Middle12, Middle34 );
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
|
||||
gp_Pnt Middle((Middle12.XYZ() + Middle34.XYZ())*0.5);
|
||||
Standard_Real SmallDist = .001;
|
||||
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox( own,
|
||||
Middle.X() - SmallDist,
|
||||
Middle.Y() - SmallDist,
|
||||
Middle.Z() - SmallDist,
|
||||
Middle.X() + SmallDist,
|
||||
Middle.Y() + SmallDist,
|
||||
Middle.Z() + SmallDist );
|
||||
aSelection->Add(box);
|
||||
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox(own,
|
||||
Middle.X() - SmallDist,
|
||||
Middle.Y() - SmallDist,
|
||||
Middle.Z() - SmallDist,
|
||||
Middle.X() + SmallDist,
|
||||
Middle.Y() + SmallDist,
|
||||
Middle.Z() + SmallDist);
|
||||
aSelection->Add (box);
|
||||
|
||||
if (myFShape.ShapeType() == TopAbs_EDGE){
|
||||
if (myFShape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
BRepAdaptor_Curve aCurve(TopoDS::Edge(myFShape));
|
||||
if (aCurve.GetType() == GeomAbs_Line){
|
||||
//add sensetive element - line
|
||||
if (aCurve.GetType() == GeomAbs_Line)
|
||||
{
|
||||
//add sensetive element - line
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint1, myPoint1);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
else if (aCurve.GetType() == GeomAbs_Circle){
|
||||
else if (aCurve.GetType() == GeomAbs_Circle)
|
||||
{
|
||||
Handle(Geom_Circle) aCircle = Handle(Geom_Circle)::DownCast(aCurve.Curve().Curve());
|
||||
Standard_Real FirstPar = ElCLib::Parameter(aCircle->Circ(), myAttachPoint1),
|
||||
LastPar = ElCLib::Parameter(aCircle->Circ(), myPoint1);
|
||||
if (LastPar < FirstPar ) LastPar+=M_PI*2;
|
||||
Handle(Select3D_SensitiveCircle) circ = new Select3D_SensitiveCircle (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
aSelection->Add( circ );
|
||||
if (LastPar < FirstPar ) LastPar += M_PI * 2;
|
||||
Handle(Select3D_SensitivePoly) circ = new Select3D_SensitivePoly (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
aSelection->Add (circ);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint1, myPoint1);
|
||||
aSelection->Add( seg );
|
||||
}
|
||||
|
||||
if (mySShape.ShapeType() == TopAbs_EDGE){
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
|
||||
if (mySShape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
BRepAdaptor_Curve aCurve(TopoDS::Edge(mySShape));
|
||||
if (aCurve.GetType() == GeomAbs_Line) {
|
||||
if (aCurve.GetType() == GeomAbs_Line)
|
||||
{
|
||||
//add sensetive element - line
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint2, myPoint2);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
else if (aCurve.GetType() == GeomAbs_Circle){
|
||||
else if (aCurve.GetType() == GeomAbs_Circle)
|
||||
{
|
||||
Handle(Geom_Circle) aCircle = Handle(Geom_Circle)::DownCast(aCurve.Curve().Curve());
|
||||
Standard_Real FirstPar = ElCLib::Parameter(aCircle->Circ(), myAttachPoint2),
|
||||
LastPar = ElCLib::Parameter(aCircle->Circ(), myPoint2);
|
||||
if (LastPar < FirstPar ) LastPar+=M_PI*2;
|
||||
Handle(Select3D_SensitiveCircle) circ = new Select3D_SensitiveCircle (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
aSelection->Add( circ );
|
||||
if (LastPar < FirstPar) LastPar += M_PI * 2;
|
||||
Handle(Select3D_SensitivePoly) circ = new Select3D_SensitivePoly (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
aSelection->Add (circ);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint2, myPoint2);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
|
||||
if (myShape3.ShapeType() == TopAbs_EDGE){
|
||||
if (myShape3.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
BRepAdaptor_Curve aCurve(TopoDS::Edge(myShape3));
|
||||
if (aCurve.GetType() == GeomAbs_Line) {
|
||||
if (aCurve.GetType() == GeomAbs_Line)
|
||||
{
|
||||
//add sensetive element - line
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint3, myPoint3);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
else if (aCurve.GetType() == GeomAbs_Circle){
|
||||
else if (aCurve.GetType() == GeomAbs_Circle)
|
||||
{
|
||||
Handle(Geom_Circle) aCircle = Handle(Geom_Circle)::DownCast(aCurve.Curve().Curve());
|
||||
Standard_Real FirstPar = ElCLib::Parameter(aCircle->Circ(), myAttachPoint3),
|
||||
LastPar = ElCLib::Parameter(aCircle->Circ(), myPoint3);
|
||||
if (LastPar < FirstPar ) LastPar+=M_PI*2;
|
||||
Handle(Select3D_SensitiveCircle) circ = new Select3D_SensitiveCircle (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
aSelection->Add( circ );
|
||||
if (LastPar < FirstPar) LastPar += M_PI * 2;
|
||||
Handle(Select3D_SensitivePoly) circ = new Select3D_SensitivePoly (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
aSelection->Add (circ);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint3, myPoint3);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint3, myPoint3);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
|
||||
if (myShape4.ShapeType() == TopAbs_EDGE){
|
||||
if (myShape4.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
BRepAdaptor_Curve aCurve(TopoDS::Edge(myShape4));
|
||||
if (aCurve.GetType() == GeomAbs_Line) {
|
||||
if (aCurve.GetType() == GeomAbs_Line)
|
||||
{
|
||||
//add sensetive element - line
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint4, myPoint4);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
else if (aCurve.GetType() == GeomAbs_Circle){
|
||||
else if (aCurve.GetType() == GeomAbs_Circle)
|
||||
{
|
||||
Handle(Geom_Circle) aCircle = Handle(Geom_Circle)::DownCast(aCurve.Curve().Curve());
|
||||
Standard_Real FirstPar = ElCLib::Parameter(aCircle->Circ(), myAttachPoint4),
|
||||
LastPar = ElCLib::Parameter(aCircle->Circ(), myPoint4);
|
||||
if (LastPar < FirstPar ) LastPar+=M_PI*2;
|
||||
Handle(Select3D_SensitiveCircle) circ = new Select3D_SensitiveCircle (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
if (LastPar < FirstPar) LastPar += M_PI * 2;
|
||||
Handle(Select3D_SensitivePoly) circ = new Select3D_SensitivePoly (own, aCircle->Circ(), FirstPar, LastPar);
|
||||
aSelection->Add( circ );
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
seg = new Select3D_SensitiveSegment( own, myAttachPoint4, myPoint4);
|
||||
aSelection->Add( seg );
|
||||
aSelection->Add (seg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <OSD_FileSystem.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_Parallel.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <RWGltf_GltfAccessorLayout.hxx>
|
||||
@@ -170,6 +171,72 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_DRACO
|
||||
//! Functor for parallel execution of encoding meshes to Draco buffers.
|
||||
class DracoEncodingFunctor
|
||||
{
|
||||
public:
|
||||
|
||||
DracoEncodingFunctor (const Message_ProgressRange& theProgress,
|
||||
draco::Encoder& theDracoEncoder,
|
||||
const std::vector<std::shared_ptr<RWGltf_CafWriter::Mesh>>& theMeshes,
|
||||
std::vector<std::shared_ptr<draco::EncoderBuffer>>& theEncoderBuffers)
|
||||
: myProgress(theProgress, "Draco compression", Max(1, int(theMeshes.size()))),
|
||||
myDracoEncoder(&theDracoEncoder),
|
||||
myRanges(0, int(theMeshes.size()) - 1),
|
||||
myMeshes(&theMeshes),
|
||||
myEncoderBuffers(&theEncoderBuffers)
|
||||
{
|
||||
for (int anIndex = 0; anIndex != int(theMeshes.size()); ++anIndex)
|
||||
{
|
||||
myRanges.SetValue(anIndex, myProgress.Next());
|
||||
}
|
||||
}
|
||||
|
||||
void operator () (int theMeshIndex) const
|
||||
{
|
||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& aCurrentMesh = myMeshes->at(theMeshIndex);
|
||||
if (aCurrentMesh->NodesVec.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Message_ProgressScope aScope(myRanges[theMeshIndex], NULL, 1);
|
||||
|
||||
draco::Mesh aMesh;
|
||||
writeNodesToDracoMesh (aMesh, aCurrentMesh->NodesVec);
|
||||
|
||||
if (!aCurrentMesh->NormalsVec.empty())
|
||||
{
|
||||
writeNormalsToDracoMesh (aMesh, aCurrentMesh->NormalsVec);
|
||||
}
|
||||
|
||||
if (!aCurrentMesh->TexCoordsVec.empty())
|
||||
{
|
||||
writeTexCoordsToDracoMesh (aMesh, aCurrentMesh->TexCoordsVec);
|
||||
}
|
||||
|
||||
writeIndicesToDracoMesh (aMesh, aCurrentMesh->IndicesVec);
|
||||
|
||||
std::shared_ptr<draco::EncoderBuffer> anEncoderBuffer = std::make_shared<draco::EncoderBuffer>();
|
||||
draco::Status aStatus = myDracoEncoder->EncodeMeshToBuffer (aMesh, anEncoderBuffer.get());
|
||||
if (aStatus.ok())
|
||||
{
|
||||
myEncoderBuffers->at(theMeshIndex) = anEncoderBuffer;
|
||||
}
|
||||
|
||||
aScope.Next();
|
||||
}
|
||||
|
||||
private:
|
||||
Message_ProgressScope myProgress;
|
||||
draco::Encoder* myDracoEncoder;
|
||||
NCollection_Array1<Message_ProgressRange> myRanges;
|
||||
const std::vector<std::shared_ptr<RWGltf_CafWriter::Mesh>>* myMeshes;
|
||||
std::vector<std::shared_ptr<draco::EncoderBuffer>>* myEncoderBuffers;
|
||||
};
|
||||
#endif
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
@@ -185,7 +252,8 @@ RWGltf_CafWriter::RWGltf_CafWriter (const TCollection_AsciiString& theFile,
|
||||
myToEmbedTexturesInGlb (true),
|
||||
myToMergeFaces (false),
|
||||
myToSplitIndices16 (false),
|
||||
myBinDataLen64 (0)
|
||||
myBinDataLen64 (0),
|
||||
myToParallel (false)
|
||||
{
|
||||
myCSTrsf.SetOutputLengthUnit (1.0); // meters
|
||||
myCSTrsf.SetOutputCoordinateSystem (RWMesh_CoordinateSystem_glTF);
|
||||
@@ -537,6 +605,8 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
myBinDataMap.Clear();
|
||||
myBinDataLen64 = 0;
|
||||
|
||||
Message_ProgressScope aScope(theProgress, "Write binary data", myDracoParameters.DracoCompression ? 2 : 1);
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aBinFile = aFileSystem->OpenOStream (myBinFileNameFull, std::ios::out | std::ios::binary);
|
||||
if (aBinFile.get() == NULL
|
||||
@@ -546,7 +616,7 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
return false;
|
||||
}
|
||||
|
||||
Message_ProgressScope aPSentryBin (theProgress, "Binary data", 4);
|
||||
Message_ProgressScope aPSentryBin (aScope.Next(), "Binary data", 4);
|
||||
const RWGltf_GltfArrayType anArrTypes[4] =
|
||||
{
|
||||
RWGltf_GltfArrayType_Position,
|
||||
@@ -797,7 +867,6 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
#ifdef HAVE_DRACO
|
||||
OSD_Timer aDracoTimer;
|
||||
aDracoTimer.Start();
|
||||
int aBuffId = 0;
|
||||
draco::Encoder aDracoEncoder;
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::POSITION, myDracoParameters.QuantizePositionBits);
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::NORMAL, myDracoParameters.QuantizeNormalBits);
|
||||
@@ -805,38 +874,23 @@ bool RWGltf_CafWriter::writeBinData (const Handle(TDocStd_Document)& theDocument
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::COLOR, myDracoParameters.QuantizeColorBits);
|
||||
aDracoEncoder.SetAttributeQuantization (draco::GeometryAttribute::GENERIC, myDracoParameters.QuantizeGenericBits);
|
||||
aDracoEncoder.SetSpeedOptions (myDracoParameters.CompressionLevel, myDracoParameters.CompressionLevel);
|
||||
for (size_t aMeshInd = 0; aMeshInd != aMeshes.size(); ++aMeshInd)
|
||||
|
||||
std::vector<std::shared_ptr<draco::EncoderBuffer>> anEncoderBuffers(aMeshes.size());
|
||||
DracoEncodingFunctor aFunctor (aScope.Next(), aDracoEncoder, aMeshes, anEncoderBuffers);
|
||||
OSD_Parallel::For (0, int(aMeshes.size()), aFunctor, !myToParallel);
|
||||
|
||||
for (size_t aBuffInd = 0; aBuffInd != anEncoderBuffers.size(); ++aBuffInd)
|
||||
{
|
||||
const std::shared_ptr<RWGltf_CafWriter::Mesh>& aCurrentMesh = aMeshes[aMeshInd];
|
||||
if (aCurrentMesh->NodesVec.empty())
|
||||
if (anEncoderBuffers.at(aBuffInd).get() == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
draco::Mesh aDracoMesh;
|
||||
writeNodesToDracoMesh (aDracoMesh, aCurrentMesh->NodesVec);
|
||||
if (!aCurrentMesh->NormalsVec.empty())
|
||||
{
|
||||
writeNormalsToDracoMesh (aDracoMesh, aCurrentMesh->NormalsVec);
|
||||
}
|
||||
if (!aCurrentMesh->TexCoordsVec.empty())
|
||||
{
|
||||
writeTexCoordsToDracoMesh (aDracoMesh, aCurrentMesh->TexCoordsVec);
|
||||
}
|
||||
writeIndicesToDracoMesh (aDracoMesh, aCurrentMesh->IndicesVec);
|
||||
|
||||
draco::EncoderBuffer anEncoderBuff;
|
||||
draco::Status aStatus = aDracoEncoder.EncodeMeshToBuffer (aDracoMesh, &anEncoderBuff);
|
||||
if (!aStatus.ok())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: mesh cannot be encoded in draco buffer."));
|
||||
Message::SendFail(TCollection_AsciiString("Error: mesh not encoded in draco buffer."));
|
||||
return false;
|
||||
}
|
||||
|
||||
RWGltf_GltfBufferView aBuffViewDraco;
|
||||
aBuffViewDraco.Id = aBuffId++;
|
||||
aBuffViewDraco.Id = (int)aBuffInd;
|
||||
aBuffViewDraco.ByteOffset = aBinFile->tellp();
|
||||
aBinFile->write (anEncoderBuff.data(), std::streamsize(anEncoderBuff.size()));
|
||||
const draco::EncoderBuffer& anEncoderBuff = *anEncoderBuffers.at(aBuffInd);
|
||||
aBinFile->write(anEncoderBuff.data(), std::streamsize(anEncoderBuff.size()));
|
||||
if (!aBinFile->good())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("File '") + myBinFileNameFull + "' cannot be written");
|
||||
|
@@ -125,6 +125,12 @@ public:
|
||||
//! May reduce binary data size thanks to smaller triangle indexes.
|
||||
void SetSplitIndices16 (bool theToSplit) { myToSplitIndices16 = theToSplit; }
|
||||
|
||||
//! Return TRUE if multithreaded optimizations are allowed; FALSE by default.
|
||||
bool ToParallel() const { return myToParallel; }
|
||||
|
||||
//! Setup multithreaded execution.
|
||||
void SetParallel (bool theToParallel) { myToParallel = theToParallel; }
|
||||
|
||||
//! Return Draco parameters
|
||||
const RWGltf_DracoParameters& CompressionParameters() const { return myDracoParameters; }
|
||||
|
||||
@@ -397,6 +403,7 @@ protected:
|
||||
int64_t myBinDataLen64; //!< length of binary file
|
||||
|
||||
std::vector<RWGltf_GltfBufferView> myBuffViewsDraco; //!< vector of buffers view with compression data
|
||||
Standard_Boolean myToParallel; //!< flag to use multithreading; FALSE by default
|
||||
RWGltf_DracoParameters myDracoParameters; //!< Draco parameters
|
||||
};
|
||||
|
||||
|
@@ -3365,17 +3365,17 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (anUnit.IsNull()) continue;
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
STEPConstruct_UnitContext anUnitCtxUpperBound;
|
||||
anUnitCtxUpperBound.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||
{
|
||||
convertAngleValue(anUnitCtx, aVal);
|
||||
convertAngleValue(anUnitCtxUpperBound, aVal);
|
||||
}
|
||||
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxUpperBound.LengthFactor() > 0.) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtxUpperBound.LengthFactor();
|
||||
}
|
||||
aDim3 = aVal;
|
||||
|
||||
@@ -3401,16 +3401,17 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (anUnit.IsNull()) continue;
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
NU = anUnit.NamedUnit();
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_LengthMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
else if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
STEPConstruct_UnitContext anUnitCtxLowerBound;
|
||||
anUnitCtxLowerBound.ComputeFactors(NU);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||
{
|
||||
convertAngleValue(anUnitCtx, aVal);
|
||||
convertAngleValue(anUnitCtxLowerBound, aVal);
|
||||
}
|
||||
else if ((aMWU->IsKind(STANDARD_TYPE(StepBasic_MeasureWithUnit)) && anUnitCtxLowerBound.LengthFactor() > 0.) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI)))
|
||||
{
|
||||
aVal = aVal * anUnitCtxLowerBound.LengthFactor();
|
||||
}
|
||||
aDim2 = Abs(aVal);
|
||||
}
|
||||
|
@@ -341,6 +341,43 @@ void STEPControl_ActorWrite::mergeInfoForNM(const Handle(Transfer_FinderProcess)
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : separateShapeToSoloVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPControl_ActorWrite::separateShapeToSoloVertex(const TopoDS_Shape& theShape,
|
||||
TopTools_SequenceOfShape& theVertices)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
switch (theShape.ShapeType())
|
||||
{
|
||||
case TopAbs_COMPOUND:
|
||||
{
|
||||
for (TopoDS_Iterator anIter(theShape); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (!separateShapeToSoloVertex(anIter.Value(), theVertices))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TopAbs_VERTEX:
|
||||
{
|
||||
theVertices.Append(theShape);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
theVertices.Clear();
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMode
|
||||
@@ -814,42 +851,49 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
|
||||
// create a list of items to translate
|
||||
Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
|
||||
|
||||
Standard_Boolean isSeparateVertices =
|
||||
|
||||
Standard_Boolean isSeparateVertices =
|
||||
Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
|
||||
// PTV 16.09.2002 OCC725 separate shape from solo vertices.
|
||||
Standard_Boolean isOnlyVertices = Standard_False;
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
||||
Standard_Integer countVrtx = 0;
|
||||
Standard_Integer countSh = 0;
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND && isSeparateVertices)
|
||||
{
|
||||
TopoDS_Compound aNewShape, aCompOfVrtx;
|
||||
BRep_Builder aB;
|
||||
aB.MakeCompound(aNewShape);
|
||||
aB.MakeCompound(aCompOfVrtx);
|
||||
TopoDS_Iterator anCompIt(theShape);
|
||||
if (isSeparateVertices) {
|
||||
for (; anCompIt.More(); anCompIt.Next()) {
|
||||
TopoDS_Shape aCurSh = anCompIt.Value();
|
||||
if (aCurSh.ShapeType() != TopAbs_VERTEX) {
|
||||
aB.Add(aNewShape, aCurSh);
|
||||
countSh++;
|
||||
BRep_Builder aBuilder;
|
||||
aBuilder.MakeCompound(aNewShape);
|
||||
aBuilder.MakeCompound(aCompOfVrtx);
|
||||
TopTools_SequenceOfShape aVertices;
|
||||
isOnlyVertices = separateShapeToSoloVertex(theShape, aVertices);
|
||||
if (!isOnlyVertices)
|
||||
{
|
||||
for (TopoDS_Iterator anCompIt(theShape); anCompIt.More(); anCompIt.Next())
|
||||
{
|
||||
const TopoDS_Shape& aCurSh = anCompIt.Value();
|
||||
TopTools_SequenceOfShape aVerticesOfSubSh;
|
||||
if (separateShapeToSoloVertex(aCurSh, aVerticesOfSubSh))
|
||||
{
|
||||
aVertices.Append(aVerticesOfSubSh);
|
||||
}
|
||||
else {
|
||||
aB.Add(aCompOfVrtx, aCurSh);
|
||||
countVrtx++;
|
||||
else
|
||||
{
|
||||
aBuilder.Add(aNewShape, aCurSh);
|
||||
}
|
||||
}
|
||||
// replace the shapes
|
||||
if (countSh)
|
||||
theShape = aNewShape;
|
||||
if (countVrtx)
|
||||
RepItemSeq->Append(aCompOfVrtx);
|
||||
if (countSh == 0)
|
||||
isOnlyVertices = Standard_True;
|
||||
theShape = aNewShape;
|
||||
}
|
||||
}
|
||||
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
||||
for (TopTools_HSequenceOfShape::Iterator anIterV(aVertices);
|
||||
anIterV.More(); anIterV.Next())
|
||||
{
|
||||
aBuilder.Add(aCompOfVrtx, anIterV.Value());
|
||||
}
|
||||
if (!aVertices.IsEmpty())
|
||||
{
|
||||
RepItemSeq->Append(aCompOfVrtx);
|
||||
}
|
||||
}
|
||||
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND)
|
||||
{
|
||||
TopExp_Explorer SolidExp, ShellExp, FaceExp;
|
||||
if (mymode != STEPControl_GeometricCurveSet) {
|
||||
for (SolidExp.Init(theShape, TopAbs_SOLID);
|
||||
|
@@ -117,6 +117,15 @@ private:
|
||||
//! bind already written shared faces to STEP entity for non-manifold
|
||||
Standard_EXPORT void mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP, const Handle(Standard_Transient) &theInfo) const;
|
||||
|
||||
//! Gets sequence of vertices of all compounds level by recursive
|
||||
//! @param[in] theShape shape to iterate, checked for compound type and sub shapes vertex type
|
||||
//! @param[out] theVertices sequence of found vertices via recursively iterate of shape
|
||||
//! @return TRUE if one or more vertex was found and all shapes were compound or vertex
|
||||
Standard_Boolean separateShapeToSoloVertex(const TopoDS_Shape& theShape,
|
||||
TopTools_SequenceOfShape& theVertices);
|
||||
|
||||
|
||||
|
||||
Standard_Integer mygroup;
|
||||
Standard_Real mytoler;
|
||||
STEPConstruct_ContextTool myContext;
|
||||
|
@@ -16,195 +16,29 @@
|
||||
|
||||
#include <Select3D_SensitiveCircle.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Select3D_SensitiveTriangle.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveCircle,Select3D_SensitivePoly)
|
||||
|
||||
namespace
|
||||
{
|
||||
static Standard_Integer GetCircleNbPoints (const gp_Circ& theCircle,
|
||||
const Standard_Integer theNbPnts)
|
||||
{
|
||||
// Check if number of points is invalid.
|
||||
// In this case myPolyg raises Standard_ConstructionError
|
||||
// exception (see constructor below).
|
||||
if (theNbPnts <= 0)
|
||||
return 0;
|
||||
|
||||
if (theCircle.Radius() > Precision::Confusion())
|
||||
return 2 * theNbPnts + 1;
|
||||
|
||||
// The radius is too small and circle degenerates into point
|
||||
return 1;
|
||||
}
|
||||
|
||||
//! Definition of circle polyline
|
||||
static void initCircle (Select3D_PointData& thePolygon,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Integer theNbPnts)
|
||||
{
|
||||
const Standard_Real aStep = (theU2 - theU1) / theNbPnts;
|
||||
const Standard_Real aRadius = theCircle.Radius();
|
||||
Standard_Integer aPntIdx = 0;
|
||||
Standard_Real aCurU = theU1;
|
||||
gp_Pnt aP1;
|
||||
gp_Vec aV1;
|
||||
for (Standard_Integer anIndex = 1; anIndex <= theNbPnts; ++anIndex, aCurU += aStep)
|
||||
{
|
||||
ElCLib::CircleD1 (aCurU, theCircle.Position(), theCircle.Radius(), aP1, aV1);
|
||||
thePolygon.SetPnt (aPntIdx++, aP1);
|
||||
|
||||
aV1.Normalize();
|
||||
const gp_Pnt aP2 = aP1.XYZ() + aV1.XYZ() * Tan (aStep * 0.5) * aRadius;
|
||||
thePolygon.SetPnt (aPntIdx++, aP2);
|
||||
}
|
||||
aP1 = ElCLib::CircleValue (theU2, theCircle.Position(), theCircle.Radius());
|
||||
thePolygon.SetPnt (theNbPnts * 2, aP1);
|
||||
}
|
||||
}
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveCircle, Select3D_SensitiveEntity)
|
||||
|
||||
//=======================================================================
|
||||
//function : Select3D_SensitiveCircle (constructor)
|
||||
//purpose : Definition of a sensitive circle
|
||||
//=======================================================================
|
||||
Select3D_SensitiveCircle::Select3D_SensitiveCircle(const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitivePoly (theOwnerId, !theIsFilled, GetCircleNbPoints (theCircle, theNbPnts)),
|
||||
myCircle (theCircle),
|
||||
myStart (0.0),
|
||||
myEnd (2.0 * M_PI)
|
||||
{
|
||||
mySensType = theIsFilled ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
|
||||
myCenter3D = theCircle.Position().Location();
|
||||
if (myPolyg.Size() != 1)
|
||||
{
|
||||
initCircle (myPolyg, theCircle, myStart, myEnd, theNbPnts);
|
||||
}
|
||||
// Radius = 0.0
|
||||
else
|
||||
{
|
||||
myPolyg.SetPnt (0, theCircle.Position().Location());
|
||||
}
|
||||
|
||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
SetSensitivityFactor (6);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select3D_SensitiveCircle (constructor)
|
||||
//purpose : Definition of a sensitive arc
|
||||
//=======================================================================
|
||||
Select3D_SensitiveCircle::Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitivePoly (theOwnerId, !theIsFilled, GetCircleNbPoints (theCircle, theNbPnts)),
|
||||
myCircle (theCircle),
|
||||
myStart (Min (theU1, theU2)),
|
||||
myEnd (Max (theU1, theU2))
|
||||
const Standard_Boolean theIsFilled)
|
||||
: Select3D_SensitiveEntity (theOwnerId)
|
||||
{
|
||||
mySensType = theIsFilled ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
|
||||
myCenter3D = theCircle.Position().Location();
|
||||
if (myPolyg.Size() != 1)
|
||||
{
|
||||
initCircle (myPolyg, theCircle, myStart, myEnd, theNbPnts);
|
||||
}
|
||||
else
|
||||
{
|
||||
myPolyg.SetPnt (0, theCircle.Position().Location());
|
||||
}
|
||||
myRadius = theCircle.Radius();
|
||||
myTrsf.SetTransformation (theCircle.Position(), gp::XOY());
|
||||
|
||||
mySensType = theIsFilled ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
|
||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
SetSensitivityFactor (6);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select3D_SensitiveCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Select3D_SensitiveCircle::Select3D_SensitiveCircle(const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const Handle(TColgp_HArray1OfPnt)& thePnts3d,
|
||||
const Standard_Boolean theIsFilled)
|
||||
: Select3D_SensitivePoly (theOwnerId, thePnts3d, static_cast<Standard_Boolean> (!theIsFilled)),
|
||||
myStart (0),
|
||||
myEnd (0)
|
||||
{
|
||||
mySensType = theIsFilled ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
|
||||
|
||||
if (myPolyg.Size() != 1)
|
||||
computeCenter3D();
|
||||
else
|
||||
myCenter3D = myPolyg.Pnt (0);
|
||||
|
||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
SetSensitivityFactor (6);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select3D_SensitiveCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Select3D_SensitiveCircle::Select3D_SensitiveCircle(const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const TColgp_Array1OfPnt& thePnts3d,
|
||||
const Standard_Boolean theIsFilled)
|
||||
: Select3D_SensitivePoly (theOwnerId, thePnts3d, !theIsFilled),
|
||||
myStart (0),
|
||||
myEnd (0)
|
||||
{
|
||||
mySensType = theIsFilled ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
|
||||
|
||||
if (myPolyg.Size() != 1)
|
||||
computeCenter3D();
|
||||
else
|
||||
myCenter3D = myPolyg.Pnt (0);
|
||||
|
||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
SetSensitivityFactor (6);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : BVH
|
||||
// purpose : Builds BVH tree for a circle's edge segments if needed
|
||||
//=======================================================================
|
||||
void Select3D_SensitiveCircle::BVH()
|
||||
{
|
||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
Select3D_SensitivePoly::BVH();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : ToBuildBVH
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Select3D_SensitiveCircle::ToBuildBVH() const
|
||||
{
|
||||
if (mySensType != Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Select3D_SensitivePoly::ToBuildBVH();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Matches
|
||||
// purpose : Checks whether the circle overlaps current selecting volume
|
||||
@@ -212,40 +46,26 @@ Standard_Boolean Select3D_SensitiveCircle::ToBuildBVH() const
|
||||
Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult)
|
||||
{
|
||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||
const Standard_Boolean aIsFilled = mySensType == Select3D_TOS_INTERIOR;
|
||||
|
||||
if (theMgr.GetActiveSelectionType() != SelectMgr_SelectionType_Point)
|
||||
{
|
||||
if (!Select3D_SensitivePoly::Matches (theMgr, thePickResult))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else if (mySensType == Select3D_TOS_INTERIOR)
|
||||
{
|
||||
Handle(TColgp_HArray1OfPnt) anArrayOfPnt;
|
||||
Points3D (anArrayOfPnt);
|
||||
if (!theMgr.IsOverlapAllowed())
|
||||
{
|
||||
if (theMgr.GetActiveSelectionType() == SelectMgr_SelectionType_Polyline)
|
||||
{
|
||||
SelectBasics_PickResult aDummy;
|
||||
return theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), mySensType, aDummy);
|
||||
}
|
||||
for (Standard_Integer aPntIdx = anArrayOfPnt->Lower(); aPntIdx <= anArrayOfPnt->Upper(); ++aPntIdx)
|
||||
{
|
||||
if (!theMgr.OverlapsPoint (anArrayOfPnt->Value(aPntIdx)))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
bool isInside = true;
|
||||
return theMgr.OverlapsCircle (myRadius, myTrsf, aIsFilled, &isInside) && isInside;
|
||||
}
|
||||
|
||||
if (!theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), Select3D_TOS_INTERIOR, thePickResult))
|
||||
else
|
||||
{
|
||||
return Standard_False;
|
||||
return theMgr.OverlapsCircle (myRadius, myTrsf, aIsFilled, NULL);
|
||||
}
|
||||
thePickResult.SetDistToGeomCenter(distanceToCOG(theMgr));
|
||||
}
|
||||
if (!theMgr.OverlapsCircle (myRadius, myTrsf, aIsFilled, thePickResult))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
thePickResult.SetDistToGeomCenter (theMgr.DistToGeometryCenter (CenterOfGeometry()));
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -254,81 +74,36 @@ Standard_Boolean Select3D_SensitiveCircle::Matches (SelectBasics_SelectingVolume
|
||||
//function : GetConnected
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Select3D_SensitiveEntity) Select3D_SensitiveCircle::GetConnected()
|
||||
{
|
||||
Standard_Boolean isFilled = mySensType == Select3D_TOS_INTERIOR;
|
||||
// Create a copy of this
|
||||
Handle(Select3D_SensitiveEntity) aNewEntity;
|
||||
// this was constructed using Handle(Geom_Circle)
|
||||
if (!Precision::IsInfinite (myCircle.Radius()))
|
||||
{
|
||||
if ((myEnd - myStart) > Precision::Confusion())
|
||||
{
|
||||
// Arc
|
||||
aNewEntity = new Select3D_SensitiveCircle (myOwnerId, myCircle, myStart, myEnd, isFilled);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Circle
|
||||
aNewEntity = new Select3D_SensitiveCircle (myOwnerId, myCircle, isFilled);
|
||||
}
|
||||
}
|
||||
// this was constructed using TColgp_Array1OfPnt
|
||||
else
|
||||
{
|
||||
Standard_Integer aSize = myPolyg.Size();
|
||||
TColgp_Array1OfPnt aPolyg (1, aSize);
|
||||
for(Standard_Integer anIndex = 1; anIndex <= aSize; ++anIndex)
|
||||
{
|
||||
aPolyg.SetValue(anIndex, myPolyg.Pnt (anIndex-1));
|
||||
}
|
||||
aNewEntity = new Select3D_SensitiveCircle (myOwnerId, aPolyg, isFilled);
|
||||
}
|
||||
|
||||
Standard_Boolean anIsFilled = mySensType == Select3D_TOS_INTERIOR;
|
||||
Handle(Select3D_SensitiveEntity) aNewEntity = new Select3D_SensitiveCircle (myOwnerId,
|
||||
Circle(),
|
||||
anIsFilled);
|
||||
return aNewEntity;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeCenter3D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Select3D_SensitiveCircle::computeCenter3D()
|
||||
//==================================================
|
||||
// Function: BoundingBox
|
||||
// Purpose :
|
||||
//==================================================
|
||||
Select3D_BndBox3d Select3D_SensitiveCircle::BoundingBox()
|
||||
{
|
||||
gp_XYZ aCenter;
|
||||
Standard_Integer aNbPnts = myPolyg.Size();
|
||||
if (aNbPnts != 1)
|
||||
{
|
||||
// The mass of points system
|
||||
Standard_Integer aMass = aNbPnts - 1;
|
||||
// Find the circle barycenter
|
||||
for (Standard_Integer anIndex = 0; anIndex < aNbPnts - 1; ++anIndex)
|
||||
{
|
||||
aCenter += myPolyg.Pnt(anIndex);
|
||||
}
|
||||
myCenter3D = aCenter / aMass;
|
||||
}
|
||||
else
|
||||
{
|
||||
myCenter3D = myPolyg.Pnt(0);
|
||||
}
|
||||
Graphic3d_Mat4d aTrsf;
|
||||
myTrsf.GetMat4 (aTrsf);
|
||||
|
||||
Select3D_BndBox3d aBox (SelectMgr_Vec3 (-myRadius, -myRadius, 0),
|
||||
SelectMgr_Vec3 (myRadius, myRadius, 0));
|
||||
aBox.Transform (aTrsf);
|
||||
|
||||
return aBox;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CenterOfGeometry
|
||||
// purpose : Returns center of the circle. If location transformation
|
||||
// is set, it will be applied
|
||||
//=======================================================================
|
||||
//==================================================
|
||||
// Function: CenterOfGeometry
|
||||
// Purpose :
|
||||
//==================================================
|
||||
gp_Pnt Select3D_SensitiveCircle::CenterOfGeometry() const
|
||||
{
|
||||
return myCenter3D;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : distanceToCOG
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Real Select3D_SensitiveCircle::distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr)
|
||||
{
|
||||
return theMgr.DistToGeometryCenter (myCenter3D);
|
||||
return gp_Pnt (myTrsf.TranslationPart());
|
||||
}
|
||||
|
@@ -17,93 +17,70 @@
|
||||
#ifndef _Select3D_SensitiveCircle_HeaderFile
|
||||
#define _Select3D_SensitiveCircle_HeaderFile
|
||||
|
||||
#include <gp_Circ.hxx>
|
||||
#include <Select3D_SensitivePoly.hxx>
|
||||
#include <Select3D_TypeOfSensitivity.hxx>
|
||||
#include <SelectMgr_SelectingVolumeManager.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
|
||||
//! A framework to define sensitive 3D arcs and circles.
|
||||
//! In some cases this class can raise Standard_ConstructionError and
|
||||
//! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
|
||||
class Select3D_SensitiveCircle : public Select3D_SensitivePoly
|
||||
#include <gp_Circ.hxx>
|
||||
|
||||
//! A framework to define sensitive 3D circles.
|
||||
class Select3D_SensitiveCircle : public Select3D_SensitiveEntity
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCircle, Select3D_SensitivePoly)
|
||||
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCircle, Select3D_SensitiveEntity)
|
||||
public:
|
||||
|
||||
//! Constructs the sensitive circle object defined by the
|
||||
//! owner theOwnerId, the circle theCircle and the boolean theIsFilled.
|
||||
Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Boolean theIsFilled = Standard_False);
|
||||
|
||||
//! Constructs the sensitive circle object defined by the
|
||||
//! owner theOwnerId, the circle theCircle, the boolean
|
||||
//! theIsFilled and the number of points theNbPnts.
|
||||
Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Boolean theIsFilled = Standard_False,
|
||||
const Standard_Integer theNbPnts = 12);
|
||||
|
||||
//! Constructs the sensitive arc object defined by the
|
||||
//! owner theOwnerId, the circle theCircle, the parameters theU1
|
||||
//! and theU2, the boolean theIsFilled and the number of points theNbPnts.
|
||||
//! theU1 and theU2 define the first and last points of the arc on theCircle.
|
||||
Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theIsFilled = Standard_False,
|
||||
const Standard_Integer theNbPnts = 12);
|
||||
|
||||
//! Constructs the sensitive circle object defined by the
|
||||
//! owner theOwnerId, the array of triangles thePnts3d, and the boolean theIsFilled.
|
||||
//! thePnts3d is an array of consecutive triangles on the
|
||||
//! circle. The triangle i+1 lies on the intersection of the
|
||||
//! tangents to the circle of i and i+2. Note, that the first point of thePnts3d
|
||||
//! must be equal to the last point of thePnts3d.
|
||||
Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const Handle(TColgp_HArray1OfPnt)& thePnts3d,
|
||||
const Standard_Boolean theIsFilled = Standard_False);
|
||||
|
||||
//! Constructs the sensitive circle object defined by the
|
||||
//! owner theOwnerId, the array of points thePnts3d, and the boolean theIsFilled.
|
||||
//! If the length of thePnts3d is more then 1, the first point of thePnts3d
|
||||
//! must be equal to the last point of thePnts3d.
|
||||
Standard_EXPORT Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const TColgp_Array1OfPnt& thePnts3d,
|
||||
const Standard_Boolean theIsFilled = Standard_False);
|
||||
Standard_DEPRECATED("Deprecated constructor, theNbPnts parameter will be ignored")
|
||||
Select3D_SensitiveCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const Standard_Integer /*theNbPnts*/)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, theIsFilled)
|
||||
{ }
|
||||
|
||||
//! Checks whether the circle overlaps current selecting volume
|
||||
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
|
||||
|
||||
//! Returns a copy of this sensitive circle
|
||||
Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
|
||||
|
||||
//! Returns center of the circle. If location
|
||||
//! transformation is set, it will be applied
|
||||
//! Returns bounding box of the circle.
|
||||
//! If location transformation is set, it will be applied
|
||||
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
|
||||
|
||||
//! Always returns Standard_False
|
||||
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
|
||||
|
||||
//! Returns the amount of points
|
||||
virtual Standard_Integer NbSubElements() const Standard_OVERRIDE { return 1; }
|
||||
|
||||
//! Returns center of the circle with transformation applied
|
||||
Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
|
||||
|
||||
//! Builds BVH tree for a circle's edge segments if needed
|
||||
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
|
||||
//! The transformation for gp::XOY() with center in gp::Origin(),
|
||||
//! it specifies the position and orientation of the circle.
|
||||
const gp_Trsf& Transformation() const { return myTrsf; }
|
||||
|
||||
//! Returns TRUE if BVH tree is in invalidated state
|
||||
Standard_EXPORT virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE;
|
||||
//! Returns circle
|
||||
gp_Circ Circle() const { return gp_Circ (gp::XOY().Transformed (myTrsf), myRadius); }
|
||||
|
||||
protected:
|
||||
|
||||
//! Calculates distance from the 3d projection of used-picked screen point
|
||||
//! to center of the geometry
|
||||
Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
|
||||
//! Returns circle radius
|
||||
Standard_Real Radius() const { return myRadius; }
|
||||
|
||||
private:
|
||||
|
||||
//! Computes myCenter3D as the barycenter of points from mypolyg3d
|
||||
void computeCenter3D();
|
||||
|
||||
private:
|
||||
|
||||
Select3D_TypeOfSensitivity mySensType; //!< True if type of selection is interior, false otherwise
|
||||
gp_Pnt myCenter3D; //!< Center of a circle
|
||||
gp_Circ myCircle; //!< Points of the circle
|
||||
Standard_Real myStart; //!< Sensitive arc parameter
|
||||
Standard_Real myEnd; //!< Sensitive arc parameter
|
||||
Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: boundary or interior
|
||||
gp_Trsf myTrsf; //!< Circle transformation to apply
|
||||
Standard_Real myRadius; //!< Circle radius
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Select3D_SensitiveCircle, Select3D_SensitivePoly)
|
||||
DEFINE_STANDARD_HANDLE(Select3D_SensitiveCircle, Select3D_SensitiveEntity)
|
||||
|
||||
#endif // _Select3D_SensitiveCircle_HeaderFile
|
||||
|
@@ -25,12 +25,14 @@ Select3D_SensitiveCylinder::Select3D_SensitiveCylinder (const Handle(SelectMgr_E
|
||||
const Standard_Real theBottomRad,
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf)
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow)
|
||||
: Select3D_SensitiveEntity (theOwnerId),
|
||||
myTrsf (theTrsf),
|
||||
myBottomRadius (theBottomRad),
|
||||
myTopRadius (theTopRad),
|
||||
myHeight (theHeight)
|
||||
myHeight (theHeight),
|
||||
myIsHollow (theIsHollow)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -46,14 +48,14 @@ Standard_Boolean Select3D_SensitiveCylinder::Matches (SelectBasics_SelectingVolu
|
||||
if (!theMgr.IsOverlapAllowed())
|
||||
{
|
||||
bool isInside = true;
|
||||
return theMgr.OverlapsCylinder (myBottomRadius, myTopRadius, myHeight, myTrsf, &isInside) && isInside;
|
||||
return theMgr.OverlapsCylinder (myBottomRadius, myTopRadius, myHeight, myTrsf, myIsHollow, &isInside) && isInside;
|
||||
}
|
||||
else
|
||||
{
|
||||
return theMgr.OverlapsCylinder (myBottomRadius, myTopRadius, myHeight, myTrsf, NULL);
|
||||
return theMgr.OverlapsCylinder (myBottomRadius, myTopRadius, myHeight, myTrsf, myIsHollow, NULL);
|
||||
}
|
||||
}
|
||||
if (!theMgr.OverlapsCylinder (myBottomRadius, myTopRadius, myHeight, myTrsf, thePickResult))
|
||||
if (!theMgr.OverlapsCylinder (myBottomRadius, myTopRadius, myHeight, myTrsf, myIsHollow, thePickResult))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -32,7 +32,8 @@ public:
|
||||
const Standard_Real theBottomRad,
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf);
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow = Standard_False);
|
||||
|
||||
//! Checks whether the cylinder overlaps current selecting volume
|
||||
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
@@ -66,11 +67,15 @@ public:
|
||||
//! Returns cylinder height
|
||||
Standard_Real Height() const { return myHeight; }
|
||||
|
||||
//! Returns true if the cylinder is empty inside
|
||||
Standard_Boolean IsHollow() const { return myIsHollow; }
|
||||
|
||||
protected:
|
||||
gp_Trsf myTrsf; //!< cylinder transformation to apply
|
||||
Standard_Real myBottomRadius; //!< cylinder bottom radius
|
||||
Standard_Real myTopRadius; //!< cylinder top radius
|
||||
Standard_Real myHeight; //!< cylinder height
|
||||
gp_Trsf myTrsf; //!< cylinder transformation to apply
|
||||
Standard_Real myBottomRadius; //!< cylinder bottom radius
|
||||
Standard_Real myTopRadius; //!< cylinder top radius
|
||||
Standard_Real myHeight; //!< cylinder height
|
||||
Standard_Boolean myIsHollow; //!< true if the cylinder is empty inside
|
||||
};
|
||||
|
||||
#endif // _Select3D_SensitiveSphere_HeaderFile
|
||||
|
@@ -13,8 +13,71 @@
|
||||
|
||||
#include <Select3D_SensitivePoly.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitivePoly,Select3D_SensitiveSet)
|
||||
|
||||
namespace
|
||||
{
|
||||
static Standard_Integer GetCircleNbPoints (const gp_Circ& theCircle,
|
||||
const Standard_Integer theNbPnts,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theIsFilled)
|
||||
{
|
||||
// Check if number of points is invalid.
|
||||
// In this case myPolyg raises Standard_ConstructionError
|
||||
// exception (see constructor below).
|
||||
if (theNbPnts <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (theCircle.Radius() > Precision::Confusion())
|
||||
{
|
||||
const Standard_Boolean isSector = theIsFilled && Abs (Abs (theU2 - theU1) - 2.0 * M_PI) > gp::Resolution();
|
||||
return 2 * theNbPnts + 1 + (isSector ? 2 : 0);
|
||||
}
|
||||
|
||||
// The radius is too small and circle degenerates into point
|
||||
return 1;
|
||||
}
|
||||
|
||||
//! Definition of circle polyline
|
||||
static void initCircle (Select3D_PointData& thePolygon,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const Standard_Integer theNbPnts)
|
||||
{
|
||||
const Standard_Real aStep = (theU2 - theU1) / theNbPnts;
|
||||
const Standard_Real aRadius = theCircle.Radius();
|
||||
Standard_Integer aPntIdx = 0;
|
||||
Standard_Real aCurU = theU1;
|
||||
gp_Pnt aP1;
|
||||
gp_Vec aV1;
|
||||
|
||||
const Standard_Boolean isSector = Abs (theU2 - theU1 - 2.0 * M_PI) > gp::Resolution();
|
||||
|
||||
if (isSector && theIsFilled) { thePolygon.SetPnt (aPntIdx++, theCircle.Location()); }
|
||||
|
||||
for (Standard_Integer anIndex = 1; anIndex <= theNbPnts; ++anIndex, aCurU += aStep)
|
||||
{
|
||||
ElCLib::CircleD1 (aCurU, theCircle.Position(), theCircle.Radius(), aP1, aV1);
|
||||
thePolygon.SetPnt (aPntIdx++, aP1);
|
||||
|
||||
aV1.Normalize();
|
||||
const gp_Pnt aP2 = aP1.XYZ() + aV1.XYZ() * Tan (aStep * 0.5) * aRadius;
|
||||
thePolygon.SetPnt (aPntIdx++, aP2);
|
||||
}
|
||||
aP1 = ElCLib::CircleValue (theU2, theCircle.Position(), theCircle.Radius());
|
||||
thePolygon.SetPnt (aPntIdx++, aP1);
|
||||
|
||||
if (isSector && theIsFilled) { thePolygon.SetPnt (aPntIdx++, theCircle.Location()); }
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function: Select3D_SensitivePoly
|
||||
// Purpose :
|
||||
@@ -23,7 +86,8 @@ Select3D_SensitivePoly::Select3D_SensitivePoly (const Handle(SelectMgr_EntityOwn
|
||||
const TColgp_Array1OfPnt& thePoints,
|
||||
const Standard_Boolean theIsBVHEnabled)
|
||||
: Select3D_SensitiveSet (theOwnerId),
|
||||
myPolyg (thePoints.Upper() - thePoints.Lower() + 1)
|
||||
myPolyg (thePoints.Upper() - thePoints.Lower() + 1),
|
||||
mySensType (Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
Standard_Integer aLowerIdx = thePoints.Lower();
|
||||
Standard_Integer anUpperIdx = thePoints.Upper();
|
||||
@@ -64,7 +128,8 @@ Select3D_SensitivePoly::Select3D_SensitivePoly (const Handle(SelectMgr_EntityOwn
|
||||
const Handle(TColgp_HArray1OfPnt)& thePoints,
|
||||
const Standard_Boolean theIsBVHEnabled)
|
||||
: Select3D_SensitiveSet (theOwnerId),
|
||||
myPolyg (thePoints->Upper() - thePoints->Lower() + 1)
|
||||
myPolyg (thePoints->Upper() - thePoints->Lower() + 1),
|
||||
mySensType (Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
Standard_Integer aLowerIdx = thePoints->Lower();
|
||||
Standard_Integer anUpperIdx = thePoints->Upper();
|
||||
@@ -105,7 +170,8 @@ Select3D_SensitivePoly::Select3D_SensitivePoly (const Handle(SelectMgr_EntityOwn
|
||||
const Standard_Boolean theIsBVHEnabled,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitiveSet (theOwnerId),
|
||||
myPolyg (theNbPnts)
|
||||
myPolyg (theNbPnts),
|
||||
mySensType (Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
if (theIsBVHEnabled)
|
||||
{
|
||||
@@ -119,6 +185,80 @@ Select3D_SensitivePoly::Select3D_SensitivePoly (const Handle(SelectMgr_EntityOwn
|
||||
myIsComputed = Standard_False;
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function: Creation
|
||||
// Purpose :
|
||||
//==================================================
|
||||
Select3D_SensitivePoly::Select3D_SensitivePoly (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitivePoly (theOwnerId, !theIsFilled, GetCircleNbPoints (theCircle, theNbPnts, theU1, theU2, theIsFilled))
|
||||
{
|
||||
mySensType = theIsFilled ? Select3D_TOS_INTERIOR : Select3D_TOS_BOUNDARY;
|
||||
|
||||
if (myPolyg.Size() != 1)
|
||||
{
|
||||
initCircle (myPolyg, theCircle, Min (theU1, theU2), Max (theU1, theU2), theIsFilled, theNbPnts);
|
||||
}
|
||||
else
|
||||
{
|
||||
myPolyg.SetPnt (0, theCircle.Position().Location());
|
||||
}
|
||||
|
||||
if (!theIsFilled)
|
||||
{
|
||||
SetSensitivityFactor (6);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Matches
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Select3D_SensitivePoly::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult)
|
||||
{
|
||||
if (mySensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
if (!Select3D_SensitiveSet::Matches (theMgr, thePickResult))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else if (mySensType == Select3D_TOS_INTERIOR)
|
||||
{
|
||||
Handle(TColgp_HArray1OfPnt) anArrayOfPnt;
|
||||
Points3D (anArrayOfPnt);
|
||||
if (!theMgr.IsOverlapAllowed())
|
||||
{
|
||||
if (theMgr.GetActiveSelectionType() == SelectMgr_SelectionType_Polyline)
|
||||
{
|
||||
SelectBasics_PickResult aDummy;
|
||||
return theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), mySensType, aDummy);
|
||||
}
|
||||
for (Standard_Integer aPntIdx = anArrayOfPnt->Lower(); aPntIdx <= anArrayOfPnt->Upper(); ++aPntIdx)
|
||||
{
|
||||
if (!theMgr.OverlapsPoint (anArrayOfPnt->Value(aPntIdx)))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (!theMgr.OverlapsPolygon (anArrayOfPnt->Array1(), Select3D_TOS_INTERIOR, thePickResult))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
thePickResult.SetDistToGeomCenter (distanceToCOG(theMgr));
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// function : BoundingBox
|
||||
// purpose : Returns bounding box of a polygon. If location
|
||||
|
@@ -14,13 +14,13 @@
|
||||
#ifndef _Select3D_SensitivePoly_HeaderFile
|
||||
#define _Select3D_SensitivePoly_HeaderFile
|
||||
|
||||
#include <gp_Circ.hxx>
|
||||
#include <Select3D_PointData.hxx>
|
||||
#include <Select3D_SensitiveSet.hxx>
|
||||
#include <Select3D_TypeOfSensitivity.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
|
||||
|
||||
//! Sensitive Entity to make a face selectable.
|
||||
//! In some cases this class can raise Standard_ConstructionError and
|
||||
//! Standard_OutOfRange exceptions from its member Select3D_PointData
|
||||
@@ -46,13 +46,28 @@ public:
|
||||
const Handle(TColgp_HArray1OfPnt)& thePoints,
|
||||
const Standard_Boolean theIsBVHEnabled);
|
||||
|
||||
//! Constructs the sensitive circle object defined by the
|
||||
//! owner OwnerId, the circle Circle, the Boolean
|
||||
//! FilledCircle and the number of points NbOfPoints.
|
||||
//! Constructs the sensitive arc object defined by the
|
||||
//! owner theOwnerId, the circle theCircle, the parameters theU1
|
||||
//! and theU2, the boolean theIsFilled and the number of points theNbPnts.
|
||||
//! theU1 and theU2 define the first and last points of the arc on theCircle.
|
||||
Standard_EXPORT Select3D_SensitivePoly (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theIsFilled = Standard_False,
|
||||
const Standard_Integer theNbPnts = 12);
|
||||
|
||||
//! Constructs a sensitive curve or arc object defined by the
|
||||
//! owner theOwnerId, the theIsBVHEnabled flag, and the
|
||||
//! maximum number of points on the curve: theNbPnts.
|
||||
Standard_EXPORT Select3D_SensitivePoly (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const Standard_Boolean theIsBVHEnabled,
|
||||
const Standard_Integer theNbPnts = 6);
|
||||
|
||||
//! Checks whether the poly overlaps current selecting volume
|
||||
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the amount of segments in poly
|
||||
Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
|
||||
|
||||
@@ -128,11 +143,12 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
Select3D_PointData myPolyg; //!< Points of the poly
|
||||
mutable gp_Pnt myCOG; //!< Center of the poly
|
||||
Handle(TColStd_HArray1OfInteger) mySegmentIndexes; //!< Segment indexes for BVH tree build
|
||||
Select3D_BndBox3d myBndBox; //!< Bounding box of the poly
|
||||
mutable Standard_Boolean myIsComputed; //!< Is true if all the points and data structures of polygon are initialized
|
||||
Select3D_PointData myPolyg; //!< Points of the poly
|
||||
mutable gp_Pnt myCOG; //!< Center of the poly
|
||||
Handle(TColStd_HArray1OfInteger) mySegmentIndexes; //!< Segment indexes for BVH tree build
|
||||
Select3D_BndBox3d myBndBox; //!< Bounding box of the poly
|
||||
Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: boundary or interior
|
||||
mutable Standard_Boolean myIsComputed; //!< Is true if all the points and data structures of polygon are initialized
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Select3D_SensitivePoly, Select3D_SensitiveSet)
|
||||
|
@@ -96,21 +96,41 @@ public:
|
||||
Standard_Boolean* theInside = NULL) const = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by cylinder (or cone) with radiuses theBottomRad
|
||||
//! and theTopRad, height theHeight and transformation to apply theTrsf.
|
||||
//! and theTopRad, height theHeight, the boolean theIsHollow and transformation to apply theTrsf.
|
||||
virtual Standard_Boolean OverlapsCylinder (const Standard_Real theBottomRad,
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
SelectBasics_PickResult& thePickResult) const = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by cylinder (or cone) with radiuses theBottomRad
|
||||
//! and theTopRad, height theHeight and transformation to apply theTrsf.
|
||||
//! and theTopRad, height theHeight, the boolean theIsHollow and transformation to apply theTrsf.
|
||||
virtual Standard_Boolean OverlapsCylinder (const Standard_Real theBottomRad,
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! the boolean theIsFilled, and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
virtual Standard_Boolean OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
SelectBasics_PickResult& thePickResult) const = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! the boolean theIsFilled, and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
virtual Standard_Boolean OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const = 0;
|
||||
|
||||
public:
|
||||
|
||||
//! Calculates distance from 3d projection of user-defined selection point
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitiveCircle.hxx>
|
||||
#include <Select3D_SensitiveCylinder.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <Select3D_SensitiveFace.hxx>
|
||||
@@ -133,41 +134,56 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
//! Fill in circle polylines.
|
||||
static void addCircle (Prs3d_NListOfSequenceOfPnt& theSeqLines,
|
||||
const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Real theHeight = 0)
|
||||
{
|
||||
const Standard_Real anUStep = 0.1;
|
||||
gp_XYZ aVec (0, 0, theHeight);
|
||||
|
||||
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
|
||||
Geom_Circle aGeom (gp_Ax2(), theRadius);
|
||||
for (Standard_Real anU = 0.0f; anU < (2.0 * M_PI + anUStep); anU += anUStep)
|
||||
{
|
||||
gp_Pnt aCircPnt = aGeom.Value (anU).Coord() + aVec;
|
||||
aCircPnt.Transform (theTrsf);
|
||||
aPoints->Append (aCircPnt);
|
||||
}
|
||||
theSeqLines.Append (aPoints);
|
||||
}
|
||||
|
||||
//! Fill in cylinder polylines.
|
||||
static void addCylinder (Prs3d_NListOfSequenceOfPnt& theSeqLines,
|
||||
const Handle(Select3D_SensitiveCylinder)& theSensCyl)
|
||||
const Handle(Select3D_SensitiveCylinder)& theSensCyl,
|
||||
const gp_Trsf& theLoc)
|
||||
{
|
||||
Handle(TColgp_HSequenceOfPnt) aVertLines[2];
|
||||
aVertLines[0] = new TColgp_HSequenceOfPnt();
|
||||
aVertLines[1] = new TColgp_HSequenceOfPnt();
|
||||
const gp_Trsf& aTrsf = theSensCyl->Transformation();
|
||||
Handle(TColgp_HSequenceOfPnt) aVertLine1 = new TColgp_HSequenceOfPnt();
|
||||
Handle(TColgp_HSequenceOfPnt) aVertLine2 = new TColgp_HSequenceOfPnt();
|
||||
|
||||
const gp_Trsf& aTrsf = theLoc.Multiplied (theSensCyl->Transformation());
|
||||
const Standard_Real aHeight = theSensCyl->Height();
|
||||
const Standard_Real anUStep = 0.1;
|
||||
|
||||
for (int aCircNum = 0; aCircNum < 3; aCircNum++)
|
||||
{
|
||||
Standard_Real aRadius = 0.5 * (2 - aCircNum) * theSensCyl->BottomRadius()
|
||||
+ 0.5 * aCircNum * theSensCyl->TopRadius();
|
||||
Geom_Circle aGeom (gp_Ax2(), aRadius);
|
||||
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
|
||||
gp_XYZ aVec (0, 0, aHeight * 0.5 * aCircNum);
|
||||
const gp_XYZ aVec (0, 0, aHeight * 0.5 * aCircNum);
|
||||
|
||||
if (aCircNum != 1)
|
||||
{
|
||||
aVertLines[0]->Append (gp_Pnt(aGeom.Value (0).Coord() + aVec).Transformed (aTrsf));
|
||||
aVertLines[1]->Append (gp_Pnt(aGeom.Value (M_PI).Coord() + aVec).Transformed (aTrsf));
|
||||
aVertLine1->Append (gp_Pnt (gp_XYZ (aRadius, 0, 0) + aVec).Transformed (aTrsf));
|
||||
aVertLine2->Append (gp_Pnt (gp_XYZ (-aRadius, 0, 0) + aVec).Transformed (aTrsf));
|
||||
}
|
||||
|
||||
for (Standard_Real anU = 0.0f; anU < (2.0 * M_PI + anUStep); anU += anUStep)
|
||||
if (aRadius > Precision::Confusion())
|
||||
{
|
||||
gp_Pnt aCircPnt = aGeom.Value (anU).Coord() + aVec;
|
||||
aCircPnt.Transform (aTrsf);
|
||||
aPoints->Append (aCircPnt);
|
||||
addCircle (theSeqLines, aRadius, aTrsf, aVec.Z());
|
||||
}
|
||||
theSeqLines.Append (aPoints);
|
||||
}
|
||||
theSeqLines.Append (aVertLines[0]);
|
||||
theSeqLines.Append (aVertLines[1]);
|
||||
theSeqLines.Append (aVertLine1);
|
||||
theSeqLines.Append (aVertLine2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +209,11 @@ void SelectMgr::ComputeSensitivePrs (const Handle(Graphic3d_Structure)& thePrs,
|
||||
}
|
||||
else if (Handle(Select3D_SensitiveCylinder) aSensCyl = Handle(Select3D_SensitiveCylinder)::DownCast (anEnt))
|
||||
{
|
||||
addCylinder (aSeqLines, aSensCyl);
|
||||
addCylinder (aSeqLines, aSensCyl, theLoc);
|
||||
}
|
||||
else if (Handle(Select3D_SensitiveCircle) aSensCircle = Handle(Select3D_SensitiveCircle)::DownCast (anEnt))
|
||||
{
|
||||
addCircle (aSeqLines, aSensCircle->Radius(), theLoc.Multiplied (aSensCircle->Transformation()));
|
||||
}
|
||||
else if (Handle(Select3D_SensitiveFace) aFace = Handle(Select3D_SensitiveFace)::DownCast(anEnt))
|
||||
{
|
||||
|
@@ -227,7 +227,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsBox (const SelectMgr_Vec3& t
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsBox() should be called after selection axis initialization");
|
||||
|
||||
(void )theInside;
|
||||
Standard_Real aTimeEnter, aTimeLeave;
|
||||
@@ -252,7 +252,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsBox (const SelectMgr_Vec3& t
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsBox() should be called after selection axis initialization");
|
||||
|
||||
Standard_Real aTimeEnter, aTimeLeave;
|
||||
if (!hasIntersection (theBoxMin, theBoxMax, aTimeEnter, aTimeLeave))
|
||||
@@ -283,7 +283,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsPoint (const gp_Pnt& thePnt,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsPoint() should be called after selection axis initialization");
|
||||
|
||||
Standard_Real aDepth = 0.0;
|
||||
if (!hasIntersection (thePnt, aDepth))
|
||||
@@ -304,7 +304,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsPoint (const gp_Pnt& thePnt,
|
||||
Standard_Boolean SelectMgr_AxisIntersector::OverlapsPoint (const gp_Pnt& thePnt) const
|
||||
{
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsPoint() should be called after selection axis initialization");
|
||||
|
||||
Standard_Real aDepth = 0.0;
|
||||
return hasIntersection (thePnt, aDepth);
|
||||
@@ -320,7 +320,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsSegment (const gp_Pnt& thePn
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsSegment() should be called after selection axis initialization");
|
||||
|
||||
if (!raySegmentDistance (thePnt1, thePnt2, thePickResult))
|
||||
{
|
||||
@@ -340,7 +340,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsPolygon (const TColgp_Array1
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsPolygon() should be called after selection axis initialization");
|
||||
|
||||
if (theSensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
@@ -400,7 +400,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsTriangle (const gp_Pnt& theP
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE(mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsTriangle() should be called after selection axis initialization");
|
||||
|
||||
if (theSensType == Select3D_TOS_BOUNDARY)
|
||||
{
|
||||
@@ -503,7 +503,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsSphere (const gp_Pnt& theCen
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsSphere() should be called after selection axis initialization");
|
||||
(void )theInside;
|
||||
Standard_Real aTimeEnter = 0.0, aTimeLeave = 0.0;
|
||||
if (!RaySphereIntersection (theCenter, theRadius, myAxis.Location(), myAxis.Direction(), aTimeEnter, aTimeLeave))
|
||||
@@ -527,7 +527,7 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsSphere (const gp_Pnt& theCen
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsSphere() should be called after selection axis initialization");
|
||||
Standard_Real aTimeEnter = 0.0, aTimeLeave = 0.0;
|
||||
if (!RaySphereIntersection (theCenter, theRadius, myAxis.Location(), myAxis.Direction(), aTimeEnter, aTimeLeave))
|
||||
{
|
||||
@@ -558,22 +558,24 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsCylinder (const Standard_Rea
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsCylinder() should be called after selection axis initialization");
|
||||
Standard_Real aTimeEnter = 0.0, aTimeLeave = 0.0;
|
||||
gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
gp_Pnt aLoc = myAxis.Location() .Transformed (aTrsfInv);
|
||||
gp_Dir aRayDir = myAxis.Direction().Transformed (aTrsfInv);
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir, aTimeEnter, aTimeLeave))
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir,
|
||||
theIsHollow, aTimeEnter, aTimeLeave))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Standard_Real aDepth = 0.0;
|
||||
Bnd_Range aRange (Max (aTimeEnter, 0.0), aTimeLeave);
|
||||
Bnd_Range aRange (Max (aTimeEnter, 0.0), Max (aTimeEnter, aTimeLeave));
|
||||
aRange.GetMin (aDepth);
|
||||
if (!theClipRange.GetNearestDepth (aRange, aDepth))
|
||||
{
|
||||
@@ -606,15 +608,17 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsCylinder (const Standard_Rea
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
Standard_Boolean* theInside) const
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::Overlaps() should be called after selection axis initialization");
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsCylinder() should be called after selection axis initialization");
|
||||
Standard_Real aTimeEnter = 0.0, aTimeLeave = 0.0;
|
||||
gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
gp_Pnt aLoc = myAxis.Location() .Transformed (aTrsfInv);
|
||||
gp_Dir aRayDir = myAxis.Direction().Transformed (aTrsfInv);
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir, aTimeEnter, aTimeLeave))
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir,
|
||||
theIsHollow, aTimeEnter, aTimeLeave))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -625,6 +629,74 @@ Standard_Boolean SelectMgr_AxisIntersector::OverlapsCylinder (const Standard_Rea
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_AxisIntersector::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsCircle() should be called after selection axis initialization");
|
||||
Standard_Real aTime = 0.0;
|
||||
gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
gp_Pnt aLoc = myAxis.Location().Transformed (aTrsfInv);
|
||||
gp_Dir aRayDir = myAxis.Direction().Transformed (aTrsfInv);
|
||||
if (!RayCircleIntersection (theRadius, aLoc, aRayDir, theIsFilled, aTime))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Standard_Real aDepth = Max (aTime, 0.0);
|
||||
if (theClipRange.IsClipped (aDepth))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const gp_Pnt aPntOnCylinder = aLoc.XYZ() + aRayDir.XYZ() * aDepth;
|
||||
thePickResult.SetDepth (aDepth);
|
||||
thePickResult.SetPickedPoint (aPntOnCylinder.Transformed (theTrsf));
|
||||
if (Abs (aPntOnCylinder.Z()) < Precision::Confusion())
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (-gp::DZ().Transformed (theTrsf));
|
||||
}
|
||||
else
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (gp_Vec (aPntOnCylinder.X(), aPntOnCylinder.Y(), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_AxisIntersector::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point,
|
||||
"Error! SelectMgr_AxisIntersector::OverlapsCircle() should be called after selection axis initialization");
|
||||
Standard_Real aTime = 0.0;
|
||||
gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
gp_Pnt aLoc = myAxis.Location().Transformed (aTrsfInv);
|
||||
gp_Dir aRayDir = myAxis.Direction().Transformed (aTrsfInv);
|
||||
if (!RayCircleIntersection (theRadius, aLoc, aRayDir, theIsFilled, aTime))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (theInside != NULL)
|
||||
{
|
||||
*theInside &= (aTime >= 0.0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GetNearPnt
|
||||
// purpose :
|
||||
|
@@ -117,6 +117,7 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
@@ -126,8 +127,28 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Measures distance between start axis point and given point theCOG.
|
||||
|
@@ -176,15 +176,15 @@ Standard_Boolean SelectMgr_BaseIntersector::RayCylinderIntersection (const Stand
|
||||
const Standard_Real theHeight,
|
||||
const gp_Pnt& theLoc,
|
||||
const gp_Dir& theRayDir,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Real& theTimeEnter,
|
||||
Standard_Real& theTimeLeave) const
|
||||
{
|
||||
Standard_Integer aNbIntersections = 0;
|
||||
Standard_Real anIntersections[4] = { RealLast(), RealLast(), RealLast(), RealLast() };
|
||||
//NCollection_Vector<Standard_Real> anIntersections; // vector for all intersections
|
||||
// Check intersections with end faces
|
||||
// point of intersection theRayDir and z = 0
|
||||
if (theRayDir.Z() != 0)
|
||||
if (!theIsHollow && theRayDir.Z() != 0)
|
||||
{
|
||||
const Standard_Real aTime1 = (0 - theLoc.Z()) / theRayDir.Z();
|
||||
const Standard_Real aX1 = theLoc.X() + theRayDir.X() * aTime1;
|
||||
@@ -293,6 +293,33 @@ Standard_Boolean SelectMgr_BaseIntersector::RayCylinderIntersection (const Stand
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : RayCircleIntersection
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_BaseIntersector::RayCircleIntersection (const Standard_Real theRadius,
|
||||
const gp_Pnt& theLoc,
|
||||
const gp_Dir& theRayDir,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Real& theTime) const
|
||||
{
|
||||
if (theRayDir.Z() != 0)
|
||||
{
|
||||
const Standard_Real aTime = (0 - theLoc.Z()) / theRayDir.Z();
|
||||
const Standard_Real aX1 = theLoc.X() + theRayDir.X() * aTime;
|
||||
const Standard_Real anY1 = theLoc.Y() + theRayDir.Y() * aTime;
|
||||
|
||||
const Standard_Real aK = aX1 * aX1 + anY1 * anY1;
|
||||
if ((theIsFilled && aK <= theRadius * theRadius)
|
||||
|| (!theIsFilled && Abs (sqrt (aK) - theRadius) <= Precision::Confusion()))
|
||||
{
|
||||
theTime = aTime;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : DistToGeometryCenter
|
||||
// purpose :
|
||||
|
@@ -187,6 +187,7 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const = 0;
|
||||
|
||||
@@ -196,8 +197,28 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const = 0;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const = 0;
|
||||
|
||||
public:
|
||||
|
||||
//! Measures distance between 3d projection of user-picked
|
||||
@@ -224,15 +245,37 @@ public:
|
||||
Standard_Real& theTimeLeave) const;
|
||||
|
||||
//! Checks whether the ray that starts at the point theLoc and directs with the direction theRayDir intersects
|
||||
//! with the cylinder (or cone) with radiuses theBottomRad and theTopRad and height theHeights
|
||||
//! with the hollow cylinder (or cone)
|
||||
//! @param[in] theBottomRadius the bottom cylinder radius
|
||||
//! @param[in] theTopRadius the top cylinder radius
|
||||
//! @param[in] theHeight the cylinder height
|
||||
//! @param[in] theLoc the location of the ray
|
||||
//! @param[in] theRayDir the ray direction
|
||||
//! @param[in] theIsHollow true if the cylinder is hollow
|
||||
//! @param[out] theTimeEnter the entering the intersection
|
||||
//! @param[out] theTimeLeave the leaving the intersection
|
||||
Standard_EXPORT virtual Standard_Boolean RayCylinderIntersection (const Standard_Real theBottomRadius,
|
||||
const Standard_Real theTopRadius,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Pnt& theLoc,
|
||||
const gp_Dir& theRayDir,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Real& theTimeEnter,
|
||||
Standard_Real& theTimeLeave) const;
|
||||
|
||||
//! Checks whether the ray that starts at the point theLoc and directs with the direction theRayDir intersects
|
||||
//! with the circle
|
||||
//! @param[in] theRadius the circle radius
|
||||
//! @param[in] theLoc the location of the ray
|
||||
//! @param[in] theRayDir the ray direction
|
||||
//! @param[in] theIsFilled true if it's a circle, false if it's a circle outline
|
||||
//! @param[out] theTime the intersection
|
||||
Standard_EXPORT virtual Standard_Boolean RayCircleIntersection (const Standard_Real theRadius,
|
||||
const gp_Pnt& theLoc,
|
||||
const gp_Dir& theRayDir,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Real& theTime) const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(SelectMgr_BaseIntersector,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
@@ -98,11 +98,25 @@ protected:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const;
|
||||
|
||||
//! Intersection test between defined volume and given circle.
|
||||
Standard_Boolean hasCircleOverlap (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const;
|
||||
|
||||
//! Returns True if all vertices (theVertices) are inside the top and bottom sides of the cylinder.
|
||||
Standard_Boolean isInsideCylinderEndFace (const Standard_Real theBottomRad,
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const;
|
||||
|
||||
//! Checking whether the point thePnt is inside the shape with borders theVertices.
|
||||
//! thePnt and theVertices lie in the same plane.
|
||||
Standard_Boolean IsDotInside (const gp_Pnt& thePnt,
|
||||
Standard_Boolean isDotInside (const gp_Pnt& thePnt,
|
||||
const TColgp_Array1OfPnt& theVertices) const;
|
||||
|
||||
private:
|
||||
@@ -116,10 +130,10 @@ private:
|
||||
|
||||
//! Checking whether the borders theVertices of the shape intersect
|
||||
//! the cylinder (or cone) end face with the center theCenter and radius theRadius
|
||||
Standard_Boolean isIntersectCylinderEndFace (const Standard_Real theRad,
|
||||
const gp_Pnt& theCenter,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const;
|
||||
Standard_Boolean isIntersectCircle (const Standard_Real theRadius,
|
||||
const gp_Pnt& theCenter,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const;
|
||||
|
||||
//! Checks if AABB and frustum are separated along the given axis
|
||||
Standard_Boolean isSeparated (const SelectMgr_Vec3& theBoxMin,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Created on: 2015-03-16
|
||||
// Created on: 2015-03-16
|
||||
// Created by: Varvara POSKONINA
|
||||
// Copyright (c) 2005-2014 OPEN CASCADE SAS
|
||||
//
|
||||
@@ -520,7 +520,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasSphereOverlap (const gp_Pnt& thePnt,
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
template<int N>
|
||||
Standard_Boolean SelectMgr_Frustum<N>::IsDotInside (const gp_Pnt& thePnt,
|
||||
Standard_Boolean SelectMgr_Frustum<N>::isDotInside (const gp_Pnt& thePnt,
|
||||
const TColgp_Array1OfPnt& theVertices) const
|
||||
{
|
||||
Standard_Real anAngle = 0.0;
|
||||
@@ -598,14 +598,14 @@ Standard_Boolean SelectMgr_Frustum<N>::isSegmentsIntersect (const gp_Pnt& thePnt
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : isIntersectCylinderEndFace
|
||||
// function : isIntersectCircle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
template<int N>
|
||||
Standard_Boolean SelectMgr_Frustum<N>::isIntersectCylinderEndFace (const Standard_Real theRad,
|
||||
const gp_Pnt& theCenter,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const
|
||||
Standard_Boolean SelectMgr_Frustum<N>::isIntersectCircle (const Standard_Real theRadius,
|
||||
const gp_Pnt& theCenter,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const
|
||||
{
|
||||
const gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
const gp_Dir aRayDir = gp_Dir (myEdgeDirs[N == 4 ? 4 : 0]).Transformed (aTrsfInv);
|
||||
@@ -633,7 +633,7 @@ Standard_Boolean SelectMgr_Frustum<N>::isIntersectCylinderEndFace (const Standar
|
||||
// Solving quadratic equation anA * T^2 + 2 * aK * T + aC = 0
|
||||
const Standard_Real anA = (aX1 - aX2) * (aX1 - aX2) + (anY1 - anY2) * (anY1 - anY2);
|
||||
const Standard_Real aK = aX1 * (aX2 - aX1) + anY1 * (anY2 - anY1);
|
||||
const Standard_Real aC = aX1 * aX1 + anY1 * anY1 - theRad * theRad;
|
||||
const Standard_Real aC = aX1 * aX1 + anY1 * anY1 - theRadius * theRadius;
|
||||
|
||||
const Standard_Real aDiscr = aK * aK - anA * aC;
|
||||
if (aDiscr >= 0.0)
|
||||
@@ -649,6 +649,47 @@ Standard_Boolean SelectMgr_Frustum<N>::isIntersectCylinderEndFace (const Standar
|
||||
return false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : isInsideCylinderEndFace
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
template<int N>
|
||||
Standard_Boolean SelectMgr_Frustum<N>::isInsideCylinderEndFace (const Standard_Real theBottomRad,
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const
|
||||
{
|
||||
const gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
const gp_Dir aRayDir = gp_Dir (myEdgeDirs[N == 4 ? 4 : 0]).Transformed (aTrsfInv);
|
||||
if (aRayDir.Z() == 0.0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Standard_Integer anIdx = theVertices.Lower(); anIdx <= theVertices.Upper(); anIdx++)
|
||||
{
|
||||
const gp_Pnt aLoc = theVertices.Value (anIdx).Transformed (aTrsfInv);
|
||||
|
||||
const Standard_Real aTime1 = (0 - aLoc.Z()) / aRayDir.Z();
|
||||
const Standard_Real aX1 = aLoc.X() + aRayDir.X() * aTime1;
|
||||
const Standard_Real anY1 = aLoc.Y() + aRayDir.Y() * aTime1;
|
||||
|
||||
const Standard_Real aTime2 = (theHeight - aLoc.Z()) / aRayDir.Z();
|
||||
const Standard_Real aX2 = aLoc.X() + aRayDir.X() * aTime2;
|
||||
const Standard_Real anY2 = aLoc.Y() + aRayDir.Y() * aTime2;
|
||||
|
||||
if (aX1 * aX1 + anY1 * anY1 <= theBottomRad * theBottomRad
|
||||
&& aX2 * aX2 + anY2 * anY2 <= theTopRad * theTopRad)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : hasCylinderOverlap
|
||||
// purpose :
|
||||
@@ -658,8 +699,37 @@ Standard_Boolean SelectMgr_Frustum<N>::hasCylinderOverlap (const Standard_Real t
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
gp_Pnt aVerticesBuf[N];
|
||||
TColgp_Array1OfPnt aVertices (aVerticesBuf[0], 0, N - 1);
|
||||
const Standard_Integer anIncFactor = (Camera()->IsOrthographic() && N == 4) ? 2 : 1;
|
||||
if (anIncFactor == 2)
|
||||
{
|
||||
const Standard_Integer anIndices[] = { 0, 2, 6, 4 };
|
||||
for (Standard_Integer anIdx = 0; anIdx < N; anIdx++)
|
||||
{
|
||||
aVertices.SetValue (anIdx, myVertices[anIndices[anIdx]]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer anIdx = 0; anIdx < N; anIdx++)
|
||||
{
|
||||
aVertices.SetValue (anIdx, myVertices[anIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
if (theIsHollow && isInsideCylinderEndFace (theBottomRad, theTopRad, theHeight, theTrsf, aVertices))
|
||||
{
|
||||
if (theInside != NULL)
|
||||
{
|
||||
*theInside = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const gp_Dir aCylNorm (gp::DZ().Transformed (theTrsf));
|
||||
const gp_Pnt aBottomCenter (gp::Origin().Transformed (theTrsf));
|
||||
const gp_Pnt aTopCenter = aBottomCenter.XYZ() + aCylNorm.XYZ() * theHeight;
|
||||
@@ -698,29 +768,11 @@ Standard_Boolean SelectMgr_Frustum<N>::hasCylinderOverlap (const Standard_Real t
|
||||
aPoints[5] = aBottomCenterProject.XYZ() - aDirEndFaces.XYZ() * theBottomRad;
|
||||
const TColgp_Array1OfPnt aPointsArr (aPoints[0], 0, 5);
|
||||
|
||||
gp_Pnt aVerticesBuf[N];
|
||||
TColgp_Array1OfPnt aVertices (aVerticesBuf[0], 0, N - 1);
|
||||
const Standard_Integer anIncFactor = (Camera()->IsOrthographic() && N == 4) ? 2 : 1;
|
||||
if (anIncFactor == 2)
|
||||
{
|
||||
const Standard_Integer anIndices[] = { 0, 2, 6, 4 };
|
||||
for (Standard_Integer anIdx = 0; anIdx < N; anIdx++)
|
||||
{
|
||||
aVertices.SetValue (anIdx, myVertices[anIndices[anIdx]]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer anIdx = 0; anIdx < N; anIdx++)
|
||||
{
|
||||
aVertices.SetValue (anIdx, myVertices[anIdx]);
|
||||
}
|
||||
}
|
||||
for (Standard_Integer anIdx = 0; anIdx < N; anIdx++)
|
||||
{
|
||||
if ((aCylNormProject.Dot (aCylNormProject) == 0.0
|
||||
&& aVertices.Value (anIdx).Distance (aPoints[0]) <= Max (theTopRad, theBottomRad))
|
||||
|| IsDotInside (aVertices.Value (anIdx), aPointsArr))
|
||||
|| isDotInside (aVertices.Value (anIdx), aPointsArr))
|
||||
{
|
||||
if (theInside != NULL)
|
||||
{
|
||||
@@ -747,8 +799,9 @@ Standard_Boolean SelectMgr_Frustum<N>::hasCylinderOverlap (const Standard_Real t
|
||||
}
|
||||
}
|
||||
|
||||
if (isIntersectCylinderEndFace (theBottomRad, gp_Pnt (0, 0, 0), theTrsf, aVertices)
|
||||
|| isIntersectCylinderEndFace (theTopRad, gp_Pnt (0, 0, theHeight), theTrsf, aVertices))
|
||||
if (!theIsHollow
|
||||
&& (isIntersectCircle (theBottomRad, gp_Pnt (0, 0, 0), theTrsf, aVertices)
|
||||
|| isIntersectCircle (theTopRad, gp_Pnt (0, 0, theHeight), theTrsf, aVertices)))
|
||||
{
|
||||
if (theInside != NULL)
|
||||
{
|
||||
@@ -759,7 +812,7 @@ Standard_Boolean SelectMgr_Frustum<N>::hasCylinderOverlap (const Standard_Real t
|
||||
bool isCylInsideRec = true;
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
isCylInsideRec &= IsDotInside (aPoints[i], aVertices);
|
||||
isCylInsideRec &= isDotInside (aPoints[i], aVertices);
|
||||
}
|
||||
if (theInside != NULL)
|
||||
{
|
||||
@@ -768,6 +821,82 @@ Standard_Boolean SelectMgr_Frustum<N>::hasCylinderOverlap (const Standard_Real t
|
||||
return isCylInsideRec;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : hasCircleOverlap
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
template<int N>
|
||||
Standard_Boolean SelectMgr_Frustum<N>::hasCircleOverlap (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
gp_Pnt aVerticesBuf[N];
|
||||
TColgp_Array1OfPnt aVertices (aVerticesBuf[0], 0, N - 1);
|
||||
const Standard_Integer anIncFactor = (Camera()->IsOrthographic() && N == 4) ? 2 : 1;
|
||||
if (anIncFactor == 2)
|
||||
{
|
||||
const Standard_Integer anIndices[] = { 0, 2, 6, 4 };
|
||||
for (Standard_Integer anIdx = 0; anIdx < N; anIdx++)
|
||||
{
|
||||
aVertices.SetValue (anIdx, myVertices[anIndices[anIdx]]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Standard_Integer anIdx = 0; anIdx < N; anIdx++)
|
||||
{
|
||||
aVertices.SetValue (anIdx, myVertices[anIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isIntersectCircle (theRadius, gp_Pnt (0, 0, 0), theTrsf, aVertices))
|
||||
{
|
||||
if (theInside != NULL)
|
||||
{
|
||||
*theInside = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
gp_Pnt aCircCenter = gp::Origin();//.Transformed (theTrsf);
|
||||
const gp_Dir aViewRayDir = gp_Dir (myEdgeDirs[N == 4 ? 4 : 0]);
|
||||
const gp_Pln aPln (myVertices[0], aViewRayDir);
|
||||
Standard_Real aCoefA, aCoefB, aCoefC, aCoefD;
|
||||
aPln.Coefficients (aCoefA, aCoefB, aCoefC, aCoefD);
|
||||
|
||||
const Standard_Real aTCenter = -(aCircCenter.XYZ().Dot (aViewRayDir.XYZ()) + aCoefD);
|
||||
const gp_Pnt aCenterProject (aCoefA * aTCenter,
|
||||
aCoefB * aTCenter,
|
||||
aCoefC * aTCenter);
|
||||
if (isDotInside (aCenterProject, aVertices))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Standard_Boolean isInside = true;
|
||||
for (Standard_Integer anIdx = aVertices.Lower(); anIdx <= aVertices.Upper(); anIdx++)
|
||||
{
|
||||
if (aVertices.Value (anIdx).Distance (aCenterProject) > theRadius)
|
||||
{
|
||||
isInside = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (theInside != NULL)
|
||||
{
|
||||
*theInside = false;
|
||||
}
|
||||
|
||||
if (!theIsFilled && isInside)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return isInside;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpJson
|
||||
//purpose :
|
||||
|
@@ -748,6 +748,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCylinder (const Standard_
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
@@ -757,7 +758,7 @@ Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCylinder (const Standard_
|
||||
const gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
const gp_Pnt aLoc = myNearPickedPnt.Transformed (aTrsfInv);
|
||||
const gp_Dir aRayDir = myViewRayDir .Transformed (aTrsfInv);
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir, aTimes[0], aTimes[1]))
|
||||
if (!RayCylinderIntersection (theBottomRad, theTopRad, theHeight, aLoc, aRayDir, theIsHollow, aTimes[0], aTimes[1]))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -787,6 +788,165 @@ Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCylinder (const Standard_
|
||||
return !theClipRange.IsClipped (thePickResult.Depth());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point || mySelectionType == SelectMgr_SelectionType_Box,
|
||||
"Error! SelectMgr_RectangularFrustum::Overlaps() should be called after selection frustum initialization");
|
||||
Standard_Real aTime = 0.0;
|
||||
const gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
const gp_Pnt aLoc = myNearPickedPnt.Transformed (aTrsfInv);
|
||||
const gp_Dir aRayDir = myViewRayDir.Transformed (aTrsfInv);
|
||||
if (!theIsFilled)
|
||||
{
|
||||
if (!hasCircleOverlap (theRadius, theTrsf, theIsFilled, NULL))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (aRayDir.Z() != 0)
|
||||
{
|
||||
aTime = (0 - aLoc.Z()) / aRayDir.Z();
|
||||
}
|
||||
}
|
||||
else if (!RayCircleIntersection (theRadius, aLoc, aRayDir, theIsFilled, aTime))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
thePickResult.SetDepth (aTime * myScale);
|
||||
if (theClipRange.IsClipped (thePickResult.Depth()))
|
||||
{
|
||||
thePickResult.SetDepth (aTime * myScale);
|
||||
}
|
||||
|
||||
const gp_Pnt aPntOnCircle = aLoc.XYZ() + aRayDir.XYZ() * aTime;
|
||||
if (Abs (aPntOnCircle.Z()) < Precision::Confusion())
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (-gp::DZ().Transformed (theTrsf));
|
||||
}
|
||||
else
|
||||
{
|
||||
thePickResult.SetSurfaceNormal (gp_Vec (aPntOnCircle.X(), aPntOnCircle.Y(), 0.0).Transformed (theTrsf));
|
||||
}
|
||||
thePickResult.SetPickedPoint (aPntOnCircle.Transformed (theTrsf));
|
||||
return !theClipRange.IsClipped (thePickResult.Depth());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : isIntersectCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_RectangularFrustum::isIntersectCircle (const Standard_Real theRadius,
|
||||
const gp_Pnt& theCenter,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const
|
||||
{
|
||||
const gp_Trsf aTrsfInv = theTrsf.Inverted();
|
||||
const gp_Dir aRayDir = gp_Dir (myEdgeDirs[4 == 4 ? 4 : 0]).Transformed (aTrsfInv);
|
||||
if (aRayDir.Z() == 0.0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Standard_Integer anIdx = theVertices.Lower(); anIdx <= theVertices.Upper(); anIdx++)
|
||||
{
|
||||
const gp_Pnt aPntStart = theVertices.Value (anIdx).Transformed (aTrsfInv);
|
||||
const gp_Pnt aPntFinish = anIdx == theVertices.Upper()
|
||||
? theVertices.Value (theVertices.Lower()).Transformed (aTrsfInv)
|
||||
: theVertices.Value (anIdx + 1).Transformed (aTrsfInv);
|
||||
|
||||
// Project points on the end face plane
|
||||
const Standard_Real aParam1 = (theCenter.Z() - aPntStart.Z()) / aRayDir.Z();
|
||||
const Standard_Real aX1 = aPntStart.X() + aRayDir.X() * aParam1;
|
||||
const Standard_Real anY1 = aPntStart.Y() + aRayDir.Y() * aParam1;
|
||||
|
||||
const Standard_Real aParam2 = (theCenter.Z() - aPntFinish.Z()) / aRayDir.Z();
|
||||
const Standard_Real aX2 = aPntFinish.X() + aRayDir.X() * aParam2;
|
||||
const Standard_Real anY2 = aPntFinish.Y() + aRayDir.Y() * aParam2;
|
||||
|
||||
// Solving quadratic equation anA * T^2 + 2 * aK * T + aC = 0
|
||||
const Standard_Real anA = (aX1 - aX2) * (aX1 - aX2) + (anY1 - anY2) * (anY1 - anY2);
|
||||
const Standard_Real aK = aX1 * (aX2 - aX1) + anY1 * (anY2 - anY1);
|
||||
const Standard_Real aC = aX1 * aX1 + anY1 * anY1 - theRadius * theRadius;
|
||||
|
||||
const Standard_Real aDiscr = aK * aK - anA * aC;
|
||||
if (aDiscr >= 0.0)
|
||||
{
|
||||
const Standard_Real aT1 = (-aK + Sqrt (aDiscr)) / anA;
|
||||
const Standard_Real aT2 = (-aK - Sqrt (aDiscr)) / anA;
|
||||
if ((aT1 >= 0 && aT1 <= 1) || (aT2 >= 0 && aT2 <= 1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : isSegmentsIntersect
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_RectangularFrustum::isSegmentsIntersect (const gp_Pnt& thePnt1Seg1,
|
||||
const gp_Pnt& thePnt2Seg1,
|
||||
const gp_Pnt& thePnt1Seg2,
|
||||
const gp_Pnt& thePnt2Seg2) const
|
||||
{
|
||||
const gp_Mat aMatPln (thePnt2Seg1.X() - thePnt1Seg1.X(), thePnt2Seg1.Y() - thePnt1Seg1.Y(), thePnt2Seg1.Z() - thePnt1Seg1.Z(),
|
||||
thePnt1Seg2.X() - thePnt1Seg1.X(), thePnt1Seg2.Y() - thePnt1Seg1.Y(), thePnt1Seg2.Z() - thePnt1Seg1.Z(),
|
||||
thePnt2Seg2.X() - thePnt1Seg1.X(), thePnt2Seg2.Y() - thePnt1Seg1.Y(), thePnt2Seg2.Z() - thePnt1Seg1.Z());
|
||||
if (Abs (aMatPln.Determinant()) > Precision::Confusion())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Standard_Real aFst[4] = { thePnt1Seg1.X(), thePnt2Seg1.X(), thePnt1Seg2.X(), thePnt2Seg2.X() };
|
||||
Standard_Real aSnd[4] = { thePnt1Seg1.Y(), thePnt2Seg1.Y(), thePnt1Seg2.Y(), thePnt2Seg2.Y() };
|
||||
if (aFst[0] == aFst[2] && aFst[1] == aFst[3])
|
||||
{
|
||||
aFst[0] = thePnt1Seg1.Z();
|
||||
aFst[1] = thePnt2Seg1.Z();
|
||||
aFst[2] = thePnt1Seg2.Z();
|
||||
aFst[3] = thePnt2Seg2.Z();
|
||||
}
|
||||
if (aSnd[0] == aSnd[2]
|
||||
&& aSnd[1] == aSnd[3])
|
||||
{
|
||||
aSnd[0] = thePnt1Seg1.Z();
|
||||
aSnd[1] = thePnt2Seg1.Z();
|
||||
aSnd[2] = thePnt1Seg2.Z();
|
||||
aSnd[3] = thePnt2Seg2.Z();
|
||||
}
|
||||
const gp_Mat2d aMat (gp_XY (aFst[0] - aFst[1], aSnd[0] - aSnd[1]),
|
||||
gp_XY (aFst[3] - aFst[2], aSnd[3] - aSnd[2]));
|
||||
|
||||
const gp_Mat2d aMatU (gp_XY (aFst[0] - aFst[2], aSnd[0] - aSnd[2]),
|
||||
gp_XY (aFst[3] - aFst[2], aSnd[3] - aSnd[2]));
|
||||
|
||||
const gp_Mat2d aMatV (gp_XY (aFst[0] - aFst[1], aSnd[0] - aSnd[1]),
|
||||
gp_XY (aFst[0] - aFst[2], aSnd[0] - aSnd[2]));
|
||||
if (aMat.Determinant() == 0.0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const Standard_Real anU = aMatU.Determinant() / aMat.Determinant();
|
||||
const Standard_Real aV = aMatV.Determinant() / aMat.Determinant();
|
||||
if (anU >= 0.0 && anU <= 1.0
|
||||
&& aV >= 0.0 && aV <= 1.0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCylinder
|
||||
// purpose :
|
||||
@@ -795,12 +955,28 @@ Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCylinder (const Standard_
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point || mySelectionType == SelectMgr_SelectionType_Box,
|
||||
"Error! SelectMgr_RectangularFrustum::Overlaps() should be called after selection frustum initialization");
|
||||
|
||||
return hasCylinderOverlap (theBottomRad, theTopRad, theHeight, theTrsf, theInside);
|
||||
return hasCylinderOverlap (theBottomRad, theTopRad, theHeight, theTrsf, theIsHollow, theInside);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_RectangularFrustum::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Point || mySelectionType == SelectMgr_SelectionType_Box,
|
||||
"Error! SelectMgr_RectangularFrustum::Overlaps() should be called after selection frustum initialization");
|
||||
|
||||
return hasCircleOverlap (theRadius, theTrsf, theIsFilled, theInside);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -66,6 +66,18 @@ public:
|
||||
Standard_EXPORT void Init (const gp_Pnt2d& theMinPnt,
|
||||
const gp_Pnt2d& theMaxPnt);
|
||||
|
||||
//! Returns True if Frustum (theVertices) intersects the circle.
|
||||
Standard_EXPORT Standard_Boolean isIntersectCircle (const Standard_Real theRadius,
|
||||
const gp_Pnt& theCenter,
|
||||
const gp_Trsf& theTrsf,
|
||||
const TColgp_Array1OfPnt& theVertices) const;
|
||||
|
||||
//! Returns True if Seg1 (thePnt1Seg1, thePnt2Seg1) and Seg2 (thePnt1Seg2, thePnt2Seg2) intersect.
|
||||
Standard_EXPORT Standard_Boolean isSegmentsIntersect (const gp_Pnt& thePnt1Seg1,
|
||||
const gp_Pnt& thePnt2Seg1,
|
||||
const gp_Pnt& thePnt1Seg2,
|
||||
const gp_Pnt& thePnt2Seg2) const;
|
||||
|
||||
//! Builds volume according to internal parameters.
|
||||
//! NOTE: it should be called after Init() method
|
||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||
@@ -150,6 +162,7 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
@@ -159,8 +172,28 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Measures distance between 3d projection of user-picked
|
||||
//! screen point and given point theCOG.
|
||||
//! It makes sense only for frustums built on a single point.
|
||||
|
@@ -426,13 +426,15 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::OverlapsCylinder (const Stand
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
if (myActiveSelectingVolume.IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return myActiveSelectingVolume->OverlapsCylinder (theBottomRad, theTopRad, theHeight, theTrsf, myViewClipRange, thePickResult);
|
||||
return myActiveSelectingVolume->OverlapsCylinder (theBottomRad, theTopRad, theHeight, theTrsf,
|
||||
theIsHollow, myViewClipRange, thePickResult);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -443,13 +445,47 @@ Standard_Boolean SelectMgr_SelectingVolumeManager::OverlapsCylinder (const Stand
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
if (myActiveSelectingVolume.IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return myActiveSelectingVolume->OverlapsCylinder (theBottomRad, theTopRad, theHeight, theTrsf, theInside);
|
||||
return myActiveSelectingVolume->OverlapsCylinder (theBottomRad, theTopRad, theHeight,
|
||||
theTrsf, theIsHollow, theInside);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_SelectingVolumeManager::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
if (myActiveSelectingVolume.IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return myActiveSelectingVolume->OverlapsCircle (theRadius, theTrsf, theIsFilled, myViewClipRange, thePickResult);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_SelectingVolumeManager::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
if (myActiveSelectingVolume.IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return myActiveSelectingVolume->OverlapsCircle (theRadius, theTrsf, theIsFilled, theInside);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -168,6 +168,7 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by cylinder (or cone) with radiuses theBottomRad
|
||||
@@ -176,8 +177,27 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Measures distance between 3d projection of user-picked
|
||||
//! screen point and given point theCOG
|
||||
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) const Standard_OVERRIDE;
|
||||
|
@@ -337,12 +337,13 @@ Standard_Boolean SelectMgr_TriangularFrustum::OverlapsCylinder (const Standard_R
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
(void)theClipRange;
|
||||
(void)thePickResult;
|
||||
return hasCylinderOverlap (theBottomRad, theTopRad, theHeight, theTrsf);
|
||||
return hasCylinderOverlap (theBottomRad, theTopRad, theHeight, theTrsf, theIsHollow);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -353,10 +354,39 @@ Standard_Boolean SelectMgr_TriangularFrustum::OverlapsCylinder (const Standard_R
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
(void) theInside;
|
||||
return hasCylinderOverlap (theBottomRad, theTopRad, theHeight, theTrsf);
|
||||
return hasCylinderOverlap (theBottomRad, theTopRad, theHeight, theTrsf, theIsHollow);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustum::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
(void)theClipRange;
|
||||
(void)thePickResult;
|
||||
return hasCircleOverlap (theRadius, theTrsf, theIsFilled);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustum::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
(void)theInside;
|
||||
return hasCircleOverlap (theRadius, theTrsf, theIsFilled);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -123,6 +123,7 @@ public: //! @name SAT Tests for different objects
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
@@ -132,8 +133,28 @@ public: //! @name SAT Tests for different objects
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by circle with radius theRadius,
|
||||
//! boolean theIsFilled and transformation to apply theTrsf.
|
||||
//! The position and orientation of the circle are specified
|
||||
//! via theTrsf transformation for gp::XOY() with center in gp::Origin().
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Nullifies the handle to corresponding builder instance to prevent memory leaks
|
||||
|
@@ -17,6 +17,10 @@
|
||||
|
||||
#include <BRepMesh_DataStructureOfDelaun.hxx>
|
||||
#include <BRepMesh_Delaun.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <GeomInt_IntSS.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <SelectMgr_FrustumBuilder.hxx>
|
||||
|
||||
@@ -506,6 +510,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCylinder (const Standar
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
@@ -513,7 +518,8 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCylinder (const Standar
|
||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (anIter.Value()->OverlapsCylinder (theBottomRad, theTopRad, theHeight, theTrsf, theClipRange, thePickResult))
|
||||
if (anIter.Value()->OverlapsCylinder (theBottomRad, theTopRad, theHeight, theTrsf,
|
||||
theIsHollow, theClipRange, thePickResult))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -529,6 +535,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCylinder (const Standar
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
const gp_Dir aCylNorm (gp::DZ().Transformed (theTrsf));
|
||||
@@ -589,7 +596,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCylinder (const Standar
|
||||
{
|
||||
aVertices[anIdx] = anIter.Value()->myVertices[anIdx];
|
||||
}
|
||||
if (anIter.Value()->IsDotInside (aPoints[i], aVertices))
|
||||
if (anIter.Value()->isDotInside (aPoints[i], aVertices))
|
||||
{
|
||||
isInside = true;
|
||||
break;
|
||||
@@ -607,7 +614,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCylinder (const Standar
|
||||
}
|
||||
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (anIter.Value()->OverlapsCylinder (theBottomRad, theTopRad, theHeight, theTrsf, theInside))
|
||||
if (anIter.Value()->OverlapsCylinder (theBottomRad, theTopRad, theHeight, theTrsf, theIsHollow, theInside))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -615,6 +622,109 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCylinder (const Standar
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const
|
||||
{
|
||||
Standard_ASSERT_RAISE (mySelectionType == SelectMgr_SelectionType_Polyline,
|
||||
"Error! SelectMgr_TriangularFrustumSet::Overlaps() should be called after selection frustum initialization");
|
||||
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (anIter.Value()->OverlapsCircle (theRadius, theTrsf, theIsFilled, theClipRange, thePickResult))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OverlapsCircle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustumSet::OverlapsCircle (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside) const
|
||||
{
|
||||
const gp_Pnt aCenter (gp::Origin().Transformed (theTrsf));
|
||||
const gp_Vec aVecPlane1 (myFrustums.First()->myVertices[0], myFrustums.First()->myVertices[1]);
|
||||
const gp_Vec aVecPlane2 (myFrustums.First()->myVertices[0], myFrustums.First()->myVertices[2]);
|
||||
|
||||
const gp_Dir aDirNorm (aVecPlane1.Crossed (aVecPlane2));
|
||||
const gp_Pln aPln (myFrustums.First()->myVertices[0], aDirNorm);
|
||||
Standard_Real aCoefA, aCoefB, aCoefC, aCoefD;
|
||||
aPln.Coefficients (aCoefA, aCoefB, aCoefC, aCoefD);
|
||||
|
||||
const Standard_Real aT = -(aCenter.XYZ().Dot (aDirNorm.XYZ()) + aCoefD) / aDirNorm.Dot (aDirNorm);
|
||||
const gp_Pnt aCenterProject (aCoefA * aT + aCenter.X(),
|
||||
aCoefB * aT + aCenter.Y(),
|
||||
aCoefC * aT + aCenter.Z());
|
||||
|
||||
gp_Pnt aVerticesBuf[3];
|
||||
TColgp_Array1OfPnt aVertices (aVerticesBuf[0], 0, 2);
|
||||
|
||||
if (!theIsFilled)
|
||||
{
|
||||
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (!anIter.Value()->OverlapsCircle (theRadius, theTrsf, theIsFilled, theInside))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (myToAllowOverlap)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (isIntersectBoundary (theRadius, theTrsf, theIsFilled))
|
||||
{
|
||||
if (theInside != NULL)
|
||||
{
|
||||
*theInside &= Standard_False;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (SelectMgr_TriangFrustums::Iterator anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (!anIter.Value()->OverlapsCircle (theRadius, theTrsf, theIsFilled, theInside))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (myToAllowOverlap)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (isIntersectBoundary (theRadius, theTrsf, theIsFilled))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (theInside != NULL)
|
||||
{
|
||||
*theInside &= Standard_False;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPlanes
|
||||
// purpose :
|
||||
@@ -638,6 +748,127 @@ void SelectMgr_TriangularFrustumSet::SetAllowOverlapDetection (const Standard_Bo
|
||||
myToAllowOverlap = theIsToAllow;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : PointInTriangle
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustumSet::pointInTriangle (const gp_Pnt& thePnt,
|
||||
const gp_Pnt& theV1, const gp_Pnt& theV2, const gp_Pnt& theV3)
|
||||
{
|
||||
gp_Vec a = theV1.XYZ() - thePnt.XYZ();
|
||||
gp_Vec b = theV2.XYZ() - thePnt.XYZ();
|
||||
gp_Vec c = theV3.XYZ() - thePnt.XYZ();
|
||||
|
||||
gp_Vec u = b.Crossed (c);
|
||||
gp_Vec v = c.Crossed (a);
|
||||
gp_Vec w = a.Crossed (b);
|
||||
|
||||
if (u.Dot (v) < 0.0 || u.Dot (w) < 0.0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : segmentSegmentIntersection
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustumSet::segmentSegmentIntersection (const gp_Pnt& theStartPnt1,
|
||||
const gp_Pnt& theEndPnt1,
|
||||
const gp_Pnt& theStartPnt2,
|
||||
const gp_Pnt& theEndPnt2)
|
||||
{
|
||||
gp_XYZ aVec1 = theEndPnt1.XYZ() - theStartPnt1.XYZ();
|
||||
gp_XYZ aVec2 = theEndPnt2.XYZ() - theStartPnt2.XYZ();
|
||||
gp_XYZ aVec21 = theStartPnt2.XYZ() - theStartPnt1.XYZ();
|
||||
gp_XYZ aVec12 = theStartPnt1.XYZ() - theStartPnt2.XYZ();
|
||||
if (Abs (aVec21.DotCross (aVec1, aVec2)) > Precision::Confusion() ||
|
||||
Abs (aVec12.DotCross (aVec2, aVec1)) > Precision::Confusion())
|
||||
{
|
||||
// lines are not coplanar
|
||||
return false;
|
||||
}
|
||||
|
||||
double aValue1 = aVec21.Crossed (aVec2).Dot (aVec1.Crossed (aVec2)) / aVec1.Crossed (aVec2).SquareModulus();
|
||||
double aValue2 = aVec12.Crossed (aVec1).Dot (aVec2.Crossed (aVec1)) / aVec2.Crossed (aVec1).SquareModulus();
|
||||
if (aValue1 < 0.0 || aValue1 > 1.0 || aValue2 < 0.0 || aValue2 > 1.0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : isIntersectBoundary
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustumSet::isIntersectBoundary (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled) const
|
||||
{
|
||||
Standard_Integer aFacesNb = myBoundaryPoints.Size() / 2;
|
||||
|
||||
const gp_Pnt& aCircCenter = theTrsf.TranslationPart();
|
||||
gp_Ax2 anAxis;
|
||||
anAxis.Transform (theTrsf);
|
||||
Handle(Geom_Circle) aCirc = new Geom_Circle (anAxis, theRadius);
|
||||
|
||||
gp_Dir aCircNorm = gp_Dir(0, 0, 1).Transformed (theTrsf);
|
||||
Handle(Geom_Surface) aCircPlane = new Geom_Plane(aCircCenter, aCircNorm);
|
||||
|
||||
for (Standard_Integer anIdx = myBoundaryPoints.Lower(); anIdx < aFacesNb + myBoundaryPoints.Lower(); anIdx++)
|
||||
{
|
||||
gp_Pnt aFace[4] = { myBoundaryPoints.Value (anIdx),
|
||||
myBoundaryPoints.Value (anIdx + aFacesNb),
|
||||
myBoundaryPoints.Value (anIdx % aFacesNb + 1 + aFacesNb),
|
||||
myBoundaryPoints.Value (anIdx % aFacesNb + 1) };
|
||||
|
||||
gp_Dir aBndPlaneNorm = gp_Vec (aFace[0], aFace[1]).Crossed (gp_Vec(aFace[0], aFace[2]));
|
||||
Handle(Geom_Surface) aBndPlane = new Geom_Plane(aFace[0], aBndPlaneNorm);
|
||||
|
||||
GeomInt_IntSS anInterSS (aCircPlane, aBndPlane, Precision::Confusion());
|
||||
if (!anInterSS.IsDone() || anInterSS.NbLines() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Handle(Geom_Line)& anInterLine = Handle(Geom_Line)::DownCast (anInterSS.Line(1));
|
||||
Standard_Real aDistance = anInterLine->Lin().Distance (aCircCenter);
|
||||
if (aDistance > theRadius)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
gp_Lin aLine = anInterLine->Lin();
|
||||
gp_Lin aNormalLine = aLine.Normal (aCircCenter);
|
||||
gp_Pnt aCrossPoint = aCircCenter.Translated (aNormalLine.Direction().Reversed().XYZ() * aDistance);
|
||||
|
||||
Standard_Real anOffset = Sqrt (theRadius * theRadius - aDistance * aDistance);
|
||||
// Line-circle intersection points
|
||||
gp_Pnt aP1 = aCrossPoint.Translated (aLine.Direction().XYZ() * anOffset);
|
||||
gp_Pnt aP2 = aCrossPoint.Translated (aLine.Direction().Reversed().XYZ() * anOffset);
|
||||
|
||||
if (pointInTriangle (aP1, aFace[0], aFace[1], aFace[2])
|
||||
|| pointInTriangle (aP1, aFace[0], aFace[2], aFace[3])
|
||||
|| pointInTriangle (aP2, aFace[0], aFace[1], aFace[2])
|
||||
|| pointInTriangle (aP2, aFace[0], aFace[2], aFace[3]))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (theIsFilled
|
||||
|| segmentSegmentIntersection (aP1, aP2, aFace[0], aFace[1])
|
||||
|| segmentSegmentIntersection (aP1, aP2, aFace[1], aFace[2])
|
||||
|| segmentSegmentIntersection (aP1, aP2, aFace[2], aFace[3])
|
||||
|| segmentSegmentIntersection (aP1, aP2, aFace[0], aFace[3]))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : isIntersectBoundary
|
||||
// purpose :
|
||||
@@ -669,7 +900,7 @@ Standard_Boolean SelectMgr_TriangularFrustumSet::isIntersectBoundary (const gp_P
|
||||
// purpose : Moller-Trumbore ray-triangle intersection test
|
||||
//=======================================================================
|
||||
Standard_Boolean SelectMgr_TriangularFrustumSet::segmentTriangleIntersection (const gp_Pnt& theOrig, const gp_Vec& theDir,
|
||||
const gp_Pnt& theV1, const gp_Pnt& theV2, const gp_Pnt& theV3) const
|
||||
const gp_Pnt& theV1, const gp_Pnt& theV2, const gp_Pnt& theV3)
|
||||
{
|
||||
gp_Vec aPVec, aTVec, aQVec;
|
||||
Standard_Real aD, aInvD, anU, aV, aT;
|
||||
|
@@ -124,6 +124,7 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
@@ -133,8 +134,24 @@ public:
|
||||
const Standard_Real theTopRad,
|
||||
const Standard_Real theHeight,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsHollow,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by cylinder (or cone) with radiuses theBottomRad
|
||||
//! and theTopRad, height theHeight and transformation to apply theTrsf.
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
const SelectMgr_ViewClipRange& theClipRange,
|
||||
SelectBasics_PickResult& thePickResult) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if selecting volume is overlapped by cylinder (or cone) with radiuses theBottomRad
|
||||
//! and theTopRad, height theHeight and transformation to apply theTrsf.
|
||||
Standard_EXPORT virtual Standard_Boolean OverlapsCircle (const Standard_Real theBottomRad,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled,
|
||||
Standard_Boolean* theInside = NULL) const Standard_OVERRIDE;
|
||||
|
||||
//! Stores plane equation coefficients (in the following form:
|
||||
//! Ax + By + Cz + D = 0) to the given vector
|
||||
Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
|
||||
@@ -151,15 +168,34 @@ private:
|
||||
//! Checks whether the segment intersects with the boundary of the current volume selection
|
||||
Standard_EXPORT Standard_Boolean isIntersectBoundary (const gp_Pnt& thePnt1, const gp_Pnt& thePnt2) const;
|
||||
|
||||
//! Checks whether the circle intersects with the boundary of the current volume selection
|
||||
Standard_EXPORT Standard_Boolean isIntersectBoundary (const Standard_Real theRadius,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theIsFilled) const;
|
||||
|
||||
//! Checks whether the triangle intersects with a segment
|
||||
Standard_EXPORT Standard_Boolean segmentTriangleIntersection (const gp_Pnt &theOrig, const gp_Vec& theDir,
|
||||
const gp_Pnt& theV1, const gp_Pnt& theV2, const gp_Pnt& theV3) const;
|
||||
Standard_EXPORT static Standard_Boolean segmentTriangleIntersection (const gp_Pnt &theOrig, const gp_Vec& theDir,
|
||||
const gp_Pnt& theV1, const gp_Pnt& theV2, const gp_Pnt& theV3);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean segmentSegmentIntersection (const gp_Pnt& theStartPnt1,
|
||||
const gp_Pnt& theEndPnt1,
|
||||
const gp_Pnt& theStartPnt2,
|
||||
const gp_Pnt& theEndPnt2);
|
||||
|
||||
Standard_EXPORT static Standard_Boolean pointInTriangle (const gp_Pnt& thePnt,
|
||||
const gp_Pnt& theV1, const gp_Pnt& theV2, const gp_Pnt& theV3);
|
||||
|
||||
private:
|
||||
|
||||
SelectMgr_TriangFrustums myFrustums; //!< set of triangular frustums
|
||||
SelectionPolyline mySelPolyline; //!< parameters of selection polyline (it is used to build triangle frustum set)
|
||||
TColgp_Array1OfPnt myBoundaryPoints; //!< boundary points
|
||||
//! 1_____2
|
||||
//! /| |\ .
|
||||
//! 4/_|_____|_\3
|
||||
//! | 5|_____|6 |
|
||||
//! | / \ |
|
||||
//! 8|/_________\|7
|
||||
Standard_Boolean myToAllowOverlap; //!< flag to detect only fully included sensitives or not
|
||||
};
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <Standard_Std.hxx>
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
class Standard_Transient;
|
||||
|
||||
@@ -71,7 +72,7 @@ namespace opencascade {
|
||||
}
|
||||
|
||||
//! Move constructor
|
||||
handle (handle&& theHandle) noexcept : entity(theHandle.entity)
|
||||
handle (handle&& theHandle) Standard_Noexcept : entity(theHandle.entity)
|
||||
{
|
||||
theHandle.entity = 0;
|
||||
}
|
||||
@@ -112,7 +113,7 @@ namespace opencascade {
|
||||
}
|
||||
|
||||
//! Move operator
|
||||
handle& operator= (handle&& theHandle) noexcept
|
||||
handle& operator= (handle&& theHandle) Standard_Noexcept
|
||||
{
|
||||
std::swap (this->entity, theHandle.entity);
|
||||
return *this;
|
||||
|
@@ -315,5 +315,21 @@
|
||||
#define Standard_ATOMIC(theType) theType
|
||||
#endif
|
||||
|
||||
//! @def Standard_Noexcept
|
||||
//! Definition of Standard_Noexcept:
|
||||
//! if noexcept is accessible, Standard_Noexcept is "noexcept" and "throw()" otherwise.
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1900
|
||||
#define Standard_Noexcept noexcept
|
||||
#else
|
||||
#define Standard_Noexcept throw()
|
||||
#endif
|
||||
#else
|
||||
#if __cplusplus >= 201103L
|
||||
#define Standard_Noexcept noexcept
|
||||
#else
|
||||
#define Standard_Noexcept throw()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include <Select3D_SensitiveFace.hxx>
|
||||
#include <Select3D_SensitiveGroup.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
#include <Select3D_SensitivePoly.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <Select3D_SensitiveSphere.hxx>
|
||||
#include <Select3D_SensitiveTriangulation.hxx>
|
||||
@@ -60,7 +61,6 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#define BVH_PRIMITIVE_LIMIT 800000
|
||||
|
||||
@@ -249,6 +249,7 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
case TopAbs_FACE:
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face (theShape);
|
||||
|
||||
Select3D_EntitySequence aSensitiveList;
|
||||
GetSensitiveForFace (aFace, theOwner,
|
||||
aSensitiveList,
|
||||
@@ -266,159 +267,15 @@ void StdSelect_BRepSelectionTool::ComputeSensitive (const TopoDS_Shape& theShape
|
||||
{
|
||||
TopTools_IndexedMapOfShape aSubfacesMap;
|
||||
TopExp::MapShapes (theShape, TopAbs_FACE, aSubfacesMap);
|
||||
if (aSubfacesMap.Extent() == 2) // detect cone
|
||||
|
||||
if (!GetSensitiveForCylinder (aSubfacesMap, theOwner, theSelection))
|
||||
{
|
||||
const TopoDS_Face* aFaces[2] =
|
||||
for (Standard_Integer aShIndex = 1; aShIndex <= aSubfacesMap.Extent(); ++aShIndex)
|
||||
{
|
||||
&TopoDS::Face (aSubfacesMap.FindKey (1)),
|
||||
&TopoDS::Face (aSubfacesMap.FindKey (2))
|
||||
};
|
||||
|
||||
TopLoc_Location aLocSurf[2];
|
||||
const Handle(Geom_Surface)* aSurfaces[2] =
|
||||
{
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf[0]),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf[1])
|
||||
};
|
||||
|
||||
Standard_Integer aConIndex = 0;
|
||||
Handle(Geom_ConicalSurface) aGeomCone = Handle(Geom_ConicalSurface)::DownCast (*aSurfaces[0]);
|
||||
Handle(Geom_Plane) aGeomPln;
|
||||
if (!aGeomCone.IsNull())
|
||||
{
|
||||
aGeomPln = Handle(Geom_Plane)::DownCast (*aSurfaces[1]);
|
||||
ComputeSensitive (aSubfacesMap.FindKey (aShIndex), theOwner,
|
||||
theSelection,
|
||||
theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
|
||||
}
|
||||
else
|
||||
{
|
||||
aConIndex = 1;
|
||||
aGeomCone = Handle(Geom_ConicalSurface)::DownCast (*aSurfaces[1]);
|
||||
aGeomPln = Handle(Geom_Plane)::DownCast (*aSurfaces[0]);
|
||||
}
|
||||
if (!aGeomCone.IsNull()
|
||||
&& !aGeomPln.IsNull()
|
||||
&& aGeomPln->Position().Direction().IsEqual (aGeomCone->Position().Direction(), Precision::Angular()))
|
||||
{
|
||||
const gp_Cone aCone = BRepAdaptor_Surface (*aFaces[aConIndex]).Cone();
|
||||
const Standard_Real aRad1 = aCone.RefRadius();
|
||||
const Standard_Real aHeight = (aRad1 != 0.0)
|
||||
? aRad1 / Abs (Tan (aCone.SemiAngle()))
|
||||
: aCone.Location().Distance (aGeomPln->Location().Transformed (aLocSurf[aConIndex == 0 ? 1 : 0]));
|
||||
const Standard_Real aRad2 = (aRad1 != 0.0) ? 0.0 : Tan (aCone.SemiAngle()) * aHeight;
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCone.Position(), gp_Ax3());
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf);
|
||||
theSelection->Add (aSensSCyl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aSubfacesMap.Extent() == 3) // detect cylinder or truncated cone
|
||||
{
|
||||
const TopoDS_Face* aFaces[3] =
|
||||
{
|
||||
&TopoDS::Face (aSubfacesMap.FindKey (1)),
|
||||
&TopoDS::Face (aSubfacesMap.FindKey (2)),
|
||||
&TopoDS::Face (aSubfacesMap.FindKey (3))
|
||||
};
|
||||
|
||||
TopLoc_Location aLocSurf[3];
|
||||
const Handle(Geom_Surface)* aSurfaces[3] =
|
||||
{
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf[0]),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf[1]),
|
||||
&BRep_Tool::Surface (*aFaces[2], aLocSurf[2])
|
||||
};
|
||||
|
||||
Standard_Integer aConIndex = -1, aNbPlanes = 0;
|
||||
Handle(Geom_ConicalSurface) aGeomCone;
|
||||
Handle(Geom_CylindricalSurface) aGeomCyl;
|
||||
Handle(Geom_Plane) aGeomPlanes[2];
|
||||
const TopLoc_Location* aGeomPlanesLoc[2];
|
||||
for (Standard_Integer aSurfIter = 0; aSurfIter < 3; ++aSurfIter)
|
||||
{
|
||||
const Handle(Geom_Surface)& aSurf = *aSurfaces[aSurfIter];
|
||||
if (aConIndex == -1)
|
||||
{
|
||||
aGeomCone = Handle (Geom_ConicalSurface)::DownCast (aSurf);
|
||||
if (!aGeomCone.IsNull())
|
||||
{
|
||||
aConIndex = aSurfIter;
|
||||
continue;
|
||||
}
|
||||
aGeomCyl = Handle (Geom_CylindricalSurface)::DownCast (aSurf);
|
||||
if (!aGeomCyl.IsNull())
|
||||
{
|
||||
aConIndex = aSurfIter;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (aNbPlanes < 2)
|
||||
{
|
||||
aGeomPlanes[aNbPlanes] = Handle(Geom_Plane)::DownCast (aSurf);
|
||||
if (!aGeomPlanes[aNbPlanes].IsNull())
|
||||
{
|
||||
aGeomPlanesLoc[aNbPlanes] = &aLocSurf[aSurfIter];
|
||||
++aNbPlanes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!aGeomCone.IsNull())
|
||||
{
|
||||
if (!aGeomPlanes[0].IsNull()
|
||||
&& !aGeomPlanes[1].IsNull()
|
||||
&& aGeomPlanes[0]->Position().Direction().IsEqual (aGeomCone->Position().Direction(), Precision::Angular())
|
||||
&& aGeomPlanes[1]->Position().Direction().IsEqual (aGeomCone->Position().Direction(), Precision::Angular()))
|
||||
{
|
||||
const gp_Cone aCone = BRepAdaptor_Surface (*aFaces[aConIndex]).Cone();
|
||||
const Standard_Real aRad1 = aCone.RefRadius();
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Transformed (*aGeomPlanesLoc[0])
|
||||
.Distance (aGeomPlanes[1]->Location().Transformed (*aGeomPlanesLoc[1]));
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCone.Position(), gp_Ax3());
|
||||
const Standard_Real aTriangleHeight = (aCone.SemiAngle() > 0.0)
|
||||
? aRad1 / Tan (aCone.SemiAngle())
|
||||
: aRad1 / Tan (Abs (aCone.SemiAngle())) - aHeight;
|
||||
const Standard_Real aRad2 = (aCone.SemiAngle() > 0.0)
|
||||
? aRad1 * (aTriangleHeight + aHeight) / aTriangleHeight
|
||||
: aRad1 * aTriangleHeight / (aTriangleHeight + aHeight);
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf);
|
||||
theSelection->Add (aSensSCyl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!aGeomCyl.IsNull())
|
||||
{
|
||||
if (!aGeomPlanes[0].IsNull()
|
||||
&& !aGeomPlanes[1].IsNull()
|
||||
&& aGeomPlanes[0]->Position().Direction().IsParallel (aGeomCyl->Position().Direction(), Precision::Angular())
|
||||
&& aGeomPlanes[1]->Position().Direction().IsParallel (aGeomCyl->Position().Direction(), Precision::Angular()))
|
||||
{
|
||||
const gp_Cylinder aCyl = BRepAdaptor_Surface (*aFaces[aConIndex]).Cylinder();
|
||||
const Standard_Real aRad = aCyl.Radius();
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Transformed (*aGeomPlanesLoc[0])
|
||||
.Distance (aGeomPlanes[1]->Location().Transformed (*aGeomPlanesLoc[1]));
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
gp_Ax3 aPos = aCyl.Position();
|
||||
if (aGeomPlanes[0]->Position().IsCoplanar (aGeomPlanes[1]->Position(), Precision::Angular(), Precision::Angular()))
|
||||
{
|
||||
// cylinders created as a prism have an inverse vector of the cylindrical surface
|
||||
aPos.SetDirection (aPos.Direction().Reversed());
|
||||
}
|
||||
aTrsf.SetTransformation (aPos, gp_Ax3());
|
||||
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad, aRad, aHeight, aTrsf);
|
||||
theSelection->Add (aSensSCyl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Standard_Integer aShIndex = 1; aShIndex <= aSubfacesMap.Extent(); ++aShIndex)
|
||||
{
|
||||
ComputeSensitive (aSubfacesMap.FindKey (aShIndex), theOwner,
|
||||
theSelection,
|
||||
theDeflection, theDeviationAngle, theNbPOnEdge, theMaxParam, isAutoTriangulation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -633,8 +490,7 @@ void StdSelect_BRepSelectionTool::GetEdgeSensitive (const TopoDS_Shape& theShape
|
||||
}
|
||||
else
|
||||
{
|
||||
theSensitive = new Select3D_SensitiveCircle (theOwner, aCircle,
|
||||
aParamFirst, aParamLast, Standard_False, 16);
|
||||
theSensitive = new Select3D_SensitivePoly (theOwner, aCircle, aParamFirst, aParamLast, Standard_False);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -705,6 +561,57 @@ void StdSelect_BRepSelectionTool::GetEdgeSensitive (const TopoDS_Shape& theShape
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getCylinderHeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Real getCylinderHeight (const Handle(Poly_Triangulation)& theTriangulation,
|
||||
const TopLoc_Location& theLoc)
|
||||
{
|
||||
Bnd_Box aBox;
|
||||
gp_Trsf aScaleTrsf;
|
||||
aScaleTrsf.SetScaleFactor (theLoc.Transformation().ScaleFactor());
|
||||
theTriangulation->MinMax (aBox, aScaleTrsf);
|
||||
return aBox.CornerMax().Z() - aBox.CornerMin().Z();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isCylinderOrCone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean isCylinderOrCone (const TopoDS_Face& theHollowCylinder, const gp_Pnt& theLocation, gp_Dir& theDirection)
|
||||
{
|
||||
Standard_Integer aCirclesNb = 0;
|
||||
Standard_Boolean isCylinder = Standard_False;
|
||||
gp_Pnt aPos;
|
||||
|
||||
TopExp_Explorer anEdgeExp;
|
||||
for (anEdgeExp.Init (theHollowCylinder, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeExp.Current());
|
||||
BRepAdaptor_Curve anAdaptor (anEdge);
|
||||
|
||||
if (anAdaptor.GetType() == GeomAbs_Circle
|
||||
&& BRep_Tool::IsClosed (anEdge))
|
||||
{
|
||||
aCirclesNb++;
|
||||
isCylinder = Standard_True;
|
||||
if (aCirclesNb == 2)
|
||||
{
|
||||
// Reverse the direction of the cylinder, relevant if the cylinder was created as a prism
|
||||
if (aPos.IsEqual (theLocation, Precision::Confusion()))
|
||||
{
|
||||
theDirection.Reverse();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
aPos = anAdaptor.Circle().Location().XYZ();
|
||||
}
|
||||
}
|
||||
|
||||
return isCylinder;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSensitiveEntityForFace
|
||||
//purpose :
|
||||
@@ -749,6 +656,76 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else if (Handle(Geom_ConicalSurface) aGeomCone = Handle(Geom_ConicalSurface)::DownCast (aSurf))
|
||||
{
|
||||
gp_Dir aDummyDir;
|
||||
if (isCylinderOrCone (theFace, gp_Pnt(), aDummyDir))
|
||||
{
|
||||
const gp_Cone aCone = BRepAdaptor_Surface (theFace).Cone();
|
||||
const Standard_Real aRad1 = aCone.RefRadius();
|
||||
const Standard_Real aHeight = getCylinderHeight (aTriangulation, aLoc);
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCone.Position(), gp::XOY());
|
||||
|
||||
Standard_Real aRad2;
|
||||
if (aRad1 == 0.0)
|
||||
{
|
||||
aRad2 = Tan (aCone.SemiAngle()) * aHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
const Standard_Real aTriangleHeight = (aCone.SemiAngle() > 0.0)
|
||||
? aRad1 / Tan (aCone.SemiAngle())
|
||||
: aRad1 / Tan (Abs (aCone.SemiAngle())) - aHeight;
|
||||
aRad2 = (aCone.SemiAngle() > 0.0)
|
||||
? aRad1 * (aTriangleHeight + aHeight) / aTriangleHeight
|
||||
: aRad1 * aTriangleHeight / (aTriangleHeight + aHeight);
|
||||
}
|
||||
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf, true);
|
||||
theSensitiveList.Append (aSensSCyl);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else if (Handle(Geom_CylindricalSurface) aGeomCyl = Handle(Geom_CylindricalSurface)::DownCast (aSurf))
|
||||
{
|
||||
const gp_Cylinder aCyl = BRepAdaptor_Surface (theFace).Cylinder();
|
||||
gp_Ax3 aPos = aCyl.Position();
|
||||
gp_Dir aDirection = aPos.Direction();
|
||||
|
||||
if (isCylinderOrCone (theFace, aPos.Location(), aDirection))
|
||||
{
|
||||
const Standard_Real aRad = aCyl.Radius();
|
||||
const Standard_Real aHeight = getCylinderHeight (aTriangulation, aLoc);
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
aPos.SetDirection (aDirection);
|
||||
aTrsf.SetTransformation (aPos, gp::XOY());
|
||||
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad, aRad, aHeight, aTrsf, true);
|
||||
theSensitiveList.Append (aSensSCyl);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else if (Handle(Geom_Plane) aGeomPlane = Handle(Geom_Plane)::DownCast (aSurf))
|
||||
{
|
||||
TopTools_IndexedMapOfShape aSubfacesMap;
|
||||
TopExp::MapShapes (theFace, TopAbs_EDGE, aSubfacesMap);
|
||||
if (aSubfacesMap.Extent() == 1)
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge (aSubfacesMap.FindKey (1));
|
||||
BRepAdaptor_Curve anAdaptor (anEdge);
|
||||
if (anAdaptor.GetType() == GeomAbs_Circle
|
||||
&& BRep_Tool::IsClosed (anEdge))
|
||||
{
|
||||
Handle(Select3D_SensitiveCircle) aSensSCyl = new Select3D_SensitiveCircle (theOwner, anAdaptor.Circle(), theInteriorFlag);
|
||||
theSensitiveList.Append (aSensSCyl);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Select3D_SensitiveTriangulation) STG = new Select3D_SensitiveTriangulation (theOwner, aTriangulation, aLoc, theInteriorFlag);
|
||||
theSensitiveList.Append (STG);
|
||||
return Standard_True;
|
||||
@@ -877,7 +854,7 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
|
||||
}
|
||||
else
|
||||
{
|
||||
theSensitiveList.Append (new Select3D_SensitiveCircle (theOwner, cu3d.Circle(), theInteriorFlag, 16));
|
||||
theSensitiveList.Append (new Select3D_SensitiveCircle (theOwner, cu3d.Circle(), theInteriorFlag));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -947,3 +924,163 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSensitiveForCylinder
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForCylinder (const TopTools_IndexedMapOfShape& theSubfacesMap,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Selection)& theSelection)
|
||||
{
|
||||
if (theSubfacesMap.Extent() == 2) // detect cone
|
||||
{
|
||||
const TopoDS_Face* aFaces[2] =
|
||||
{
|
||||
&TopoDS::Face (theSubfacesMap.FindKey (1)),
|
||||
&TopoDS::Face (theSubfacesMap.FindKey (2))
|
||||
};
|
||||
|
||||
TopLoc_Location aLocSurf[2];
|
||||
const Handle(Geom_Surface)* aSurfaces[2] =
|
||||
{
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf[0]),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf[1])
|
||||
};
|
||||
|
||||
Standard_Integer aConIndex = 0;
|
||||
Handle(Geom_ConicalSurface) aGeomCone = Handle(Geom_ConicalSurface)::DownCast (*aSurfaces[0]);
|
||||
Handle(Geom_Plane) aGeomPln;
|
||||
if (!aGeomCone.IsNull())
|
||||
{
|
||||
aGeomPln = Handle(Geom_Plane)::DownCast (*aSurfaces[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
aConIndex = 1;
|
||||
aGeomCone = Handle(Geom_ConicalSurface)::DownCast (*aSurfaces[1]);
|
||||
aGeomPln = Handle(Geom_Plane)::DownCast (*aSurfaces[0]);
|
||||
}
|
||||
if (!aGeomCone.IsNull()
|
||||
&& !aGeomPln.IsNull()
|
||||
&& aGeomPln->Position().Direction().IsEqual (aGeomCone->Position().Direction(), Precision::Angular()))
|
||||
{
|
||||
const gp_Cone aCone = BRepAdaptor_Surface (*aFaces[aConIndex]).Cone();
|
||||
const Standard_Real aRad1 = aCone.RefRadius();
|
||||
const Standard_Real aHeight = (aRad1 != 0.0)
|
||||
? aRad1 / Abs (Tan (aCone.SemiAngle()))
|
||||
: aCone.Location().Distance (aGeomPln->Location().Transformed (aLocSurf[aConIndex == 0 ? 1 : 0]));
|
||||
const Standard_Real aRad2 = (aRad1 != 0.0) ? 0.0 : Tan (aCone.SemiAngle()) * aHeight;
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCone.Position(), gp::XOY());
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf);
|
||||
theSelection->Add (aSensSCyl);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
if (theSubfacesMap.Extent() == 3) // detect cylinder or truncated cone
|
||||
{
|
||||
const TopoDS_Face* aFaces[3] =
|
||||
{
|
||||
&TopoDS::Face (theSubfacesMap.FindKey (1)),
|
||||
&TopoDS::Face (theSubfacesMap.FindKey (2)),
|
||||
&TopoDS::Face (theSubfacesMap.FindKey (3))
|
||||
};
|
||||
|
||||
TopLoc_Location aLocSurf[3];
|
||||
const Handle(Geom_Surface)* aSurfaces[3] =
|
||||
{
|
||||
&BRep_Tool::Surface (*aFaces[0], aLocSurf[0]),
|
||||
&BRep_Tool::Surface (*aFaces[1], aLocSurf[1]),
|
||||
&BRep_Tool::Surface (*aFaces[2], aLocSurf[2])
|
||||
};
|
||||
|
||||
Standard_Integer aConIndex = -1, aNbPlanes = 0;
|
||||
Handle(Geom_ConicalSurface) aGeomCone;
|
||||
Handle(Geom_CylindricalSurface) aGeomCyl;
|
||||
Handle(Geom_Plane) aGeomPlanes[2];
|
||||
const TopLoc_Location* aGeomPlanesLoc[2];
|
||||
for (Standard_Integer aSurfIter = 0; aSurfIter < 3; ++aSurfIter)
|
||||
{
|
||||
const Handle(Geom_Surface)& aSurf = *aSurfaces[aSurfIter];
|
||||
if (aConIndex == -1)
|
||||
{
|
||||
aGeomCone = Handle (Geom_ConicalSurface)::DownCast (aSurf);
|
||||
if (!aGeomCone.IsNull())
|
||||
{
|
||||
aConIndex = aSurfIter;
|
||||
continue;
|
||||
}
|
||||
aGeomCyl = Handle (Geom_CylindricalSurface)::DownCast (aSurf);
|
||||
if (!aGeomCyl.IsNull())
|
||||
{
|
||||
aConIndex = aSurfIter;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (aNbPlanes < 2)
|
||||
{
|
||||
aGeomPlanes[aNbPlanes] = Handle(Geom_Plane)::DownCast (aSurf);
|
||||
if (!aGeomPlanes[aNbPlanes].IsNull())
|
||||
{
|
||||
aGeomPlanesLoc[aNbPlanes] = &aLocSurf[aSurfIter];
|
||||
++aNbPlanes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!aGeomCone.IsNull())
|
||||
{
|
||||
if (!aGeomPlanes[0].IsNull()
|
||||
&& !aGeomPlanes[1].IsNull()
|
||||
&& aGeomPlanes[0]->Position().Direction().IsEqual (aGeomCone->Position().Direction(), Precision::Angular())
|
||||
&& aGeomPlanes[1]->Position().Direction().IsEqual (aGeomCone->Position().Direction(), Precision::Angular()))
|
||||
{
|
||||
const gp_Cone aCone = BRepAdaptor_Surface (*aFaces[aConIndex]).Cone();
|
||||
const Standard_Real aRad1 = aCone.RefRadius();
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Transformed (*aGeomPlanesLoc[0])
|
||||
.Distance (aGeomPlanes[1]->Location().Transformed (*aGeomPlanesLoc[1]));
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (aCone.Position(), gp::XOY());
|
||||
const Standard_Real aTriangleHeight = (aCone.SemiAngle() > 0.0)
|
||||
? aRad1 / Tan (aCone.SemiAngle())
|
||||
: aRad1 / Tan (Abs (aCone.SemiAngle())) - aHeight;
|
||||
const Standard_Real aRad2 = (aCone.SemiAngle() > 0.0)
|
||||
? aRad1 * (aTriangleHeight + aHeight) / aTriangleHeight
|
||||
: aRad1 * aTriangleHeight / (aTriangleHeight + aHeight);
|
||||
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf);
|
||||
theSelection->Add (aSensSCyl);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else if (!aGeomCyl.IsNull())
|
||||
{
|
||||
if (!aGeomPlanes[0].IsNull()
|
||||
&& !aGeomPlanes[1].IsNull()
|
||||
&& aGeomPlanes[0]->Position().Direction().IsParallel (aGeomCyl->Position().Direction(), Precision::Angular())
|
||||
&& aGeomPlanes[1]->Position().Direction().IsParallel (aGeomCyl->Position().Direction(), Precision::Angular()))
|
||||
{
|
||||
const gp_Cylinder aCyl = BRepAdaptor_Surface (*aFaces[aConIndex]).Cylinder();
|
||||
const Standard_Real aRad = aCyl.Radius();
|
||||
const Standard_Real aHeight = aGeomPlanes[0]->Location().Transformed (*aGeomPlanesLoc[0])
|
||||
.Distance (aGeomPlanes[1]->Location().Transformed (*aGeomPlanesLoc[1]));
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
gp_Ax3 aPos = aCyl.Position();
|
||||
if (aGeomPlanes[0]->Position().IsCoplanar (aGeomPlanes[1]->Position(), Precision::Angular(), Precision::Angular()))
|
||||
{
|
||||
// cylinders created as a prism have an inverse vector of the cylindrical surface
|
||||
aPos.SetDirection (aPos.Direction().Reversed());
|
||||
}
|
||||
aTrsf.SetTransformation (aPos, gp::XOY());
|
||||
|
||||
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad, aRad, aHeight, aTrsf);
|
||||
theSelection->Add (aSensSCyl);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <Select3D_EntitySequence.hxx>
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
class SelectMgr_SelectableObject;
|
||||
class TopoDS_Face;
|
||||
|
||||
@@ -124,14 +125,14 @@ public:
|
||||
}
|
||||
|
||||
//! Computes the sensitive primitives, stores them in the SelectMgr_Selection object, and returns this object.
|
||||
//! @param theShape shape to compute sensitive entities
|
||||
//! @param theOwner selectable owner object
|
||||
//! @param theSelection selection to append new sensitive entities
|
||||
//! @param theDeflection linear deflection
|
||||
//! @param theDeflAngle angular deflection
|
||||
//! @param theNbPOnEdge sensitivity parameters for edges and wires
|
||||
//! @param theMaxiParam sensitivity parameters for infinite objects (the default value is 500)
|
||||
//! @param theAutoTriang flag to compute triangulation for the faces which have none
|
||||
//! @param[in] theShape shape to compute sensitive entities
|
||||
//! @param[in] theOwner selectable owner object
|
||||
//! @param[in] theSelection selection to append new sensitive entities
|
||||
//! @param[in] theDeflection linear deflection
|
||||
//! @param[in] theDeflAngle angular deflection
|
||||
//! @param[in] theNbPOnEdge sensitivity parameters for edges and wires
|
||||
//! @param[in] theMaxiParam sensitivity parameters for infinite objects (the default value is 500)
|
||||
//! @param[in] theAutoTriang flag to compute triangulation for the faces which have none
|
||||
Standard_EXPORT static void ComputeSensitive (const TopoDS_Shape& theShape,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Selection)& theSelection,
|
||||
@@ -142,13 +143,13 @@ public:
|
||||
const Standard_Boolean theAutoTriang = Standard_True);
|
||||
|
||||
//! Creates the 3D sensitive entities for Face selection.
|
||||
//! @param theFace face to compute sensitive entities
|
||||
//! @param theOwner selectable owner object
|
||||
//! @param theOutList output result list to append created entities
|
||||
//! @param theAutoTriang obsolete flag (has no effect)
|
||||
//! @param theNbPOnEdge sensitivity parameters
|
||||
//! @param theMaxiParam sensitivity parameters
|
||||
//! @param theInteriorFlag flag indicating that face interior (TRUE) or face boundary (FALSE) should be selectable
|
||||
//! @param[in] theFace face to compute sensitive entities
|
||||
//! @param[in] theOwner selectable owner object
|
||||
//! @param[out] theOutList output result list to append created entities
|
||||
//! @param[in] theAutoTriang obsolete flag (has no effect)
|
||||
//! @param[in] theNbPOnEdge sensitivity parameters
|
||||
//! @param[in] theMaxiParam sensitivity parameters
|
||||
//! @param[in] theInteriorFlag flag indicating that face interior (TRUE) or face boundary (FALSE) should be selectable
|
||||
Standard_EXPORT static Standard_Boolean GetSensitiveForFace (const TopoDS_Face& theFace,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
Select3D_EntitySequence& theOutList,
|
||||
@@ -157,14 +158,22 @@ public:
|
||||
const Standard_Real theMaxiParam = 500,
|
||||
const Standard_Boolean theInteriorFlag = Standard_True);
|
||||
|
||||
//! Creates a sensitive cylinder.
|
||||
//! @param[in] theSubfacesMap map of cylinder faces
|
||||
//! @param[in] theOwner selectable owner object
|
||||
//! @param[in] theSelection selection to append new sensitive entities
|
||||
Standard_EXPORT static Standard_Boolean GetSensitiveForCylinder (const TopTools_IndexedMapOfShape& theSubfacesMap,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Selection)& theSelection);
|
||||
|
||||
//! Create a sensitive edge or sensitive wire.
|
||||
//! @param theShape either TopoDS_Edge or TopoDS_Wire to compute sensitive entities
|
||||
//! @param theOwner selectable owner object
|
||||
//! @param theSelection selection to append new sensitive entities
|
||||
//! @param theDeflection linear deflection
|
||||
//! @param theDeviationAngle angular deflection
|
||||
//! @param theNbPOnEdge sensitivity parameters
|
||||
//! @param theMaxiParam sensitivity parameters
|
||||
//! @param[in] theShape either TopoDS_Edge or TopoDS_Wire to compute sensitive entities
|
||||
//! @param[in] theOwner selectable owner object
|
||||
//! @param[in] theSelection selection to append new sensitive entities
|
||||
//! @param[in] theDeflection linear deflection
|
||||
//! @param[in] theDeviationAngle angular deflection
|
||||
//! @param[in] theNbPOnEdge sensitivity parameters
|
||||
//! @param[out] theMaxiParam sensitivity parameters
|
||||
Standard_EXPORT static void GetEdgeSensitive (const TopoDS_Shape& theShape,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(SelectMgr_Selection)& theSelection,
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include <ShapeAlgo.hxx>
|
||||
#include <ShapeAlgo_AlgoContainer.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <StepData_GlobalFactors.hxx>
|
||||
#include <StepGeom_BSplineSurface.hxx>
|
||||
#include <StepGeom_BSplineSurfaceForm.hxx>
|
||||
#include <StepGeom_OffsetSurface.hxx>
|
||||
@@ -488,9 +489,11 @@ StepToTopoDS_TranslateFace::createMesh(const Handle(StepVisual_TriangulatedFace)
|
||||
const Standard_Boolean aHasNormals = (theTF->NbNormals() > 0);
|
||||
Handle(Poly_Triangulation) aMesh = new Poly_Triangulation(theTF->NbPnindex(), theTF->NbTriangles(), aHasUVNodes, aHasNormals);
|
||||
|
||||
const Standard_Real aLF = StepData_GlobalFactors::Intance().LengthFactor();
|
||||
for (Standard_Integer j = 1; j <= theTF->NbPnindex(); ++j)
|
||||
{
|
||||
aMesh->SetNode(j, aNodes->Value(theTF->PnindexValue(j)));
|
||||
const gp_XYZ& aPoint = aNodes->Value(theTF->PnindexValue(j));
|
||||
aMesh->SetNode(j, aPoint * aLF);
|
||||
}
|
||||
|
||||
for (Standard_Integer k = 1; k <= theTF->NbTriangles(); ++k)
|
||||
@@ -573,9 +576,11 @@ StepToTopoDS_TranslateFace::createMesh(const Handle(StepVisual_ComplexTriangulat
|
||||
Handle(Poly_Triangulation) aMesh = new Poly_Triangulation(theTF->NbPnindex(),
|
||||
aNbTriaStrips + aNbTriaFans, aHasUVNodes, aHasNormals);
|
||||
|
||||
const Standard_Real aLF = StepData_GlobalFactors::Intance().LengthFactor();
|
||||
for (Standard_Integer j = 1; j <= theTF->NbPnindex(); ++j)
|
||||
{
|
||||
aMesh->SetNode(j, aNodes->Value(theTF->PnindexValue(j)));
|
||||
const gp_XYZ& aPoint = aNodes->Value(theTF->PnindexValue(j));
|
||||
aMesh->SetNode(j, aLF * aPoint);
|
||||
}
|
||||
|
||||
Standard_Integer k = 1;
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_IStream.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
class TCollection_ExtendedString;
|
||||
|
||||
//! Class defines a variable-length sequence of 8-bit characters.
|
||||
@@ -74,7 +75,7 @@ public:
|
||||
Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring);
|
||||
|
||||
//! Move constructor
|
||||
TCollection_AsciiString (TCollection_AsciiString&& theOther) noexcept
|
||||
TCollection_AsciiString (TCollection_AsciiString&& theOther) Standard_Noexcept
|
||||
: mystring (theOther.mystring),
|
||||
mylength (theOther.mylength)
|
||||
{
|
||||
@@ -276,7 +277,7 @@ void operator = (const TCollection_AsciiString& fromwhere)
|
||||
Standard_EXPORT void Swap (TCollection_AsciiString& theOther);
|
||||
|
||||
//! Move assignment operator
|
||||
TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) noexcept { Swap (theOther); return *this; }
|
||||
TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) Standard_Noexcept { Swap (theOther); return *this; }
|
||||
|
||||
//! Frees memory allocated by AsciiString.
|
||||
Standard_EXPORT ~TCollection_AsciiString();
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
@@ -98,7 +99,7 @@ public:
|
||||
Standard_EXPORT TCollection_ExtendedString(const TCollection_ExtendedString& astring);
|
||||
|
||||
//! Move constructor
|
||||
TCollection_ExtendedString (TCollection_ExtendedString&& theOther) noexcept
|
||||
TCollection_ExtendedString (TCollection_ExtendedString&& theOther) Standard_Noexcept
|
||||
: mystring (theOther.mystring),
|
||||
mylength (theOther.mylength)
|
||||
{
|
||||
@@ -153,7 +154,7 @@ void operator = (const TCollection_ExtendedString& fromwhere)
|
||||
Standard_EXPORT void Swap (TCollection_ExtendedString& theOther);
|
||||
|
||||
//! Move assignment operator
|
||||
TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) noexcept { Swap (theOther); return *this; }
|
||||
TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) Standard_Noexcept { Swap (theOther); return *this; }
|
||||
|
||||
//! Frees memory allocated by ExtendedString.
|
||||
Standard_EXPORT ~TCollection_ExtendedString();
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Macro.hxx>
|
||||
class TopLoc_SListNodeOfItemLocation;
|
||||
class TopLoc_ItemLocation;
|
||||
|
||||
@@ -69,13 +70,13 @@ public:
|
||||
}
|
||||
|
||||
//! Move constructor
|
||||
TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) noexcept
|
||||
TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
|
||||
: myNode(std::move (theOther.myNode))
|
||||
{
|
||||
}
|
||||
|
||||
//! Move operator
|
||||
TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) noexcept
|
||||
TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
|
||||
{
|
||||
myNode = std::move (theOther.myNode);
|
||||
return *this;
|
||||
|
@@ -132,6 +132,7 @@
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
#include <Select3D_SensitivePoly.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
|
||||
@@ -1965,8 +1966,14 @@ public:
|
||||
// CASCADE RTTI
|
||||
DEFINE_STANDARD_RTTI_INLINE(FilledCircle, AIS_InteractiveObject);
|
||||
|
||||
FilledCircle (const gp_Pnt& theCenter, Standard_Real theRadius);
|
||||
FilledCircle (Handle(Geom_Circle) theCircle);
|
||||
FilledCircle (const Handle(Geom_Circle)& theCircle,
|
||||
const Standard_Real theUStart,
|
||||
const Standard_Real theUEnd);
|
||||
|
||||
FilledCircle (const gp_Pnt& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
const Standard_Real theUStart,
|
||||
const Standard_Real theUEnd);
|
||||
|
||||
private:
|
||||
TopoDS_Face ComputeFace();
|
||||
@@ -1982,35 +1989,50 @@ private:
|
||||
protected:
|
||||
|
||||
Handle(Geom_Circle) myCircle;
|
||||
Standard_Boolean myFilledStatus;
|
||||
Standard_Real myUStart;
|
||||
Standard_Real myUEnd;
|
||||
Standard_Boolean myFilledStatus;
|
||||
|
||||
};
|
||||
|
||||
FilledCircle::FilledCircle (const Handle(Geom_Circle)& theCircle,
|
||||
const Standard_Real theUStart,
|
||||
const Standard_Real theUEnd)
|
||||
: myCircle (theCircle),
|
||||
myUStart (theUStart),
|
||||
myUEnd (theUEnd),
|
||||
myFilledStatus (Standard_True)
|
||||
{ }
|
||||
|
||||
FilledCircle::FilledCircle(const gp_Pnt& theCenter, Standard_Real theRadius)
|
||||
FilledCircle::FilledCircle (const gp_Pnt& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
const Standard_Real theUStart,
|
||||
const Standard_Real theUEnd)
|
||||
: FilledCircle (CreateCircle (theCenter, theRadius), theUStart, theUEnd)
|
||||
{ }
|
||||
|
||||
TopoDS_Face FilledCircle::ComputeFace()
|
||||
{
|
||||
myCircle = CreateCircle(theCenter, theRadius);
|
||||
myFilledStatus = Standard_True;
|
||||
}
|
||||
// Create edge from myCircle
|
||||
BRepBuilderAPI_MakeEdge anEdgeMaker (myCircle->Circ(), myUStart, myUEnd);
|
||||
TopoDS_Edge anEdge = anEdgeMaker.Edge();
|
||||
|
||||
FilledCircle::FilledCircle(Handle(Geom_Circle) theCircle)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myFilledStatus = Standard_True;
|
||||
}
|
||||
|
||||
TopoDS_Face FilledCircle::ComputeFace()
|
||||
{
|
||||
// Create edge from myCircle
|
||||
BRepBuilderAPI_MakeEdge anEdgeMaker(myCircle->Circ());
|
||||
TopoDS_Edge anEdge = anEdgeMaker.Edge();
|
||||
|
||||
// Create wire from anEdge
|
||||
BRepBuilderAPI_MakeWire aWireMaker(anEdge);
|
||||
// Create wire from anEdge
|
||||
BRepBuilderAPI_MakeWire aWireMaker;
|
||||
if (Abs (Abs (myUEnd - myUStart) - 2.0 * M_PI) > gp::Resolution())
|
||||
{
|
||||
TopoDS_Edge anEndCenterEdge = BRepBuilderAPI_MakeEdge (myCircle->Value (myUEnd), myCircle->Location()).Edge();
|
||||
TopoDS_Edge aStartCenterEdge = BRepBuilderAPI_MakeEdge (myCircle->Location(), myCircle->Value (myUStart)).Edge();
|
||||
aWireMaker = BRepBuilderAPI_MakeWire (anEdge, anEndCenterEdge, aStartCenterEdge);
|
||||
}
|
||||
else
|
||||
{
|
||||
aWireMaker = BRepBuilderAPI_MakeWire (anEdge);
|
||||
}
|
||||
TopoDS_Wire aWire = aWireMaker.Wire();
|
||||
|
||||
// Create face from aWire
|
||||
BRepBuilderAPI_MakeFace aFaceMaker(aWire);
|
||||
BRepBuilderAPI_MakeFace aFaceMaker (aWire);
|
||||
TopoDS_Face aFace = aFaceMaker.Face();
|
||||
|
||||
return aFace;
|
||||
@@ -2030,12 +2052,22 @@ void FilledCircle::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
StdPrs_ShadedShape::Add (thePrs, aFace, myDrawer);
|
||||
}
|
||||
|
||||
void FilledCircle::ComputeSelection(const Handle(SelectMgr_Selection) &theSelection,
|
||||
const Standard_Integer /*theMode*/)
|
||||
void FilledCircle::ComputeSelection (const Handle(SelectMgr_Selection) &theSelection,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) aSensitiveCircle = new Select3D_SensitiveCircle (anEntityOwner, myCircle->Circ(), myFilledStatus);
|
||||
theSelection->Add(aSensitiveCircle);
|
||||
Handle(Select3D_SensitiveEntity) aSensitiveCircle;
|
||||
|
||||
if (Abs (Abs (myUEnd - myUStart) - 2.0 * M_PI) > gp::Resolution())
|
||||
{
|
||||
aSensitiveCircle = new Select3D_SensitivePoly (anEntityOwner, myCircle->Circ(), myUStart, myUEnd, myFilledStatus);
|
||||
}
|
||||
else
|
||||
{
|
||||
aSensitiveCircle = new Select3D_SensitiveCircle (anEntityOwner, myCircle->Circ(), myFilledStatus);
|
||||
}
|
||||
|
||||
theSelection->Add (aSensitiveCircle);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
@@ -2046,51 +2078,63 @@ void FilledCircle::ComputeSelection(const Handle(SelectMgr_Selection) &theSelect
|
||||
//==============================================================================
|
||||
//function : VCircleBuilder
|
||||
//purpose : Build an AIS_Circle
|
||||
//Draw arg : vcircle CircleName PlaneName PointName Radius IsFilled
|
||||
// PointName PointName PointName IsFilled
|
||||
//Draw arg : vcircle CircleName PlaneName PointName Radius IsFilled UStart UEnd
|
||||
// PointName PointName PointName IsFilled UStart UEnd
|
||||
//==============================================================================
|
||||
|
||||
void DisplayCircle (Handle (Geom_Circle) theGeomCircle,
|
||||
TCollection_AsciiString theName,
|
||||
Standard_Boolean isFilled)
|
||||
void DisplayCircle (const Handle(Geom_Circle)& theGeomCircle,
|
||||
const TCollection_AsciiString& theName,
|
||||
const Standard_Boolean isFilled,
|
||||
const Standard_Real theUStart,
|
||||
const Standard_Real theUEnd)
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aCircle;
|
||||
if (isFilled)
|
||||
if (isFilled)
|
||||
{
|
||||
aCircle = new FilledCircle(theGeomCircle);
|
||||
aCircle = new FilledCircle (theGeomCircle, theUStart, theUEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
aCircle = new AIS_Circle(theGeomCircle);
|
||||
Handle(AIS_Circle)::DownCast (aCircle)->SetFilledCircleSens (Standard_False);
|
||||
aCircle = new AIS_Circle (theGeomCircle, theUStart, theUEnd, Standard_False);
|
||||
}
|
||||
|
||||
// Check if there is an object with given name
|
||||
// and remove it from context
|
||||
if (GetMapOfAIS().IsBound2(theName))
|
||||
if (GetMapOfAIS().IsBound2(theName))
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anInterObj = GetMapOfAIS().Find2(theName);
|
||||
TheAISContext()->Remove(anInterObj, Standard_False);
|
||||
GetMapOfAIS().UnBind2(theName);
|
||||
Handle(AIS_InteractiveObject) anInterObj = GetMapOfAIS().Find2 (theName);
|
||||
TheAISContext()->Remove (anInterObj, Standard_False);
|
||||
GetMapOfAIS().UnBind2 (theName);
|
||||
}
|
||||
|
||||
// Bind the circle to its name
|
||||
GetMapOfAIS().Bind(aCircle, theName);
|
||||
GetMapOfAIS().Bind (aCircle, theName);
|
||||
|
||||
// Display the circle
|
||||
TheAISContext()->Display (aCircle, Standard_True);
|
||||
|
||||
}
|
||||
|
||||
static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const char** argv)
|
||||
static int VCircleBuilder (Draw_Interpretor& /*di*/, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc > 6 || argc < 2)
|
||||
{
|
||||
if (argc > 8 || argc < 2)
|
||||
{
|
||||
Message::SendFail ("Syntax error: wrong number of arguments");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc == 6)
|
||||
Standard_Real anUStart = 0, anUEnd = M_PI * 2.0;
|
||||
if (argc == 8)
|
||||
{
|
||||
anUStart = Draw::Atof (argv[6]) * M_PI / 180.0;
|
||||
anUEnd = Draw::Atof (argv[7]) * M_PI / 180.0;
|
||||
}
|
||||
else if (argc == 4)
|
||||
{
|
||||
anUStart = Draw::Atof (argv[2]) * M_PI / 180.0;
|
||||
anUEnd = Draw::Atof (argv[3]) * M_PI / 180.0;
|
||||
}
|
||||
|
||||
if (argc == 6 || argc == 8)
|
||||
{
|
||||
TCollection_AsciiString aName (argv[1]);
|
||||
Standard_Boolean isFilled = Draw::Atoi(argv[5]) != 0;
|
||||
@@ -2159,7 +2203,7 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
|
||||
return 1;
|
||||
}
|
||||
|
||||
DisplayCircle (aGeomCircle, aName, isFilled);
|
||||
DisplayCircle (aGeomCircle, aName, isFilled, anUStart, anUEnd);
|
||||
}
|
||||
|
||||
// Arguments: AIS_Plane AIS_Point Real
|
||||
@@ -2203,7 +2247,7 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
|
||||
return 1;
|
||||
}
|
||||
|
||||
DisplayCircle (aGeomCircle, aName, isFilled);
|
||||
DisplayCircle (aGeomCircle, aName, isFilled, anUStart, anUEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2263,7 +2307,7 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
|
||||
return 1;
|
||||
}
|
||||
|
||||
DisplayCircle (aGeomCircle, aName, isFilled);
|
||||
DisplayCircle (aGeomCircle, aName, isFilled, anUStart, anUEnd);
|
||||
}
|
||||
else if (aShapeA.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
@@ -2307,7 +2351,7 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
|
||||
return 1;
|
||||
}
|
||||
|
||||
DisplayCircle (aGeomCircle, aName, isFilled);
|
||||
DisplayCircle (aGeomCircle, aName, isFilled, anUStart, anUEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2500,6 +2544,11 @@ static int VDrawText (Draw_Interpretor& theDI,
|
||||
}
|
||||
aTextFormatter->SetWrapping ((Standard_ShortReal)Draw::Atof(theArgVec[++anArgIt]));
|
||||
}
|
||||
else if (aParam == "-wordwrapping")
|
||||
{
|
||||
const bool isWordWrapping = Draw::ParseOnOffNoIterator(theArgsNb, theArgVec, anArgIt);
|
||||
aTextFormatter->SetWordWrapping(isWordWrapping);
|
||||
}
|
||||
else if (aParam == "-aspect"
|
||||
&& anArgIt + 1 < theArgsNb)
|
||||
{
|
||||
@@ -6909,8 +6958,8 @@ Creates a line from coordinates, named or interactively selected vertices.
|
||||
)" /* [vline] */);
|
||||
|
||||
addCmd ("vcircle", VCircleBuilder, /* [vcircle] */ R"(
|
||||
vcircle CircleName [PointName PointName PointName IsFilled]
|
||||
[PlaneName PointName Radius IsFilled]
|
||||
vcircle CircleName [PointName PointName PointName IsFilled] [UStart UEnd]
|
||||
[PlaneName PointName Radius IsFilled] [UStart UEnd]
|
||||
Creates a circle from named or interactively selected entities.
|
||||
Parameter IsFilled is defined as 0 or 1.
|
||||
)" /* [vcircle] */);
|
||||
@@ -6925,6 +6974,7 @@ vdrawtext name text
|
||||
[-zoom {0|1}]=0
|
||||
[-height height]=16
|
||||
[-wrapping width]=40
|
||||
[-wordwrapping {0|1}]=1
|
||||
[-aspect {regular|bold|italic|boldItalic}]=regular
|
||||
[-font font]=Times
|
||||
[-2d] [-perspos {X Y Z}]={0 0 0}
|
||||
|
@@ -515,7 +515,7 @@ static void rescaleDimensionRefLabels(const TDF_LabelSequence& theRefLabels,
|
||||
if (aL.FindAttribute(TNaming_NamedShape::GetID(), aNS))
|
||||
{
|
||||
TopoDS_Shape aShape = aNS->Get();
|
||||
theBRepTrsf.Perform(aShape, Standard_True);
|
||||
theBRepTrsf.Perform(aShape, Standard_True, Standard_True);
|
||||
if (!theBRepTrsf.IsDone())
|
||||
{
|
||||
Standard_SStream aSS;
|
||||
@@ -664,7 +664,7 @@ Standard_Boolean XCAFDoc_Editor::RescaleGeometry(const TDF_Label& theLabel,
|
||||
if (aNodeType == XCAFDoc_AssemblyGraph::NodeType_Part)
|
||||
{
|
||||
const TopoDS_Shape aShape = aShapeTool->GetShape(aLabel);
|
||||
aBRepTrsf.Perform(aShape, Standard_True);
|
||||
aBRepTrsf.Perform(aShape, Standard_True, Standard_True);
|
||||
if (!aBRepTrsf.IsDone())
|
||||
{
|
||||
Standard_SStream aSS;
|
||||
|
@@ -1836,7 +1836,7 @@ void XDEDRAW::Init(Draw_Interpretor& di)
|
||||
"Doc [-names]: Prints number of assembly instances",
|
||||
__FILE__, XDumpNomenclature, g);
|
||||
di.Add("XRescaleGeometry",
|
||||
"Doc -scale factor [-root label]: Applies geometrical scale to assembly",
|
||||
"Doc factor [-root label] [-force]: Applies geometrical scale to assembly",
|
||||
__FILE__, XRescaleGeometry, g);
|
||||
|
||||
// Specialized commands
|
||||
|
@@ -383,6 +383,7 @@ static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
|
||||
RWMesh_CoordinateSystem aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
|
||||
bool toForceUVExport = false, toEmbedTexturesInGlb = true;
|
||||
bool toMergeFaces = false, toSplitIndices16 = false;
|
||||
bool isParallel = false;
|
||||
RWMesh_NameFormat aNodeNameFormat = RWMesh_NameFormat_InstanceOrProduct;
|
||||
RWMesh_NameFormat aMeshNameFormat = RWMesh_NameFormat_Product;
|
||||
RWGltf_DracoParameters aDracoParameters;
|
||||
@@ -556,6 +557,10 @@ static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
|
||||
{
|
||||
aDracoParameters.UnifiedQuantization = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
|
||||
}
|
||||
else if (anArgCase == "-parallel")
|
||||
{
|
||||
isParallel = Draw::ParseOnOffIterator(theNbArgs, theArgVec, anArgIter);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
|
||||
@@ -587,6 +592,7 @@ static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
|
||||
aWriter.SetToEmbedTexturesInGlb (toEmbedTexturesInGlb);
|
||||
aWriter.SetMergeFaces (toMergeFaces);
|
||||
aWriter.SetSplitIndices16 (toSplitIndices16);
|
||||
aWriter.SetParallel(isParallel);
|
||||
aWriter.SetCompressionParameters(aDracoParameters);
|
||||
aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit (aScaleFactorM);
|
||||
aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem (aSystemCoordSys);
|
||||
@@ -2450,7 +2456,7 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
|
||||
"\n\t\t: [-meshNameFormat {empty|product|instance|instOrProd|prodOrInst|prodAndInst|verbose}]=product"
|
||||
"\n\t\t: [-draco]=0 [-compressionLevel {0-10}]=7 [-quantizePositionBits Value]=14 [-quantizeNormalBits Value]=10"
|
||||
"\n\t\t: [-quantizeTexcoordBits Value]=12 [-quantizeColorBits Value]=8 [-quantizeGenericBits Value]=12"
|
||||
"\n\t\t: [-unifiedQuantization]=0"
|
||||
"\n\t\t: [-unifiedQuantization]=0 [-parallel]=0"
|
||||
"\n\t\t: Write XDE document into glTF file."
|
||||
"\n\t\t: -trsfFormat preferred transformation format"
|
||||
"\n\t\t: -systemCoordSys system coordinate system; Zup when not specified"
|
||||
@@ -2460,7 +2466,7 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
|
||||
"\n\t\t: -texturesSeparate write textures to separate files"
|
||||
"\n\t\t: -nodeNameFormat name format for Nodes"
|
||||
"\n\t\t: -meshNameFormat name format for Meshes"
|
||||
"\n\t\t: -draco use Draco compression 3D geometric meshes"
|
||||
"\n\t\t: -draco use Draco compression 3D geometric meshes"
|
||||
"\n\t\t: -compressionLevel draco compression level [0-10] (by default 7), a value of 0 will apply sequential encoding and preserve face order"
|
||||
"\n\t\t: -quantizePositionBits quantization bits for position attribute when using Draco compression (by default 14)"
|
||||
"\n\t\t: -quantizeNormalBits quantization bits for normal attribute when using Draco compression (by default 10)"
|
||||
@@ -2468,7 +2474,8 @@ void XSDRAWSTLVRML::InitCommands (Draw_Interpretor& theCommands)
|
||||
"\n\t\t: -quantizeColorBits quantization bits for color attribute when using Draco compression (by default 8)"
|
||||
"\n\t\t: -quantizeGenericBits quantization bits for skinning attribute (joint indices and joint weights)"
|
||||
"\n and custom attributes when using Draco compression (by default 12)"
|
||||
"\n\t\t: -unifiedQuantization quantization is applied on each primitive separately if this option is false",
|
||||
"\n\t\t: -unifiedQuantization quantization is applied on each primitive separately if this option is false"
|
||||
"\n\t\t: -parallel use multithreading for Draco compression",
|
||||
__FILE__, WriteGltf, g);
|
||||
theCommands.Add ("writegltf",
|
||||
"writegltf shape file",
|
||||
|
23
tests/bugs/step/bug33053
Normal file
23
tests/bugs/step/bug33053
Normal file
@@ -0,0 +1,23 @@
|
||||
puts "===================================="
|
||||
puts "0033053: Data Exchange, Step Export - Compound with vertex is ignored"
|
||||
puts "===================================="
|
||||
puts ""
|
||||
|
||||
pload OCAF
|
||||
|
||||
Close D_orig -silent
|
||||
Close D_comp -silent
|
||||
|
||||
ReadStep D_orig [locate_data_file bug33053_shapes_2d.stp]
|
||||
|
||||
WriteStep D_orig $imagedir/${casename}_D.stp
|
||||
|
||||
ReadStep D_comp $imagedir/${casename}_D.stp
|
||||
|
||||
file delete $imagedir/${casename}_D.stp
|
||||
|
||||
XGetOneShape orig D_orig
|
||||
XGetOneShape comp D_comp
|
||||
|
||||
checkshape comp
|
||||
checknbshapes orig -ref [nbshapes comp]
|
32
tests/bugs/step/bug33095
Normal file
32
tests/bugs/step/bug33095
Normal file
@@ -0,0 +1,32 @@
|
||||
puts "======="
|
||||
puts "0033095: Data Exchange, Step Import - Wrong PMI values when loading a *.stp file in m"
|
||||
puts "======="
|
||||
|
||||
pload OCAF
|
||||
|
||||
catch { Close D_mm }
|
||||
catch { Close D_m }
|
||||
|
||||
# Read file in mm
|
||||
ReadStep D_mm [locate_data_file bug33095_cad_with_pmi.stp]
|
||||
set plusMinusTol_mm [XGetDimensionPlusMinusTol D_mm 0:1:4:77]
|
||||
|
||||
# Read file in m
|
||||
XNewDoc D_m
|
||||
XSetLengthUnit D_m m
|
||||
ReadStep D_m [locate_data_file bug33095_cad_with_pmi.stp]
|
||||
set plusMinusTol_m [XGetDimensionPlusMinusTol D_m 0:1:4:77]
|
||||
|
||||
# Checking
|
||||
regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_m full lower_m upper_m
|
||||
regexp {lower +([-0-9.+eE]+) +upper +([-0-9.+eE]+)} $plusMinusTol_mm full lower_mm upper_mm
|
||||
|
||||
set lower_m_to_mm [expr {$lower_m * 1000}]
|
||||
set upper_m_to_mm [expr {$upper_m * 1000}]
|
||||
|
||||
if {[expr {abs($lower_m_to_mm - $lower_mm)}] > 1e-2} {
|
||||
puts "Error: incorrect scaling lower toleranse value"
|
||||
}
|
||||
if {[expr {abs($upper_m_to_mm - $upper_mm)}] > 1e-2} {
|
||||
puts "Error: incorrect scaling upper toleranse value"
|
||||
}
|
15
tests/bugs/xde/bug33100
Normal file
15
tests/bugs/xde/bug33100
Normal file
@@ -0,0 +1,15 @@
|
||||
puts "0033100: Modeling Algorithms - XCAFDoc_Editor::RescaleGeometry does not rescale triangulations"
|
||||
|
||||
pload DCAF
|
||||
Close d -silent
|
||||
ReadStep d [locate_data_file "bug33100_window.step"]
|
||||
|
||||
XGetOneShape a d
|
||||
set ref_diag [eval distpp [bounding a]]
|
||||
|
||||
XRescaleGeometry d 1000
|
||||
|
||||
XGetOneShape a d
|
||||
set diag [eval distpp [bounding a]]
|
||||
|
||||
checkreal "bounding box diagonal" $diag [expr $ref_diag * 1000] 0 0.001
|
13
tests/de_mesh/gltf_write/bull_parallel
Normal file
13
tests/de_mesh/gltf_write/bull_parallel
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "========"
|
||||
puts "0032867: Data Exchange - Implement Draco compression for writing glTF"
|
||||
puts "Test case exporting model into glb (binary glTF) file."
|
||||
puts "========"
|
||||
|
||||
Close D0 -silent
|
||||
ReadGltf D0 [locate_data_file bug32867_bull.glb]
|
||||
|
||||
set aGltfFile1 "${imagedir}/${casename}_tmp1.glb"
|
||||
|
||||
WriteGltf D0 "$aGltfFile1" -draco on -parallel
|
||||
|
||||
ReadGltf D "$aGltfFile1"
|
@@ -12,45 +12,45 @@ set ref_data {
|
||||
0:1:1:2:2 Shape.5
|
||||
0:1:4:1 GeomTolerance.5.1 ( N "Feature Control Frame (4)" T 12 TV 0, V 0.254 )
|
||||
0:1:1:2:7 Shape.10
|
||||
0:1:4:6 Dimension.10.1 ( N "linear distance" T 2, V 20.827999999999996, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:6 Dimension.10.1 ( N "linear distance" T 2, V 20.827999999999996, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:19 Shape.22
|
||||
0:1:4:39 Dimension.22.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.22.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.22.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.22.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.22.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.22.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:20 Shape.23
|
||||
0:1:4:39 Dimension.23.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.23.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.23.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.23.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.23.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.23.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:21 Shape.24
|
||||
0:1:4:39 Dimension.24.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.24.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.24.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.24.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.24.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.24.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:22 Shape.25
|
||||
0:1:4:39 Dimension.25.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:39 Dimension.25.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:35 GeomTolerance.25.1 ( N "Feature Control Frame (40)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:36 Datum.25.1.1 ( N "Feature Control Frame (40)" )
|
||||
0:1:4:37 Datum.25.1.2 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:4:38 Datum.25.1.3 ( N "Feature Control Frame (40)", M 15 )
|
||||
0:1:1:2:28 Shape.31
|
||||
0:1:4:6 Dimension.31.1 ( N "linear distance" T 2, V 20.827999999999996, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:6 Dimension.31.1 ( N "linear distance" T 2, V 20.827999999999996, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:2 GeomTolerance.31.1 ( N "Feature Control Frame (24)" T 12 TV 0, V 0.76200000000000001 )
|
||||
0:1:4:3 Datum.31.1.1 ( N "Feature Control Frame (24)" )
|
||||
0:1:4:4 Datum.31.1.2 ( N "Feature Control Frame (24)" )
|
||||
0:1:4:5 Datum.31.1.3 ( N "Feature Control Frame (24)" )
|
||||
0:1:1:2:39 Shape.42
|
||||
0:1:4:14 Dimension.42.1 ( N "diameter" T 15, V 50.799999999999997, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.42.1 ( N "diameter" T 15, V 50.799999999999997, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:15 GeomTolerance.42.1 ( N "Feature Control Frame (16)" T 10 TV 1, V 1.524 )
|
||||
0:1:4:16 Datum.42.1.1 ( N "Feature Control Frame (16)" )
|
||||
0:1:4:17 Datum.42.1.2 ( N "Feature Control Frame (16)" )
|
||||
0:1:4:18 Datum.42.1.3 ( N "Feature Control Frame (16)" )
|
||||
0:1:1:2:40 Shape.43
|
||||
0:1:4:14 Dimension.43.1 ( N "diameter" T 15, V 50.799999999999997, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.43.1 ( N "diameter" T 15, V 50.799999999999997, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:15 GeomTolerance.43.1 ( N "Feature Control Frame (16)" T 10 TV 1, V 1.524 )
|
||||
0:1:4:16 Datum.43.1.1 ( N "Feature Control Frame (16)" )
|
||||
0:1:4:17 Datum.43.1.2 ( N "Feature Control Frame (16)" )
|
||||
@@ -58,7 +58,7 @@ set ref_data {
|
||||
0:1:1:2:48 Shape.51
|
||||
0:1:4:30 Dimension.51.1 ( N "linear distance" T 2, V 19.049999999999997, P 0 )
|
||||
0:1:1:2:49 Shape.52
|
||||
0:1:4:19 Dimension.52.1 ( N "diameter" T 15, V 38.099999999999994, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:19 Dimension.52.1 ( N "diameter" T 15, V 38.099999999999994, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:20 GeomTolerance.52.1 ( N "Feature Control Frame (18)" T 10 TV 1, V 2.032 )
|
||||
0:1:4:21 Datum.52.1.1 ( N "Feature Control Frame (18)" )
|
||||
0:1:4:22 Datum.52.1.2 ( N "Feature Control Frame (18)" )
|
||||
@@ -68,7 +68,7 @@ set ref_data {
|
||||
0:1:4:27 Datum.52.2.2 ( N "Feature Control Frame (20)" )
|
||||
0:1:4:28 Datum.52.2.3 ( N "Feature Control Frame (20)" )
|
||||
0:1:1:2:50 Shape.53
|
||||
0:1:4:19 Dimension.53.1 ( N "diameter" T 15, V 38.099999999999994, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:19 Dimension.53.1 ( N "diameter" T 15, V 38.099999999999994, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:24 Dimension.53.2 ( N "linear distance" T 2, V 38.099999999999994, P 0 )
|
||||
0:1:4:20 GeomTolerance.53.1 ( N "Feature Control Frame (18)" T 10 TV 1, V 2.032 )
|
||||
0:1:4:21 Datum.53.1.1 ( N "Feature Control Frame (18)" )
|
||||
@@ -79,49 +79,49 @@ set ref_data {
|
||||
0:1:4:27 Datum.53.2.2 ( N "Feature Control Frame (20)" )
|
||||
0:1:4:28 Datum.53.2.3 ( N "Feature Control Frame (20)" )
|
||||
0:1:1:2:51 Shape.54
|
||||
0:1:4:29 Dimension.54.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.54.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.54.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.54.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.54.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.54.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:52 Shape.55
|
||||
0:1:4:29 Dimension.55.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.55.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.55.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.55.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.55.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.55.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:53 Shape.56
|
||||
0:1:4:29 Dimension.56.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.56.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.56.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.56.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.56.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.56.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:54 Shape.57
|
||||
0:1:4:29 Dimension.57.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.57.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.57.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.57.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.57.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.57.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:55 Shape.58
|
||||
0:1:4:29 Dimension.58.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.58.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.58.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.58.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.58.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.58.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:56 Shape.59
|
||||
0:1:4:29 Dimension.59.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.59.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.59.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.59.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.59.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.59.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:57 Shape.60
|
||||
0:1:4:29 Dimension.60.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.60.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.60.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.60.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.60.1.2 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:34 Datum.60.1.3 ( N "Feature Control Frame (36)" )
|
||||
0:1:1:2:58 Shape.61
|
||||
0:1:4:29 Dimension.61.1 ( N "diameter" T 15, V 15.875, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:29 Dimension.61.1 ( N "diameter" T 15, V 15.875, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:31 GeomTolerance.61.1 ( N "Feature Control Frame (36)" T 10 TV 1, V 1.27, MR 1 )
|
||||
0:1:4:32 Datum.61.1.1 ( N "Feature Control Frame (36)" )
|
||||
0:1:4:33 Datum.61.1.2 ( N "Feature Control Frame (36)" )
|
||||
@@ -137,28 +137,28 @@ set ref_data {
|
||||
0:1:1:2:129 Shape.132
|
||||
0:1:4:1 GeomTolerance.132.1 ( N "Feature Control Frame (4)" T 12 TV 0, V 0.254 )
|
||||
0:1:1:2:134 Shape.137
|
||||
0:1:4:40 Dimension.137.1 ( N "diameter" T 15, V 27.050999999999998, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:40 Dimension.137.1 ( N "diameter" T 15, V 27.050999999999998, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:41 GeomTolerance.137.1 ( N "Feature Control Frame (30)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:42 Datum.137.1.1 ( N "Feature Control Frame (30)" )
|
||||
0:1:1:2:135 Shape.138
|
||||
0:1:4:40 Dimension.138.1 ( N "diameter" T 15, V 27.050999999999998, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:40 Dimension.138.1 ( N "diameter" T 15, V 27.050999999999998, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:41 GeomTolerance.138.1 ( N "Feature Control Frame (30)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:42 Datum.138.1.1 ( N "Feature Control Frame (30)" )
|
||||
0:1:1:2:153 Shape.156
|
||||
0:1:4:7 Dimension.156.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:7 Dimension.156.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:9 GeomTolerance.156.1 ( N "Feature Control Frame (10)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:10 Datum.156.1.1 ( N "Feature Control Frame (10)" )
|
||||
0:1:1:2:154 Shape.157
|
||||
0:1:4:7 Dimension.157.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:7 Dimension.157.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:9 GeomTolerance.157.1 ( N "Feature Control Frame (10)" T 9 TV 1, V 0.254 )
|
||||
0:1:4:10 Datum.157.1.1 ( N "Feature Control Frame (10)" )
|
||||
0:1:1:2:155 Shape.158
|
||||
0:1:4:8 Dimension.158.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:8 Dimension.158.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:11 GeomTolerance.158.1 ( N "Feature Control Frame (11)" T 10 TV 1, V 0.50800000000000001 )
|
||||
0:1:4:12 Datum.158.1.1 ( N "Feature Control Frame (11)" )
|
||||
0:1:4:13 Datum.158.1.2 ( N "Feature Control Frame (11)" )
|
||||
0:1:1:2:156 Shape.159
|
||||
0:1:4:8 Dimension.159.1 ( N "diameter" T 15, V 11.1252, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:8 Dimension.159.1 ( N "diameter" T 15, V 11.1252, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:4:11 GeomTolerance.159.1 ( N "Feature Control Frame (11)" T 10 TV 1, V 0.50800000000000001 )
|
||||
0:1:4:12 Datum.159.1.1 ( N "Feature Control Frame (11)" )
|
||||
0:1:4:13 Datum.159.1.2 ( N "Feature Control Frame (11)" )
|
||||
|
@@ -10,9 +10,9 @@ set ref_data {
|
||||
NbOfDatumTarget : 2
|
||||
|
||||
0:1:1:2:2 Shape.5
|
||||
0:1:4:14 Dimension.5.1 ( N "linear distance" T 2, V 127, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.5.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:8 Shape.11
|
||||
0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:14 Dimension.11.1 ( N "linear distance" T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:9 Shape.12
|
||||
0:1:4:1 GeomTolerance.12.1 ( N "Feature Control Frame (11)" T 13 TV 0, V 0.127 )
|
||||
0:1:1:2:66 Shape.69
|
||||
@@ -57,9 +57,9 @@ set ref_data {
|
||||
0:1:4:7 GeomTolerance.203.1 ( N "Feature Control Frame (4)" T 2 TV 0, V 0.050799999999999998 )
|
||||
0:1:4:8 Datum.203.1.1 ( N "Feature Control Frame (4)" )
|
||||
0:1:1:2:206 Shape.209
|
||||
0:1:4:11 Dimension.209.1 ( N "linear distance" T 2, V 254, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:11 Dimension.209.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:2:207 Shape.210
|
||||
0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 2.54, VU 2.54, P 0 )
|
||||
0:1:4:11 Dimension.210.1 ( N "linear distance" T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
|
||||
0:1:1:3:1 Shape.211
|
||||
0:1:4:1 GeomTolerance.211.1 ( N "Feature Control Frame (11)" T 13 TV 0, V 0.127 )
|
||||
}
|
||||
|
@@ -4,21 +4,30 @@ puts ""
|
||||
puts "==========="
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vinit View1
|
||||
vinit View1 -width 500
|
||||
vclear
|
||||
vaxo
|
||||
|
||||
box b1 10 0 360 10 180 40
|
||||
box b1 10 0 460 10 180 40
|
||||
vdisplay b1
|
||||
vdrawtext t1 "Top text on plane yOz\n(not wrapped)" -pos 10 5 400 -color green -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
vdrawtext t1 "Top text on plane yOz\n(not wrapped)" -pos 10 5 500 -color green -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
|
||||
box b2 10 0 240 10 130 60
|
||||
box b2 10 0 340 10 130 60
|
||||
vdisplay b2
|
||||
vdrawtext t2 "Top text on plane yOz\n(wrapping=120)" -pos 10 5 300 -color green -wrapping 120 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
vdrawtext t2 "Top text on plane yOz\n(wrapping=120)" -pos 10 5 400 -color green -wrapping 120 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
|
||||
box b3 10 0 60 10 60 150
|
||||
box b3 10 0 160 10 60 150
|
||||
vdisplay b3
|
||||
vdrawtext t3 "Top text on plane yOz\n(wrapping=50)" -pos 10 5 200 -color green -wrapping 50 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
vdrawtext t3 "Top text on plane yOz\n(wrapping=50)" -pos 10 5 300 -color green -wrapping 50 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1
|
||||
|
||||
box b4 10 200 400 10 130 100
|
||||
vdisplay b4
|
||||
vdrawtext t4 "Top text on plane yOz\n(wrapping=120, word wrapping disabled)" -pos 10 205 500 -color green -wrapping 120 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1 -wordwrapping 0
|
||||
|
||||
box b5 10 200 160 10 60 200
|
||||
vdisplay b5
|
||||
vdrawtext t5 "Top text on plane yOz\n(wrapping=50, word wrapping disabled)" -pos 10 205 350 -color green -wrapping 50 -plane 1 0 0 0 1 0 -valign top -font SansFont -zoom 1 -wordwrapping 0
|
||||
|
||||
|
||||
vright
|
||||
vfit
|
||||
|
@@ -113,7 +113,7 @@ vmanipulator m -followRotation 0
|
||||
# test rotation around y axis (world reference frame)
|
||||
# ---------------------------------------------------
|
||||
|
||||
set mouse_pick {211 087}
|
||||
set mouse_pick {205 087}
|
||||
set mouse_drag {232 127}
|
||||
|
||||
vmoveto {*}$mouse_pick
|
||||
|
@@ -8,7 +8,7 @@ proc check_output {theInfo} {
|
||||
for {set i 0} {$i < $aSize} {incr i} {
|
||||
if {[string equal [lindex $theInfo $i] "Depth:"]} {
|
||||
set aDepth [lindex $theInfo [expr $i + 1]]
|
||||
if {[string equal $aDepth "17.5691"]} {
|
||||
if {[string equal $aDepth "17.4833"]} {
|
||||
return 1
|
||||
} else {
|
||||
return $aDepth
|
||||
@@ -35,7 +35,7 @@ set aResult [check_output $anInfo]
|
||||
if {$aResult == 1} {
|
||||
puts "OK"
|
||||
} else {
|
||||
puts "ERROR: the depth value is incorrect: should be 17.5691, but is equal to:"
|
||||
puts "ERROR: the depth value is incorrect: should be 17.4833, but is equal to:"
|
||||
puts $aResult
|
||||
}
|
||||
|
||||
|
46
tests/vselect/cone_cylinder/circle_sector
Normal file
46
tests/vselect/cone_cylinder/circle_sector
Normal file
@@ -0,0 +1,46 @@
|
||||
puts "================================="
|
||||
puts "0032547: Visualization, Select3D_SensitiveCylinder - implement picking of a hollow cylinder"
|
||||
puts ""
|
||||
puts "================================="
|
||||
|
||||
pload VISUALIZATION OPENGL
|
||||
vinit View1
|
||||
|
||||
# Filled circle sector
|
||||
vpoint C1P1 10 10 10
|
||||
vpoint C1P2 60 60 -10
|
||||
vpoint C1P3 35 100 10
|
||||
vcircle c1 C1P1 C1P2 C1P3 1 90 150
|
||||
|
||||
# Circle arc
|
||||
vpoint C2P1 10 -10 -10
|
||||
vpoint C2P2 60 -60 10
|
||||
vpoint C2P3 35 -100 10
|
||||
vcircle c2 C2P1 C2P2 C2P3 0 90 150
|
||||
|
||||
# Filled circle
|
||||
vpoint C3P1 -80 -10 10
|
||||
vpoint C3P2 -140 -50 -10
|
||||
vpoint C3P3 -110 -100 -10
|
||||
vcircle c3 C3P1 C3P2 C3P3 1 0 360
|
||||
|
||||
# Circle wire
|
||||
vpoint C4P1 -80 10 10
|
||||
vpoint C4P2 -140 60 10
|
||||
vpoint C4P3 -110 100 -10
|
||||
vcircle c4 C4P1 C4P2 C4P3 0 0 360
|
||||
|
||||
vbottom
|
||||
vfit
|
||||
|
||||
vselect 100 100
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: filled circle should be detected" }
|
||||
|
||||
vselect 100 225
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle wire should be detected" }
|
||||
|
||||
vselect 390 50
|
||||
if { ![string match "*Select3D_SensitivePoly*" [vstate -entities]] } { puts "Error: circle arc should be detected" }
|
||||
|
||||
vselect 360 350
|
||||
if { ![string match "*Select3D_SensitivePoly*" [vstate -entities]] } { puts "Error: circle sector should be detected" }
|
67
tests/vselect/cone_cylinder/circle_wire
Normal file
67
tests/vselect/cone_cylinder/circle_wire
Normal file
@@ -0,0 +1,67 @@
|
||||
puts "================================="
|
||||
puts "0032547: Visualization, Select3D_SensitiveCylinder - implement picking of a hollow cylinder"
|
||||
puts ""
|
||||
puts "================================="
|
||||
|
||||
pload VISUALIZATION OPENGL
|
||||
vinit View1
|
||||
|
||||
vpoint radP1 0 0 0
|
||||
vpoint radP2 50 50 0
|
||||
vpoint radP3 100 0 0
|
||||
vcircle circle radP1 radP2 radP3 0
|
||||
vaxo
|
||||
vfit
|
||||
|
||||
# Single click selection
|
||||
# point inside a circle
|
||||
vselect 200 200
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should not be detected" }
|
||||
|
||||
# point on circle
|
||||
vselect 177 285
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should be detected" }
|
||||
|
||||
# point outside a circle
|
||||
vselect 360 360
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should not be detected" }
|
||||
|
||||
|
||||
# Selection with polygon
|
||||
# circle inside a polygon
|
||||
vselect 50 300 360 300 360 100 50 100
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle inside a polygon should be detected" }
|
||||
|
||||
# circle is partially covered by a polygon
|
||||
vselect 250 300 360 300 360 100 250 100 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a polygon should not be detected" }
|
||||
|
||||
vselect 250 300 360 300 360 100 250 100 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a polygon should be detected" }
|
||||
|
||||
# polygon inside a circle
|
||||
vselect 150 200 200 200 200 150 150 150 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the polygon should not be detected" }
|
||||
|
||||
vselect 150 200 200 200 200 150 150 150 -allowoverlap 1
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the polygon should not be detected" }
|
||||
|
||||
|
||||
# Selection with rectangle
|
||||
# circle inside a rectangle
|
||||
vselect 50 300 360 100
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle inside a rectangle should be detected" }
|
||||
|
||||
# circle is partially covered by a rectangle
|
||||
vselect 250 300 360 100 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a rectangle should not be detected" }
|
||||
|
||||
vselect 250 300 360 100 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a rectangle should be detected" }
|
||||
|
||||
# rectangle inside a circle
|
||||
vselect 150 200 200 150 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the rectangle should not be detected" }
|
||||
|
||||
vselect 150 200 200 150 -allowoverlap 1
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the rectangle should not be detected" }
|
67
tests/vselect/cone_cylinder/filled_circle
Normal file
67
tests/vselect/cone_cylinder/filled_circle
Normal file
@@ -0,0 +1,67 @@
|
||||
puts "================================="
|
||||
puts "0032547: Visualization, Select3D_SensitiveCylinder - implement picking of a hollow cylinder"
|
||||
puts ""
|
||||
puts "================================="
|
||||
|
||||
pload VISUALIZATION OPENGL
|
||||
vinit View1
|
||||
|
||||
vpoint radP1 0 0 0
|
||||
vpoint radP2 50 50 0
|
||||
vpoint radP3 100 0 0
|
||||
vcircle circle radP1 radP2 radP3 1
|
||||
vaxo
|
||||
vfit
|
||||
|
||||
# Single click selection
|
||||
# point inside a circle
|
||||
vselect 200 200
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should be detected" }
|
||||
|
||||
# point on circle
|
||||
vselect 177 279
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should be detected" }
|
||||
|
||||
# point outside a circle
|
||||
vselect 360 360
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should not be detected" }
|
||||
|
||||
|
||||
# Selection with polygon
|
||||
# circle inside a polygon
|
||||
vselect 50 300 360 300 360 100 50 100
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle inside a polygon should be detected" }
|
||||
|
||||
# circle is partially covered by a polygon
|
||||
vselect 250 300 360 300 360 100 250 100 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a polygon should not be detected" }
|
||||
|
||||
vselect 250 300 360 300 360 100 250 100 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a polygon should be detected" }
|
||||
|
||||
# polygon inside a circle
|
||||
vselect 150 200 200 200 200 150 150 150 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the polygon should not be detected" }
|
||||
|
||||
vselect 150 200 200 200 200 150 150 150 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the polygon should be detected" }
|
||||
|
||||
|
||||
# Selection with rectangle
|
||||
# circle inside a rectangle
|
||||
vselect 50 300 360 100
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle inside a rectangle should be detected" }
|
||||
|
||||
# circle is partially covered by a rectangle
|
||||
vselect 250 300 360 100 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a rectangle should not be detected" }
|
||||
|
||||
vselect 250 300 360 100 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle partially covered by a rectangle should be detected" }
|
||||
|
||||
# rectangle inside a circle
|
||||
vselect 150 200 200 150 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the rectangle should not be detected" }
|
||||
|
||||
vselect 150 200 200 150 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle around the rectangle should be detected" }
|
61
tests/vselect/cone_cylinder/hollow_cone_cyl
Normal file
61
tests/vselect/cone_cylinder/hollow_cone_cyl
Normal file
@@ -0,0 +1,61 @@
|
||||
puts "================================="
|
||||
puts "0032547: Visualization, Select3D_SensitiveCylinder - implement picking of a hollow cylinder"
|
||||
puts " "
|
||||
puts "================================="
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
pcone cone 10 5 10
|
||||
trotate cone 0 0 0 1 1 0 30
|
||||
ttranslate cone 15 15 0
|
||||
|
||||
pcylinder cyl 7 7
|
||||
trotate cyl 0 0 0 1 1 0 30
|
||||
|
||||
explode cyl F
|
||||
explode cone F
|
||||
|
||||
vdisplay -dispmode 1 cyl_1 cone_1
|
||||
|
||||
vaxo
|
||||
vfit
|
||||
|
||||
vselect 60 220 140 220 140 190 60 190 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cylinder should not be detected" }
|
||||
|
||||
vselect 60 220 140 220 140 190 60 190 -allowoverlap 1
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cylinder should not be detected" }
|
||||
|
||||
vselect 60 220 140 190 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cylinder should not be detected" }
|
||||
|
||||
vselect 60 220 140 190 -allowoverlap 1
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cylinder should not be detected" }
|
||||
|
||||
vselect 270 210 310 210 310 160 270 160 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cone should not be detected" }
|
||||
|
||||
vselect 270 210 310 210 310 160 270 160 -allowoverlap 1
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cone should not be detected" }
|
||||
|
||||
vselect 270 210 310 160 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cone should not be detected" }
|
||||
|
||||
vselect 270 210 310 160 -allowoverlap 1
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cone should not be detected" }
|
||||
|
||||
|
||||
vselect 60 210 310 210 310 200 60 200 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]]} { puts "Error: cone should not be detected" }
|
||||
|
||||
vselect 60 210 310 210 310 200 60 200 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCylinder*" [vstate -entities]]
|
||||
&& [string first "Select3D_SensitiveCylinder" [vstate -entities]]
|
||||
!= [string last "Select3D_SensitiveCylinder" [vstate -entities]]} { puts "Error: cone should be detected" }
|
||||
|
||||
vselect 60 210 310 200 -allowoverlap 0
|
||||
if { [string match "*Select3D_SensitiveCylinder*" [vstate -entities]] } { puts "Error: cone should not be detected" }
|
||||
|
||||
vselect 60 210 310 200 -allowoverlap 1
|
||||
if { ![string match "*Select3D_SensitiveCylinder*" [vstate -entities]]
|
||||
&& [string first "Select3D_SensitiveCylinder" [vstate -entities]]
|
||||
!= [string last "Select3D_SensitiveCylinder" [vstate -entities]] } { puts "Error: cone should be detected" }
|
41
tests/vselect/cone_cylinder/transformed_circle
Normal file
41
tests/vselect/cone_cylinder/transformed_circle
Normal file
@@ -0,0 +1,41 @@
|
||||
puts "================================="
|
||||
puts "0032547: Visualization, Select3D_SensitiveCylinder - implement picking of a hollow cylinder"
|
||||
puts ""
|
||||
puts "================================="
|
||||
|
||||
pload VISUALIZATION OPENGL
|
||||
vinit View1
|
||||
|
||||
vpoint C1P1 10 10 10
|
||||
vpoint C1P2 60 60 -10
|
||||
vpoint C1P3 35 100 10
|
||||
vcircle c1 C1P1 C1P2 C1P3 1
|
||||
|
||||
vpoint C2P1 10 -10 -10
|
||||
vpoint C2P2 60 -60 10
|
||||
vpoint C2P3 35 -100 10
|
||||
vcircle c2 C2P1 C2P2 C2P3 1
|
||||
|
||||
vpoint C3P1 -80 -10 10
|
||||
vpoint C3P2 -140 -50 -10
|
||||
vpoint C3P3 -110 -100 -10
|
||||
vcircle c3 C3P1 C3P2 C3P3 1
|
||||
|
||||
vpoint C4P1 -80 10 10
|
||||
vpoint C4P2 -140 60 10
|
||||
vpoint C4P3 -110 100 -10
|
||||
vcircle c4 C4P1 C4P2 C4P3 1
|
||||
|
||||
vbottom
|
||||
vfit
|
||||
|
||||
vmoveto 100 100
|
||||
if {[vreadpixel 100 100 rgb name] != "TURQUOISE"} { puts "ERROR: the circle should be highlighted" }
|
||||
|
||||
vmoveto 200 200
|
||||
|
||||
vseldump $imagedir/${casename}_selnorm.png -type surfNormal
|
||||
|
||||
vsensdis
|
||||
|
||||
vseldump $imagedir/${casename}.png
|
@@ -11,7 +11,7 @@ ttranslate c 2500 3500 1000
|
||||
|
||||
vinit View1
|
||||
|
||||
# check Select3D_SensitiveTriangulation
|
||||
# check Select3D_SensitiveCircle
|
||||
vclear
|
||||
vaxo
|
||||
compound {*}[explode c Sh] cc
|
||||
@@ -21,7 +21,7 @@ vselaxis 2500 3498 1001 0 1 0 -display a -showNormal
|
||||
set aPntTris [vmoveto 200 200]
|
||||
vpoint pp {*}$aPntTris
|
||||
checkpoint aPntTris_p $aPntTris {2500.42 3499.54 1000.81} 0.1
|
||||
if { ![string match "*Select3D_SensitiveTriangulation*" [vstate -entities]] } { puts "Error: triangulation should be detected" }
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should be detected" }
|
||||
vfit
|
||||
vdump $imagedir/${casename}_prs_tris.png
|
||||
vseldump $imagedir/${casename}_selnorm_tris.png -type surfNormal
|
||||
|
@@ -11,7 +11,7 @@ ttranslate c 2500 3500 1000
|
||||
|
||||
vinit View1
|
||||
|
||||
# check Select3D_SensitiveTriangulation
|
||||
# check Select3D_SensitiveCircle
|
||||
vclear
|
||||
vaxo
|
||||
compound {*}[explode c Sh] cc
|
||||
@@ -21,7 +21,7 @@ vselaxis 2500 3498 1001 0 1 0 -display a -showNormal
|
||||
set aPntTris [vmoveto 200 200]
|
||||
vpoint pp {*}$aPntTris
|
||||
checkpoint aPntTris_p $aPntTris {2500.9 3499.0 1001.6} 0.1
|
||||
if { ![string match "*Select3D_SensitiveTriangulation*" [vstate -entities]] } { puts "Error: triangulation should be detected" }
|
||||
if { ![string match "*Select3D_SensitiveCircle*" [vstate -entities]] } { puts "Error: circle should be detected" }
|
||||
vfit
|
||||
vdump $imagedir/${casename}_prs_tris.png
|
||||
vseldump $imagedir/${casename}_selnorm_tris.png -type surfNormal
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user