1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-18 14:27:39 +03:00

Compare commits

...

11 Commits

Author SHA1 Message Date
ddzama
b3284f3ba9 0033117: migration to intel oneTBB 2021.5.0 (c++20 ready)
MSVC 2022/c++20.

After employed c++20 language standard errors of compilation in intel oneTBB occurred.
To get rid of compilation errors proposed moving on actual (2021.5.0) intel oneTBB occ products and occt.

After migration errors of compilation of TKernel and TMath have been occurred...
...Error occurred if using c++20 standard with new oneTBB 2021.5.0.
The error was:
   Error C2672 'tbb::v1::parallel_for_each': no matching overloaded function found TKernel
   could be 'void tbb::detail::d2::parallel_for_each(Iterator,Iterator,const Body &)' TKernel
   'tbb::detail::d2::parallel_for_each': the associated constraints are not satisfied TKernel
Note, that if we use c++14 or c++17, all ok, error does not occures.
To solve the problem, i have to modify `UniversalIterator` class:
`value_type` instead `UniversalIterator` converted to `IteratorInterface*`
`pointer` = `reference` = `value_type`
Method `DownCast` moved into `FunctorInterface` abstract class.
argument `UniversalIterator& item` of the unary fuctions converted to `IteratorInterface*`.
The proposed solution removes compilation error.

Affected projects: TKernel, TMath
Affected sources: src/OSD/OSD_Parallel.hxx, src/OSD/OSD_Parallel_Threads.cxx
Affected classes: class OSD_Parallel, OSD_Parallel::UniversalIterator, OSD_Parallel::FunctorInterface, OSD_Parallel::FunctorWrapperIter, OSD_Parallel:;FunctorWrapperInt.
2022-09-25 01:09:12 +03:00
jgv
b95eefe1c2 0031992: Modeling Algorithms - Offset of closed B-spline edge fails
1. Increase the tolerance of approximation.
2. Update auxiliary Draw command "topoload" for usage of option "-approx".

Add missing comment
2022-09-23 18:31:02 +03:00
atychini
5bde4773f9 0032820: Data Exchange - add VRML reader to XCAF document
Implementing VRML reader into XCAF document.
Updating DE_Wrapper according to VRML Reader.
2022-09-23 18:30:08 +03:00
ona
b0f92d3d5c 0032239: Data Exchange, STEP import - bounding box is too large
- ShapeFix_Face::FixMissingSeam method is fixed in order to handle degenerated torus
- Calculation of degenerated torus bounding box is fixed
- Test reference data is changed
2022-09-21 23:09:17 +03:00
mzernova
b9f787f180 0033114: Visualization - AIS_Animation returns 0 elapsed time after finishing playback
Added -elapsedTime option to DRAW vanim command
2022-09-20 12:03:58 +03:00
oan
a939fd40eb 0031853: Mesh - holes in triangulation with large linear deflection
0030442: Mesh - broken triangulation on pipe shape

Scale down min size parameter for NURBS taking into account its U and V resolution in order to prevent comparison of 2d parameters with 3d value involved in filtering process.
2022-09-16 18:35:32 +03:00
oan
c4ea4ca3d1 0032241: Mesh - wrong shading display of thrusections [regression since OCCT 7.4.0]
0032422: Mesh - Weird rendering
0029641: Mesher produce 'bad' result for extruded spline with given deviation coefficient

Added method BRepMesh_NURBSRangeSplitter::getUndefinedInterval() intended to compute checkpoint parameters for those NURBS surfaces which have no intervals at all. In this case number of poles is used to produce artificial regular grid which can be refined further. Add at least one midpoint for surfaces with one interval and only two poles.

Added BRepMesh_ExtrusionRangeSplitter and BRepMesh_UndefinedRangeSplitter derivatives from BRepMesh_NURBSRangeSplitter intended to handle special cases of extrusion surfaces and general surfaces with undefined parameters.
2022-09-16 18:34:44 +03:00
oan
f3573fb54b 0031449: Mesh - BRepMesh works too long and produces many free nodes on a valid face
Added test cases
2022-09-13 23:30:33 +03:00
knosulko
78aade7569 0033017: Implement an algorithm to find a proximity between a pair of shapes
Extend "proximity" command to be able to compute the proximity value;
Implement classes for calculate proximity value between two shapes;
Add possibility to set up the number of sample points for the input shapes;
Add tests lowalgos/proximity.
2022-09-13 23:29:39 +03:00
kgv
03b0ca59cb 0033142: Configuration, genproj - ExpToCasExe building fails with generated VS projects
Generate executable single MSVC project per-Unit instead of per-source file.
2022-09-13 23:28:49 +03:00
ddzama
d6baf70a93 0032960: Wrong result of BRepExtrema_DistShapeShape after translation.
Add corresponding test.
2022-09-13 10:57:29 +03:00
146 changed files with 3858 additions and 661 deletions

View File

@@ -1,5 +1,13 @@
# tbb
if (NOT DEFINED 3RDPARTY_DIR)
message (FATAL_ERROR "3RDPARTY_DIR is not defined.")
endif()
if ((NOT EXISTS "${3RDPARTY_DIR}") OR ("${3RDPARTY_DIR}" STREQUAL ""))
message (FATAL_ERROR "Directory ${3RDPARTY_DIR} is not set.")
endif()
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
@@ -69,226 +77,186 @@ else()
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
endif()
# common steps for tbb and tbbmalloc
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
# Throw execution if 3RDPARTY_TBB_DIR is equal to void string.
if ("${3RDPARTY_TBB_DIR}" STREQUAL "")
message (FATAL_ERROR "Directory with one TBB have not found.")
endif()
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
# Searching TBBConfig.cmake and TBBTargets-release.cmake in 3RDPARTY_TBB_DIR
# TBBConfig.cmake - is required, TBBTargets-release.cmake is optional.
file (GLOB_RECURSE TBB_CONFIG_CMAKE_FILE "${3RDPARTY_TBB_DIR}/*TBBConfig.cmake")
if (NOT EXISTS "${TBB_CONFIG_CMAKE_FILE}")
message (FATAL_ERROR "TBBConfig.cmake has not been found.")
endif()
include ("${TBB_CONFIG_CMAKE_FILE}")
# 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()
file (GLOB_RECURSE TBB_TARGET_CMAKE_FILE "${3RDPARTY_TBB_DIR}/*TBBTargets-release.cmake")
if (EXISTS "${TBB_TARGET_CMAKE_FILE}")
include ("${TBB_TARGET_CMAKE_FILE}")
endif()
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
endif()
endif()
if (WIN32 AND NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
endif()
# check 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} library")
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
endif()
if (WIN32)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} shared library")
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
endif()
endif()
endif()
OCCT_MAKE_COMPILER_SHORT_NAME()
OCCT_MAKE_COMPILER_BITNESS()
if (${COMPILER_BITNESS} EQUAL 32)
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME ia32)
# We do not know, full path to file is pointed, or local.
# So, we should check it and output FULL PATH to FILE.
macro (TBB_FILE_NAME_TO_FILEPATH FL_NAME FL_PATH)
if (EXISTS "${FL_NAME}")
# FL_NAME is full path.
set (${FL_PATH} "${FL_NAME}")
else()
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64)
endif()
# 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)
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME})
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
if (THE_MOST_FRESH_COMPILER_VERSION)
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
endif()
endif()
endif()
else()
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
endif()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
PATHS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}"
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME}
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else()
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
# Here we deal with local path, so assign to var full path to file.
# Acquire full path.
set (${FL_PATH} "${3RDPARTY_TBB_DIR}${FL_NAME}")
if (NOT EXISTS "${${FL_PATH}}")
message (FATAL_ERROR "TBB: needed file not found (${FL_PATH}).")
endif()
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
# 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)
set (PRODUCT_PATH_SUFFIXES bin)
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
if (THE_MOST_FRESH_COMPILER_VERSION)
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
endif()
endif()
endif()
else()
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER})
endif()
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME}
PATHS "${3RDPARTY_TBB_DIR}"
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else()
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
endif()
endif()
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR)
endif()
endif()
# install tbb/tbbmalloc
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
else()
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY} NAME)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
else()
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
endif()
endif()
endif()
mark_as_advanced (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL)
endmacro()
#if (BUILD_SHARED_LIBS)
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
TBB_PRODUCT_SEARCH (${LIB})
endforeach()
# TARGET_NAME - is target name from oneTBB cmake file
# it is either "TBB::tbb", or "TBB::tbbmalloc"
# LIB_NAME_UC - is library id (TBB or TBBMALLOC)
# PROPERTY_TO_SET - LIBRARY or DLL
macro (WIN_TBB_PARSE TARGET_NAME LIB_NAME PROPERTY_TO_SET)
set (FILE_NAME "")
set (FILE_PATH "")
set (FILE_DIR "")
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
if ("${PROPERTY_TO_SET}" STREQUAL "LIBRARY")
get_target_property (FILE_NAME "${TARGET_NAME}" IMPORTED_IMPLIB_RELEASE)
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
get_target_property (FILE_NAME "${TARGET_NAME}" IMPORTED_LOCATION_RELEASE)
endif()
# acquire full path
TBB_FILE_NAME_TO_FILEPATH("${FILE_NAME}" FILE_PATH)
get_filename_component (FILE_NAME "${FILE_PATH}" NAME)
get_filename_component (FILE_DIR "${FILE_PATH}" DIRECTORY)
if (NOT EXISTS "${FILE_DIR}/${FILE_NAME}")
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET} "" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR "" CACHE PATH "The directory containing ${LIB_NAME} shared library")
if ("${PROPERTY_TO_SET}" STREQUAL "LIBRARY")
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR)
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR)
endif()
else()
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET} "${FILE_DIR}/${FILE_NAME}" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR "${FILE_DIR}" CACHE PATH "The directory containing ${LIB_NAME} shared library")
if ("${PROPERTY_TO_SET}" STREQUAL "LIBRARY")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${FILE_DIR}")
else()
list (APPEND 3RDPARTY_DLL_DIRS "${FILE_DIR}")
endif()
endif()
#endif()
endmacro()
# TARGET_NAME - is target name from oneTBB cmake file
# it is either "TBB::tbb", or "TBB::tbbmalloc"
# LIB_NAME_UC - is library id (TBB or TBBMALLOC)
macro (LIN_TBB_PARSE TARGET_NAME LIB_NAME)
set (FILE_NAME "")
set (FILE_PATH "")
set (FILE_DIR "")
get_target_property (FILE_NAME "${TARGET_NAME}" IMPORTED_LOCATION_RELEASE)
# acquire full path
TBB_FILE_NAME_TO_FILEPATH("${FILE_NAME}" FILE_PATH)
get_filename_component (FILE_NAME "${FILE_PATH}" NAME)
get_filename_component (FILE_DIR "${FILE_PATH}" DIRECTORY)
if (NOT EXISTS "${FILE_DIR}/${FILE_NAME}")
set (3RDPARTY_${LIB_NAME}_LIBRARY "" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_NAME} shared library")
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_NAME}_LIBRARY_DIR)
else()
set (3RDPARTY_${LIB_NAME}_LIBRARY "${FILE_DIR}/${FILE_NAME}" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_LIBRARY_DIR "${FILE_DIR}" CACHE PATH "The directory containing ${LIB_NAME} shared library")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_NAME}_LIBRARY_DIR}")
endif()
endmacro()
if (WIN32)
# Here we should set:
# - 3RDPARTY_*_LIBRARY
# - 3RDPARTY_*_LIBRARY_DIR
# - 3RDPARTY_*_DLL
# - 3RDPARTY_*_DLL_DIR
# where * - is TBB or TBBMALLOC
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
WIN_TBB_PARSE("TBB::${LIB_LOWER}" "${LIB_UPPER}" "LIBRARY")
WIN_TBB_PARSE("TBB::${LIB_LOWER}" "${LIB_UPPER}" "DLL")
endforeach()
else()
# Here we should set:
# - 3RDPARTY_*_LIBRARY
# - 3RDPARTY_*_LIBRARY_DIR
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
LIN_TBB_PARSE("TBB::${LIB_LOWER}" "${LIB_UPPER}")
endforeach()
endif()
# install tbb/tbbmalloc
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
if (SINGLE_GENERATOR)
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
endforeach()
else()
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_BIN}d")
endforeach()
endif()
else()
if (SINGLE_GENERATOR)
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} DESTINATION "${INSTALL_DIR_LIB}")
endforeach()
else()
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_LIB}d")
endforeach()
endif()
endif()
endif()
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
endforeach()
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
endif()
endif()

View File

@@ -780,14 +780,14 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
}
}
if { "$::tcl_platform(platform)" == "windows" } {
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
if { "$aTbbDllPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
if { "$aTbbDllPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
} else {
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}

View File

@@ -1233,28 +1233,11 @@ proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects
lappend aProjectsInModule($aModule) $aToolKit
lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
}
# executables, assume one project per cxx file...
# executables
foreach aUnit [OS:executable ${aModule}] {
set aUnitLoc $aUnit
set src_files [_get_used_files $aUnit $theSrcDir false]
set aSrcFiles {}
foreach s $src_files {
regexp {source ([^\s]+)} $s dummy name
lappend aSrcFiles $name
}
foreach aSrcFile $aSrcFiles {
set aFileExtension [file extension $aSrcFile]
if { $aFileExtension == ".cxx" } {
set aPrjName [file rootname $aSrcFile]
lappend aProjects $aPrjName
lappend aProjectsInModule($aModule) $aPrjName
if {[file isdirectory $path/$theSrcDir/$aUnitLoc]} {
lappend aDependencies [LibToLinkX $aUnitLoc [file rootname $aSrcFile] $theSrcDir $theSourceDirOther]
} else {
lappend aDependencies {}
}
}
}
lappend aProjects $aUnit
lappend aProjectsInModule($aModule) $aUnit
lappend aDependencies [LibToLink $aUnit $theSrcDir $theSourceDirOther]
}
}
}
@@ -2110,98 +2093,106 @@ proc osutils:tk:execfiles { theFiles theOutDir theCommand thePrefix theExtension
# Generate Visual Studio project file for executable
proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
set aVcFiles {}
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
set aProjName [file rootname [file tail $f]]
set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
set aProjName $theToolKit
set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($aProjName)] } {
set aGuidsMap($aProjName) [OS:genGUID]
}
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($aProjName)] } {
set aGuidsMap($aProjName) [OS:genGUID]
}
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
lappend aUsedLibs "${tkx}.lib"
}
set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
lappend aUsedLibs "${tkx}.lib"
}
set anOsReleaseLibs {}
set anOsDebugLibs {}
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
set anOsReleaseLibs {}
set anOsDebugLibs {}
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
lappend aVcFilesCxx($theToolKit) $f
} else {
append aFilesSection "\t\t\t<Filter\n"
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
append aFilesSection "\t\t\t\t>\n"
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
append aFilesSection "\t\t\t</Filter>"
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
#puts "$aProjTmpl $aFilesSection"
set anIncPaths "..\\..\\..\\inc"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
} else {
append aFilesSection "\t\t\t<Filter\n"
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
append aFilesSection "\t\t\t\t>\n"
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
}
append aFilesSection "\t\t\t</Filter>"
}
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
#puts "$aProjTmpl $aFilesSection"
set anIncPaths "..\\..\\..\\inc"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
fconfigure $aFile -translation crlf
puts $aFile $aProjTmpl
close $aFile
set aCommonSettingsFile "$aVcFilePath.user"
lappend aVcFiles $aVcFilePath
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
} elseif { "$theVcVer" == "vc9" } {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
fconfigure $aFile -translation crlf
puts $aFile $aProjTmpl
puts $aFile $aCommonSettingsFileTmpl
close $aFile
set aCommonSettingsFile "$aVcFilePath.user"
lappend aVcFiles $aVcFilePath
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
} elseif { "$theVcVer" == "vc9" } {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
fconfigure $aFile -translation crlf
puts $aFile $aCommonSettingsFileTmpl
close $aFile
lappend aVcFiles "$aCommonSettingsFile"
}
lappend aVcFiles "$aCommonSettingsFile"
}
return $aVcFiles
}

View File

@@ -128,8 +128,9 @@ You can download its sources from https://freetype.org/
@subsection dev_guides__building_3rdparty_win_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Windows platform.
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Windows platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-win.zip`)
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
@@ -304,9 +305,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product.
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-lin.tgz`).
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
@@ -477,9 +478,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
@subsection dev_guides__building_3rdparty_osx_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (`tbb30_018oss_osx.tgz`).
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-mac.tgz`).
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage

View File

@@ -360,7 +360,7 @@ 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 TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) |
| Intel oneTBB 2021.5.0 | https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0 | All | Parallelization of algorithms (alternative to built-in thread pool) |
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer |
@@ -572,8 +572,7 @@ FreeType 2 is released under two open-source licenses: BSD-like FreeType License
It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert.
Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that
abstracts platform details and threading mechanisms for scalability and performance.
TBB version 2017 is available under Apache 2.0 license, while older versions
until 4.4 are available under GPLv2 license with the runtime exception (https://www.threadingbuildingblocks.org).
Intel oneTBB 2021.5.0 is available under Apache 2.0 license (https://www.threadingbuildingblocks.org).
**OpenGL** is an industry standard API for 3D graphics used by OCCT for
implementation of 3D viewer. OpenGL specification is developed by the

View File

@@ -2338,3 +2338,8 @@ or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hx
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.
@subsection upgrade_occt770_shapeproximity BRepExtrema_ShapeProximity
A new way of using the `BRepExtrema_ShapeProximity` class was provided for computing a proximity value between two shapes.
If at initialization of the `BRepExtrema_ShapeProximity` class the *theTolerance* parameter is not defined (Precision::Infinite() by default), the proximity value will be computed.

View File

@@ -251,7 +251,9 @@ void AIS_Animation::Stop()
myState = AnimationState_Stopped;
if (!myTimer.IsNull())
{
const Standard_Real anElapsedTime = ElapsedTime();
myTimer->Stop();
myTimer->Seek (Min (Duration(), anElapsedTime));
}
for (NCollection_Sequence<Handle(AIS_Animation)>::Iterator anIter (myAnimations); anIter.More(); anIter.Next())

View File

@@ -0,0 +1,460 @@
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// 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.
#include <BRepExtrema_ProximityDistTool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pln.hxx>
#include <Precision.hxx>
#include <Poly_Connect.hxx>
#include <Standard_NullValue.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : BRepExtrema_ProximityDistTool
//purpose : Creates new unitialized tool
//=======================================================================
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool()
: myMinDistance (std::numeric_limits<Standard_Real>::max()),
myProxDist (-1.),
myPntStatus1 (ProxPnt_Status_UNKNOWN),
myPntStatus2 (ProxPnt_Status_UNKNOWN),
myNbSamples1 (0),
myProxVtxIdx1 (-1)
{
}
//=======================================================================
//function : BRepExtrema_ProximityDistTool
//purpose : Creates new tool for the given element sets
//=======================================================================
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
: myMinDistance (std::numeric_limits<Standard_Real>::max()),
myProxDist (-1.),
myPntStatus1 (ProxPnt_Status_UNKNOWN),
myPntStatus2 (ProxPnt_Status_UNKNOWN),
myNbSamples1 (theNbSamples1),
myProxVtxIdx1 (-1)
{
LoadTriangleSets (theSet1, theSet2);
LoadShapeLists (theShapeList1, theShapeList2);
}
//=======================================================================
//function : LoadTriangleSets
//purpose : Loads the given element sets into the tool
//=======================================================================
void BRepExtrema_ProximityDistTool::LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Handle(BRepExtrema_TriangleSet)& theSet2)
{
mySet1 = theSet1;
mySet2 = theSet2;
}
//=======================================================================
//function : LoadTriangleSets
//purpose : Loads the given list of subshapes into the proximity tool
//=======================================================================
void BRepExtrema_ProximityDistTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
{
myShapeList1 = theShapeList1;
myShapeList2 = theShapeList2;
}
//=======================================================================
//function : Perform
//purpose : Performs searching of the proximity distance
//=======================================================================
void BRepExtrema_ProximityDistTool::Perform()
{
SetBVHSet (mySet2.get());
const BVH_Array3d& aVertices1 = mySet1->GetVertices();
Standard_Integer aVtxSize = (Standard_Integer)aVertices1.size();
Standard_Integer aVtxStep = Max (myNbSamples1 <= 0 ? 1 : aVtxSize / myNbSamples1, 1);
for (Standard_Integer aVtxIdx = 0; aVtxIdx < aVtxSize; aVtxIdx += aVtxStep)
{
myDistance = std::numeric_limits<Standard_Real>::max();
myMinDistance = std::numeric_limits<Standard_Real>::max();
myIsDone = Standard_False;
SetObject (aVertices1[aVtxIdx]);
ComputeDistance();
if (!IsDone() && myProxDist < 0.) return;
if (IsDone() && myDistance > myProxDist)
{
myPnt1 = aVertices1[aVtxIdx];
myPnt2 = myExtremaPoint;
myProxDist = myDistance;
myProxVtxIdx1 = aVtxIdx;
myProxPrjState = myExtPrjState;
}
}
myIsDone = myProxDist > -1.;
if (myIsDone)
{
DefineStatusProxPnt();
}
}
static Standard_Real pointBoxSquareMaxDistance (const BVH_Vec3d& thePoint,
const BVH_Vec3d& theCMin,
const BVH_Vec3d& theCMax)
{
Standard_Real aDist = 0;
for (int i = 0; i < 3; ++i)
{
if (thePoint[i] <= 0.5 * (theCMax[i] + theCMin[i])) { Standard_Real d = theCMax[i] - thePoint[i]; d *= d; aDist += d; }
else { Standard_Real d = thePoint[i] - theCMin[i]; d *= d; aDist += d; }
}
return aDist;
}
//=======================================================================
//function : Branch rejection
//purpose : Defines the rules for node rejection by bounding box
//=======================================================================
Standard_Boolean BRepExtrema_ProximityDistTool::RejectNode (const BVH_Vec3d& theCornerMin,
const BVH_Vec3d& theCornerMax,
Standard_Real& theMetric) const
{
theMetric = sqrt (BVH_Tools<Standard_Real, 3>::PointBoxSquareDistance (myObject,
theCornerMin,
theCornerMax));
Standard_Real aMaxMetric = sqrt (pointBoxSquareMaxDistance (myObject,
theCornerMin,
theCornerMax));
return theMetric > myDistance || aMaxMetric < myProxDist;
}
//=======================================================================
//function : Leaf acceptance
//purpose : Defines the rules for leaf acceptance
//=======================================================================
Standard_Boolean BRepExtrema_ProximityDistTool::Accept (const Standard_Integer theTrgIdx,
const Standard_Real&)
{
BVH_Vec3d aTrgVert1;
BVH_Vec3d aTrgVert2;
BVH_Vec3d aTrgVert3;
BVH_PrjState aBVH_PrjState;
Standard_Integer aNumberOfFirstNode = -1;
Standard_Integer aNumberOfLastNode = -1;
mySet2->GetVertices (theTrgIdx, aTrgVert1, aTrgVert2, aTrgVert3);
BVH_Vec3d aNearestPnt = BVH_Tools<Standard_Real, 3>::PointTriangleProjection (myObject,
aTrgVert1, aTrgVert2, aTrgVert3,
&aBVH_PrjState,
&aNumberOfFirstNode, &aNumberOfLastNode);
PrjState aPrjState (theTrgIdx, aBVH_PrjState, aNumberOfFirstNode, aNumberOfLastNode);
BVH_Vec3d aDirect = myObject - aNearestPnt;
Standard_Real aSqDistance = aDirect.Dot(aDirect);
if (aSqDistance > Precision::SquareConfusion()) // point belongs to triangle
{
const BVH_Vec3d aAB = aTrgVert2 - aTrgVert1;
BVH_Vec3d aNorm;
if (aTrgVert2.IsEqual (aTrgVert3)) // is this degenerate triangle (= segment)
{
const BVH_Vec3d aAP = myObject - aTrgVert1;
aNorm = BVH_Vec3d::Cross (BVH_Vec3d::Cross (aAP, aAB), aAB);
}
else
{
const BVH_Vec3d aAC = aTrgVert3 - aTrgVert1;
aNorm = BVH_Vec3d::Cross (aAB, aAC);
}
Standard_Real aNormSqLen = aNorm.Dot (aNorm);
// check if the distance is under perpendicular
const BVH_Vec3d aCrossCross = BVH_Vec3d::Cross (aDirect, aNorm);
Standard_Real aCrossCrossSqLen = aCrossCross.Dot (aCrossCross);
if (aCrossCrossSqLen > Precision::SquareConfusion() * aSqDistance * aNormSqLen)
{
// the distance is not under perpendicular
if (myMinDistance - sqrt (aSqDistance) > Precision::Confusion())
{
myMinDistance = sqrt (aSqDistance);
myMinDistPoint = aNearestPnt;
myMinPrjState = aPrjState;
}
return Standard_False;
}
}
// the distance is under perpendicular
if (myDistance - sqrt (aSqDistance) > Precision::Confusion())
{
myDistance = sqrt (aSqDistance);
myExtremaPoint = aNearestPnt;
myExtPrjState = aPrjState;
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : ComputeDistance
//purpose : Computes the distance between object and BVH tree
//=======================================================================
Standard_Real BRepExtrema_ProximityDistTool::ComputeDistance()
{
myIsDone = this->Select() > 0;
if (!myIsDone)
{
if (myMinDistance < std::numeric_limits<Standard_Real>::max())
{
myExtremaPoint = myMinDistPoint;
myExtPrjState = myMinPrjState;
myIsDone = true;
}
myDistance = myMinDistance;
}
return myDistance;
}
static Standard_Boolean isNodeOnBorder (const Standard_Integer theNodeIdx, const Handle (Poly_Triangulation)& theTr)
{
Poly_Connect aPolyConnect (theTr);
Standard_Integer aContTrg; //index of triangle containing exploring node
for (aPolyConnect.Initialize (theNodeIdx); aPolyConnect.More(); aPolyConnect.Next())
{
aContTrg = aPolyConnect.Value();
Standard_Integer aContTrgNodes[3];
theTr->Triangle (aContTrg).Get (aContTrgNodes[0], aContTrgNodes[1], aContTrgNodes[2]); //indices of nodes of the triangle
Standard_Integer aAdjTrg[3];
aPolyConnect.Triangles (aContTrg, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
for (Standard_Integer j = 0; j < 3; j++)
{
Standard_Integer k = (j + 1) % 3;
if (aAdjTrg[j] == 0) //free segment of triangle
{
//aContTrgNodes[j], aContTrgNodes[k] are ends of free segment and it is a part of border
if (aContTrgNodes[j] == theNodeIdx || aContTrgNodes[k] == theNodeIdx)
{
return Standard_True;
}
}
}
}
return Standard_False;
}
//=======================================================================
//function : defineStatusProxPnt1
//purpose : Defines the status of proximity point from 1st BVH
//=======================================================================
void BRepExtrema_ProximityDistTool::defineStatusProxPnt1()
{
Standard_Integer aFaceID1 = mySet1->GetShapeIDOfVtx (myProxVtxIdx1);
if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_EDGE)
{
const BVH_Array3d& aVertices1 = mySet1->GetVertices();
Standard_Integer aVtxSize = (Standard_Integer)aVertices1.size();
Standard_Integer aLastIdx = aVtxSize - 1;
if ((aVertices1[0] - aVertices1[aLastIdx]).Modulus() < Precision::Confusion()) // if closed
{
myPntStatus1 = ProxPnt_Status_MIDDLE;
return;
}
if (myProxVtxIdx1 == 0 || myProxVtxIdx1 == aLastIdx)
{
myPntStatus1 = ProxPnt_Status_BORDER;
}
else
{
myPntStatus1 = ProxPnt_Status_MIDDLE;
}
}
else if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_FACE)
{
Standard_Integer aNodeIdx = mySet1->GetVtxIdxInShape (myProxVtxIdx1) + 1;
TopLoc_Location aLocation;
const TopoDS_Face& aF = TopoDS::Face (myShapeList1 (aFaceID1));
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
if (isNodeOnBorder (aNodeIdx, aTr))
{
myPntStatus1 = ProxPnt_Status_BORDER;
}
else
{
myPntStatus1 = ProxPnt_Status_MIDDLE;
}
}
}
//=======================================================================
//function : defineStatusProxPnt2
//purpose : Defines the status of proximity point from 2nd BVH
//=======================================================================
void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
{
Standard_Integer aTrgIdx = myProxPrjState.GetTrgIdx();
Standard_Integer aFaceID2 = mySet2->GetFaceID (aTrgIdx);
if (myShapeList2 (aFaceID2).ShapeType() == TopAbs_EDGE)
{
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_INNER)
{
return;
}
else
{
const BVH_Array3d& aVertices2 = mySet2->GetVertices();
Standard_Integer aVtxSize = (Standard_Integer)aVertices2.size();
Standard_Integer aLastIdx = aVtxSize - 1;
if ((aVertices2[0] - aVertices2[aLastIdx]).Modulus() < Precision::Confusion()) // if closed
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
return;
}
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
Standard_Integer aFirstNodeNum = myProxPrjState.GetNumberOfFirstNode();
Standard_Integer aFirstVtxIdx = aVtxIndicesOfTrg[aFirstNodeNum];
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_VERTEX)
{
if (aFirstVtxIdx == 0 || aFirstVtxIdx == aLastIdx)
{
myPntStatus2 = ProxPnt_Status_BORDER;
}
else
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
}
}
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
{
Standard_Integer aLastNodeNum = myProxPrjState.GetNumberOfLastNode();
Standard_Integer aLastVtxIdx = aVtxIndicesOfTrg[aLastNodeNum];
// it could be border only in case projection is on a degenerated edge
if (aFirstVtxIdx == aLastVtxIdx && (aFirstVtxIdx == 0 || aFirstVtxIdx == aLastIdx))
{
myPntStatus2 = ProxPnt_Status_BORDER;
}
else
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
}
}
}
}
else if (myShapeList2 (aFaceID2).ShapeType() == TopAbs_FACE)
{
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_INNER)
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
}
else
{
TopLoc_Location aLocation;
const TopoDS_Face& aF = TopoDS::Face (myShapeList2 (aFaceID2));
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_VERTEX)
{
Standard_Integer aNodeNum = myProxPrjState.GetNumberOfFirstNode();
Standard_Integer aNodeIdx = mySet2->GetVtxIdxInShape (aVtxIndicesOfTrg[aNodeNum]) + 1;
if (isNodeOnBorder (aNodeIdx, aTr))
{
myPntStatus2 = ProxPnt_Status_BORDER;
}
else
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
}
}
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
Poly_Connect aPolyConnect (aTr);
Standard_Integer aTrgIdxInShape = mySet2->GetTrgIdxInShape (aTrgIdx) + 1;
Standard_Integer aAdjTrg[3];
aPolyConnect.Triangles (aTrgIdxInShape, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
for (Standard_Integer j = 0; j < 3; j++)
{
Standard_Integer k = (j + 1) % 3;
if (aAdjTrg[j] == 0) //free segment of triangle
{
//aVtxIndicesOfTrg[j] and aVtxIndicesOfTrg[k] are ends of free segment and it is a part of border
if (j == myProxPrjState.GetNumberOfFirstNode() &&
k == myProxPrjState.GetNumberOfLastNode())
{
myPntStatus2 = ProxPnt_Status_BORDER;
break;
}
}
}
} //else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
}
} //else if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_FACE)
}
//=======================================================================
//function : DefineStatusProxPnt
//purpose : Defines the status of proximity points
//=======================================================================
void BRepExtrema_ProximityDistTool::DefineStatusProxPnt()
{
// define the status of proximity point from 1st BVH
defineStatusProxPnt1();
// define the status of proximity point from 2nd BVH
defineStatusProxPnt2();
}

View File

@@ -0,0 +1,200 @@
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// 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 _BRepExtrema_ProximityDistTool_HeaderFile
#define _BRepExtrema_ProximityDistTool_HeaderFile
#include <BRepExtrema_ElementFilter.hxx>
#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
#include <BRepExtrema_TriangleSet.hxx>
#include <BVH_Distance.hxx>
#include <BVH_Tools.hxx>
//! Tool class for computation the proximity distance from first
//! primitive set to second one that is the maximal from minimum
//! perpendicular distances. If no perpendicular distance is found, the
//! minimum distance will be returned.
//! This tool is not intended to be used independently, and is integrated
//! in other classes, implementing algorithms based on shape tessellation
//! (BRepExtrema_ProximityValueTool).
//!
//! Please note that algorithm results are approximate and depend greatly
//! on the quality of input tessellation(s).
class BRepExtrema_ProximityDistTool : public BVH_Distance <Standard_Real, 3, BVH_Vec3d,
BRepExtrema_TriangleSet>
{
public:
typedef typename BVH_Tools<Standard_Real, 3>::BVH_PrjStateInTriangle BVH_PrjState;
enum ProxPnt_Status
{
ProxPnt_Status_BORDER,
ProxPnt_Status_MIDDLE,
ProxPnt_Status_UNKNOWN
};
public:
//! Struct with information about projection point state from 2nd BVH,
//! providing proximity point of 2nd shape
struct PrjState
{
PrjState()
: myTrgIdx (0),
myPrjState (BVH_PrjState::BVH_PrjStateInTriangle_INNER),
myNumberOfFirstNode (0),
myNumberOfLastNode (0)
{}
PrjState (const Standard_Integer theTrgIdx,
const BVH_PrjState thePrjState,
const Standard_Integer theNumberOfFirstNode,
const Standard_Integer theNumberOfLastNode)
: myTrgIdx (theTrgIdx),
myPrjState (thePrjState),
myNumberOfFirstNode (theNumberOfFirstNode),
myNumberOfLastNode (theNumberOfLastNode)
{}
Standard_Integer GetTrgIdx() const { return myTrgIdx; }
BVH_PrjState GetPrjState() const { return myPrjState; }
Standard_Integer GetNumberOfFirstNode() const { return myNumberOfFirstNode; }
Standard_Integer GetNumberOfLastNode() const { return myNumberOfLastNode; }
private:
Standard_Integer myTrgIdx; //!< Index of triangle on which the projection is located
BVH_PrjState myPrjState; //!< Position of a projection on the triangle (vertex, edge, inner)
Standard_Integer myNumberOfFirstNode; //!< The 1st vtx of the triangle edge on which the projection is located
Standard_Integer myNumberOfLastNode; //!< The 2nd vtx of the triangle edge on which the projection is located
};
public:
//! Creates new unitialized tool.
Standard_EXPORT BRepExtrema_ProximityDistTool();
//! Creates new tool for the given element sets.
Standard_EXPORT BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
public:
//! Loads the given element sets into the tool.
Standard_EXPORT void LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Handle(BRepExtrema_TriangleSet)& theSet2);
//! Loads the given list of subshapes into the tool.
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
//! Performs searching of the proximity distance.
Standard_EXPORT void Perform();
public: //! @name Reject/Accept implementations
//! Defines the rules for node rejection by bounding box.
Standard_EXPORT virtual Standard_Boolean RejectNode (const BVH_Vec3d& theCornerMin,
const BVH_Vec3d& theCornerMax,
Standard_Real& theMetric) const Standard_OVERRIDE;
//! Defines the rules for leaf acceptance.
Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theSgmIdx,
const Standard_Real&) Standard_OVERRIDE;
//! Returns points on triangles sets, which provide the proximity distance.
void ProximityPoints (BVH_Vec3d& thePoint1, BVH_Vec3d& thePoint2) const
{
thePoint1 = myPnt1;
thePoint2 = myPnt2;
}
//! Returns status of points on triangles sets, which provide the proximity distance.
void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
{
thePointStatus1 = myPntStatus1;
thePointStatus2 = myPntStatus2;
}
//! Returns the computed distance
Standard_Real ProximityDistance() const { return myProxDist; }
protected:
//! Computes the distance between object and BVH tree.
Standard_EXPORT Standard_Real ComputeDistance();
//! Defines the status of proximity points.
Standard_EXPORT void DefineStatusProxPnt();
private:
//! Defines the status of proximity point from 1st BVH.
void defineStatusProxPnt1();
//! Defines the status of proximity point from 2nd BVH.
void defineStatusProxPnt2();
protected:
Standard_Real myMinDistance; //!< Minimal distance from point to BVH, could be not equal to myDistance
BVH_Vec3d myMinDistPoint; //!< Point on BVH providing the minimal distance
BVH_Vec3d myExtremaPoint; //!< Point on BVH providing the extrema
Standard_Real myProxDist; //!< Proximity distance
//! Proximity points
BVH_Vec3d myPnt1, myPnt2;
//! Proximity points' status
ProxPnt_Status myPntStatus1, myPntStatus2;
private:
//! Set of all mesh elements (triangles) of the 1st shape.
Handle(BRepExtrema_TriangleSet) mySet1;
//! Set of all mesh elements (triangles) of the 2nd shape.
Handle(BRepExtrema_TriangleSet) mySet2;
//! List of subshapes of the 1st shape.
BRepExtrema_ShapeList myShapeList1;
//! List of subshapes of the 2nd shape.
BRepExtrema_ShapeList myShapeList2;
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
//! Vertex index from 1st BVH corresponding to proximity point of 1st shape
Standard_Integer myProxVtxIdx1;
//! Information of projection point state from 2nd BVH providing proximity point of 2nd shape
PrjState myProxPrjState;
//! Information of projection point state from 2nd BVH providing the extrema
PrjState myExtPrjState;
//! Information of projection point state from 2nd BVH providing the minimal distance
PrjState myMinPrjState;
};
#endif // _BRepExtrema_ProximityDistTool_HeaderFile

View File

@@ -0,0 +1,161 @@
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// 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.
#include <BRepExtrema_ProximityValueTool.hxx>
//=======================================================================
//function : BRepExtrema_ProximityValueTool
//purpose : Creates new unitialized proximity tool
//=======================================================================
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool()
: myDistance (std::numeric_limits<Standard_Real>::max()),
myIsDone (Standard_False),
myNbSamples1(0),
myNbSamples2(0)
{}
//=======================================================================
//function : BRepExtrema_ProximityValueTool
//purpose : Creates new proximity tool for the given element sets
//=======================================================================
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
: myDistance (std::numeric_limits<Standard_Real>::max()),
myIsDone (Standard_False),
myNbSamples1(0),
myNbSamples2(0)
{
LoadTriangleSets (theSet1, theSet2);
LoadShapeLists (theShapeList1, theShapeList2);
}
//=======================================================================
//function : LoadTriangleSets
//purpose : Loads the given element sets into the proximity tool
//=======================================================================
void BRepExtrema_ProximityValueTool::LoadTriangleSets (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Handle(BRepExtrema_TriangleSet)& theSet2)
{
mySet1 = theSet1;
mySet2 = theSet2;
myIsDone = Standard_False;
}
//=======================================================================
//function : LoadTriangleSets
//purpose : Loads the given list of subshapes into the proximity tool
//=======================================================================
void BRepExtrema_ProximityValueTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
{
myShapeList1 = theShapeList1;
myShapeList2 = theShapeList2;
myIsDone = Standard_False;
}
//=======================================================================
//function : SetNbSamplePoints
//purpose : Sets number of sample points used for proximity calculation for each shape
//=======================================================================
void BRepExtrema_ProximityValueTool::SetNbSamplePoints(const Standard_Integer theSamples1,
const Standard_Integer theSamples2)
{
myNbSamples1 = theSamples1;
myNbSamples2 = theSamples2;
myIsDone = Standard_False;
}
//=======================================================================
//function : computeProximityValue
//purpose : Returns the computed proximity value from first BVH to another one
//=======================================================================
Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2,
BVH_Vec3d& thePoint1,
BVH_Vec3d& thePoint2,
ProxPnt_Status& thePointStatus1,
ProxPnt_Status& thePointStatus2) const
{
BRepExtrema_ProximityDistTool aProxDistTool (theSet1, theNbSamples1, theSet2, theShapeList1, theShapeList2);
aProxDistTool.Perform();
if (!aProxDistTool.IsDone())
return -1.;
aProxDistTool.ProximityPoints (thePoint1, thePoint2);
aProxDistTool.ProximityPointsStatus (thePointStatus1, thePointStatus2);
return aProxDistTool.ProximityDistance();
}
//=======================================================================
//function : Perform
//purpose : Performs the computation of the proximity value
//=======================================================================
void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
{
myIsDone = Standard_False;
// max(min) dist from the 1st shape to the 2nd one
BVH_Vec3d aP1_1, aP1_2;
ProxPnt_Status aPointStatus1_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
ProxPnt_Status aPointStatus1_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
Standard_Real aProximityDist1 = computeProximityDist (mySet1, myNbSamples1, mySet2, myShapeList1, myShapeList2,
aP1_1, aP1_2, aPointStatus1_1, aPointStatus1_2);
if (aProximityDist1 < 0.)
return;
// max(min) dist from the 2nd shape to t he 1st one
BVH_Vec3d aP2_1, aP2_2;
ProxPnt_Status aPointStatus2_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
ProxPnt_Status aPointStatus2_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, mySet1, myShapeList2, myShapeList1,
aP2_2, aP2_1, aPointStatus2_2, aPointStatus2_1);
if (aProximityDist2 < 0.)
return;
// min dist of the two max(min) dists
if (aProximityDist1 < aProximityDist2)
{
myDistance = aProximityDist1;
myPnt1.SetCoord(aP1_1.x(), aP1_1.y(), aP1_1.z());
myPnt2.SetCoord(aP1_2.x(), aP1_2.y(), aP1_2.z());
myPntStatus1 = aPointStatus1_1;
myPntStatus2 = aPointStatus1_2;
}
else
{
myDistance = aProximityDist2;
myPnt1.SetCoord(aP2_1.x(), aP2_1.y(), aP2_1.z());
myPnt2.SetCoord(aP2_2.x(), aP2_2.y(), aP2_2.z());
myPntStatus1 = aPointStatus2_1;
myPntStatus2 = aPointStatus2_2;
}
myIsDone = Standard_True;
theTolerance = myDistance;
}

View File

@@ -0,0 +1,126 @@
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// 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 _BRepExtrema_ProximityValueTool_HeaderFile
#define _BRepExtrema_ProximityValueTool_HeaderFile
#include <BRepExtrema_ProximityDistTool.hxx>
#include <BRepExtrema_TriangleSet.hxx>
//! Tool class for computation of the proximity value from one BVH
//! primitive set to another, solving max(min) problem.
//! This tool is not intended to be used independently, and is integrated
//! in other classes, implementing algorithms based on shape tessellation
//! (BRepExtrema_ShapeProximity and BRepExtrema_SelfIntersection).
//!
//! Please note that algorithm results are approximate and depend greatly
//! on the quality of input tessellation(s).
class BRepExtrema_ProximityValueTool
{
public:
typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
public:
//! Creates new unitialized proximity tool.
Standard_EXPORT BRepExtrema_ProximityValueTool();
//! Creates new proximity tool for the given element sets.
Standard_EXPORT BRepExtrema_ProximityValueTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
public:
//! Loads the given element sets into the proximity tool.
Standard_EXPORT void LoadTriangleSets (const Handle (BRepExtrema_TriangleSet)& theSet1,
const Handle (BRepExtrema_TriangleSet)& theSet2);
//! Loads the given list of subshapes into the proximity tool.
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
//! Sets number of sample points used for proximity calculation for each shape.
//! If number is less or equal zero, all triangulation nodes are used.
Standard_EXPORT void SetNbSamplePoints (const Standard_Integer theSamples1 = 0,
const Standard_Integer theSamples2 = 0);
//! Performs the computation of the proximity value.
Standard_EXPORT void Perform (Standard_Real& theTolerance);
//! Is proximity test completed?
Standard_Boolean IsDone() const { return myIsDone; }
//! Marks test results as outdated.
void MarkDirty() { myIsDone = Standard_False; }
//! Returns the computed distance.
Standard_Real Distance() const { return myDistance; }
//! Returns points on triangles sets, which provide the proximity distance.
void ProximityPoints(gp_Pnt& thePoint1, gp_Pnt& thePoint2) const
{
thePoint1 = myPnt1;
thePoint2 = myPnt2;
}
//! Returns status of points on triangles sets, which provide the proximity distance.
void ProximityPointsStatus (ProxPnt_Status& thePointStatus1, ProxPnt_Status& thePointStatus2) const
{
thePointStatus1 = myPntStatus1;
thePointStatus2 = myPntStatus2;
}
private:
//! Returns the computed proximity value from first BVH to another one.
Standard_Real computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2,
BVH_Vec3d& thePoint1,
BVH_Vec3d& thePoint2,
ProxPnt_Status& thePointStatus1,
ProxPnt_Status& thePointStatus2) const;
private:
//! Set of all mesh primitives of the 1st shape.
Handle(BRepExtrema_TriangleSet) mySet1;
//! Set of all mesh primitives of the 2nd shape.
Handle(BRepExtrema_TriangleSet) mySet2;
//! List of subshapes of the 1st shape.
BRepExtrema_ShapeList myShapeList1;
//! List of subshapes of the 2nd shape.
BRepExtrema_ShapeList myShapeList2;
Standard_Real myDistance; //!< Distance
Standard_Boolean myIsDone; //!< State of the algorithm
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
Standard_Integer myNbSamples2; //!< Number of samples points on the second shape
//! Proximity points
gp_Pnt myPnt1, myPnt2;
//! Proximity points' status
ProxPnt_Status myPntStatus1, myPntStatus2;
};
#endif // _BRepExtrema_ProximityValueTool_HeaderFile

View File

@@ -18,6 +18,8 @@
#include <BRepExtrema_OverlapTool.hxx>
#include <TopoDS.hxx>
//! Tool class for detection of self-sections in the given shape.
//! This class is based on BRepExtrema_OverlapTool and thus uses
//! shape tessellation to detect incorrect mesh fragments (pairs
@@ -76,7 +78,7 @@ public:
//! Returns sub-shape from the shape for the given index (started from 0).
const TopoDS_Face& GetSubShape (const Standard_Integer theID) const
{
return myFaceList.Value (theID);
return TopoDS::Face(myFaceList.Value(theID));
}
//! Returns set of all the face triangles of the shape.

View File

@@ -18,6 +18,28 @@
#include <Precision.hxx>
#include <TopExp_Explorer.hxx>
// Assign a map of sub-shapes (edges/faces) of a given shape
static Standard_Boolean initSubShapes(const TopoDS_Shape& theShape,
BRepExtrema_ShapeList& theSubshapesList,
Handle(BRepExtrema_TriangleSet)& theTriangleSet)
{
theSubshapesList.Clear();
for (TopExp_Explorer anIter(theShape, TopAbs_FACE); anIter.More(); anIter.Next())
{
theSubshapesList.Append(anIter.Current());
}
for (TopExp_Explorer anIter(theShape, TopAbs_EDGE); anIter.More(); anIter.Next())
{
theSubshapesList.Append(anIter.Current());
}
if (theTriangleSet.IsNull())
theTriangleSet = new BRepExtrema_TriangleSet;
return theTriangleSet->Init(theSubshapesList);
}
//=======================================================================
//function : BRepExtrema_ShapeProximity
//purpose : Creates uninitialized proximity tool
@@ -25,7 +47,9 @@
BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const Standard_Real theTolerance)
: myTolerance (theTolerance),
myElementSet1 (new BRepExtrema_TriangleSet),
myElementSet2 (new BRepExtrema_TriangleSet)
myElementSet2 (new BRepExtrema_TriangleSet),
myNbSamples1 (0),
myNbSamples2 (0)
{
// Should be initialized later
myIsInitS1 = myIsInitS2 = Standard_False;
@@ -40,7 +64,9 @@ BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const TopoDS_Shape& theS
const Standard_Real theTolerance)
: myTolerance (theTolerance),
myElementSet1 (new BRepExtrema_TriangleSet),
myElementSet2 (new BRepExtrema_TriangleSet)
myElementSet2 (new BRepExtrema_TriangleSet),
myNbSamples1 (0),
myNbSamples2 (0)
{
LoadShape1 (theShape1);
LoadShape2 (theShape2);
@@ -52,16 +78,18 @@ BRepExtrema_ShapeProximity::BRepExtrema_ShapeProximity (const TopoDS_Shape& theS
//=======================================================================
Standard_Boolean BRepExtrema_ShapeProximity::LoadShape1 (const TopoDS_Shape& theShape1)
{
myFaceList1.Clear();
myIsInitS1 = initSubShapes(theShape1, myShapeList1, myElementSet1);
for (TopExp_Explorer anIter (theShape1, TopAbs_FACE); anIter.More(); anIter.Next())
if (myTolerance == Precision::Infinite())
{
myFaceList1.Append (static_cast<const TopoDS_Face&> (anIter.Current()));
myProxValTool.MarkDirty();
}
else
{
myOverlapTool.MarkDirty();
}
myOverlapTool.MarkDirty();
return myIsInitS1 = myElementSet1->Init (myFaceList1);
return myIsInitS1;
}
//=======================================================================
@@ -70,16 +98,18 @@ Standard_Boolean BRepExtrema_ShapeProximity::LoadShape1 (const TopoDS_Shape& the
//=======================================================================
Standard_Boolean BRepExtrema_ShapeProximity::LoadShape2 (const TopoDS_Shape& theShape2)
{
myFaceList2.Clear();
myIsInitS2 = initSubShapes(theShape2, myShapeList2, myElementSet2);
for (TopExp_Explorer anIter (theShape2, TopAbs_FACE); anIter.More(); anIter.Next())
if (myTolerance == Precision::Infinite())
{
myFaceList2.Append (static_cast<const TopoDS_Face&> (anIter.Current()));
myProxValTool.MarkDirty();
}
else
{
myOverlapTool.MarkDirty();
}
myOverlapTool.MarkDirty();
return myIsInitS2 = myElementSet2->Init (myFaceList2);
return myIsInitS2;
}
//=======================================================================
@@ -88,13 +118,32 @@ Standard_Boolean BRepExtrema_ShapeProximity::LoadShape2 (const TopoDS_Shape& the
//=======================================================================
void BRepExtrema_ShapeProximity::Perform()
{
if (!myIsInitS1 || !myIsInitS2 || myOverlapTool.IsDone())
if (myTolerance == Precision::Infinite())
{
return;
if (!myIsInitS1 || !myIsInitS2 || myProxValTool.IsDone())
{
return;
}
myProxValTool.LoadTriangleSets (myElementSet1,
myElementSet2);
myProxValTool.LoadShapeLists (myShapeList1,
myShapeList2);
myProxValTool.Perform (myTolerance);
myProxValTool.ProximityPoints(myProxPoint1, myProxPoint2);
myProxValTool.ProximityPointsStatus (myProxPntStatus1, myProxPntStatus2);
}
else
{
if (!myIsInitS1 || !myIsInitS2 || myOverlapTool.IsDone())
{
return;
}
myOverlapTool.LoadTriangleSets (myElementSet1,
myElementSet2);
myOverlapTool.LoadTriangleSets (myElementSet1,
myElementSet2);
myOverlapTool.Perform (myTolerance);
myOverlapTool.Perform (myTolerance);
}
}

View File

@@ -16,31 +16,48 @@
#ifndef _BRepExtrema_ShapeProximity_HeaderFile
#define _BRepExtrema_ShapeProximity_HeaderFile
#include <NCollection_DataMap.hxx>
#include <Precision.hxx>
#include <TColStd_PackedMapOfInteger.hxx>
#include <BRepExtrema_ProximityValueTool.hxx>
#include <BRepExtrema_TriangleSet.hxx>
#include <BRepExtrema_OverlapTool.hxx>
//! Tool class for shape proximity detection.
//! @brief Tool class for shape proximity detection.
//!
//! First approach:
//! For two given shapes and given tolerance (offset from the mesh) the algorithm allows
//! to determine whether or not they are overlapped. The algorithm input consists of any
//! shapes which can be decomposed into individual faces (used as basic shape elements).
//! High performance is achieved through the use of existing triangulation of faces. So
//! poly triangulation (with the desired deflection) should already be built. Note that
//! solution is approximate (and corresponds to the deflection used for triangulation).
//!
//! The algorithm can be run in two modes. If tolerance is set to zero, the algorithm
//! will detect only intersecting faces (containing triangles with common points). If
//! tolerance is set to positive value, the algorithm will also detect faces located
//! on distance less than the given tolerance from each other.
//!
//! Second approach:
//! Compute the proximity value between two shapes if the tolerance is not defined (Precision::Infinite()).
//! In this case the proximity value is a minimal thickness of a layer containing both shapes.
//!
//! For the both approaches the high performance is achieved through the use of existing
//! triangulation of faces. So, poly triangulation (with the desired deflection) should already
//! be built. Note that solution is approximate (and corresponds to the deflection used for
//! triangulation).
class BRepExtrema_ShapeProximity
{
public:
typedef typename BRepExtrema_ProximityValueTool::ProxPnt_Status ProxPnt_Status;
public:
//! Creates empty proximity tool.
Standard_EXPORT BRepExtrema_ShapeProximity (const Standard_Real theTolerance = 0.0);
Standard_EXPORT BRepExtrema_ShapeProximity (const Standard_Real theTolerance = Precision::Infinite());
//! Creates proximity tool for the given two shapes.
Standard_EXPORT BRepExtrema_ShapeProximity (const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
const Standard_Real theTolerance = 0.0);
const Standard_Real theTolerance = Precision::Infinite());
public:
@@ -56,19 +73,33 @@ public:
myTolerance = theTolerance;
}
//! Returns proximity value calculated for the whole input shapes.
Standard_Real Proximity() const
{
return Tolerance();
}
//! Loads 1st shape into proximity tool.
Standard_EXPORT Standard_Boolean LoadShape1 (const TopoDS_Shape& theShape1);
//! Loads 2nd shape into proximity tool.
Standard_EXPORT Standard_Boolean LoadShape2 (const TopoDS_Shape& theShape2);
//! Set number of sample points on the 1st shape used to compute the proximity value.
//! In case of 0, all triangulation nodes will be used.
void SetNbSamples1(const Standard_Integer theNbSamples) { myNbSamples1 = theNbSamples; }
//! Set number of sample points on the 2nd shape used to compute the proximity value.
//! In case of 0, all triangulation nodes will be used.
void SetNbSamples2(const Standard_Integer theNbSamples) { myNbSamples2 = theNbSamples; }
//! Performs search of overlapped faces.
Standard_EXPORT void Perform();
//! True if the search is completed.
Standard_Boolean IsDone() const
{
return myOverlapTool.IsDone();
return myOverlapTool.IsDone() || myProxValTool.IsDone();
}
//! Returns set of IDs of overlapped faces of 1st shape (started from 0).
@@ -84,15 +115,15 @@ public:
}
//! Returns sub-shape from 1st shape with the given index (started from 0).
const TopoDS_Face& GetSubShape1 (const Standard_Integer theID) const
const TopoDS_Shape& GetSubShape1 (const Standard_Integer theID) const
{
return myFaceList1.Value (theID);
return myShapeList1.Value (theID);
}
//! Returns sub-shape from 1st shape with the given index (started from 0).
const TopoDS_Face& GetSubShape2 (const Standard_Integer theID) const
const TopoDS_Shape& GetSubShape2 (const Standard_Integer theID) const
{
return myFaceList2.Value (theID);
return myShapeList2.Value (theID);
}
//! Returns set of all the face triangles of the 1st shape.
@@ -107,6 +138,34 @@ public:
return myElementSet2;
}
//! Returns the point on the 1st shape, which could be used as a reference point
//! for the value of the proximity.
const gp_Pnt& ProximityPoint1() const
{
return myProxPoint1;
}
//! Returns the point on the 2nd shape, which could be used as a reference point
//! for the value of the proximity.
const gp_Pnt& ProximityPoint2() const
{
return myProxPoint2;
}
//! Returns the status of point on the 1st shape, which could be used as a reference point
//! for the value of the proximity.
const ProxPnt_Status& ProxPntStatus1() const
{
return myProxPntStatus1;
}
//! Returns the status of point on the 2nd shape, which could be used as a reference point
//! for the value of the proximity.
const ProxPnt_Status& ProxPntStatus2() const
{
return myProxPntStatus2;
}
private:
//! Maximum overlapping distance.
@@ -117,19 +176,39 @@ private:
//! Is the 2nd shape initialized?
Standard_Boolean myIsInitS2;
//! List of faces of the 1st shape.
BRepExtrema_ShapeList myFaceList1;
//! List of faces of the 2nd shape.
BRepExtrema_ShapeList myFaceList2;
//! List of subshapes of the 1st shape.
BRepExtrema_ShapeList myShapeList1;
//! List of subshapes of the 2nd shape.
BRepExtrema_ShapeList myShapeList2;
//! Set of all the face triangles of the 1st shape.
Handle(BRepExtrema_TriangleSet) myElementSet1;
//! Set of all the face triangles of the 2nd shape.
Handle(BRepExtrema_TriangleSet) myElementSet2;
//! Number of sample points on the 1st shape used to compute the proximity value
//! (if zero (default), all triangulation nodes will be used).
Standard_Integer myNbSamples1;
//! Number of sample points on the 2nd shape used to compute the proximity value
//! (if zero (default), all triangulation nodes will be used).
Standard_Integer myNbSamples2;
//! Reference point of the proximity value on the 1st shape.
gp_Pnt myProxPoint1;
//! Reference point of the proximity value on the 2st shape.
gp_Pnt myProxPoint2;
//! Status of reference points of the proximity value.
ProxPnt_Status myProxPntStatus1, myProxPntStatus2;
//! Overlap tool used for intersection/overlap test.
BRepExtrema_OverlapTool myOverlapTool;
//! Shape-shape proximity tool used for computation of
//! the minimal diameter of a tube containing both edges or
//! the minimal thickness of a shell containing both faces.
BRepExtrema_ProximityValueTool myProxValTool;
};
#endif // _BRepExtrema_ShapeProximity_HeaderFile

View File

@@ -18,6 +18,7 @@
#include <BRep_Tool.hxx>
#include <BVH_LinearBuilder.hxx>
#include <Poly_Triangulation.hxx>
#include <TopoDS.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)
@@ -114,17 +115,65 @@ void BRepExtrema_TriangleSet::Swap (const Standard_Integer theIndex1, const Stan
{
std::swap (myTriangles[theIndex1],
myTriangles[theIndex2]);
std::swap (myTrgIdxMap (theIndex1),
myTrgIdxMap (theIndex2));
}
//=======================================================================
//function : GetFaceID
//purpose : Returns face ID of the given triangle
//purpose : Returns face ID of the given vertex
//=======================================================================
Standard_Integer BRepExtrema_TriangleSet::GetFaceID (const Standard_Integer theIndex) const
{
return myTriangles[theIndex].w();
}
//=======================================================================
//function : GetShapeIDOfVtx
//purpose : Returns shape ID of the given vertex index
//=======================================================================
Standard_Integer BRepExtrema_TriangleSet::GetShapeIDOfVtx (const Standard_Integer theIndex) const
{
return myShapeIdxOfVtxVec.Value (theIndex);
}
//=======================================================================
//function : GetVtxIdxInShape
//purpose : Returns vertex index in tringulation of the shape, which vertex belongs,
// with the given vtx ID in whole set
//=======================================================================
Standard_Integer BRepExtrema_TriangleSet::GetVtxIdxInShape (const Standard_Integer theIndex) const
{
Standard_Integer aShID = myShapeIdxOfVtxVec.Value (theIndex);
Standard_Integer aNumVertices = 0;
for (Standard_Integer aSIdx = 0; aSIdx < aShID; aSIdx++)
{
aNumVertices += myNumVtxInShapeVec.Value (aSIdx);
}
return theIndex - aNumVertices;
}
//=======================================================================
//function : GetTrgIdxInShape
//purpose : Returns triangle index (before swapping) in tringulation of the shape, which triangle belongs,
// with the given trg ID in whole set (after swapping)
//=======================================================================
Standard_Integer BRepExtrema_TriangleSet::GetTrgIdxInShape (const Standard_Integer theIndex) const
{
Standard_Integer aShID = GetFaceID (theIndex);
Standard_Integer aNumTriangles = 0;
for (Standard_Integer aSIdx = 0; aSIdx < aShID; aSIdx++)
{
aNumTriangles += myNumTrgInShapeVec.Value (aSIdx);
}
return myTrgIdxMap (theIndex) - aNumTriangles;
}
//=======================================================================
//function : GetVertices
//purpose : Returns vertices of the given triangle
@@ -141,6 +190,21 @@ void BRepExtrema_TriangleSet::GetVertices (const Standard_Integer theIndex,
theVertex3 = myVertexArray[aTriangle.z()];
}
//=======================================================================
//function : GetVertices
//purpose : Returns vertices of the given triangle
//=======================================================================
void BRepExtrema_TriangleSet::GetVtxIndices (const Standard_Integer theIndex,
NCollection_Array1<Standard_Integer>& theVtxIndices) const
{
BVH_Vec4i aTriangle = myTriangles[theIndex];
theVtxIndices = NCollection_Array1<Standard_Integer> (0, 2);
theVtxIndices.SetValue (0, aTriangle.x());
theVtxIndices.SetValue (1, aTriangle.y());
theVtxIndices.SetValue (2, aTriangle.z());
}
//=======================================================================
//function : Clear
//purpose : Clears triangle set data
@@ -158,41 +222,26 @@ void BRepExtrema_TriangleSet::Clear()
//function : Init
//purpose : Initializes triangle set
//=======================================================================
Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& theFaces)
Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& theShapes)
{
Clear();
for (Standard_Integer aFaceIdx = 0; aFaceIdx < theFaces.Size(); ++aFaceIdx)
Standard_Boolean isOK = Standard_True;
for (Standard_Integer aShapeIdx = 0; aShapeIdx < theShapes.Size() && isOK; ++aShapeIdx)
{
TopLoc_Location aLocation;
if (theShapes (aShapeIdx).ShapeType() == TopAbs_FACE)
isOK = initFace (TopoDS::Face (theShapes(aShapeIdx)), aShapeIdx);
else if (theShapes (aShapeIdx).ShapeType() == TopAbs_EDGE)
isOK = initEdge (TopoDS::Edge (theShapes(aShapeIdx)), aShapeIdx);
}
Handle(Poly_Triangulation) aTriangulation =
BRep_Tool::Triangulation (theFaces (aFaceIdx), aLocation);
Standard_Integer aNumTrg = static_cast<Standard_Integer> (myTriangles.size());
myTrgIdxMap.Clear();
myTrgIdxMap.ReSize (aNumTrg);
if (aTriangulation.IsNull())
{
return Standard_False;
}
const Standard_Integer aVertOffset =
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
for (Standard_Integer aVertIdx = 1; aVertIdx <= aTriangulation->NbNodes(); ++aVertIdx)
{
gp_Pnt aVertex = aTriangulation->Node (aVertIdx);
aVertex.Transform (aLocation.Transformation());
myVertexArray.push_back (BVH_Vec3d (aVertex.X(), aVertex.Y(), aVertex.Z()));
}
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)
{
Standard_Integer aVertex1, aVertex2, aVertex3;
aTriangulation->Triangle (aTriIdx).Get (aVertex1, aVertex2, aVertex3);
myTriangles.push_back (BVH_Vec4i (aVertex1 + aVertOffset,
aVertex2 + aVertOffset,
aVertex3 + aVertOffset,
aFaceIdx));
}
for (Standard_Integer aTrgIdx = 0; aTrgIdx < aNumTrg; ++aTrgIdx)
{
myTrgIdxMap.Bind (aTrgIdx, aTrgIdx);
}
MarkDirty(); // needs BVH rebuilding
@@ -203,3 +252,95 @@ Standard_Boolean BRepExtrema_TriangleSet::Init (const BRepExtrema_ShapeList& the
return Standard_True;
}
//=======================================================================
//function : initFace
//purpose : Initializes triangle set
//=======================================================================
Standard_Boolean BRepExtrema_TriangleSet::initFace (const TopoDS_Face& theFace, const Standard_Integer theIndex)
{
TopLoc_Location aLocation;
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (theFace, aLocation);
if (aTriangulation.IsNull())
{
return Standard_False;
}
const Standard_Integer aVertOffset =
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
initNodes (aTriangulation->MapNodeArray()->ChangeArray1(), aLocation.Transformation(), theIndex);
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTriangulation->NbTriangles(); ++aTriIdx)
{
Standard_Integer aVertex1;
Standard_Integer aVertex2;
Standard_Integer aVertex3;
aTriangulation->Triangle (aTriIdx).Get (aVertex1,
aVertex2,
aVertex3);
myTriangles.push_back (BVH_Vec4i (aVertex1 + aVertOffset,
aVertex2 + aVertOffset,
aVertex3 + aVertOffset,
theIndex));
}
myNumTrgInShapeVec.SetValue (theIndex, aTriangulation->NbTriangles());
return Standard_True;
}
//=======================================================================
//function : initEdge
//purpose : Initializes triangle set
//=======================================================================
Standard_Boolean BRepExtrema_TriangleSet::initEdge (const TopoDS_Edge& theEdge, const Standard_Integer theIndex)
{
TopLoc_Location aLocation;
Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (theEdge, aLocation);
if (aPolygon.IsNull())
{
return Standard_False;
}
const Standard_Integer aVertOffset =
static_cast<Standard_Integer> (myVertexArray.size()) - 1;
initNodes (aPolygon->Nodes(), aLocation.Transformation(), theIndex);
for (Standard_Integer aVertIdx = 1; aVertIdx < aPolygon->NbNodes(); ++aVertIdx)
{
// segment as degenerate triangle
myTriangles.push_back (BVH_Vec4i (aVertIdx + aVertOffset,
aVertIdx + aVertOffset + 1,
aVertIdx + aVertOffset + 1,
theIndex));
}
return Standard_True;
}
//=======================================================================
//function : initNodes
//purpose : Initializes nodes
//=======================================================================
void BRepExtrema_TriangleSet::initNodes (const TColgp_Array1OfPnt& theNodes,
const gp_Trsf& theTrsf,
const Standard_Integer theIndex)
{
for (Standard_Integer aVertIdx = 1; aVertIdx <= theNodes.Size(); ++aVertIdx)
{
gp_Pnt aVertex = theNodes.Value (aVertIdx);
aVertex.Transform (theTrsf);
myVertexArray.push_back (BVH_Vec3d (aVertex.X(),
aVertex.Y(),
aVertex.Z()));
myShapeIdxOfVtxVec.Append (theIndex);
}
myNumVtxInShapeVec.SetValue (theIndex, theNodes.Size());
}

View File

@@ -16,11 +16,14 @@
#ifndef _BRepExtrema_TriangleSet_HeaderFile
#define _BRepExtrema_TriangleSet_HeaderFile
#include <TopoDS_Face.hxx>
#include <BVH_PrimitiveSet3d.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
//! List of shapes and their IDs for collision detection.
typedef NCollection_Vector<TopoDS_Face> BRepExtrema_ShapeList;
typedef NCollection_Vector<TopoDS_Shape> BRepExtrema_ShapeList;
//! Triangle set corresponding to specific face.
class BRepExtrema_TriangleSet : public BVH_PrimitiveSet3d
@@ -59,7 +62,10 @@ public:
Standard_EXPORT void Clear();
//! Initializes triangle set.
Standard_EXPORT Standard_Boolean Init (const BRepExtrema_ShapeList& theFaces);
Standard_EXPORT Standard_Boolean Init (const BRepExtrema_ShapeList& theShapes);
//! Returns all vertices.
Standard_EXPORT const BVH_Array3d& GetVertices() const { return myVertexArray; }
//! Returns vertices of the given triangle.
Standard_EXPORT void GetVertices (const Standard_Integer theIndex,
@@ -67,9 +73,37 @@ public:
BVH_Vec3d& theVertex2,
BVH_Vec3d& theVertex3) const;
//! Returns vertex indices of the given triangle.
Standard_EXPORT void GetVtxIndices (const Standard_Integer theIndex,
NCollection_Array1<Standard_Integer>& theVtxIndices) const;
//! Returns face ID of the given triangle.
Standard_EXPORT Standard_Integer GetFaceID (const Standard_Integer theIndex) const;
//! Returns shape ID of the given vertex index.
Standard_EXPORT Standard_Integer GetShapeIDOfVtx (const Standard_Integer theIndex) const;
//! Returns vertex index in tringulation of the shape, which vertex belongs,
//! with the given vtx ID in whole set.
Standard_EXPORT Standard_Integer GetVtxIdxInShape (const Standard_Integer theIndex) const;
//! Returns triangle index (before swapping) in tringulation of the shape, which triangle belongs,
//! with the given trg ID in whole set (after swapping).
Standard_EXPORT Standard_Integer GetTrgIdxInShape (const Standard_Integer theIndex) const;
private:
//! Initializes triangle set from the face
Standard_Boolean initFace (const TopoDS_Face& theFace, const Standard_Integer theIndex);
//! Initializes polygon from the edge
Standard_Boolean initEdge (const TopoDS_Edge& theEdge, const Standard_Integer theIndex);
//! Initializes nodes
void initNodes (const TColgp_Array1OfPnt& theNodes,
const gp_Trsf& theTrsf,
const Standard_Integer theIndex);
protected:
//! Array of vertex indices.
@@ -78,6 +112,19 @@ protected:
//! Array of vertex coordinates.
BVH_Array3d myVertexArray;
//! Vector of shapes' indices where index of item corresponds to index of vertex,
//! belonging to this shape.
NCollection_Vector<Standard_Integer> myShapeIdxOfVtxVec;
//! Vector of vertexes' number belonging to shape which index corresponds item's index.
NCollection_Vector<Standard_Integer> myNumVtxInShapeVec;
//! Vector of triangles' number belonging to shape which index corresponds item's index.
NCollection_Vector<Standard_Integer> myNumTrgInShapeVec;
//! Map of triangles' indices after (key) and before (value) swapping.
TColStd_DataMapOfIntegerInteger myTrgIdxMap;
public:
DEFINE_STANDARD_RTTIEXT(BRepExtrema_TriangleSet, BVH_PrimitiveSet3d)

View File

@@ -18,6 +18,10 @@ BRepExtrema_OverlapTool.cxx
BRepExtrema_OverlapTool.hxx
BRepExtrema_Poly.cxx
BRepExtrema_Poly.hxx
BRepExtrema_ProximityValueTool.cxx
BRepExtrema_ProximityValueTool.hxx
BRepExtrema_ProximityDistTool.cxx
BRepExtrema_ProximityDistTool.hxx
BRepExtrema_SelfIntersection.cxx
BRepExtrema_SelfIntersection.hxx
BRepExtrema_SeqOfSolution.hxx

View File

@@ -0,0 +1,45 @@
// Created on: 2022-09-07
// Copyright (c) 2022 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 <BRepMesh_ExtrusionRangeSplitter.hxx>
//=======================================================================
// Function: getUndefinedIntervalNb
// Purpose :
//=======================================================================
Standard_Integer BRepMesh_ExtrusionRangeSplitter::getUndefinedIntervalNb(
const Handle(Adaptor3d_Surface)& theSurface,
const Standard_Boolean /*isU*/,
const GeomAbs_Shape theContinuity) const
{
// Here we need just a regular grid along dimension with no
// geometrical data regarding intervals like extrusion surface.
const Handle(Adaptor3d_Curve) aCurve = theSurface->BasisCurve();
Standard_Integer aIntervalsNb = aCurve->NbIntervals(theContinuity);
if (aIntervalsNb == 1)
{
const GeomAbs_CurveType aCurveType = aCurve->GetType();
const Standard_Boolean isBSplineCurve =
aCurveType == GeomAbs_BezierCurve ||
aCurveType == GeomAbs_BSplineCurve;
if (isBSplineCurve)
{
aIntervalsNb = aCurve->NbPoles() - 1;
}
}
return aIntervalsNb;
}

View File

@@ -0,0 +1,45 @@
// Created on: 2022-09-07
// Copyright (c) 2022 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 _BRepMesh_ExtrusionRangeSplitter_HeaderFile
#define _BRepMesh_ExtrusionRangeSplitter_HeaderFile
#include <BRepMesh_NURBSRangeSplitter.hxx>
//! Auxiliary class analysing extrusion surface in order to generate internal nodes.
class BRepMesh_ExtrusionRangeSplitter : public BRepMesh_NURBSRangeSplitter
{
public:
//! Constructor.
BRepMesh_ExtrusionRangeSplitter()
{
}
//! Destructor.
virtual ~BRepMesh_ExtrusionRangeSplitter()
{
}
protected:
//! Returns number of intervals computed using available geometrical parameters.
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
const Handle(Adaptor3d_Surface)& theSurface,
const Standard_Boolean isU,
const GeomAbs_Shape theContinuity) const Standard_OVERRIDE;
};
#endif

View File

@@ -21,6 +21,8 @@
#include <BRepMesh_DelaunayBaseMeshAlgo.hxx>
#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
#include <BRepMesh_ExtrusionRangeSplitter.hxx>
#include <BRepMesh_UndefinedRangeSplitter.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_MeshAlgoFactory, IMeshTools_MeshAlgoFactory)
@@ -98,7 +100,18 @@ Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo(
return new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
break;
default:
case GeomAbs_SurfaceOfExtrusion:
return new DeflectionControlMeshAlgo<BRepMesh_ExtrusionRangeSplitter>::Type;
break;
case GeomAbs_BezierSurface:
case GeomAbs_BSplineSurface:
return new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
break;
case GeomAbs_OffsetSurface:
case GeomAbs_OtherSurface:
default:
return new DeflectionControlMeshAlgo<BRepMesh_UndefinedRangeSplitter>::Type;
}
}

View File

@@ -392,27 +392,73 @@ Handle(IMeshData::ListOfPnt2d) BRepMesh_NURBSRangeSplitter::GenerateSurfaceNodes
return aNodes;
}
//=======================================================================
// Function: getUndefinedIntervalNb
// Purpose :
//=======================================================================
Standard_Integer BRepMesh_NURBSRangeSplitter::getUndefinedIntervalNb(
const Handle(Adaptor3d_Surface)& theSurface,
const Standard_Boolean isU,
const GeomAbs_Shape /*theContinuity*/) const
{
return (isU ? theSurface->NbUPoles() : theSurface->NbVPoles()) - 1;
}
//=======================================================================
// Function: getUndefinedInterval
// Purpose :
//=======================================================================
void BRepMesh_NURBSRangeSplitter::getUndefinedInterval(
const Handle(Adaptor3d_Surface)& theSurface,
const Standard_Boolean isU,
const GeomAbs_Shape theContinuity,
const std::pair<Standard_Real, Standard_Real>& theRange,
TColStd_Array1OfReal& theIntervals) const
{
Standard_Integer aIntervalsNb = isU ?
theSurface->NbUIntervals(theContinuity) :
theSurface->NbVIntervals(theContinuity);
if (aIntervalsNb == 1)
{
aIntervalsNb = getUndefinedIntervalNb(theSurface, isU, theContinuity);
if (aIntervalsNb > 1)
{
theIntervals = TColStd_Array1OfReal(1, aIntervalsNb - 1);
const Standard_Real aDiff = (theRange.second - theRange.first) / aIntervalsNb;
for (Standard_Integer i = theIntervals.Lower(); i <= theIntervals.Upper(); ++i)
{
theIntervals.SetValue(i, theRange.first + i * aDiff);
}
}
}
if (theIntervals.IsEmpty())
{
theIntervals = TColStd_Array1OfReal(1, aIntervalsNb + 1);
if (isU)
{
theSurface->UIntervals(theIntervals, theContinuity);
}
else
{
theSurface->VIntervals(theIntervals, theContinuity);
}
}
}
//=======================================================================
// Function: initParameters
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_NURBSRangeSplitter::initParameters() const
{
const GeomAbs_Shape aContinuity = GeomAbs_CN;
const Handle(BRepAdaptor_Surface)& aSurface = GetSurface();
const GeomAbs_Shape aContinuity = GeomAbs_CN;
const std::pair<Standard_Integer, Standard_Integer> aIntervalsNb(
aSurface->NbUIntervals(aContinuity),
aSurface->NbVIntervals(aContinuity)
);
TColStd_Array1OfReal aIntervals[2] = {
TColStd_Array1OfReal(1, aIntervalsNb.first + 1),
TColStd_Array1OfReal(1, aIntervalsNb.second + 1)
};
aSurface->UIntervals(aIntervals[0], aContinuity);
aSurface->VIntervals(aIntervals[1], aContinuity);
TColStd_Array1OfReal aIntervals[2];
getUndefinedInterval(aSurface, Standard_True, aContinuity, GetRangeU(), aIntervals[0]);
getUndefinedInterval(aSurface, Standard_False, aContinuity, GetRangeV(), aIntervals[1]);
const Standard_Boolean isSplitIntervals = toSplitIntervals (aSurface->Surface().Surface(), aIntervals);
@@ -507,12 +553,17 @@ Handle(IMeshData::SequenceOfReal) BRepMesh_NURBSRangeSplitter::computeGrainAndFi
aMinDiff /= theDelta;
}
aMinDiff = Max(theParameters.MinSize, aMinDiff);
const Handle(BRepAdaptor_Surface)& aSurface = GetSurface();
const Standard_Real aMinSize2d = Max(
aSurface->UResolution(theParameters.MinSize),
aSurface->UResolution(theParameters.MinSize));
aMinDiff = Max(aMinSize2d, aMinDiff);
const Standard_Real aDiffMaxLim = 0.1 * theRangeDiff;
const Standard_Real aDiffMinLim = Max(0.005 * theRangeDiff,
2. * theTol2d);
const Standard_Real aDiff = Max(theParameters.MinSize,
const Standard_Real aDiff = Max(aMinSize2d,
Min(aDiffMaxLim, aDiffMinLim));
return filterParameters(theSourceParams, aMinDiff, aDiff, theAllocator);
}

View File

@@ -49,7 +49,21 @@ protected:
//! Initializes U and V parameters lists using CN continuity intervals.
Standard_EXPORT virtual Standard_Boolean initParameters() const;
//! Returns number of intervals computed using available geometrical parameters.
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
const Handle(Adaptor3d_Surface)& theSurface,
const Standard_Boolean isU,
const GeomAbs_Shape theContinuity) const;
private:
//! Tries to compute intervals even for cases with no intervals
//! at all using available geometrical parameters.
void getUndefinedInterval(
const Handle(Adaptor3d_Surface)& theSurface,
const Standard_Boolean isU,
const GeomAbs_Shape theContinuity,
const std::pair<Standard_Real, Standard_Real>& theRange,
TColStd_Array1OfReal& theIntervals) const;
//! Computes parameters of filter and applies it to the source parameters.
Handle(IMeshData::SequenceOfReal) computeGrainAndFilterParameters(

View File

@@ -0,0 +1,28 @@
// Created on: 2022-09-07
// Copyright (c) 2022 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 <BRepMesh_UndefinedRangeSplitter.hxx>
//=======================================================================
// Function: getUndefinedIntervalNb
// Purpose :
//=======================================================================
Standard_Integer BRepMesh_UndefinedRangeSplitter::getUndefinedIntervalNb(
const Handle(Adaptor3d_Surface)& /*theSurface*/,
const Standard_Boolean /*isU*/,
const GeomAbs_Shape /*theContinuity*/) const
{
return 1;
}

View File

@@ -0,0 +1,46 @@
// Created on: 2022-09-07
// Copyright (c) 2022 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 _BRepMesh_UndefinedRangeSplitter_HeaderFile
#define _BRepMesh_UndefinedRangeSplitter_HeaderFile
#include <BRepMesh_NURBSRangeSplitter.hxx>
//! Auxiliary class provides safe value for surfaces that looks like NURBS
//! but has no poles or other characteristics.
class BRepMesh_UndefinedRangeSplitter : public BRepMesh_NURBSRangeSplitter
{
public:
//! Constructor.
BRepMesh_UndefinedRangeSplitter()
{
}
//! Destructor.
virtual ~BRepMesh_UndefinedRangeSplitter()
{
}
protected:
//! Returns number of intervals computed using available geometrical parameters.
Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
const Handle(Adaptor3d_Surface)& theSurface,
const Standard_Boolean isU,
const GeomAbs_Shape theContinuity) const Standard_OVERRIDE;
};
#endif

View File

@@ -40,6 +40,8 @@ BRepMesh_EdgeDiscret.hxx
BRepMesh_EdgeParameterProvider.hxx
BRepMesh_EdgeTessellationExtractor.cxx
BRepMesh_EdgeTessellationExtractor.hxx
BRepMesh_ExtrusionRangeSplitter.cxx
BRepMesh_ExtrusionRangeSplitter.hxx
BRepMesh_FaceChecker.cxx
BRepMesh_FaceChecker.hxx
BRepMesh_FaceDiscret.cxx
@@ -80,6 +82,8 @@ BRepMesh_SphereRangeSplitter.hxx
BRepMesh_TorusRangeSplitter.cxx
BRepMesh_TorusRangeSplitter.hxx
BRepMesh_Triangle.hxx
BRepMesh_UndefinedRangeSplitter.cxx
BRepMesh_UndefinedRangeSplitter.hxx
BRepMesh_UVParamRangeSplitter.hxx
BRepMesh_Vertex.hxx
BRepMesh_VertexInspector.hxx

View File

@@ -60,8 +60,8 @@ static Standard_Boolean NeedsConvertion (const TopoDS_Wire& theWire)
return Standard_False;
}
static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
const Standard_Real theAngleTolerance)
TopoDS_Face BRepOffsetAPI_MakeOffset::ConvertFace (const TopoDS_Face& theFace,
const Standard_Real theAngleTolerance)
{
TopAbs_Orientation anOr = theFace.Orientation();
TopoDS_Face aFace = theFace;
@@ -76,6 +76,7 @@ static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
if (NeedsConvertion (aWire))
{
TopAbs_Orientation anOrOfWire = aWire.Orientation();
aWire.Orientation (TopAbs_FORWARD);
aWire = BRepAlgo::ConvertWire (aWire, theAngleTolerance, aFace);
BRepLib::BuildCurves3d (aWire);
aWire.Orientation (anOrOfWire);
@@ -352,7 +353,7 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
{
if (myIsToApprox)
{
Standard_Real aTol = 0.01;
Standard_Real aTol = 0.1;
if (myFace.IsNull())
{
TopoDS_Face aFace;

View File

@@ -84,7 +84,10 @@ public:
//! from the shape <S>.
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
//! Converts each wire of the face into contour consisting only of
//! arcs and segments. New 3D curves are built too.
Standard_EXPORT static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
const Standard_Real theAngleTolerance);
protected:

View File

@@ -173,7 +173,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
{
if (theNbArgs < 3 || theNbArgs > 6)
{
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value>] [-profile]";
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value> | -value] [-profile]";
return 1;
}
@@ -186,9 +186,11 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
return 1;
}
BRepExtrema_ShapeProximity aTool;
BRepExtrema_ShapeProximity aTool(0.0);
Standard_Boolean aProfile = Standard_False;
Standard_Boolean isTolerance = Standard_False;
Standard_Boolean isValue = Standard_False;
for (Standard_Integer anArgIdx = 3; anArgIdx < theNbArgs; ++anArgIdx)
{
@@ -197,6 +199,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
if (aFlag == "-tol")
{
isTolerance = Standard_True;
if (++anArgIdx >= theNbArgs)
{
Message::SendFail() << "Error: wrong syntax at argument '" << aFlag;
@@ -214,13 +217,23 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
aTool.SetTolerance (aTolerance);
}
}
if (aFlag == "-profile")
else if (aFlag == "-value")
{
isValue = Standard_True;
aTool.SetTolerance(Precision::Infinite());
}
else if (aFlag == "-profile")
{
aProfile = Standard_True;
}
}
if (isTolerance && isValue)
{
Message::SendFail() << "Error: Proximity value could not be computed if the tolerance is set";
return 1;
}
Standard_Real aInitTime = 0.0;
Standard_Real aWorkTime = 0.0;
@@ -264,39 +277,74 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
theDI << "Executing proximity test: " << aWorkTime << "\n";
}
TopoDS_Builder aCompBuilder;
TopoDS_Compound aFaceCompound1;
aCompBuilder.MakeCompound (aFaceCompound1);
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1 (aTool.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
if (isValue)
{
TCollection_AsciiString aStr = TCollection_AsciiString (theArgs[1]) + "_" + (anIt1.Key() + 1);
theDI << "Proximity value: " << aTool.Proximity() << "\n";
const TopoDS_Face& aFace = aTool.GetSubShape1 (anIt1.Key());
aCompBuilder.Add (aFaceCompound1, aFace);
DBRep::Set (aStr.ToCString(), aFace);
// proximity points
TopoDS_Vertex aProxVtx1 = BRepLib_MakeVertex (aTool.ProximityPoint1());
TopoDS_Vertex aProxVtx2 = BRepLib_MakeVertex (aTool.ProximityPoint2());
theDI << aStr << " \n";
DBRep::Set ("ProxPnt1", aProxVtx1);
DBRep::Set ("ProxPnt2", aProxVtx2);
// proximity points' status
TCollection_AsciiString ProxPntStatus1;
TCollection_AsciiString ProxPntStatus2;
switch (aTool.ProxPntStatus1())
{
case 0: ProxPntStatus1 = "Border"; break;
case 1: ProxPntStatus1 = "Middle"; break;
default: ProxPntStatus1 = "Unknown";
}
switch (aTool.ProxPntStatus2())
{
case 0: ProxPntStatus2 = "Border"; break;
case 1: ProxPntStatus2 = "Middle"; break;
default: ProxPntStatus2 = "Unknown";
}
theDI << " Status of ProxPnt1 on " << theArgs[1] << " : " << ProxPntStatus1 << "\n";
theDI << " Status of ProxPnt2 on " << theArgs[2] << " : " << ProxPntStatus2 << "\n";
}
TopoDS_Compound aFaceCompound2;
aCompBuilder.MakeCompound (aFaceCompound2);
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2 (aTool.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
else
{
TCollection_AsciiString aStr = TCollection_AsciiString (theArgs[2]) + "_" + (anIt2.Key() + 1);
TopoDS_Builder aCompBuilder;
const TopoDS_Face& aFace = aTool.GetSubShape2 (anIt2.Key());
aCompBuilder.Add (aFaceCompound2, aFace);
DBRep::Set (aStr.ToCString(), aFace);
TopoDS_Compound aFaceCompound1;
aCompBuilder.MakeCompound(aFaceCompound1);
theDI << aStr << " \n";
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1(aTool.OverlapSubShapes1()); anIt1.More(); anIt1.Next())
{
TCollection_AsciiString aStr = TCollection_AsciiString(theArgs[1]) + "_" + (anIt1.Key() + 1);
const TopoDS_Shape& aShape = aTool.GetSubShape1(anIt1.Key());
aCompBuilder.Add(aFaceCompound1, aShape);
DBRep::Set(aStr.ToCString(), aShape);
theDI << aStr << " \n";
}
TopoDS_Compound aFaceCompound2;
aCompBuilder.MakeCompound(aFaceCompound2);
for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2(aTool.OverlapSubShapes2()); anIt2.More(); anIt2.Next())
{
TCollection_AsciiString aStr = TCollection_AsciiString(theArgs[2]) + "_" + (anIt2.Key() + 1);
const TopoDS_Shape& aShape = aTool.GetSubShape2(anIt2.Key());
aCompBuilder.Add(aFaceCompound2, aShape);
DBRep::Set(aStr.ToCString(), aShape);
theDI << aStr << " \n";
}
DBRep::Set((TCollection_AsciiString(theArgs[1]) + "_" + "overlapped").ToCString(), aFaceCompound1);
DBRep::Set((TCollection_AsciiString(theArgs[2]) + "_" + "overlapped").ToCString(), aFaceCompound2);
}
DBRep::Set ((TCollection_AsciiString (theArgs[1]) + "_" + "overlapped").ToCString(), aFaceCompound1);
DBRep::Set ((TCollection_AsciiString (theArgs[2]) + "_" + "overlapped").ToCString(), aFaceCompound2);
return 0;
}
@@ -445,12 +493,14 @@ void BRepTest::ExtremaCommands (Draw_Interpretor& theCommands)
aGroup);
theCommands.Add ("proximity",
"proximity Shape1 Shape2 [-tol <value>] [-profile]"
"proximity Shape1 Shape2 [-tol <value> | -value] [-profile]"
"\n\t\t: Searches for pairs of overlapping faces of the given shapes."
"\n\t\t: The options are:"
"\n\t\t: -tol : non-negative tolerance value used for overlapping"
"\n\t\t: test (for zero tolerance, the strict intersection"
"\n\t\t: test will be performed)"
"\n\t\t: -value : compute the proximity value (minimal value which"
"\n\t\t: shows both shapes fully overlapped)"
"\n\t\t: -profile : outputs execution time for main algorithm stages",
__FILE__,
ShapeProximity,

View File

@@ -35,6 +35,7 @@
#include <Bisector_BisecAna.hxx>
#include <Precision.hxx>
#include <BRepOffsetAPI_MakeOffset.hxx>
#include <BRepMAT2d_Explorer.hxx>
#include <BRepMAT2d_BisectingLocus.hxx>
#include <BRepMAT2d_LinkTopoBilo.hxx>
@@ -44,6 +45,7 @@
#include <DBRep.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#ifdef _WIN32
Standard_IMPORT Draw_Viewer dout;
@@ -70,7 +72,16 @@ static Standard_Integer topoload (Draw_Interpretor& , Standard_Integer argc, con
if (C1.IsNull()) return 1;
anExplo.Perform (TopoDS::Face(C1));
TopoDS_Face aFace = TopoDS::Face(C1);
if (argc >= 3 &&
(strcmp(argv[2], "-approx") == 0))
{
Standard_Real aTol = 0.1;
aFace = BRepOffsetAPI_MakeOffset::ConvertFace (aFace, aTol);
}
anExplo.Perform (aFace);
return 0;
}
@@ -267,7 +278,7 @@ void DrawCurve(const Handle(Geom2d_Curve)& aCurve,
void BRepTest::MatCommands (Draw_Interpretor& theCommands)
{
theCommands.Add("topoload","load face",__FILE__,topoload);
theCommands.Add("topoload","load face: topoload face [-approx]",__FILE__,topoload);
theCommands.Add("drawcont","display current contour",__FILE__,drawcont);
theCommands.Add("mat","computes the mat: mat [a/i [o]]",__FILE__,mat);
theCommands.Add("side","side left/right",__FILE__,side);

View File

@@ -30,6 +30,15 @@ public: //! @name public types
typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
public:
enum BVH_PrjStateInTriangle
{
BVH_PrjStateInTriangle_VERTEX,
BVH_PrjStateInTriangle_EDGE,
BVH_PrjStateInTriangle_INNER
};
public: //! @name Box-Box Square distance
//! Computes Square distance between Axis aligned bounding boxes
@@ -113,11 +122,14 @@ public: //! @name Point-Box projection
public: //! @name Point-Triangle Square distance
//! Computes square distance between point and triangle
static T PointTriangleSquareDistance (const BVH_VecNt& thePoint,
const BVH_VecNt& theNode0,
const BVH_VecNt& theNode1,
const BVH_VecNt& theNode2)
//! Find nearest point on a triangle for the given point
static BVH_VecNt PointTriangleProjection (const BVH_VecNt& thePoint,
const BVH_VecNt& theNode0,
const BVH_VecNt& theNode1,
const BVH_VecNt& theNode2,
BVH_PrjStateInTriangle* thePrjState = nullptr,
Standard_Integer* theNumberOfFirstNode = nullptr,
Standard_Integer* theNumberOfLastNode = nullptr)
{
const BVH_VecNt aAB = theNode1 - theNode0;
const BVH_VecNt aAC = theNode2 - theNode0;
@@ -128,68 +140,110 @@ public: //! @name Point-Triangle Square distance
if (aABdotAP <= 0. && aACdotAP <= 0.)
{
return aAP.Dot(aAP);
if (thePrjState != nullptr)
{
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
*theNumberOfFirstNode = 0;
*theNumberOfLastNode = 0;
}
return theNode0;
}
const BVH_VecNt aBC = theNode2 - theNode1;
const BVH_VecNt aBP = thePoint - theNode1;
T aBAdotBP = -(aAB.Dot(aBP));
T aBCdotBP = (aBC.Dot(aBP));
T aBAdotBP = -(aAB.Dot (aBP));
T aBCdotBP = (aBC.Dot (aBP));
if (aBAdotBP <= 0. && aBCdotBP <= 0.)
{
return (aBP.Dot(aBP));
if (thePrjState != nullptr)
{
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
*theNumberOfFirstNode = 1;
*theNumberOfLastNode = 1;
}
return theNode1;
}
const BVH_VecNt aCP = thePoint - theNode2;
T aCBdotCP = -(aBC.Dot(aCP));
T aCAdotCP = -(aAC.Dot(aCP));
T aCBdotCP = -(aBC.Dot (aCP));
T aCAdotCP = -(aAC.Dot (aCP));
if (aCAdotCP <= 0. && aCBdotCP <= 0.)
{
return (aCP.Dot(aCP));
if (thePrjState != nullptr)
{
*thePrjState = BVH_PrjStateInTriangle_VERTEX;
*theNumberOfFirstNode = 2;
*theNumberOfLastNode = 2;
}
return theNode2;
}
T aACdotBP = (aAC.Dot(aBP));
T aACdotBP = (aAC.Dot (aBP));
T aVC = aABdotAP * aACdotBP + aBAdotBP * aACdotAP;
if (aVC <= 0. && aABdotAP > 0. && aBAdotBP > 0.)
{
const BVH_VecNt aDirect = aAP - aAB * (aABdotAP / (aABdotAP + aBAdotBP));
return (aDirect.Dot(aDirect));
if (thePrjState != nullptr)
{
*thePrjState = BVH_PrjStateInTriangle_EDGE;
*theNumberOfFirstNode = 0;
*theNumberOfLastNode = 1;
}
return theNode0 + aAB * (aABdotAP / (aABdotAP + aBAdotBP));
}
T aABdotCP = (aAB.Dot(aCP));
T aABdotCP = (aAB.Dot (aCP));
T aVA = aBAdotBP * aCAdotCP - aABdotCP * aACdotBP;
if (aVA <= 0. && aBCdotBP > 0. && aCBdotCP > 0.)
{
const BVH_VecNt aDirect = aBP - aBC * (aBCdotBP / (aBCdotBP + aCBdotCP));
return (aDirect.Dot(aDirect));
if (thePrjState != nullptr)
{
*thePrjState = BVH_PrjStateInTriangle_EDGE;
*theNumberOfFirstNode = 1;
*theNumberOfLastNode = 2;
}
return theNode1 + aBC * (aBCdotBP / (aBCdotBP + aCBdotCP));
}
T aVB = aABdotCP * aACdotAP + aABdotAP * aCAdotCP;
if (aVB <= 0. && aACdotAP > 0. && aCAdotCP > 0.)
{
const BVH_VecNt aDirect = aAP - aAC * (aACdotAP / (aACdotAP + aCAdotCP));
return (aDirect.Dot(aDirect));
if (thePrjState != nullptr)
{
*thePrjState = BVH_PrjStateInTriangle_EDGE;
*theNumberOfFirstNode = 2;
*theNumberOfLastNode = 0;
}
return theNode0 + aAC * (aACdotAP / (aACdotAP + aCAdotCP));
}
T aNorm = aVA + aVB + aVC;
const BVH_VecNt& aDirect = thePoint - (theNode0 * aVA +
theNode1 * aVB +
theNode2 * aVC) / aNorm;
return (aDirect.Dot(aDirect));
if (thePrjState != nullptr)
{
*thePrjState = BVH_PrjStateInTriangle_INNER;
}
return (theNode0 * aVA + theNode1 * aVB + theNode2 * aVC) / aNorm;
}
//! Computes square distance between point and triangle
static T PointTriangleSquareDistance (const BVH_VecNt& thePoint,
const BVH_VecNt& theNode0,
const BVH_VecNt& theNode1,
const BVH_VecNt& theNode2)
{
const BVH_VecNt aProj = PointTriangleProjection(thePoint, theNode0, theNode1, theNode2);
const BVH_VecNt aPP = aProj - thePoint;
return aPP.Dot(aPP);
}
public: //! @name Ray-Box Intersection

View File

@@ -1221,6 +1221,105 @@ static void ComputeSphere (const gp_Sphere& Sphere,
}
}
//=======================================================================
//function : computeDegeneratedTorus
//purpose : compute bounding box for degenerated torus
//=======================================================================
static void computeDegeneratedTorus (const gp_Torus& theTorus,
const Standard_Real theUMin, const Standard_Real theUMax,
const Standard_Real theVMin, const Standard_Real theVMax,
Bnd_Box& theB)
{
gp_Pnt aP = theTorus.Location();
Standard_Real aRa = theTorus.MajorRadius();
Standard_Real aRi = theTorus.MinorRadius();
Standard_Real aXmin,anYmin,aZmin,aXmax,anYmax,aZmax;
aXmin = aP.X() - aRa - aRi;
aXmax = aP.X() + aRa + aRi;
anYmin = aP.Y() - aRa - aRi;
anYmax = aP.Y() + aRa + aRi;
aZmin = aP.Z() - aRi;
aZmax = aP.Z() + aRi;
Standard_Real aPhi = ACos (-aRa / aRi);
Standard_Real anUper = 2. * M_PI - Precision::PConfusion();
Standard_Real aVper = 2. * aPhi - Precision::PConfusion();
if (theUMax - theUMin >= anUper && theVMax - theVMin >= aVper)
{
// a whole torus
theB.Update(aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
return;
}
Standard_Real anU,aV;
Standard_Real anUmax = theUMin + 2. * M_PI;
const gp_Ax3& aPos = theTorus.Position();
gp_Pnt aPExt = aP;
aPExt.SetX(aXmin);
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
{
theB.Add(aPExt);
}
//
aPExt.SetX(aXmax);
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
{
theB.Add(aPExt);
}
aPExt.SetX(aP.X());
//
aPExt.SetY(anYmin);
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
{
theB.Add(aPExt);
}
//
aPExt.SetY(anYmax);
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
{
theB.Add(aPExt);
}
aPExt.SetY(aP.Y());
//
aPExt.SetZ(aZmin);
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
{
theB.Add(aPExt);
}
//
aPExt.SetZ(aZmax);
ElSLib::TorusParameters(aPos,aRa,aRi,aPExt,anU,aV);
anU = ElCLib::InPeriod(anU,theUMin,anUmax);
if(anU >= theUMin && anU <= theUMax && aV >= theVMin && aV <= theVMax)
{
theB.Add(aPExt);
}
//
// Add boundaries of patch
// UMin, UMax
gp_Circ aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMin);
BndLib::Add(aC,theVMin,theVMax,0.,theB);
aC = ElSLib::TorusUIso(aPos,aRa,aRi,theUMax);
BndLib::Add(aC,theVMin,theVMax,0.,theB);
// VMin, VMax
aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMin);
BndLib::Add(aC,theUMin,theUMax,0.,theB);
aC = ElSLib::TorusVIso(aPos,aRa,aRi,theVMax);
BndLib::Add(aC,theUMin,theUMax,0.,theB);
}
void BndLib::Add(const gp_Sphere& S,const Standard_Real UMin,
const Standard_Real UMax,const Standard_Real VMin,
const Standard_Real VMax,const Standard_Real Tol, Bnd_Box& B)
@@ -1265,6 +1364,13 @@ void BndLib::Add(const gp_Torus& S,const Standard_Real UMin,
if (Fi2<Fi1) return;
if (Ra<Ri)
{
computeDegeneratedTorus(S,UMin,UMax,VMin,VMax,B);
B.Enlarge(Tol);
return;
}
#define SC 0.71
#define addP0 (Compute(UMin,UMax,Ra+Ri,Ra+Ri,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),S.Location(),B))
#define addP1 (Compute(UMin,UMax,Ra+Ri*SC,Ra+Ri*SC,gp_Pnt(S.XAxis().Direction().XYZ()),gp_Pnt(S.YAxis().Direction().XYZ()),gp_Pnt(S.Location().XYZ()+(Ri*SC)*S.Axis().Direction().XYZ()),B))

View File

@@ -27,10 +27,8 @@
#include <Draw_Appli.hxx>
#include <DrawTrSurf_Curve2d.hxx>
#include <GCE2d_MakeSegment.hxx>
#include <DrawTrSurf.hxx>
#endif
#include <Bisector_Bisec.hxx>
#include <Bisector_BisecAna.hxx>
#include <Bisector_BisecCC.hxx>
@@ -229,10 +227,22 @@ Standard_Integer MAT2d_Tool2d::TangentBefore(const Standard_Integer anitem,
type = theCircuit->Value(anitem)->DynamicType();
if ( type != STANDARD_TYPE(Geom2d_CartesianPoint)){
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(anitem));
#ifdef DRAW
char *name = new char[100];
sprintf(name, "c%d", anitem);
DrawTrSurf::Set(name, curve);
delete [] name;
#endif
theGeomVecs.Bind(theNumberOfVecs,curve->DN(curve->LastParameter(),1));
}
else {
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(item));
#ifdef DRAW
char *name = new char[100];
sprintf(name, "c%d", item);
DrawTrSurf::Set(name, curve);
delete [] name;
#endif
Standard_Real param = (IsOpenResult && anitem == theCircuit->NumberOfItems())?
curve->LastParameter() : curve->FirstParameter();
theGeomVecs.Bind(theNumberOfVecs,curve->DN(param,1));
@@ -265,6 +275,12 @@ Standard_Integer MAT2d_Tool2d::TangentAfter(const Standard_Integer anitem,
type = theCircuit->Value(anitem)->DynamicType();
if ( type != STANDARD_TYPE(Geom2d_CartesianPoint)){
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(anitem));
#ifdef DRAW
char *name = new char[100];
sprintf(name, "c%d", anitem);
DrawTrSurf::Set(name, curve);
delete [] name;
#endif
thevector = curve->DN(curve->FirstParameter(),1);
}
else {
@@ -272,7 +288,14 @@ Standard_Integer MAT2d_Tool2d::TangentAfter(const Standard_Integer anitem,
item = (anitem == 1) ? theCircuit->NumberOfItems() : (anitem - 1);
else
item = (anitem == 1) ? 2 : (anitem - 1);
curve = Handle(Geom2d_Curve)::DownCast(theCircuit->Value(item));
#ifdef DRAW
char *name = new char[100];
sprintf(name, "c%d", item);
DrawTrSurf::Set(name, curve);
delete [] name;
#endif
Standard_Real param = (IsOpenResult && anitem == 1)?
curve->FirstParameter() : curve->LastParameter();
thevector = curve->DN(param,1);
@@ -397,6 +420,14 @@ void MAT2d_Tool2d::CreateBisector(const Handle(MAT_Bisector)& abisector)
abisector->BisectorNumber(theNumberOfBisectors);
abisector->Sense(1);
#ifdef DRAW
char *name = new char[100];
sprintf(name, "b%d", theNumberOfBisectors);
DrawTrSurf::Set(name, bisector.Value());
Dump(abisector->BisectorNumber(),1);
delete [] name;
#endif
#ifdef OCCT_DEBUG
Standard_Boolean AffichDraw = Standard_False;
if (AffichDraw) Dump(abisector->BisectorNumber(),1);

View File

@@ -125,10 +125,10 @@ protected:
// Since C++20 inheritance from std::iterator is deprecated, so define predefined types manually:
using iterator_category = std::forward_iterator_tag;
using value_type = UniversalIterator;
using value_type = IteratorInterface*;
using difference_type = ptrdiff_t;
using pointer = UniversalIterator*;
using reference = UniversalIterator&;
using pointer = value_type;
using reference = value_type;
UniversalIterator() {}
@@ -171,18 +171,8 @@ protected:
return aValue;
}
const UniversalIterator& operator* () const { return *this; }
UniversalIterator& operator* () { return *this; }
const UniversalIterator* operator->() const { return this; }
UniversalIterator* operator->() { return this; }
// type cast to actual iterator
template <typename Iterator>
const Iterator& DownCast () const
{
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(myPtr.get())->Value();
}
reference operator* () const { return myPtr.get(); }
reference operator* () { return myPtr.get(); }
private:
std::unique_ptr<IteratorInterface> myPtr;
@@ -196,7 +186,14 @@ protected:
public:
virtual ~FunctorInterface() {}
virtual void operator () (UniversalIterator& theIterator) const = 0;
virtual void operator () (IteratorInterface* theIterator) const = 0;
// type cast to actual iterator
template <typename Iterator>
static const Iterator& DownCast(IteratorInterface* theIterator)
{
return dynamic_cast<OSD_Parallel::IteratorWrapper<Iterator>*>(theIterator)->Value();
}
};
private:
@@ -211,9 +208,9 @@ private:
{
}
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
{
const Iterator& anIt = theIterator.DownCast<Iterator>();
const Iterator& anIt = DownCast<Iterator>(theIterator);
myFunctor(*anIt);
}
@@ -233,9 +230,9 @@ private:
{
}
virtual void operator() (UniversalIterator& theIterator) const Standard_OVERRIDE
virtual void operator() (IteratorInterface* theIterator) const Standard_OVERRIDE
{
Standard_Integer anIndex = theIterator.DownCast<Standard_Integer>();
Standard_Integer anIndex = DownCast<Standard_Integer>(theIterator);
myFunctor(anIndex);
}

View File

@@ -100,7 +100,7 @@ namespace
{
for (OSD_Parallel::UniversalIterator anIter = myRange.It(); anIter != myRange.End(); anIter = myRange.It())
{
myPerformer (anIter);
myPerformer (*anIter);
}
}

View File

@@ -48,6 +48,7 @@
#include <Geom_Curve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_Surface.hxx>
#include <GProp_GProps.hxx>
#include <Message_Msg.hxx>
@@ -1585,6 +1586,9 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
}
BRep_Builder B;
Handle(Geom_ToroidalSurface) aTorSurf = Handle(Geom_ToroidalSurface)::DownCast(mySurf->Surface());
Standard_Boolean anIsDegeneratedTor = ( aTorSurf.IsNull() ? Standard_False : aTorSurf->MajorRadius() < aTorSurf->MinorRadius() );
if ( w1.IsNull() ) return Standard_False;
else if ( w2.IsNull()) {
// For spheres and BSpline cone-like surfaces(bug 24055):
@@ -1595,7 +1599,18 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
gp_Dir2d d;
Standard_Real aRange;
if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
if( ismodeu && anIsDegeneratedTor )
{
Standard_Real aRa = aTorSurf->MajorRadius();
Standard_Real aRi = aTorSurf->MinorRadius();
Standard_Real aPhi = ACos (-aRa / aRi);
p.SetCoord (0.0, ( ismodeu > 0 ? M_PI + aPhi : aPhi ));
Standard_Real aXCoord = -ismodeu;
d.SetCoord ( aXCoord, 0.);
aRange = 2.*M_PI;
}
else if ( ismodeu && mySurf->Surface()->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ) {
p.SetCoord ( ( ismodeu < 0 ? 0. : 2.*M_PI ), ismodeu * 0.5 * M_PI );
Standard_Real aXCoord = -ismodeu;
d.SetCoord ( aXCoord, 0.);
@@ -1663,7 +1678,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
// validity of orientation of the open wires in parametric space.
// In case of U closed surface wire with minimal V coordinate should be directed in positive direction by U
// In case of V closed surface wire with minimal U coordinate should be directed in negative direction by V
if (!vclosed || !uclosed)
if (!vclosed || !uclosed || anIsDegeneratedTor)
{
Standard_Real deltaOther = 0.5 * (m2[coord][0] + m2[coord][1]) - 0.5 * (m1[coord][0] + m1[coord][1]);
if (deltaOther * isneg < 0)
@@ -1711,7 +1726,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam()
// A special kind of FixShifted is necessary for torus-like
// surfaces to adjust wires by period ALONG the missing SEAM direction
// tr9_r0501-ug.stp #187640
if ( uclosed && vclosed ) {
if ( uclosed && vclosed && !anIsDegeneratedTor ) {
Standard_Real shiftw2 =
ShapeAnalysis::AdjustByPeriod ( 0.5 * ( m2[coord][0] + m2[coord][1] ),
0.5 * ( m1[coord][0] + m1[coord][1] +

View File

@@ -5,7 +5,6 @@ TKG3d
TKMath
TKBRep
TKGeomAlgo
TKTopAlgo
TKShHealing
TKMesh
TKService

View File

@@ -9,6 +9,7 @@ TKG2d
TKG3d
TKMesh
TKHLR
TKRWMesh
TKService
TKGeomAlgo
TKV3d

View File

@@ -7296,9 +7296,10 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
Standard_Real aPlaySpeed = 1.0;
Standard_Real aPlayStartTime = anAnimation->StartPts();
Standard_Real aPlayDuration = anAnimation->Duration();
Standard_Boolean isFreeCamera = Standard_False;
Standard_Boolean isFreeCamera = Standard_False;
Standard_Boolean toPauseOnClick = Standard_True;
Standard_Boolean isLockLoop = Standard_False;
Standard_Boolean isLockLoop = Standard_False;
Standard_Boolean toPrintElapsedTime = Standard_False;
// video recording parameters
TCollection_AsciiString aRecFile;
@@ -7352,6 +7353,11 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
}
}
}
else if (anArg == "-elapsedtime"
|| anArg == "-elapsed")
{
toPrintElapsedTime = Standard_True;
}
else if (anArg == "-resume")
{
toPlay = Standard_True;
@@ -7760,8 +7766,17 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
}
}
ViewerTest::CurrentEventManager()->AbortViewAnimation();
ViewerTest::CurrentEventManager()->SetObjectsAnimation (Handle(AIS_Animation)());
if (anAnimation.IsNull() || anAnimation->IsStopped())
{
ViewerTest::CurrentEventManager()->AbortViewAnimation();
ViewerTest::CurrentEventManager()->SetObjectsAnimation(Handle(AIS_Animation)());
}
if (toPrintElapsedTime)
{
theDI << "Elapsed Time: " << anAnimation->ElapsedTime() << " s\n";
}
if (!toPlay && aRecFile.IsEmpty())
{
return 0;
@@ -14338,13 +14353,14 @@ List existing animations:
vanim
Animation playback:
vanim name {-play|-resume|-pause|-stop} [playFrom [playDuration]]
[-speed Coeff] [-freeLook] [-noPauseOnClick] [-lockLoop]
vanim name {-play|-resume|-pause|-stop} [playFrom [playDuration]] [-speed Coeff]
[-freeLook] [-noPauseOnClick] [-lockLoop] [-elapsedTime]
-speed playback speed (1.0 is normal speed)
-freeLook skip camera animations
-speed playback speed (1.0 is normal speed)
-freeLook skip camera animations
-noPauseOnClick do not pause animation on mouse click
-lockLoop disable any interactions
-lockLoop disable any interactions
-elapsedTime prints elapsed time in seconds"
Animation definition:
vanim Name/sub/name [-clear] [-delete]

View File

@@ -56,6 +56,15 @@ bool Vrml_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theReso
{
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();
InternalParameters.ReadFileUnit =
theResource->RealVal("read.file.unit", InternalParameters.ReadFileUnit, aScope);
InternalParameters.ReadFileCoordinateSys = (RWMesh_CoordinateSystem)
theResource->IntegerVal("read.file.coordinate.system", InternalParameters.ReadFileCoordinateSys, aScope);
InternalParameters.ReadSystemCoordinateSys = (RWMesh_CoordinateSystem)
theResource->IntegerVal("read.system.coordinate.system", InternalParameters.ReadSystemCoordinateSys, aScope);
InternalParameters.ReadFillIncomplete =
theResource->BooleanVal("read.fill.incomplete", InternalParameters.ReadFillIncomplete, aScope);
InternalParameters.WriterVersion = (WriteMode_WriterVersion)
theResource->IntegerVal("writer.version", InternalParameters.WriterVersion, aScope);
InternalParameters.WriteRepresentationType = (WriteMode_RepresentationType)
@@ -75,19 +84,47 @@ TCollection_AsciiString Vrml_ConfigurationNode::Save() const
aResult = aResult + "!Configuration Node " + " Vendor: " + GetVendor() + " Format: " + GetFormat() + "\n";
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".";
aResult += "!\n";
aResult += "!Read parameters:\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Set (override) file length units to convert from while reading the file, defined as scale factor for m (meters).\n";
aResult += "!Default value: 1. Available values: positive double\n";
aResult += aScope + "read.file.unit :\t " + InternalParameters.ReadFileUnit + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Set (override) file origin coordinate system to perform conversion during read.\n";
aResult += "!Default value: Yup (1). { Zup (0) | Yup (1) }\n";
aResult += aScope + "read.file.coordinate.system :\t " + InternalParameters.ReadFileCoordinateSys + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Set system origin coordinate system to perform conversion into during read.\n";
aResult += "!Default value: Zup (0). Available values: { Zup (0) | Yup (1) }\n";
aResult += aScope + "read.system.coordinate.system :\t " + InternalParameters.ReadSystemCoordinateSys + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Set flag allowing partially read file content to be put into the XDE document.\n";
aResult += "!Default value: 1(\"ON\"). Available values: 0(\"OFF\"), 1(\"ON\")\n";
aResult += aScope + "read.fill.incomplete :\t " + InternalParameters.ReadFillIncomplete + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Write parameters:\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up writer version\n";
aResult += "!Setting up writer version.\n";
aResult += "!Default value: 2. Available values: 1, 2\n";
aResult += aScope + "writer.version :\t " + InternalParameters.WriterVersion + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Setting up representation\n";
aResult += "!Default value: 1. Available values: 0(shaded), 1(wireframe), 2(both)\n";
aResult += "!Default value: 1. Available values: 0(shaded), 1(wireframe), 2(both).\n";
aResult += aScope + "write.representation.type :\t " + InternalParameters.WriteRepresentationType + "\n";
aResult += "!\n";

View File

@@ -15,6 +15,7 @@
#define _Vrml_ConfigurationNode_HeaderFile
#include <DE_ConfigurationNode.hxx>
#include <RWMesh_CoordinateSystem.hxx>
//! The purpose of this class is to configure the transfer process for VRML format
//! Stores the necessary settings for Vrml_Provider.
@@ -93,6 +94,12 @@ public:
struct Vrml_InternalSection
{
// Read
double ReadFileUnit = 1.; //<! file length units to convert from while reading the file, defined as scale factor for meters
RWMesh_CoordinateSystem ReadFileCoordinateSys = RWMesh_CoordinateSystem_Yup; //<! coordinate system defined by Vrml file
RWMesh_CoordinateSystem ReadSystemCoordinateSys = RWMesh_CoordinateSystem_Zup; //<! result coordinate system
bool ReadFillIncomplete = true; //<! fill the document with partially retrieved data even if reader has failed with error
// Write
WriteMode_WriterVersion WriterVersion = WriteMode_WriterVersion_2; //!< Setting up writer version (1/2)
WriteMode_RepresentationType WriteRepresentationType = WriteMode_RepresentationType_Wireframe; //!< Setting up representation (shaded/wireframe/both)

View File

@@ -17,6 +17,7 @@
#include <Message.hxx>
#include <OSD_Path.hxx>
#include <TDocStd_Document.hxx>
#include <VrmlAPI_CafReader.hxx>
#include <VrmlAPI_Writer.hxx>
#include <VrmlData_Scene.hxx>
#include <Vrml_ConfigurationNode.hxx>
@@ -87,14 +88,27 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
return false;
}
Handle(Vrml_ConfigurationNode) aNode = Handle(Vrml_ConfigurationNode)::DownCast(GetNode());
TopoDS_Shape aShape;
if(!Read(thePath, aShape, theProgress))
VrmlAPI_CafReader aVrmlReader;
aVrmlReader.SetDocument(theDocument);
aVrmlReader.SetFileLengthUnit(aNode->InternalParameters.ReadFileUnit);
aVrmlReader.SetSystemLengthUnit(aNode->GlobalParameters.LengthUnit);
aVrmlReader.SetFileCoordinateSystem(aNode->InternalParameters.ReadFileCoordinateSys);
aVrmlReader.SetSystemCoordinateSystem(aNode->InternalParameters.ReadSystemCoordinateSys);
aVrmlReader.SetFillIncompleteDocument(aNode->InternalParameters.ReadFillIncomplete);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->InternalParameters.ReadFileUnit);
if (!aVrmlReader.Perform(thePath, theProgress))
{
return false;
if (aVrmlReader.ExtraStatus() != RWMesh_CafReaderStatusEx_Partial)
{
Message::SendFail() << "Error in the Vrml_Provider during reading the file '" << thePath << "'";
return false;
}
Message::SendWarning() << "Warning in the Vrml_Provider during reading the file: file has been read paratially " <<
"(due to unexpected EOF, syntax error, memory limit) '" << thePath << "'";
}
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShTool->AddShape(aShape);
XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
return true;
}
@@ -117,7 +131,7 @@ bool Vrml_Provider::Write(const TCollection_AsciiString& thePath,
VrmlAPI_Writer aWriter;
aWriter.SetRepresentation(static_cast<VrmlAPI_RepresentationOfShape>(aNode->InternalParameters.WriteRepresentationType));
Standard_Real aScaleFactorM = aNode->GlobalParameters.LengthUnit / 1000;
Standard_Real aScaleFactorM = aNode->GlobalParameters.LengthUnit;
if (!aWriter.WriteDoc(theDocument, thePath.ToCString(), aScaleFactorM))
{
Message::SendFail() << "Error in the Vrml_Provider during wtiting the file " <<
@@ -199,8 +213,7 @@ bool Vrml_Provider::Read(const TCollection_AsciiString& thePath,
}
VrmlData_Scene aScene;
Standard_Real anOCCUnitMM = aNode->GlobalParameters.LengthUnit;
aScene.SetLinearScale(1000. / anOCCUnitMM);
aScene.SetLinearScale(aNode->GlobalParameters.LengthUnit);
aScene.SetVrmlDir(aVrmlDir);
aScene << aStream;

View File

@@ -1,5 +1,7 @@
VrmlAPI.cxx
VrmlAPI.hxx
VrmlAPI_CafReader.cxx
VrmlAPI_CafReader.hxx
VrmlAPI_RepresentationOfShape.hxx
VrmlAPI_Writer.cxx
VrmlAPI_Writer.hxx

View File

@@ -0,0 +1,137 @@
// 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.
#include <VrmlAPI_CafReader.hxx>
#include <OSD_FileSystem.hxx>
#include <OSD_OpenFile.hxx>
#include <OSD_Path.hxx>
#include <Message.hxx>
#include <Standard_CLocaleSentry.hxx>
#include <TopoDS_Iterator.hxx>
#include <VrmlData_Scene.hxx>
#include <memory>
IMPLEMENT_STANDARD_RTTIEXT(VrmlAPI_CafReader, Standard_Transient)
namespace
{
//=======================================================================
// function : getVrmlErrorName
// purpose :
//=======================================================================
static TCollection_AsciiString getVrmlErrorName(VrmlData_ErrorStatus theStatus)
{
switch (theStatus)
{
case VrmlData_StatusOK: return "";
case VrmlData_EmptyData: return "EmptyData";
case VrmlData_UnrecoverableError: return "UnrecoverableError";
case VrmlData_GeneralError: return "GeneralError";
case VrmlData_EndOfFile: return "EndOfFile";
case VrmlData_NotVrmlFile: return "NotVrmlFile";
case VrmlData_CannotOpenFile: return "CannotOpenFile";
case VrmlData_VrmlFormatError: return "VrmlFormatError";
case VrmlData_NumericInputError: return "NumericInputError";
case VrmlData_IrrelevantNumber: return "IrrelevantNumber";
case VrmlData_BooleanInputError: return "BooleanInputError";
case VrmlData_StringInputError: return "StringInputError";
case VrmlData_NodeNameUnknown: return "NodeNameUnknown";
case VrmlData_NonPositiveSize: return "NonPositiveSize";
case VrmlData_ReadUnknownNode: return "ReadUnknownNode";
case VrmlData_NonSupportedFeature: return "NonSupportedFeature";
case VrmlData_OutputStreamUndefined: return "OutputStreamUndefined";
case VrmlData_NotImplemented: return "NotImplemented";
}
return "UNKNOWN";
}
//=======================================================================
// function : performMeshSubshape
// purpose :
//=======================================================================
static void performMeshSubshape(RWMesh_NodeAttributeMap& theAttribMap,
const VrmlData_DataMapOfShapeAppearance& theShapeAppMap,
const TopoDS_Shape& theShape)
{
Handle(VrmlData_Appearance) anAppearance;
if (theShapeAppMap.Find(theShape.TShape(), anAppearance))
{
if (!anAppearance.IsNull()
&& !anAppearance->Material().IsNull())
{
RWMesh_NodeAttributes aFaceAttribs;
theAttribMap.Find(theShape, aFaceAttribs);
aFaceAttribs.Style.SetColorSurf(anAppearance->Material()->DiffuseColor());
theAttribMap.Bind(theShape, aFaceAttribs);
}
}
for (TopoDS_Iterator aSubShapeIter(theShape, true, false); aSubShapeIter.More(); aSubShapeIter.Next())
{
performMeshSubshape(theAttribMap, theShapeAppMap, aSubShapeIter.Value());
}
}
}
//=======================================================================
// function : performMesh
// purpose :
//=======================================================================
bool VrmlAPI_CafReader::performMesh(const TCollection_AsciiString& theFile,
const Message_ProgressRange& theProgress,
const Standard_Boolean theToProbe)
{
(void)theProgress;
Handle(OSD_FileSystem) aFile = OSD_FileSystem::DefaultFileSystem();
std::shared_ptr<std::istream> aFileStream = aFile->OpenIStream(theFile, std::ios::in | std::ios::binary);
if (aFileStream.get() == nullptr || !aFileStream->good())
{
Message::SendFail() << "Error in VrmlAPI_CafReader: file '" << theFile << "' is not found";
return false;
}
if (theToProbe)
{
Message::SendFail() << "Error in VrmlAPI_CafReader: theToProbe parameter isn't supported";
return false; // unsupported
}
// determine file location to load associated files
TCollection_AsciiString aFolder;
TCollection_AsciiString aFileName;
OSD_Path::FolderAndFileFromPath(theFile, aFolder, aFileName);
VrmlData_Scene aScene;
aScene.SetLinearScale(FileLengthUnit());
aScene.SetVrmlDir(aFolder);
aScene << *aFileStream;
VrmlData_DataMapOfShapeAppearance aShapeAppMap;
TopoDS_Shape aShape = aScene.GetShape(aShapeAppMap);
if (!aShape.IsNull())
{
performMeshSubshape(myAttribMap, aShapeAppMap, aShape);
myRootShapes.Append(aShape);
}
if (aScene.Status() != VrmlData_StatusOK
|| aShape.IsNull())
{
Message::SendFail() << "Error in VrmlAPI_CafReader: " << getVrmlErrorName(aScene.Status())
<< "occurred at line " << aScene.GetLineError()
<< "\nwhile reading VRML file '" << theFile << "'";
return false;
}
return true;
}

View File

@@ -0,0 +1,37 @@
// 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 _VrmlAPI_Reader_HeaderFile
#define _VrmlAPI_Reader_HeaderFile
#include <RWMesh_CafReader.hxx>
//! The Vrml mesh reader into XDE document.
class VrmlAPI_CafReader : public RWMesh_CafReader
{
DEFINE_STANDARD_RTTIEXT(VrmlAPI_CafReader, RWMesh_CafReader)
protected:
//! Read the mesh data from specified file.
//! @param theFile file to read
//! @param theProgress progress indicator
//! @param theToProbe flag for probing file without complete reading. Not supported.
//! @return false when theToProbe is set to true or reading has completed with error.
Standard_EXPORT virtual Standard_Boolean performMesh(const TCollection_AsciiString& theFile,
const Message_ProgressRange& theProgress,
const Standard_Boolean theToProbe) Standard_OVERRIDE;
};
#endif // _VrmlAPI_Reader_HeaderFile

View File

@@ -13,7 +13,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <DDocStd.hxx>
#include <DDocStd_DrawDocument.hxx>
#include <DE_ConfigurationContext.hxx>
@@ -39,6 +38,7 @@
#include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_Vars.hxx>
#include <VrmlAPI_CafReader.hxx>
#include <VrmlAPI_Writer.hxx>
#include <DDF.hxx>
@@ -49,6 +49,7 @@
#include <TDF_Tool.hxx>
#include <TopoDS_Shape.hxx>
#include <Interface_Static.hxx>
#include <UnitsAPI.hxx>
#include <UnitsMethods.hxx>
#include <stdio.h>
@@ -58,6 +59,30 @@
//============================================================
static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thedictws;
//=======================================================================
//function : parseCoordinateSystem
//purpose : Parse RWMesh_CoordinateSystem enumeration.
//=======================================================================
static bool parseCoordinateSystem(const char* theArg,
RWMesh_CoordinateSystem& theSystem)
{
TCollection_AsciiString aCSStr(theArg);
aCSStr.LowerCase();
if (aCSStr == "zup")
{
theSystem = RWMesh_CoordinateSystem_Zup;
}
else if (aCSStr == "yup")
{
theSystem = RWMesh_CoordinateSystem_Yup;
}
else
{
return Standard_False;
}
return Standard_True;
}
static Standard_Boolean ClearDicWS()
{
thedictws.Clear();
@@ -721,6 +746,142 @@ static Standard_Integer Extract(Draw_Interpretor& di,
return 0;
}
//=======================================================================
//function : ReadVrml
//purpose :
//=======================================================================
static Standard_Integer ReadVrml(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char** theArgv)
{
if(theArgc < 3)
{
theDI.PrintHelp(theArgv[0]);
return 1;
}
Handle(TDocStd_Document) aDoc;
Standard_Real aFileUnitFactor = 1.0;
RWMesh_CoordinateSystem aFileCoordSys = RWMesh_CoordinateSystem_Yup, aSystemCoordSys = RWMesh_CoordinateSystem_Zup;
Standard_Boolean toUseExistingDoc = Standard_False;
Standard_Boolean toFillIncomplete = Standard_True;
Standard_CString aDocName = NULL;
TCollection_AsciiString aFilePath;
for(Standard_Integer anArgIt = 1; anArgIt < theArgc; anArgIt++)
{
TCollection_AsciiString anArg(theArgv[anArgIt]);
anArg.LowerCase();
if(anArgIt + 1 < theArgc && anArg == "-fileunit")
{
const TCollection_AsciiString aUnitStr(theArgv[++anArgIt]);
aFileUnitFactor = UnitsAPI::AnyToSI(1.0, aUnitStr.ToCString());
if (aFileUnitFactor <= 0.0)
{
Message::SendFail() << "Error: wrong length unit '" << aUnitStr << "'";
return 1;
}
}
else if (anArgIt + 1 < theArgc && anArg == "-filecoordsys")
{
if (!parseCoordinateSystem(theArgv[++anArgIt], aFileCoordSys))
{
Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
return 1;
}
}
else if (anArgIt + 1 < theArgc && anArg == "-systemcoordsys")
{
if (!parseCoordinateSystem(theArgv[++anArgIt], aSystemCoordSys))
{
Message::SendFail() << "Error: unknown coordinate system '" << theArgv[anArgIt] << "'";
return 1;
}
}
else if (anArg == "-fillincomplete")
{
toFillIncomplete = true;
if (anArgIt + 1 < theArgc && Draw::ParseOnOff(theArgv[anArgIt + 1], toFillIncomplete))
{
++anArgIt;
}
}
else if (anArg == "-nocreatedoc")
{
toUseExistingDoc = true;
}
else if (aDocName == nullptr)
{
aDocName = theArgv[anArgIt];
DDocStd::GetDocument(aDocName, aDoc, Standard_False);
}
else if(aFilePath.IsEmpty())
{
aFilePath = theArgv[anArgIt];
}
else
{
Message::SendFail() << "Syntax error at '" << theArgv[anArgIt] << "'";
return 1;
}
}
if (aFilePath.IsEmpty() || aDocName == nullptr)
{
Message::SendFail() << "Syntax error: wrong number of arguments";
return 1;
}
if (aDoc.IsNull())
{
if(toUseExistingDoc)
{
Message::SendFail() << "Error: document with name " << aDocName << " does not exist";
return 1;
}
Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
anApp->NewDocument("BinXCAF", aDoc);
}
else if (!toUseExistingDoc)
{
Message::SendFail() << "Error: document with name " << aDocName << " already exists\n";
return 1;
}
Standard_Real aScaleFactor = 1.;
if (!XCAFDoc_DocumentTool::GetLengthUnit(aDoc, aScaleFactor))
{
XSAlgo::AlgoContainer()->PrepareForTransfer();
aScaleFactor = UnitsMethods::GetCasCadeLengthUnit();
}
VrmlAPI_CafReader aVrmlReader;
aVrmlReader.SetDocument(aDoc);
aVrmlReader.SetFileLengthUnit(aFileUnitFactor);
aVrmlReader.SetSystemLengthUnit(aScaleFactor);
aVrmlReader.SetFileCoordinateSystem(aFileCoordSys);
aVrmlReader.SetSystemCoordinateSystem(aSystemCoordSys);
aVrmlReader.SetFillIncompleteDocument(toFillIncomplete);
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
if (!aVrmlReader.Perform(aFilePath, aProgress->Start()))
{
if (aVrmlReader.ExtraStatus() != RWMesh_CafReaderStatusEx_Partial)
{
Message::SendFail() << "Error: file reading failed '" << aFilePath << "'";
return 1;
}
Message::SendWarning() <<
"Warning: file has been read paratially (due to unexpected EOF, syntax error, memory limit) " << aFilePath;
}
TDataStd_Name::Set(aDoc->GetData()->Root(), aDocName);
Handle(DDocStd_DrawDocument) aDD = new DDocStd_DrawDocument(aDoc);
Draw::Set(aDocName, aDD);
return 0;
}
//=======================================================================
//function : WriteVrml
//purpose : Write DECAF document to Vrml
@@ -1126,7 +1287,20 @@ void XDEDRAW_Common::InitCommands(Draw_Interpretor& di)
"Extracts given srcLabel1 srcLabel2 ... from srcDoc into given Doc or assembly shape",
__FILE__, Extract, g);
di.Add("WriteVrml", "Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]", __FILE__, WriteVrml, g);
di.Add("ReadVrml",
"ReadVrml docName filePath [-fileCoordSys {Zup|Yup}] [-fileUnit Unit]"
"\n\t\t: [-systemCoordSys {Zup|Yup}] [-noCreateDoc] [-fillIncomplete {ON|OFF}]"
"\n\t\t: Read Vrml file into XDE document."
"\n\t\t: -fileCoordSys coordinate system defined by Vrml file; Yup when not specified."
"\n\t\t: -fileUnit length unit of Vrml file content."
"\n\t\t: -systemCoordSys result coordinate system; Zup when not specified."
"\n\t\t: -noCreateDoc read into existing XDE document."
"\n\t\t: -fillIncomplete fill the document with partially retrieved data even if reader has failed with "
"error; true when not specified",
__FILE__, ReadVrml, g);
di.Add("WriteVrml",
"WriteVrml Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]",
__FILE__, WriteVrml, g);
di.Add("DumpConfiguration",
"DumpConfiguration [-path <path>] [-recursive {on|off}] [-format fmt1 fmt2 ...] [-vendor vend1 vend2 ...]\n"

View File

@@ -0,0 +1,16 @@
puts "========"
puts "OCC32960: Wrong result of BRepExtrema_DistShapeShape after translation"
puts "========"
# Correct distance is 1.0
restore [locate_data_file bug32960.brep] aShape
explode aShape
set anInfo [distmini d aShape_1 aShape_2]
# Check extrema distance
set absTol 1.0e-7
set relTol 1.0e-7
set aDist_Exp 1.0
set aDist [dval d_val]
checkreal "Distance value check" $aDist $aDist_Exp $absTol $relTol

View File

@@ -12,5 +12,5 @@ tclean result
incmesh result 0.1
triangles result
checktrinfo result -tri 638 -nod 564
checktrinfo result -tri 748 -nod 619
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -13,6 +13,6 @@ vdisplay result
vsetdispmode result 1
vfit
checktrinfo result -tri 200 -nod 215
checktrinfo result -tri 278 -nod 254
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -14,6 +14,6 @@ vdisplay result
vsetdispmode result 1
vfit
checktrinfo result -tri 2722 -nod 2618
checktrinfo result -tri 3552 -nod 3033
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -20,7 +20,7 @@ vsetdispmode result 1
vdisplay result
vfit
checktrinfo result -tri 5812 -nod 5809
checktrinfo result -tri 6014 -nod 5910
checkmaxtol result -ref 0.92213088179312575
checknbshapes result -shell 1

View File

@@ -13,7 +13,7 @@ restore [locate_data_file OCC396_f2903.brep] result
incmesh result 0.01
triangles result
checktrinfo result -tri 57 -nod 59
checktrinfo result -tri 75 -nod 68
vinit
vdisplay result

View File

@@ -11,7 +11,7 @@ renamevar a_1 result
incmesh result 0.0001 -a 30 -force_face_def -parallel
checktrinfo result -tri 12512 -nod 8519 -defl 0.00031502118964205414 -tol_abs_defl 1e-6
checktrinfo result -tri 14494 -nod 9510 -defl 0.00031502118964205414 -tol_abs_defl 1e-6
vinit
vsetdispmode 1

View File

@@ -17,7 +17,7 @@ vdefaults -autoTriang 0
vdisplay result
vfit
set rel_tol 0.6928018366802983
set rel_tol 0.7607262575544315
set max_rel_tol_diff 0.001
set area_eps 1

View File

@@ -14,7 +14,7 @@ vdisplay result
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri 3006 -nod 4360 -defl 3.0544822246414993 -tol_abs_defl 1e-6
checktrinfo result -tri 3832 -nod 4773 -defl 3.0509255143612428 -tol_abs_defl 1e-6
set log [tricheck result]
if { [llength $log] != 0 } {

View File

@@ -19,7 +19,7 @@ incmesh result 0.59
vdisplay result -redisplay
vfit
checktrinfo result -tri 1235
checktrinfo result -tri 1863
checkview -screenshot -3d -path ${imagedir}/${test_image}-1.png
tclean result
@@ -27,7 +27,7 @@ incmesh result 0.59 -a 11.45
vdisplay result -redisplay
vfit
checktrinfo result -tri 6438
checktrinfo result -tri 6422
checkview -screenshot -3d -path ${imagedir}/${test_image}-2.png
tclean result
@@ -35,6 +35,6 @@ incmesh result 0.59 -a 11.45 -min 0.035
vdisplay result -redisplay
vfit
checktrinfo result -tri 7079
checktrinfo result -tri 6427
checkview -screenshot -3d -path ${imagedir}/${test_image}-3.png

View File

@@ -7,7 +7,7 @@ restore [locate_data_file bug29149.brep] result
tclean result
incmesh result 0.1
checktrinfo result -tri 7998 -nod 4931 -defl 1.9852316024615062 -tol_abs_defl 1e-6
checktrinfo result -tri 8972 -nod 5418 -defl 1.4639409344792007 -tol_abs_defl 1e-6
# Reduce shape tolerance in order to hard check of mesh quality
settolerance result 1.0e-7

20
tests/bugs/mesh/bug29641 Normal file
View File

@@ -0,0 +1,20 @@
puts "========"
puts "0029641: Mesher produce 'bad' result for extruded spline with given deviation coefficient"
puts "========"
puts ""
restore [locate_data_file bug29641.brep] result
tclean result
vinit
vdefaults -devCoeff 0.0001
vsetdispmode 1
vdisplay result
vtop
vrotate -0.1 0.1 1 0 0 0
vfit
checktrinfo result -tri 29040 -nod 15358
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -16,6 +16,6 @@ if { [llength $log] != 0 } {
puts "Mesh is OK"
}
checktrinfo result -tri 148 -nod 103 -defl 0.34778084099529977 -tol_abs_defl 1e-6
checktrinfo result -tri 156 -nod 107 -defl 0.29785837547864635 -tol_abs_defl 1e-6
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -15,7 +15,7 @@ if { [llength $log1] != 0 } {
puts "Mesh is OK"
}
checktrinfo result -tri 2 -nod 4 -defl 5.5579174982152475 -tol_abs_defl 1e-6
checktrinfo result -tri 344 -nod 175 -defl 48.278808345584679 -tol_abs_defl 1e-6
tclean result
incmesh result 0.01

View File

@@ -12,6 +12,6 @@ vdisplay result
vviewparams -scale 8.46292 -proj 0.653203 -0.644806 0.396926 -up -0.0109833 0.51609 0.856464 -at 347.559 1026.89 219.262 -eye 2080.75 -684.022 1272.45
tricheck result
checktrinfo result -tri 6978 -nod 4890 -defl 8.4394056682382157 -tol_abs_defl 1e-6
checktrinfo result -tri 9470 -nod 6136 -defl 4.7757836297551908 -tol_abs_defl 1e-6
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -12,6 +12,6 @@ vdisplay result
vfit
tricheck result
checktrinfo result -tri 3424 -nod 1801 -max_defl 0.55846824898476011 -tol_abs_defl 1.0e-6
checktrinfo result -tri 2954 -nod 1566 -max_defl 0.66166700094601016 -tol_abs_defl 1.0e-6
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

25
tests/bugs/mesh/bug30442 Normal file
View File

@@ -0,0 +1,25 @@
puts "======="
puts "0030442: Mesh - broken triangulation on pipe shape"
puts "======="
puts ""
bsmooth aSmoothCurve 1.0 [locate_data_file bug30442_points.txt]
circle aCircle 0 0 0 1 1 1 20
mkedge aSpineEdge aSmoothCurve
mkedge aProfileEdge aCircle
wire aSpineWire aSpineEdge
wire aProfileWire aProfileEdge
pipe result aSpineWire aProfileWire
vinit View1
vdisplay result
vsetdispmode 1
vfit
checktrinfo result -tri 25814 -nod 12955
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -15,7 +15,7 @@ vdefaults -autoTriang 0
tclean result
incmesh result 0.004 -a 14
checktrinfo result -tri 70556 -nod 39944 -defl 0.24607185555570676 -tol_abs_defl 1e-6
checktrinfo result -tri 72570 -nod 40951 -defl 0.24607185555570676 -tol_abs_defl 1e-6
vdisplay result -redisplay
vfit
@@ -23,7 +23,7 @@ checkview -screenshot -3d -path ${imagedir}/${test_image}_default.png
tclean result
incmesh result 0.004 -a 14 -force_face_def
checktrinfo result -tri 292556 -nod 150944 -defl 0.16388671063364907 -tol_abs_defl 1e-6
checktrinfo result -tri 287990 -nod 148661 -defl 0.16388671063364907 -tol_abs_defl 1e-6
vdisplay result -redisplay
vfit

View File

@@ -0,0 +1,20 @@
puts "================"
puts "0031449: Mesh - BRepMesh works too long and produces many free nodes on a valid face"
puts "================"
puts ""
pload XDE
set aTmpFile ${imagedir}/${casename}.stp
ReadStep D [locate_data_file bug31301.stp]
WriteStep D ${aTmpFile}
param xstep.cascade.unit M
ReadStep Q ${aTmpFile}
XShow Q
vfit
vsetdispmode 1
XGetOneShape result Q
checktrinfo result -tri 9025 -nod 6562
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,17 @@
puts "================"
puts "0031449: Mesh - BRepMesh works too long and produces many free nodes on a valid face"
puts "================"
puts ""
restore [locate_data_file bug31449_face_loopback_M.brep] result
incmesh result 0.0001
set info_good [tricheck result]
if { [string compare $info_good "" ] != 0 } {
puts "Error : something wierd has been produced, like free nodes, or links"
}
checktrinfo result -tri 65 -nod 67
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,19 @@
puts "================"
puts "0031449: Mesh - BRepMesh works too long and produces many free nodes on a valid face"
puts "================"
puts ""
pload XDE
set aTmpFile ${imagedir}/${casename}.stp
ReadStep D [locate_data_file bug31301.stp]
WriteStep D ${aTmpFile}
param xstep.cascade.unit M
ReadStep Q ${aTmpFile}
XGetOneShape result Q
incmesh result 0.00039624 -a 20 -min 0.0001 -parallel
checktrinfo result -tri 7661 -nod 5810
checkview -display result -3d -path ${imagedir}/${test_image}.png

17
tests/bugs/mesh/bug31853 Normal file
View File

@@ -0,0 +1,17 @@
puts "======="
puts "0031853: Mesh - holes in triangulation with large linear deflection"
puts "======="
puts ""
pload MODELING XDE VISUALIZATION
testreadstep [locate_data_file bug31853_WR16-30.step] result
incmesh result 1 -a 6
checktrinfo result -tri 142834 -nod 72496
vinit View1
vdefaults -autoTriang 0
vdisplay -dispMode 1 result
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

39
tests/bugs/mesh/bug32241 Normal file
View File

@@ -0,0 +1,39 @@
puts "========"
puts "0032241: Mesh - wrong shading display of thrusections"
puts "========"
puts ""
if { [regexp {Windows} [dversion]] } {
set tri_n 2702
set nod_n 1399
} else {
set tri_n 2766
set nod_n 1431
}
pload MODELING VISUALIZATION
circle c0 0 0 0 0 0 1 30
circle c1 0 0 0 0 0 1 30
rotate c1 2000 0 0 0 1 0 15
circle c2 0 0 0 0 0 1 30
rotate c2 2000 0 0 0 1 0 30
circle c3 0 0 0 0 0 1 30
rotate c3 2000 0 0 0 1 0 45
circle c4 0 0 0 0 0 1 30
rotate c4 2000 0 0 0 1 0 60
mkedge e0 c0
mkedge e1 c1
mkedge e2 c2
mkedge e3 c3
mkedge e4 c4
wire w0 e0
wire w1 e1
wire w2 e2
wire w3 e3
wire w4 e4
thrusections result issolid w0 w1 w2 w3 w4
checkview -display result -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri $tri_n -nod $nod_n

32
tests/bugs/mesh/bug32422 Normal file
View File

@@ -0,0 +1,32 @@
puts "========"
puts "0032422: Mesh - Weird rendering"
puts "========"
puts ""
pload MODELING VISUALIZATION
pbsplinecurve sp1 3 9 0 2 73.198335334976 1 109.22594821708 1 168.29694729401 1 244.58155163942 1 307.53411471698 1 344.2978168401 1 379.98768527731 1 399.75469301329 2 77.34874687409 77.303696496535 0 1 -37.404350826922 66.469283013615 0 1 -38.129049645989 51.427809605917 0 1 45.003598352348 23.760586819334 0 1 -76.009618710498 -14.499612221562 0 1 44.396611605217 -43.851734118626 0 1 119.71153838454 27.656796734959 0 1 38.244406969565 24.98300747794 0 1 68.787902964874 60.998473938995 0 1
mkedge eg1 sp1
wire wr1 eg1
mkplane fc1 wr1
prism result fc1 0 0 100
checkshape result
vinit
vdisplay -dispMode 1 result
vfit
checktrinfo result -tri 1286 -nod 863
explode result F
tessellate r result_1 50 50
vdisplay r -dispMode 1
vaspects r -material STONE -color GREEN
vlocation r -location 0 0 -100
vleft
vfit
checktrinfo r -tri 5000 -nod 2601
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@@ -15,6 +15,6 @@ vclear
isos result 0
triangles result
checktrinfo result -tri 10 -nod 12
checktrinfo result -tri 26 -nod 20
checkprops result -s 1.3135
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -18,6 +18,6 @@ vclear
isos result 0
triangles result
checktrinfo result -tri 55 -nod 40
checktrinfo result -tri 31 -nod 28
checkprops result -s 0
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -19,6 +19,6 @@ vsetdispmode result 1
isos result 0
triangles result
checktrinfo result -tri 10 -nod 12
checktrinfo result -tri 26 -nod 20
checkprops result -s 1.3135
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -6,6 +6,14 @@ puts "========================"
puts "The helical pipe is not shaded in AISViewer"
#####
if { [regexp {Windows} [dversion]] } {
set tri_n 19922
set nod_n 10395
} else {
set tri_n 19882
set nod_n 10375
}
restore [locate_data_file OCC358a.brep] f
checkshape f
@@ -19,7 +27,7 @@ vdisplay result
vfit
vsetdispmode result 1
checktrinfo result -tri 21654 -nod 11261
checktrinfo result -tri $tri_n -nod $nod_n
checkprops result -s 24861.2
checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,64 @@
puts "=============================================="
puts "OCC31992: Offset of closed B-spline edge fails"
puts "=============================================="
puts ""
restore [locate_data_file bug31992.brep] a
wire a a
mkplane a a
mkoffset result a 20 0.1 -approx
top
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
for {set i 1} {$i<=20} {incr i} {
checkshape result_${i}
set tolres [checkmaxtol result_${i}]
if { ${tolres} > 1.001e-7} {
puts "Error: bad tolerance of result"
}
}
checknbshapes result_1 -t -vertex 175 -edge 175 -wire 1
checkprops result_1 -l 9.16454
checknbshapes result_2 -t -vertex 175 -edge 175 -wire 1
checkprops result_2 -l 9.79285
checknbshapes result_3 -t -vertex 175 -edge 175 -wire 1
checkprops result_3 -l 10.4212
checknbshapes result_4 -t -vertex 175 -edge 175 -wire 1
checkprops result_4 -l 11.0495
checknbshapes result_5 -t -vertex 175 -edge 175 -wire 1
checkprops result_5 -l 11.6778
checknbshapes result_6 -t -vertex 173 -edge 173 -wire 1
checkprops result_6 -l 12.3061
checknbshapes result_7 -t -vertex 169 -edge 169 -wire 1
checkprops result_7 -l 12.9344
checknbshapes result_8 -t -vertex 167 -edge 167 -wire 1
checkprops result_8 -l 13.5626
checknbshapes result_9 -t -vertex 165 -edge 165 -wire 1
checkprops result_9 -l 14.1907
checknbshapes result_10 -t -vertex 162 -edge 162 -wire 1
checkprops result_10 -l 14.8189
checknbshapes result_11 -t -vertex 158 -edge 158 -wire 1
checkprops result_11 -l 15.447
checknbshapes result_12 -t -vertex 155 -edge 155 -wire 1
checkprops result_12 -l 16.0748
checknbshapes result_13 -t -vertex 154 -edge 154 -wire 1
checkprops result_13 -l 16.7025
checknbshapes result_14 -t -vertex 152 -edge 152 -wire 1
checkprops result_14 -l 17.3303
checknbshapes result_15 -t -vertex 150 -edge 150 -wire 1
checkprops result_15 -l 17.958
checknbshapes result_16 -t -vertex 148 -edge 148 -wire 1
checkprops result_16 -l 18.5855
checknbshapes result_17 -t -vertex 147 -edge 147 -wire 1
checkprops result_17 -l 19.213
checknbshapes result_18 -t -vertex 147 -edge 147 -wire 1
checkprops result_18 -l 19.8405
checknbshapes result_19 -t -vertex 146 -edge 146 -wire 1
checkprops result_19 -l 20.4681
checknbshapes result_20 -t -vertex 145 -edge 145 -wire 1
checkprops result_20 -l 21.0957

View File

@@ -22,31 +22,31 @@ for {set i 1} {$i<=14} {incr i} {
}
}
checknbshapes result_1 -t -vertex 114 -edge 114 -wire 1
checknbshapes result_1 -t -vertex 83 -edge 83 -wire 1
checkprops result_1 -l 4.39365
checknbshapes result_2 -t -vertex 110 -edge 110 -wire 1
checknbshapes result_2 -t -vertex 79 -edge 79 -wire 1
checkprops result_2 -l 5.02084
checknbshapes result_3 -t -vertex 104 -edge 104 -wire 1
checknbshapes result_3 -t -vertex 76 -edge 76 -wire 1
checkprops result_3 -l 5.64778
checknbshapes result_4 -t -vertex 101 -edge 101 -wire 1
checknbshapes result_4 -t -vertex 74 -edge 74 -wire 1
checkprops result_4 -l 6.27443
checknbshapes result_5 -t -vertex 95 -edge 95 -wire 1
checknbshapes result_5 -t -vertex 70 -edge 70 -wire 1
checkprops result_5 -l 6.89816
checknbshapes result_6 -t -vertex 92 -edge 92 -wire 1
checknbshapes result_6 -t -vertex 66 -edge 66 -wire 1
checkprops result_6 -l 7.51255
checknbshapes result_7 -t -vertex 88 -edge 88 -wire 1
checknbshapes result_7 -t -vertex 65 -edge 65 -wire 1
checkprops result_7 -l 8.12807
checknbshapes result_8 -t -vertex 81 -edge 81 -wire 1
checknbshapes result_8 -t -vertex 59 -edge 59 -wire 1
checkprops result_8 -l 8.74586
checknbshapes result_9 -t -vertex 72 -edge 72 -wire 1
checknbshapes result_9 -t -vertex 53 -edge 53 -wire 1
checkprops result_9 -l 9.36292
checknbshapes result_10 -t -vertex 65 -edge 65 -wire 1
checknbshapes result_10 -t -vertex 51 -edge 51 -wire 1
checkprops result_10 -l 9.97455
checknbshapes result_11 -t -vertex 60 -edge 60 -wire 1
checknbshapes result_11 -t -vertex 50 -edge 50 -wire 1
checkprops result_11 -l 10.5864
checknbshapes result_12 -t -vertex 59 -edge 59 -wire 1
checknbshapes result_12 -t -vertex 49 -edge 49 -wire 1
checkprops result_12 -l 11.2017
checknbshapes result_13 -t -vertex 57 -edge 57 -wire 1
checknbshapes result_13 -t -vertex 49 -edge 49 -wire 1
checkprops result_13 -l 11.8196
checknbshapes result_14 -t -vertex 55 -edge 55 -wire 1
checknbshapes result_14 -t -vertex 47 -edge 47 -wire 1
checkprops result_14 -l 12.4395

View File

@@ -22,31 +22,31 @@ for {set i 1} {$i<=14} {incr i} {
}
}
checknbshapes result_1 -t -vertex 61 -edge 60 -wire 1
checknbshapes result_1 -t -vertex 47 -edge 46 -wire 1
checkprops result_1 -l 2.04858
checknbshapes result_2 -t -vertex 61 -edge 60 -wire 1
checknbshapes result_2 -t -vertex 47 -edge 46 -wire 1
checkprops result_2 -l 2.21414
checknbshapes result_3 -t -vertex 61 -edge 60 -wire 1
checknbshapes result_3 -t -vertex 47 -edge 46 -wire 1
checkprops result_3 -l 2.37971
checknbshapes result_4 -t -vertex 61 -edge 60 -wire 1
checknbshapes result_4 -t -vertex 47 -edge 46 -wire 1
checkprops result_4 -l 2.54528
checknbshapes result_5 -t -vertex 61 -edge 60 -wire 1
checknbshapes result_5 -t -vertex 47 -edge 46 -wire 1
checkprops result_5 -l 2.71084
checknbshapes result_6 -t -vertex 61 -edge 60 -wire 1
checknbshapes result_6 -t -vertex 47 -edge 46 -wire 1
checkprops result_6 -l 2.87641
checknbshapes result_7 -t -vertex 61 -edge 60 -wire 1
checknbshapes result_7 -t -vertex 47 -edge 46 -wire 1
checkprops result_7 -l 3.04198
checknbshapes result_8 -t -vertex 56 -edge 55 -wire 1
checknbshapes result_8 -t -vertex 43 -edge 42 -wire 1
checkprops result_8 -l 3.20723
checknbshapes result_9 -t -vertex 50 -edge 49 -wire 1
checkprops result_9 -l 3.38587
checknbshapes result_10 -t -vertex 48 -edge 47 -wire 1
checknbshapes result_9 -t -vertex 38 -edge 37 -wire 1
checkprops result_9 -l 3.32866
checknbshapes result_10 -t -vertex 38 -edge 37 -wire 1
checkprops result_10 -l 3.58204
checknbshapes result_11 -t -vertex 45 -edge 44 -wire 1
checkprops result_11 -l 3.73715
checknbshapes result_12 -t -vertex 45 -edge 44 -wire 1
checkprops result_12 -l 3.97323
checknbshapes result_13 -t -vertex 43 -edge 42 -wire 1
checknbshapes result_11 -t -vertex 37 -edge 36 -wire 1
checkprops result_11 -l 3.67639
checknbshapes result_12 -t -vertex 37 -edge 36 -wire 1
checkprops result_12 -l 3.90941
checknbshapes result_13 -t -vertex 37 -edge 36 -wire 1
checkprops result_13 -l 4.14242
checknbshapes result_14 -t -vertex 43 -edge 42 -wire 1
checknbshapes result_14 -t -vertex 37 -edge 36 -wire 1
checkprops result_14 -l 4.37544

View File

@@ -22,31 +22,31 @@ for {set i 1} {$i<=14} {incr i} {
}
}
checknbshapes result_1 -t -vertex 50 -edge 49 -wire 1
checknbshapes result_1 -t -vertex 33 -edge 32 -wire 1
checkprops result_1 -l 1.66475
checknbshapes result_2 -t -vertex 46 -edge 45 -wire 1
checkprops result_2 -l 1.57655
checknbshapes result_3 -t -vertex 40 -edge 39 -wire 1
checkprops result_3 -l 1.48755
checknbshapes result_4 -t -vertex 37 -edge 36 -wire 1
checknbshapes result_2 -t -vertex 29 -edge 28 -wire 1
checkprops result_2 -l 1.56032
checknbshapes result_3 -t -vertex 26 -edge 25 -wire 1
checkprops result_3 -l 1.45922
checknbshapes result_4 -t -vertex 24 -edge 23 -wire 1
checkprops result_4 -l 1.39682
checknbshapes result_5 -t -vertex 31 -edge 30 -wire 1
checknbshapes result_5 -t -vertex 20 -edge 19 -wire 1
checkprops result_5 -l 1.30715
checknbshapes result_6 -t -vertex 28 -edge 27 -wire 1
checknbshapes result_6 -t -vertex 16 -edge 15 -wire 1
checkprops result_6 -l 1.27033
checknbshapes result_7 -t -vertex 24 -edge 23 -wire 1
checknbshapes result_7 -t -vertex 15 -edge 14 -wire 1
checkprops result_7 -l 1.1996
checknbshapes result_8 -t -vertex 22 -edge 21 -wire 1
checknbshapes result_8 -t -vertex 13 -edge 12 -wire 1
checkprops result_8 -l 1.1737
checknbshapes result_9 -t -vertex 18 -edge 17 -wire 1
checknbshapes result_9 -t -vertex 11 -edge 10 -wire 1
checkprops result_9 -l 1.17713
checknbshapes result_10 -t -vertex 17 -edge 16 -wire 1
checkprops result_10 -l 1.22711
checknbshapes result_11 -t -vertex 14 -edge 13 -wire 1
checkprops result_11 -l 1.2663
checknbshapes result_12 -t -vertex 14 -edge 13 -wire 1
checkprops result_12 -l 1.33108
checknbshapes result_13 -t -vertex 14 -edge 13 -wire 1
checkprops result_13 -l 1.39586
checknbshapes result_14 -t -vertex 14 -edge 13 -wire 1
checkprops result_14 -l 1.46064
checknbshapes result_10 -t -vertex 9 -edge 8 -wire 1
checkprops result_10 -l 1.11521
checknbshapes result_11 -t -vertex 9 -edge 8 -wire 1
checkprops result_11 -l 1.17655
checknbshapes result_12 -t -vertex 8 -edge 7 -wire 1
checkprops result_12 -l 1.10597
checknbshapes result_13 -t -vertex 8 -edge 7 -wire 1
checkprops result_13 -l 1.16139
checknbshapes result_14 -t -vertex 6 -edge 5 -wire 1
checkprops result_14 -l 1.06775

View File

@@ -14,5 +14,5 @@ vdisplay result
vsetdispmode result 1
vfit
checktrinfo result -tri 1075 -nod 635
checktrinfo result -tri 1317 -nod 756
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -14,5 +14,5 @@ tclean result
set Deflection 1.
catch {incmesh result ${Deflection} }
checktrinfo result -tri 52956 -nod 46525 -defl 1.2592398118022043 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checktrinfo result -tri 60069 -nod 50081 -defl 1.6213275001104823 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -19,7 +19,7 @@ tclean result
set Deflection 0.001
incmesh result ${Deflection}
checktrinfo result -tri 375392 -nod 190670 -defl 0.080199363667810539 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
checktrinfo result -tri 326712 -nod 166330 -defl 0.080199363667810539 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
vinit
vdisplay result

View File

@@ -19,5 +19,5 @@ isos result 0
triangles result
fit
checktrinfo result -tri 7863 -nod 6342
checktrinfo result -tri 10463 -nod 7643
checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png

View File

@@ -13,5 +13,5 @@ tclean result
incmesh result .1
triangles result
checktrinfo result -tri 335 -nod 200
checktrinfo result -tri 163 -nod 114
checkview -display result -3d -path ${imagedir}/${test_image}.png

57
tests/bugs/step/bug32239 Normal file
View File

@@ -0,0 +1,57 @@
puts "===================================="
puts "0032239: Data Exchange, STEP import - bounding box is too large"
puts "===================================="
puts ""
pload ALL
# Read file
stepread [locate_data_file bug32239.STEP] b *
# Check that shape is valid
checkshape b_1
# Check bounding box
set xmin0 -62.992562093513783
set ymin0 -51.45371311501097
set zmin0 -33.223762093513777
set xmax0 43.263112093513783
set ymax0 33.211062093513789
set zmax0 37.744962093513792
set bb [bounding b_1]
set xmin [lindex $bb 0]
set ymin [lindex $bb 1]
set zmin [lindex $bb 2]
set xmax [lindex $bb 3]
set ymax [lindex $bb 4]
set zmax [lindex $bb 5]
if { [expr abs($xmin - $xmin0)] > 1.0e-5 } {
set bb_changed 1
}
if { [expr abs($xmax - $xmax0)] > 1.0e-5 } {
set bb_changed 1
}
if { [expr abs($ymin - $ymin0)] > 1.0e-5 } {
set bb_changed 1
}
if { [expr abs($ymax - $ymax0)] > 1.0e-5 } {
set bb_changed 1
}
if { [expr abs($zmin - $zmin0)] > 1.0e-5 } {
set bb_changed 1
}
if { [expr abs($zmax - $zmax0)] > 1.0e-5 } {
set bb_changed 1
}
if { [info exists bb_changed] } {
puts "Error: not expected bounding box"
}
renamevar b_1 result
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -7,4 +7,5 @@
007 obj_write
008 ply_write
009 step_read
010 step_write
010 step_write
011 vrml_read

View File

@@ -9,7 +9,7 @@ writestl m $imagedir/${casename}
readstl res $imagedir/${casename}
file delete $imagedir/${casename}
checktrinfo res -tri 58 -nod 31
checktrinfo res -tri 60 -nod 32
# Visual check
checkview -display res -2d -path ${imagedir}/${test_image}.png

View File

@@ -9,7 +9,7 @@ writestl m $imagedir/${casename}
readstl res $imagedir/${casename}
file delete $imagedir/${casename}
checktrinfo res -tri 106 -nod 55
checktrinfo res -tri 116 -nod 60
# Visual check
checkview -display res -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,32 @@
puts "============"
puts "0032820: Data Exchange - add VRML reader to XCAF document"
puts "============"
puts ""
set aFile [locate_data_file bug29597_vrml2.wrl]
catch { Close D }
loadvrml S_${casename} $aFile
vinit Driver1/View_${casename}_1/${casename}_1
vdisplay S_${casename} -dispmode 1
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}_1.png
XNewDoc D
ReadVrml D $aFile -nocreatedoc
vinit Driver1/View_${casename}_2/${casename}_2
XDisplay D -dispMode 1
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}_2.png
XGetOneShape S_New D
checktrinfo S_New -ref [trinfo S_${casename}]
set ref_colors "TEAL "
set new_colors [ XGetAllColors D ]
if {[ string equal $new_colors $ref_colors ] == 0} {
puts "Error: Colors have been read incorrectly."
}
Close D

View File

@@ -0,0 +1,25 @@
puts "============"
puts "0032820: Data Exchange - add VRML reader to XCAF document"
puts "============"
puts ""
set aFile [locate_data_file M_2056112640_E.wrl]
catch { Close D }
loadvrml S_${casename} $aFile
vinit Driver1/View_${casename}_1/${casename}_1
vdisplay S_${casename} -dispmode 1
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}_1.png
XNewDoc D
ReadVrml D $aFile -nocreatedoc
vinit Driver1/View_${casename}_2/${casename}_2
XDisplay D -dispMode 1
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}_2.png
XGetOneShape S_New D
checktrinfo S_New -ref [trinfo S_${casename}]
Close D

View File

@@ -0,0 +1,32 @@
puts "============"
puts "0032820: Data Exchange - add VRML reader to XCAF document"
puts "============"
puts ""
set aFile [locate_data_file OCC22092-sk97.wrl]
catch { Close D }
loadvrml S_${casename} $aFile
vinit Driver1/View_${casename}_1/${casename}_1
vdisplay S_${casename} -dispmode 1
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}_1.png
XNewDoc D
ReadVrml D $aFile -nocreatedoc
vinit Driver1/View_${casename}_2/${casename}_2
XDisplay D -dispMode 1
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}_2.png
XGetOneShape S_New D
checktrinfo S_New -tol_abs_defl 1e-14 -ref [trinfo S_${casename}]
set ref_colors "BLACK "
set new_colors [ XGetAllColors D ]
if {[ string equal $new_colors $ref_colors ] == 0} {
puts "Error: Colors have been read incorrectly."
}
Close D

View File

@@ -0,0 +1,22 @@
puts "============"
puts "0032820: Data Exchange - add VRML reader to XCAF document"
puts "============"
puts ""
set aFile [locate_data_file OCC23023-2056132060_2_tutnicht.wrl]
catch { Close D }
XNewDoc D
ReadVrml D $aFile -nocreatedoc
vinit Driver1/View_${casename}_1/${casename}_1
XDisplay D -dispMode 1
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}_1.png
set ref_colors "GRAY76 GRAY64 WHITE TURQUOISE4 "
set d_colors [ XGetAllColors D ]
if { [ string equal $d_colors $ref_colors ] == 0 } {
puts "Error: Colors have been read incorrectly."
}

View File

@@ -0,0 +1,5 @@
# File: begin
pload XDE
pload OCAF
pload TOPTEST

View File

@@ -61,6 +61,11 @@ provider.STEP.OCC.write.name : 1
provider.STEP.OCC.write.layer : 1
provider.STEP.OCC.write.props : 1
provider.STEP.OCC.write.model.type : 0
provider.VRML.OCC.read.file.unit : 1
provider.VRML.OCC.read.memory.limit : -1
provider.VRML.OCC.read.file.coordinate.system : 1
provider.VRML.OCC.read.system.coordinate.system : 0
provider.VRML.OCC.read.fill.incomplete : 1
provider.VRML.OCC.writer.version : 2
provider.VRML.OCC.write.representation.type : 1
provider.STL.OCC.read.merge.angle : 90

View File

@@ -19,25 +19,25 @@ if [catch {loadvrml res1 $filename} catch_result] {
puts "OK : Reading is correct"
}
if [catch {ReadFile D2 $filename} catch_result] {
if [catch {ReadFile D2 $filename -conf "provider.VRML.OCC.read.file.unit : 1000"} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
XGetOneShape S2 D2
if { [XGetLengthUnit D2] != "mm" } {
if { [XGetLengthUnit D2] != "km" } {
puts "Error: incrorrect document's length unit"
}
XNewDoc D3
if [catch {ReadFile D3 $filename -conf "global.general.length.unit : 1000 " } catch_result] {
if [catch {ReadFile D3 $filename -conf "provider.VRML.OCC.read.file.unit : 0.001" } catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
}
XGetOneShape S3 D3
if [catch {readfile S4 $filename } catch_result] {
if [catch {readfile S4 $filename -conf "global.general.length.unit : 0.001 "} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
@@ -49,7 +49,7 @@ if [catch {readfile S5 $filename -conf "global.general.length.unit : 1000 " } ca
puts "OK : Reading is correct"
}
array set areas {0 5.3415e+06 1 5.3415 2 5.3415e+06 3 5.3415 4 5.3415e+06 5 5.3415}
array set areas {0 5.3415e+06 1 5.3415 2 5.3415e+06 3 5.3415e-06 4 5.3415e-06 5 5.3415e+06}
array set results {0 res0 1 res1 2 S2 3 S3 4 S4 5 S5}
for { set anind 0} { $anind < 6 } { incr anind } {
checkprops $results($anind) -s $areas($anind) -eps 1e-2

View File

@@ -79,7 +79,7 @@ if [catch {WriteFile D0 $write_path} catch_result] {
} else {
puts "OK : Writing is correct"
}
if [catch {ReadFile D6 $write_path -conf "global.general.length.unit : 1 "} catch_result] {
if [catch {ReadFile D6 $write_path -conf "provider.VRML.OCC.read.file.unit : 1"} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"
@@ -91,7 +91,7 @@ if [catch {writefile S1 $write_path} catch_result] {
} else {
puts "OK : Writing is correct"
}
if [catch {ReadFile D7 $write_path -conf "global.general.length.unit : 1000 "} catch_result] {
if [catch {ReadFile D7 $write_path -conf "provider.VRML.OCC.read.file.unit : 0.001"} catch_result] {
puts "Error : Problem with reading file"
} else {
puts "OK : Reading is correct"

View File

@@ -1,5 +1,5 @@
set viewname "vright"
set length 514.884
set length 516.281
testreadstep [locate_data_file bug27341_Adapter_Zylinder_2_CAD.stp] a
COMPUTE_HLR $viewname $algotype

View File

@@ -1,5 +1,5 @@
set viewname "vright"
set length 9546.99
set length 9548.13
testreadstep [locate_data_file bug27341_Assembly_ABS_1_CAD.stp] a
COMPUTE_HLR $viewname $algotype

View File

@@ -1,7 +1,5 @@
puts "TODO OCC30286 ALL: Error : The length of result shape is 5499.*, expected 5934.34"
set viewname "vright"
set length 5934.34
set length 5497.6
testreadstep [locate_data_file bug27341_Assembly_BILZ_WFL2_1_CAD.stp] a
COMPUTE_HLR $viewname $algotype

View File

@@ -1,5 +1,5 @@
set viewname "vright"
set length 5117.25
set length 5101.26
testreadstep [locate_data_file bug27341_Assembly_GMS_Kurz_CAD.stp] a
COMPUTE_HLR $viewname $algotype

View File

@@ -1,7 +1,5 @@
puts "TODO OCC30286 ALL: Error : The length of result shape is 1664.\\d+, expected 1664.48"
set viewname "vright"
set length 1664.48
set length 1662.87
testreadstep [locate_data_file bug27341_CCS_Adapter_CAD.stp] a
COMPUTE_HLR $viewname $algotype

View File

@@ -1,5 +1,5 @@
set viewname "vright"
set length 2234.38
set length 2239.26
testreadstep [locate_data_file bug27341_CCT_PMK_32_L_o_CAD.stp] a
COMPUTE_HLR $viewname $algotype

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