mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a28be1eb2a | ||
|
835f8451ac |
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
|
||||
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
|
||||
|
||||
@@ -6,10 +6,6 @@ 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")
|
||||
@@ -717,14 +713,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_TBB12")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
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_TBB12")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
|
@@ -32,13 +32,15 @@ if(__COTIRE_INCLUDED)
|
||||
endif()
|
||||
set(__COTIRE_INCLUDED TRUE)
|
||||
|
||||
# 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)
|
||||
# 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()
|
||||
|
||||
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
|
||||
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
|
||||
|
@@ -1,96 +1,4 @@
|
||||
# Draco - a library for a lossy vertex data compression, used as extension to glTF format.
|
||||
# https://github.com/google/draco
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
if (NOT DEFINED INSTALL_DRACO)
|
||||
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
|
||||
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
|
||||
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
|
||||
if (DRACO_DIR_NAME)
|
||||
set (3RDPARTY_DRACO_DIR "${3RDPARTY_DIR}/${DRACO_DIR_NAME}" CACHE PATH "The directory containing Draco" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
|
||||
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
|
||||
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_INCLUDE_DIR AND EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_DRACO_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DRACO_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
|
||||
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
|
||||
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
|
||||
|
||||
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
|
||||
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
|
||||
PATH_SUFFIXES lib
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
NO_DEFAULT_PATH)
|
||||
if (3RDPARTY_DRACO_LIBRARY AND EXISTS "${3RDPARTY_DRACO_LIBRARY}")
|
||||
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY}" PATH)
|
||||
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
|
||||
endif()
|
||||
|
||||
if (INSTALL_DRACO)
|
||||
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
|
||||
if (SINGLE_GENERATOR)
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "${INSTALL_DIR_LIB}")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS RelWithDebInfo
|
||||
DESTINATION "${INSTALL_DIR_LIB}i")
|
||||
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "${INSTALL_DIR_LIB}d")
|
||||
endif()
|
||||
endif()
|
||||
THIRDPARTY_PRODUCT("DRACO" "draco/compression/decode.h" "CSF_Draco" "")
|
||||
|
@@ -12,7 +12,7 @@ endif()
|
||||
|
||||
# TBB
|
||||
if (USE_TBB)
|
||||
set (CSF_TBB "tbb12 tbbmalloc")
|
||||
set (CSF_TBB "tbb 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 MATCHES "[Cc][Ll][Aa][Nn][Gg]"))
|
||||
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
|
||||
endif()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
@@ -130,26 +130,14 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPIL
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# 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 ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
|
||||
if (APPLE)
|
||||
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
|
||||
set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
|
||||
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}")
|
||||
endif()
|
||||
# Optimize size of binaries
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
@@ -160,10 +148,14 @@ 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 MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set (COMPILER clang)
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
set (COMPILER icc)
|
||||
else()
|
||||
set (COMPILER ${CMAKE_GENERATOR})
|
||||
@@ -589,7 +589,9 @@ macro (OCCT_UPDATE_TARGET_FILE)
|
||||
endif()
|
||||
|
||||
install (CODE
|
||||
"string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
|
||||
"cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
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)
|
||||
@@ -598,7 +600,8 @@ 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()")
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
@@ -612,14 +615,17 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
|
||||
install(CODE "set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
|
||||
install(CODE "cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
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()")
|
||||
endforeach()
|
||||
cmake_policy(POP)")
|
||||
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 tbb12 and tbbmalloc
|
||||
# common steps for tbb and tbbmalloc
|
||||
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
|
||||
|
||||
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
|
||||
|
||||
# define required tbb12/tbbmalloc variables
|
||||
# define required tbb/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()
|
||||
|
||||
# tbb12/tbbmalloc library
|
||||
# tbb/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()
|
||||
|
||||
# tbb12/tbbmalloc shared library
|
||||
# tbb/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 tbb12/tbbmalloc
|
||||
# install tbb/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_TBB12_DLL_DIR})
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
|
||||
else()
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB12_LIBRARY_DIR})
|
||||
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_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}tbb12.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
|
||||
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
|
||||
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
|
||||
}
|
||||
}
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
|
||||
if { "$aTbbDllPath" == "" } {
|
||||
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
|
||||
if { "$aTbbDllPath" != "" } {
|
||||
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
|
||||
} else {
|
||||
lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
|
||||
lappend anErrBin$anArchIter "Error: 'tbb.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) "tbb12 tbbmalloc"
|
||||
set aLibsMap(CSF_TBB) "tbb 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 = -ltbb12 -ltbbmalloc }
|
||||
HAVE_TBB { CSF_TBB = -ltbb -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_TBB12_DLL_DIR@"
|
||||
set "TBB_DIR=@3RDPARTY_TBB_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_TBB12_LIBRARY_DIR@"
|
||||
export TBB_DIR="@3RDPARTY_TBB_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,9 +128,8 @@ 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/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`)
|
||||
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.
|
||||
|
||||
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
|
||||
|
||||
@@ -305,9 +304,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/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`).
|
||||
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.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
|
||||
|
||||
@@ -478,9 +477,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/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`).
|
||||
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`).
|
||||
|
||||
@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 3.1 or later.
|
||||
OCCT requires CMake version 2.8.12 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,7 +113,6 @@ 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 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) |
|
||||
| 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) |
|
||||
| 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.
|
||||
oneTBB 2021.5.0 is available under Apache 2.0 license, while older versions
|
||||
TBB version 2017 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
|
||||
|
@@ -338,8 +338,7 @@ The <i>GeomConvert</i> package also provides the following:
|
||||
* a splitting algorithm, which determines the curves along which a BSpline surface should be cut in order to obtain patches with the same degree of continuity,
|
||||
* global functions to construct BSpline surfaces created by this splitting algorithm, or by other types of BSpline surface segmentation,
|
||||
* an algorithm, which converts a BSpline surface into a series of adjacent Bezier surfaces,
|
||||
* an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
|
||||
* algorithms that converts NURBS, Bezier and other general parametrized curves and surface into anaytical curves and surfaces.
|
||||
* an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface.
|
||||
|
||||
@subsection occt_modat_1_4 Points on Curves
|
||||
|
||||
|
@@ -1007,25 +1007,6 @@ Standard_Integer aNbOffsetSurfaces = aCheckContents.NbOffsetSurf();
|
||||
Handle(TopTools_HSequenceOfShape) aSeqFaces = aCheckContents.OffsetSurfaceSec();
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_shg_3_2_4 Analysis of shape underlined geometry
|
||||
|
||||
Class *ShapeAnalysis_CanonicalRecognition* provides tools that analyze geometry of shape and explore the possibility of converting geometry into a canonical form.
|
||||
Canonical forms for curves are lines, circles and ellipses.
|
||||
Canonical forms for surfaces are planar, cylindrical, conical and spherical surfaces.
|
||||
|
||||
Recognition and converting into canonical form is performed according to maximal deviation criterium: maximal distance between initial and canonical geometrical objects must be less, than given value.
|
||||
|
||||
Analysis of curves is allowed for following shapes:
|
||||
* edge - algorithm checks 3d curve of edge
|
||||
* wire - algorithm checks 3d curves of all edges in order to convert them in the same analytical curve
|
||||
|
||||
Analysis of surfaces is allowed for following shapes:
|
||||
* face - algorithm checks surface of face
|
||||
* shell - algorithm checks surfaces of all faces in order to convert them in the same analytical surface
|
||||
* edge - algorithm checks all surfaces that are shared by given edge in order convert one of them in analytical surface, which most close to the input sample surface.
|
||||
* wire - the same as for edge, but algorithm checks all edges of wire in order to find analytical surface, which most close to the input sample surface.
|
||||
|
||||
|
||||
@section occt_shg_4 Upgrading
|
||||
|
||||
Upgrading tools are intended for adaptation of shapes for better use by Open CASCADE Technology or for customization to particular needs, i.e. for export to another system.
|
||||
|
@@ -91,7 +91,6 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -122,7 +121,6 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -147,7 +145,6 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
@@ -175,7 +172,6 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
|
||||
|
@@ -92,7 +92,6 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -124,7 +123,6 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -149,7 +147,6 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
|
||||
@@ -177,7 +174,6 @@
|
||||
</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.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</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.8"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>IE_WPF_WinForms</RootNamespace>
|
||||
<AssemblyName>IE_WPF_WinForms</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</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.8"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</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.8"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
|
@@ -4,6 +4,7 @@ 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 MATCHES "[Cc][Ll][Aa][Nn][Gg]")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set (MY_COMPILER clang)
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
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} -Wall -frtti -fexceptions -fpermissive")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -frtti -fexceptions -fpermissive")
|
||||
|
||||
add_library(TKJniSample SHARED ${SOURCE_FILES})
|
||||
target_link_libraries(TKJniSample ${aLibDeps})
|
||||
|
@@ -1,10 +1,4 @@
|
||||
# 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)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
project (Geometry)
|
||||
|
||||
|
@@ -1,10 +1,4 @@
|
||||
# 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)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
project (Modeling)
|
||||
|
||||
|
@@ -1,10 +1,4 @@
|
||||
# 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)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
project (ImportExport)
|
||||
|
||||
|
@@ -1,10 +1,4 @@
|
||||
# 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)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
project (HLR)
|
||||
|
||||
|
@@ -1,10 +1,4 @@
|
||||
# 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)
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
|
||||
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 += -ltbb12 -ltbbmalloc
|
||||
LIBS += -ltbb -ltbbmalloc
|
||||
QMAKE_CXXFLAGS += -std=gnu++11
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@ 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,7 +27,6 @@
|
||||
#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>
|
||||
@@ -42,9 +41,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.0),
|
||||
myUEnd (2.0 * M_PI),
|
||||
myCircleIsArc (Standard_False),
|
||||
myUStart(0.),
|
||||
myUEnd(2*M_PI),
|
||||
myCircleIsArc(Standard_False),
|
||||
myIsFilledCircleSens (Standard_False)
|
||||
{
|
||||
}
|
||||
@@ -61,7 +60,7 @@ AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& theComponent,
|
||||
myComponent (theComponent),
|
||||
myUStart (theUStart),
|
||||
myUEnd (theUEnd),
|
||||
myCircleIsArc (Abs (Abs (theUEnd - theUStart) - 2.0 * M_PI) > gp::Resolution()),
|
||||
myCircleIsArc (Standard_True),
|
||||
myIsFilledCircleSens (theIsFilledCircleSens)
|
||||
{
|
||||
}
|
||||
@@ -208,14 +207,14 @@ void AIS_Circle::UnsetWidth()
|
||||
//function : ComputeCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
|
||||
GeomAdaptor_Curve curv(myComponent);
|
||||
Standard_Real prevdev = myDrawer->DeviationCoefficient();
|
||||
myDrawer->SetDeviationCoefficient (1.e-5);
|
||||
StdPrs_DeflectionCurve::Add (thePresentation, curv, myDrawer);
|
||||
myDrawer->SetDeviationCoefficient (prevdev);
|
||||
myDrawer->SetDeviationCoefficient(1.e-5);
|
||||
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
|
||||
myDrawer->SetDeviationCoefficient(prevdev);
|
||||
|
||||
}
|
||||
|
||||
@@ -224,13 +223,13 @@ void AIS_Circle::ComputeCircle (const Handle(Prs3d_Presentation)& thePresentatio
|
||||
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::ComputeArc (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
void AIS_Circle::ComputeArc( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
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 (thePresentation, curv, myDrawer);
|
||||
myDrawer->SetDeviationCoefficient (prevdev);
|
||||
myDrawer->SetDeviationCoefficient(1.e-5);
|
||||
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
|
||||
myDrawer->SetDeviationCoefficient(prevdev);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -238,25 +237,27 @@ void AIS_Circle::ComputeArc (const Handle(Prs3d_Presentation)& thePresentation)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Circle::ComputeCircleSelection (const Handle(SelectMgr_Selection)& theSelection)
|
||||
void AIS_Circle::ComputeCircleSelection(const Handle(SelectMgr_Selection)& aSelection)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) aCirc = new Select3D_SensitiveCircle (anOwner,
|
||||
myComponent->Circ(),
|
||||
myIsFilledCircleSens);
|
||||
theSelection->Add (aCirc);
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
|
||||
myComponent->Circ(),
|
||||
myIsFilledCircleSens);
|
||||
aSelection->Add(seg);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeArcSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_Circle::ComputeArcSelection (const Handle(SelectMgr_Selection)& theSelection)
|
||||
void AIS_Circle::ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitivePoly) aSeg = new Select3D_SensitivePoly (anOwner,
|
||||
myComponent->Circ(),
|
||||
myUStart, myUEnd,
|
||||
myIsFilledCircleSens);
|
||||
theSelection->Add (aSeg);
|
||||
|
||||
|
||||
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
|
||||
Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
|
||||
myComponent->Circ(),
|
||||
myUStart, myUEnd,
|
||||
myIsFilledCircleSens);
|
||||
aSelection->Add(seg);
|
||||
}
|
||||
|
@@ -84,8 +84,9 @@ namespace
|
||||
public:
|
||||
//! Main constructor.
|
||||
ManipSensCircle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
|
||||
const gp_Circ& theCircle)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False),
|
||||
const gp_Circ& theCircle,
|
||||
const Standard_Integer theNbPnts)
|
||||
: Select3D_SensitiveCircle (theOwnerId, theCircle, Standard_False, theNbPnts),
|
||||
ManipSensRotation (theCircle.Position().Direction()) {}
|
||||
|
||||
//! Checks whether the circle overlaps current selecting volume
|
||||
@@ -1167,7 +1168,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);
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle, anAxis.FacettesNumber());
|
||||
aCircle->SetSensitivityFactor (15);
|
||||
theSelection->Add (aCircle);
|
||||
// enlarge sensitivity by triangulation
|
||||
|
@@ -1948,7 +1948,7 @@ int mcrcomm_(integer *kop,
|
||||
/* Local variables */
|
||||
intptr_t ideb;
|
||||
doublereal dtab[32000];
|
||||
intptr_t itab[160] /* was [4][40] */;
|
||||
intptr_t itab[160] = {0} /* was [4][40] */;
|
||||
intptr_t ipre;
|
||||
integer i__, j, k;
|
||||
|
||||
@@ -2522,7 +2522,7 @@ int AdvApp2Var_SysBase::mcrlist_(integer *ier) const
|
||||
|
||||
/* Local variables */
|
||||
char cfmt[1];
|
||||
doublereal dfmt;
|
||||
doublereal dfmt = 0.0; // unused
|
||||
integer ifmt, i__, nufmt, ntotal;
|
||||
char subrou[7];
|
||||
|
||||
@@ -2667,7 +2667,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
|
||||
integer i__1, i__2;
|
||||
|
||||
/* Local variables */
|
||||
doublereal dfmt;
|
||||
doublereal dfmt = 0.0; // unused
|
||||
integer ifmt, iver;
|
||||
char subr[7];
|
||||
integer ksys , ibyte, irest, ier;
|
||||
|
@@ -77,7 +77,8 @@ static void ComputeTrsf2d(const Handle(TheWLine)& theline,
|
||||
for(Standard_Integer i=1; i<=aNbPnts; i++)
|
||||
{
|
||||
const IntSurf_PntOn2S POn2S = theline->Point(i);
|
||||
Standard_Real U,V;
|
||||
Standard_Real U = 0.0;
|
||||
Standard_Real V = 0.0;
|
||||
(POn2S.*pfunc)(U,V);
|
||||
aUmin = Min(U, aUmin);
|
||||
aVmin = Min(V, aVmin);
|
||||
|
@@ -15,8 +15,186 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepTools_CopyModification.hxx>
|
||||
#include <BRepTools_Modification.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
namespace {
|
||||
|
||||
//! Tool class implementing necessary functionality for copying geometry
|
||||
class BRepBuilderAPI_Copy_Modification : public BRepTools_Modification
|
||||
{
|
||||
public:
|
||||
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom,
|
||||
const Standard_Boolean copyMesh)
|
||||
: myCopyGeom(copyGeom),
|
||||
myCopyMesh(copyMesh)
|
||||
{
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy face;
|
||||
//! copies surface if requested
|
||||
Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S,
|
||||
TopLoc_Location& L, Standard_Real& Tol,
|
||||
Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE
|
||||
{
|
||||
S = BRep_Tool::Surface(F,L);
|
||||
Tol = BRep_Tool::Tolerance(F);
|
||||
RevWires = RevFace = Standard_False;
|
||||
|
||||
if ( ! S.IsNull() && myCopyGeom )
|
||||
S = Handle(Geom_Surface)::DownCast(S->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy triangulation;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T) Standard_OVERRIDE
|
||||
{
|
||||
if (!myCopyMesh
|
||||
&& BRep_Tool::IsGeometric (F))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location L;
|
||||
T = BRep_Tool::Triangulation(F, L);
|
||||
|
||||
if (T.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// mesh is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
T = T->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy edge;
|
||||
//! copies curves if requested
|
||||
Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C,
|
||||
TopLoc_Location& L, Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
Standard_Real f,l;
|
||||
C = BRep_Tool::Curve (E, L, f, l);
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
|
||||
if ( ! C.IsNull() && myCopyGeom )
|
||||
C = Handle(Geom_Curve)::DownCast(C->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy polygon;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P) Standard_OVERRIDE
|
||||
{
|
||||
if (!myCopyMesh
|
||||
&& BRep_Tool::IsGeometric (E))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
P = BRep_Tool::Polygon3D(E, aLoc);
|
||||
|
||||
if (P.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
P = P->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy polygon;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& E, const TopoDS_Face& F,
|
||||
Handle(Poly_PolygonOnTriangulation)& P) Standard_OVERRIDE
|
||||
{
|
||||
if (!myCopyMesh
|
||||
&& BRep_Tool::IsGeometric (E))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(F, aLoc);
|
||||
P = BRep_Tool::PolygonOnTriangulation(E, aTria, aLoc);
|
||||
|
||||
if (P.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
P = P->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy vertex
|
||||
Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P,
|
||||
Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
P = BRep_Tool::Pnt(V);
|
||||
Tol = BRep_Tool::Tolerance(V);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy edge;
|
||||
//! copies pcurve if requested
|
||||
Standard_Boolean NewCurve2d (const TopoDS_Edge& E,
|
||||
const TopoDS_Face& F,
|
||||
const TopoDS_Edge& /*NewE*/,
|
||||
const TopoDS_Face& /*NewF*/,
|
||||
Handle(Geom2d_Curve)& C,
|
||||
Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
Standard_Real f, l;
|
||||
C = BRep_Tool::CurveOnSurface (E, F, f, l);
|
||||
|
||||
if ( ! C.IsNull() && myCopyGeom )
|
||||
C = Handle(Geom2d_Curve)::DownCast (C->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy vertex
|
||||
Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E,
|
||||
Standard_Real& P, Standard_Real& Tol) Standard_OVERRIDE
|
||||
{
|
||||
if (V.IsNull()) return Standard_False; // infinite edge may have Null vertex
|
||||
|
||||
Tol = BRep_Tool::Tolerance(V);
|
||||
P = BRep_Tool::Parameter (V, E);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns the continuity of E between F1 and F2
|
||||
GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1,
|
||||
const TopoDS_Face& F2, const TopoDS_Edge&,
|
||||
const TopoDS_Face&, const TopoDS_Face&) Standard_OVERRIDE
|
||||
{
|
||||
return BRep_Tool::Continuity (E, F1, F2);
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepBuilderAPI_Copy_Modification,BRepTools_Modification)
|
||||
|
||||
private:
|
||||
Standard_Boolean myCopyGeom;
|
||||
Standard_Boolean myCopyMesh;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepBuilderAPI_Copy
|
||||
@@ -25,7 +203,7 @@
|
||||
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||
{
|
||||
myModification = new BRepTools_CopyModification(Standard_True, Standard_False);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(Standard_True, Standard_False);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +214,7 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepTools_CopyModification(copyGeom, copyMesh);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
DoModif(S);
|
||||
}
|
||||
|
||||
@@ -48,7 +226,7 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_B
|
||||
|
||||
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepTools_CopyModification(copyGeom, copyMesh);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
NotDone(); // on force la copie si on vient deja d`en faire une
|
||||
DoModif(S);
|
||||
}
|
||||
|
@@ -1,247 +0,0 @@
|
||||
// Created on: 2022-06-30
|
||||
// Created by: Alexander MALYSHEV
|
||||
// Copyright (c) 2022-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <BRepBuilderAPI_MakeShapeOnMesh.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <NCollection_IndexedDataMap.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Structure representing mesh edge.
|
||||
struct Edge
|
||||
{
|
||||
//! Constructor. Sets edge nodes.
|
||||
Edge(const Standard_Integer TheIdx1,
|
||||
const Standard_Integer TheIdx2)
|
||||
: Idx1(Min(TheIdx1, TheIdx2)),
|
||||
Idx2(Max(TheIdx1, TheIdx2))
|
||||
{}
|
||||
|
||||
//! Comparison operator.
|
||||
Standard_Boolean operator<(const Edge& other) const
|
||||
{
|
||||
if (Idx1 < other.Idx1 ||
|
||||
(Idx1 == other.Idx1 && Idx2 < other.Idx2))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//! First index. It is lower or equal than the second.
|
||||
Standard_Integer Idx1;
|
||||
|
||||
//! Second index.
|
||||
Standard_Integer Idx2;
|
||||
};
|
||||
|
||||
//! Hasher of Edge structure.
|
||||
struct EdgeHasher
|
||||
{
|
||||
|
||||
//! Returns hash code for the given edge.
|
||||
static Standard_Integer HashCode(const Edge& theEdge,
|
||||
const Standard_Integer theUpperBound)
|
||||
{
|
||||
// Circle-based collisions.
|
||||
return ::HashCode(theEdge.Idx1 * theEdge.Idx1 + theEdge.Idx2 * theEdge.Idx2, theUpperBound);
|
||||
}
|
||||
|
||||
//! Returns true if two edges are equal.
|
||||
static Standard_Boolean IsEqual(const Edge& theEdge1,
|
||||
const Edge& theEdge2)
|
||||
{
|
||||
return theEdge1.Idx1 == theEdge2.Idx1 && theEdge1.Idx2 == theEdge2.Idx2;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Build
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepBuilderAPI_MakeShapeOnMesh::Build(const Message_ProgressRange& theRange)
|
||||
{
|
||||
// Generally, this method guarantees topology sharing by mapping mesh primitives
|
||||
// into topological counterparts.
|
||||
// mesh points -> topological vertices
|
||||
// mesh edges -> topological edges
|
||||
|
||||
// Cannot reconstruct anything from null or empty mesh.
|
||||
if (myMesh.IsNull() || myMesh->NbNodes() == 0 || myMesh->NbTriangles() == 0)
|
||||
return;
|
||||
|
||||
const Standard_Integer aNbNodes = myMesh->NbNodes();
|
||||
const Standard_Integer aNbTriangles = myMesh->NbTriangles();
|
||||
|
||||
// We are going to have three loops: iterate once over nodes and iterate twice
|
||||
// over triangles of input mesh.
|
||||
Message_ProgressScope aPS(theRange,
|
||||
"Per-facet shape construction",
|
||||
Standard_Real(aNbNodes + 2 * aNbTriangles));
|
||||
|
||||
// Build shared vertices.
|
||||
NCollection_IndexedDataMap<Standard_Integer, TopoDS_Vertex> aPnt2VertexMap;
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNbNodes; ++i)
|
||||
{
|
||||
aPS.Next();
|
||||
if (aPS.UserBreak())
|
||||
return;
|
||||
|
||||
const gp_Pnt aP = myMesh->Node(i);
|
||||
const TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex(aP);
|
||||
aPnt2VertexMap.Add(i, aV);
|
||||
}
|
||||
|
||||
// Build shared edges.
|
||||
NCollection_IndexedDataMap<Edge, TopoDS_Edge, EdgeHasher> anEdgeToTEgeMap;
|
||||
for (Standard_Integer i = 1; i <= aNbTriangles; ++i)
|
||||
{
|
||||
aPS.Next();
|
||||
if (aPS.UserBreak())
|
||||
return;
|
||||
|
||||
Standard_Integer anIdx[3];
|
||||
const Poly_Triangle& aTriangle = myMesh->Triangle(i);
|
||||
aTriangle.Get(anIdx[0], anIdx[1], anIdx[2]);
|
||||
|
||||
// Skip degenerated triangles.
|
||||
if (anIdx[0] == anIdx[1] || anIdx[0] == anIdx[2] || anIdx[1] == anIdx[2])
|
||||
continue;
|
||||
|
||||
const gp_Pnt aP1 = myMesh->Node(anIdx[0]);
|
||||
const gp_Pnt aP2 = myMesh->Node(anIdx[1]);
|
||||
const gp_Pnt aP3 = myMesh->Node(anIdx[2]);
|
||||
const Standard_Real aD1 = aP1.SquareDistance(aP2);
|
||||
const Standard_Real aD2 = aP1.SquareDistance(aP3);
|
||||
const Standard_Real aD3 = aP2.SquareDistance(aP3);
|
||||
if (aD1 < gp::Resolution() ||
|
||||
aD2 < gp::Resolution() ||
|
||||
aD3 < gp::Resolution())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Edges are constructed in forward order for the existing normals orientation.
|
||||
// In Poly_Triangulation, positive direction is defined as cross product:
|
||||
// (aV1, aV2) x (aV1, aV3).
|
||||
const TopoDS_Vertex& aV1 = aPnt2VertexMap.FindFromKey(anIdx[0]);
|
||||
const TopoDS_Vertex& aV2 = aPnt2VertexMap.FindFromKey(anIdx[1]);
|
||||
const TopoDS_Vertex& aV3 = aPnt2VertexMap.FindFromKey(anIdx[2]);
|
||||
|
||||
const Edge aMeshEdge1(anIdx[0], anIdx[1]);
|
||||
const Edge aMeshEdge2(anIdx[1], anIdx[2]);
|
||||
const Edge aMeshEdge3(anIdx[2], anIdx[0]);
|
||||
|
||||
BRepBuilderAPI_MakeEdge aMaker1(aV1, aV2);
|
||||
BRepBuilderAPI_MakeEdge aMaker2(aV2, aV3);
|
||||
BRepBuilderAPI_MakeEdge aMaker3(aV3, aV1);
|
||||
|
||||
TopoDS_Edge aTE1 = aMaker1.Edge();
|
||||
if (anIdx[1] < anIdx[0])
|
||||
aTE1.Reverse();
|
||||
|
||||
TopoDS_Edge aTE2 = aMaker2.Edge();
|
||||
if (anIdx[2] < anIdx[1])
|
||||
aTE2.Reverse();
|
||||
|
||||
TopoDS_Edge aTE3 = aMaker3.Edge();
|
||||
if (anIdx[0] < anIdx[2])
|
||||
aTE3.Reverse();
|
||||
|
||||
anEdgeToTEgeMap.Add(aMeshEdge1, aTE1);
|
||||
anEdgeToTEgeMap.Add(aMeshEdge2, aTE2);
|
||||
anEdgeToTEgeMap.Add(aMeshEdge3, aTE3);
|
||||
}
|
||||
|
||||
// Construct planar faces using shared topology.
|
||||
TopoDS_Compound aResult;
|
||||
BRep_Builder aBB;
|
||||
aBB.MakeCompound(aResult);
|
||||
for (Standard_Integer i = 1; i <= aNbTriangles; ++i)
|
||||
{
|
||||
aPS.Next();
|
||||
if (aPS.UserBreak())
|
||||
return;
|
||||
|
||||
Standard_Integer anIdx[3];
|
||||
const Poly_Triangle& aTriangle = myMesh->Triangle(i);
|
||||
aTriangle.Get(anIdx[0], anIdx[1], anIdx[2]);
|
||||
|
||||
const Edge aMeshEdge1(anIdx[0], anIdx[1]);
|
||||
const Edge aMeshEdge2(anIdx[1], anIdx[2]);
|
||||
const Edge aMeshEdge3(anIdx[2], anIdx[0]);
|
||||
const Standard_Boolean isReversed1 = anIdx[1] < anIdx[0];
|
||||
const Standard_Boolean isReversed2 = anIdx[2] < anIdx[1];
|
||||
const Standard_Boolean isReversed3 = anIdx[0] < anIdx[2];
|
||||
|
||||
// Edges can be skipped in case of mesh defects - topologically or geometrically
|
||||
// degenerated triangles.
|
||||
const Standard_Boolean aHasAllEdges = anEdgeToTEgeMap.Contains(aMeshEdge1) &&
|
||||
anEdgeToTEgeMap.Contains(aMeshEdge2) &&
|
||||
anEdgeToTEgeMap.Contains(aMeshEdge3) ;
|
||||
if (!aHasAllEdges)
|
||||
continue;
|
||||
|
||||
TopoDS_Edge aTEdge1 = anEdgeToTEgeMap.FindFromKey(aMeshEdge1);
|
||||
if (isReversed1)
|
||||
aTEdge1.Reverse();
|
||||
TopoDS_Edge aTEdge2 = anEdgeToTEgeMap.FindFromKey(aMeshEdge2);
|
||||
if (isReversed2)
|
||||
aTEdge2.Reverse();
|
||||
TopoDS_Edge aTEdge3 = anEdgeToTEgeMap.FindFromKey(aMeshEdge3);
|
||||
if (isReversed3)
|
||||
aTEdge3.Reverse();
|
||||
|
||||
BRepBuilderAPI_MakeWire aWireMaker;
|
||||
aWireMaker.Add(aTEdge1);
|
||||
aWireMaker.Add(aTEdge2);
|
||||
aWireMaker.Add(aTEdge3);
|
||||
const TopoDS_Wire aWire = aWireMaker.Wire();
|
||||
|
||||
// Construct plane explicitly since it is faster than automatic construction
|
||||
// within BRepBuilderAPI_MakeFace.
|
||||
BRepAdaptor_Curve aC1(aTEdge1);
|
||||
BRepAdaptor_Curve aC2(aTEdge2);
|
||||
const gp_Dir aD1 = aC1.Line().Direction();
|
||||
const gp_Dir aD2 = aC2.Line().Direction();
|
||||
gp_XYZ aN = aD1.XYZ().Crossed(aD2.XYZ());
|
||||
if (aN.SquareModulus() < Precision::SquareConfusion())
|
||||
continue;
|
||||
if (aTEdge1.Orientation() == TopAbs_REVERSED)
|
||||
aN.Reverse();
|
||||
if (aTEdge2.Orientation() == TopAbs_REVERSED)
|
||||
aN.Reverse();
|
||||
const gp_Dir aNorm(aN);
|
||||
gp_Pln aPln(myMesh->Node(anIdx[0]), aNorm);
|
||||
|
||||
BRepBuilderAPI_MakeFace aFaceMaker(aPln, aWire);
|
||||
const TopoDS_Face aFace = aFaceMaker.Face();
|
||||
|
||||
aBB.Add(aResult, aFace);
|
||||
}
|
||||
|
||||
this->Done();
|
||||
myShape = aResult;
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
// Created on: 2022-06-30
|
||||
// Created by: Alexander MALYSHEV
|
||||
// Copyright (c) 2022-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
||||
#define _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
||||
|
||||
#include <BRepBuilderAPI_MakeShape.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
//! Builds shape on per-facet basis on the input mesh. Resulting shape has shared
|
||||
//! edges by construction, but no maximization (unify same domain) is applied.
|
||||
//! No generation history is provided.
|
||||
class BRepBuilderAPI_MakeShapeOnMesh : public BRepBuilderAPI_MakeShape
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Ctor. Sets mesh to process.
|
||||
//! @param theMesh [in] - Mesh to construct shape for.
|
||||
BRepBuilderAPI_MakeShapeOnMesh(const Handle(Poly_Triangulation)& theMesh)
|
||||
: myMesh(theMesh)
|
||||
{}
|
||||
|
||||
//! Builds shape on mesh.
|
||||
Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
Handle(Poly_Triangulation) myMesh;
|
||||
|
||||
};
|
||||
|
||||
#endif // _BRepBuilderAPI_MakeShapeOnMesh_HeaderFile
|
@@ -36,14 +36,13 @@ BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const gp_Trsf& T) :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& theShape,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theCopyGeom,
|
||||
const Standard_Boolean theCopyMesh)
|
||||
: myTrsf(theTrsf)
|
||||
BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& S,
|
||||
const gp_Trsf& T,
|
||||
const Standard_Boolean Copy) :
|
||||
myTrsf(T)
|
||||
{
|
||||
myModification = new BRepTools_TrsfModification(theTrsf);
|
||||
Perform(theShape, theCopyGeom, theCopyMesh);
|
||||
myModification = new BRepTools_TrsfModification(T);
|
||||
Perform(S,Copy);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,21 +52,19 @@ BRepBuilderAPI_Transform::BRepBuilderAPI_Transform (const TopoDS_Shape& theSh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& theShape,
|
||||
const Standard_Boolean theCopyGeom,
|
||||
const Standard_Boolean theCopyMesh)
|
||||
void BRepBuilderAPI_Transform::Perform(const TopoDS_Shape& S,
|
||||
const Standard_Boolean Copy)
|
||||
{
|
||||
myUseModif = theCopyGeom || myTrsf.IsNegative() || (Abs(Abs(myTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec());
|
||||
myUseModif = Copy || myTrsf.IsNegative() || (Abs(Abs(myTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec());
|
||||
if (myUseModif) {
|
||||
Handle(BRepTools_TrsfModification) theModif =
|
||||
Handle(BRepTools_TrsfModification)::DownCast(myModification);
|
||||
theModif->Trsf() = myTrsf;
|
||||
theModif->IsCopyMesh() = theCopyMesh;
|
||||
DoModif(theShape, myModification);
|
||||
DoModif(S,myModification);
|
||||
}
|
||||
else {
|
||||
myLocation = myTrsf;
|
||||
myShape = theShape.Moved(myLocation);
|
||||
myShape = S.Moved(myLocation);
|
||||
Done();
|
||||
}
|
||||
|
||||
|
@@ -50,37 +50,28 @@ public:
|
||||
//! to define the shape to transform.
|
||||
Standard_EXPORT BRepBuilderAPI_Transform(const gp_Trsf& T);
|
||||
|
||||
//! Creates a transformation from the gp_Trsf <theTrsf>, and
|
||||
//! applies it to the shape <theShape>. If the transformation
|
||||
//! Creates a transformation from the gp_Trsf <T>, and
|
||||
//! applies it to the shape <S>. If the transformation
|
||||
//! is direct and isometric (determinant = 1) and
|
||||
//! <theCopyGeom> = Standard_False, the resulting shape is
|
||||
//! <theShape> on which a new location has been set.
|
||||
//! <Copy> = Standard_False, the resulting shape is
|
||||
//! <S> on which a new location has been set.
|
||||
//! Otherwise, the transformation is applied on a
|
||||
//! duplication of <theShape>.
|
||||
//! If <theCopyMesh> is true, the triangulation will be copied,
|
||||
//! and the copy will be assigned to the result shape.
|
||||
Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& theShape,
|
||||
const gp_Trsf& theTrsf,
|
||||
const Standard_Boolean theCopyGeom = Standard_False,
|
||||
const Standard_Boolean theCopyMesh = Standard_False);
|
||||
//! duplication of <S>.
|
||||
Standard_EXPORT BRepBuilderAPI_Transform(const TopoDS_Shape& S, const gp_Trsf& T, const Standard_Boolean Copy = Standard_False);
|
||||
|
||||
//! Applies the geometric transformation defined at the
|
||||
//! pplies the geometric transformation defined at the
|
||||
//! time of construction of this framework to the shape S.
|
||||
//! - If the transformation T is direct and isometric, in
|
||||
//! other words, if the determinant of the vectorial part
|
||||
//! of T is equal to 1., and if theCopyGeom equals false (the
|
||||
//! of T is equal to 1., and if Copy equals false (the
|
||||
//! default value), the resulting shape is the same as
|
||||
//! the original but with a new location assigned to it.
|
||||
//! - In all other cases, the transformation is applied to a duplicate of theShape.
|
||||
//! - If theCopyMesh is true, the triangulation will be copied,
|
||||
//! and the copy will be assigned to the result shape.
|
||||
//! - In all other cases, the transformation is applied to a duplicate of S.
|
||||
//! Use the function Shape to access the result.
|
||||
//! Note: this framework can be reused to apply the same
|
||||
//! geometric transformation to other shapes. You only
|
||||
//! need to specify them by calling the function Perform again.
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& theShape,
|
||||
const Standard_Boolean theCopyGeom = Standard_False,
|
||||
const Standard_Boolean theCopyMesh = Standard_False);
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean Copy = Standard_False);
|
||||
|
||||
//! Returns the modified shape corresponding to <S>.
|
||||
Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE;
|
||||
|
@@ -26,8 +26,6 @@ BRepBuilderAPI_MakePolygon.cxx
|
||||
BRepBuilderAPI_MakePolygon.hxx
|
||||
BRepBuilderAPI_MakeShape.cxx
|
||||
BRepBuilderAPI_MakeShape.hxx
|
||||
BRepBuilderAPI_MakeShapeOnMesh.cxx
|
||||
BRepBuilderAPI_MakeShapeOnMesh.hxx
|
||||
BRepBuilderAPI_MakeShell.cxx
|
||||
BRepBuilderAPI_MakeShell.hxx
|
||||
BRepBuilderAPI_MakeSolid.cxx
|
||||
|
@@ -1585,7 +1585,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
NbSamples = 4;
|
||||
gp_Pln FirstPlane;
|
||||
PlaneOfWire(TopoDS::Wire(myWork(ideb)), FirstPlane);
|
||||
gp_Pnt PrevBary = FirstPlane.Location();
|
||||
gp_Pnt FirstBary = FirstPlane.Location();
|
||||
gp_Vec NormalOfFirstPlane = FirstPlane.Axis().Direction();
|
||||
for (i = ideb+1; i <= ifin; i++)
|
||||
{
|
||||
@@ -1596,10 +1596,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
gp_Pln CurPlane;
|
||||
PlaneOfWire(aWire, CurPlane);
|
||||
gp_Pnt CurBary = CurPlane.Location();
|
||||
gp_Vec aVec(PrevBary, CurBary);
|
||||
gp_Vec aVec(FirstBary, CurBary);
|
||||
gp_Vec anOffsetProj = (aVec * NormalOfFirstPlane) * NormalOfFirstPlane;
|
||||
CurBary.Translate(-anOffsetProj); //projected current bary center
|
||||
gp_Vec Offset(CurBary, PrevBary);
|
||||
gp_Vec Offset(CurBary, FirstBary);
|
||||
|
||||
TopoDS_Wire newwire;
|
||||
BRep_Builder BB;
|
||||
@@ -1804,8 +1804,6 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
|
||||
newwire.Closed( Standard_True );
|
||||
newwire.Orientation( TopAbs_FORWARD );
|
||||
myWork(i) = newwire;
|
||||
|
||||
PrevBary = CurBary;
|
||||
}
|
||||
#ifdef OCCT_DEBUG_EFV
|
||||
|
||||
|
@@ -124,12 +124,10 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
|
||||
const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
|
||||
const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
|
||||
|
||||
// Slightly increase exact resolution so to cover links with approximate
|
||||
// length equal to resolution itself on sub-resolution differences.
|
||||
const Standard_Real aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
|
||||
const Adaptor3d_Surface& aSurface = GetSurface()->Surface();
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance) * 1.1;
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance) * 1.1;
|
||||
const Standard_Real aResU = aSurface.UResolution (aTolerance);
|
||||
const Standard_Real aResV = aSurface.VResolution (aTolerance);
|
||||
|
||||
const Standard_Real aDeflectionUV = 1.e-05;
|
||||
myTolerance.first = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
|
||||
|
@@ -46,8 +46,7 @@ namespace
|
||||
void operator()(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
if (aDFace->IsSet(IMeshData_Outdated) ||
|
||||
aDFace->GetFace().IsNull())
|
||||
if (aDFace->IsSet(IMeshData_Outdated))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +119,7 @@ namespace
|
||||
void operator()(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone || aDFace->IsSet(IMeshData_Failure))
|
||||
if (aDFace->GetSurface()->GetType() != GeomAbs_Cone)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -129,7 +128,7 @@ namespace
|
||||
for (Standard_Integer aEdgeIdx = 0; aEdgeIdx < aDWire->EdgesNb() - 1; ++aEdgeIdx)
|
||||
{
|
||||
const IMeshData::IEdgePtr& aDEdge = aDWire->GetEdge (aEdgeIdx);
|
||||
|
||||
|
||||
if (aDEdge->GetPCurve(aDFace.get(), TopAbs_FORWARD) != aDEdge->GetPCurve(aDFace.get(), TopAbs_REVERSED))
|
||||
{
|
||||
if (aDEdge->GetCurve()->ParametersNb() == 2)
|
||||
@@ -147,7 +146,7 @@ namespace
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -124,14 +124,7 @@ static Standard_Integer transform(Draw_Interpretor&,Standard_Integer n,const cha
|
||||
Standard_Boolean isBasic = Standard_False;
|
||||
Standard_Boolean isForced = Standard_False;
|
||||
Standard_Boolean isCopy = Standard_False;
|
||||
Standard_Boolean isCopyMesh = Standard_False;
|
||||
|
||||
// Check "copymesh" flag.
|
||||
if (!strcmp(a[n - 1], "-copymesh"))
|
||||
{
|
||||
isCopyMesh = Standard_True;
|
||||
last = --n;
|
||||
}
|
||||
// Check "copy" flag.
|
||||
if (!strcmp(a[n-1], "-copy")) {
|
||||
isCopy = Standard_True;
|
||||
@@ -225,7 +218,7 @@ static Standard_Integer transform(Draw_Interpretor&,Standard_Integer n,const cha
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
trf.Perform(S, isCopy, isCopyMesh);
|
||||
trf.Perform(S, isCopy);
|
||||
if (!trf.IsDone())
|
||||
return 1;
|
||||
DBRep::Set(a[i],trf.Shape());
|
||||
@@ -1494,27 +1487,27 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmove",
|
||||
"tmove name1 name2 ... name, set location from name [-copy] [-copymesh]",
|
||||
"tmove name1 name2 ... name, set location from name [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("ttranslate",
|
||||
"ttranslate name1 name2 ... dx dy dz [-copy [-copymesh]]",
|
||||
"ttranslate name1 name2 ... dx dy dz [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("trotate",
|
||||
"trotate name1 name2 ... x y z dx dy dz angle [-copy [-copymesh]]",
|
||||
"trotate name1 name2 ... x y z dx dy dz angle [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmirror",
|
||||
"tmirror name x y z dx dy dz [-copy] [-copymesh]",
|
||||
"tmirror name x y z dx dy dz [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tscale",
|
||||
"tscale name x y z scale [-copy] [-copymesh]",
|
||||
"tscale name x y z scale [-copy]",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
|
@@ -893,8 +893,6 @@ void BRepTools::CleanGeometry(const TopoDS_Shape& theShape)
|
||||
aBuilder.UpdateEdge(anEdge, Handle(Geom_Curve)(),
|
||||
TopLoc_Location(), BRep_Tool::Tolerance(anEdge));
|
||||
}
|
||||
|
||||
RemoveUnusedPCurves(theShape);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,215 +0,0 @@
|
||||
// Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRepTools_CopyModification.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepTools_CopyModification, BRepTools_Modification)
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepTools_CopyModification
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepTools_CopyModification::BRepTools_CopyModification(const Standard_Boolean copyGeom,
|
||||
const Standard_Boolean copyMesh)
|
||||
: myCopyGeom(copyGeom),
|
||||
myCopyMesh(copyMesh)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewSurface
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewSurface(const TopoDS_Face& theFace,
|
||||
Handle(Geom_Surface)& theSurf,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol,
|
||||
Standard_Boolean& theRevWires,
|
||||
Standard_Boolean& theRevFace)
|
||||
{
|
||||
theSurf = BRep_Tool::Surface(theFace, theLoc);
|
||||
theTol = BRep_Tool::Tolerance(theFace);
|
||||
theRevWires = theRevFace = Standard_False;
|
||||
|
||||
if (!theSurf.IsNull() && myCopyGeom)
|
||||
theSurf = Handle(Geom_Surface)::DownCast(theSurf->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewTriangulation(const TopoDS_Face& theFace,
|
||||
Handle(Poly_Triangulation)& theTri)
|
||||
{
|
||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theFace))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
theTri = BRep_Tool::Triangulation(theFace, aLoc);
|
||||
|
||||
if (theTri.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// mesh is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
theTri = theTri->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewCurve(const TopoDS_Edge& theEdge,
|
||||
Handle(Geom_Curve)& theCurve,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
Standard_Real aFirst, aLast;
|
||||
theCurve = BRep_Tool::Curve(theEdge, theLoc, aFirst, aLast);
|
||||
theTol = BRep_Tool::Tolerance(theEdge);
|
||||
|
||||
if (!theCurve.IsNull() && myCopyGeom)
|
||||
theCurve = Handle(Geom_Curve)::DownCast(theCurve->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewPolygon(const TopoDS_Edge& theEdge,
|
||||
Handle(Poly_Polygon3D)& thePoly)
|
||||
{
|
||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theEdge))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
thePoly = BRep_Tool::Polygon3D(theEdge, aLoc);
|
||||
|
||||
if (thePoly.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
thePoly = thePoly->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewPolygonOnTriangulation(
|
||||
const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly)
|
||||
{
|
||||
if (!myCopyMesh && BRep_Tool::IsGeometric(theEdge))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(theFace, aLoc);
|
||||
thePoly = BRep_Tool::PolygonOnTriangulation(theEdge, aTria, aLoc);
|
||||
|
||||
if (thePoly.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
// polygon is copied if and only if the geometry need to be copied too
|
||||
if (myCopyGeom)
|
||||
thePoly = thePoly->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewPoint(const TopoDS_Vertex& theVertex,
|
||||
gp_Pnt& thePnt,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
thePnt = BRep_Tool::Pnt(theVertex);
|
||||
theTol = BRep_Tool::Tolerance(theVertex);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewCurve2d
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewCurve2d(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge&,
|
||||
const TopoDS_Face&,
|
||||
Handle(Geom2d_Curve)& theCurve,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
theTol = BRep_Tool::Tolerance(theEdge);
|
||||
Standard_Real aFirst, aLast;
|
||||
theCurve = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast);
|
||||
|
||||
if (!theCurve.IsNull() && myCopyGeom)
|
||||
theCurve = Handle(Geom2d_Curve)::DownCast(theCurve->Copy());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewParameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_CopyModification::NewParameter(const TopoDS_Vertex& theVertex,
|
||||
const TopoDS_Edge& theEdge,
|
||||
Standard_Real& thePnt,
|
||||
Standard_Real& theTol)
|
||||
{
|
||||
if (theVertex.IsNull())
|
||||
return Standard_False; // infinite edge may have Null vertex
|
||||
|
||||
theTol = BRep_Tool::Tolerance(theVertex);
|
||||
thePnt = BRep_Tool::Parameter(theVertex, theEdge);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Continuity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAbs_Shape BRepTools_CopyModification::Continuity(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const TopoDS_Edge&,
|
||||
const TopoDS_Face&,
|
||||
const TopoDS_Face&)
|
||||
{
|
||||
return BRep_Tool::Continuity(theEdge, theFace1, theFace2);
|
||||
}
|
||||
|
||||
|
@@ -1,124 +0,0 @@
|
||||
// Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _BRepTools_CopyModification_HeaderFile
|
||||
#define _BRepTools_CopyModification_HeaderFile
|
||||
|
||||
#include <BRepTools_Modification.hxx>
|
||||
|
||||
class BRepTools_CopyModification;
|
||||
DEFINE_STANDARD_HANDLE(BRepTools_CopyModification, BRepTools_Modification)
|
||||
|
||||
//! Tool class implementing necessary functionality for copying geometry and triangulation.
|
||||
class BRepTools_CopyModification : public BRepTools_Modification
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
//! \param[in] theCopyGeom indicates that the geomtery (surfaces and curves) should be copied
|
||||
//! \param[in] theCopyMesh indicates that the triangulation should be copied
|
||||
Standard_EXPORT explicit BRepTools_CopyModification(const Standard_Boolean theCopyGeom = Standard_True,
|
||||
const Standard_Boolean theCopyMesh = Standard_True);
|
||||
|
||||
//! Returns true if theFace has been modified.
|
||||
//! If the face has been modified:
|
||||
//! - theSurf is the new geometry of the face,
|
||||
//! - theLoc is its new location, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! theRevWires, theRevFace are always set to false, because the orientaion is not changed.
|
||||
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& theFace,
|
||||
Handle(Geom_Surface)& theSurf,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol,
|
||||
Standard_Boolean& theRevWires,
|
||||
Standard_Boolean& theRevFace) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theEdge has been modified.
|
||||
//! If the edge has been modified:
|
||||
//! - theCurve is the new geometric support of the edge,
|
||||
//! - theLoc is the new location, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! If the edge has not been modified, this function
|
||||
//! returns false, and the values of theCurve, theLoc and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& theEdge,
|
||||
Handle(Geom_Curve)& theCurve,
|
||||
TopLoc_Location& theLoc,
|
||||
Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theVertex has been modified.
|
||||
//! If the vertex has been modified:
|
||||
//! - thePnt is the new geometry of the vertex, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! If the vertex has not been modified this function
|
||||
//! returns false, and the values of thePnt and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& theVertex, gp_Pnt& thePnt, Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theEdge has a new curve on surface on theFace.
|
||||
//! If a new curve exists:
|
||||
//! - theCurve is the new geometric support of the edge,
|
||||
//! - theTol the new tolerance.
|
||||
//! If no new curve exists, this function returns false, and
|
||||
//! the values of theCurve and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theNewEdge,
|
||||
const TopoDS_Face& theNewFace,
|
||||
Handle(Geom2d_Curve)& theCurve,
|
||||
Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if theVertex has a new parameter on theEdge.
|
||||
//! If a new parameter exists:
|
||||
//! - thePnt is the parameter, and
|
||||
//! - theTol is the new tolerance.
|
||||
//! If no new parameter exists, this function returns false,
|
||||
//! and the values of thePnt and theTol are not significant.
|
||||
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& theVertex,
|
||||
const TopoDS_Edge& theEdge,
|
||||
Standard_Real& thePnt,
|
||||
Standard_Real& theTol) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the continuity of theNewEdge between theNewFace1 and theNewFace2.
|
||||
//!
|
||||
//! theNewEdge is the new edge created from theEdge. theNewFace1
|
||||
//! (resp. theNewFace2) is the new face created from theFace1 (resp. theFace2).
|
||||
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const TopoDS_Edge& theNewEdge,
|
||||
const TopoDS_Face& theNewFace1,
|
||||
const TopoDS_Face& theNewFace2) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the face has been modified according to changed triangulation.
|
||||
//! If the face has been modified:
|
||||
//! - theTri is a new triangulation on the face
|
||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& theFace, Handle(Poly_Triangulation)& theTri) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon
|
||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& theEdge, Handle(Poly_Polygon3D)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon on triangulation
|
||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepTools_CopyModification, BRepTools_Modification)
|
||||
|
||||
private:
|
||||
Standard_Boolean myCopyGeom;
|
||||
Standard_Boolean myCopyMesh;
|
||||
};
|
||||
|
||||
#endif // _BRepTools_CopyModification_HeaderFile
|
@@ -29,7 +29,6 @@
|
||||
#include <GeomLib.hxx>
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Quaternion.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -89,13 +88,7 @@ Standard_Boolean BRepTools_GTrsfModification::NewSurface
|
||||
gp_GTrsf gtrsf;
|
||||
gtrsf.SetVectorialPart(myGTrsf.VectorialPart());
|
||||
gtrsf.SetTranslationPart(myGTrsf.TranslationPart());
|
||||
S = BRep_Tool::Surface(F, L);
|
||||
if (S.IsNull())
|
||||
{
|
||||
//processing the case when there is no geometry
|
||||
return Standard_False;
|
||||
}
|
||||
S = Handle(Geom_Surface)::DownCast(S->Copy());
|
||||
S = Handle(Geom_Surface)::DownCast(BRep_Tool::Surface(F,L)->Copy());
|
||||
|
||||
Tol = BRep_Tool::Tolerance(F);
|
||||
Tol *= myGScale;
|
||||
@@ -180,7 +173,7 @@ Standard_Boolean BRepTools_GTrsfModification::NewCurve
|
||||
C = new Geom_TrimmedCurve(C, f, l);
|
||||
}
|
||||
L.Identity() ;
|
||||
return !C.IsNull();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -221,11 +214,6 @@ Standard_Boolean BRepTools_GTrsfModification::NewCurve2d
|
||||
Tol *= myGScale;
|
||||
Standard_Real f,l;
|
||||
C = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||
if (C.IsNull())
|
||||
{
|
||||
//processing the case when there is no geometry
|
||||
return Standard_False;
|
||||
}
|
||||
C = new Geom2d_TrimmedCurve(C, f, l);
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -263,113 +251,4 @@ GeomAbs_Shape BRepTools_GTrsfModification::Continuity
|
||||
return BRep_Tool::Continuity(E,F1,F2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_GTrsfModification::NewTriangulation(const TopoDS_Face& theFace,
|
||||
Handle(Poly_Triangulation)& theTriangulation)
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
theTriangulation = BRep_Tool::Triangulation(theFace, aLoc);
|
||||
if (theTriangulation.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_GTrsf aGTrsf;
|
||||
aGTrsf.SetVectorialPart(myGTrsf.VectorialPart());
|
||||
aGTrsf.SetTranslationPart(myGTrsf.TranslationPart());
|
||||
aGTrsf.Multiply(aLoc.Transformation());
|
||||
|
||||
theTriangulation = theTriangulation->Copy();
|
||||
theTriangulation->SetCachedMinMax(Bnd_Box()); // clear bounding box
|
||||
theTriangulation->Deflection(theTriangulation->Deflection() * Abs(myGScale));
|
||||
// apply transformation to 3D nodes
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
|
||||
{
|
||||
gp_Pnt aP = theTriangulation->Node(anInd);
|
||||
aGTrsf.Transforms(aP.ChangeCoord());
|
||||
theTriangulation->SetNode(anInd, aP);
|
||||
}
|
||||
// modify triangles orientation in case of mirror transformation
|
||||
if (myGScale < 0.0)
|
||||
{
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
||||
{
|
||||
Poly_Triangle aTria = theTriangulation->Triangle(anInd);
|
||||
Standard_Integer aN1, aN2, aN3;
|
||||
aTria.Get(aN1, aN2, aN3);
|
||||
aTria.Set(aN1, aN3, aN2);
|
||||
theTriangulation->SetTriangle(anInd, aTria);
|
||||
}
|
||||
}
|
||||
// modify normals
|
||||
if (theTriangulation->HasNormals())
|
||||
{
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
||||
{
|
||||
gp_Dir aNormal = theTriangulation->Normal(anInd);
|
||||
aNormal.Transform(aGTrsf.Trsf());
|
||||
theTriangulation->SetNormal(anInd, aNormal);
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_GTrsfModification::NewPolygon(const TopoDS_Edge& theEdge,
|
||||
Handle(Poly_Polygon3D)& thePoly)
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
thePoly = BRep_Tool::Polygon3D(theEdge, aLoc);
|
||||
if (thePoly.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_GTrsf aGTrsf;
|
||||
aGTrsf.SetVectorialPart(myGTrsf.VectorialPart());
|
||||
aGTrsf.SetTranslationPart(myGTrsf.TranslationPart());
|
||||
aGTrsf.Multiply(aLoc.Transformation());
|
||||
|
||||
thePoly = thePoly->Copy();
|
||||
thePoly->Deflection(thePoly->Deflection() * Abs(myGScale));
|
||||
// transform nodes
|
||||
TColgp_Array1OfPnt& aNodesArray = thePoly->ChangeNodes();
|
||||
for (Standard_Integer anId = aNodesArray.Lower(); anId <= aNodesArray.Upper(); ++anId)
|
||||
{
|
||||
gp_Pnt& aP = aNodesArray.ChangeValue(anId);
|
||||
aGTrsf.Transforms(aP.ChangeCoord());
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_GTrsfModification::NewPolygonOnTriangulation
|
||||
(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly)
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(theFace, aLoc);
|
||||
if (aT.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
thePoly = BRep_Tool::PolygonOnTriangulation(theEdge, aT, aLoc);
|
||||
if (!thePoly.IsNull())
|
||||
thePoly = thePoly->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -101,25 +101,6 @@ public:
|
||||
//! (resp. <F2>).
|
||||
Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the face has been modified according to changed triangulation.
|
||||
//! If the face has been modified:
|
||||
//! - theTri is a new triangulation on the face
|
||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& theFace,
|
||||
Handle(Poly_Triangulation)& theTri) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon
|
||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& theEdge,
|
||||
Handle(Poly_Polygon3D)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon on triangulation
|
||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -20,10 +20,7 @@
|
||||
#include <BRep_TEdge.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <Extrema_ExtPC2d.hxx>
|
||||
#include <Extrema_GenLocateExtPS.hxx>
|
||||
#include <Extrema_LocateExtPC.hxx>
|
||||
#include <Extrema_LocateExtPC2d.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
@@ -50,163 +47,30 @@
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_CopyModification)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_Modification)
|
||||
|
||||
//
|
||||
namespace
|
||||
static void GeomLib_ChangeUBounds(Handle(Geom_BSplineSurface)& aSurface,
|
||||
const Standard_Real newU1,
|
||||
const Standard_Real newU2)
|
||||
{
|
||||
static void GeomLib_ChangeUBounds(Handle(Geom_BSplineSurface)& aSurface,
|
||||
const Standard_Real newU1,
|
||||
const Standard_Real newU2)
|
||||
{
|
||||
TColStd_Array1OfReal knots(1, aSurface->NbUKnots());
|
||||
aSurface->UKnots(knots);
|
||||
BSplCLib::Reparametrize(newU1, newU2, knots);
|
||||
aSurface->SetUKnots(knots);
|
||||
}
|
||||
|
||||
static void GeomLib_ChangeVBounds(Handle(Geom_BSplineSurface)& aSurface,
|
||||
const Standard_Real newV1,
|
||||
const Standard_Real newV2)
|
||||
{
|
||||
TColStd_Array1OfReal knots(1, aSurface->NbVKnots());
|
||||
aSurface->VKnots(knots);
|
||||
BSplCLib::Reparametrize(newV1, newV2, knots);
|
||||
aSurface->SetVKnots(knots);
|
||||
}
|
||||
|
||||
// find 3D curve from theEdge in theMap, and return the transformed curve or NULL
|
||||
static Handle(Geom_Curve) newCurve(const TColStd_IndexedDataMapOfTransientTransient& theMap,
|
||||
const TopoDS_Edge& theEdge,
|
||||
Standard_Real& theFirst,
|
||||
Standard_Real& theLast)
|
||||
{
|
||||
Handle(Geom_Curve) aNewCurve;
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aLoc, theFirst, theLast);
|
||||
if (!aCurve.IsNull() && theMap.Contains(aCurve))
|
||||
{
|
||||
aNewCurve = Handle(Geom_Curve)::DownCast(theMap.FindFromKey(aCurve));
|
||||
aNewCurve = Handle(Geom_Curve)::DownCast(aNewCurve->Transformed(aLoc.Transformation()));
|
||||
}
|
||||
return aNewCurve;
|
||||
}
|
||||
|
||||
// find 2D curve from theEdge on theFace in theMap, and return the transformed curve or NULL
|
||||
static Handle(Geom2d_Curve) newCurve(const TColStd_IndexedDataMapOfTransientTransient& theMap,
|
||||
const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Standard_Real& theFirst,
|
||||
Standard_Real& theLast)
|
||||
{
|
||||
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, theFirst, theLast);
|
||||
return (!aC2d.IsNull() && theMap.Contains(aC2d)) ? Handle(Geom2d_Curve)::DownCast(theMap.FindFromKey(aC2d))
|
||||
: Handle(Geom2d_Curve)();
|
||||
}
|
||||
|
||||
// find surface from theFace in theMap, and return the transformed surface or NULL
|
||||
static Handle(Geom_Surface) newSurface(const TColStd_IndexedDataMapOfTransientTransient& theMap,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
Handle(Geom_Surface) aNewSurf;
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
||||
if (!aSurf.IsNull() && theMap.Contains(aSurf))
|
||||
{
|
||||
aNewSurf = Handle(Geom_Surface)::DownCast(theMap.FindFromKey(aSurf));
|
||||
aNewSurf = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(aLoc.Transformation()));
|
||||
}
|
||||
return aNewSurf;
|
||||
}
|
||||
|
||||
static Standard_Boolean newParameter(const gp_Pnt& thePoint,
|
||||
const Handle(Geom_Curve)& theCurve,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theTol,
|
||||
Standard_Real& theParam)
|
||||
{
|
||||
GeomAdaptor_Curve anAdaptor(theCurve);
|
||||
Extrema_LocateExtPC proj(thePoint, anAdaptor, theParam, theFirst, theLast, Precision::PConfusion());
|
||||
if (proj.IsDone())
|
||||
{
|
||||
Standard_Real aDist2Min = proj.SquareDistance();
|
||||
if (aDist2Min < theTol * theTol)
|
||||
{
|
||||
theParam = proj.Point().Parameter();
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
static Standard_Boolean newParameter(const gp_Pnt2d& theUV,
|
||||
const Handle(Geom2d_Curve)& theCurve2d,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theTol,
|
||||
Standard_Real& theParam)
|
||||
{
|
||||
Geom2dAdaptor_Curve anAdaptor(theCurve2d);
|
||||
Extrema_LocateExtPC2d aProj(theUV, anAdaptor, theParam, Precision::PConfusion());
|
||||
if (aProj.IsDone())
|
||||
{
|
||||
Standard_Real aDist2Min = aProj.SquareDistance();
|
||||
if (aDist2Min < theTol * theTol)
|
||||
{
|
||||
theParam = aProj.Point().Parameter();
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to use general extrema to find the parameter, because Extrema_LocateExtPC2d
|
||||
// sometimes could not find a solution if the parameter's first approach is several
|
||||
// spans away from the expected solution (test bugs/modalg_7/bug28722).
|
||||
Extrema_ExtPC2d anExt(theUV, anAdaptor, theFirst, theLast);
|
||||
if (anExt.IsDone())
|
||||
{
|
||||
Standard_Integer aMinInd = 0;
|
||||
Standard_Real aMinSqDist = Precision::Infinite();
|
||||
for (Standard_Integer anIndex = 1; anIndex <= anExt.NbExt(); ++anIndex)
|
||||
if (anExt.SquareDistance(anIndex) < aMinSqDist)
|
||||
{
|
||||
aMinSqDist = anExt.SquareDistance(anIndex);
|
||||
aMinInd = anIndex;
|
||||
}
|
||||
if (aMinSqDist < theTol * theTol)
|
||||
{
|
||||
theParam = anExt.Point(aMinInd).Parameter();
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
static Standard_Boolean newUV(const gp_Pnt& thePoint,
|
||||
const Handle(Geom_Surface)& theSurf,
|
||||
const Standard_Real theTol,
|
||||
gp_Pnt2d& theUV)
|
||||
{
|
||||
GeomAdaptor_Surface anAdaptor(theSurf);
|
||||
Extrema_GenLocateExtPS aProj(anAdaptor);
|
||||
aProj.Perform(thePoint, theUV.X(), theUV.Y());
|
||||
if (aProj.IsDone())
|
||||
{
|
||||
Standard_Real aDist2Min = aProj.SquareDistance();
|
||||
if (aDist2Min < theTol * theTol)
|
||||
{
|
||||
gp_XY& aUV = theUV.ChangeCoord();
|
||||
aProj.Point().Parameter(aUV.ChangeCoord(1), aUV.ChangeCoord(2));
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
TColStd_Array1OfReal knots(1,aSurface->NbUKnots()) ;
|
||||
aSurface->UKnots(knots) ;
|
||||
BSplCLib::Reparametrize(newU1,
|
||||
newU2,
|
||||
knots) ;
|
||||
aSurface->SetUKnots(knots) ;
|
||||
}
|
||||
static void GeomLib_ChangeVBounds(Handle(Geom_BSplineSurface)& aSurface,
|
||||
const Standard_Real newV1,
|
||||
const Standard_Real newV2)
|
||||
{
|
||||
TColStd_Array1OfReal knots(1,aSurface->NbVKnots()) ;
|
||||
aSurface->VKnots(knots) ;
|
||||
BSplCLib::Reparametrize(newV1,
|
||||
newV2,
|
||||
knots) ;
|
||||
aSurface->SetVKnots(knots) ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -238,12 +102,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
||||
RevWires = Standard_False;
|
||||
RevFace = Standard_False;
|
||||
Handle(Geom_Surface) SS = BRep_Tool::Surface(F,L);
|
||||
if (SS.IsNull())
|
||||
{
|
||||
//processing the case when there is no geometry
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(Standard_Type) TheTypeSS = SS->DynamicType();
|
||||
if ((TheTypeSS == STANDARD_TYPE(Geom_BSplineSurface)) ||
|
||||
(TheTypeSS == STANDARD_TYPE(Geom_BezierSurface))) {
|
||||
@@ -257,7 +115,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
||||
//OCC466(apo)->
|
||||
U1 = curvU1; U2 = curvU2;
|
||||
V1 = curvV1; V2 = curvV2;
|
||||
S->Bounds(surfU1,surfU2,surfV1,surfV2);
|
||||
SS->Bounds(surfU1,surfU2,surfV1,surfV2);
|
||||
|
||||
if (Abs(U1 - surfU1) <= TolPar)
|
||||
U1 = surfU1;
|
||||
@@ -334,10 +192,10 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
||||
|
||||
if (Abs(surfU1-U1) > Tol || Abs(surfU2-U2) > Tol ||
|
||||
Abs(surfV1-V1) > Tol || Abs(surfV2-V2) > Tol)
|
||||
S = new Geom_RectangularTrimmedSurface(S, U1, U2, V1, V2);
|
||||
S->Bounds(surfU1,surfU2,surfV1,surfV2);
|
||||
SS = new Geom_RectangularTrimmedSurface(S, U1, U2, V1, V2);
|
||||
SS->Bounds(surfU1,surfU2,surfV1,surfV2);
|
||||
|
||||
S = GeomConvert::SurfaceToBSplineSurface(S);
|
||||
S = GeomConvert::SurfaceToBSplineSurface(SS);
|
||||
Handle(Geom_BSplineSurface) BS = Handle(Geom_BSplineSurface)::DownCast(S) ;
|
||||
BS->Resolution(Tol, UTol, VTol) ;
|
||||
|
||||
@@ -352,9 +210,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewSurface
|
||||
GeomLib_ChangeVBounds(BS, V1, V2) ;
|
||||
}
|
||||
|
||||
if (!myMap.Contains(SS)) {
|
||||
myMap.Add(SS, S);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -379,41 +234,6 @@ static Standard_Boolean IsConvert(const TopoDS_Edge& E)
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_NurbsConvertModification::NewTriangulation(const TopoDS_Face& theFace,
|
||||
Handle(Poly_Triangulation)& theTri)
|
||||
{
|
||||
if (!BRepTools_CopyModification::NewTriangulation(theFace, theTri))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// convert UV nodes of the mesh
|
||||
if (theTri->HasUVNodes())
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
||||
Handle(Geom_Surface) aNewSurf = newSurface(myMap, theFace);
|
||||
if (!aSurf.IsNull() && !aNewSurf.IsNull())
|
||||
{
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(theFace);
|
||||
for (Standard_Integer anInd = 1; anInd <= theTri->NbNodes(); ++anInd)
|
||||
{
|
||||
gp_Pnt2d aUV = theTri->UVNode(anInd);
|
||||
gp_Pnt aPoint = aSurf->Value(aUV.X(), aUV.Y());
|
||||
if (newUV(aPoint, aNewSurf, aTol, aUV))
|
||||
theTri->SetUVNode(anInd, aUV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewCurve
|
||||
//purpose :
|
||||
@@ -492,40 +312,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve
|
||||
return Standard_True ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_NurbsConvertModification::NewPolygon(const TopoDS_Edge& theEdge,
|
||||
Handle(Poly_Polygon3D)& thePoly)
|
||||
{
|
||||
if (!BRepTools_CopyModification::NewPolygon(theEdge, thePoly))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// update parameters of polygon
|
||||
if (thePoly->HasParameters())
|
||||
{
|
||||
Standard_Real aTol = BRep_Tool::Tolerance(theEdge);
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast);
|
||||
Handle(Geom_Curve) aNewCurve = newCurve(myMap, theEdge, aFirst, aLast);
|
||||
if (!aCurve.IsNull() && !aNewCurve.IsNull()) // skip processing degenerated edges
|
||||
{
|
||||
TColStd_Array1OfReal& aParams = thePoly->ChangeParameters();
|
||||
for (Standard_Integer anInd = aParams.Lower(); anInd <= aParams.Upper(); ++anInd)
|
||||
{
|
||||
Standard_Real& aParam = aParams(anInd);
|
||||
gp_Pnt aPoint = aCurve->Value(aParam);
|
||||
newParameter(aPoint, aNewCurve, aFirst, aLast, aTol, aParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPoint
|
||||
//purpose :
|
||||
@@ -554,7 +340,7 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
Standard_Real f2d,l2d;
|
||||
Handle(Geom2d_Curve) aBaseC2d = BRep_Tool::CurveOnSurface(E,F,f2d,l2d);
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f2d,l2d);
|
||||
Standard_Real f3d,l3d;
|
||||
TopLoc_Location Loc;
|
||||
Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, Loc, f3d,l3d);
|
||||
@@ -562,7 +348,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
!C3d->IsKind(STANDARD_TYPE(Geom_BezierCurve))) ||
|
||||
IsConvert(E));
|
||||
|
||||
Handle(Geom2d_Curve) C2d = aBaseC2d;
|
||||
if(BRep_Tool::Degenerated(E)) {
|
||||
//Curve2d = C2d;
|
||||
if(!C2d->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
|
||||
@@ -571,7 +356,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
C2d = aTrimC;
|
||||
}
|
||||
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
if(!BRepTools::IsReallyClosed(E,F)) {
|
||||
@@ -597,11 +381,9 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
if(!newE.IsNull()) {
|
||||
C3d = BRep_Tool::Curve(newE, f3d, l3d);
|
||||
}
|
||||
if (C3d.IsNull()) {
|
||||
else {
|
||||
C3d = BRep_Tool::Curve(E,f3d,l3d);
|
||||
}
|
||||
if (C3d.IsNull())
|
||||
return Standard_False;
|
||||
GeomAdaptor_Curve G3dAC(C3d, f3d, l3d);
|
||||
Handle(GeomAdaptor_Curve) G3dAHC = new GeomAdaptor_Curve(G3dAC);
|
||||
|
||||
@@ -621,16 +403,13 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom_Surface) aNewS = BRep_Tool::Surface(newF);
|
||||
if (!aNewS.IsNull())
|
||||
S = aNewS;
|
||||
S = BRep_Tool::Surface(newF);
|
||||
}
|
||||
S->Bounds(Uinf, Usup, Vinf, Vsup);
|
||||
//Uinf -= 1e-9; Usup += 1e-9; Vinf -= 1e-9; Vsup += 1e-9;
|
||||
@@ -672,7 +451,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
Curve2d = ProjOnCurve.BSpline();
|
||||
@@ -682,7 +460,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -725,7 +502,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
else {
|
||||
@@ -736,7 +512,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -782,7 +557,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
@@ -808,7 +582,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
@@ -856,7 +629,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
Tol = newTol;
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
else {
|
||||
@@ -868,7 +640,6 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
myUpdatedEdges.Append(newE);
|
||||
}
|
||||
mylcu.Append(C2dBis);
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -880,58 +651,11 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewCurve2d
|
||||
return Standard_False;
|
||||
}
|
||||
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
|
||||
myMap.Add(aBaseC2d, Curve2d);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepTools_NurbsConvertModification::NewPolygonOnTriangulation(
|
||||
const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly)
|
||||
{
|
||||
if (!BRepTools_CopyModification::NewPolygonOnTriangulation(theEdge, theFace, thePoly))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// update parameters of 2D polygon
|
||||
if (thePoly->HasParameters())
|
||||
{
|
||||
Standard_Real aTol = Max(BRep_Tool::Tolerance(theEdge), thePoly->Deflection());
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
||||
Handle(Geom_Surface) aNewSurf = newSurface(myMap, theFace);
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, aFirst, aLast);
|
||||
Handle(Geom2d_Curve) aNewC2d = newCurve(myMap, theEdge, theFace, aFirst, aLast);
|
||||
if (!aSurf.IsNull() && !aC2d.IsNull() && !aNewSurf.IsNull() && !aNewC2d.IsNull())
|
||||
{
|
||||
// compute 2D tolerance
|
||||
GeomAdaptor_Surface aSurfAdapt(aSurf);
|
||||
Standard_Real aTol2D = Max(aSurfAdapt.UResolution(aTol), aSurfAdapt.VResolution(aTol));
|
||||
|
||||
for (Standard_Integer anInd = 1; anInd <= thePoly->NbNodes(); ++anInd)
|
||||
{
|
||||
Standard_Real aParam = thePoly->Parameter(anInd);
|
||||
gp_Pnt2d aUV = aC2d->Value(aParam);
|
||||
gp_Pnt aPoint = aSurf->Value(aUV.X(), aUV.Y());
|
||||
if (newUV(aPoint, aNewSurf, aTol, aUV) &&
|
||||
newParameter(aUV, aNewC2d, aFirst, aLast, aTol2D, aParam))
|
||||
{
|
||||
thePoly->SetParameter(anInd, aParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewParameter
|
||||
//purpose :
|
||||
@@ -946,12 +670,30 @@ Standard_Boolean BRepTools_NurbsConvertModification::NewParameter
|
||||
Tol = BRep_Tool::Tolerance(V);
|
||||
if(BRep_Tool::Degenerated(E))
|
||||
return Standard_False;
|
||||
Standard_Real f, l, param = BRep_Tool::Parameter(V,E);
|
||||
TopLoc_Location L;
|
||||
|
||||
Handle(Geom_Curve) gc = BRep_Tool::Curve(E, L, f, l);
|
||||
if(!myMap.Contains(gc))
|
||||
return Standard_False;
|
||||
|
||||
Handle(Geom_BSplineCurve) gcc =
|
||||
Handle(Geom_BSplineCurve)::DownCast(myMap.FindFromKey(gc));
|
||||
|
||||
gcc = Handle(Geom_BSplineCurve)::DownCast(gcc->Transformed(L.Transformation()));
|
||||
|
||||
GeomAdaptor_Curve ac(gcc);
|
||||
gp_Pnt pnt = BRep_Tool::Pnt(V);
|
||||
P = BRep_Tool::Parameter(V,E);
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aNewCurve = newCurve(myMap, E, aFirst, aLast);
|
||||
return !aNewCurve.IsNull() && newParameter(pnt, aNewCurve, aFirst, aLast, Tol, P);
|
||||
|
||||
Extrema_LocateExtPC proj(pnt, ac, param, f, l, Tol);
|
||||
if(proj.IsDone()) {
|
||||
Standard_Real Dist2Min = proj.SquareDistance();
|
||||
if (Dist2Min < Tol*Tol) {
|
||||
P = proj.Point().Parameter();
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TColStd_ListOfTransient.hxx>
|
||||
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
|
||||
#include <BRepTools_CopyModification.hxx>
|
||||
#include <BRepTools_Modification.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
class TopoDS_Face;
|
||||
@@ -36,12 +36,12 @@ class Geom2d_Curve;
|
||||
|
||||
|
||||
class BRepTools_NurbsConvertModification;
|
||||
DEFINE_STANDARD_HANDLE(BRepTools_NurbsConvertModification, BRepTools_CopyModification)
|
||||
DEFINE_STANDARD_HANDLE(BRepTools_NurbsConvertModification, BRepTools_Modification)
|
||||
|
||||
//! Defines a modification of the geometry by a Trsf
|
||||
//! from gp. All methods return True and transform the
|
||||
//! geometry.
|
||||
class BRepTools_NurbsConvertModification : public BRepTools_CopyModification
|
||||
class BRepTools_NurbsConvertModification : public BRepTools_Modification
|
||||
{
|
||||
|
||||
public:
|
||||
@@ -100,27 +100,11 @@ public:
|
||||
//! (resp. <F2>).
|
||||
Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the face has been modified according to changed triangulation.
|
||||
//! If the face has been modified:
|
||||
//! - theTri is a new triangulation on the face
|
||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& theFace, Handle(Poly_Triangulation)& theTri) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon
|
||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& theEdge, Handle(Poly_Polygon3D)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
||||
//! If the edge has been modified:
|
||||
//! - thePoly is a new polygon on triangulation
|
||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
Handle(Poly_PolygonOnTriangulation)& thePoly) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const TopTools_ListOfShape& GetUpdatedEdges() const;
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_CopyModification)
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepTools_NurbsConvertModification,BRepTools_Modification)
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomLib.hxx>
|
||||
#include <GeomLib_Tool.hxx>
|
||||
#include <gp_GTrsf2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
@@ -44,8 +43,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepTools_TrsfModification,BRepTools_Modification)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BRepTools_TrsfModification::BRepTools_TrsfModification(const gp_Trsf& T) :
|
||||
myTrsf(T),
|
||||
myCopyMesh(Standard_False)
|
||||
myTrsf(T)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -60,16 +58,6 @@ gp_Trsf& BRepTools_TrsfModification::Trsf ()
|
||||
return myTrsf;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsCopyMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean& BRepTools_TrsfModification::IsCopyMesh()
|
||||
{
|
||||
return myCopyMesh;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewSurface
|
||||
//purpose :
|
||||
@@ -84,12 +72,6 @@ Standard_Boolean BRepTools_TrsfModification::NewSurface
|
||||
Standard_Boolean& RevFace)
|
||||
{
|
||||
S = BRep_Tool::Surface(F,L);
|
||||
if (S.IsNull())
|
||||
{
|
||||
//processing cases when there is no geometry
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Tol = BRep_Tool::Tolerance(F);
|
||||
Tol *= Abs(myTrsf.ScaleFactor());
|
||||
RevWires = Standard_False;
|
||||
@@ -105,194 +87,6 @@ Standard_Boolean BRepTools_TrsfModification::NewSurface
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_TrsfModification::NewTriangulation
|
||||
(const TopoDS_Face& theFace,
|
||||
Handle(Poly_Triangulation)& theTriangulation)
|
||||
{
|
||||
if (!myCopyMesh)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
theTriangulation = BRep_Tool::Triangulation(theFace, aLoc);
|
||||
|
||||
if (theTriangulation.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_Trsf aTrsf = myTrsf;
|
||||
if (!aLoc.IsIdentity())
|
||||
{
|
||||
aTrsf = aLoc.Transformation().Inverted() * aTrsf * aLoc.Transformation();
|
||||
}
|
||||
|
||||
theTriangulation = theTriangulation->Copy();
|
||||
theTriangulation->SetCachedMinMax(Bnd_Box()); // clear bounding box
|
||||
theTriangulation->Deflection(theTriangulation->Deflection() * Abs(myTrsf.ScaleFactor()));
|
||||
// apply transformation to 3D nodes
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
|
||||
{
|
||||
gp_Pnt aP = theTriangulation->Node(anInd);
|
||||
aP.Transform(aTrsf);
|
||||
theTriangulation->SetNode(anInd, aP);
|
||||
}
|
||||
// modify 2D nodes
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace, aLoc);
|
||||
if (theTriangulation->HasUVNodes() && !aSurf.IsNull())
|
||||
{
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
|
||||
{
|
||||
gp_Pnt2d aP2d = theTriangulation->UVNode(anInd);
|
||||
aSurf->TransformParameters(aP2d.ChangeCoord().ChangeCoord(1),
|
||||
aP2d.ChangeCoord().ChangeCoord(2),
|
||||
myTrsf);
|
||||
theTriangulation->SetUVNode(anInd, aP2d);
|
||||
}
|
||||
}
|
||||
// modify triangles orientation in case of mirror transformation
|
||||
if (myTrsf.ScaleFactor() < 0.0)
|
||||
{
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
||||
{
|
||||
Poly_Triangle aTria = theTriangulation->Triangle(anInd);
|
||||
Standard_Integer aN1, aN2, aN3;
|
||||
aTria.Get(aN1, aN2, aN3);
|
||||
aTria.Set(aN1, aN3, aN2);
|
||||
theTriangulation->SetTriangle(anInd, aTria);
|
||||
}
|
||||
}
|
||||
// modify normals
|
||||
if (theTriangulation->HasNormals())
|
||||
{
|
||||
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
|
||||
{
|
||||
gp_Dir aNormal = theTriangulation->Normal(anInd);
|
||||
aNormal.Transform(aTrsf);
|
||||
theTriangulation->SetNormal(anInd, aNormal);
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_TrsfModification::NewPolygon
|
||||
(const TopoDS_Edge& theE,
|
||||
Handle(Poly_Polygon3D)& theP)
|
||||
{
|
||||
if (!myCopyMesh)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
theP = BRep_Tool::Polygon3D(theE, aLoc);
|
||||
if (theP.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
gp_Trsf aTrsf = myTrsf;
|
||||
if (!aLoc.IsIdentity())
|
||||
{
|
||||
aTrsf = aLoc.Transformation().Inverted() * aTrsf * aLoc.Transformation();
|
||||
}
|
||||
|
||||
theP = theP->Copy();
|
||||
theP->Deflection(theP->Deflection() * Abs(myTrsf.ScaleFactor()));
|
||||
TColgp_Array1OfPnt& aNodesArray = theP->ChangeNodes();
|
||||
for (Standard_Integer anId = aNodesArray.Lower(); anId <= aNodesArray.Upper(); ++anId)
|
||||
{
|
||||
//Applying the transformation to each node of polygon
|
||||
aNodesArray.ChangeValue(anId).Transform(aTrsf);
|
||||
}
|
||||
// transform the parametrization
|
||||
if (theP->HasParameters())
|
||||
{
|
||||
TopLoc_Location aCurveLoc;
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theE, aCurveLoc, aFirst, aLast);
|
||||
if (!aCurve.IsNull())
|
||||
{
|
||||
Standard_Real aReparametrization = aCurve->ParametricTransformation(aTrsf);
|
||||
if (Abs(aReparametrization - 1.0) > Precision::PConfusion())
|
||||
{
|
||||
TColStd_Array1OfReal& aParams = theP->ChangeParameters();
|
||||
for (Standard_Integer anInd = aParams.Lower(); anInd <= aParams.Upper(); ++anInd)
|
||||
{
|
||||
aParams(anInd) *= aReparametrization;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewPolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepTools_TrsfModification::NewPolygonOnTriangulation
|
||||
(const TopoDS_Edge& theE,
|
||||
const TopoDS_Face& theF,
|
||||
Handle(Poly_PolygonOnTriangulation)& theP)
|
||||
{
|
||||
if (!myCopyMesh)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
TopLoc_Location aLoc;
|
||||
Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(theF, aLoc);
|
||||
if (aT.IsNull())
|
||||
{
|
||||
theP = Handle(Poly_PolygonOnTriangulation) ();
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
theP = BRep_Tool::PolygonOnTriangulation(theE, aT, aLoc);
|
||||
if (theP.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
theP = theP->Copy();
|
||||
theP->Deflection(theP->Deflection() * Abs(myTrsf.ScaleFactor()));
|
||||
|
||||
// transform the parametrization
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theF, aLoc);
|
||||
Standard_Real aFirst, aLast;
|
||||
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(theE, theF, aFirst, aLast);
|
||||
if (!aSurf.IsNull() && !aC2d.IsNull() && Abs(Abs(myTrsf.ScaleFactor()) - 1.0) > TopLoc_Location::ScalePrec())
|
||||
{
|
||||
gp_GTrsf2d aGTrsf = aSurf->ParametricTransformation(myTrsf);
|
||||
if (aGTrsf.Form() != gp_Identity)
|
||||
{
|
||||
Handle(Geom2d_Curve) aNewC2d = GeomLib::GTransform(aC2d, aGTrsf);
|
||||
for (Standard_Integer anInd = 1; anInd <= theP->NbNodes(); ++anInd)
|
||||
{
|
||||
Standard_Real aParam = theP->Parameter(anInd);
|
||||
gp_Pnt2d aP2d = aC2d->Value(aParam);
|
||||
aGTrsf.Transforms(aP2d.ChangeCoord());
|
||||
GeomLib_Tool::Parameter(aNewC2d, aP2d, theP->Deflection(), aParam);
|
||||
theP->SetParameter(anInd, aParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewCurve
|
||||
@@ -307,10 +101,6 @@ Standard_Boolean BRepTools_TrsfModification::NewCurve
|
||||
{
|
||||
Standard_Real f,l;
|
||||
C = BRep_Tool::Curve(E,L,f,l);
|
||||
if (C.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Tol = BRep_Tool::Tolerance(E);
|
||||
Tol *= Abs(myTrsf.ScaleFactor());
|
||||
@@ -363,12 +153,6 @@ Standard_Boolean BRepTools_TrsfModification::NewCurve2d
|
||||
Standard_Real scale = myTrsf.ScaleFactor();
|
||||
Tol *= Abs(scale);
|
||||
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,loc);
|
||||
|
||||
if (S.IsNull())
|
||||
{
|
||||
// processing the case when the surface (geometry) is deleted
|
||||
return Standard_False;
|
||||
}
|
||||
GeomAdaptor_Surface GAsurf(S);
|
||||
if (GAsurf.GetType() == GeomAbs_Plane)
|
||||
return Standard_False;
|
||||
|
@@ -50,9 +50,6 @@ public:
|
||||
//! Provides access to the gp_Trsf associated with this
|
||||
//! modification. The transformation can be changed.
|
||||
Standard_EXPORT gp_Trsf& Trsf();
|
||||
|
||||
//! Sets a flag to indicate the need to copy mesh.
|
||||
Standard_EXPORT Standard_Boolean& IsCopyMesh();
|
||||
|
||||
//! Returns true if the face F has been modified.
|
||||
//! If the face has been modified:
|
||||
@@ -67,21 +64,6 @@ public:
|
||||
//! associated with this modification is negative.
|
||||
Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the face has been modified according to changed triangulation.
|
||||
//! If the face has been modified:
|
||||
//! - T is a new triangulation on the face
|
||||
Standard_EXPORT Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon.
|
||||
//! If the edge has been modified:
|
||||
//! - P is a new polygon
|
||||
Standard_EXPORT Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge has been modified according to changed polygon on triangulation.
|
||||
//! If the edge has been modified:
|
||||
//! - P is a new polygon on triangulation
|
||||
Standard_EXPORT Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& E, const TopoDS_Face& F, Handle(Poly_PolygonOnTriangulation)& P) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the edge E has been modified.
|
||||
//! If the edge has been modified:
|
||||
//! - C is the new geometric support of the edge,
|
||||
@@ -138,7 +120,6 @@ private:
|
||||
|
||||
|
||||
gp_Trsf myTrsf;
|
||||
Standard_Boolean myCopyMesh;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -1,7 +1,5 @@
|
||||
BRepTools.cxx
|
||||
BRepTools.hxx
|
||||
BRepTools_CopyModification.cxx
|
||||
BRepTools_CopyModification.hxx
|
||||
BRepTools_DataMapIteratorOfMapOfVertexPnt2d.hxx
|
||||
BRepTools_Debug.cxx
|
||||
BRepTools_GTrsfModification.cxx
|
||||
|
@@ -51,7 +51,7 @@ Standard_Boolean BinMDF_TagSourceDriver::Paste
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TDF_TagSource) aTag = Handle(TDF_TagSource)::DownCast(theTarget);
|
||||
Standard_Integer aValue;
|
||||
const Standard_Integer aValue = -1;
|
||||
Standard_Boolean ok = theSource >> aValue;
|
||||
if (ok)
|
||||
aTag->Set(aValue);
|
||||
|
@@ -73,7 +73,7 @@ Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
|
||||
}
|
||||
if(aSize) {
|
||||
Handle(TColStd_HPackedMapOfInteger) aHMap = new TColStd_HPackedMapOfInteger ();
|
||||
Standard_Integer aKey;
|
||||
const Standard_Integer aKey = -1;
|
||||
for(Standard_Integer i = 0; i< aSize; i++) {
|
||||
Standard_Boolean ok = Source >> aKey;
|
||||
if (!ok) {
|
||||
|
@@ -54,7 +54,7 @@ Standard_Boolean BinMDataStd_IntegerDriver::Paste
|
||||
BinObjMgt_RRelocationTable& theRT) const
|
||||
{
|
||||
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
|
||||
Standard_Integer aValue;
|
||||
const Standard_Integer aValue = -1;
|
||||
Standard_Boolean ok = theSource >> aValue;
|
||||
if (ok)
|
||||
anAtt->Set(aValue);
|
||||
|
@@ -54,7 +54,7 @@ Standard_Boolean BinMDataStd_RealDriver::Paste
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
|
||||
Standard_Real aValue;
|
||||
Standard_Real aValue = -1.0;
|
||||
Standard_Boolean ok = theSource >> aValue;
|
||||
if (ok)
|
||||
anAtt->Set(aValue);
|
||||
|
@@ -54,7 +54,7 @@ Standard_Boolean BinMDataXtd_GeometryDriver::Paste
|
||||
Handle(TDataXtd_Geometry) aT =
|
||||
Handle(TDataXtd_Geometry)::DownCast (theTarget);
|
||||
|
||||
Standard_Integer aType;
|
||||
const Standard_Integer aType = -1;
|
||||
Standard_Boolean ok = theSource >> aType;
|
||||
if (ok)
|
||||
aT->SetType ((TDataXtd_GeometryEnum) aType);
|
||||
|
@@ -55,7 +55,7 @@ Standard_Boolean BinMDataXtd_PositionDriver::Paste
|
||||
BinObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
|
||||
Standard_Real aValue;
|
||||
Standard_Real aValue = 0.0;
|
||||
Standard_Boolean ok = theSource >> aValue;
|
||||
if (!ok) return ok;
|
||||
gp_Pnt aPosition(0., 0., 0.);
|
||||
|
@@ -56,7 +56,7 @@ Standard_Boolean BinMDataXtd_PresentationDriver::Paste
|
||||
Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theTarget);
|
||||
|
||||
// Display status
|
||||
Standard_Integer aValue;
|
||||
const Standard_Integer aValue = -1;
|
||||
ok = theSource >> aValue;
|
||||
if (!ok) return ok;
|
||||
anAttribute->SetDisplayed (aValue != 0);
|
||||
@@ -92,7 +92,7 @@ Standard_Boolean BinMDataXtd_PresentationDriver::Paste
|
||||
anAttribute->UnsetMaterial();
|
||||
|
||||
// Transparency
|
||||
Standard_Real aRValue;
|
||||
Standard_Real aRValue = -1.0;
|
||||
ok = theSource >> aRValue;
|
||||
if ( !ok ) return ok;
|
||||
if ( aRValue != -1. )
|
||||
|
@@ -62,7 +62,7 @@ Standard_Boolean BinMFunction_FunctionDriver::Paste
|
||||
Standard_Boolean ok = theSource >> aGUID;
|
||||
if (ok) {
|
||||
anAtt->SetDriverGUID(aGUID);
|
||||
Standard_Integer aValue;
|
||||
const Standard_Integer aValue = -1;
|
||||
ok = theSource >> aValue;
|
||||
if(ok)
|
||||
anAtt->SetFailure(aValue);
|
||||
|
@@ -117,8 +117,9 @@ static int TranslateFrom (const BinObjMgt_Persistent& theSource,
|
||||
TopoDS_Shape& theResult,
|
||||
BinTools_ShapeSet* theShapeSet)
|
||||
{
|
||||
Standard_Integer aShapeID, aLocID;
|
||||
Standard_Character aCharOrient;
|
||||
const Standard_Integer aShapeID = -1;
|
||||
const Standard_Integer aLocID = -1;
|
||||
const Standard_Character aCharOrient = '0';
|
||||
Standard_Boolean Ok = theSource >> aShapeID; //TShapeID;
|
||||
if(!Ok) return 1;
|
||||
// Read TShape and Orientation
|
||||
@@ -176,11 +177,11 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste
|
||||
theSource >> aNbShapes;
|
||||
TDF_Label aLabel = theTarget->Label ();
|
||||
TNaming_Builder aBuilder (aLabel);
|
||||
Standard_Integer aVer;
|
||||
const Standard_Integer aVer = -1;
|
||||
Standard_Boolean ok = theSource >> aVer;
|
||||
if(!ok) return Standard_False;
|
||||
aTAtt->SetVersion(aVer); //Version
|
||||
Standard_Character aCharEvol;
|
||||
const Standard_Character aCharEvol = '0';
|
||||
ok = theSource >> aCharEvol;
|
||||
if(!ok) return Standard_False;
|
||||
TNaming_Evolution anEvol = EvolutionToEnum (aCharEvol); //Evolution
|
||||
|
@@ -152,7 +152,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
|
||||
TNaming_Name& aName = anAtt->ChangeName();
|
||||
TCollection_ExtendedString aMsg;
|
||||
//1. NameType
|
||||
Standard_Character aValue;
|
||||
const Standard_Character aValue = '0';
|
||||
Standard_Boolean ok = theSource >> aValue;
|
||||
Standard_Boolean aNewF = Standard_False;
|
||||
if (ok) {
|
||||
@@ -171,7 +171,7 @@ Standard_Boolean BinMNaming_NamingDriver::Paste
|
||||
|
||||
//3. Args
|
||||
Standard_Integer aNbArgs=0;
|
||||
Standard_Integer anIndx;
|
||||
const Standard_Integer anIndx = -1;
|
||||
Handle(TNaming_NamedShape) aNS;
|
||||
ok = theSource >> aNbArgs;
|
||||
if (ok) {
|
||||
|
@@ -48,7 +48,9 @@ Standard_Boolean BinMXCAFDoc_CentroidDriver::Paste(const BinObjMgt_Persistent& t
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Centroid) anAtt = Handle(XCAFDoc_Centroid)::DownCast(theTarget);
|
||||
Standard_Real x, y, z;
|
||||
Standard_Real x = 0.0;
|
||||
Standard_Real y = 0.0;
|
||||
Standard_Real z = 0.0;
|
||||
Standard_Boolean isOk = theSource >> x >> y >> z;
|
||||
if(isOk) {
|
||||
gp_Pnt aPnt(x, y, z);
|
||||
|
@@ -48,8 +48,10 @@ Standard_Boolean BinMXCAFDoc_ColorDriver::Paste(const BinObjMgt_Persistent& theS
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Color) anAtt = Handle(XCAFDoc_Color)::DownCast(theTarget);
|
||||
Standard_Real R, G, B;
|
||||
Standard_ShortReal alpha;
|
||||
Standard_Real R = 0.0;
|
||||
Standard_Real G = 0.0;
|
||||
Standard_Real B = 0.0;
|
||||
Standard_ShortReal alpha = 1.0;
|
||||
Standard_Boolean isOk = theSource >> R >> G >> B;
|
||||
if(isOk) {
|
||||
Standard_Boolean isRGBA = theSource >> alpha;
|
||||
|
@@ -54,7 +54,6 @@ static Standard_Byte faceCullToChar (Graphic3d_TypeOfBackfacingModel theMode)
|
||||
{
|
||||
case Graphic3d_TypeOfBackfacingModel_Auto: return '0';
|
||||
case Graphic3d_TypeOfBackfacingModel_BackCulled: return 'B';
|
||||
case Graphic3d_TypeOfBackfacingModel_FrontCulled: return 'F';
|
||||
case Graphic3d_TypeOfBackfacingModel_DoubleSided: return '1';
|
||||
}
|
||||
return '0';
|
||||
@@ -67,7 +66,6 @@ static Graphic3d_TypeOfBackfacingModel faceCullFromChar (Standard_Byte theMode)
|
||||
{
|
||||
case '0': return Graphic3d_TypeOfBackfacingModel_Auto;
|
||||
case 'B': return Graphic3d_TypeOfBackfacingModel_BackCulled;
|
||||
case 'F': return Graphic3d_TypeOfBackfacingModel_FrontCulled;
|
||||
case '1': return Graphic3d_TypeOfBackfacingModel_DoubleSided;
|
||||
}
|
||||
return Graphic3d_TypeOfBackfacingModel_Auto;
|
||||
|
@@ -198,7 +198,7 @@ public:
|
||||
Standard_Real LowerValue()
|
||||
{
|
||||
Standard_Integer a, aResultIndex = 0;
|
||||
Standard_Real aValue;
|
||||
Standard_Real aValue = 0.0;
|
||||
for(a = myV.Length(); a > 0; a--)
|
||||
{
|
||||
if (aResultIndex == 0 || Abs(aValue) > Abs(myV.Value(a)))
|
||||
|
@@ -3915,7 +3915,7 @@ void ChFi3d_Builder::IntersectMoreCorner(const Standard_Integer Index)
|
||||
}
|
||||
TopoDS_Face FFv;
|
||||
Standard_Real tol;
|
||||
Standard_Integer prol;
|
||||
Standard_Integer prol = 0;
|
||||
BRep_Builder BRE;
|
||||
Handle(Geom_Surface ) Sface;
|
||||
Sface=BRep_Tool::Surface(Fv);
|
||||
|
@@ -1780,7 +1780,7 @@ void ChFi3d_ChBuilder::ExtentTwoCorner(const TopoDS_Vertex& V,
|
||||
Standard_Integer Sens = 0;
|
||||
ChFiDS_ListIteratorOfListOfStripe itel(LS);
|
||||
Standard_Boolean FF = Standard_True;
|
||||
Standard_Boolean isfirst[2];
|
||||
Standard_Boolean isfirst[2] = { Standard_True, Standard_True };
|
||||
Standard_Integer Iedge[2];
|
||||
Iedge[0] = 1;
|
||||
Iedge[1] = 1;
|
||||
|
@@ -371,7 +371,7 @@ bool D3DHost_View::d3dSwap()
|
||||
}
|
||||
|
||||
const HRESULT isOK = myD3dDevice->Present (NULL, NULL, NULL, NULL);
|
||||
if (isOK != D3D_OK && isOK != S_PRESENT_OCCLUDED)
|
||||
if (isOK != D3D_OK)
|
||||
{
|
||||
myWorkspace->GetGlContext()->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
|
||||
TCollection_AsciiString("Direct3D9, Present device failed, ") + d3dFormatError (isOK));
|
||||
|
@@ -27,14 +27,7 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(DE_Wrapper, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
||||
{
|
||||
static const TCollection_AsciiString aScope ("global");
|
||||
return aScope;
|
||||
}
|
||||
}
|
||||
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "global";
|
||||
|
||||
//=======================================================================
|
||||
// function : DE_Wrapper
|
||||
@@ -260,7 +253,7 @@ Standard_Boolean DE_Wrapper::Load(const TCollection_AsciiString& theResource,
|
||||
Standard_Boolean DE_Wrapper::Load(const Handle(DE_ConfigurationContext)& theResource,
|
||||
const Standard_Boolean theIsRecursive)
|
||||
{
|
||||
GlobalParameters.LengthUnit = theResource->RealVal("general.length.unit", GlobalParameters.LengthUnit, THE_CONFIGURATION_SCOPE());
|
||||
GlobalParameters.LengthUnit = theResource->RealVal("general.length.unit", GlobalParameters.LengthUnit, THE_CONFIGURATION_SCOPE);
|
||||
if (theIsRecursive)
|
||||
{
|
||||
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
||||
@@ -333,7 +326,7 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
|
||||
aFormatIter.More(); aFormatIter.Next())
|
||||
{
|
||||
const TCollection_AsciiString& aFormat = aFormatIter.Key();
|
||||
aResult += THE_CONFIGURATION_SCOPE() + '.' + "priority" + '.' + aFormat + " :\t ";
|
||||
aResult += THE_CONFIGURATION_SCOPE + '.' + "priority" + '.' + aFormat + " :\t ";
|
||||
for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
|
||||
aVendorIter.More(); aVendorIter.Next())
|
||||
{
|
||||
@@ -344,7 +337,7 @@ TCollection_AsciiString DE_Wrapper::Save(const Standard_Boolean theIsRecursive,
|
||||
}
|
||||
aResult += "!Global parameters. Used for all providers\n";
|
||||
aResult += "!Length scale unit value. Should be more the 0. Default value: 1.0(MM)\n";
|
||||
aResult += THE_CONFIGURATION_SCOPE() + ".general.length.unit :\t " + GlobalParameters.LengthUnit + "\n";
|
||||
aResult += THE_CONFIGURATION_SCOPE + ".general.length.unit :\t " + GlobalParameters.LengthUnit + "\n";
|
||||
if (theIsRecursive)
|
||||
{
|
||||
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
||||
@@ -532,7 +525,7 @@ Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath
|
||||
//=======================================================================
|
||||
void DE_Wrapper::sort(const Handle(DE_ConfigurationContext)& theResource)
|
||||
{
|
||||
const TCollection_AsciiString aScope(THE_CONFIGURATION_SCOPE() + '.' + "priority");
|
||||
const TCollection_AsciiString aScope(THE_CONFIGURATION_SCOPE + '.' + "priority");
|
||||
NCollection_List<Handle(DE_ConfigurationNode)> aVendors;
|
||||
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
|
||||
aFormatIter.More(); aFormatIter.Next())
|
||||
|
@@ -19,14 +19,7 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(DEBRepCascade_ConfigurationNode, DE_ConfigurationNode)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
||||
{
|
||||
static const TCollection_AsciiString aScope = "provider";
|
||||
return aScope;
|
||||
}
|
||||
}
|
||||
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||
|
||||
//=======================================================================
|
||||
// function : DEBRepCascade_ConfigurationNode
|
||||
@@ -55,7 +48,7 @@ DEBRepCascade_ConfigurationNode::DEBRepCascade_ConfigurationNode(const Handle(DE
|
||||
//=======================================================================
|
||||
bool DEBRepCascade_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||
{
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||
|
||||
InternalParameters.WriteBinary =
|
||||
theResource->BooleanVal("write.binary", InternalParameters.WriteBinary, aScope);
|
||||
@@ -79,7 +72,7 @@ TCollection_AsciiString DEBRepCascade_ConfigurationNode::Save() const
|
||||
TCollection_AsciiString aResult;
|
||||
aResult += "!*****************************************************************************\n";
|
||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Write parameters:\n";
|
||||
|
@@ -19,14 +19,7 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(DEXCAFCascade_ConfigurationNode, DE_ConfigurationNode)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
||||
{
|
||||
static const TCollection_AsciiString aScope = "provider";
|
||||
return aScope;
|
||||
}
|
||||
}
|
||||
static const TCollection_AsciiString THE_CONFIGURATION_SCOPE = "provider";
|
||||
|
||||
//=======================================================================
|
||||
// function : DEXCAFCascade_ConfigurationNode
|
||||
@@ -55,7 +48,7 @@ DEXCAFCascade_ConfigurationNode::DEXCAFCascade_ConfigurationNode(const Handle(DE
|
||||
//=======================================================================
|
||||
bool DEXCAFCascade_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
|
||||
{
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor();
|
||||
|
||||
InternalParameters.ReadAppendMode = (PCDM_ReaderFilter::AppendMode)
|
||||
theResource->IntegerVal("read.append.mode", InternalParameters.ReadAppendMode, aScope);
|
||||
@@ -74,7 +67,7 @@ TCollection_AsciiString DEXCAFCascade_ConfigurationNode::Save() const
|
||||
TCollection_AsciiString aResult;
|
||||
aResult += "!*****************************************************************************\n";
|
||||
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
|
||||
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE + "." + GetFormat() + "." + GetVendor() + ".";
|
||||
|
||||
aResult += "!\n";
|
||||
aResult += "!Read parameters:\n";
|
||||
|
@@ -7,10 +7,6 @@ TKOpenGlesTest
|
||||
TKViewerTest
|
||||
TKDraw
|
||||
TKMeshVS
|
||||
TKXDECascade
|
||||
TKTObj
|
||||
TKBinTObj
|
||||
TKXmlTObj
|
||||
TKXDESTEP
|
||||
TKSTEP
|
||||
TKSTEPAttr
|
||||
@@ -22,7 +18,6 @@ TKXSBase
|
||||
TKVRML
|
||||
TKSTL
|
||||
TKRWMesh
|
||||
TKXDE
|
||||
TKBinXCAF
|
||||
TKXmlXCAF
|
||||
TKBin
|
||||
|
@@ -60,7 +60,6 @@ Font_TextFormatter::Font_TextFormatter()
|
||||
myAlignY (Graphic3d_VTA_TOP),
|
||||
myTabSize (8),
|
||||
myWrappingWidth (0.0f),
|
||||
myIsWordWrapping (true),
|
||||
myLastSymbolWidth (0.0f),
|
||||
myMaxSymbolWidth (0.0f),
|
||||
//
|
||||
@@ -250,7 +249,6 @@ void Font_TextFormatter::Format()
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Utf32Char aCharPrev = 0;
|
||||
for (Font_TextFormatter::Iterator aFormatterIt(*this);
|
||||
aFormatterIt.More(); aFormatterIt.Next())
|
||||
{
|
||||
@@ -271,30 +269,12 @@ void Font_TextFormatter::Format()
|
||||
Font_Rect aBndBox;
|
||||
GlyphBoundingBox (aRectIter, aBndBox);
|
||||
const Standard_ShortReal aNextXPos = aBndBox.Right - BottomLeft (aFirstCornerId).x();
|
||||
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
|
||||
if (aNextXPos > aMaxLineWidth) // 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,12 +220,6 @@ 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
|
||||
{
|
||||
@@ -280,14 +274,6 @@ 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
|
||||
@@ -302,7 +288,6 @@ 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
|
||||
|
||||
|
@@ -20,14 +20,3 @@ GeomConvert_CompCurveToBSplineCurve.cxx
|
||||
GeomConvert_CompCurveToBSplineCurve.hxx
|
||||
GeomConvert_Units.cxx
|
||||
GeomConvert_Units.hxx
|
||||
GeomConvert_CurveToAnaCurve.cxx
|
||||
GeomConvert_CurveToAnaCurve.hxx
|
||||
GeomConvert_SurfToAnaSurf.cxx
|
||||
GeomConvert_SurfToAnaSurf.hxx
|
||||
GeomConvert_ConvType.hxx
|
||||
GeomConvert_FuncSphereLSDist.cxx
|
||||
GeomConvert_FuncSphereLSDist.hxx
|
||||
GeomConvert_FuncCylinderLSDist.cxx
|
||||
GeomConvert_FuncCylinderLSDist.hxx
|
||||
GeomConvert_FuncConeLSDist.cxx
|
||||
GeomConvert_FuncConeLSDist.hxx
|
||||
|
@@ -1,23 +0,0 @@
|
||||
// Copyright (c) 2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _GeomConvert_ConvType_HeaderFile
|
||||
#define _GeomConvert_ConvType_HeaderFile
|
||||
enum GeomConvert_ConvType
|
||||
{
|
||||
GeomConvert_Target,
|
||||
GeomConvert_Simplest,
|
||||
GeomConvert_MinGap
|
||||
};
|
||||
|
||||
#endif // _GeomConvert_ConvType_HeaderFile
|
@@ -1,768 +0,0 @@
|
||||
// Created: 2001-05-21
|
||||
//
|
||||
// Copyright (c) 2001-2013 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of commercial software by OPEN CASCADE SAS,
|
||||
// furnished in accordance with the terms and conditions of the contract
|
||||
// and with the inclusion of this copyright notice.
|
||||
// This file or any part thereof may not be provided or otherwise
|
||||
// made available to any third party.
|
||||
//
|
||||
// No ownership title to the software is transferred hereby.
|
||||
//
|
||||
// OPEN CASCADE SAS makes no representation or warranties with respect to the
|
||||
// performance of this software, and specifically disclaims any responsibility
|
||||
// for any damages, special or consequential, connected with its use.
|
||||
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <gce_MakeCirc.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Ellipse.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <GeomConvert_CurveToAnaCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_Gauss.hxx>
|
||||
|
||||
|
||||
GeomConvert_CurveToAnaCurve::GeomConvert_CurveToAnaCurve():
|
||||
myGap(Precision::Infinite()),
|
||||
myConvType(GeomConvert_MinGap),
|
||||
myTarget(GeomAbs_Line)
|
||||
{
|
||||
}
|
||||
|
||||
GeomConvert_CurveToAnaCurve::GeomConvert_CurveToAnaCurve(const Handle(Geom_Curve)& C) :
|
||||
myGap(Precision::Infinite()),
|
||||
myConvType(GeomConvert_MinGap),
|
||||
myTarget(GeomAbs_Line)
|
||||
{
|
||||
myCurve = C;
|
||||
}
|
||||
|
||||
void GeomConvert_CurveToAnaCurve::Init(const Handle(Geom_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myGap = Precision::Infinite();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConvertToAnalytical
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean GeomConvert_CurveToAnaCurve::ConvertToAnalytical(const Standard_Real tol,
|
||||
Handle(Geom_Curve)& theResultCurve,
|
||||
const Standard_Real F, const Standard_Real L,
|
||||
Standard_Real& NewF, Standard_Real& NewL)
|
||||
{
|
||||
if(myCurve.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(Geom_Curve) aCurve = myCurve;
|
||||
while (aCurve->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) aTrimmed = Handle(Geom_TrimmedCurve)::
|
||||
DownCast(aCurve);
|
||||
aCurve = aTrimmed->BasisCurve();
|
||||
}
|
||||
|
||||
Handle(Geom_Curve) C = ComputeCurve(aCurve,tol,F, L, NewF, NewL, myGap, myConvType, myTarget);
|
||||
|
||||
if(C.IsNull()) return Standard_False;
|
||||
theResultCurve = C;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsLinear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean GeomConvert_CurveToAnaCurve::IsLinear(const TColgp_Array1OfPnt& aPoles,
|
||||
const Standard_Real tolerance,
|
||||
Standard_Real& Deviation)
|
||||
{
|
||||
Standard_Integer nbPoles = aPoles.Length();
|
||||
if(nbPoles < 2)
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real dMax = 0;
|
||||
Standard_Integer iMax1=0,iMax2=0;
|
||||
|
||||
Standard_Integer i;
|
||||
for(i = 1; i < nbPoles; i++)
|
||||
for(Standard_Integer j = i+1; j <= nbPoles; j++) {
|
||||
Standard_Real dist = aPoles(i).SquareDistance(aPoles(j));
|
||||
if(dist > dMax) {
|
||||
dMax = dist;
|
||||
iMax1 = i;
|
||||
iMax2 = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (dMax < Precision::SquareConfusion())
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real tol2 = tolerance*tolerance;
|
||||
gp_Vec avec (aPoles(iMax1),aPoles(iMax2)); gp_Dir adir (avec); gp_Lin alin (aPoles(iMax1),adir);
|
||||
|
||||
Standard_Real aMax = 0.;
|
||||
for(i = 1; i <= nbPoles; i++) {
|
||||
Standard_Real dist = alin.SquareDistance(aPoles(i));
|
||||
if(dist > tol2)
|
||||
return Standard_False;
|
||||
if(dist > aMax)
|
||||
aMax = dist;
|
||||
}
|
||||
Deviation = sqrt(aMax);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
gp_Lin GeomConvert_CurveToAnaCurve::GetLine(const gp_Pnt& P1, const gp_Pnt& P2,
|
||||
Standard_Real& cf, Standard_Real& cl)
|
||||
{
|
||||
gp_Vec avec(P1, P2); gp_Dir adir(avec); gp_Lin alin(P1, adir);
|
||||
cf = ElCLib::Parameter(alin, P1);
|
||||
cl = ElCLib::Parameter(alin, P2);
|
||||
return alin;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ComputeLine
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_Line) GeomConvert_CurveToAnaCurve::ComputeLine (const Handle(Geom_Curve)& curve,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Real c1, const Standard_Real c2,
|
||||
Standard_Real& cf, Standard_Real& cl,
|
||||
Standard_Real& Deviation)
|
||||
{
|
||||
Handle(Geom_Line) line;
|
||||
if (curve.IsNull()) return line;
|
||||
line = Handle(Geom_Line)::DownCast(curve); // qui sait
|
||||
if (!line.IsNull()) {
|
||||
cf = c1;
|
||||
cl = c2;
|
||||
Deviation = 0.;
|
||||
return line;
|
||||
}
|
||||
|
||||
gp_Pnt P1 = curve->Value (c1);
|
||||
gp_Pnt P2 = curve->Value (c2);
|
||||
if(P1.SquareDistance(P2) < Precision::SquareConfusion())
|
||||
return line;
|
||||
cf = c1; cl = c2;
|
||||
|
||||
Handle(TColgp_HArray1OfPnt) Poles;
|
||||
Standard_Integer nbPoles;
|
||||
Handle(Geom_BSplineCurve) bsc = Handle(Geom_BSplineCurve)::DownCast(curve);
|
||||
if (!bsc.IsNull()) {
|
||||
nbPoles = bsc->NbPoles();
|
||||
Poles = new TColgp_HArray1OfPnt(1, nbPoles);
|
||||
bsc->Poles(Poles->ChangeArray1());
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(Geom_BezierCurve) bzc = Handle(Geom_BezierCurve)::DownCast(curve);
|
||||
if (!bzc.IsNull()) {
|
||||
nbPoles = bzc->NbPoles();
|
||||
Poles = new TColgp_HArray1OfPnt(1, nbPoles);
|
||||
bzc->Poles(Poles->ChangeArray1());
|
||||
}
|
||||
else
|
||||
{
|
||||
nbPoles = 23;
|
||||
Poles = new TColgp_HArray1OfPnt(1, nbPoles);
|
||||
Standard_Real dt = (c2 - c1) / (nbPoles - 1);
|
||||
Poles->SetValue(1, P1);
|
||||
Poles->SetValue(nbPoles, P2);
|
||||
Standard_Integer i;
|
||||
for (i = 2; i < nbPoles; ++i)
|
||||
{
|
||||
Poles->SetValue(i, curve->Value(c1 + (i - 1) * dt));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!IsLinear(Poles->Array1(),tolerance,Deviation)) return line; // non
|
||||
gp_Lin alin = GetLine (P1, P2, cf, cl);
|
||||
line = new Geom_Line (alin);
|
||||
return line;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean GeomConvert_CurveToAnaCurve::GetCircle (gp_Circ& crc,
|
||||
const gp_Pnt& P0,const gp_Pnt& P1, const gp_Pnt& P2)
|
||||
{
|
||||
// Control if points are not aligned (should be done by MakeCirc
|
||||
Standard_Real aMaxCoord = Sqrt(Precision::Infinite());
|
||||
if (Abs(P0.X()) > aMaxCoord || Abs(P0.Y()) > aMaxCoord || Abs(P0.Z()) > aMaxCoord)
|
||||
return Standard_False;
|
||||
if (Abs(P1.X()) > aMaxCoord || Abs(P1.Y()) > aMaxCoord || Abs(P1.Z()) > aMaxCoord)
|
||||
return Standard_False;
|
||||
if (Abs(P2.X()) > aMaxCoord || Abs(P2.Y()) > aMaxCoord || Abs(P2.Z()) > aMaxCoord)
|
||||
return Standard_False;
|
||||
|
||||
// Building the circle
|
||||
gce_MakeCirc mkc (P0,P1,P2);
|
||||
if (!mkc.IsDone()) return Standard_False;
|
||||
crc = mkc.Value();
|
||||
if (crc.Radius() < gp::Resolution()) return Standard_False;
|
||||
// Recalage sur P0
|
||||
gp_Pnt PC = crc.Location();
|
||||
gp_Ax2 axe = crc.Position();
|
||||
gp_Vec VX (PC,P0);
|
||||
axe.SetXDirection (VX);
|
||||
crc.SetPosition (axe);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCircle (const Handle(Geom_Curve)& c3d,
|
||||
const Standard_Real tol,
|
||||
const Standard_Real c1, const Standard_Real c2,
|
||||
Standard_Real& cf, Standard_Real& cl,
|
||||
Standard_Real& Deviation)
|
||||
{
|
||||
if (c3d->IsKind (STANDARD_TYPE(Geom_Circle))) {
|
||||
cf = c1;
|
||||
cl = c2;
|
||||
Deviation = 0.;
|
||||
Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(c3d);
|
||||
return aCirc;
|
||||
}
|
||||
|
||||
Handle(Geom_Circle) circ;
|
||||
gp_Pnt P0,P1,P2;
|
||||
Standard_Real ca = (c1+c1+c2) / 3; Standard_Real cb = (c1+c2+c2) / 3;
|
||||
P0 = c3d->Value(c1);
|
||||
P1 = c3d->Value(ca);
|
||||
P2 = c3d->Value(cb);
|
||||
|
||||
gp_Circ crc;
|
||||
if (!GetCircle (crc,P0,P1,P2)) return circ;
|
||||
|
||||
// Reste a controler que c est bien un cercle : prendre 20 points
|
||||
Standard_Real du = (c2-c1)/20;
|
||||
Standard_Integer i;
|
||||
Standard_Real aMax = 0.;
|
||||
for (i = 0; i <= 20; i ++) {
|
||||
Standard_Real u = c1+(du*i);
|
||||
gp_Pnt PP = c3d->Value(u);
|
||||
Standard_Real dist = crc.Distance(PP);
|
||||
if (dist > tol) return circ; // not done
|
||||
if (dist > aMax)
|
||||
aMax = dist;
|
||||
}
|
||||
Deviation = aMax;
|
||||
|
||||
// defining the parameters
|
||||
Standard_Real PI2 = 2 * M_PI;
|
||||
|
||||
cf = ElCLib::Parameter (crc,c3d->Value (c1));
|
||||
cf = ElCLib::InPeriod(cf, 0., PI2);
|
||||
|
||||
//first parameter should be closed to zero
|
||||
|
||||
if(Abs(cf) < Precision::PConfusion() || Abs(PI2-cf) < Precision::PConfusion())
|
||||
cf = 0.;
|
||||
|
||||
Standard_Real cm = ElCLib::Parameter (crc,c3d->Value ((c1+c2)/2.));
|
||||
cm = ElCLib::InPeriod(cm, cf, cf + PI2);
|
||||
|
||||
cl = ElCLib::Parameter (crc,c3d->Value (c2));
|
||||
cl = ElCLib::InPeriod(cl, cm, cm + PI2);
|
||||
|
||||
circ = new Geom_Circle (crc);
|
||||
return circ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Compute Ellipse
|
||||
//=======================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : IsArrayPntPlanar
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean IsArrayPntPlanar(const Handle(TColgp_HArray1OfPnt)& HAP,
|
||||
gp_Dir& Norm, const Standard_Real prec)
|
||||
{
|
||||
Standard_Integer size = HAP->Length();
|
||||
if(size<3)
|
||||
return Standard_False;
|
||||
gp_Pnt P1 = HAP->Value(1);
|
||||
gp_Pnt P2 = HAP->Value(2);
|
||||
gp_Pnt P3 = HAP->Value(3);
|
||||
Standard_Real dist1 = P1.Distance(P2);
|
||||
Standard_Real dist2 = P1.Distance(P3);
|
||||
if( dist1<prec || dist2<prec )
|
||||
return Standard_False;
|
||||
gp_Vec V1(P1,P2);
|
||||
gp_Vec V2(P1,P3);
|
||||
if(V1.IsParallel(V2,prec))
|
||||
return Standard_False;
|
||||
gp_Vec NV = V1.Crossed(V2);
|
||||
|
||||
Standard_Integer i;
|
||||
for (i = 1; i <= 3; ++i)
|
||||
{
|
||||
if (Precision::IsInfinite(NV.Coord(i)))
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if(NV.Magnitude() < gp::Resolution())
|
||||
return Standard_False;
|
||||
|
||||
if(size>3) {
|
||||
for(i=4; i<=size; i++) {
|
||||
gp_Pnt PN = HAP->Value(i);
|
||||
dist1 = P1.Distance(PN);
|
||||
if (dist1 < prec || Precision::IsInfinite(dist1))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
gp_Vec VN(P1,PN);
|
||||
if(!NV.IsNormal(VN,prec))
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
Norm = NV;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ConicdDefinition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean ConicDefinition
|
||||
( const Standard_Real a, const Standard_Real b1, const Standard_Real c,
|
||||
const Standard_Real d1, const Standard_Real e1, const Standard_Real f,
|
||||
const Standard_Boolean IsParab, const Standard_Boolean IsEllip,
|
||||
gp_Pnt& Center, gp_Dir& MainAxis, Standard_Real& Rmin, Standard_Real& Rmax )
|
||||
{
|
||||
Standard_Real Xcen = 0.,Ycen = 0., Xax = 0.,Yax = 0.;
|
||||
Standard_Real b,d,e;
|
||||
// conic : a*x2 + 2*b*x*y + c*y2 + 2*d*x + 2*e*y + f = 0.
|
||||
//Equation (a,b,c,d,e,f);
|
||||
b = b1/2.; d = d1/2.; e = e1/2.; // chgt de variable
|
||||
|
||||
Standard_Real eps = 1.E-08; // ?? comme ComputedForm
|
||||
|
||||
if (IsParab) {
|
||||
|
||||
}
|
||||
else {
|
||||
// -> Conique a centre, cas general
|
||||
// On utilise les Determinants des matrices :
|
||||
// | a b d |
|
||||
// gdet (3x3) = | b c e | et pdet (2X2) = | a b |
|
||||
// | d e f | | b c |
|
||||
|
||||
Standard_Real gdet = a*c*f + 2*b*d*e - c*d*d - a*e*e - b*b*f;
|
||||
Standard_Real pdet = a*c - b*b;
|
||||
|
||||
Xcen = (b*e - c*d) / pdet;
|
||||
Ycen = (b*d - a*e) / pdet;
|
||||
|
||||
Standard_Real term1 = a-c;
|
||||
Standard_Real term2 = 2*b;
|
||||
Standard_Real cos2t;
|
||||
Standard_Real auxil;
|
||||
|
||||
if (Abs(term2) <= eps && Abs(term1) <= eps) {
|
||||
cos2t = 1.;
|
||||
auxil = 0.;
|
||||
}
|
||||
else {
|
||||
if (Abs(term1) < eps)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
Standard_Real t2d = term2/term1; //skl 21.11.2001
|
||||
cos2t = 1./sqrt(1+t2d*t2d);
|
||||
auxil = sqrt (term1*term1 + term2*term2);
|
||||
}
|
||||
|
||||
Standard_Real cost = sqrt ( (1+cos2t)/2. );
|
||||
Standard_Real sint = sqrt ( (1-cos2t)/2. );
|
||||
|
||||
Standard_Real aprim = (a+c+auxil)/2.;
|
||||
Standard_Real cprim = (a+c-auxil)/2.;
|
||||
|
||||
if (Abs(aprim) < gp::Resolution() || Abs(cprim) < gp::Resolution())
|
||||
return Standard_False;
|
||||
|
||||
term1 = -gdet/(aprim*pdet);
|
||||
term2 = -gdet/(cprim*pdet);
|
||||
|
||||
if (IsEllip) {
|
||||
Xax = cost;
|
||||
Yax = sint;
|
||||
Rmin = sqrt ( term1);
|
||||
Rmax = sqrt ( term2);
|
||||
if(Rmax<Rmin){
|
||||
Rmax = sqrt ( term1);
|
||||
Rmin = sqrt ( term2);
|
||||
}
|
||||
}
|
||||
else if (term1 <= eps){
|
||||
Xax = -sint;
|
||||
Yax = cost;
|
||||
Rmin = sqrt (-term1);
|
||||
Rmax = sqrt (term2);
|
||||
}
|
||||
else {
|
||||
Xax = cost;
|
||||
Yax = sint;
|
||||
Rmin = sqrt (-term2);
|
||||
Rmax = sqrt (term1);
|
||||
}
|
||||
}
|
||||
Center.SetCoord (Xcen,Ycen,0.);
|
||||
MainAxis.SetCoord (Xax,Yax,0.);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeEllipse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeEllipse(const Handle(Geom_Curve)& c3d,
|
||||
const Standard_Real tol,
|
||||
const Standard_Real c1, const Standard_Real c2,
|
||||
Standard_Real& cf, Standard_Real& cl,
|
||||
Standard_Real& Deviation)
|
||||
{
|
||||
if (c3d->IsKind (STANDARD_TYPE(Geom_Ellipse))) {
|
||||
cf = c1;
|
||||
cl = c2;
|
||||
Deviation = 0.;
|
||||
Handle(Geom_Ellipse) anElips = Handle(Geom_Ellipse)::DownCast(c3d);
|
||||
return anElips;
|
||||
}
|
||||
|
||||
Handle(Geom_Curve) res;
|
||||
Standard_Real prec = Precision::PConfusion();
|
||||
|
||||
Standard_Real AF,BF,CF,DF,EF,Q1,Q2,Q3,c2n;
|
||||
Standard_Integer i;
|
||||
|
||||
gp_Pnt PStart = c3d->Value(c1);
|
||||
gp_Pnt PEnd = c3d->Value(c2);
|
||||
|
||||
const Standard_Boolean IsClos = PStart.Distance(PEnd) < prec;
|
||||
if (IsClos)
|
||||
{
|
||||
c2n=c2-(c2-c1)/5;
|
||||
}
|
||||
else
|
||||
c2n=c2;
|
||||
//
|
||||
gp_XYZ aBC;
|
||||
Handle(TColgp_HArray1OfPnt) AP = new TColgp_HArray1OfPnt(1,5);
|
||||
AP->SetValue(1,PStart);
|
||||
aBC += PStart.XYZ();
|
||||
Standard_Real dc=(c2n-c1)/4;
|
||||
for (i = 1; i < 5; i++)
|
||||
{
|
||||
gp_Pnt aP = c3d->Value(c1 + dc*i);
|
||||
AP->SetValue(i + 1, aP);
|
||||
aBC += aP.XYZ();
|
||||
}
|
||||
aBC /= 5;
|
||||
aBC *= -1;
|
||||
gp_Vec aTrans(aBC);
|
||||
for (i = 1; i <= 5; ++i)
|
||||
{
|
||||
AP->ChangeValue(i).Translate(aTrans);
|
||||
}
|
||||
gp_Dir ndir;
|
||||
if(!IsArrayPntPlanar(AP,ndir,prec))
|
||||
return res;
|
||||
|
||||
if (Abs(ndir.X()) < gp::Resolution() && Abs(ndir.Y()) < gp::Resolution()
|
||||
&& Abs(ndir.Z()) < gp::Resolution())
|
||||
return res;
|
||||
|
||||
gp_Ax3 AX(gp_Pnt(0,0,0),ndir);
|
||||
gp_Trsf Tr;
|
||||
Tr.SetTransformation(AX);
|
||||
gp_Trsf Tr2 = Tr.Inverted();
|
||||
|
||||
math_Matrix Dt(1, 5, 1, 5);
|
||||
math_Vector F(1, 5), Sl(1, 5);
|
||||
|
||||
Standard_Real XN,YN,ZN = 0.;
|
||||
gp_Pnt PT,PP;
|
||||
for(i=1; i<=5; i++) {
|
||||
PT = AP->Value(i).Transformed(Tr);
|
||||
PT.Coord(XN,YN,ZN);
|
||||
Dt(i, 1) = XN*XN;
|
||||
Dt(i, 2) = XN*YN;
|
||||
Dt(i, 3) = YN*YN;
|
||||
Dt(i, 4) = XN;
|
||||
Dt(i, 5) = YN;
|
||||
F(i) = -1.;
|
||||
}
|
||||
|
||||
math_Gauss aSolver(Dt);
|
||||
if (!aSolver.IsDone())
|
||||
return res;
|
||||
|
||||
aSolver.Solve(F, Sl);
|
||||
|
||||
AF=Sl(1);
|
||||
BF=Sl(2);
|
||||
CF=Sl(3);
|
||||
DF=Sl(4);
|
||||
EF=Sl(5);
|
||||
|
||||
Q1=AF*CF+BF*EF*DF/4-CF*DF*DF/4-BF*BF/4-AF*EF*EF/4;
|
||||
Q2=AF*CF-BF*BF/4;
|
||||
Q3=AF+CF;
|
||||
|
||||
Standard_Real Rmax, Rmin;
|
||||
gp_Pnt Center;
|
||||
gp_Dir MainAxis;
|
||||
Standard_Boolean IsParab = Standard_False, IsEllip = Standard_False;
|
||||
|
||||
if (Q2 > 0 && Q1*Q3 < 0) {
|
||||
// ellipse
|
||||
IsEllip = Standard_True;
|
||||
if (ConicDefinition(AF, BF, CF, DF, EF, 1., IsParab, IsEllip,
|
||||
Center, MainAxis, Rmin, Rmax)) {
|
||||
// create ellipse
|
||||
if (Rmax - Rmin < Precision::Confusion())
|
||||
{
|
||||
return res; //really it is circle, which must be recognized in other method
|
||||
}
|
||||
aTrans *= -1;
|
||||
Center.SetZ(ZN);
|
||||
gp_Pnt NewCenter = Center.Transformed(Tr2);
|
||||
gp_Pnt Ptmp(Center.X() + MainAxis.X() * 10,
|
||||
Center.Y() + MainAxis.Y() * 10,
|
||||
Center.Z() + MainAxis.Z() * 10);
|
||||
gp_Pnt NewPtmp = Ptmp.Transformed(Tr2);
|
||||
gp_Dir NewMainAxis(NewPtmp.X() - NewCenter.X(),
|
||||
NewPtmp.Y() - NewCenter.Y(),
|
||||
NewPtmp.Z() - NewCenter.Z());
|
||||
gp_Ax2 ax2(NewCenter, ndir, NewMainAxis);
|
||||
|
||||
gp_Elips anEllipse(ax2, Rmax, Rmin);
|
||||
anEllipse.Translate(aTrans);
|
||||
Handle(Geom_Ellipse) gell = new Geom_Ellipse(anEllipse);
|
||||
|
||||
// test for 20 points
|
||||
Standard_Real param2 = 0;
|
||||
dc = (c2 - c1) / 20;
|
||||
for (i = 1; i <= 20; i++) {
|
||||
PP = c3d->Value(c1 + i*dc);
|
||||
Standard_Real aPar = ElCLib::Parameter(anEllipse, PP);
|
||||
Standard_Real dist = gell->Value(aPar).Distance(PP);
|
||||
if (dist > tol) return res; // not done
|
||||
if (dist > param2)
|
||||
param2 = dist;
|
||||
}
|
||||
|
||||
|
||||
Deviation = param2;
|
||||
|
||||
Standard_Real PI2 = 2 * M_PI;
|
||||
cf = ElCLib::Parameter(anEllipse, c3d->Value(c1));
|
||||
cf = ElCLib::InPeriod(cf, 0., PI2);
|
||||
|
||||
//first parameter should be closed to zero
|
||||
|
||||
if (Abs(cf) < Precision::PConfusion() || Abs(PI2 - cf) < Precision::PConfusion())
|
||||
cf = 0.;
|
||||
|
||||
Standard_Real cm = ElCLib::Parameter(anEllipse, c3d->Value((c1 + c2) / 2.));
|
||||
cm = ElCLib::InPeriod(cm, cf, cf + PI2);
|
||||
|
||||
cl = ElCLib::Parameter(anEllipse, c3d->Value(c2));
|
||||
cl = ElCLib::InPeriod(cl, cm, cm + PI2);
|
||||
|
||||
res = gell;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (Q2 < 0 && Q1 != 0) {
|
||||
// hyberbola
|
||||
}
|
||||
|
||||
if (Q2 == 0 && Q1 != 0) {
|
||||
// parabola
|
||||
}
|
||||
*/
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom_Curve) GeomConvert_CurveToAnaCurve::ComputeCurve(const Handle(Geom_Curve)& theC3d,
|
||||
const Standard_Real tolerance,
|
||||
const Standard_Real c1, const Standard_Real c2,
|
||||
Standard_Real& cf, Standard_Real& cl,
|
||||
Standard_Real& theGap,
|
||||
const GeomConvert_ConvType theConvType, const GeomAbs_CurveType theTarget)
|
||||
{
|
||||
cf = c1; cl = c2;
|
||||
Handle(Geom_Curve) c3d, newc3d[3];
|
||||
Standard_Integer i, imin = -1;
|
||||
c3d = theC3d;
|
||||
if (c3d.IsNull()) return newc3d[imin];
|
||||
gp_Pnt P1 = c3d->Value(c1);
|
||||
gp_Pnt P2 = c3d->Value(c2);
|
||||
gp_Pnt P3 = c3d->Value(c1 + (c2 - c1) / 2);
|
||||
Standard_Real d[3] = { RealLast(), RealLast(), RealLast() };
|
||||
Standard_Real fp[3], lp[3];
|
||||
|
||||
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle(Geom_TrimmedCurve) aTc = Handle(Geom_TrimmedCurve)::DownCast(c3d);
|
||||
c3d = aTc->BasisCurve();
|
||||
}
|
||||
|
||||
if (theConvType == GeomConvert_Target)
|
||||
{
|
||||
theGap = RealLast();
|
||||
if (theTarget == GeomAbs_Line)
|
||||
{
|
||||
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], theGap);
|
||||
cf = fp[0];
|
||||
cl = lp[0];
|
||||
return newc3d[0];
|
||||
}
|
||||
if (theTarget == GeomAbs_Circle)
|
||||
{
|
||||
newc3d[1] = ComputeCircle(c3d, tolerance, c1, c2, fp[1], lp[1], theGap);
|
||||
cf = fp[1];
|
||||
cl = lp[1];
|
||||
return newc3d[1];
|
||||
}
|
||||
if (theTarget == GeomAbs_Ellipse)
|
||||
{
|
||||
newc3d[2] = ComputeEllipse(c3d, tolerance, c1, c2, fp[2], lp[2], theGap);
|
||||
cf = fp[2];
|
||||
cl = lp[2];
|
||||
return newc3d[2];
|
||||
}
|
||||
}
|
||||
//
|
||||
if (theConvType == GeomConvert_Simplest)
|
||||
{
|
||||
theGap = RealLast();
|
||||
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], theGap);
|
||||
if (!newc3d[0].IsNull())
|
||||
{
|
||||
cf = fp[0];
|
||||
cl = lp[0];
|
||||
return newc3d[0];
|
||||
}
|
||||
theGap = RealLast();
|
||||
newc3d[1] = ComputeCircle(c3d, tolerance, c1, c2, fp[1], lp[1], theGap);
|
||||
if (!newc3d[1].IsNull())
|
||||
{
|
||||
cf = fp[1];
|
||||
cl = lp[1];
|
||||
return newc3d[1];
|
||||
}
|
||||
theGap = RealLast();
|
||||
newc3d[2] = ComputeEllipse(c3d, tolerance, c1, c2, fp[2], lp[2], theGap);
|
||||
if (!newc3d[2].IsNull())
|
||||
{
|
||||
cf = fp[2];
|
||||
cl = lp[2];
|
||||
return newc3d[2];
|
||||
}
|
||||
// Conversion failed, returns null curve
|
||||
return newc3d[0];
|
||||
}
|
||||
|
||||
// theConvType == GeomConvert_MinGap
|
||||
// recognition in case of small curve
|
||||
imin = -1;
|
||||
if((P1.Distance(P2) < 2*tolerance) && (P1.Distance(P3) < 2*tolerance)) {
|
||||
newc3d[1] = ComputeCircle(c3d, tolerance, c1, c2, fp[1], lp[1], d[1]);
|
||||
newc3d[0] = ComputeLine(c3d, tolerance, c1, c2, fp[0], lp[0], d[0]);
|
||||
imin = 1;
|
||||
if (newc3d[1].IsNull() || d[0] < d[1])
|
||||
{
|
||||
imin = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
d[0] = RealLast();
|
||||
newc3d[0] = ComputeLine (c3d,tolerance,c1,c2,fp[0],lp[0],d[0]);
|
||||
Standard_Real tol = Min(tolerance, d[0]);
|
||||
if (!Precision::IsInfinite(c1) && !Precision::IsInfinite(c2))
|
||||
{
|
||||
d[1] = RealLast();
|
||||
newc3d[1] = ComputeCircle(c3d, tol, c1, c2, fp[1], lp[1], d[1]);
|
||||
tol = Min(tol, d[1]);
|
||||
d[2] = RealLast();
|
||||
newc3d[2] = ComputeEllipse(c3d, tol, c1, c2, fp[2], lp[2], d[2]);
|
||||
}
|
||||
Standard_Real dd = RealLast();
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
if (newc3d[i].IsNull()) continue;
|
||||
if (d[i] < dd)
|
||||
{
|
||||
dd = d[i];
|
||||
imin = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imin >= 0)
|
||||
{
|
||||
cf = fp[imin];
|
||||
cl = lp[imin];
|
||||
theGap = d[imin];
|
||||
return newc3d[imin];
|
||||
}
|
||||
else
|
||||
{
|
||||
cf = c1;
|
||||
cl = c2;
|
||||
theGap = -1.;
|
||||
return newc3d[0]; // must be null curve;
|
||||
}
|
||||
}
|
@@ -1,133 +0,0 @@
|
||||
// Created: 2001-05-21
|
||||
//
|
||||
// Copyright (c) 2001-2013 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of commercial software by OPEN CASCADE SAS,
|
||||
// furnished in accordance with the terms and conditions of the contract
|
||||
// and with the inclusion of this copyright notice.
|
||||
// This file or any part thereof may not be provided or otherwise
|
||||
// made available to any third party.
|
||||
//
|
||||
// No ownership title to the software is transferred hereby.
|
||||
//
|
||||
// OPEN CASCADE SAS makes no representation or warranties with respect to the
|
||||
// performance of this software, and specifically disclaims any responsibility
|
||||
// for any damages, special or consequential, connected with its use.
|
||||
|
||||
#ifndef _GeomConvert_CurveToAnaCurve_HeaderFile
|
||||
#define _GeomConvert_CurveToAnaCurve_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <GeomConvert_ConvType.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
|
||||
class Geom_Curve;
|
||||
class Geom_Line;
|
||||
class gp_Lin;
|
||||
class gp_Pnt;
|
||||
class gp_Circ;
|
||||
|
||||
|
||||
|
||||
class GeomConvert_CurveToAnaCurve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT GeomConvert_CurveToAnaCurve();
|
||||
|
||||
Standard_EXPORT GeomConvert_CurveToAnaCurve(const Handle(Geom_Curve)& C);
|
||||
|
||||
Standard_EXPORT void Init (const Handle(Geom_Curve)& C);
|
||||
|
||||
//! Converts me to analytical if possible with given
|
||||
//! tolerance. The new first and last parameters are
|
||||
//! returned to newF, newL
|
||||
Standard_EXPORT Standard_Boolean ConvertToAnalytical (const Standard_Real theTol, Handle(Geom_Curve)& theResultCurve, const Standard_Real F, const Standard_Real L, Standard_Real& newF, Standard_Real& newL);
|
||||
|
||||
Standard_EXPORT static Handle(Geom_Curve) ComputeCurve (const Handle(Geom_Curve)& curve, const Standard_Real tolerance,
|
||||
const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl,
|
||||
Standard_Real& theGap, const GeomConvert_ConvType theCurvType = GeomConvert_MinGap, const GeomAbs_CurveType theTarget = GeomAbs_Line);
|
||||
|
||||
//! Tries to convert the given curve to circle with given
|
||||
//! tolerance. Returns NULL curve if conversion is
|
||||
//! not possible.
|
||||
Standard_EXPORT static Handle(Geom_Curve) ComputeCircle (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
|
||||
|
||||
//! Tries to convert the given curve to ellipse with given
|
||||
//! tolerance. Returns NULL curve if conversion is
|
||||
//! not possible.
|
||||
Standard_EXPORT static Handle(Geom_Curve) ComputeEllipse (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
|
||||
|
||||
//! Tries to convert the given curve to line with given
|
||||
//! tolerance. Returns NULL curve if conversion is
|
||||
//! not possible.
|
||||
Standard_EXPORT static Handle(Geom_Line) ComputeLine (const Handle(Geom_Curve)& curve, const Standard_Real tolerance, const Standard_Real c1, const Standard_Real c2, Standard_Real& cf, Standard_Real& cl, Standard_Real& Deviation);
|
||||
|
||||
//! Returns true if the set of points is linear with given
|
||||
//! tolerance
|
||||
Standard_EXPORT static Standard_Boolean IsLinear (const TColgp_Array1OfPnt& aPoints, const Standard_Real tolerance, Standard_Real& Deviation);
|
||||
|
||||
//! Creates line on two points.
|
||||
//! Resulting parameters returned
|
||||
Standard_EXPORT static gp_Lin GetLine(const gp_Pnt& P1, const gp_Pnt& P2, Standard_Real& cf, Standard_Real& cl);
|
||||
|
||||
//! Creates circle on points. Returns true if OK.
|
||||
Standard_EXPORT static Standard_Boolean GetCircle(gp_Circ& Circ, const gp_Pnt& P0, const gp_Pnt& P1, const gp_Pnt& P2);
|
||||
|
||||
//! Returns maximal deviation of converted surface from the original
|
||||
//! one computed by last call to ConvertToAnalytical
|
||||
Standard_Real Gap() const
|
||||
{
|
||||
return myGap;
|
||||
}
|
||||
|
||||
//! Returns conversion type
|
||||
GeomConvert_ConvType GetConvType() const
|
||||
{
|
||||
return myConvType;
|
||||
}
|
||||
|
||||
//! Sets type of convertion
|
||||
void SetConvType(const GeomConvert_ConvType theConvType)
|
||||
{
|
||||
myConvType = theConvType;
|
||||
}
|
||||
|
||||
//! Returns target curve type
|
||||
GeomAbs_CurveType GetTarget() const
|
||||
{
|
||||
return myTarget;
|
||||
}
|
||||
|
||||
//! Sets target curve type
|
||||
void SetTarget(const GeomAbs_CurveType theTarget)
|
||||
{
|
||||
myTarget = theTarget;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Handle(Geom_Curve) myCurve;
|
||||
Standard_Real myGap;
|
||||
GeomConvert_ConvType myConvType;
|
||||
GeomAbs_CurveType myTarget;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // _GeomConvert_CurveToAnaCurve_HeaderFile
|
@@ -1,68 +0,0 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <GeomConvert_FuncConeLSDist.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomConvert_FuncConeLSDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomConvert_FuncConeLSDist::GeomConvert_FuncConeLSDist(
|
||||
const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir):
|
||||
myPoints(thePoints), myDir(theDir)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GeomConvert_FuncConeLSDist::NbVariables () const
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomConvert_FuncConeLSDist::Value(const math_Vector& X, Standard_Real& F)
|
||||
{
|
||||
gp_Pnt aLoc(X(1), X(2), X(3));
|
||||
Standard_Real aSemiAngle = X(4), anR = X(5);
|
||||
gp_Ax3 aPos(aLoc, myDir);
|
||||
|
||||
F = 0.;
|
||||
Standard_Integer i;
|
||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
||||
{
|
||||
Standard_Real u, v;
|
||||
gp_Pnt aPi(myPoints->Value(i));
|
||||
ElSLib::ConeParameters(aPos, anR, aSemiAngle, aPi, u, v);
|
||||
gp_Pnt aPp;
|
||||
ElSLib::ConeD0(u, v, aPos, anR, aSemiAngle, aPp);
|
||||
F += aPi.SquareDistance(aPp);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
@@ -1,66 +0,0 @@
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _GeomConvert_FuncConeLSDist_HeaderFile
|
||||
#define _GeomConvert_FuncConeLSDist_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <math_MultipleVarFunction.hxx>
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
//! Function for search of Cone canonic parameters: coordinates of center local coordinate system,
|
||||
//! direction of axis, radius and semi-angle from set of points
|
||||
//! by least square method.
|
||||
//!
|
||||
//!
|
||||
class GeomConvert_FuncConeLSDist : public math_MultipleVarFunction
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT GeomConvert_FuncConeLSDist() {};
|
||||
|
||||
Standard_EXPORT GeomConvert_FuncConeLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir);
|
||||
|
||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
||||
{
|
||||
myPoints = thePoints;
|
||||
}
|
||||
|
||||
void SetDir(const gp_Dir& theDir)
|
||||
{
|
||||
myDir = theDir;
|
||||
}
|
||||
|
||||
//! Number of variables.
|
||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
||||
|
||||
//! Value.
|
||||
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Handle(TColgp_HArray1OfXYZ) myPoints;
|
||||
gp_Dir myDir;
|
||||
|
||||
};
|
||||
#endif // _GeomConvert_FuncConeLSDist_HeaderFile
|
@@ -1,140 +0,0 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <GeomConvert_FuncCylinderLSDist.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomConvert_FuncCylinderLSDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomConvert_FuncCylinderLSDist::GeomConvert_FuncCylinderLSDist(
|
||||
const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir):
|
||||
myPoints(thePoints), myDir(theDir)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GeomConvert_FuncCylinderLSDist::NbVariables () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Value(const math_Vector& X,Standard_Real& F)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR2 = X(4)*X(4);
|
||||
|
||||
F = 0.;
|
||||
Standard_Integer i;
|
||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
||||
{
|
||||
gp_Vec aV(myPoints->Value(i) - aLoc);
|
||||
Standard_Real aD2 = aV.CrossSquareMagnitude(myDir);
|
||||
Standard_Real d = aD2 - anR2;
|
||||
F += d * d;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Gradient
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
||||
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
||||
Standard_Real x = myDir.X(), y = myDir.Y(), z = myDir.Z();
|
||||
G.Init(0.);
|
||||
|
||||
Standard_Integer i;
|
||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
||||
{
|
||||
gp_Vec aV(myPoints->Value(i) - aLoc);
|
||||
Standard_Real aD2 = aV.CrossSquareMagnitude(myDir);
|
||||
Standard_Real d = aD2 - anR2;
|
||||
Standard_Real Dx0 = 2.*(aV.Z()*x - aV.X()*z)*z
|
||||
-2.*(aV.X()*y - aV.Y()*x)*y;
|
||||
Standard_Real Dy0 = -2.*(aV.Y()*z - aV.Z()*y)*z
|
||||
+2.*(aV.X()*y - aV.Y()*x)*x;
|
||||
Standard_Real Dz0 = 2.*(aV.Y()*z - aV.Z()*y)*y
|
||||
-2.*(aV.Z()*x - aV.X()*z)*x;
|
||||
|
||||
G(1) += d * Dx0;
|
||||
G(2) += d * Dy0;
|
||||
G(3) += d * Dz0;
|
||||
//
|
||||
G(4) += d;
|
||||
}
|
||||
|
||||
G *= 2;
|
||||
G(6) *= -2.*anR;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomConvert_FuncCylinderLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
||||
Standard_Real x = myDir.X(), y = myDir.Y(), z = myDir.Z();
|
||||
|
||||
F = 0.;
|
||||
G.Init(0.);
|
||||
Standard_Integer i;
|
||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
||||
{
|
||||
gp_Vec aV(myPoints->Value(i) - aLoc);
|
||||
Standard_Real aD2 = aV.CrossSquareMagnitude(myDir);
|
||||
Standard_Real d = aD2 - anR2;
|
||||
Standard_Real Dx0 = 2.*(aV.Z()*x - aV.X()*z)*z
|
||||
- 2.*(aV.X()*y - aV.Y()*x)*y;
|
||||
Standard_Real Dy0 = -2.*(aV.Y()*z - aV.Z()*y)*z
|
||||
+ 2.*(aV.X()*y - aV.Y()*x)*x;
|
||||
Standard_Real Dz0 = 2.*(aV.Y()*z - aV.Z()*y)*y
|
||||
- 2.*(aV.Z()*x - aV.X()*z)*x;
|
||||
|
||||
G(1) += d * Dx0;
|
||||
G(2) += d * Dy0;
|
||||
G(3) += d * Dz0;
|
||||
//
|
||||
G(4) += d;
|
||||
//
|
||||
F += d * d;
|
||||
}
|
||||
|
||||
G *= 2;
|
||||
G(4) *= -2.*anR;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,100 +0,0 @@
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _GeomConvert_FuncCylinderLSDist_HeaderFile
|
||||
#define _GeomConvert_FuncCylinderLSDist_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <math_MultipleVarFunctionWithGradient.hxx>
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
//! Function for search of cylinder canonic parameters: coordinates of center local coordinate system,
|
||||
//! direction of axis and radius from set of points
|
||||
//! by least square method.
|
||||
//!
|
||||
//! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
|
||||
//! for use in math_BFGS algorithm.
|
||||
//!
|
||||
//! Parametrisation:
|
||||
//! Cylinder is defined by its axis and radius. Axis is defined by 3 cartesian coordinats it location x0, y0, z0
|
||||
//! and direction, which is constant and set by user:
|
||||
//! dir.x, dir.y, dir.z
|
||||
//! The criteria is:
|
||||
//! F(x0, y0, z0, theta, phi, R) = Sum[|(P(i) - Loc)^dir|^2 - R^2]^2 => min
|
||||
//! P(i) is i-th sample point, Loc, dir - axis location and direction, R - radius
|
||||
//!
|
||||
//! The square vector product |(P(i) - Loc)^dir|^2 is:
|
||||
//!
|
||||
//! [(y - y0)*dir.z - (z - z0)*dir.y]^2 +
|
||||
//! [(z - z0)*dir.x - (x - x0)*dir.z]^2 +
|
||||
//! [(x - x0)*dir.y - (y - y0)*dir.x]^2
|
||||
//!
|
||||
//! First derivative of square vector product are:
|
||||
//! Dx0 = 2*[(z - z0)*dir.x - (x - x0)*dir.z]*dir.z
|
||||
//! -2*[(x - x0)*dir.y - (y - y0)*dir.x]*dir.y
|
||||
//! Dy0 = -2*[(y - y0)*dir.z - (z - z0)*dir.y]*dir.z
|
||||
//! +2*[(x - x0)*dir.y - (y - y0)*dir.x]*dir.x
|
||||
//! Dz0 = 2*[(y - y0)*dir.z - (z - z0)*dir.y]*dir.y
|
||||
//! -2*[(z - z0)*dir.x - (x - x0)*dir.z]*dir.x
|
||||
//!
|
||||
//! dF/dx0 : G1(...) = 2*Sum{[...]*Dx0}
|
||||
//! dF/dy0 : G2(...) = 2*Sum{[...]*Dy0}
|
||||
//! dF/dz0 : G3(...) = 2*Sum{[...]*Dz0}
|
||||
//! dF/dR : G4(...) = -4*R*Sum[...]
|
||||
//! [...] = [|(P(i) - Loc)^dir|^2 - R^2]
|
||||
class GeomConvert_FuncCylinderLSDist : public math_MultipleVarFunctionWithGradient
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT GeomConvert_FuncCylinderLSDist() {};
|
||||
|
||||
Standard_EXPORT GeomConvert_FuncCylinderLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const gp_Dir& theDir);
|
||||
|
||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
||||
{
|
||||
myPoints = thePoints;
|
||||
}
|
||||
|
||||
void SetDir(const gp_Dir& theDir)
|
||||
{
|
||||
myDir = theDir;
|
||||
}
|
||||
|
||||
//! Number of variables.
|
||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
||||
|
||||
//! Value.
|
||||
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
|
||||
|
||||
//! Gradient.
|
||||
Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
|
||||
|
||||
//! Value and gradient.
|
||||
Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
Handle(TColgp_HArray1OfXYZ) myPoints;
|
||||
gp_Dir myDir;
|
||||
|
||||
};
|
||||
#endif // _GeomConvert_FuncCylinderLSDist_HeaderFile
|
@@ -1,115 +0,0 @@
|
||||
// Created on: 2016-05-10
|
||||
// Created by: Alexander MALYSHEV
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <GeomConvert_FuncSphereLSDist.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GeomConvert_FuncSphereLSDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomConvert_FuncSphereLSDist::GeomConvert_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints):
|
||||
myPoints(thePoints)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GeomConvert_FuncSphereLSDist::NbVariables () const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Value(const math_Vector& X,Standard_Real& F)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR2 = X(4)*X(4);
|
||||
|
||||
F = 0.;
|
||||
Standard_Integer i;
|
||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
||||
{
|
||||
Standard_Real d = (myPoints->Value(i) - aLoc).SquareModulus() - anR2;
|
||||
F += d * d;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Gradient
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Gradient(const math_Vector& X,math_Vector& G)
|
||||
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
||||
|
||||
G.Init(0.);
|
||||
Standard_Integer i;
|
||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
||||
{
|
||||
gp_XYZ dLoc = myPoints->Value(i) - aLoc;
|
||||
Standard_Real d = dLoc.SquareModulus() - anR2;
|
||||
G(1) += d * dLoc.X();
|
||||
G(2) += d * dLoc.Y();
|
||||
G(3) += d * dLoc.Z();
|
||||
G(4) += d;
|
||||
}
|
||||
G *= -4;
|
||||
G(4) *= anR;
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Values
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean GeomConvert_FuncSphereLSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
|
||||
{
|
||||
gp_XYZ aLoc(X(1), X(2), X(3));
|
||||
Standard_Real anR = X(4), anR2 = anR * anR;
|
||||
|
||||
G.Init(0.);
|
||||
F = 0.;
|
||||
Standard_Integer i;
|
||||
for (i = myPoints->Lower(); i <= myPoints->Upper(); ++i)
|
||||
{
|
||||
gp_XYZ dLoc = myPoints->Value(i) - aLoc;
|
||||
Standard_Real d = dLoc.SquareModulus() - anR2;
|
||||
G(1) += d * dLoc.X();
|
||||
G(2) += d * dLoc.Y();
|
||||
G(3) += d * dLoc.Z();
|
||||
G(4) += d;
|
||||
F += d * d;
|
||||
}
|
||||
G *= -4;
|
||||
G(4) *= anR;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,77 +0,0 @@
|
||||
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2022 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _GeomConvert_FuncSphereLSDist_HeaderFile
|
||||
#define _GeomConvert_FuncSphereLSDist_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <math_MultipleVarFunctionWithGradient.hxx>
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
//! Function for search of sphere canonic parameters: coordinates of center and radius from set of moints
|
||||
//! by least square method.
|
||||
//! //!
|
||||
//! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
|
||||
//! for use in math_BFGS algorithm.
|
||||
//!
|
||||
//! The criteria is:
|
||||
//! F(x0, y0, z0, R) = Sum[(x(i) - x0)^2 + (y(i) - y0)^2 + (z(i) - z0)^2 - R^2]^2 => min,
|
||||
//! x(i), y(i), z(i) - coordinates of sample points, x0, y0, z0, R - coordinates of center and radius of sphere,
|
||||
//! which must be defined
|
||||
//!
|
||||
//! The first derivative are:
|
||||
//! dF/dx0 : G1(x0, y0, z0, R) = -4*Sum{[...]*(x(i) - x0)}
|
||||
//! dF/dy0 : G2(x0, y0, z0, R) = -4*Sum{[...]*(y(i) - y0)}
|
||||
//! dF/dz0 : G3(x0, y0, z0, R) = -4*Sum{[...]*(z(i) - z0)}
|
||||
//! dF/dR : G4(x0, y0, z0, R) = -4*R*Sum[...]
|
||||
//! [...] = [(x(i) - x0)^2 + (y(i) - y0)^2 + (z(i) - z0)^2 - R^2]
|
||||
//!
|
||||
class GeomConvert_FuncSphereLSDist : public math_MultipleVarFunctionWithGradient
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT GeomConvert_FuncSphereLSDist() {};
|
||||
|
||||
Standard_EXPORT GeomConvert_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints);
|
||||
|
||||
void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints)
|
||||
{
|
||||
myPoints = thePoints;
|
||||
}
|
||||
|
||||
//! Number of variables.
|
||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
||||
|
||||
//! Value.
|
||||
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
|
||||
|
||||
//! Gradient.
|
||||
Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
|
||||
|
||||
//! Value and gradient.
|
||||
Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
Handle(TColgp_HArray1OfXYZ) myPoints;
|
||||
|
||||
};
|
||||
#endif // _GeomConvert_FuncSphereLSDist_HeaderFile
|
File diff suppressed because it is too large
Load Diff
@@ -1,135 +0,0 @@
|
||||
// Created: 1998-06-03
|
||||
//
|
||||
// Copyright (c) 1999-2013 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of commercial software by OPEN CASCADE SAS,
|
||||
// furnished in accordance with the terms and conditions of the contract
|
||||
// and with the inclusion of this copyright notice.
|
||||
// This file or any part thereof may not be provided or otherwise
|
||||
// made available to any third party.
|
||||
//
|
||||
// No ownership title to the software is transferred hereby.
|
||||
//
|
||||
// OPEN CASCADE SAS makes no representation or warranties with respect to the
|
||||
// performance of this software, and specifically disclaims any responsibility
|
||||
// for any damages, special or consequential, connected with its use.
|
||||
|
||||
#ifndef _GeomConvert_SurfToAnaSurf_HeaderFile
|
||||
#define _GeomConvert_SurfToAnaSurf_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <GeomConvert_ConvType.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <TColgp_HArray1OfXYZ.hxx>
|
||||
class Geom_Surface;
|
||||
class Geom_SurfaceOfRevolution;
|
||||
class Geom_Circle;
|
||||
|
||||
//! Converts a surface to the analitical form with given
|
||||
//! precision. Conversion is done only the surface is bspline
|
||||
//! of bezier and this can be approximed by some analytical
|
||||
//! surface with that precision.
|
||||
class GeomConvert_SurfToAnaSurf
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT GeomConvert_SurfToAnaSurf();
|
||||
|
||||
Standard_EXPORT GeomConvert_SurfToAnaSurf(const Handle(Geom_Surface)& S);
|
||||
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& S);
|
||||
|
||||
void SetConvType(const GeomConvert_ConvType theConvType = GeomConvert_Simplest)
|
||||
{
|
||||
myConvType = theConvType;
|
||||
}
|
||||
void SetTarget(const GeomAbs_SurfaceType theSurfType = GeomAbs_Plane)
|
||||
{
|
||||
myTarget = theSurfType;
|
||||
}
|
||||
|
||||
//! Returns maximal deviation of converted surface from the original
|
||||
//! one computed by last call to ConvertToAnalytical
|
||||
Standard_Real Gap() const
|
||||
{
|
||||
return myGap;
|
||||
}
|
||||
|
||||
//! Tries to convert the Surface to an Analytic form
|
||||
//! Returns the result
|
||||
//! In case of failure, returns a Null Handle
|
||||
//!
|
||||
Standard_EXPORT Handle(Geom_Surface) ConvertToAnalytical (const Standard_Real InitialToler);
|
||||
Standard_EXPORT Handle(Geom_Surface) ConvertToAnalytical (const Standard_Real InitialToler,
|
||||
const Standard_Real Umin, const Standard_Real Umax,
|
||||
const Standard_Real Vmin, const Standard_Real Vmax);
|
||||
|
||||
//! Returns true if surfaces is same with the given tolerance
|
||||
Standard_EXPORT static Standard_Boolean IsSame (const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const Standard_Real tol);
|
||||
|
||||
//! Returns true, if surface is canonical
|
||||
Standard_EXPORT static Standard_Boolean IsCanonical (const Handle(Geom_Surface)& S);
|
||||
|
||||
private:
|
||||
//!static method for checking surface of revolution
|
||||
//!To avoid two-parts cone-like surface
|
||||
static void CheckVTrimForRevSurf(const Handle(Geom_SurfaceOfRevolution)& aRevSurf,
|
||||
Standard_Real& V1, Standard_Real& V2);
|
||||
|
||||
//!static method to try create cylindrical or conical surface
|
||||
static Handle(Geom_Surface) TryCylinerCone(const Handle(Geom_Surface)& theSurf, const Standard_Boolean theVCase,
|
||||
const Handle(Geom_Curve)& theUmidiso, const Handle(Geom_Curve)& theVmidiso,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Standard_Real theToler);
|
||||
|
||||
//!static method to try create cylinrical surface using least square method
|
||||
static Standard_Boolean GetCylByLS(const Handle(TColgp_HArray1OfXYZ)& thePoints,
|
||||
const Standard_Real theTol,
|
||||
gp_Ax3& thePos, Standard_Real& theR,
|
||||
Standard_Real& theGap);
|
||||
|
||||
//!static method to try create cylinrical surface based on its Gauss field
|
||||
static Handle(Geom_Surface) TryCylinderByGaussField(const Handle(Geom_Surface)& theSurf,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Standard_Real theToler, const Standard_Integer theNbU = 20, const Standard_Integer theNbV = 20,
|
||||
const Standard_Boolean theLeastSquare = Standard_False);
|
||||
|
||||
//! static method to try create toroidal surface.
|
||||
//! In case <isTryUMajor> = Standard_True try to use V isoline radius as minor radaius.
|
||||
static Handle(Geom_Surface) TryTorusSphere(const Handle(Geom_Surface)& theSurf,
|
||||
const Handle(Geom_Circle)& circle,
|
||||
const Handle(Geom_Circle)& otherCircle,
|
||||
const Standard_Real Param1,
|
||||
const Standard_Real Param2,
|
||||
const Standard_Real aParam1ToCrv,
|
||||
const Standard_Real aParam2ToCrv,
|
||||
const Standard_Real toler,
|
||||
const Standard_Boolean isTryUMajor);
|
||||
|
||||
static Standard_Real ComputeGap(const Handle(Geom_Surface)& theSurf,
|
||||
const Standard_Real theU1, const Standard_Real theU2, const Standard_Real theV1, const Standard_Real theV2,
|
||||
const Handle(Geom_Surface) theNewSurf, const Standard_Real theTol = RealLast());
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
Handle(Geom_Surface) mySurf;
|
||||
Standard_Real myGap;
|
||||
GeomConvert_ConvType myConvType;
|
||||
GeomAbs_SurfaceType myTarget;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // _GeomConvert_SurfToAnaSurf_HeaderFile
|
@@ -59,9 +59,7 @@
|
||||
#include <Geom2dConvert.hxx>
|
||||
#include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
|
||||
#include <GeomLProp_SLProps.hxx>
|
||||
#include <GeomConvert_SurfToAnaSurf.hxx>
|
||||
#include <GeomConvert_CurveToAnaCurve.hxx>
|
||||
#include <GeomConvert_ConvType.hxx>
|
||||
|
||||
|
||||
#include <DrawTrSurf_BezierSurface.hxx>
|
||||
#include <DrawTrSurf_BSplineSurface.hxx>
|
||||
@@ -524,111 +522,6 @@ static Standard_Integer converting(Draw_Interpretor& , Standard_Integer n, const
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : converting to canonical
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer tocanon(Draw_Interpretor& di, Standard_Integer n, const char ** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
|
||||
GeomConvert_ConvType aConvType = GeomConvert_Simplest;
|
||||
GeomAbs_CurveType aCurv = GeomAbs_Line;
|
||||
GeomAbs_SurfaceType aSurf = GeomAbs_Plane;
|
||||
if (n > 4)
|
||||
{
|
||||
if (strcmp(a[4], "sim") == 0) {
|
||||
aConvType = GeomConvert_Simplest;
|
||||
}
|
||||
else if (strcmp(a[4], "gap") == 0) {
|
||||
aConvType = GeomConvert_MinGap;
|
||||
}
|
||||
else if (strcmp(a[4], "lin") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aCurv = GeomAbs_Line;
|
||||
}
|
||||
else if (strcmp(a[4], "cir") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aCurv = GeomAbs_Circle;
|
||||
}
|
||||
else if (strcmp(a[4], "ell") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aCurv = GeomAbs_Ellipse;
|
||||
}
|
||||
else if (strcmp(a[4], "pln") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aSurf = GeomAbs_Plane;
|
||||
}
|
||||
else if (strcmp(a[4], "cyl") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aSurf = GeomAbs_Cylinder;
|
||||
}
|
||||
else if (strcmp(a[4], "con") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aSurf = GeomAbs_Cone;
|
||||
}
|
||||
else if (strcmp(a[4], "sph") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aSurf = GeomAbs_Sphere;
|
||||
}
|
||||
else if (strcmp(a[4], "tor") == 0) {
|
||||
aConvType = GeomConvert_Target;
|
||||
aSurf = GeomAbs_Torus;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real tol = Precision::Confusion();
|
||||
if (n > 3)
|
||||
{
|
||||
tol = Draw::Atof(a[3]);
|
||||
}
|
||||
|
||||
Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[2]);
|
||||
if (GC.IsNull()) {
|
||||
Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
|
||||
if (GS.IsNull()) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
GeomConvert_SurfToAnaSurf aSurfToAna(GS);
|
||||
aSurfToAna.SetConvType(aConvType);
|
||||
if(aConvType == GeomConvert_Target)
|
||||
aSurfToAna.SetTarget(aSurf);
|
||||
Handle(Geom_Surface) anAnaSurf = aSurfToAna.ConvertToAnalytical(tol);
|
||||
if (!anAnaSurf.IsNull())
|
||||
{
|
||||
DrawTrSurf::Set(a[1], anAnaSurf);
|
||||
Standard_Real aGap = aSurfToAna.Gap();
|
||||
di << "Gap = " << aGap << "\n";
|
||||
}
|
||||
else
|
||||
di << "Conversion failed" << "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
GeomConvert_CurveToAnaCurve aCurvToAna(GC);
|
||||
aCurvToAna.SetConvType(aConvType);
|
||||
if (aConvType == GeomConvert_Target)
|
||||
aCurvToAna.SetTarget(aCurv);
|
||||
|
||||
Handle(Geom_Curve) anAnaCurv;
|
||||
Standard_Real tf = GC->FirstParameter(), tl = GC->LastParameter(), ntf, ntl;
|
||||
Standard_Boolean isdone = aCurvToAna.ConvertToAnalytical(tol, anAnaCurv, tf, tl, ntf, ntl);
|
||||
if (isdone)
|
||||
{
|
||||
anAnaCurv = new Geom_TrimmedCurve(anAnaCurv, ntf, ntl);
|
||||
DrawTrSurf::Set(a[1], anAnaCurv);
|
||||
Standard_Real aGap = aCurvToAna.Gap();
|
||||
di << "Gap = " << aGap << "\n";
|
||||
}
|
||||
else
|
||||
di << "Conversion failed" << "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : tobezier
|
||||
@@ -650,7 +543,11 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
if ( C3d.IsNull()) {
|
||||
Handle(Geom_BSplineSurface) S =
|
||||
DrawTrSurf::GetBSplineSurface(a[2]);
|
||||
if ( S.IsNull()) return 1;
|
||||
if (S.IsNull())
|
||||
{
|
||||
delete[] name;
|
||||
return 1;
|
||||
}
|
||||
if (n == 7) {
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
U1 = Draw::Atof(a[3]);
|
||||
@@ -738,6 +635,8 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
}
|
||||
}
|
||||
|
||||
delete[] name;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1821,11 +1720,6 @@ void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
|
||||
__FILE__,
|
||||
converting,g);
|
||||
|
||||
theCommands.Add("tocanon",
|
||||
"tocanon result c3d/surf [tol [sim gap lin cir ell pln cyl con sph tor]]",
|
||||
__FILE__,
|
||||
tocanon, g);
|
||||
|
||||
theCommands.Add("tobezier",
|
||||
"tobezier result c2d/c3d/surf [ufirst, ulast / ufirst, ulast, vfirst, vlast]",
|
||||
__FILE__,
|
||||
|
@@ -23,8 +23,8 @@ enum Graphic3d_DisplayPriority
|
||||
Graphic3d_DisplayPriority_INVALID = -1,
|
||||
Graphic3d_DisplayPriority_Bottom = 0,
|
||||
Graphic3d_DisplayPriority_AlmostBottom = 1,
|
||||
Graphic3d_DisplayPriority_Below2 = 2,
|
||||
Graphic3d_DisplayPriority_Below1 = 3,
|
||||
Graphic3d_DisplayPriority_Below3 = 2,
|
||||
Graphic3d_DisplayPriority_Below2 = 3,
|
||||
Graphic3d_DisplayPriority_Below = 4,
|
||||
Graphic3d_DisplayPriority_Normal = 5,
|
||||
Graphic3d_DisplayPriority_Above = 6,
|
||||
|
@@ -1547,7 +1547,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getStdProgramPhong (con
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
aProgramSrc->SetPBR (theIsPBR); // should be set before defaultGlslVersion()
|
||||
aProgramSrc->SetPBR (theIsPBR);
|
||||
|
||||
TCollection_AsciiString aSrcVert, aSrcVertExtraFunc, aSrcVertExtraMain;
|
||||
TCollection_AsciiString aSrcFrag, aSrcFragGetVertColor, aSrcFragExtraMain;
|
||||
@@ -1987,8 +1987,6 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
||||
{
|
||||
Standard_ASSERT_RAISE (theIndex >= 0 && theIndex <= 2,"");
|
||||
Handle(Graphic3d_ShaderProgram) aProgramSrc = new Graphic3d_ShaderProgram();
|
||||
aProgramSrc->SetPBR (true); // should be set before defaultGlslVersion()
|
||||
|
||||
Graphic3d_ShaderObject::ShaderVariableList aUniforms, aStageInOuts;
|
||||
|
||||
TCollection_AsciiString aSrcVert = TCollection_AsciiString()
|
||||
@@ -2035,6 +2033,7 @@ Handle(Graphic3d_ShaderProgram) Graphic3d_ShaderManager::getPBREnvBakingProgram
|
||||
aProgramSrc->SetNbLightsMax (0);
|
||||
aProgramSrc->SetNbShadowMaps (0);
|
||||
aProgramSrc->SetNbClipPlanesMax (0);
|
||||
aProgramSrc->SetPBR (true);
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcVert, Graphic3d_TOS_VERTEX, aUniforms, aStageInOuts));
|
||||
aProgramSrc->AttachShader (Graphic3d_ShaderObject::CreateFromSource (aSrcFrag, Graphic3d_TOS_FRAGMENT, aUniforms, aStageInOuts));
|
||||
return aProgramSrc;
|
||||
|
@@ -23,8 +23,7 @@ enum Graphic3d_TypeOfBackfacingModel
|
||||
Graphic3d_TypeOfBackfacingModel_Auto, //!< automatic back face culling enabled for opaque groups with closed flag
|
||||
//! (e.g. solids, see Graphic3d_Group::IsClosed())
|
||||
Graphic3d_TypeOfBackfacingModel_DoubleSided, //!< no culling (double-sided shading)
|
||||
Graphic3d_TypeOfBackfacingModel_BackCulled, //!< back face culling
|
||||
Graphic3d_TypeOfBackfacingModel_FrontCulled, //!< front face culling
|
||||
Graphic3d_TypeOfBackfacingModel_BackCulled, //!< back face culling
|
||||
// old aliases
|
||||
Graphic3d_TOBM_AUTOMATIC = Graphic3d_TypeOfBackfacingModel_Auto,
|
||||
Graphic3d_TOBM_FORCE = Graphic3d_TypeOfBackfacingModel_DoubleSided,
|
||||
|
@@ -420,7 +420,8 @@ HLRAlgo_PolyInternalData::UpdateLinks (const Standard_Integer ip1,
|
||||
aSegIndices2->Conex2 = cnx2;
|
||||
aNodIndices3.NdSg = find;
|
||||
|
||||
Standard_Integer iOld,iNew,iTr,skip,ip4,itpk[2];
|
||||
Standard_Integer iOld,iNew,iTr,skip,ip4;
|
||||
Standard_Integer itpk[2] = { -1, -1 };
|
||||
Standard_Integer n1,n2,n3,nOld[3],nNew[3],New[4];
|
||||
New[0] = cnx1;
|
||||
New[2] = myNbTData + 1;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user