1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Compare commits

..

39 Commits

Author SHA1 Message Date
myn
2c57ab72bc 0027558: Restore support for legacy XCAF persistence format 2016-06-08 14:10:23 +03:00
msv
77887d30d8 0027492: Change error messages highlighting to make them readable in HTML report 2016-05-30 14:20:10 +03:00
gka
b94d48585b 0027520: Operation "splitshape" in the Test Harness give invalid result on the attached case.
The new method has been added in the class BRepFeat_SplitShape for addition of the sequence of the splitting edges or wires for the whole initial shape without specification of the edge->face, edge->edge mapping.
The procedure of collecting wires has been corrected so as not to take into account the distance in 2D space between adjacent edges having a common vertex.
New category of tests "bugs/splitshape" has been added to non-regression data base.

Test cases for issue CR27520

Remove compilation warnings.

Add dependence of TKFeat on TKShHealing in EXTERNLIB in order to build with genproj.
2016-05-27 15:35:51 +03:00
duv
50d06d8fcf 0027374: Visualization - optimize management of the scene bounding box
OpenGl_View now caches bounding boxes per Z-layer (instead of bounding box of entire scene in Graphic3d_CView).
Redundant invalidation of cached scene bounding box is now avoided in case
when new presentation attributes are assigned to the graphic structure.

Add a new methods ConsiderZoomPersistenceObjects() and considerZoomPersistenceObjects() in the Graphic3d_CView, OpenGl_View and OpenGl_Layer classes.
Call ConsiderZoomPersistenceObjects() in the V3d_View::FitMinMax method.

std::numeric_limits<T>::lowest() fix
2016-05-27 11:57:55 +03:00
aml
5ae6e53dec 0027341: Incorrect exact HLR results
- removal of excess interferences in case of simple hiding face
- correct processing of boundary edges coinciding with outlines
- change of API for testing Draw Command
- correction of Draw command "build3d"
- test cases are added.

Linux reference data is changed.

Partially fixed 0027340: Insufficient exact HLR speed

Number of samples in PolyPoly intersection algorithm tuned in each instance of generic class.
Default number of the samples in Geom2dAdaptor is changed according to the Adaptor2d_Curve2d class.
Minimal number of points in case of B-Spline is changed.
Minimal number of samples support is added in intersection algorithms.
2016-05-27 11:57:50 +03:00
vpa
41e08b4df8 0027317: Some visualisation tests failed because of exceptions generated by FP signals.
- missing implementation of CenterOfGeometry method was added in MeshVS_CommonSensitiveEntity;
- a check to prevent float overflow was added to OpenGl_BVHClipPrimitiveSet::Center.
2016-05-27 11:57:44 +03:00
msv
a002d297f7 0027541: ShapeFix_ComposeShell allows usage of uninitialized value of the field myInvertEdgeStatus
Initialize all fields of the class in the constructor.
2016-05-27 11:57:41 +03:00
mgn
f2b6318110 0027538: Visualization, AIS_InteractiveContext::Display() - do not erase previous display mode.
AIS_InteractiveContext::Display() does not erases old presentation modes of interactive object anymore giving us performance benefit AIS_InteractiveContext::Display() is used. Instead, the method marks them hidden in the same way as AIS_InteractiveContext::SetDisplayMode() and ::UnsetDisplayMode().
2016-05-27 11:57:38 +03:00
vpa
7d46a9ed8b 0027477: Visualization - Select3D_SensitiveCircle always return infinite depth value in boundary mode
- unnecessary re-initialization of pick result was removed from Select3D_SensitiveCircle;
- test case for issue #27477
2016-05-27 11:57:35 +03:00
ski
88d533be65 0026512: Build fails with VTK 6.2 and OpenGL2 Rendering Backend
Support of VTK with OpenGL2 Rendering Backend was added.
2016-05-27 11:57:31 +03:00
aml
6b52f1253e 0025623: Some tests become worse after 22598 fix
Tolerance of line / line analytical intersection is fixed.
Test cases are updated to the new behavior.

Update of test case according to the current behavior
2016-05-27 11:57:26 +03:00
msv
38c2acd423 0027521: Standard_ConstructionError when trying to use unifySameDom into a shape
Correct the algorithm in the function MergeEdges in ShapeUpgrade_UnifySameDomain.cxx so as to take into account the orientation of the next edge added to the chain.

Test cases for issue CR27521
2016-05-26 12:19:26 +03:00
kgv
55fb31dae4 0027458: Configuration, genproj.tcl - add -rpath-link option to linker in Code::Blocks project 2016-05-19 15:09:52 +03:00
aml
882e1d11aa 0026938: Boolean operations fail between two ellipsoids
Treatment for single singular point is added.
Test cases are updated to the new behavior.
New test cases are added,
Message of "bad" state is corrected.
2016-05-19 15:07:44 +03:00
aml
871776ea38 0027194: Possible division by zero in IntPatch_WLineTool
Correct handling for division by zero is added. This prevents exception when FPE is enabled
2016-05-19 15:04:28 +03:00
kgv
09eca2b5b3 0027499: Configuration, CMake - add option INSTALL_NAME_DIR on OS X 2016-05-19 15:02:13 +03:00
kgv
5501f9a946 0027510: Visualization, OpenGl_Window - do not ignore backing store resize on OS X 2016-05-19 14:01:30 +03:00
aml
e64622331f 0027493: [Regression relative to OCCT 7.0.0] Extrema_ExtCC does not set flag "IsParallel" equal to true for the overlapped curves
Check for infinite solutions now starts from two solutions.
Test case is added.
2016-05-19 13:23:34 +03:00
kgv
264abd72f2 0027505: Visualization, Font_FontMgr - do not look for fonts.dir on OS X
Font_FontMgr::InitFontDataBase() now uses the same approach on OS X as on Android
ignoring fonts.dir files which are non used on these systems.
2016-05-19 13:21:25 +03:00
msv
e5260e1dfa 0027466: The algorithm Extrema_GenLocateExtPS gives incorrect result
Euclidean distance criteria is added for local point / surface extrema.
Classes representing objective criteria are renamed to be consistent.
Local extrema usage is updated according to new behavior.
Test case is added.

Misprint correction.
2016-05-19 13:17:18 +03:00
msv
e1c1b6b9f4 0027490: BRepMesh: Reduce number of memory allocations
1) Reduce the number of calls to malloc by grouping requests to larger blocks. To achieve this goal, the following ways are used:

- Containers of types sequence, list and map are initialized with an instance of NCollection_IncAllocator, at this taking care of the time of life of allocated objects, so that not to occupy huge amount of memory.

- Allocation of several arrays having the same and short life time is changed so that to allocate a buffer array of necessary size and to place arrays in this buffer.

2) In BRepMesh_FastDiscretFace, optimize the function filterParameters so that to avoid excess memory allocations.

3) In NCollection_CellFilter, change declaration of the method Reset to accept array by reference rather than by value.

4) Add Allocator() method in map, sequence and vector collection classes by analogy with list collection.

5) Correct the size of block for IncAllocator for x64 platform. In order free-ed block to be returned to the system its size should be at least 1024K on x64 and 512K on x86. This allows to retain free virtual space almost to the state before algorithm run.

6) Decrease amount of memory zeroed by calloc. For that, reduce theIncrement parameter of the embedded vectors of the classes NCollection_UBTreeFiller and BRepMesh_VertexInspector to default value 256.

7) Avoid computing bounding box when not necessary (if no relative deflection is used)

8) Cycles by wires of face using TopExp_Explorer are converted to use TopoDS_Iterator instead.

9) BRepMesh_FastDiscret::Add optimized to avoid storing sequences of faces and edges

10) The tests "mesh standard_* W7" are corrected to accept the new behavior. Earlier the following error took place:
Not connected mesh inside face 9
{12 13}
Now this error was replaced with another one:
free nodes (in pairs: face / node):
{9 12}
Actually it is not a regression, rather improvement, if we look at the snapshot.

11) Change other test cases to their actual state.
2016-05-13 19:04:34 +03:00
bugmaster
f02e43eb35 Adjusting testing cases for current state of OCCT 2016-05-13 12:37:53 +03:00
gka
0911d065ff 0027169: Suspitious behavior of importing names during STEP import
In order to avoid using empty strings in the names of the assemblies in the XCAF document after reading step file for cases when description or name is defined by only 1 space character method TCollection_AsciiString::Length()
was replaced on the method TCollection_AsciiString::UsefullLength().

Test case for issue CR27169

Eliminating warning
2016-05-12 18:12:22 +03:00
abv
3d370858dd 0027432: Null Handle Access When Creating AIS_Trihedron
Debug-only "RaiseIf" is replaced by simple "if" to have exceptional situation handled correctly in Release mode.

Mention mandatory variable CSF_ShadersDirectory in porting notes for OCCT 6.9.0

Test cases for issue CR27432

Deleting test cases for issue CR27432
2016-05-12 12:08:24 +03:00
ssv
3e6a4cd02a 0027463: BRepTools_ReShape ends up with empty shapes
Add check on empty topological containers.

Add empty shapes to the replacement map.

Add Draw command for Re-Shape.

Add a test grid for reshape with a single use case for starters.
2016-05-12 12:02:49 +03:00
anv
38f24151f6 0027476: Code alignment for ShapeFix_ComposeShell 2016-05-12 11:59:35 +03:00
anv
4613a51fd4 0027331: Not valid result on translating the file
Added processing of a short segments of a seam edge.

Test case added.
2016-05-12 11:59:31 +03:00
aml
aa1b48c7dd 0027475: Incomplete direction for Powell method in math_GlobOptMin
Directions are changed to be valid orthogonal set.
2016-05-12 11:52:05 +03:00
msv
18151f1aa1 0027454: Application hangs while opening a non-OCAF XML file
1) Add protection against accessing null pointer in PCDM_ReadWriter::FileFormat.

2) In LDOM_XmlReader::ReadRecord, take into account that the character '>' can have no special meaning (e.g., in a text), and we must read the data behind this character to complete the current tag reading. This treatment concerns the mode of work when myTagPerStep is true.

3) Create a test case of reading of XML file not related to OCAF document.

Test case was added.
2016-05-12 11:09:15 +03:00
aml
15a954deb5 0027467: Modeling Algorithms - class Extrema_ExtCC2d does not find extremum between two intersecting lines
Line / line analytic treatment is added for 2d case.
Test case is added.
2016-05-12 10:53:29 +03:00
kgv
8d0b864941 0027460: Data Exchange - restore method XSControl_WorkSession::MapReader() 2016-05-12 10:49:53 +03:00
apn
c9de149dec 0027463: Checkprops can not be used with several properties
Added possibility to use several properties in one checkprops command

Modified test cases according to changes in checkprops command
2016-05-12 10:46:21 +03:00
Benjamin Bihler
a1530ab1b8 0027433: Opening/Saving OCAF Documents With Own Document Format Does Not Work
Modified Load(...) method of Resource_Manager.cxx to print file names correctly.

Removed appending (empty) file name to directory name, since this is not
necessary and leads to a Standard_OutOfRange failure in TCollection_AsciiString.

Appending file name is done, but only if the name is not empty.

Added test case
2016-05-12 10:37:11 +03:00
jgv
c59fcd1186 0027468: Incorrect processing of some cases by HLR algorithm
Incorrect work of HLR algorithm caused by usage of wrong tolerances, wrong sampling of 2d curve and some other bugs are fixed.

Test cases for issue CR27341
2016-05-12 10:33:35 +03:00
ika
b7b2f85ac1 0027455: Implementation of connection points
Add Import/Export connection points.
Make some improvements in STEP reading in collections shapes, to which dimension is attached.
Update tests.
2016-05-12 10:30:09 +03:00
oan
8e509b0ba1 0027442: Rotation sweep can't be rendered in 3D
Do not insert internal nodes for Cylinder in case if it is less than DefFace value or in case of long cylinder with small radius due to protection against overflow during casting to integer.

Small correction of shape name in test case for issue CR27442
2016-05-12 10:17:38 +03:00
kgv
a9b51f4977 0027424: Configuration, genconf.tcl - add missing option to enable TKD3DHost in configurator 2016-05-11 17:11:07 +03:00
kgv
5951a08873 0026846: Configuration, genproj.tcl - create hardlinks instead for header redirection
Build guides updated accordingly

Update genconf screenshot for Linux
2016-05-11 17:11:02 +03:00
Benjamin Bihler
5950d7816e 0027478: Configuration - avoid inclusion of Xlib.h within Graphic3d_GraphicDriver.hxx
Replace Aspect_DisplayConnection.hxx inclusion by forward declaration.
2016-05-10 20:59:55 +03:00
297 changed files with 6668 additions and 2176 deletions

1
.gitignore vendored
View File

@@ -49,6 +49,7 @@ Release
/*.m4
/*.ac
/*.sh
/codeblocks.bat
/custom.bat
/autom4te.cache
/build_configure

View File

@@ -294,6 +294,10 @@ else()
OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR}")
endif()
if(APPLE)
set (INSTALL_NAME_DIR "" CACHE STRING "install_name library suffix on OS X (e.g. @executable_path/../Frameworks)")
endif()
# a directory recognized as a 'patch' for OCCT
set (BUILD_PATCH "" CACHE PATH "${BUILD_PATCH_DESCR}")

View File

@@ -363,6 +363,8 @@ n XCAFApp
n XCAFDimTolObjects
n XCAFDoc
n XCAFPrs
n XCAFDrivers
n XCAFPersistent
n XSAlgo
n XSControl
n XmlMXCAFDoc

View File

@@ -5,124 +5,104 @@ if(FLAGS_ALREADY_INCLUDED)
endif()
set(FLAGS_ALREADY_INCLUDED 1)
# this macro adds new flag to a cache variable is being connected with compiler
macro (ADD_CONTENT_IF_IT_ABSENT USER_VARIABLE USER_CONTENT)
separate_arguments (USER_CONTENT)
foreach (CURRENT_USER_CONTENT ${USER_CONTENT})
if (NOT "${CURRENT_USER_CONTENT}" STREQUAL "")
set (HAS_CONTENT OFF)
foreach (COMPILER_OPTION_SPECIFICATOR "/" "-") # there are two compiler option specificators / (msvc) and - (msvc and others)
set (FULL_USER_CONTENT "${COMPILER_OPTION_SPECIFICATOR}${CURRENT_USER_CONTENT}")
string (REGEX MATCH "${FULL_USER_CONTENT}" HAS_CURRENT_CONTENT "${${USER_VARIABLE}}")
if (HAS_CURRENT_CONTENT)
set (HAS_CONTENT ON)
endif()
endforeach()
if (NOT HAS_CONTENT)
if (MSVC)
set (FULL_USER_CONTENT "/${CURRENT_USER_CONTENT}")
else()
set (FULL_USER_CONTENT "-${CURRENT_USER_CONTENT}")
endif()
message (STATUS "Info: ${FULL_USER_CONTENT} added to ${USER_VARIABLE}")
get_property(USER_VARIABLE_DOCSTRING CACHE ${USER_VARIABLE} PROPERTY HELPSTRING)
set (${USER_VARIABLE} "${${USER_VARIABLE}} ${FULL_USER_CONTENT}" CACHE STRING "${USER_VARIABLE_DOCSTRING}" FORCE)
endif()
endforeach()
endif()
endmacro()
# this macro replaces a specific flag with new one in a cache variable is being connected with compiler
macro (REPLACE_CONTENT_IF_IT_IS USER_VARIABLE USER_CONTENT NEW_USER_CONTENT)
foreach (COMPILER_OPTION_SPECIFICATOR "/" "-") # there are two compiler option specificators / (msvc) and - (msvc and others)
set (FULL_USER_CONTENT "${COMPILER_OPTION_SPECIFICATOR}${USER_CONTENT}")
string (REGEX MATCH "${FULL_USER_CONTENT}" HAS_CONTENT "${${USER_VARIABLE}}")
if (HAS_CONTENT)
if ("${NEW_USER_CONTENT}" STREQUAL "")
message (STATUS "Info: ${FULL_USER_CONTENT} removed from ${USER_VARIABLE}")
set (FULL_NEW_USER_CONTENT "${NEW_USER_CONTENT}")
else()
set (FULL_NEW_USER_CONTENT "${COMPILER_OPTION_SPECIFICATOR}${NEW_USER_CONTENT}")
message (STATUS "Info: ${FULL_USER_CONTENT} replaced with ${FULL_NEW_USER_CONTENT} in ${USER_VARIABLE}")
endif()
string (REGEX REPLACE "${FULL_USER_CONTENT}" "${FULL_NEW_USER_CONTENT}" ${USER_VARIABLE} "${${USER_VARIABLE}}")
get_property(USER_VARIABLE_DOCSTRING CACHE ${USER_VARIABLE} PROPERTY HELPSTRING)
set (${USER_VARIABLE} "${${USER_VARIABLE}}" CACHE STRING "${USER_VARIABLE_DOCSTRING}" FORCE)
endif()
endforeach()
endmacro()
# force option -fp:precise for Visual Studio projects.
# force option /fp:precise for Visual Studio projects.
#
# Note that while this option is default for MSVC compiler, Visual Studio
# project can be switched later to use Intel Compiler (ICC).
# Enforcing -fp:precise ensures that in such case ICC will use correct
# option instead of its default -fp:fast which is harmful for OCCT.
if (MSVC)
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "fp:precise")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS "fp:precise")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise")
endif()
# set compiler short name and choose SSE2 option for appropriate MSVC compilers
# ONLY for 32-bit
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
if (MSVC80 OR MSVC90 OR MSVC10)
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "arch:SSE2")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS "arch:SSE2")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
endif()
endif()
if (WIN32)
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "fPIC fexceptions")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS "fPIC fexceptions")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions -fPIC")
add_definitions(-DOCC_CONVERT_SIGNALS)
endif()
# enable structured exceptions for MSVC
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "EHsc" "EHa")
if (MSVC)
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "EHa")
string (REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
if (ISFLAG)
string (REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
elseif (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
endif()
# remove _WINDOWS, WIN32 flag if they are
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "D_WINDOWS" "")
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "DWIN32" "")
# remove _WINDOWS flag if it exists
string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_CXX_FLAGS}")
if (IS_WINDOWSFLAG)
message (STATUS "Info: /D_WINDOWS has been removed from CMAKE_CXX_FLAGS")
string (REGEX REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
REPLACE_CONTENT_IF_IT_IS (CMAKE_C_FLAGS "D_WINDOWS" "")
REPLACE_CONTENT_IF_IT_IS (CMAKE_C_FLAGS "DWIN32" "")
# remove WIN32 flag if it exists
string (REGEX MATCH "/DWIN32" IS_WIN32FLAG "${CMAKE_CXX_FLAGS}")
if (IS_WIN32FLAG)
message (STATUS "Info: /DWIN32 has been removed from CMAKE_CXX_FLAGS")
string (REGEX REPLACE "/DWIN32" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
# remove _WINDOWS flag if it exists
string (REGEX MATCH "/D_WINDOWS" IS_WINDOWSFLAG "${CMAKE_C_FLAGS}")
if (IS_WINDOWSFLAG)
message (STATUS "Info: /D_WINDOWS has been removed from CMAKE_C_FLAGS")
string (REGEX REPLACE "/D_WINDOWS" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
endif()
# remove WIN32 flag if it exists
string (REGEX MATCH "/DWIN32" IS_WIN32FLAG "${CMAKE_C_FLAGS}")
if (IS_WIN32FLAG)
message (STATUS "Info: /DWIN32 has been removed from CMAKE_C_FLAGS")
string (REGEX REPLACE "/DWIN32" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
endif()
# remove DEBUG flag if it exists
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS_DEBUG "DDEBUG" "")
REPLACE_CONTENT_IF_IT_IS (CMAKE_C_FLAGS_DEBUG "DDEBUG" "")
string (REGEX MATCH "-DDEBUG" IS_DEBUG_CXX "${CMAKE_CXX_FLAGS_DEBUG}")
if (IS_DEBUG_CXX)
message (STATUS "Info: -DDEBUG has been removed from CMAKE_CXX_FLAGS_DEBUG")
string (REGEX REPLACE "-DDEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()
string (REGEX MATCH "-DDEBUG" IS_DEBUG_C "${CMAKE_C_FLAGS_DEBUG}")
if (IS_DEBUG_C)
message (STATUS "Info: -DDEBUG has been removed from CMAKE_C_FLAGS_DEBUG")
string (REGEX REPLACE "-DDEBUG" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
endif()
# enable parallel compilation on MSVC 9 and above
if (MSVC AND NOT MSVC70 AND NOT MSVC80)
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "MP")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
# generate a single response file which enlist all of the object files
SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
# increase compiler warnings level (-W4 for MSVC, -Wextra for GCC)
if (MSVC)
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS "W[0-3]" "")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "W4")
if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string (REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "Wextra Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if (BUILD_SHARED_LIBS)
if(NOT WIN32)
ADD_CONTENT_IF_IT_ABSENT (CMAKE_SHARED_LINKER_FLAGS "lm")
if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
elseif(NOT WIN32)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
endif()
endif()
endif()
@@ -131,25 +111,26 @@ if(MINGW)
# Set default release optimization option to O2 instead of O3, since in
# some OCCT related examples, this gives significantly smaller binaries
# at comparable performace with MinGW-w64.
REPLACE_CONTENT_IF_IT_IS (CMAKE_CXX_FLAGS_RELEASE "O3" "O2")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS_RELEASE "O2")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "std=gnu++0x")
string (REGEX MATCH "-O3" IS_O3_CXX "${CMAKE_CXX_FLAGS_RELEASE}")
if (IS_O3_CXX)
string (REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
else()
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
endif()
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
add_definitions(-D_WIN32_WINNT=0x0501)
# workaround bugs in mingw with vtable export
ADD_CONTENT_IF_IT_ABSENT (CMAKE_SHARED_LINKER_FLAGS "Wl,--export-all-symbols")
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS "std=c++0x")
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif()
# Optimize size of binaries
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW)
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS_RELEASE "s")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS_RELEASE "s")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
endif()
ADD_CONTENT_IF_IT_ABSENT (CMAKE_CXX_FLAGS_RELEASE "DNo_Exception")
ADD_CONTENT_IF_IT_ABSENT (CMAKE_C_FLAGS_RELEASE "DNo_Exception")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")

View File

@@ -176,6 +176,11 @@ endif()
if (CURRENT_MODULE)
set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Modules/${CURRENT_MODULE}")
set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
if (APPLE)
if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
set_target_properties (${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "${INSTALL_NAME_DIR}")
endif()
endif()
endif()
get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
@@ -230,6 +235,21 @@ if (APPLE)
endif()
endif()
# Update list of used VTK libraries if OpenGL2 Rendering BackEnd is used.
# Add VTK_OPENGL2_BACKEND definition.
if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
add_definitions(-DVTK_OPENGL2_BACKEND)
foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
list (FIND USED_TOOLKITS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
list (REMOVE_ITEM USED_TOOLKITS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
endif()
endif()
endforeach()
endif()
if (BUILD_SHARED_LIBS)
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
endif()

View File

@@ -371,8 +371,8 @@ entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
#
checkbutton .myFrame.myHxxChecks.myScutsCheck -offvalue "false" -onvalue "true" -variable SHORTCUT_HEADERS
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Create short-cuts to headers in inc folder instead of copying"
ttk::combobox .myFrame.myHxxChecks.myScutsCombo -values { {ShortCut} {Copy} {HardLink} } -textvariable SHORTCUT_HEADERS -state readonly -width 12
ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Strategy for filling headers folder inc:"
#
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
@@ -384,6 +384,10 @@ checkbutton .myFrame.myChecks.myGl2psCheck -offvalue "false" -onvalue "true
ttk::label .myFrame.myChecks.myGl2psLbl -text "Use GL2PS"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
if { "$::tcl_platform(platform)" == "windows" } {
checkbutton .myFrame.myChecks.myD3dCheck -offvalue "false" -onvalue "true" -variable HAVE_D3D -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myD3dLbl -text "Use Direct3D"
}
#checkbutton .myFrame.myChecks.myOpenClCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENCL -command wokdep:gui:UpdateList
#ttk::label .myFrame.myChecks.myOpenClLbl -text "Use OpenCL"
checkbutton .myFrame.myChecks.myMacGLXCheck -offvalue "false" -onvalue "true" -variable MACOSX_USE_GLX
@@ -465,8 +469,8 @@ if { "$tcl_platform(platform)" == "windows" } {
#
grid .myFrame.myHxxChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
grid .myFrame.myHxxChecks.myScutsCheck -row 0 -column 0
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 1
grid .myFrame.myHxxChecks.myScutsLbl -row 0 -column 0
grid .myFrame.myHxxChecks.myScutsCombo -row 0 -column 1
incr aRowIter
#
grid .myFrame.mySrchLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
@@ -483,6 +487,10 @@ grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 5 -sticky w
if { "$::tcl_platform(platform)" == "windows" } {
grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 7 -sticky w
}
#grid .myFrame.myChecks.myOpenClCheck -row $aCheckRowIter -column 6 -sticky e
#grid .myFrame.myChecks.myOpenClLbl -row $aCheckRowIter -column 7 -sticky w
incr aCheckRowIter

View File

@@ -41,11 +41,12 @@ if { "$tcl_platform(platform)" == "unix" } {
set VCVARS ""
}
set SHORTCUT_HEADERS "true"
set SHORTCUT_HEADERS "ShortCut"
set HAVE_FREEIMAGE "false"
set HAVE_GL2PS "false"
set HAVE_TBB "false"
set HAVE_D3D "false"
set HAVE_OPENCL "false"
set HAVE_VTK "false"
set MACOSX_USE_GLX "false"
@@ -72,6 +73,9 @@ if { [info exists ::env(VCVARS)] } {
}
if { [info exists ::env(SHORTCUT_HEADERS)] } {
set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
if { $SHORTCUT_HEADERS == "true" } {
set SHORTCUT_HEADERS "ShortCut"
}
}
if { [info exists ::env(HAVE_FREEIMAGE)] } {
set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)"
@@ -82,6 +86,9 @@ if { [info exists ::env(HAVE_GL2PS)] } {
if { [info exists ::env(HAVE_TBB)] } {
set HAVE_TBB "$::env(HAVE_TBB)"
}
if { [info exists ::env(HAVE_D3D)] } {
set HAVE_D3D "$::env(HAVE_D3D)"
}
if { [info exists ::env(HAVE_OPENCL)] } {
set HAVE_OPENCL "$::env(HAVE_OPENCL)"
}
@@ -949,6 +956,7 @@ proc wokdep:SaveCustom {} {
puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
puts $aFile "set HAVE_TBB=$::HAVE_TBB"
puts $aFile "set HAVE_D3D=$::HAVE_D3D"
puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
puts $aFile "set HAVE_VTK=$::HAVE_VTK"
puts $aFile "set CHECK_QT4=$::CHECK_QT4"

View File

@@ -639,16 +639,27 @@ proc osutils:collectinc {theModules theIncPath} {
}
}
}
lsort -unique $anUsedToolKits
set anUsedToolKits [lsort -unique $anUsedToolKits]
set anUnits {}
foreach anUsedToolKit $anUsedToolKits {
set anUnits [concat $anUnits [osutils:tk:units $anUsedToolKit]]
}
lsort -unique $anUnits
set anUnits [lsort -unique $anUnits]
if { [info exists ::env(SHORTCUT_HEADERS)] &&
$::env(SHORTCUT_HEADERS) == "true" } {
# define copying style
set aCopyType "copy"
if { [info exists ::env(SHORTCUT_HEADERS)] } {
if { [string equal -nocase $::env(SHORTCUT_HEADERS) "hard"]
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "hardlink"] } {
set aCopyType "hardlink"
} elseif { [string equal -nocase $::env(SHORTCUT_HEADERS) "true"]
|| [string equal -nocase $::env(SHORTCUT_HEADERS) "shortcut"] } {
set aCopyType "shortcut"
}
}
if { $aCopyType == "shortcut" } {
# template preparation
if { ![file exists $::THE_CASROOT/adm/templates/header.in] } {
puts "template file does not exist: $::THE_CASROOT/adm/templates/header.in"
@@ -683,6 +694,7 @@ proc osutils:collectinc {theModules theIncPath} {
continue
}
}
file delete -force "$theIncPath/$aHeaderFileName"
}
set aShortCutHeaderFile [open "$theIncPath/$aHeaderFileName" "w"]
@@ -690,7 +702,7 @@ proc osutils:collectinc {theModules theIncPath} {
puts $aShortCutHeaderFile $aShortCutHeaderFileContent
close $aShortCutHeaderFile
}
}
}
} else {
set nbcopied 0
foreach anUnit $anUnits {
@@ -700,14 +712,20 @@ proc osutils:collectinc {theModules theIncPath} {
# copy file only if target does not exist or is older than original
set torig [file mtime $aHeaderFile]
if { ! [file isfile $anIncPath/$aHeaderFileName] } {
set tcopy 0
} else {
set tcopy 0
if { [file isfile $anIncPath/$aHeaderFileName] } {
set tcopy [file mtime $anIncPath/$aHeaderFileName]
}
if { $tcopy < $torig } {
incr nbcopied
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
if { $aCopyType == "hardlink" } {
if { $tcopy != 0 } {
file delete -force "$theIncPath/$aHeaderFileName"
}
file link -hard $anIncPath/$aHeaderFileName $aHeaderFile
} else {
file copy -force $aHeaderFile $anIncPath/$aHeaderFileName
}
} elseif { $tcopy != $torig } {
puts "Warning: file $anIncPath/$aHeaderFileName is newer than $aHeaderFile, not changed!"
}
@@ -2136,6 +2154,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
if { "$aWokStation" == "lin" } {
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/lib\" />"
}
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t</Target>"
@@ -2183,6 +2204,9 @@ proc osutils:cbp { theCmpl theOutDir theProjName thePlatform theSrcFiles theLibs
}
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
if { "$aWokStation" == "lin" } {
puts $aFile "\t\t\t\t\t<Add option=\"-Wl,-rpath-link=../../../${aWokStation}/cbp/libd\" />"
}
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t</Target>"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -20,7 +20,10 @@ The environment is defined in the file *custom.sh* (on Linux and OS X) or *custo
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false

View File

@@ -30,13 +30,16 @@ If you have Visual Studio projects already available (pre-installed or generated
* *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution
* <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products
* <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products
* *SHORTCUT_HEADERS* -- if set to "true", folder *inc* will be populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
* *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
That tool will analyze your environment and propose you to choose available options:
* Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*)
* Option to use short-cuts to header files in folder *inc* (enabled by default).
* Method to populate folder *inc* (short-cuts by default).
* Location of third-party libraries (usually downloaded from OCCT web site, see above).
* Path to common directory where third-party libraries are located (optional)
* Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).

View File

@@ -21,7 +21,10 @@ The environment is defined in the file *custom.sh* which can be edited directly:
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator).
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~~
export HAVE_GL2PS=false

View File

@@ -247,6 +247,10 @@ The class *Select3D_Projector* now supports both orientation and projection tran
Porting of user applications from an earlier OCCT version to version 6.9.0 requires taking into account the following major changes.
@subsection upgrade_690_shaders 3D Viewer initialization
3D Viewer now uses GLSL programs for managing frame buffer and stereoscopic output.
For proper initialization, application should configure **CSF_ShadersDirectory** environment variable pointing to a folder with GLSL resources - files from folder **CASROOT**/src/Shaders.
@subsection upgrade_690_selection Changes in Selection

View File

@@ -449,7 +449,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
return;
}
// Erase presentations for all display modes different from aDispMode.
// Mark the presentation modes hidden of interactive object different from aDispMode.
// Then make sure aDispMode is displayed and maybe highlighted.
// Finally, activate selection mode <SelMode> if not yet activated.
TColStd_ListOfInteger aModesToRemove;
@@ -463,7 +463,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
myMainPM->Unhighlight (theIObj, anOldMode);
}
myMainPM->Erase (theIObj, anOldMode);
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
}
}

View File

@@ -846,16 +846,19 @@ Standard_Integer Adaptor3d_CurveOnSurface::NbIntervals (const GeomAbs_Shape S) c
Standard_Integer nu,nv,nc;
nu=mySurface->NbUIntervals(S);
nv=mySurface->NbVIntervals(S);
nc=myCurve->NbIntervals(S);
// Allocate the memory for arrays TabU, TabV, TabC only once using the buffer TabBuf.
TColStd_Array1OfReal TabBuf(1, nu + nv + nc + 3);
TColStd_Array1OfReal TabU(TabBuf(1), 1, nu+1);
TColStd_Array1OfReal TabV(TabBuf(nu + 2), 1, nv+1);
TColStd_Array1OfReal TabC(TabBuf(nu + nv + 3), 1, nc+1);
TColStd_Array1OfReal TabU(1,nu+1);
TColStd_Array1OfReal TabV(1,nv+1);
Standard_Integer NbSample = 20;
Standard_Real U,V,Tdeb,Tfin;
Tdeb=myCurve->FirstParameter();
Tfin=myCurve->LastParameter();
nc=myCurve->NbIntervals(S);
TColStd_Array1OfReal TabC(1,nc+1);
myCurve->Intervals(TabC,S);
Standard_Real Tol= Precision::PConfusion()/10;

View File

@@ -25,6 +25,8 @@
#include <BRepBuilderAPI_MakeShape.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
class LocOpe_WiresOnShape;
class StdFail_NotDone;
class Standard_ConstructionError;
@@ -60,7 +62,12 @@ public:
BRepFeat_SplitShape();
//! Creates the process with the shape <S>.
BRepFeat_SplitShape(const TopoDS_Shape& S);
BRepFeat_SplitShape(const TopoDS_Shape& S);
//! Add splitting edges or wires for whole initial shape
//! withot additional specification edge->face, edge->edge
//! This method puts edge on the corresponding faces from initial shape
Standard_EXPORT Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges);
//! Initializes the process on the shape <S>.
void Init (const TopoDS_Shape& S);

View File

@@ -38,6 +38,14 @@ inline BRepFeat_SplitShape::BRepFeat_SplitShape (const TopoDS_Shape& S) :
myWOnShape = new LocOpe_WiresOnShape(S);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline Standard_Boolean BRepFeat_SplitShape::Add(const TopTools_SequenceOfShape& theEdges)
{
return myWOnShape->Add(theEdges);
}
//=======================================================================
//function : Init

View File

@@ -2006,18 +2006,17 @@ void BRepLib::ReverseSortFaces (const TopoDS_Shape& Sh,
TopTools_ListOfShape& LF)
{
LF.Clear();
TopTools_ListOfShape LTri,LPlan,LCyl,LCon,LSphere,LTor,LOther;
// Use the allocator of the result LF for intermediate results
TopTools_ListOfShape LTri(LF.Allocator()), LPlan(LF.Allocator()),
LCyl(LF.Allocator()), LCon(LF.Allocator()), LSphere(LF.Allocator()),
LTor(LF.Allocator()), LOther(LF.Allocator());
TopExp_Explorer exp(Sh,TopAbs_FACE);
TopLoc_Location l;
Handle(Geom_Surface) S;
for (; exp.More(); exp.Next()) {
const TopoDS_Face& F = TopoDS::Face(exp.Current());
S = BRep_Tool::Surface(F, l);
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F, l);
if (!S.IsNull()) {
if (S->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
}
GeomAdaptor_Surface AS(S);
switch (AS.GetType()) {
case GeomAbs_Plane:

View File

@@ -56,8 +56,16 @@ class BRepMesh_VertexTool;
namespace BRepMesh
{
//! Default size for memory block allocated by IncAllocator.
//! Default size for memory block allocated by IncAllocator.
/**
* The idea here is that blocks of the given size are returned to the system
* rather than retained in the malloc heap, at least on WIN32 and WIN64 platforms.
*/
#ifdef _WIN64
const size_t MEMORY_BLOCK_SIZE_HUGE = 1024 * 1024;
#else
const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
#endif
//! Structure keeping parameters of segment.
struct Segment

View File

@@ -35,7 +35,8 @@ BRepMesh_DataStructureOfDelaun::BRepMesh_DataStructureOfDelaun(
const Handle(NCollection_IncAllocator)& theAllocator,
const Standard_Integer theReservedNodeSize)
: myAllocator (theAllocator),
myNodes (new BRepMesh_VertexTool(theReservedNodeSize, myAllocator)),
myNodes (new BRepMesh_VertexTool(myAllocator)),
myNodeLinks (theReservedNodeSize * 3, myAllocator),
myLinks (theReservedNodeSize * 3, myAllocator),
myDelLinks (myAllocator),
myElements (theReservedNodeSize * 2, myAllocator),

View File

@@ -429,8 +429,6 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
Handle(NCollection_IncAllocator) aAllocator =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
Standard_Real aTolU, aTolV;
myMeshData->Data()->GetTolerance(aTolU, aTolV);
const Standard_Real aSqTol = aTolU * aTolU + aTolV * aTolV;
@@ -442,8 +440,8 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
Standard_Integer anUpper = theVertexIndexes.Upper();
for( ; anIndex <= anUpper; ++anIndex )
{
aLoopEdges.Clear();
aAllocator->Reset(Standard_False);
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
Standard_Integer aVertexIdx = theVertexIndexes( anIndex );
const BRepMesh_Vertex& aVertex = GetVertex( aVertexIdx );
@@ -598,6 +596,7 @@ void BRepMesh_Delaun::cleanupMesh()
for(;;)
{
aAllocator->Reset(Standard_False);
BRepMesh::MapOfIntegerInteger aLoopEdges(10, aAllocator);
BRepMesh::MapOfInteger aDelTriangles(10, aAllocator);
@@ -679,7 +678,6 @@ void BRepMesh_Delaun::cleanupMesh()
myMeshData->RemoveLink( aLoopEdgesIt.Key() );
}
aAllocator->Reset(Standard_False);
if ( aDeletedTrianglesNb == 0 )
break;
}
@@ -2173,7 +2171,8 @@ Standard_Boolean BRepMesh_Delaun::UseEdge( const Standard_Integer /*theIndex*/ )
BRepMesh::HMapOfInteger BRepMesh_Delaun::getEdgesByType(
const BRepMesh_DegreeOfFreedom theEdgeType ) const
{
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger;
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::HMapOfInteger aResult = new BRepMesh::MapOfInteger(1, anAlloc);
BRepMesh::MapOfInteger::Iterator anEdgeIt( myMeshData->LinksOfDomain() );
for ( ; anEdgeIt.More(); anEdgeIt.Next() )

View File

@@ -25,7 +25,6 @@
#include <TopoDS_Iterator.hxx>
#include <BRep_Tool.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FaceAttribute,Standard_Transient)
//=======================================================================
@@ -141,14 +140,12 @@ void BRepMesh_FaceAttribute::init()
// between vertices
myMinStep = RealLast();
for (TopExp_Explorer anExp(myFace, TopAbs_WIRE); anExp.More(); anExp.Next())
for (TopoDS_Iterator aFaceIt(myFace); aFaceIt.More(); aFaceIt.Next())
{
TopoDS_Wire aWire = TopoDS::Wire(anExp.Current());
for (TopoDS_Iterator aWireExp(aWire); aWireExp.More(); aWireExp.Next())
for (TopoDS_Iterator aWireIt(aFaceIt.Value()); aWireIt.More(); aWireIt.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(aWireExp.Value());
if (BRep_Tool::IsClosed(anEdge))
const TopoDS_Edge& anEdge = TopoDS::Edge(aWireIt.Value());
if (anEdge.IsNull() || BRep_Tool::IsClosed(anEdge))
continue;
// Get end points on 2d curve

View File

@@ -47,6 +47,7 @@
#include <Extrema_LocateExtPC.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfCharacter.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColGeom2d_SequenceOfCurve.hxx>
@@ -82,6 +83,7 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret,Standard_Transient)
BRepMesh_FastDiscret::BRepMesh_FastDiscret( const Bnd_Box& theBox,
const BRepMesh_FastDiscret::Parameters& theParams)
:
myMapdefle(1000, new NCollection_IncAllocator()),
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
myParameters(theParams),
@@ -195,7 +197,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
resetDataStructure();
Standard_Real defedge;
Standard_Real defedge = myParameters.Deflection;
Standard_Integer nbEdge = 0;
Standard_Real savangle = myParameters.Angle;
Standard_Real cdef;
@@ -205,18 +207,14 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
if (!myParameters.Relative)
defface = Max(myParameters.Deflection, maxdef);
NCollection_Sequence<EdgePCurve> aPCurves;
NCollection_Sequence<TopoDS_Edge> aFaceEdges;
const TopoDS_Face& aFace = myAttribute->Face();
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
TopExp_Explorer aWireIt(aFace, TopAbs_WIRE);
for (; aWireIt.More(); aWireIt.Next())
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
{
TopExp_Explorer aEdgeIt(aWireIt.Current(), TopAbs_EDGE);
for (; aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
{
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Current());
const TopoDS_Edge& aEdge = TopoDS::Edge(aEdgeIt.Value());
if (aEdge.IsNull())
continue;
if (!myMapdefle.IsBound(aEdge))
{
if (myParameters.Relative)
@@ -265,8 +263,6 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
continue;
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
aPCurves.Append(aPCurve);
aFaceEdges.Append(aEdge);
add(aEdge, aPCurve, defedge);
myParameters.Angle = savangle;
@@ -293,6 +289,7 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
TopLoc_Location aLoc;
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLoc);
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
if ( aTriangulation.IsNull() )
{
@@ -401,16 +398,29 @@ Standard_Integer BRepMesh_FastDiscret::Add(const TopoDS_Face& theFace)
++nbmaill;
resetDataStructure();
for (Standard_Integer j = 1; j <= aFaceEdges.Length(); ++j)
for (TopoDS_Iterator aWireIt(aFace); aWireIt.More(); aWireIt.Next())
{
const TopoDS_Edge& anEdge = aFaceEdges(j);
if (myEdges.IsBound(anEdge))
myEdges.UnBind(anEdge);
for (TopoDS_Iterator aEdgeIt(aWireIt.Value()); aEdgeIt.More(); aEdgeIt.Next(), ++nbEdge)
{
const TopoDS_Edge& anEdge = TopoDS::Edge(aEdgeIt.Value());
if (anEdge.IsNull())
continue;
if (myEdges.IsBound(anEdge))
myEdges.UnBind(anEdge);
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
myMapdefle.Bind(anEdge, defedge);
defedge = Max(myMapdefle(anEdge) / 3.0, eps);
myMapdefle.Bind(anEdge, defedge);
add(anEdge, aPCurves(j), defedge);
Standard_Real aFirstParam, aLastParam;
Handle(Geom2d_Curve) aCurve2d =
BRep_Tool::CurveOnSurface(anEdge, aFace, aFirstParam, aLastParam);
if (aCurve2d.IsNull())
continue;
EdgePCurve aPCurve = { aCurve2d, aFirstParam, aLastParam };
add(anEdge, aPCurve, defedge);
}
}
aDFaceChecker.ReCompute(aClassifier);
@@ -806,18 +816,13 @@ void BRepMesh_FastDiscret::update(
Handle(Poly_PolygonOnTriangulation) P1, P2;
if (BRepMesh_ShapeTool::IsDegenerated(theEdge, aFace))
{
const Standard_Integer aNodesNb = 2;
TColStd_Array1OfInteger aNewNodes (1, aNodesNb);
TColStd_Array1OfInteger aNewNodInStruct(1, aNodesNb);
TColStd_Array1OfReal aNewParams (1, aNodesNb);
aNewNodInStruct(1) = ipf;
aNewNodes (1) = isvf;
aNewParams (1) = aEAttr.FirstParam;
aNewNodInStruct(aNodesNb) = ipl;
aNewNodes (aNodesNb) = isvl;
aNewParams (aNodesNb) = aEAttr.LastParam;
// two nodes
Standard_Integer aNewNodesArr[] = {isvf, isvl};
Standard_Integer aNewNodInStructArr[] = {ipf, ipl};
Standard_Real aNewParamsArr[] = {aEAttr.FirstParam, aEAttr.LastParam};
TColStd_Array1OfInteger aNewNodes (aNewNodesArr[0], 1, 2);
TColStd_Array1OfInteger aNewNodInStruct(aNewNodInStructArr[0], 1, 2);
TColStd_Array1OfReal aNewParams (aNewParamsArr[0], 1, 2);
P1 = new Poly_PolygonOnTriangulation(aNewNodes, aNewParams);
P2 = new Poly_PolygonOnTriangulation(aNewNodInStruct, aNewParams);
@@ -825,9 +830,15 @@ void BRepMesh_FastDiscret::update(
else
{
const Standard_Integer aNodesNb = aEdgeTool->NbPoints();
TColStd_Array1OfInteger aNewNodesVec (1, aNodesNb);
TColStd_Array1OfInteger aNewNodesInStructVec(1, aNodesNb);
TColStd_Array1OfReal aNewParamsVec (1, aNodesNb);
// Allocate the memory for arrays aNewNodesVec, aNewNodesInStructVec, aNewParamsVec
// only once using the buffer aBuf.
TColStd_Array1OfCharacter aBuf(1, aNodesNb * (2*sizeof(Standard_Integer) + sizeof(Standard_Real)));
TColStd_Array1OfInteger aNewNodesVec(*reinterpret_cast<const Standard_Integer*>
(&aBuf(1)), 1, aNodesNb);
TColStd_Array1OfInteger aNewNodesInStructVec(*reinterpret_cast<const Standard_Integer*>
(&aBuf(1 + aNodesNb*sizeof(Standard_Integer))), 1, aNodesNb);
TColStd_Array1OfReal aNewParamsVec(*reinterpret_cast<const Standard_Real*>
(&aBuf(1 + aNodesNb*2*sizeof(Standard_Integer))), 1, aNodesNb);
Standard_Integer aNodesCount = 1;
aNewNodesInStructVec(aNodesCount) = ipf;

View File

@@ -207,8 +207,8 @@ void BRepMesh_FastDiscretFace::initDataStructure()
myStructure->Data()->SetTolerance( aTolU / deltaX, aTolV / deltaY);
myAttribute->ChangeStructure() = myStructure;
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt;
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger;
myAttribute->ChangeSurfacePoints() = new BRepMesh::DMapOfIntegerPnt(1, aAllocator);
myAttribute->ChangeSurfaceVertices()= new BRepMesh::DMapOfVertexInteger(1, aAllocator);
// Check the necessity to fill the map of parameters
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
@@ -217,8 +217,8 @@ void BRepMesh_FastDiscretFace::initDataStructure()
thetype == GeomAbs_BSplineSurface);
const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus || IsCompexSurface (thetype));
myUParam.Clear();
myVParam.Clear();
myUParam.Clear(aAllocator);
myVParam.Clear(aAllocator);
// essai de determination de la longueur vraie:
// akm (bug OCC16) : We must calculate these measures in non-singular
@@ -393,7 +393,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
Standard_Real aDef = -1;
if ( !isaline && myStructure->ElementsOfDomain().Extent() > 0 )
{
BRepMesh::ListOfVertex aNewVertices;
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::ListOfVertex aNewVertices(anAlloc);
if (!rajout)
{
aDef = control(aNewVertices, trigu, Standard_True);
@@ -463,8 +464,6 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
BRepMesh::SequenceOfReal& theResult)
{
// Sort sequence of parameters
BRepMesh::SequenceOfReal aParamTmp;
Standard_Integer aParamLength = 1;
const Standard_Integer anInitLen = theParams.Extent();
TColStd_Array1OfReal aParamArray(1, anInitLen);
@@ -475,37 +474,26 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
std::sort (aParamArray.begin(), aParamArray.end());
// mandatory pre-filtering using the first (minimal) filter value
Standard_Real aP1, aP2;
aP1 = aParamArray(1);
aParamTmp.Append(aP1);
Standard_Integer aParamLength = 1;
for (j = 2; j <= anInitLen; j++)
{
aP2 = aParamArray(j);
if ((aP2-aP1) > theMinDist)
if ((aParamArray(j)-aParamArray(aParamLength)) > theMinDist)
{
aParamTmp.Append(aP2);
aP1 = aP2;
aParamLength++;
if (++aParamLength < j)
aParamArray(aParamLength) = aParamArray(j);
}
}
//add last point if required
if(aParamArray(anInitLen)-theParams(aParamLength) > theMinDist)
{
aParamTmp.Append(aParamArray(anInitLen));
aParamLength++;
}
//perform filtering on series
Standard_Real aLastAdded, aLastCandidate;
Standard_Boolean isCandidateDefined = Standard_False;
aLastAdded = aParamTmp.First();
aLastAdded = aParamArray(1);
aLastCandidate = aLastAdded;
theResult.Append(aParamTmp.First());
theResult.Append(aLastAdded);
for(j=2;j<aParamTmp.Length();j++)
for(j=2; j < aParamLength; j++)
{
Standard_Real aVal = aParamTmp.Value(j);
Standard_Real aVal = aParamArray(j);
if(aVal-aLastAdded > theFilterDist)
{
//adds the parameter
@@ -525,7 +513,7 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
aLastCandidate = aVal;
isCandidateDefined = Standard_True;
}
theResult.Append(aParamTmp.Last());
theResult.Append(aParamArray(aParamLength));
}
void BRepMesh_FastDiscretFace::insertInternalVertices(
@@ -617,19 +605,29 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesCylinder(
gp_Cylinder aCylinder = myAttribute->Surface()->Cylinder();
const Standard_Real aRadius = aCylinder.Radius();
// Calculate parameters for iteration in U direction
Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep(
aRadius, myAttribute->GetDefFace(), myAngle, myMinSize);
Standard_Integer nbU = 0;
Standard_Integer nbV = 0;
const Standard_Real su = umax - umin;
const Standard_Integer nbU = (Standard_Integer)(su / Du);
Du = su / (nbU + 1);
// Calculate parameters for iteration in V direction
const Standard_Real sv = vmax - vmin;
Standard_Integer nbV = (Standard_Integer)(nbU*sv / (su*aRadius));
nbV = Min(nbV, 100 * nbU);
Standard_Real Dv = sv / (nbV + 1);
const Standard_Real aArcLen = su * aRadius;
if (aArcLen > myAttribute->GetDefFace ())
{
// Calculate parameters for iteration in U direction
const Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep (
aRadius, myAttribute->GetDefFace (), myAngle, myMinSize);
nbU = (Standard_Integer)(su / Du);
// Calculate parameters for iteration in V direction
const Standard_Real aDv = nbU*sv / aArcLen;
// Protection against overflow during casting to int in case
// of long cylinder with small radius.
nbV = aDv > static_cast<Standard_Real> (IntegerLast ()) ?
0 : (Standard_Integer)(aDv);
nbV = Min (nbV, 100 * nbU);
}
const Standard_Real Du = su / (nbU + 1);
const Standard_Real Dv = sv / (nbV + 1);
Standard_Real pasu, pasv, pasvmax = vmax - Dv*0.5, pasumax = umax - Du*0.5;
for (pasv = vmin + Dv; pasv < pasvmax; pasv += Dv)
@@ -832,7 +830,9 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
const Standard_Real aDefFace = myAttribute->GetDefFace();
const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
BRepMesh::SequenceOfReal aParams[2];
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
BRepMesh::SequenceOfReal aParams[2] = { BRepMesh::SequenceOfReal(anAlloc),
BRepMesh::SequenceOfReal(anAlloc) };
for (Standard_Integer i = 0; i < 2; ++i)
{
Standard_Boolean isU = (i == 0);
@@ -858,8 +858,10 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
BRepMesh::MapOfReal aParamsToRemove[2];
BRepMesh::MapOfReal aParamsForbiddenToRemove[2];
BRepMesh::MapOfReal aParamsToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
BRepMesh::MapOfReal(1, anAlloc) };
BRepMesh::MapOfReal aParamsForbiddenToRemove[2] = { BRepMesh::MapOfReal(1, anAlloc),
BRepMesh::MapOfReal(1, anAlloc) };
// precision for compare square distances
const Standard_Real aPrecision = Precision::Confusion();
@@ -1033,7 +1035,8 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
const Standard_Real theFaceDeflection,
const BRepMesh_CircleTool& theCircleTool,
BRepMesh::ListOfVertex& theVertices,
Standard_Real& theMaxTriangleDeflection)
Standard_Real& theMaxTriangleDeflection,
const Handle(NCollection_IncAllocator)& theTempAlloc)
{
if (theTriangleDeflection > theMaxTriangleDeflection)
theMaxTriangleDeflection = theTriangleDeflection;
@@ -1048,9 +1051,7 @@ Standard_Boolean BRepMesh_FastDiscretFace::checkDeflectionAndInsert(
const_cast<BRepMesh_CircleTool&>(theCircleTool).Select(
myAttribute->Scale(theUV, Standard_True));
Handle(NCollection_IncAllocator) aAllocator =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
BRepMesh::MapOfInteger aUsedNodes(10, aAllocator);
BRepMesh::MapOfInteger aUsedNodes(10, theTempAlloc);
BRepMesh::ListOfInteger::Iterator aCircleIt(aCirclesList);
for (; aCircleIt.More(); aCircleIt.Next())
{
@@ -1108,9 +1109,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
aBSpline = gFace->ChangeSurface ().Surface().Surface();
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap;
BRepMesh::MapOfIntegerInteger aStatMap;
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb);
Handle(NCollection_IncAllocator) anAlloc =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap(1, anAlloc);
BRepMesh::MapOfIntegerInteger aStatMap(1, anAlloc);
NCollection_Map<BRepMesh_OrientedEdge> aCouples(3 * aTrianglesNb, anAlloc);
const BRepMesh_CircleTool& aCircles = theTrigu.Circles();
// Perform refinement passes
@@ -1121,8 +1124,11 @@ Standard_Real BRepMesh_FastDiscretFace::control(
Standard_Real aMaxSqDef = -1.;
Standard_Integer aPass = 1, aInsertedNb = 1;
Standard_Boolean isAllDegenerated = Standard_False;
Handle(NCollection_IncAllocator) aTempAlloc =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
for (; aPass <= aPassesNb && aInsertedNb && !isAllDegenerated; ++aPass)
{
aTempAlloc->Reset(Standard_False);
theNewVertices.Clear();
// Reset stop condition
@@ -1198,7 +1204,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
aSqDef *= aSqDef;
isSkipped = !checkDeflectionAndInsert(pDef, aCenter2d, theIsFirst,
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
if (isSkipped)
break;
@@ -1232,7 +1238,7 @@ Standard_Real BRepMesh_FastDiscretFace::control(
aSqDef = aLin.SquareDistance(pDef);
isSkipped = !checkDeflectionAndInsert(pDef, mi2d, theIsFirst,
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef);
aSqDef, aSqDefFace, aCircles, theNewVertices, aMaxSqDef, aTempAlloc);
}
}
@@ -1399,6 +1405,8 @@ void BRepMesh_FastDiscretFace::commitSurfaceTriangulation()
BRepMesh_ShapeTool::AddInFace(aFace, aNewTriangulation);
// Delete unused data
myUParam.Clear(0L);
myVParam.Clear(0L);
myAttribute->ChangeStructure().Nullify();
myAttribute->ChangeSurfacePoints().Nullify();
myAttribute->ChangeSurfaceVertices().Nullify();

View File

@@ -174,7 +174,8 @@ private:
const Standard_Real theFaceDeflection,
const BRepMesh_CircleTool& theCircleTool,
BRepMesh::ListOfVertex& theVertices,
Standard_Real& theMaxTriangleDeflection);
Standard_Real& theMaxTriangleDeflection,
const Handle(NCollection_IncAllocator)& theTempAlloc);
private:

View File

@@ -48,6 +48,7 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
@@ -125,8 +126,11 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
//=======================================================================
void BRepMesh_IncrementalMesh::clear()
{
myEdges.Clear();
myEdgeDeflection.Clear();
// the allocator will be alive while the structures are alive
Handle(NCollection_IncAllocator) anAlloc =
new NCollection_IncAllocator(BRepMesh::MEMORY_BLOCK_SIZE_HUGE);
myEdges.Clear(anAlloc);
myEdgeDeflection.Clear(anAlloc);
myFaces.Clear();
myMesh.Nullify();
}
@@ -146,15 +150,18 @@ void BRepMesh_IncrementalMesh::init()
collectFaces();
Bnd_Box aBox;
BRepBndLib::Add(myShape, aBox, Standard_False);
if (aBox.IsVoid())
if ( myParameters.Relative )
{
// Nothing to mesh.
return;
}
BRepBndLib::Add(myShape, aBox, Standard_False);
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
if (aBox.IsVoid())
{
// Nothing to mesh.
return;
}
BRepMesh_ShapeTool::BoxMaxDimension(aBox, myMaxShapeSize);
}
myMesh = new BRepMesh_FastDiscret (aBox, myParameters);
@@ -167,22 +174,21 @@ void BRepMesh_IncrementalMesh::init()
//=======================================================================
void BRepMesh_IncrementalMesh::collectFaces()
{
TopTools_ListOfShape aFaceList;
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
TopTools_ListOfShape aFaceList(anAlloc);
BRepLib::ReverseSortFaces(myShape, aFaceList);
TopTools_MapOfShape aFaceMap;
TColStd_MapOfTransient aTFaceMap(1, anAlloc);
// make array of faces suitable for processing (excluding faces without surface)
TopLoc_Location aDummyLoc;
const TopLoc_Location aEmptyLoc;
TopTools_ListIteratorOfListOfShape aFaceIter(aFaceList);
for (; aFaceIter.More(); aFaceIter.Next())
{
TopoDS_Shape aFaceNoLoc = aFaceIter.Value();
aFaceNoLoc.Location(aEmptyLoc);
if (!aFaceMap.Add (aFaceNoLoc))
const TopoDS_Face& aFace = TopoDS::Face(aFaceIter.Value());
const Handle(TopoDS_TShape)& aTFace = aFace.TShape();
if (!aTFaceMap.Add (aTFace))
continue; // already processed
TopoDS_Face aFace = TopoDS::Face(aFaceIter.Value());
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace, aDummyLoc);
if (aSurf.IsNull())
continue;
@@ -282,8 +288,9 @@ void BRepMesh_IncrementalMesh::discretizeFreeEdges()
Standard_Real BRepMesh_IncrementalMesh::edgeDeflection(
const TopoDS_Edge& theEdge)
{
if (myEdgeDeflection.IsBound(theEdge))
return myEdgeDeflection(theEdge);
const Standard_Real* pDef = myEdgeDeflection.Seek(theEdge);
if (pDef)
return *pDef;
Standard_Real aEdgeDeflection;
if ( myParameters.Relative )
@@ -329,7 +336,7 @@ Standard_Real BRepMesh_IncrementalMesh::faceDeflection(
void BRepMesh_IncrementalMesh::update(const TopoDS_Edge& theEdge)
{
if (!myEdges.IsBound(theEdge))
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool());
myEdges.Bind(theEdge, BRepMesh::DMapOfTriangulationBool(3, myEdges.Allocator()));
Standard_Real aEdgeDeflection = edgeDeflection(theEdge);
// Check that triangulation relies to face of the given shape.

View File

@@ -30,13 +30,11 @@ public:
typedef Standard_Integer Target;
//! Constructor.
//! @param theReservedSize size to be reserved for vector of vertices.
//! @param theAllocator memory allocator to be used by internal collections.
Standard_EXPORT BRepMesh_VertexInspector (
const Standard_Integer theReservedSize,
const Handle(NCollection_IncAllocator)& theAllocator)
: myResIndices(theAllocator),
myVertices (new BRepMesh::VectorOfVertex(theReservedSize)),
myVertices (new BRepMesh::VectorOfVertex),
myDelNodes (theAllocator)
{
SetTolerance( Precision::Confusion() );

View File

@@ -56,11 +56,10 @@ NCollection_CellFilter_Action BRepMesh_VertexInspector::Inspect(
//purpose :
//=======================================================================
BRepMesh_VertexTool::BRepMesh_VertexTool(
const Standard_Integer theReservedSize,
const Handle(NCollection_IncAllocator)& theAllocator)
: myAllocator (theAllocator),
myCellFilter(0., myAllocator),
mySelector (Max(theReservedSize, 64),myAllocator)
mySelector (myAllocator)
{
const Standard_Real aTol = Precision::Confusion();
SetCellSize ( aTol + 0.05 * aTol );

View File

@@ -36,10 +36,8 @@ public:
DEFINE_STANDARD_ALLOC
//! Constructor.
//! @param theReservedSize size to be reserved for vector of vertices.
//! @param theAllocator memory allocator to be used by internal collections.
Standard_EXPORT BRepMesh_VertexTool(
const Standard_Integer theReservedSize,
const Handle(NCollection_IncAllocator)& theAllocator);
//! Sets new size of cell for cellfilter equal in both directions.

View File

@@ -22,7 +22,8 @@
#include <BRepTools_WireExplorer.hxx>
#include <TopAbs_Orientation.hxx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Iterator.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <BRepMesh_PairOfPolygon.hxx>
#include <TColStd_SequenceOfInteger.hxx>
@@ -147,10 +148,11 @@ BRepMesh_WireChecker::BRepMesh_WireChecker(
TopoDS_Face aFace = theFace;
aFace.Orientation(TopAbs_FORWARD);
TopExp_Explorer aFaceExplorer(aFace, TopAbs_WIRE);
for (; aFaceExplorer.More(); aFaceExplorer.Next())
for (TopoDS_Iterator aFaceIt(aFace); aFaceIt.More(); aFaceIt.Next())
{
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceExplorer.Current());
if (aFaceIt.Value().IsNull() || aFaceIt.Value().ShapeType() != TopAbs_WIRE) // may be inner vertex
continue;
const TopoDS_Wire& aWire = TopoDS::Wire(aFaceIt.Value());
myWiresEdges.Append(ListOfEdges());
ListOfEdges& aEdges = myWiresEdges.ChangeLast();

View File

@@ -1792,7 +1792,7 @@ Standard_Integer build3d(Draw_Interpretor& di,
}
Standard_Boolean Ok;
TopoDS_Shape S = DBRep::Get(a[1],TopAbs_FACE);
TopoDS_Shape S = DBRep::Get(a[1]);
if (S.IsNull()) return 1;
if (n==2) { Ok = BRepLib::BuildCurves3d(S); }

View File

@@ -732,10 +732,22 @@ static Standard_Integer PRF(Draw_Interpretor& theCommands,
static Standard_Integer SPLS(Draw_Interpretor& ,
Standard_Integer narg, const char** a)
{
Standard_Integer newnarg ;
Standard_Integer newnarg;
if (narg<3) return 1;
if (narg < 3)
{
cout << "Invalid number of arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]" << endl;
return 1;
}
TopoDS_Shape S = DBRep::Get(a[2]);
if (S.IsNull())
{
cout << "Invalid input shape " << a[2]<<endl;
return 1;
}
BRepFeat_SplitShape Spls(S);
Standard_Boolean pick = Standard_False;
TopoDS_Shape EF;
@@ -752,20 +764,42 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
(newnarg !=narg && ((narg-newnarg)<=2 || (narg-newnarg)%2 != 1))) {
return 1;
}
if (i<newnarg) {
Standard_Boolean isSplittingEdges = Standard_False;
TopTools_SequenceOfShape aSplitEdges;
if (i < newnarg) {
pick = (a[i][0] == '.');
EF = DBRep::Get(a[i],TopAbs_FACE);
if (EF.IsNull()) return 1;
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
cout << "Invalid input shape " <<a[i]<<endl;
return 1;
}
if (aSh.ShapeType() == TopAbs_FACE)
EF = TopoDS::Face(aSh);
else
{
if (aSh.ShapeType() == TopAbs_COMPOUND || aSh.ShapeType() == TopAbs_WIRE || aSh.ShapeType() == TopAbs_EDGE)
{
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
for (; aExpE.More(); aExpE.Next())
aSplitEdges.Append(aExpE.Current());
isSplittingEdges = (aSplitEdges.Length());
}
}
}
i++;
while (i < newnarg) {
if (pick) {
DBRep_DrawableShape::LastPick(EF,u,v);
}
if (EF.ShapeType() == TopAbs_FACE) {
if (!isSplittingEdges && !EF.IsNull() && EF.ShapeType() == TopAbs_FACE) {
// face wire/edge ...
i++;
while (i < newnarg) {
TopoDS_Shape W;
Standard_Boolean rever = Standard_False;
@@ -811,11 +845,36 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
}
}
else
return 1;
{
if (isSplittingEdges)
{
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
cout << "Invalid input shape " <<a[i]<< endl;
return 1;
}
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
for (; aExpE.More(); aExpE.Next())
aSplitEdges.Append(aExpE.Current());
}
else
{
cout << "Invalid input arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]"<<endl;
return 1;
}
}
i++;
}
if (isSplittingEdges)
Spls.Add(aSplitEdges);
// ici, i vaut newnarg
for (i++; i<narg; i+=2) {
for (; i < narg; i += 2) {
TopoDS_Shape Ew,Es;
TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_EDGE));
Es = TopoDS::Edge(aLocalShape);
@@ -827,6 +886,7 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
Ew = TopoDS::Edge(aLocalShape);
// Ew = TopoDS::Edge(DBRep::Get(a[i+1],TopAbs_EDGE));
if (Ew.IsNull()) {
cout << "Invalid input shape " <<a[i+1]<< endl;
return 1;
}
Spls.Add(TopoDS::Edge(Ew),TopoDS::Edge(Es));
@@ -2250,8 +2310,8 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
theCommands.Add("splitshape",
"splitshape result shape face wire/edge/compound [wire/edge/compound ...][face wire/edge/compound [wire/edge/compound...] ...] [@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]",
__FILE__,SPLS,g);
"splitshape result shape [splitedges] [face wire/edge/compound [wire/edge/compound ...][face wire/edge/compound [wire/edge/compound...] ...] [@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]",
__FILE__, SPLS, g);
theCommands.Add("thickshell",

View File

@@ -495,18 +495,21 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
Standard_Integer locStatus = myStatus;
// apply recorded modifications to subshapes
Standard_Boolean isEmpty = Standard_True;
for ( TopoDS_Iterator it(shape,Standard_False); it.More(); it.Next() ) {
TopoDS_Shape sh = it.Value();
newsh = Apply ( sh, until );
if ( newsh != sh ) {
if ( myStatus & EncodeStatus(4)) //ShapeExtend::DecodeStatus ( myStatus, ShapeExtend_DONE4 ) )
locStatus |= EncodeStatus(4); //|= ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
locStatus |= EncodeStatus(4); //|= ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
modif = 1;
}
if ( newsh.IsNull() ) {
locStatus |= EncodeStatus(4); //ShapeExtend::EncodeStatus ( ShapeExtend_DONE4 );
continue;
}
if ( isEmpty )
isEmpty = Standard_False;
locStatus |= EncodeStatus(3);//ShapeExtend::EncodeStatus ( ShapeExtend_DONE3 );
if ( st == TopAbs_COMPOUND || newsh.ShapeType() == sh.ShapeType()) { //fix for SAMTECH bug OCC322 about abcense internal vertices after sewing.
B.Add ( result, newsh );
@@ -522,23 +525,33 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
}
if ( ! modif ) return shape;
// restore Range on edge broken by EmptyCopied()
if ( st == TopAbs_EDGE ) {
CopyRanges (result, shape, 0, 1);
// For empty topological containers (any kind of shape except vertex, edge
// and face) we have to produce an empty result
if ( isEmpty && st != TopAbs_VERTEX && st != TopAbs_EDGE && st != TopAbs_FACE )
{
result = TopoDS_Shape();
}
else if (st == TopAbs_FACE) {
TopoDS_Face face = TopoDS::Face ( shape );
if( BRep_Tool::NaturalRestriction( face ) ) {
BRep_Builder aB;
aB.NaturalRestriction( TopoDS::Face ( result ), Standard_True );
else
{
// restore Range on edge broken by EmptyCopied()
if ( st == TopAbs_EDGE ) {
CopyRanges (result, shape, 0, 1);
}
}
else if (st == TopAbs_WIRE || st == TopAbs_SHELL)
result.Closed (BRep_Tool::IsClosed (result));
else if (st == TopAbs_FACE) {
TopoDS_Face face = TopoDS::Face ( shape );
if( BRep_Tool::NaturalRestriction( face ) ) {
BRep_Builder aB;
aB.NaturalRestriction( TopoDS::Face ( result ), Standard_True );
}
}
else if (st == TopAbs_WIRE || st == TopAbs_SHELL)
result.Closed (BRep_Tool::IsClosed (result));
result.Orientation(orien);
}
result.Orientation(orien);
myStatus = locStatus;
Replace ( shape, result );
myStatus = locStatus;
return result;
}

View File

@@ -1332,8 +1332,11 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ){
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}
@@ -1389,8 +1392,12 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ){
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}
@@ -1457,8 +1464,10 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S1->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S2->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ){
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}
@@ -1525,8 +1534,10 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
Standard_Real tol = tolesp*1.e2;
// Standard_Real u,v;
Extrema_GenLocateExtPS proj1(pt1,S2->Surface(),SolDep(1),SolDep(2),tol,tol);
Extrema_GenLocateExtPS proj2(pt2,S1->Surface(),SolDep(3),SolDep(4),tol,tol);
Extrema_GenLocateExtPS proj1(S2->Surface(), tol, tol);
proj1.Perform(pt1, SolDep(1), SolDep(2));
Extrema_GenLocateExtPS proj2(S1->Surface(), tol, tol);
proj2.Perform(pt2, SolDep(3), SolDep(4));
if( proj1.IsDone() ) {
(proj1.Point()).Parameter(SolDep(1),SolDep(2));
}

View File

@@ -543,21 +543,15 @@ proc checkprops {shape args} {
_check_args ${args} ${options} "checkprops"
if { ${length} != -1 || ${equal_check} == 1 } {
set CommandName lprops
set mass $length
set prop "length"
lappend CommandNames {lprops}
set equal_check 0
}
if { ${area} != -1 || ${equal_check} == 1 } {
set CommandName sprops
set mass $area
set prop "area"
lappend CommandNames {sprops}
set equal_check 0
}
if { ${volume} != -1 || ${equal_check} == 1 } {
set CommandName vprops
set mass $volume
set prop "volume"
lappend CommandNames {vprops}
set equal_check 0
}
@@ -565,41 +559,47 @@ proc checkprops {shape args} {
if { $skip } {
set skip_option "-skip"
}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${shape} ${epsilon} $skip_option] full m
if { ${compared_equal_shape} != -1 } {
upvar ${compared_equal_shape} ${compared_equal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_equal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m != $m } {
puts "Error: Shape ${compared_equal_shape} is not equal to shape ${shape}"
foreach CommandName ${CommandNames} {
switch $CommandName {
"lprops" { set mass ${length}; set prop "length" }
"sprops" { set mass ${area}; set prop "area" }
"vprops" { set mass ${volume}; set prop "volume" }
}
}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${shape} ${epsilon} $skip_option] full m
if { ${compared_notequal_shape} != -1 } {
upvar ${compared_notequal_shape} ${compared_notequal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_notequal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m == $m } {
puts "Error: Shape ${compared_notequal_shape} is equal shape to ${shape}"
if { ${compared_equal_shape} != -1 } {
upvar ${compared_equal_shape} ${compared_equal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_equal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m != $m } {
puts "Error: Shape ${compared_equal_shape} is not equal to shape ${shape}"
}
}
}
if { ${compared_equal_shape} == -1 && ${compared_notequal_shape} == -1 } {
if { [string compare "$mass" "empty"] != 0 } {
if { $m == 0 } {
puts "Error : The command is not valid. The $prop is 0."
if { ${compared_notequal_shape} != -1 } {
upvar ${compared_notequal_shape} ${compared_notequal_shape}
regexp {Mass +: +([-0-9.+eE]+)} [eval ${CommandName} ${compared_notequal_shape} ${epsilon} $skip_option] full compared_m
if { $compared_m == $m } {
puts "Error: Shape ${compared_notequal_shape} is equal shape to ${shape}"
}
if { $mass > 0 } {
puts "The expected $prop is $mass"
}
#check of change of area is < 1%
if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
puts "Error : The $prop of result shape is $m"
}
} else {
if { $m != 0 } {
puts "Error : The command is not valid. The $prop is $m"
}
if { ${compared_equal_shape} == -1 && ${compared_notequal_shape} == -1 } {
if { [string compare "$mass" "empty"] != 0 } {
if { $m == 0 } {
puts "Error : The command is not valid. The $prop is 0."
}
if { $mass > 0 } {
puts "The expected $prop is $mass"
}
#check of change of area is < 1%
if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
puts "Error : The $prop of result shape is $m"
}
} else {
if { $m != 0 } {
puts "Error : The command is not valid. The $prop is $m"
}
}
}
}

View File

@@ -1428,7 +1428,7 @@ proc _html_color {status} {
if { $status == "OK" } {
return lightgreen
} elseif { [regexp -nocase {^FAIL} $status] } {
return red
return ff8080
} elseif { [regexp -nocase {^BAD} $status] } {
return yellow
} elseif { [regexp -nocase {^IMP} $status] } {
@@ -1976,7 +1976,7 @@ proc _log_html_diff {file log dir1 dir2 highlight_percent} {
# put a line; highlight considerable (> ${highlight_percent}%) deviations of CPU and memory
if { [regexp "\[\\\[](\[0-9.e+-]+)%\[\]]" $line res value] &&
[expr abs($value)] > ${highlight_percent} } {
puts $fd "<table><tr><td bgcolor=\"[expr $value > 0 ? \"red\" : \"lightgreen\"]\">$line</td></tr></table>"
puts $fd "<table><tr><td bgcolor=\"[expr $value > 0 ? \"ff8080\" : \"lightgreen\"]\">$line</td></tr></table>"
} else {
puts $fd $line
}

View File

@@ -36,9 +36,13 @@
Extrema_ExtElC2d::Extrema_ExtElC2d () { myDone = Standard_False; }
//=============================================================================
Extrema_ExtElC2d::Extrema_ExtElC2d (const gp_Lin2d& C1,
const gp_Lin2d& C2,
const Standard_Real)
//=======================================================================
//function : Extrema_ExtElC2d
//purpose :
//=======================================================================
Extrema_ExtElC2d::Extrema_ExtElC2d (const gp_Lin2d& C1,
const gp_Lin2d& C2,
const Standard_Real)
/*-----------------------------------------------------------------------------
Function:
Find min distance between 2 straight lines.
@@ -57,15 +61,37 @@ Method:
myIsPar = Standard_False;
myNbExt = 0;
gp_Dir2d D1 = C1.Direction();
gp_Dir2d D2 = C2.Direction();
if (D1.IsParallel(D2, Precision::Angular())) {
gp_Vec2d D1(C1.Direction());
gp_Vec2d D2(C2.Direction());
if (D1.IsParallel(D2, Precision::Angular()))
{
myIsPar = Standard_True;
mySqDist[0] = C2.SquareDistance(C1.Location());
}
else {
myNbExt = 0;
else
{
// Vector from P1 to P2 (P2 - P1).
gp_Vec2d aP1P2(C1.Location(), C2.Location());
// Solve linear system using Cramer's rule:
// D1.X * t1 + D2.X * (-t2) = P2.X - P1.X
// D1.Y * t1 + D2.Y * (-t2) = P2.Y - P1.Y
// There is no division by zero since lines are not parallel.
Standard_Real aDelim = 1 / (D1^D2);
Standard_Real aParam1 = (aP1P2 ^ D2) * aDelim;
Standard_Real aParam2 = -(D1 ^ aP1P2) * aDelim; // -1.0 coefficient before t2.
gp_Pnt2d P1 = ElCLib::Value(aParam1, C1);
gp_Pnt2d P2 = ElCLib::Value(aParam2, C2);
mySqDist[myNbExt] = 0.0;
myPoint[myNbExt][0] = Extrema_POnCurv2d(aParam1,P1);
myPoint[myNbExt][1] = Extrema_POnCurv2d(aParam2,P2);
myNbExt = 1;
}
myDone = Standard_True;
}
//=============================================================================

View File

@@ -21,7 +21,7 @@
#include <Standard_Type.hxx>
#include <Standard_Real.hxx>
#include <Extrema_FuncExtPS.hxx>
#include <Extrema_FuncPSNorm.hxx>
#include <gp_Vec.hxx>
#include <gp_Ax2.hxx>
#include <Extrema_GenExtPS.hxx>
@@ -98,7 +98,7 @@ private:
Standard_Real myvinf;
Standard_Real myvsup;
Standard_Real mytolv;
Extrema_FuncExtPS myF;
Extrema_FuncPSNorm myF;
Handle(Adaptor3d_HCurve) myC;
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) myS;
gp_Vec myDirection;

View File

@@ -0,0 +1,119 @@
// Created on: 2016-05-10
// Created by: Alexander MALYSHEV
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Extrema_FuncPSDist.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <math_Vector.hxx>
//=======================================================================
//function : Extrema_FuncPSDist
//purpose :
//=======================================================================
Extrema_FuncPSDist::Extrema_FuncPSDist(const Adaptor3d_Surface& theS,
const gp_Pnt& theP)
: mySurf(theS),
myP(theP)
{
}
//=======================================================================
//function : NbVariables
//purpose :
//=======================================================================
Standard_Integer Extrema_FuncPSDist::NbVariables () const
{
return 2;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Standard_Boolean Extrema_FuncPSDist::Value(const math_Vector& X,Standard_Real& F)
{
if (!IsInside(X))
return Standard_False;
F = mySurf.Value(X(1), X(2)).SquareDistance(myP);
return Standard_True;
}
//=======================================================================
//function : Gradient
//purpose :
//=======================================================================
Standard_Boolean Extrema_FuncPSDist::Gradient(const math_Vector& X,math_Vector& G)
{
if (!IsInside(X))
return Standard_False;
gp_Pnt aP;
gp_Vec Du1s, Dv1s;
mySurf.D1(X(1),X(2),aP,Du1s,Dv1s);
gp_Vec P1P2 (aP, myP);
G(1) = P1P2.Dot(Du1s);
G(2) = P1P2.Dot(Dv1s);
return Standard_True;
}
//=======================================================================
//function : Values
//purpose :
//=======================================================================
Standard_Boolean Extrema_FuncPSDist::Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
{
if (!IsInside(X))
return Standard_False;
gp_Pnt aP;
gp_Vec Du1s, Dv1s;
mySurf.D1(X(1),X(2),aP,Du1s,Dv1s);
gp_Vec P1P2 (aP, myP);
G(1) = P1P2.Dot(Du1s);
G(2) = P1P2.Dot(Dv1s);
F = mySurf.Value(X(1), X(2)).SquareDistance(myP);
return true;
}
//=======================================================================
//function : IsInside
//purpose :
//=======================================================================
Standard_Boolean Extrema_FuncPSDist::IsInside(const math_Vector& X)
{
if (X(1) < mySurf.FirstUParameter() ||
X(1) > mySurf.LastUParameter() ||
X(2) < mySurf.FirstUParameter() ||
X(2) > mySurf.LastUParameter() )
{
// Point out of borders.
return Standard_False;
}
// Point is inside.
return Standard_True;
}

View File

@@ -0,0 +1,82 @@
// Created on: 2016-05-10
// Created by: Alexander MALYSHEV
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Extrema_FuncPSDsit_HeaderFile
#define _Extrema_FuncPSDsit_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <math_MultipleVarFunctionWithGradient.hxx>
#include <gp_Pnt.hxx>
#include <Adaptor3d_Surface.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class math_Vector;
//! Functional for search of extremum of the square Euclidean distance between point P and
//! surface S, starting from approximate solution (u0, v0).
//!
//! The class inherits math_MultipleVarFunctionWithGradient and thus is intended
//! for use in math_BFGS algorithm.
//!
//! The criteria is:
//! F = SquareDist(P, S(u, v)) - > min
//!
//! The first derivative are:
//! F1(u,v) = (S(u,v) - P) * Su
//! F2(u,v) = (S(u,v) - P) * Sv
//!
//! Su and Sv are first derivatives of the surface, * symbol means dot product.
class Extrema_FuncPSDist : public math_MultipleVarFunctionWithGradient
{
public:
DEFINE_STANDARD_ALLOC
//! Constructor.
Standard_EXPORT Extrema_FuncPSDist(const Adaptor3d_Surface& theS,
const gp_Pnt& theP);
//! Number of variables.
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
//! Value.
Standard_EXPORT Standard_Boolean Value(const math_Vector& X,Standard_Real& F) Standard_OVERRIDE;
//! Gradient.
Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X,math_Vector& G) Standard_OVERRIDE;
//! Value and gradient.
Standard_EXPORT Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G) Standard_OVERRIDE;
private:
//! Check point is inside of the surface parameter space.
//! Returns true if inside and false otherwise.
Standard_Boolean IsInside(const math_Vector& X);
const Extrema_FuncPSDist& operator=(const Extrema_FuncPSDist&);
Extrema_FuncPSDist(const Extrema_FuncPSDist&);
const Adaptor3d_Surface &mySurf;
const gp_Pnt &myP;
};
#endif // _Extrema_FuncPSDsit_HeaderFile

View File

@@ -14,27 +14,25 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Modified by skv - Thu Sep 30 15:21:07 2004 OCC593
#include <Extrema_FuncPSNorm.hxx>
#include <Adaptor3d_Surface.hxx>
#include <Extrema_FuncExtPS.hxx>
#include <Extrema_POnSurf.hxx>
#include <GeomAbs_IsoType.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <math_Matrix.hxx>
#include <Precision.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_TypeMismatch.hxx>
Extrema_FuncExtPS::Extrema_FuncExtPS ()
Extrema_FuncPSNorm::Extrema_FuncPSNorm ()
{
myPinit = Standard_False;
mySinit = Standard_False;
}
//=============================================================================
Extrema_FuncExtPS::Extrema_FuncExtPS (const gp_Pnt& P,
Extrema_FuncPSNorm::Extrema_FuncPSNorm (const gp_Pnt& P,
const Adaptor3d_Surface& S)
{
myP = P;
@@ -44,7 +42,7 @@ Extrema_FuncExtPS::Extrema_FuncExtPS (const gp_Pnt& P,
}
//=============================================================================
void Extrema_FuncExtPS::Initialize(const Adaptor3d_Surface& S)
void Extrema_FuncPSNorm::Initialize(const Adaptor3d_Surface& S)
{
myS = (Adaptor3d_SurfacePtr)&S;
mySinit = Standard_True;
@@ -54,7 +52,7 @@ void Extrema_FuncExtPS::Initialize(const Adaptor3d_Surface& S)
//=============================================================================
void Extrema_FuncExtPS::SetPoint(const gp_Pnt& P)
void Extrema_FuncPSNorm::SetPoint(const gp_Pnt& P)
{
myP = P;
myPinit = Standard_True;
@@ -66,13 +64,13 @@ void Extrema_FuncExtPS::SetPoint(const gp_Pnt& P)
//=============================================================================
Standard_Integer Extrema_FuncExtPS::NbVariables () const { return 2;}
Standard_Integer Extrema_FuncPSNorm::NbVariables () const { return 2;}
//=============================================================================
Standard_Integer Extrema_FuncExtPS::NbEquations () const { return 2;}
Standard_Integer Extrema_FuncPSNorm::NbEquations () const { return 2;}
//=============================================================================
Standard_Boolean Extrema_FuncExtPS::Value (const math_Vector& UV,
Standard_Boolean Extrema_FuncPSNorm::Value (const math_Vector& UV,
math_Vector& F)
{
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
@@ -90,7 +88,7 @@ Standard_Boolean Extrema_FuncExtPS::Value (const math_Vector& UV,
}
//=============================================================================
Standard_Boolean Extrema_FuncExtPS::Derivatives (const math_Vector& UV,
Standard_Boolean Extrema_FuncPSNorm::Derivatives (const math_Vector& UV,
math_Matrix& Df)
{
math_Vector F(1,2);
@@ -98,7 +96,7 @@ Standard_Boolean Extrema_FuncExtPS::Derivatives (const math_Vector& UV,
}
//=============================================================================
Standard_Boolean Extrema_FuncExtPS::Values (const math_Vector& UV,
Standard_Boolean Extrema_FuncPSNorm::Values (const math_Vector& UV,
math_Vector& F,
math_Matrix& Df)
{
@@ -123,7 +121,7 @@ Standard_Boolean Extrema_FuncExtPS::Values (const math_Vector& UV,
}
//=============================================================================
Standard_Integer Extrema_FuncExtPS::GetStateNumber ()
Standard_Integer Extrema_FuncPSNorm::GetStateNumber ()
{
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
//comparison of solution with previous solutions
@@ -145,20 +143,20 @@ Standard_Integer Extrema_FuncExtPS::GetStateNumber ()
}
//=============================================================================
Standard_Integer Extrema_FuncExtPS::NbExt () const
Standard_Integer Extrema_FuncPSNorm::NbExt () const
{
return mySqDist.Length();
}
//=============================================================================
Standard_Real Extrema_FuncExtPS::SquareDistance (const Standard_Integer N) const
Standard_Real Extrema_FuncPSNorm::SquareDistance (const Standard_Integer N) const
{
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
return mySqDist.Value(N);
}
//=============================================================================
const Extrema_POnSurf& Extrema_FuncExtPS::Point (const Standard_Integer N) const
const Extrema_POnSurf& Extrema_FuncPSNorm::Point (const Standard_Integer N) const
{
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
return myPoint.Value(N);

View File

@@ -14,12 +14,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Extrema_FuncExtPS_HeaderFile
#define _Extrema_FuncExtPS_HeaderFile
#ifndef _Extrema_FunctPSNorm_HeaderFile
#define _Extrema_FunctPSNorm_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Pnt.hxx>
#include <Adaptor3d_SurfacePtr.hxx>
@@ -58,16 +57,16 @@ class Extrema_POnSurf;
//! Dvf2(u,v) = Sv^2 + (S-P) * Svv
//!
//! Here * denotes scalar product, and ^2 is square power.
class Extrema_FuncExtPS : public math_FunctionSetWithDerivatives
class Extrema_FuncPSNorm : public math_FunctionSetWithDerivatives
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT Extrema_FuncExtPS();
Standard_EXPORT Extrema_FuncPSNorm();
Standard_EXPORT Extrema_FuncExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S);
Standard_EXPORT Extrema_FuncPSNorm(const gp_Pnt& P, const Adaptor3d_Surface& S);
//! sets the field mysurf of the function.
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S);
@@ -100,19 +99,8 @@ public:
//! Returns the Nth extremum.
Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
protected:
private:
gp_Pnt myP;
Adaptor3d_SurfacePtr myS;
Standard_Real myU;
@@ -122,14 +110,5 @@ private:
Extrema_SequenceOfPOnSurf myPoint;
Standard_Boolean myPinit;
Standard_Boolean mySinit;
};
#endif // _Extrema_FuncExtPS_HeaderFile
#endif // _Extrema_FunctPSNorm_HeaderFile

View File

@@ -335,8 +335,7 @@ void Extrema_GenExtCC::Perform()
// Avoid mark parallel case when have duplicates out of tolerance.
// Bad conditioned task: bug25635_1, bug23706_10, bug23706_13.
const Standard_Integer aMinNbInfSol = 100;
if (aPnts.Size() >= aMinNbInfSol)
if (aPnts.Size() >= 2)
{
isParallel = Standard_True;
for(Standard_Integer anIdx = aPnts.Lower(); anIdx <= aPnts.Upper() - 1; anIdx++)

View File

@@ -27,7 +27,7 @@
#include <Extrema_HArray2OfPOnSurfParams.hxx>
#include <Extrema_HUBTreeOfSphere.hxx>
#include <Bnd_HArray1OfSphere.hxx>
#include <Extrema_FuncExtPS.hxx>
#include <Extrema_FuncPSNorm.hxx>
#include <Adaptor3d_SurfacePtr.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
@@ -148,7 +148,7 @@ private:
Handle(Extrema_HArray2OfPOnSurfParams) myPoints;
Extrema_HUBTreeOfSphere mySphereUBTree;
Handle(Bnd_HArray1OfSphere) mySphereArray;
Extrema_FuncExtPS myF;
Extrema_FuncPSNorm myF;
Adaptor3d_SurfacePtr myS;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;

View File

@@ -15,94 +15,117 @@
// commercial license or contractual agreement.
#include <Adaptor3d_Surface.hxx>
#include <Extrema_FuncExtPS.hxx>
#include <Extrema_GenLocateExtPS.hxx>
#include <Adaptor3d_Surface.hxx>
#include <Extrema_FuncPSNorm.hxx>
#include <Extrema_FuncPSDist.hxx>
#include <Extrema_POnSurf.hxx>
#include <gp.hxx>
#include <gp_Pnt.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_NewtonFunctionSetRoot.hxx>
#include <math_BFGS.hxx>
#include <math_Vector.hxx>
#include <Standard_DomainError.hxx>
#include <StdFail_NotDone.hxx>
//=============================================================================
Extrema_GenLocateExtPS::Extrema_GenLocateExtPS () { myDone = Standard_False; }
//=============================================================================
//=======================================================================
//function : Extrema_GenLocateExtPS
//purpose :
//=======================================================================
Extrema_GenLocateExtPS::Extrema_GenLocateExtPS(const Adaptor3d_Surface& theS,
const Standard_Real theTolU,
const Standard_Real theTolV)
: mySurf(theS),
myTolU(theTolU), myTolV(theTolV),
myDone(Standard_False),
mySqDist(-1.0)
{
}
Extrema_GenLocateExtPS::Extrema_GenLocateExtPS (const gp_Pnt& P,
const Adaptor3d_Surface& S,
const Standard_Real U0,
const Standard_Real V0,
const Standard_Real TolU,
const Standard_Real TolV)
/*-----------------------------------------------------------------------------
Function:
Find (U,V) close to (U0,V0) so that dist(S(U,V),P) was extreme.
Method:
If (u,v) is a solution, it is possible to write:
{ F1(u,v) = (S(u,v)-P).dS/du(u,v) = 0.
{ F2(u,v) = (S(u,v)-P).dS/dv(u,v) = 0.
The problem consists in finding, in the interval of surface definition,
the root of the system closest to (U0,V0).
Use class math_FunctionSetRoot with the following construction arguments:
- F: Extrema_FuncExtPS created from P and S,
- U0V0: math_Vector (U0,V0),
- Tol: Min(TolU,TolV),
- math_Vector (Uinf,Usup),
- math_Vector (Vinf,Vsup),
- 100. .
---------------------------------------------------------------------------*/
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void Extrema_GenLocateExtPS::Perform(const gp_Pnt& theP,
const Standard_Real theU0,
const Standard_Real theV0,
const Standard_Boolean isDistanceCriteria)
{
myDone = Standard_False;
Standard_Real Uinf, Usup, Vinf, Vsup;
Uinf = S.FirstUParameter();
Usup = S.LastUParameter();
Vinf = S.FirstVParameter();
Vsup = S.LastVParameter();
// Prepare initial data structures.
math_Vector aTol(1, 2), aStart(1, 2), aBoundInf(1, 2), aBoundSup(1, 2);
Extrema_FuncExtPS F (P,S);
math_Vector Tol(1, 2), Start(1, 2), BInf(1, 2), BSup(1, 2);
// Tolerance.
aTol(1) = myTolU;
aTol(2) = myTolV;
Tol(1) = TolU;
Tol(2) = TolV;
// Initial solution approximation.
aStart(1) = theU0;
aStart(2) = theV0;
Start(1) = U0;
Start(2) = V0;
// Borders.
aBoundInf(1) = mySurf.FirstUParameter();
aBoundInf(2) = mySurf.FirstVParameter();
aBoundSup(1) = mySurf.LastUParameter();
aBoundSup(2) = mySurf.LastVParameter();
BInf(1) = Uinf;
BInf(2) = Vinf;
BSup(1) = Usup;
BSup(2) = Vsup;
if (isDistanceCriteria == Standard_False)
{
// Normal projection criteria.
Extrema_FuncPSNorm F(theP,mySurf);
math_FunctionSetRoot SR (F, Tol);
SR.Perform(F, Start, BInf, BSup);
if (!SR.IsDone())
return;
math_FunctionSetRoot SR (F, aTol);
SR.Perform(F, aStart, aBoundInf, aBoundSup);
if (!SR.IsDone())
return;
mySqDist = F.SquareDistance(1);
myPoint = F.Point(1);
myDone = Standard_True;
mySqDist = F.SquareDistance(1);
myPoint = F.Point(1);
myDone = Standard_True;
}
else
{
// Distance criteria.
Extrema_FuncPSDist F(mySurf, theP);
math_BFGS aSolver(2);
aSolver.Perform(F, aStart);
if (!aSolver.IsDone())
return;
math_Vector aResPnt(1,2);
aSolver.Location(aResPnt);
mySqDist = aSolver.Minimum();
myPoint.SetParameters(aResPnt(1), aResPnt(2), mySurf.Value(aResPnt(1), aResPnt(2)));
myDone = Standard_True;
}
}
//=============================================================================
Standard_Boolean Extrema_GenLocateExtPS::IsDone () const { return myDone; }
//=============================================================================
//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean Extrema_GenLocateExtPS::IsDone () const
{
return myDone;
}
//=======================================================================
//function : SquareDistance
//purpose :
//=======================================================================
Standard_Real Extrema_GenLocateExtPS::SquareDistance () const
{
if (!IsDone()) { StdFail_NotDone::Raise(); }
return mySqDist;
}
//=============================================================================
//=======================================================================
//function : Point
//purpose :
//=======================================================================
const Extrema_POnSurf& Extrema_GenLocateExtPS::Point () const
{
if (!IsDone()) { StdFail_NotDone::Raise(); }
return myPoint;
}
//=============================================================================

View File

@@ -19,7 +19,6 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
@@ -33,23 +32,27 @@ class Extrema_POnSurf;
//! With a close point, it calculates the distance
//! between a point and a surface.
//! This distance can be a minimum or a maximum.
//! Criteria type is defined in "Perform" method.
class Extrema_GenLocateExtPS
{
public:
DEFINE_STANDARD_ALLOC
//! Constructor.
Standard_EXPORT Extrema_GenLocateExtPS(const Adaptor3d_Surface& theS,
const Standard_Real theTolU = Precision::PConfusion(),
const Standard_Real theTolV = Precision::PConfusion());
Standard_EXPORT Extrema_GenLocateExtPS();
//! Calculates the distance with a close point.
//! The close point is defined by the parameter values
//! U0 and V0.
//! The function F(u,v)=distance(S(u,v),p) has an
//! extremun when gradient(F)=0. The algorithm searchs
//! a zero near the close point.
Standard_EXPORT Extrema_GenLocateExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real U0, const Standard_Real V0, const Standard_Real TolU, const Standard_Real TolV);
//! Calculates the extrema between the point and the surface using a close point.
//! The close point is defined by the parameter values theU0 and theV0.
//! Type of the algorithm depends on the isDistanceCriteria flag.
//! If flag value is false - normal projection criteria will be used.
//! If flag value is true - distance criteria will be used.
Standard_EXPORT void Perform(const gp_Pnt& theP,
const Standard_Real theU0,
const Standard_Real theV0,
const Standard_Boolean isDistanceCriteria = Standard_False);
//! Returns True if the distance is found.
Standard_EXPORT Standard_Boolean IsDone() const;
@@ -60,20 +63,19 @@ public:
//! Returns the point of the extremum distance.
Standard_EXPORT const Extrema_POnSurf& Point() const;
protected:
private:
const Extrema_GenLocateExtPS& operator=(const Extrema_GenLocateExtPS&);
Extrema_GenLocateExtPS(const Extrema_GenLocateExtPS&);
// Input.
const Adaptor3d_Surface& mySurf;
Standard_Real myTolU, myTolV;
// State.
Standard_Boolean myDone;
// Result.
Standard_Real mySqDist;
Extrema_POnSurf myPoint;

View File

@@ -72,8 +72,10 @@ Extrema_FuncExtCC.lxx
Extrema_FuncExtCS.cxx
Extrema_FuncExtCS.hxx
Extrema_FuncExtPC.gxx
Extrema_FuncExtPS.cxx
Extrema_FuncExtPS.hxx
Extrema_FuncPSNorm.cxx
Extrema_FuncPSNorm.hxx
Extrema_FuncPSDist.cxx
Extrema_FuncPSDist.hxx
Extrema_FuncExtSS.cxx
Extrema_FuncExtSS.hxx
Extrema_GenExtCC.gxx

View File

@@ -38,7 +38,7 @@ struct Font_FontMgr_FontAliasMapNode
static const Font_FontMgr_FontAliasMapNode Font_FontMgr_MapOfFontsAliases[] =
{
#ifdef _WIN32
#if defined(_WIN32) || defined(__APPLE__)
{ "Courier" , "Courier New" , Font_FA_Regular },
{ "Times-Roman" , "Times New Roman", Font_FA_Regular },
@@ -122,15 +122,21 @@ static const Font_FontMgr_FontAliasMapNode Font_FontMgr_MapOfFontsAliases[] =
"ttc",
"pfa",
"pfb",
#ifdef __APPLE__
// Datafork TrueType (OS X), obsolete
//"dfont",
#endif
NULL
};
#if !defined(__ANDROID__) && !defined(__APPLE__)
// X11 configuration file in plain text format (obsolete - doesn't exists in modern distributives)
static Standard_CString myFontServiceConf[] = {"/etc/X11/fs/config",
"/usr/X11R6/lib/X11/fs/config",
"/usr/X11/lib/X11/fs/config",
NULL
};
#endif
#ifdef __APPLE__
// default fonts paths in Mac OS X
@@ -384,6 +390,7 @@ void Font_FontMgr::InitFontDataBase()
#else
NCollection_Map<TCollection_AsciiString> aMapOfFontsDirs;
#if !defined(__ANDROID__) && !defined(__APPLE__)
const OSD_Protection aProtectRead (OSD_R, OSD_R, OSD_R, OSD_R);
// read fonts directories from font service config file (obsolete)
@@ -440,6 +447,7 @@ void Font_FontMgr::InitFontDataBase()
}
aFile.Close();
}
#endif
// append default directories
for (Standard_Integer anIter = 0; myDefaultFontsDirs[anIter] != NULL; ++anIter)
@@ -461,7 +469,7 @@ void Font_FontMgr::InitFontDataBase()
for (NCollection_Map<TCollection_AsciiString>::Iterator anIter (aMapOfFontsDirs);
anIter.More(); anIter.Next())
{
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__APPLE__)
OSD_Path aFolderPath (anIter.Value());
for (OSD_FileIterator aFileIter (aFolderPath, "*"); aFileIter.More(); aFileIter.Next())
{

View File

@@ -991,7 +991,7 @@ Handle(Geom2d_BSplineCurve) Geom2dAdaptor_Curve::BSpline() const
static Standard_Integer nbPoints(const Handle(Geom2d_Curve)& theCurve)
{
Standard_Integer nbs = 10;
Standard_Integer nbs = 20;
if(theCurve->IsKind(STANDARD_TYPE( Geom2d_Line)) )
nbs = 2;

View File

@@ -95,7 +95,9 @@ public:
//! Create a domain from a curve
Standard_EXPORT IntRes2d_Domain ComputeDomain (const Adaptor2d_Curve2d& C1, const Standard_Real TolDomain) const;
//! Set / get minimum number of points in polygon intersection.
Standard_EXPORT void SetMinNbSamples (const Standard_Integer theMinNbSamples);
Standard_EXPORT Standard_Integer GetMinNbSamples () const;
protected:

View File

@@ -25,21 +25,25 @@
//============================================================
Standard_Integer Geom2dInt_Geom2dCurveTool::NbSamples (const Adaptor2d_Curve2d& C,
const Standard_Real U0,
const Standard_Real U1)
const Standard_Real U0,
const Standard_Real U1)
{
GeomAbs_CurveType typC = C.GetType();
Standard_Integer nbs = C.NbSamples();
if(typC == GeomAbs_BSplineCurve) {
Standard_Real t=C.LastParameter()-C.FirstParameter();
Standard_Real t1=U1-U0;
if(t1<0.0) t1=-t1;
if(typC == GeomAbs_BSplineCurve)
{
Standard_Real t = C.LastParameter() - C.FirstParameter();
Standard_Real t1 = U1 - U0;
if(t1 < 0.0) t1 = -t1;
nbs = C.NbKnots();
nbs*= C.Degree();
Standard_Real anb = t1/t * nbs;
Standard_Real anb = t1 / t * nbs;
nbs = (Standard_Integer)anb;
if(nbs < 4) nbs=4;
Standard_Integer aMinPntNb = Max(C.Degree() + 1, 4);
if(nbs < aMinPntNb)
nbs = aMinPntNb;
}
else if (typC == GeomAbs_Circle)
{

View File

@@ -42,14 +42,15 @@ public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT Geom2dInt_TheIntPCurvePCurveOfGInter();
Standard_EXPORT void Perform (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Adaptor2d_Curve2d& Curve2, const IntRes2d_Domain& Domain2, const Standard_Real TolConf, const Standard_Real Tol);
Standard_EXPORT void Perform (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Standard_Real TolConf, const Standard_Real Tol);
//! Set / get minimum number of points in polygon for intersection.
Standard_EXPORT void SetMinNbSamples (const Standard_Integer theMinNbSamples);
Standard_EXPORT Standard_Integer GetMinNbSamples () const;
protected:
@@ -59,9 +60,6 @@ protected:
Standard_EXPORT void Perform (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Standard_Real TolConf, const Standard_Real Tol, const Standard_Integer NbIter, const Standard_Real DeltaU, const Standard_Real DeltaV);
private:
@@ -72,10 +70,11 @@ private:
//! : during prelimanary search for line (case of bad paramerization of Bspline for example).
Standard_EXPORT Standard_Boolean findIntersect (const Adaptor2d_Curve2d& Curve1, const IntRes2d_Domain& Domain1, const Adaptor2d_Curve2d& Curve2, const IntRes2d_Domain& Domain2, const Standard_Real TolConf, const Standard_Real Tol, const Standard_Integer NbIter, const Standard_Real DeltaU, const Standard_Real DeltaV, const Geom2dInt_ThePolygon2dOfTheIntPCurvePCurveOfGInter& thePoly1, const Geom2dInt_ThePolygon2dOfTheIntPCurvePCurveOfGInter& thePoly2, const Standard_Boolean isFullRepresentation);
IntRes2d_Domain DomainOnCurve1;
IntRes2d_Domain DomainOnCurve2;
//! Minimal number of sample points
Standard_Integer myMinPntNb;
};

View File

@@ -81,10 +81,8 @@ GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1,Nb);
TColStd_Array1OfInteger TM(1,Nb);
myBSplineCurve->Knots(TK);
myBSplineCurve->Multiplicities(TM);
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U1,myBSplineCurve->IsPeriodic(),
1,Nb,Index1,newFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,U2,myBSplineCurve->IsPeriodic(),
@@ -293,10 +291,8 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1,Nb);
TColStd_Array1OfInteger TM(1,Nb);
myBSplineCurve->Knots(TK);
myBSplineCurve->Multiplicities(TM);
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
myBSplineCurve->IsPeriodic(),
1,Nb,Index1,newFirst);
@@ -418,10 +414,8 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1,Nb);
TColStd_Array1OfInteger TM(1,Nb);
myBSplineCurve->Knots(TK);
myBSplineCurve->Multiplicities(TM);
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
BSplCLib::LocateParameter(myBSplineCurve->Degree(),TK,TM,myFirst,
myBSplineCurve->IsPeriodic(),
1,Nb,Index1,newFirst);

View File

@@ -17,6 +17,29 @@
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CView,Graphic3d_DataStructureManager)
namespace
{
static const int THE_DEFAULT_LAYERS[] = { Graphic3d_ZLayerId_Top,
Graphic3d_ZLayerId_Topmost,
Graphic3d_ZLayerId_BotOSD,
Graphic3d_ZLayerId_TopOSD };
static const int THE_NB_DEFAULT_LAYERS = sizeof(THE_DEFAULT_LAYERS) / sizeof(*THE_DEFAULT_LAYERS);
void combineBox (Bnd_Box& aCombined, const Graphic3d_BndBox4f& theBox)
{
if (theBox.IsValid())
{
aCombined.Add (gp_Pnt (theBox.CornerMin().x(),
theBox.CornerMin().y(),
theBox.CornerMin().z()));
aCombined.Add (gp_Pnt (theBox.CornerMax().x(),
theBox.CornerMax().y(),
theBox.CornerMax().z()));
}
}
}
//=======================================================================
//function : Constructor
//purpose :
@@ -349,9 +372,11 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
// function : Update
// purpose :
// =======================================================================
void Graphic3d_CView::Update (const Aspect_TypeOfUpdate theUpdateMode)
void Graphic3d_CView::Update (const Aspect_TypeOfUpdate theUpdateMode,
const Graphic3d_ZLayerId theLayerId)
{
myMinMax.Invalidate();
InvalidateZLayerBoundingBox (theLayerId);
if (theUpdateMode == Aspect_TOU_ASAP)
{
Compute();
@@ -409,13 +434,68 @@ void Graphic3d_CView::DisplayedStructures (Graphic3d_MapOfStructure& theStructur
// =======================================================================
Bnd_Box Graphic3d_CView::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag) const
{
if (myMinMax.IsOutdated (theToIgnoreInfiniteFlag))
Bnd_Box aResult;
if (!IsDefined())
{
myMinMax.BoundingBox (theToIgnoreInfiniteFlag) = MinMaxValues (myStructsDisplayed, theToIgnoreInfiniteFlag);
myMinMax.IsOutdated (theToIgnoreInfiniteFlag) = Standard_False;
return aResult;
}
return myMinMax.BoundingBox (theToIgnoreInfiniteFlag);
Handle(Graphic3d_Camera) aCamera = Camera();
Standard_Integer aWinWidth = 0;
Standard_Integer aWinHeight = 0;
Window()->Size (aWinWidth, aWinHeight);
for (Standard_Integer aLayer = 0; aLayer < THE_NB_DEFAULT_LAYERS; ++aLayer)
{
Graphic3d_BndBox4f aBox = ZLayerBoundingBox (THE_DEFAULT_LAYERS[aLayer],
aCamera,
aWinWidth,
aWinHeight,
theToIgnoreInfiniteFlag);
combineBox (aResult, aBox);
}
Standard_Integer aMaxZLayer = ZLayerMax();
for (Standard_Integer aLayerId = Graphic3d_ZLayerId_Default; aLayerId <= aMaxZLayer; ++aLayerId)
{
Graphic3d_BndBox4f aBox = ZLayerBoundingBox (aLayerId, aCamera, aWinWidth, aWinHeight, theToIgnoreInfiniteFlag);
combineBox (aResult, aBox);
}
return aResult;
}
// =======================================================================
// function : ConsiderZoomPersistenceObjects
// purpose :
// =======================================================================
Standard_Real Graphic3d_CView::ConsiderZoomPersistenceObjects()
{
if (!IsDefined())
{
return 1.0;
}
Handle(Graphic3d_Camera) aCamera = Camera();
Standard_Integer aWinWidth = 0;
Standard_Integer aWinHeight = 0;
Window()->Size (aWinWidth, aWinHeight);
Standard_Real aMaxCoef = 1.0;
for (Standard_Integer aLayer = 0; aLayer < THE_NB_DEFAULT_LAYERS; ++aLayer)
{
aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (THE_DEFAULT_LAYERS[aLayer], aCamera, aWinWidth, aWinHeight, Standard_False));
}
for (Standard_Integer aLayer = Graphic3d_ZLayerId_Default; aLayer <= ZLayerMax(); ++aLayer)
{
aMaxCoef = Max (aMaxCoef, considerZoomPersistenceObjects (aLayer, aCamera, aWinWidth, aWinHeight, Standard_False));
}
return aMaxCoef;
}
// =======================================================================
@@ -672,7 +752,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
theStructure->CalculateBoundBox();
displayStructure (theStructure->CStructure(), theStructure->DisplayPriority());
Update (theUpdateMode);
Update (theUpdateMode, theStructure->GetZLayer());
return;
}
else if (anAnswer != Graphic3d_TOA_COMPUTE)
@@ -693,7 +773,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
}
displayStructure (anOldStruct->CStructure(), theStructure->DisplayPriority());
Update (theUpdateMode);
Update (theUpdateMode, anOldStruct->GetZLayer());
return;
}
else
@@ -716,7 +796,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
const Handle(Graphic3d_Structure)& aNewStruct = myStructsComputed.Value (aNewIndex);
myStructsComputed.SetValue (anIndex, aNewStruct);
displayStructure (aNewStruct->CStructure(), theStructure->DisplayPriority());
Update (theUpdateMode);
Update (theUpdateMode, aNewStruct->GetZLayer());
return;
}
else
@@ -807,7 +887,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
myStructsDisplayed.Add (theStructure);
displayStructure (aStruct->CStructure(), theStructure->DisplayPriority());
Update (theUpdateMode);
Update (theUpdateMode, aStruct->GetZLayer());
}
// =======================================================================
@@ -851,7 +931,7 @@ void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure,
}
}
myStructsDisplayed.Remove (theStructure);
Update (theUpdateMode);
Update (theUpdateMode, theStructure->GetZLayer());
}
// =======================================================================

View File

@@ -108,8 +108,10 @@ public:
//! Computes the new presentation of the structure displayed in this view with the type Graphic3d_TOS_COMPUTED.
Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
//! Updates screen in function of modifications of the structures.
Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode);
//! Updates screen in function of modifications of the structures
//! and invalidates bounding box of specified ZLayerId.
Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode,
const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN);
//! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles.
Standard_EXPORT Standard_Boolean ContainsFacet() const;
@@ -134,8 +136,7 @@ public:
Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId,
Handle(Graphic3d_Structure)& theComputedStruct) const;
//! Returns the coordinates of the boundary box of all
//! structures displayed in the view.
//! Returns the bounding box of all structures displayed in the view.
//! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
//! also includes minimum and maximum limits of graphical elements
//! forming parts of infinite structures.
@@ -336,6 +337,20 @@ public:
//! ID for the structure.
virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
//! Returns the maximum Z layer ID.
//! First layer ID is Graphic3d_ZLayerId_Default, last ID is ZLayerMax().
virtual Standard_Integer ZLayerMax() const = 0;
//! Returns the bounding box of all structures displayed in the Z layer.
virtual void InvalidateZLayerBoundingBox (const Graphic3d_ZLayerId theLayerId) const = 0;
//! Returns the bounding box of all structures displayed in the Z layer.
virtual Graphic3d_BndBox4f ZLayerBoundingBox (const Graphic3d_ZLayerId theLayerId,
const Handle(Graphic3d_Camera)& theCamera,
const Standard_Integer theWindowWidth,
const Standard_Integer theWindowHeight,
const Standard_Boolean theToIgnoreInfiniteFlag) const = 0;
//! Remove Z layer from the specified view. All structures
//! displayed at the moment in layer will be displayed in default layer
//! ( the bottom-level z layer ). To unset layer ID from associated
@@ -346,6 +361,9 @@ public:
virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
const Graphic3d_ZLayerSettings& theSettings) = 0;
//! Returns zoom-scale factor.
Standard_EXPORT Standard_Real ConsiderZoomPersistenceObjects();
//! Returns pointer to an assigned framebuffer object.
virtual Handle(Standard_Transient) FBO() const = 0;
@@ -522,29 +540,12 @@ private:
virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure,
const Standard_Integer theNewPriority) = 0;
protected:
struct CachedMinMax
{
CachedMinMax() { Invalidate(); }
Bnd_Box& BoundingBox (const Standard_Boolean theToIgnoreInfiniteFlag)
{
return !theToIgnoreInfiniteFlag ? myBoundingBox[0] : myBoundingBox[1];
}
Standard_Boolean& IsOutdated (const Standard_Boolean theToIgnoreInfiniteFlag)
{
return !theToIgnoreInfiniteFlag ? myIsOutdated[0] : myIsOutdated[1];
}
void Invalidate()
{
myIsOutdated[0] = Standard_True;
myIsOutdated[1] = Standard_True;
}
Standard_Boolean myIsOutdated [2];
Bnd_Box myBoundingBox[2];
};
//! Returns zoom-scale factor.
virtual Standard_Real considerZoomPersistenceObjects (const Graphic3d_ZLayerId theLayerId,
const Handle(Graphic3d_Camera)& theCamera,
const Standard_Integer theWindowWidth,
const Standard_Integer theWindowHeight,
const Standard_Boolean theToIgnoreInfiniteFlag) const = 0;
protected:
@@ -559,7 +560,6 @@ protected:
Standard_Boolean myIsActive;
Standard_Boolean myIsRemoved;
Graphic3d_TypeOfVisualization myVisualization;
mutable CachedMinMax myMinMax;
private:

View File

@@ -21,7 +21,6 @@
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <Aspect_DisplayConnection.hxx>
#include <Standard_Boolean.hxx>
#include <MMgt_TShared.hxx>
#include <Graphic3d_CView.hxx>
@@ -51,6 +50,7 @@
#include <TColStd_Array2OfReal.hxx>
#include <TColStd_SequenceOfInteger.hxx>
class Aspect_DisplayConnection;
class Graphic3d_CView;
class Graphic3d_GraphicDriver;
class Graphic3d_TransformError;

View File

@@ -123,7 +123,7 @@ void Graphic3d_Structure::Clear (const Standard_Boolean theWithDestruction)
myCStructure->ContainsFacet = 0;
myStructureManager->Clear (this, theWithDestruction);
Update();
Update (true);
}
//=======================================================================
@@ -363,7 +363,7 @@ void Graphic3d_Structure::SetVisible (const Standard_Boolean theValue)
myCStructure->visible = isVisible;
myCStructure->OnVisibilityChanged();
Update();
Update (true);
}
//=============================================================================
@@ -1385,7 +1385,7 @@ void Graphic3d_Structure::Connect (const Handle(Graphic3d_Structure)& theStructu
GraphicConnect (theStructure);
myStructureManager->Connect (this, theStructure);
Update();
Update (true);
}
else // Graphic3d_TOC_ANCESTOR
{
@@ -1422,7 +1422,7 @@ void Graphic3d_Structure::Disconnect (const Handle(Graphic3d_Structure)& theStru
myStructureManager->Disconnect (this, theStructure);
CalculateBoundBox();
Update();
Update (true);
}
else if (RemoveAncestor (aStructure))
{
@@ -1562,7 +1562,7 @@ void Graphic3d_Structure::SetTransform (const TColStd_Array2OfReal& theMat
myCStructure->UpdateTransformation();
myStructureManager->SetTransform (this, aNewTrsf);
Update();
Update (true);
}
//=============================================================================
@@ -1986,14 +1986,15 @@ void Graphic3d_Structure::PrintNetwork (const Handle(Graphic3d_Structure)& theSt
//function : Update
//purpose :
//=============================================================================
void Graphic3d_Structure::Update() const
void Graphic3d_Structure::Update (const bool theUpdateLayer) const
{
if (IsDeleted())
{
return;
}
myStructureManager->Update (myStructureManager->UpdateMode());
myStructureManager->Update (myStructureManager->UpdateMode(),
theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
}
//=============================================================================

View File

@@ -532,9 +532,9 @@ private:
//! Returns the manager to which <me> is associated.
Standard_EXPORT Handle(Graphic3d_StructureManager) StructureManager() const;
//! Calls the Update method of the StructureManager which
//! contains the Structure <me>.
Standard_EXPORT void Update() const;
//! Calls the Update method of the StructureManager which contains the Structure <me>.
//! If theUpdateLayer is true then invalidates bounding box of ZLayer.
Standard_EXPORT void Update (const bool theUpdateLayer = false) const;
//! Updates the c structure associated to <me>.
Standard_EXPORT void UpdateStructure (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF);

View File

@@ -83,11 +83,12 @@ Aspect_TypeOfUpdate Graphic3d_StructureManager::UpdateMode() const
// function : Update
// purpose :
// ========================================================================
void Graphic3d_StructureManager::Update (const Aspect_TypeOfUpdate theMode) const
void Graphic3d_StructureManager::Update (const Aspect_TypeOfUpdate theMode,
const Graphic3d_ZLayerId theLayerId) const
{
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
{
aViewIt.Value()->Update (theMode);
aViewIt.Value()->Update (theMode, theLayerId);
}
}

View File

@@ -109,8 +109,10 @@ public:
//! TOU_WAIT on demand (Update)
Standard_EXPORT Aspect_TypeOfUpdate UpdateMode() const;
//! Updates screen in function of modifications of the structures.
Standard_EXPORT virtual void Update (const Aspect_TypeOfUpdate theMode = Aspect_TOU_ASAP) const;
//! Updates screen in function of modifications of the structures
//! and invalidates bounding box of specified ZLayerId.
Standard_EXPORT virtual void Update (const Aspect_TypeOfUpdate theMode = Aspect_TOU_ASAP,
const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN) const;
//! Deletes and erases the 3D structure manager.
Standard_EXPORT virtual void Remove();

View File

@@ -91,11 +91,12 @@ void HLRAppli_ReflectLines::Perform()
//=======================================================================
TopoDS_Shape HLRAppli_ReflectLines::GetCompoundOf3dEdges(const HLRBRep_TypeOfResultingEdge type,
const Standard_Boolean visible)
const Standard_Boolean visible,
const Standard_Boolean In3d)
{
HLRBRep_HLRToShape aHLRToShape( myHLRAlgo );
TopoDS_Shape theCompound = aHLRToShape.CompoundOfEdges(type, visible, Standard_True);
TopoDS_Shape theCompound = aHLRToShape.CompoundOfEdges(type, visible, In3d);
BRepLib::SameParameter(theCompound,Precision::PConfusion(),Standard_False);
@@ -109,5 +110,5 @@ TopoDS_Shape HLRAppli_ReflectLines::GetCompoundOf3dEdges(const HLRBRep_TypeOfRes
TopoDS_Shape HLRAppli_ReflectLines::GetResult()
{
return GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True);
return GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True, Standard_True);
}

View File

@@ -55,9 +55,10 @@ public:
//! returns resulting compound of lines
//! of specified type and visibility
//! represented by edges in 3d
//! represented by edges in 3d or 2d
Standard_EXPORT TopoDS_Shape GetCompoundOf3dEdges(const HLRBRep_TypeOfResultingEdge type,
const Standard_Boolean visible);
const Standard_Boolean visible,
const Standard_Boolean In3d);

View File

@@ -95,7 +95,9 @@ public:
//! Create a domain from a curve
Standard_EXPORT IntRes2d_Domain ComputeDomain (const Standard_Address& C1, const Standard_Real TolDomain) const;
//! Set / get minimum number of points in polygon intersection.
Standard_EXPORT void SetMinNbSamples (const Standard_Integer theMinNbSamples);
Standard_EXPORT Standard_Integer GetMinNbSamples () const;
protected:

View File

@@ -60,8 +60,8 @@ HLRBRep_CurveTool::NbSamples (const Standard_Address C)
Standard_Integer
HLRBRep_CurveTool::NbSamples (const Standard_Address C,
const Standard_Real /*u1*/,
const Standard_Real /*u2*/)
const Standard_Real u1,
const Standard_Real u2)
{
GeomAbs_CurveType typC = ((HLRBRep_Curve *)C)->GetType();
static Standard_Real nbsOther = 10.0;
@@ -72,7 +72,9 @@ HLRBRep_CurveTool::NbSamples (const Standard_Address C,
else if(typC == GeomAbs_BezierCurve)
nbs = 3 + ((HLRBRep_Curve *)C)->NbPoles();
else if(typC == GeomAbs_BSplineCurve) {
nbs = ((HLRBRep_Curve *)C)->NbKnots();
Handle(Geom_Curve) aCurve = ((HLRBRep_Curve *)C)->Curve().Curve().Curve();
GeomAdaptor_Curve GAcurve(aCurve, u1, u2);
nbs = GAcurve.NbIntervals(GeomAbs_CN) + 1;
nbs*= ((HLRBRep_Curve *)C)->Degree();
if(nbs < 2.0) nbs=2;
}

View File

@@ -774,7 +774,7 @@ void HLRBRep_Data::Update (const HLRAlgo_Projector& P)
Standard_Boolean withOutL = Standard_False;
for (myFaceItr1.InitEdge(*fd);
myFaceItr1.MoreEdge() && !cut && !withOutL;
myFaceItr1.MoreEdge();
myFaceItr1.NextEdge()) {
if (myFaceItr1.Internal()) {
withOutL = Standard_True;
@@ -1223,7 +1223,7 @@ void HLRBRep_Data::NextInterference ()
if (myFEOri == TopAbs_FORWARD ||
myFEOri == TopAbs_REVERSED) {
// Edge from the boundary
if (!((HLRBRep_EdgeData*)myFEData)->Vertical() && !myFEDouble) {
if (!((HLRBRep_EdgeData*)myFEData)->Vertical() && !(myFEDouble && !myFEOutLine)) {
// not a vertical edge and not a double Edge
Standard_Address MinMaxFEdg = ((HLRBRep_EdgeData*)myFEData)->MinMax();
//-- -----------------------------------------------------------------------

View File

@@ -28,6 +28,7 @@
#include <HLRBRep_EdgeInterferenceTool.hxx>
#include <HLRBRep_Hider.hxx>
#include <HLRBRep_VertexList.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <Standard_ErrorHandler.hxx>
//=======================================================================
@@ -350,8 +351,56 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
Standard_Integer level = 0;
if (!myDS->SimpleHidingFace()) // Level at Start
level = myDS->HidingStartLevel(E,ed,ILHidden); // **************
HLRAlgo_ListIteratorOfInterferenceList It(ILHidden);
HLRAlgo_ListIteratorOfInterferenceList It(ILHidden);
if (myDS->SimpleHidingFace()) //remove excess interferences
{
TColStd_SequenceOfReal ToRemove;
TopAbs_Orientation PrevTrans = TopAbs_EXTERNAL;
Standard_Real PrevParam = 0.;
for (; It.More(); It.Next())
{
const HLRAlgo_Interference& Int = It.Value();
TopAbs_Orientation aTrans = Int.Transition();
if (aTrans == PrevTrans)
{
if (aTrans == TopAbs_FORWARD)
{
ToRemove.Append(Int.Intersection().Parameter());
#ifdef OCCT_DEBUG
cout<<"Two adjacent interferences with transition FORWARD"<<endl;
#endif
}
else if (aTrans == TopAbs_REVERSED)
{
ToRemove.Append(PrevParam);
#ifdef OCCT_DEBUG
cout<<"Two adjacent interferences with transition REVERSED"<<endl;
#endif
}
}
PrevTrans = aTrans;
PrevParam = Int.Intersection().Parameter();
}
It.Initialize(ILHidden);
while (It.More())
{
Standard_Real aParam = It.Value().Intersection().Parameter();
Standard_Boolean found = Standard_False;
for (Standard_Integer i = 1; i <= ToRemove.Length(); i++)
if (aParam == ToRemove(i))
{
found = Standard_True;
ILHidden.Remove(It);
ToRemove.Remove(i);
break;
}
if (!found)
It.Next();
}
} //remove excess interferences
It.Initialize(ILHidden);
while(It.More()) { // suppress multi-inside Intersections
// ***********************************
@@ -361,16 +410,20 @@ void HLRBRep_Hider::Hide(const Standard_Integer FI,
case TopAbs_FORWARD :
{
Standard_Integer decal = Int.Intersection().Level();
if (level > 0) ILHidden.Remove(It);
else It.Next();
if (level > 0)
ILHidden.Remove(It);
else
It.Next();
level = level + decal;
}
break;
case TopAbs_REVERSED :
{
level = level - Int.Intersection().Level();
if (level > 0) ILHidden.Remove(It);
else It.Next();
if (level > 0)
ILHidden.Remove(It);
else
It.Next();
}
break;
case TopAbs_EXTERNAL :

View File

@@ -84,6 +84,10 @@ myPolyhedron(NULL)
=NbInters=NbIntersVides=NbInters1Segment=NbInters1Point=NbIntersNPoints
= NbIntersNSegments=NbIntersPointEtSegment=NbIntersCSVides=0;
#endif
// Set minimal number of samples in case of HLR polygonal intersector.
const Standard_Integer aMinNbHLRSamples = 4;
myIntersector.SetMinNbSamples(aMinNbHLRSamples);
}
//=======================================================================
@@ -118,7 +122,10 @@ void HLRBRep_Intersector::Perform (const Standard_Address A1,
b = ((HLRBRep_Curve*)myC1)->Parameter2d(b);
IntRes2d_Domain D1(pa,a,(Standard_Real)ta,pb,b,(Standard_Real)tb);
tol = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance());
//modified by jgv, 18.04.2016 for OCC27341
//tol = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance());
tol = Precision::Confusion();
//////////////////////////////////////////
myIntersector.Perform(myC1,D1,tol,tol);
}
@@ -155,8 +162,12 @@ void HLRBRep_Intersector::Perform (const Standard_Integer /*nA*/,
Standard_Real a1,b1,a2,b2,d,dd,tol,tol1,tol2;
Standard_ShortReal ta,tb;
tol1 = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance());
tol2 = (Standard_Real)(((HLRBRep_EdgeData*) A2)->Tolerance());
//modified by jgv, 18.04.2016 for OCC27341
//tol1 = (Standard_Real)(((HLRBRep_EdgeData*) A1)->Tolerance());
//tol2 = (Standard_Real)(((HLRBRep_EdgeData*) A2)->Tolerance());
tol1 = Precision::Confusion();
tol2 = Precision::Confusion();
//////////////////////////////////////////
if (tol1 > tol2) tol = tol1;
else tol = tol2;

View File

@@ -49,8 +49,9 @@ public:
Standard_EXPORT void Perform (const Standard_Address& Curve1, const IntRes2d_Domain& Domain1, const Standard_Real TolConf, const Standard_Real Tol);
//! Set / get minimum number of points in polygon for intersection.
Standard_EXPORT void SetMinNbSamples (const Standard_Integer theMinNbSamples);
Standard_EXPORT Standard_Integer GetMinNbSamples () const;
protected:
@@ -76,7 +77,8 @@ private:
IntRes2d_Domain DomainOnCurve1;
IntRes2d_Domain DomainOnCurve2;
//! Minimal number of sample points
Standard_Integer myMinPntNb;
};

View File

@@ -486,11 +486,11 @@ static Standard_Integer hlrin3d(Draw_Interpretor& , Standard_Integer n, const ch
BRep_Builder BB;
BB.MakeCompound(Result);
TopoDS_Shape SharpEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Sharp, Standard_True);
TopoDS_Shape SharpEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Sharp, Standard_True, Standard_True);
BB.Add(Result, SharpEdges);
TopoDS_Shape OutLines = Reflector.GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True);
TopoDS_Shape OutLines = Reflector.GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True, Standard_True);
BB.Add(Result, OutLines);
TopoDS_Shape SmoothEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Rg1Line, Standard_True);
TopoDS_Shape SmoothEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Rg1Line, Standard_True, Standard_True);
BB.Add(Result, SmoothEdges);
DBRep::Set(a[1], Result);

View File

@@ -68,59 +68,6 @@
#define APPROX 1
static Standard_Boolean IntLineRisesFromRegularity(const TopoDS_Edge& anIntLine,
const TopoDS_Edge& anEdge,
const TopoDS_Face&,
const TopTools_ListOfShape& aList)
{
TopoDS_Vertex Ver [2];
TopExp::Vertices(anIntLine, Ver[0], Ver[1]);
//find min param and max param
Standard_Real MinPar = RealLast(), MaxPar = RealFirst();
TopTools_ListIteratorOfListOfShape itl(aList);
for (; itl.More(); itl.Next())
{
const TopoDS_Edge& anOutLine = TopoDS::Edge(itl.Value());
Standard_Real aFirst, aLast;
BRep_Tool::Range(anOutLine, aFirst, aLast);
if (aFirst < MinPar)
MinPar = aFirst;
if (aLast > MaxPar)
MaxPar = aLast;
}
Standard_Real theTol = BRep_Tool::Tolerance(anEdge);
Standard_Real ParamTol = Precision::Confusion();
Standard_Integer i, j;
for (i = 0; i < 2; i++)
{
BRepExtrema_ExtPC anExtPC(Ver[i], anEdge);
if (!anExtPC.IsDone())
continue;
Standard_Integer NbExt = anExtPC.NbExt();
if (NbExt == 0)
continue;
Standard_Integer jmin = 1;
for (j = 2; j <= NbExt; j++)
if (anExtPC.SquareDistance(j) < anExtPC.SquareDistance(jmin))
jmin = j;
Standard_Real aDist = anExtPC.SquareDistance(jmin);
aDist = Sqrt(aDist);
if (aDist > theTol)
continue;
Standard_Real theParam = anExtPC.Parameter(jmin);
if (theParam > MinPar + ParamTol &&
theParam < MaxPar - ParamTol)
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : Insert
//purpose : explore the faces and insert them
@@ -507,50 +454,6 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
}
}
}
//jgv: correction of internal outlines: remove those that rise from middle of boundary outlines
TopTools_ListIteratorOfListOfShape itl(IntL);
while (itl.More())
{
TopoDS_Edge anIntLine = TopoDS::Edge(itl.Value());
Standard_Real found = Standard_False;
TopExp_Explorer Explo(F, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(Explo.Current());
if (!BRep_Tool::HasContinuity(anEdge))
continue;
TopLoc_Location RegLoc;
Standard_Real fpar, lpar;
Handle(Geom_Curve) RegCurve = BRep_Tool::Curve(anEdge, RegLoc, fpar, lpar);
TopTools_ListOfShape thelist;
TopTools_ListIteratorOfListOfShape itoutl(OutL);
for (; itoutl.More(); itoutl.Next())
{
TopoDS_Edge anOutLine = TopoDS::Edge(itoutl.Value());
TopLoc_Location aLoc;
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anOutLine, aLoc, aFirst, aLast);
if (aCurve == RegCurve && aLoc == RegLoc)
thelist.Append(anOutLine);
}
if (thelist.IsEmpty())
continue;
if (IntLineRisesFromRegularity(anIntLine, anEdge, F, thelist))
{
IntL.Remove(itl);
found = Standard_True;
break;
}
}
if (!found)
itl.Next();
}
///////////////////////////////////////////////////
}
//=======================================================================

View File

@@ -27,7 +27,11 @@ IMPLEMENT_STANDARD_RTTIEXT(IVtkVTK_View,IVtk_IView)
// Since VTK 6 the factory methods require "auto-initialization" depending on
// what modules are enabled at VTK configure time.
// Some defines are needed in order to make the factories work properly.
#ifdef VTK_OPENGL2_BACKEND
VTK_MODULE_INIT(vtkRenderingOpenGL2)
#else
VTK_MODULE_INIT(vtkRenderingOpenGL)
#endif
VTK_MODULE_INIT(vtkInteractionStyle)
// Handle implementation

View File

@@ -1234,8 +1234,8 @@ void IntCurve_IntConicConic::Perform(const gp_Lin2d& L1
IntRes2d_IntersectionPoint PtSeg1,PtSeg2;
Standard_Real aHalfSinL1L2;
Standard_Real Tol = TolR;
if(TolR< 1e-10) Tol = 1e-10;
if(Tol < Precision::PConfusion())
Tol = Precision::PConfusion();
LineLineGeometricIntersection(L1,L2,Tol,U1,U2,aHalfSinL1L2,nbsol);

View File

@@ -1116,57 +1116,20 @@ IntCurve_IntCurveCurveGen::InternalCompositePerform(const TheCurve& C1,
}
}
//=======================================================================
//function : SetMinNbSamples
//purpose :
//=======================================================================
void IntCurve_IntCurveCurveGen::SetMinNbSamples(const Standard_Integer theMinNbSamples)
{
intcurvcurv.SetMinNbSamples(theMinNbSamples);
}
//----------------------------------------------------------------------
//-- InterComposite ( C1 , Num1 , C2 , Num2 , Recursion_sur_C2 )
//--
//-- Boolean Arret = False
//--
//-- Si C2.Type() == Composite Max2 = C2.GetIntervals() Sinon Max2=2
//--
//-- Si C1.Type() == Composite Max1 = C1.GetIntervals() Sinon Max1=2
//--
//-- Si Num2 > Max2 RETURN;
//--
//-- Sinon
//--
//-- Si Recursion_sur_C2 == True
//--
//-- for i = Num1 --> Max1
//--
//-- Num1 = i
//--
//-- InterComposite(C2,Num2,C1,Num1,False);
//--
//-- Si Num2 < Max2
//--
//-- Num2++
//--
//-- Num1 = 1
//--
//-- InterComposite(C1,Num1,C2,Num2,True);
//--
//-- Sinon
//--
//-- *** INTERSECTION ENTRE C2[num2] et C1[Num1] ***
//--
//-- Fin
//--
//--
//-- (( Appel avec C1 , 1 , C2 , 1 , True))
//--
//-- Exemple : C1 = ABCD C2= 12
//--
//-- donne : A,1 B,1 C,1 D,1 A,2 B,2 C,2 D,2
//----------------------------------------------------------------------
//=======================================================================
//function : GetMinNbSamples
//purpose :
//=======================================================================
Standard_Integer IntCurve_IntCurveCurveGen::GetMinNbSamples() const
{
return intcurvcurv.GetMinNbSamples();
}

View File

@@ -50,10 +50,7 @@
//======================================================================
// Modified by skv - Tue Mar 1 14:22:09 2005 OCC8169 Begin
// #define NBITER_MAX_POLYGON 3
#define NBITER_MAX_POLYGON 10
// Modified by skv - Tue Mar 1 14:22:09 2005 OCC8169 End
#define TOL_CONF_MINI 0.0000000001
#define TOL_MINI 0.0000000001
@@ -84,7 +81,10 @@ Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1
//======================================================================
IntCurve_IntPolyPolyGen::IntCurve_IntPolyPolyGen(void) {
IntCurve_IntPolyPolyGen::IntCurve_IntPolyPolyGen()
{
const Standard_Integer aMinPntNb = 20; // Minimum number of samples.
myMinPntNb = aMinPntNb;
done = Standard_False;
}
//======================================================================
@@ -631,50 +631,43 @@ Standard_Boolean HeadOrEndPoint( const IntRes2d_Domain& D1
return(Standard_False);
}
//======================================================================
void IntCurve_IntPolyPolyGen::Perform( const TheCurve& C1
,const IntRes2d_Domain& D1
,const TheCurve& C2
,const IntRes2d_Domain& D2
,const Standard_Real TolConf
,const Standard_Real Tol
,const Standard_Integer NbIter
,const Standard_Real DeltaU
,const Standard_Real DeltaV) {
//=======================================================================
//function : Perform
//purpose : Base method to perform polyline / polyline intersection for
// pair of curves.
//=======================================================================
void IntCurve_IntPolyPolyGen::Perform(const TheCurve& C1,
const IntRes2d_Domain& D1,
const TheCurve& C2,
const IntRes2d_Domain& D2,
const Standard_Real TolConf,
const Standard_Real Tol,
const Standard_Integer NbIter,
const Standard_Real DeltaU,
const Standard_Real DeltaV)
{
Standard_Integer nbsamplesOnC1,nbsamplesOnC2;
done = Standard_False;
if(NbIter>NBITER_MAX_POLYGON) return;
nbsamplesOnC1 = TheCurveTool::NbSamples(C1,D1.FirstParameter(),D1.LastParameter());
if (NbIter == 0) // first time
{
if (nbsamplesOnC1 < 20)
nbsamplesOnC1 = 20;
}
else // NbIter > 0
{
nbsamplesOnC1=(5*(nbsamplesOnC1*NbIter))/4;
}
/////////////////////////////////////////////
// Number of samples tunning.
nbsamplesOnC1 = TheCurveTool::NbSamples(C1,D1.FirstParameter(),D1.LastParameter());
nbsamplesOnC2 = TheCurveTool::NbSamples(C2,D2.FirstParameter(),D2.LastParameter());
if (NbIter == 0) // first time
{
if (nbsamplesOnC2 < 20)
nbsamplesOnC2 = 20;
}
else // NbIter > 0
{
nbsamplesOnC2=(5*(nbsamplesOnC2*NbIter))/4;
}
/////////////////////////////////////////////
if (NbIter == 0)
{
// Minimal number of points.
nbsamplesOnC1 = Max(nbsamplesOnC1, myMinPntNb);
nbsamplesOnC2 = Max(nbsamplesOnC2, myMinPntNb);
}
else
{
// Increase number of samples in second and next iterations.
nbsamplesOnC1=(5 * (nbsamplesOnC1 * NbIter)) / 4;
nbsamplesOnC2=(5 * (nbsamplesOnC2 * NbIter)) / 4;
}
NCollection_Handle<IntCurve_ThePolygon2d>
aPoly1 = new IntCurve_ThePolygon2d(C1,nbsamplesOnC1,D1,Tol),
aPoly2 = new IntCurve_ThePolygon2d(C2,nbsamplesOnC2,D2,Tol);
@@ -1184,3 +1177,21 @@ void GetIntersection(const TheCurve& theC1, const Standard_Real theT1f, const St
}
}
//=======================================================================
//function : GetMinNbPoints
//purpose :
//=======================================================================
Standard_Integer IntCurve_IntPolyPolyGen::GetMinNbSamples() const
{
return myMinPntNb;
}
//=======================================================================
//function : SetMinNbPoints
//purpose :
//=======================================================================
void IntCurve_IntPolyPolyGen::SetMinNbSamples(const Standard_Integer theMinNbSamples)
{
myMinPntNb = theMinNbSamples;
}

View File

@@ -2782,9 +2782,8 @@ static Standard_Boolean DecomposeResult(const Handle(IntPatch_PointLine)& theLin
theQSurf->D0(aUquad, aVquad, aPQuad);
Extrema_GenLocateExtPS anExtr(aPQuad, thePSurf->Surface(), aU0, aV0,
Precision::PConfusion(),
Precision::PConfusion());
Extrema_GenLocateExtPS anExtr(thePSurf->Surface());
anExtr.Perform(aPQuad, aU0, aV0);
if(!anExtr.IsDone())
{
@@ -2946,9 +2945,8 @@ static Standard_Boolean DecomposeResult(const Handle(IntPatch_PointLine)& theLin
theQSurf->D0(aUquad, aVquad, aPQuad);
Extrema_GenLocateExtPS anExtr(aPQuad, thePSurf->Surface(), aU0, aV0,
Precision::PConfusion(),
Precision::PConfusion());
Extrema_GenLocateExtPS anExtr(thePSurf->Surface());
anExtr.Perform(aPQuad, aU0, aV0);
if(!anExtr.IsDone())
{

View File

@@ -1716,8 +1716,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
if(PW.IsDone()) {
if(PW.NbPoints()>2)
{
//Try to extend the intersection line to boundary, if it is possibly
Standard_Boolean hasBeenAdded = PW.PutToBoundary(Surf1, Surf2);
//Try to extend the intersection line to boundary, if it is possible.
PW.PutToBoundary(Surf1, Surf2);
RejetLigne = Standard_False;
Point3dDebut = PW.Value(1).Value();
@@ -1773,8 +1773,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)&
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
if (RestrictLine){
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang,hasBeenAdded);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang,hasBeenAdded);
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
}
if(wline->NbVertex() == 0) {
@@ -2345,13 +2345,12 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
if( iPWNbPoints > 2 )
{
//Try to extend the intersection line to boundary, if it is possibly
Standard_Boolean hasBeenAdded = PW.PutToBoundary(Surf1, Surf2);
PW.PutToBoundary(Surf1, Surf2);
const Standard_Integer aMinNbPoints = 40;
if(iPWNbPoints < aMinNbPoints)
{
hasBeenAdded =
PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints) || hasBeenAdded;
PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
iPWNbPoints = PW.NbPoints();
}
@@ -2453,9 +2452,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang,hasBeenAdded);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang,hasBeenAdded);
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
if(wline->NbVertex() == 0)
{
IntPatch_Point vtx;

View File

@@ -442,12 +442,11 @@ static Standard_Boolean IsSegment2dSmall(const IntPatch_Polygo& Pol,
//=======================================================================
void IntPatch_RstInt::PutVertexOnLine (const Handle(IntPatch_Line)& L,
const Handle(Adaptor3d_HSurface)& Surf,
const Handle(Adaptor3d_TopolTool)& Domain,
const Handle(Adaptor3d_HSurface)& OtherSurf,
const Standard_Boolean OnFirst,
const Standard_Real Tol,
const Standard_Boolean hasBeenAdded)
const Handle(Adaptor3d_HSurface)& Surf,
const Handle(Adaptor3d_TopolTool)& Domain,
const Handle(Adaptor3d_HSurface)& OtherSurf,
const Standard_Boolean OnFirst,
const Standard_Real Tol)
{
// Domain est le domaine de restriction de la surface Surf.
@@ -1243,7 +1242,7 @@ void IntPatch_RstInt::PutVertexOnLine (const Handle(IntPatch_Line)& L,
*/
wlin->SetPeriod(pu1,pv1,pu2,pv2);
wlin->ComputeVertexParameters(Tol, hasBeenAdded);
wlin->ComputeVertexParameters(Tol);
}
else {
rlin->ComputeVertexParameters(Tol);

View File

@@ -38,7 +38,12 @@ public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT static void PutVertexOnLine (const Handle(IntPatch_Line)& L, const Handle(Adaptor3d_HSurface)& Surf, const Handle(Adaptor3d_TopolTool)& Domain, const Handle(Adaptor3d_HSurface)& OtherSurf, const Standard_Boolean OnFirst, const Standard_Real Tol, const Standard_Boolean hasBeenAdded = Standard_False);
Standard_EXPORT static void PutVertexOnLine (const Handle(IntPatch_Line)& L,
const Handle(Adaptor3d_HSurface)& Surf,
const Handle(Adaptor3d_TopolTool)& Domain,
const Handle(Adaptor3d_HSurface)& OtherSurf,
const Standard_Boolean OnFirst,
const Standard_Real Tol);
};

View File

@@ -255,8 +255,7 @@ inline Standard_Boolean CompareVerticesOnS2(const IntPatch_Point& vtx1, const In
{return CompareVerticesOnSurf (vtx1, vtx2, Standard_False);}
void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol,
const Standard_Boolean hasBeenAdded)
void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol)
{
// MSV Oct 15, 2001: use tolerance of vertex instead of RTol where
// it is possible
@@ -505,30 +504,8 @@ void IntPatch_WLine::ComputeVertexParameters( const Standard_Real RTol,
for(i=1; i<=nbvtx; i++) {
const gp_Pnt& P = svtx.Value(i).Value();
Standard_Real vTol = svtx.Value(i).Tolerance();
if(hasBeenAdded)
{
if(nbvtx == 2)
{
if(i == nbvtx)
{
indicevertex = curv->NbPoints();
}
else
{
indicevertex = svtx.Value(i).ParameterOnLine();
}
}
else
{
indicevertex = svtx.Value(i).ParameterOnLine();
}
}
else
{
indicevertex = svtx.Value(i).ParameterOnLine();
}
indicevertex = svtx.Value(i).ParameterOnLine();
indicevertexonline = (Standard_Integer)indicevertex;
//--------------------------------------------------
//-- On Compare le vertex avec les points de la ligne

View File

@@ -124,7 +124,7 @@ public:
//! if a vertex is already in the line,
//! its parameter is modified
//! else a new point in the line is inserted.
Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol, const Standard_Boolean hasBeenAdded = Standard_False);
Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol);
//! Returns set of intersection points
Standard_EXPORT virtual Handle(IntSurf_LineOn2S) Curve() const Standard_OVERRIDE;

View File

@@ -379,9 +379,10 @@ static Handle(IntPatch_WLine)
Standard_Real aStepOnS1 = aPntOnS1[0].SquareModulus() / aPntOnS1[1].SquareModulus();
Standard_Real aStepOnS2 = aPntOnS2[0].SquareModulus() / aPntOnS2[1].SquareModulus();
Standard_Real aStepCoeff = Min(aStepOnS1, aStepOnS2) / Max(aStepOnS1, aStepOnS2);
if (aStepCoeff > aLimitCoeff)
// Check very rare case when wline fluctuates nearly one point and some of them may be equal.
// Middle point will be deleted when such situation occurs.
// bugs moddata_2 bug469.
if (Min(aStepOnS1, aStepOnS2) >= aLimitCoeff * Max(aStepOnS1, aStepOnS2))
{
// Set hash flag to "Delete" state.
isDeleteState = Standard_True;

View File

@@ -1312,8 +1312,9 @@ void IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(const Standard_Boo
//
gp_Pnt aPoint = myCurve.Value(aCurPar);
Extrema_GenLocateExtPS anExtrema(aPoint, mySurface, U, V, 1.e-10, 1.e-10);
Extrema_GenLocateExtPS anExtrema(mySurface, 1.e-10, 1.e-10);
anExtrema.Perform(aPoint, U, V);
if(anExtrema.IsDone()) {
if(anExtrema.SquareDistance() < myCriteria * myCriteria) {
Extrema_POnSurf aPOnSurf = anExtrema.Point();

View File

@@ -113,7 +113,8 @@ static void IsParallel(const Handle(IntSurf_LineOn2S)& theLine,
theIsUparallel = theIsVparallel = Standard_True;
Standard_Integer aNbPoints = theLine->NbPoints();
const Standard_Integer aNbLinePnts = theLine->NbPoints();
Standard_Integer aNbPoints = aNbLinePnts;
if(aNbPoints > aNbPointsMAX)
{
aNbPoints = aNbPointsMAX;
@@ -131,10 +132,9 @@ static void IsParallel(const Handle(IntSurf_LineOn2S)& theLine,
Standard_Real aUmin = RealLast(), aUmax = RealFirst(), aVmin = RealLast(), aVmax = RealFirst();
for(Standard_Integer aNum = 1; aNum <= aNbPoints; aNum++, aNPoint += aStep)
{
if(aNPoint > aNbPoints)
{
aNPoint = aNbPoints;
}
// Fix possible "out of parameter" case.
if (aNPoint > aNbLinePnts)
aNPoint = aNbLinePnts;
Standard_Real u, v;
if(theCheckSurf1)
@@ -159,100 +159,6 @@ static void IsParallel(const Handle(IntSurf_LineOn2S)& theLine,
theIsUparallel = ((aVmax - aVmin) < theToler);
}
//=======================================================================
//function : Checking
//purpose : Check, if given point is in surface's boundaries.
// If "yes" then theFactTol = 0.0, else theFactTol is
// equal maximal deviation.
//=======================================================================
static Standard_Boolean Checking( const Handle(Adaptor3d_HSurface)& theASurf1,
const Handle(Adaptor3d_HSurface)& theASurf2,
Standard_Real& theU1,
Standard_Real& theV1,
Standard_Real& theU2,
Standard_Real& theV2,
Standard_Real& theFactTol)
{
const Standard_Real aTol = Precision::PConfusion();
const Standard_Real aU1bFirst = theASurf1->FirstUParameter();
const Standard_Real aU1bLast = theASurf1->LastUParameter();
const Standard_Real aU2bFirst = theASurf2->FirstUParameter();
const Standard_Real aU2bLast = theASurf2->LastUParameter();
const Standard_Real aV1bFirst = theASurf1->FirstVParameter();
const Standard_Real aV1bLast = theASurf1->LastVParameter();
const Standard_Real aV2bFirst = theASurf2->FirstVParameter();
const Standard_Real aV2bLast = theASurf2->LastVParameter();
Standard_Boolean isOnOrIn = Standard_True;
theFactTol = 0.0;
Standard_Real aDelta = aU1bFirst - theU1;
if(aDelta > aTol)
{
theU1 = aU1bFirst;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
aDelta = theU1 - aU1bLast;
if(aDelta > aTol)
{
theU1 = aU1bLast;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
aDelta = aV1bFirst - theV1;
if(aDelta > aTol)
{
theV1 = aV1bFirst;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
aDelta = theV1 - aV1bLast;
if(aDelta > aTol)
{
theV1 = aV1bLast;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
aDelta = aU2bFirst - theU2;
if(aDelta > aTol)
{
theU2 = aU2bFirst;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
aDelta = theU2 - aU2bLast;
if(aDelta > aTol)
{
theU2 = aU2bLast;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
aDelta = aV2bFirst - theV2;
if(aDelta > aTol)
{
theV2 = aV2bFirst;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
aDelta = theV2 - aV2bLast;
if(aDelta > aTol)
{
theV2 = aV2bLast;
theFactTol = Max(theFactTol, aDelta);
isOnOrIn = Standard_False;
}
return isOnOrIn;
}
//==================================================================================
// function : IntWalk_PWalking::IntWalk_PWalking
// purpose :
@@ -617,8 +523,9 @@ static Standard_Real SQDistPointSurface(const gp_Pnt &thePnt,
const Standard_Real theU0,
const Standard_Real theV0)
{
const Extrema_GenLocateExtPS aExtPS(thePnt, theSurf, theU0, theV0,
Precision::PConfusion(), Precision::PConfusion());
Extrema_GenLocateExtPS aExtPS(theSurf);
aExtPS.Perform(thePnt, theU0, theV0);
if(!aExtPS.IsDone())
return RealLast();
@@ -2259,6 +2166,55 @@ DistanceMinimizeByExtrema(const Handle(Adaptor3d_HSurface)& theASurf,
return (aSQDistPrev < aTol);
}
//=======================================================================
//function : HandleSingleSingularPoint
//purpose :
//=======================================================================
Standard_Boolean IntWalk_PWalking::HandleSingleSingularPoint(const Handle(Adaptor3d_HSurface)& theASurf1,
const Handle(Adaptor3d_HSurface)& theASurf2,
const Standard_Real the3DTol,
TColStd_Array1OfReal &thePnt)
{
// u1, v1, u2, v2 order is used.
Standard_Real aLowBorder[4] = {theASurf1->FirstUParameter(),
theASurf1->FirstVParameter(),
theASurf2->FirstUParameter(),
theASurf2->FirstVParameter()};
Standard_Real aUppBorder[4] = {theASurf1->LastUParameter(),
theASurf1->LastVParameter(),
theASurf2->LastUParameter(),
theASurf2->LastVParameter()};
IntImp_ConstIsoparametric aLockedDir[4] = {IntImp_UIsoparametricOnCaro1,
IntImp_VIsoparametricOnCaro1,
IntImp_UIsoparametricOnCaro2,
IntImp_VIsoparametricOnCaro2};
// Create new intersector with new tolerance.
IntWalk_TheInt2S anInt(theASurf1, theASurf2, the3DTol);
math_FunctionSetRoot aRsnld(anInt.Function());
for (Standard_Integer i = 1; i <= 4; ++i)
{
if ( Abs(thePnt(i) - aLowBorder[i - 1]) < Precision::PConfusion() ||
Abs(thePnt(i) - aUppBorder[i - 1]) < Precision::PConfusion())
{
anInt.Perform(thePnt,aRsnld, aLockedDir[i - 1]);
if (!anInt.IsDone())
continue;
if (anInt.IsEmpty())
continue;
anInt.Point().Parameters(thePnt(1), thePnt(2), thePnt(3), thePnt(4));
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : SeekPointOnBoundary
//purpose :
@@ -2272,79 +2228,64 @@ SeekPointOnBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
const Standard_Real theV2,
const Standard_Boolean isTheFirst)
{
const Standard_Real aTol = 1.0e-14;
Standard_Boolean isOK = Standard_False;
Standard_Real U1prec = theU1, V1prec = theV1, U2prec = theU2, V2prec = theV2;
Standard_Boolean flFinish = Standard_False;
// Tune solution tolerance according with object size.
const Standard_Real aRes1 = Max(Precision::PConfusion() / theASurf1->UResolution(1.0),
Precision::PConfusion() / theASurf1->VResolution(1.0));
const Standard_Real aRes2 = Max(Precision::PConfusion() / theASurf2->UResolution(1.0),
Precision::PConfusion() / theASurf2->VResolution(1.0));
const Standard_Real a3DTol = Max(aRes1, aRes2);
const Standard_Real aTol = Max(Precision::Confusion(), a3DTol);
// u1, v1, u2, v2 order is used.
TColStd_Array1OfReal aPnt(1,4);
aPnt(1) = theU1; aPnt(2) = theV1; aPnt(3) = theU2; aPnt(4) = theV2;
TColStd_Array1OfReal aSingularPnt(aPnt);
Standard_Integer aNbIter = 20;
while(!flFinish)
Standard_Boolean aStatus = Standard_False;
do
{
flFinish = Standard_False;
Standard_Boolean aStatus = Standard_False;
do
{
aNbIter--;
aStatus = DistanceMinimizeByGradient(theASurf1, theASurf2, U1prec, V1prec, U2prec, V2prec);
if(aStatus)
{
break;
}
aStatus = DistanceMinimizeByExtrema(theASurf1, theASurf2->Value(U2prec, V2prec), U1prec, V1prec);
if(aStatus)
{
break;
}
aStatus = DistanceMinimizeByExtrema(theASurf2, theASurf1->Value(U1prec, V1prec), U2prec, V2prec);
if(aStatus)
{
break;
}
}
while(!aStatus && (aNbIter > 0));
aNbIter--;
aStatus = DistanceMinimizeByGradient(theASurf1, theASurf2, aPnt(1), aPnt(2), aPnt(3), aPnt(4));
if(aStatus)
{
const Standard_Real aTolMax = 1.0e-8;
Standard_Real aTolF = 0.0;
Standard_Real u1 = U1prec, v1 = V1prec, u2 = U2prec, v2 = V2prec;
flFinish = Checking(theASurf1, theASurf2, U1prec, V1prec, U2prec, V2prec, aTolF);
if(aTolF <= aTolMax)
{
gp_Pnt aP1 = theASurf1->Value(u1, v1),
aP2 = theASurf2->Value(u2, v2);
gp_Pnt aPInt(0.5*(aP1.XYZ() + aP2.XYZ()));
const Standard_Real aSQDist1 = aPInt.SquareDistance(aP1),
aSQDist2 = aPInt.SquareDistance(aP2);
if((aSQDist1 < aTol) && (aSQDist2 < aTol))
{
IntSurf_PntOn2S anIP;
anIP.SetValue(aPInt, u1, v1, u2, v2);
if(isTheFirst)
line->InsertBefore(1,anIP);
else
line->Add(anIP);
isOK = Standard_True;
}
}
}
else
{
break;
}
if(aNbIter < 0)
aStatus = DistanceMinimizeByExtrema(theASurf1, theASurf2->Value(aPnt(3), aPnt(4)), aPnt(1), aPnt(2));
if(aStatus)
break;
aStatus = DistanceMinimizeByExtrema(theASurf2, theASurf1->Value(aPnt(1), aPnt(2)), aPnt(3), aPnt(4));
if(aStatus)
break;
}
while(!aStatus && (aNbIter > 0));
// Handle singular points.
Standard_Boolean aSingularStatus = HandleSingleSingularPoint(theASurf1, theASurf2, aTol, aSingularPnt);
if (aSingularStatus)
aPnt = aSingularPnt;
if(aStatus || aSingularStatus)
{
gp_Pnt aP1 = theASurf1->Value(aPnt(1), aPnt(2)),
aP2 = theASurf2->Value(aPnt(3), aPnt(4));
gp_Pnt aPInt(0.5*(aP1.XYZ() + aP2.XYZ()));
const Standard_Real aSQDist = aPInt.SquareDistance(aP1);
if (aSQDist < aTol * aTol)
{
IntSurf_PntOn2S anIP;
anIP.SetValue(aPInt, aPnt(1), aPnt(2), aPnt(3), aPnt(4));
if(isTheFirst)
line->InsertBefore(1,anIP);
else
line->Add(anIP);
isOK = Standard_True;
}
}
return isOK;
@@ -2395,7 +2336,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = u1 - aU1bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u1 = aU1bFirst - aDelta;
u1 = aU1bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2403,7 +2344,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aU1bLast - u1;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u1 = aU1bLast + aDelta;
u1 = aU1bLast;
isNeedAdding = Standard_True;
}
}
@@ -2414,7 +2355,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = u2 - aU2bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u2 = aU2bFirst - aDelta;
u2 = aU2bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2422,7 +2363,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aU2bLast - u2;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u2 = aU2bLast + aDelta;
u2 = aU2bLast;
isNeedAdding = Standard_True;
}
}
@@ -2433,7 +2374,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = v1 - aV1bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v1 = aV1bFirst - aDelta;
v1 = aV1bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2441,7 +2382,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aV1bLast - v1;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v1 = aV1bLast + aDelta;
v1 = aV1bLast;
isNeedAdding = Standard_True;
}
}
@@ -2452,7 +2393,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = v2 - aV2bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v2 = aV2bFirst - aDelta;
v2 = aV2bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2460,7 +2401,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aV2bLast - v2;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v2 = aV2bLast + aDelta;
v2 = aV2bLast;
isNeedAdding = Standard_True;
}
}
@@ -2482,7 +2423,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = u1 - aU1bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u1 = aU1bFirst - aDelta;
u1 = aU1bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2490,7 +2431,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aU1bLast - u1;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u1 = aU1bLast + aDelta;
u1 = aU1bLast;
isNeedAdding = Standard_True;
}
}
@@ -2501,7 +2442,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = u2 - aU2bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u2 = aU2bFirst - aDelta;
u2 = aU2bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2509,7 +2450,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aU2bLast - u2;
if((aTolMin < aDelta) && (aDelta < aTol))
{
u2 = aU2bLast + aDelta;
u2 = aU2bLast;
isNeedAdding = Standard_True;
}
}
@@ -2520,7 +2461,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = v1 - aV1bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v1 = aV1bFirst - aDelta;
v1 = aV1bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2528,7 +2469,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aV1bLast - v1;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v1 = aV1bLast + aDelta;
v1 = aV1bLast;
isNeedAdding = Standard_True;
}
}
@@ -2539,7 +2480,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = v2 - aV2bFirst;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v2 = aV2bFirst - aDelta;
v2 = aV2bFirst;
isNeedAdding = Standard_True;
}
else
@@ -2547,7 +2488,7 @@ PutToBoundary(const Handle(Adaptor3d_HSurface)& theASurf1,
aDelta = aV2bLast - v2;
if((aTolMin < aDelta) && (aDelta < aTol))
{
v2 = aV2bLast + aDelta;
v2 = aV2bLast;
isNeedAdding = Standard_True;
}
}

View File

@@ -167,6 +167,11 @@ private:
Standard_EXPORT Standard_Boolean SeekPointOnBoundary (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2, const Standard_Real theU1, const Standard_Real theV1, const Standard_Real theU2, const Standard_Real theV2, const Standard_Boolean isTheFirst);
// Method to handle single singular point. Sub-method in SeekPointOnBoundary.
Standard_Boolean HandleSingleSingularPoint(const Handle(Adaptor3d_HSurface) &theASurf1,
const Handle(Adaptor3d_HSurface) &theASurf2,
const Standard_Real the3DTol,
TColStd_Array1OfReal &thePnt);
Standard_Boolean done;
Handle(IntSurf_LineOn2S) line;

View File

@@ -107,6 +107,8 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
}
else if (myTagPerStep && aHasRead)
{
// in myTagPerStep mode, we should parse the buffer to the end before
// getting more characters from the stream.
}
else
{
@@ -225,6 +227,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
aState = STATE_TEXT;
aStartData = myPtr;
myPtr = myEndPtr;
aHasRead = Standard_False;
} // end of checking in STATE_WAITING
continue;
@@ -244,6 +247,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
return XML_HEADER;
}
myPtr = myEndPtr - 1;
aHasRead = Standard_False;
continue;
// Checking the characters in STATE_DOCTYPE, seek for "]>" sequence
@@ -264,6 +268,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
}
}
myPtr = myEndPtr - 1;
aHasRead = Standard_False;
continue;
state_doctype_markup:
@@ -282,6 +287,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
return XML_DOCTYPE;
}
myPtr = myEndPtr - 1;
aHasRead = Standard_False;
continue;
// Checking the characters in STATE_COMMENT, seek for "-->" sequence
@@ -303,6 +309,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
}
}
myPtr = myEndPtr - 2;
aHasRead = Standard_False;
continue;
// Checking the characters in STATE_TEXT, seek for "<"
@@ -316,6 +323,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
return XML_TEXT;
}
myPtr = myEndPtr;
aHasRead = Standard_False;
continue;
// Checking the characters in STATE_CDATA, seek for "]]"
@@ -334,6 +342,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
return XML_CDATA;
}
myPtr = myEndPtr - 1;
aHasRead = Standard_False;
continue;
// Checking the characters in STATE_ELEMENT, seek the end of TagName
@@ -489,8 +498,11 @@ attr_name:
myPtr = aPtr + 1;
aStartData = NULL;
aState = STATE_ATTRIBUTE_NAME;
} else
}
else {
myPtr = myEndPtr;
aHasRead = Standard_False;
}
continue;
}
// Checking the characters in STATE_ELEMENT_END, seek for ">"
@@ -504,6 +516,7 @@ attr_name:
return XML_END_ELEMENT;
}
myPtr = myEndPtr;
aHasRead = Standard_False;
continue;
}
}

View File

@@ -95,14 +95,15 @@ void LocOpe_BuildWires::Perform(const TopTools_ListOfShape& L,
TopTools_MapOfShape Bords;
// for (Standard_Integer i = 1; i <= theMapVE.Extent(); i++) {
Standard_Integer i ;
for ( i = 1; i <= theMapVE.Extent(); i++) {
// Modified by skv - Mon May 31 13:07:50 2004 OCC5865 Begin
// if (theMapVE(i).Extent() == 1) {
TopoDS_Vertex vtx = TopoDS::Vertex(theMapVE.FindKey(i));
TopoDS_Edge etmp;
TopoDS_Vertex aV_border;
Standard_Real partmp;
if (theMapVE(i).Extent() == 1 || PW->OnEdge(vtx, etmp, partmp)) {
if (theMapVE(i).Extent() == 1 || (PW->OnVertex(vtx, aV_border) || PW->OnEdge(vtx, etmp, partmp)) ) {
Bords.Add(vtx);
// Modified by skv - Mon May 31 13:07:50 2004 OCC5865 End
}

View File

@@ -56,6 +56,10 @@
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
#include <Geom_Surface.hxx>
static Standard_Boolean IsInside(const TopoDS_Face&,
const TopoDS_Wire&,
@@ -75,8 +79,7 @@ static Standard_Boolean ChoixUV(const TopoDS_Edge&,
const TopTools_IndexedMapOfShape&,
TopoDS_Edge&,
gp_Pnt2d&,
gp_Vec2d&,
const Standard_Real tol);
gp_Vec2d&);
static TopoDS_Shape ChooseDirection(const TopoDS_Shape&,
const TopoDS_Vertex&,
@@ -679,6 +682,50 @@ Standard_Boolean LocOpe_SplitShape::AddClosedWire(const TopoDS_Wire& W,
return Standard_True;
}
//=======================================================================
//function : checkOverlapping
//purpose :
//=======================================================================
static Standard_Boolean checkOverlapping(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2,
const TopoDS_Face& theFace)
{
BRepAdaptor_Surface anAdS(theFace,Standard_False );
Standard_Real MaxTol = (BRep_Tool::Tolerance(theEdge1) + BRep_Tool::Tolerance(theEdge2));
Standard_Real aMaxTol2d = Max(anAdS.UResolution(MaxTol),anAdS.VResolution(MaxTol));
Standard_Real aTolAng = M_PI/180.;
Geom2dAPI_ProjectPointOnCurve proj;
Standard_Real aF1, aL1,aF2, aL2;
Handle(Geom2d_Curve) aCrv1 = BRep_Tool::CurveOnSurface(theEdge1, theFace, aF1, aL1);
Handle(Geom2d_Curve) aCrv2 = BRep_Tool::CurveOnSurface(theEdge2, theFace, aF2, aL2);
Standard_Integer j =1, nbP = 4;
Standard_Real aStep = ( aL2 - aF2)/nbP;
for( ; j < nbP; j++)
{
Standard_Real par2 = aF2 + aStep * j;
gp_Pnt2d aP2d;
gp_Vec2d aV2;
aCrv2->D1(par2, aP2d, aV2);
proj.Init(aP2d,aCrv1, aF1, aL1);
//check intermediate points
if(!proj.NbPoints() || proj.LowerDistance() > aMaxTol2d)
return Standard_False;
Standard_Real par1 = proj.LowerDistanceParameter();
gp_Pnt2d aP2d1;
gp_Vec2d aV1;
aCrv1->D1(par1, aP2d1, aV1);
if( !aV1.IsParallel(aV2, aTolAng))
return Standard_False;
}
return Standard_True;
}
//=======================================================================
//function : AddOpenWire
@@ -883,7 +930,7 @@ Standard_Boolean LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W,
TopoDS_Shape aLocalFaceTemp = FaceRef.Oriented(wfirst.Orientation());
if(!ChoixUV(LastEdge, TopoDS::Face(aLocalFaceTemp), PossE,
aNextEdge, plast, dlast, toll))
aNextEdge, plast, dlast))
return Standard_False;
}
@@ -922,16 +969,58 @@ Standard_Boolean LocOpe_SplitShape::AddOpenWire(const TopoDS_Wire& W,
tol1 = Max(BAS.UResolution(tol1), BAS.VResolution(tol1));
}
Standard_Integer nbAddBound =0;
TopTools_ListIteratorOfListOfShape lexp(WiresFirst);
TopoDS_Shape anE1, anE2;
for (; lexp.More(); lexp.Next()) {
const TopoDS_Edge& edg = TopoDS::Edge(lexp.Value());
if (!MapE.Contains(edg)) {
B.Add(newW2,edg);
MapE.Add(edg);
nbAddBound++;
if(anE1.IsNull())
anE1 = edg;
else
anE2 = edg;
}
}
//check overlapping edges for second face
if(nbAddBound <2)
return Standard_False;
if(nbAddBound ==2 && !anE1.IsNull() && !anE2.IsNull())
{
if(checkOverlapping(TopoDS::Edge(anE1), TopoDS::Edge(anE2),FaceRef ))
return Standard_False;
}
nbAddBound =0;
TopoDS_Shape anE11, anE12;
TopoDS_Iterator anItE(newW1, Standard_False);
for( ; anItE.More(); anItE.Next())
{
if( anItE.Value().ShapeType() != TopAbs_EDGE)
continue;
nbAddBound++;
if(anE11.IsNull())
anE11 = anItE.Value();
else
anE12 = anItE.Value();
}
//check overlapping edges for first face
if(nbAddBound <2)
return Standard_False;
if(nbAddBound ==2 && !anE11.IsNull() && !anE12.IsNull())
{
if(checkOverlapping(TopoDS::Edge(anE11), TopoDS::Edge(anE12), FaceRef))
return Standard_False;
}
TopoDS_Face newF1,newF2;
aLocalFace = FaceRef.EmptyCopied();
newF1 = TopoDS::Face(aLocalFace);
@@ -1168,7 +1257,33 @@ void LocOpe_SplitShape::Put(const TopoDS_Shape& S)
}
}
static void updateToleraces(const TopoDS_Face& theFace, const TopTools_DataMapOfShapeListOfShape& theMap)
{
TopExp_Explorer aExpE(theFace, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next())
{
if (!theMap.IsBound(aExpE.Current()))
continue;
const TopTools_ListOfShape& lEdges = theMap(aExpE.Current());
if (lEdges.Extent() <= 1)
continue;
TopTools_ListIteratorOfListOfShape itrE(lEdges);
ShapeAnalysis_Edge aSae;
for (; itrE.More(); itrE.Next())
{
TopoDS_Edge aCurE = TopoDS::Edge(itrE.Value());
Standard_Real amaxdev = 0.;
if (aSae.CheckSameParameter(aCurE, theFace, amaxdev))
{
BRep_Builder aB;
aB.UpdateEdge(aCurE, amaxdev);
}
}
}
}
//=======================================================================
//function : Rebuild
//purpose :
@@ -1177,7 +1292,8 @@ void LocOpe_SplitShape::Put(const TopoDS_Shape& S)
Standard_Boolean LocOpe_SplitShape::Rebuild(const TopoDS_Shape& S)
{
if (S.ShapeType() == TopAbs_FACE)
updateToleraces(TopoDS::Face(S), myMap);
TopTools_ListIteratorOfListOfShape itr(myMap(S));
if (itr.More()) {
if (itr.Value().IsSame(S)) {
@@ -1387,8 +1503,7 @@ Standard_Boolean ChoixUV(const TopoDS_Edge& Last,
const TopTools_IndexedMapOfShape& Poss,
TopoDS_Edge& theResEdge,
gp_Pnt2d& plst,
gp_Vec2d& dlst,
const Standard_Real toll)
gp_Vec2d& dlst)
{
gp_Pnt2d p2d;
gp_Vec2d v2d;
@@ -1397,31 +1512,21 @@ Standard_Boolean ChoixUV(const TopoDS_Edge& Last,
BRepAdaptor_Surface surf(F,Standard_False); // no restriction
surf.D0 (plst.X(), plst.Y(), aPlst);
Standard_Real tol;
gp_Dir2d ref2d(dlst);
Handle(Geom2d_Curve) C2d;
Standard_Integer index = 0, imin=0;
Standard_Real angmax = -M_PI, dist, ang;
Standard_Real angmax = -M_PI, ang;
for (index = 1; index <= Poss.Extent(); index++) {
TopoDS_Edge anEdge = TopoDS::Edge (Poss.FindKey (index));
TopoDS_Vertex aVF = TopExp::FirstVertex(anEdge, Standard_True);
if( aVF.IsNull())
return 0;
tol = BRep_Tool::Tolerance(aVF);
GetDirection (anEdge, F, p2d, v2d, Standard_True);
GetDirection(anEdge, F, p2d, v2d, Standard_True);
surf.D0 (p2d.X(), p2d.Y(), aPCur);
tol = Max(toll, tol); tol *= tol;
dist = aPCur.SquareDistance(aPlst);
if (!Last.IsSame(anEdge)) {
ang = ref2d.Angle(gp_Dir2d(v2d));
}
@@ -1429,7 +1534,7 @@ Standard_Boolean ChoixUV(const TopoDS_Edge& Last,
ang = -M_PI;
}
if ((dist - tol < Epsilon(1.0)) && (ang > angmax)) {
if ( (ang > angmax)) {
imin = index;
angmax = ang;
}
@@ -1438,7 +1543,7 @@ Standard_Boolean ChoixUV(const TopoDS_Edge& Last,
if (imin)
{
theResEdge = TopoDS::Edge (Poss.FindKey (imin));
GetDirection (theResEdge, F, plst, dlst, Standard_False);
GetDirection(theResEdge, F, plst, dlst, Standard_False);
}
return (imin);

View File

@@ -48,7 +48,7 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
//#include <LocOpe_ProjectedWires.hxx>
// Modified by skv - Mon May 31 13:00:30 2004 OCC5865 Begin
@@ -100,6 +100,8 @@ void LocOpe_Spliter::Perform(const Handle(LocOpe_WiresOnShape)& PW)
if (!mapV.Contains(vtx)) {
if (PW->OnVertex(vtx,Vb)) {
mapV.Add(vtx);
if (vtx.IsSame(Vb))
continue;
lsubs.Clear();
TopoDS_Vertex vsub = TopoDS::Vertex(vtx.Oriented(TopAbs_FORWARD));
gp_Pnt p1 = BRep_Tool::Pnt(vsub), p2 = BRep_Tool::Pnt(Vb);

View File

@@ -56,6 +56,21 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
#include <Extrema_ExtCC2d.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_SeqOfBox.hxx>
#include <NCollection_Handle.hxx>
#include <TColStd_PackedMapOfInteger.hxx>
#include <Extrema_ExtPS.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
IMPLEMENT_STANDARD_RTTIEXT(LocOpe_WiresOnShape,MMgt_TShared)
@@ -84,7 +99,8 @@ static void PutPCurves(const TopoDS_Edge&,
static void FindInternalIntersections(const TopoDS_Edge&,
const TopoDS_Face&,
TopTools_IndexedDataMapOfShapeListOfShape&);
TopTools_IndexedDataMapOfShapeListOfShape&,
Standard_Boolean&);
//=======================================================================
//function : LocOpe_WiresOnShape
@@ -95,8 +111,6 @@ LocOpe_WiresOnShape::LocOpe_WiresOnShape(const TopoDS_Shape& S):
myShape(S),myCheckInterior(Standard_True),myDone(Standard_False)
{}
//=======================================================================
//function : Init
//purpose :
@@ -111,8 +125,6 @@ void LocOpe_WiresOnShape::Init(const TopoDS_Shape& S)
myMapEF.Clear();
}
//=======================================================================
//function : Bind
//purpose :
@@ -229,6 +241,7 @@ void LocOpe_WiresOnShape::BindAll()
TopTools_IndexedDataMapOfShapeListOfShape Splits;
Standard_Integer Ind;
TopTools_MapOfShape anOverlappedEdges;
for (Ind = 1; Ind <= myMapEF.Extent(); Ind++)
{
const TopoDS_Edge& edg = TopoDS::Edge(myMapEF.FindKey(Ind));
@@ -241,12 +254,19 @@ void LocOpe_WiresOnShape::BindAll()
continue;
if (myCheckInterior)
FindInternalIntersections(edg, fac, Splits);
{
Standard_Boolean isOverlapped = Standard_False;
FindInternalIntersections(edg, fac, Splits, isOverlapped);
if(isOverlapped)
anOverlappedEdges.Add(edg);
}
}
for (Ind = 1; Ind <= Splits.Extent(); Ind++)
{
TopoDS_Shape anEdge = Splits.FindKey(Ind);
if(anOverlappedEdges.Contains(anEdge))
continue;
TopoDS_Shape aFace = myMapEF.FindFromKey(anEdge);
//Remove "anEdge" from "myMapEF"
TopoDS_Shape LastEdge = myMapEF.FindKey(myMapEF.Extent());
@@ -259,8 +279,9 @@ void LocOpe_WiresOnShape::BindAll()
for (; itl.More(); itl.Next())
myMapEF.Add(itl.Value(), aFace);
}
TopTools_DataMapOfShapeReal aVertParam;
for (Ind = 1; Ind <= myMapEF.Extent(); Ind++) {
const TopoDS_Edge& edg = TopoDS::Edge(myMapEF.FindKey(Ind));
const TopoDS_Face& fac = TopoDS::Face(myMapEF(Ind));
@@ -276,34 +297,53 @@ void LocOpe_WiresOnShape::BindAll()
Standard_Real vtx_param = BRep_Tool::Parameter(vtx, edg);
BRepAdaptor_Curve2d BAcurve2d(edg, fac);
gp_Pnt2d p2d = BAcurve2d.Value(vtx_param);
gp_Pnt2d p2d = (!BAcurve2d.Curve().IsNull() ?
BAcurve2d.Value(vtx_param) : gp_Pnt2d(Precision::Infinite(), Precision::Infinite()));
TopoDS_Edge Epro;
Standard_Real prm = 0.;
Standard_Real prm = Precision::Infinite();
Standard_Boolean isProjected = myMap.IsBound(vtx);
//if vertex was already projected on the current edge on the previous face
//it is necessary to check tolerance of the vertex in the 2D space on the current
//face without projection and update tolerance of vertex if it is necessary
if (isProjected)
{
TopoDS_Shape aSh = myMap.Find(vtx);
if (aSh.ShapeType() != TopAbs_EDGE)
continue;
Epro = TopoDS::Edge(myMap.Find(vtx));
if (aVertParam.IsBound(vtx))
prm = aVertParam.Find(vtx);
}
Standard_Boolean ok = Project(vtx, p2d, fac, Epro, prm);
if (ok) {
for (exp2.Init(Epro,TopAbs_VERTEX); exp2.More(); exp2.Next()) {
const TopoDS_Vertex& vtx2 = TopoDS::Vertex(exp2.Current());
if (vtx2.IsSame(vtx)) {
break;
}
else if (BRepTools::Compare(vtx,vtx2)) {
if (ok && !isProjected) {
for (exp2.Init(Epro, TopAbs_VERTEX); exp2.More(); exp2.Next()) {
const TopoDS_Vertex& vtx2 = TopoDS::Vertex(exp2.Current());
if (vtx2.IsSame(vtx)) {
myMap.Bind(vtx, vtx2);
theMap.Add(vtx);
break;
}
else if (BRepTools::Compare(vtx, vtx2)) {
Standard_Real aF1, aL1;
BRep_Tool::Range(Epro, fac, aF1, aL1);
if (!BRep_Tool::Degenerated(Epro) ||
Abs(prm-aF1) <= Precision::PConfusion() ||
Abs(prm-aL1) <= Precision::PConfusion())
if (!BRep_Tool::Degenerated(Epro) && (
Abs(prm - aF1) <= Precision::PConfusion() ||
Abs(prm - aL1) <= Precision::PConfusion()))
{
myMap.Bind(vtx,vtx2);
myMap.Bind(vtx, vtx2);
theMap.Add(vtx);
break;
}
}
}
}
}
if (!exp2.More()) {
myMap.Bind(vtx,Epro);
}
theMap.Add(vtx);
aVertParam.Bind(vtx, prm);
}
}
}
}
@@ -459,7 +499,9 @@ Standard_Boolean LocOpe_WiresOnShape::OnEdge(const TopoDS_Vertex& V,
return Standard_False;
TopoDS_Shape aShape = myMapEF.FindFromKey(EdgeFrom);
if( aShape.ShapeType() == TopAbs_FACE)
Standard_Real aF, aL;
Handle(Geom_Curve) aC = BRep_Tool::Curve(Ed, aF, aL);
if (aC.IsNull() && aShape.ShapeType() == TopAbs_FACE)
{
TopoDS_Face aFace = TopoDS::Face(aShape);
@@ -488,59 +530,104 @@ Standard_Boolean Project(const TopoDS_Vertex& V,
TopoDS_Edge& theEdge,
Standard_Real& param)
{
Handle(Geom2d_Curve) PC;
//TopLoc_Location Loc;
Standard_Real f,l;
Standard_Real dmin = RealLast();
//gp_Pnt toproj(BRep_Tool::Pnt(V));
Standard_Real aTolV = BRep_Tool::Tolerance(V);
Standard_Real dmin = (theEdge.IsNull() ? RealLast() : aTolV * aTolV);
Standard_Boolean valret = Standard_False;
Geom2dAPI_ProjectPointOnCurve proj;
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
if (theEdge.IsNull())
{
gp_Pnt toproj(BRep_Tool::Pnt(V));
for (TopExp_Explorer exp(F.Oriented(TopAbs_FORWARD), TopAbs_EDGE);
exp.More(); exp.Next()) {
const TopoDS_Edge& edg = TopoDS::Edge(exp.Current());
Standard_Real f, l;
Handle(Geom_Curve) C = BRep_Tool::Curve(edg, f, l);
Standard_Real aCurDist = Precision::Infinite();
Standard_Real aCurPar = Precision::Infinite();
if (!C.IsNull())
{
aCurPar = Project(V, edg);
if (Precision::IsInfinite(aCurPar))
continue;
gp_Pnt aCurPBound;
C->D0(aCurPar, aCurPBound);
aCurDist = aCurPBound.SquareDistance(toproj);
}
for (TopExp_Explorer exp(F.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More(); exp.Next()) {
const TopoDS_Edge& edg = TopoDS::Edge(exp.Current());
//C = BRep_Tool::Curve(edg,Loc,f,l);
PC = BRep_Tool::CurveOnSurface(edg, F, f, l);
proj.Init(p2d, PC, f, l);
if (proj.NbPoints() > 0) {
if (proj.LowerDistance() < dmin) {
else if(!Precision::IsInfinite(p2d.X()))
{
//Geom2dAPI_ProjectPointOnCurve proj;
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(edg,F , f, l);
if(aC2d.IsNull())
continue;
aCurPar = Project(V, p2d, edg, F);
if (Precision::IsInfinite(aCurPar))
continue;
Handle(Geom2d_Curve) PC = BRep_Tool::CurveOnSurface(edg, F, f, l);
gp_Pnt2d aPProj;
PC->D0(aCurPar, aPProj);
gp_Pnt aCurPBound;
aSurf->D0(aPProj.X(), aPProj.Y(), aCurPBound);
aCurDist = aCurPBound.SquareDistance(toproj);
}
if (aCurDist < dmin) {
theEdge = edg;
theEdge.Orientation(edg.Orientation());
dmin = proj.LowerDistance();
param = proj.LowerDistanceParameter();
dmin = aCurDist;
param = aCurPar;
}
}
if (theEdge.IsNull())
return Standard_False;
}
else if (Precision::IsInfinite(param))
{
Standard_Real f, l;
Handle(Geom_Curve) C = BRep_Tool::Curve(theEdge, f, l);
param = (!C.IsNull() ? Project(V, theEdge) : Project(V, p2d, theEdge, F));
}
if(theEdge.IsNull())
return Standard_False;
//compute distance in 3D space
Handle(Geom2d_Curve) aCrvBound = BRep_Tool::CurveOnSurface(theEdge, F, f, l);
gp_Pnt2d aPBound2d;
aCrvBound->D0(param,aPBound2d);
gp_Pnt aPBound;
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
aSurf->D0(aPBound2d.X(), aPBound2d.Y(), aPBound);
//point of vertex computed by pcurve of the splitting edge
gp_Pnt aPV2d;
aSurf->D0(p2d.X(), p2d.Y(), aPV2d);
//point of vertex in 3D splace
gp_Pnt aP3dV = BRep_Tool::Pnt(V);
Standard_Real aDist3d2 = Max( aPV2d.SquareDistance(aPBound), aP3dV.SquareDistance(aPBound));
Standard_Real aTolV = BRep_Tool::Tolerance(V);
Standard_Real ttol = aTolV + BRep_Tool::Tolerance(theEdge);
if (aDist3d2 <= ttol* ttol) {
if (dmin <= ttol* ttol) {
valret = Standard_True;
GeomAdaptor_Surface adSurf(aSurf);
BRep_Builder B;
if( aTolV * aTolV < aDist3d2)
Standard_Real anUResolution = adSurf.UResolution(1.);
Standard_Real aVResolution = adSurf.UResolution(1.);
Standard_Real f, l;
Handle(Geom2d_Curve) aCrvBound = BRep_Tool::CurveOnSurface(theEdge, F, f, l);
if (!aCrvBound.IsNull())
{
Standard_Real aNewTol = sqrt(aDist3d2) + Precision::Confusion();
B.UpdateVertex(V, aNewTol);
gp_Pnt2d aPBound2d;
aCrvBound->D0(param, aPBound2d);
//distance in 2D space recomputed in the 3D space in order to tolerance of vertex
//cover gap in 2D space. For consistency with check of the validity in the BRepCheck_Wire
Standard_Real aDist3d = p2d.Distance(aPBound2d) / Min(anUResolution, aVResolution);
gp_Pnt aPBound;
aSurf->D0(aPBound2d.X(), aPBound2d.Y(), aPBound);
gp_Pnt aPV2d;
aSurf->D0(p2d.X(), p2d.Y(), aPV2d);
Standard_Real aDistPoints_3D = aPV2d.SquareDistance(aPBound);
Standard_Real aDist2d = Max(aDistPoints_3D, aDist3d * aDist3d);
BRep_Builder B;
if (aTolV * aTolV < aDist2d)
{
Standard_Real aNewTol = sqrt(aDist2d) + Precision::Confusion();
B.UpdateVertex(V, aNewTol);
}
}
}
#ifdef OCCT_DEBUG_MESH
@@ -575,7 +662,8 @@ Standard_Real Project(const TopoDS_Vertex& V,
proj.Init(toproj,C,f,l);
return proj.LowerDistanceParameter();
return (proj.NbPoints() > 0 ? proj.LowerDistanceParameter() : Precision::Infinite());
}
//=======================================================================
@@ -588,23 +676,19 @@ Standard_Real Project(const TopoDS_Vertex&,
const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace)
{
//Handle(Geom_Curve) C;
Handle(Geom2d_Curve) PC;
//TopLoc_Location Loc;
Standard_Real f,l;
Standard_Real f, l;
Geom2dAPI_ProjectPointOnCurve proj;
PC = BRep_Tool::CurveOnSurface(theEdge, theFace, f, l);
/*
if (!Loc.IsIdentity()) {
Handle(Geom_Geometry) GG = C->Transformed(Loc.Transformation());
C = Handle(Geom_Curve)::DownCast (GG);
}
*/
proj.Init(p2d, PC, f, l);
return proj.LowerDistanceParameter();
return proj.NbPoints() > 0 ? proj.LowerDistanceParameter() : Precision::Infinite();
}
@@ -639,7 +723,7 @@ void PutPCurve(const TopoDS_Edge& Edg,
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(Edg,Fac,f,l);
if ( !aC2d.IsNull() ) {
gp_Pnt2d p2d;
aC2d->D0(f,p2d);
aC2d->D0((f + l) *0.5, p2d);
Standard_Boolean IsIn = Standard_True;
if ( ( p2d.X() < Umin-Precision::PConfusion() ) ||
( p2d.X() > Umax+Precision::PConfusion() ) )
@@ -647,13 +731,7 @@ void PutPCurve(const TopoDS_Edge& Edg,
if ( ( p2d.Y() < Vmin-Precision::PConfusion() ) ||
( p2d.Y() > Vmax+Precision::PConfusion() ) )
IsIn = Standard_False;
aC2d->D0(l,p2d);
if ( ( p2d.X() < Umin-Precision::PConfusion() ) ||
( p2d.X() > Umax+Precision::PConfusion() ) )
IsIn = Standard_False;
if ( ( p2d.Y() < Vmin-Precision::PConfusion() ) ||
( p2d.Y() > Vmax+Precision::PConfusion() ) )
IsIn = Standard_False;
if (IsIn)
return;
}
@@ -671,18 +749,17 @@ void PutPCurve(const TopoDS_Edge& Edg,
S = BRep_Tool::Surface(Fac);
// Compute the tol2d
Standard_Real tol3d = Max(BRep_Tool::Tolerance(Edg),
BRep_Tool::Tolerance(Fac));
GeomAdaptor_Surface Gas(S,Umin,Umax,Vmin,Vmax);
Standard_Real TolU = Gas.UResolution(tol3d);
Standard_Real TolV = Gas.VResolution(tol3d);
Standard_Real tol2d = Max(TolU,TolV);
Standard_Real tol2d = Precision::Confusion();
Handle(Geom2d_Curve) C2d;
ShapeConstruct_ProjectCurveOnSurface aToolProj;
aToolProj.Init(S, tol2d);
Handle(Geom2d_Curve) C2d =
GeomProjLib::Curve2d(C,S,Umin,Umax,Vmin,Vmax,tol2d);
if(C2d.IsNull())
return;
aToolProj.Perform(C,f,l, C2d);
if (C2d.IsNull())
{
return;
}
gp_Pnt2d pf(C2d->Value(f));
gp_Pnt2d pl(C2d->Value(l));
gp_Pnt PF,PL;
@@ -760,20 +837,7 @@ void PutPCurve(const TopoDS_Edge& Edg,
nbtra--;
}
}
/*
if (theVmin > Vmax-tolv) {
while (theVmin > Vmax-tolv) {
theVmin -= vp;
nbtra--;
}
}
else if (theVmax < Vmin+tolv) {
while (theVmax < Vmin+tolv) {
theVmax += vp;
nbtra++;
}
}
*/
if (nbtra !=0) {
C2d->Translate(gp_Vec2d(0.,nbtra*vp));
}
@@ -1149,11 +1213,13 @@ void PutPCurves(const TopoDS_Edge& Efrom,
void FindInternalIntersections(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace,
TopTools_IndexedDataMapOfShapeListOfShape& Splits)
TopTools_IndexedDataMapOfShapeListOfShape& Splits,
Standard_Boolean& isOverlapped)
{
Standard_Real TolExt = Precision::PConfusion();
Standard_Integer i, j, aNbExt;
Standard_Integer i, j;
BRepAdaptor_Surface anAdSurf(theFace, Standard_False);
TColStd_SequenceOfReal SplitPars;
TopoDS_Vertex theVertices [2];
@@ -1188,14 +1254,17 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
GeomAdaptor_Curve aGAcurve(aCurve, aFpar, aLpar);
Extrema_ExtCC anExtrema(theGAcurve, aGAcurve, TolExt, TolExt);
if (!anExtrema.IsDone())
if (!anExtrema.IsDone() || !anExtrema.NbExt())
continue;
if (anExtrema.IsParallel())
continue;
aNbExt = anExtrema.NbExt();
Standard_Real MaxTol = Max(BRep_Tool::Tolerance(theEdge), BRep_Tool::Tolerance(anEdge));
Standard_Integer aNbExt = anExtrema.NbExt();
Standard_Real MaxTol = BRep_Tool::Tolerance(anEdge);
Standard_Real aMaxTol2 = MaxTol * MaxTol;
if (anExtrema.IsParallel() && anExtrema.SquareDistance(1) <= aMaxTol2)
{
isOverlapped = Standard_True;
return;
}
for (i = 1; i <= aNbExt; i++)
{
Standard_Real aDist = anExtrema.SquareDistance(i);
@@ -1215,8 +1284,12 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
if (j >= 2) //intersection is inside "theEdge" => split
{
gp_Pnt aPoint = aCurve->Value(anIntPar);
if (aPoint.SquareDistance(thePnt[0]) > aTolV[0] * aTolV[0] &&
aPoint.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1])
gp_Pnt aPointInt = theCurve->Value(theIntPar);
if (aPointInt.SquareDistance(thePnt[0]) > aTolV[0] * aTolV[0] &&
aPointInt.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1] &&
aPoint.SquareDistance(thePnt[0]) > aTolV[0] * aTolV[0] &&
aPoint.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1])
{
SplitPars.Append(theIntPar);
if( aDist > aDistMax)
@@ -1282,7 +1355,18 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
BB.Add(NewEdge, FirstVertex);
BB.Add(NewEdge, LastVertex);
NewEdge.Orientation(anOrient);
NewEdges.Append(NewEdge);
ShapeAnalysis_Edge aSae;
Standard_Real amaxdev =0.;
if (aSae.CheckSameParameter(NewEdge, theFace, amaxdev))
{
BRep_Builder aB;
aB.UpdateEdge(NewEdge, amaxdev);
}
if (anOrient == TopAbs_FORWARD)
NewEdges.Append(NewEdge);
else
NewEdges.Prepend(NewEdge);
FirstVertex = LastVertex;
FirstPar = LastPar;
}
@@ -1290,3 +1374,98 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge,
if (!NewEdges.IsEmpty())
Splits.Add(theEdge, NewEdges);
}
//=======================================================================
//function : AddSplittingEdges
//purpose :
//=======================================================================
Standard_Boolean LocOpe_WiresOnShape::Add(const TopTools_SequenceOfShape& theEdges)
{
TopTools_SequenceOfShape anEdges;
Bnd_SeqOfBox anEdgeBoxes;
Standard_Integer i = 1, nb = theEdges.Length();
for (; i <= nb; i++)
{
const TopoDS_Shape& aCurSplit = theEdges(i);
TopExp_Explorer anExpE(aCurSplit, TopAbs_EDGE);
for (; anExpE.More(); anExpE.Next())
{
const TopoDS_Shape& aCurE = anExpE.Current();
Bnd_Box aBoxE;
BRepBndLib::AddClose(aCurE, aBoxE);
if (aBoxE.IsVoid())
continue;
Standard_Real aTolE = BRep_Tool::Tolerance(TopoDS::Edge(aCurE));
aBoxE.SetGap(aTolE);
anEdgeBoxes.Append(aBoxE);
anEdges.Append(aCurE);
}
}
TopExp_Explorer anExpFaces(myShape, TopAbs_FACE);
Standard_Integer numF = 1;
TColStd_PackedMapOfInteger anUsedEdges;
for (; anExpFaces.More(); anExpFaces.Next(), numF++)
{
const TopoDS_Face& aCurF = TopoDS::Face(anExpFaces.Current());
Bnd_Box aBoxF;
BRepBndLib::Add(aCurF, aBoxF);
if (aBoxF.IsVoid())
continue;
BRepAdaptor_Surface anAdF(aCurF, Standard_False);
NCollection_Handle<BRepTopAdaptor_FClass2d> aCheckStateTool;
i = 1;
nb = anEdgeBoxes.Length();
for (; i <= nb; i++)
{
if (anUsedEdges.Contains(i))
continue;
if (aBoxF.IsOut(anEdgeBoxes(i)))
continue;
const TopoDS_Edge& aCurE = TopoDS::Edge(anEdges(i));
Standard_Real aF, aL;
Handle(Geom_Curve) aC = BRep_Tool::Curve(aCurE, aF, aL);
if (aC.IsNull())
{
anUsedEdges.Add(i);
continue;
}
gp_Pnt aP = aC->Value((aF + aL)* 0.5);
Extrema_ExtPS anExtr(aP, anAdF, Precision::Confusion(), Precision::Confusion());
if (!anExtr.IsDone() || !anExtr.NbExt())
continue;
Standard_Real aTolE = BRep_Tool::Tolerance(TopoDS::Edge(aCurE));
Standard_Real aTol2 = (aTolE + Precision::Confusion()) * (aTolE + Precision::Confusion());
Standard_Integer n = 1;
for (; n <= anExtr.NbExt(); n++)
{
Standard_Real aDist2 = anExtr.SquareDistance(n);
if (aDist2 > aTol2)
continue;
const Extrema_POnSurf& aPS = anExtr.Point(n);
Standard_Real aU, aV;
aPS.Parameter(aU, aV);
if (aCheckStateTool.IsNull())
{
aCheckStateTool = new BRepTopAdaptor_FClass2d(aCurF, Precision::PConfusion());
}
if (aCheckStateTool->Perform(gp_Pnt2d(aU, aV)) == TopAbs_IN)
{
Bind(aCurE, aCurF);
anUsedEdges.Add(i);
}
}
}
}
return (anUsedEdges.Extent());
}

View File

@@ -28,6 +28,8 @@
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Real.hxx>
#include <TopTools_SequenceOfShape.hxx>
class TopoDS_Shape;
class TopoDS_Wire;
class TopoDS_Face;
@@ -49,6 +51,11 @@ public:
Standard_EXPORT LocOpe_WiresOnShape(const TopoDS_Shape& S);
Standard_EXPORT void Init (const TopoDS_Shape& S);
//! Add splitting edges or wires for whole initial shape
//! withot additional specification edge->face, edge->edge
//! This method puts edge on the corresponding faces from initial shape
Standard_EXPORT Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges);
//! Set the flag of check internal intersections
//! default value is True (to check)

View File

@@ -321,3 +321,12 @@ Select3D_BndBox3d MeshVS_CommonSensitiveEntity::BoundingBox()
{
return myBndBox;
}
//=======================================================================
//function : CenterOfGeometry
//purpose :
//=======================================================================
gp_Pnt MeshVS_CommonSensitiveEntity::CenterOfGeometry() const
{
return myCOG;
}

View File

@@ -55,6 +55,9 @@ public:
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
//! Returns center of a mesh
Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
public:
DEFINE_STANDARD_RTTIEXT (MeshVS_CommonSensitiveEntity, Select3D_SensitiveSet)

View File

@@ -149,6 +149,10 @@ public:
//! Statistics
Standard_EXPORT void Statistics(Standard_OStream& S) const;
//! Returns attached allocator
const Handle(NCollection_BaseAllocator)& Allocator() const
{ return myAllocator; }
protected:
// -------- PROTECTED METHODS -----------

View File

@@ -102,6 +102,10 @@ public:
Standard_Boolean IsEmpty () const {return (mySize == 0);}
Standard_Integer Length () const {return mySize;}
//! Returns attached allocator
const Handle(NCollection_BaseAllocator)& Allocator() const
{ return myAllocator; }
protected:
// Methods PROTECTED
//

View File

@@ -212,6 +212,12 @@ public: //! @name public API
}
}
//! Returns attached allocator
const Handle(NCollection_BaseAllocator)& Allocator() const
{
return myAllocator;
}
protected: //! @name Protected fields
Handle(NCollection_BaseAllocator) myAllocator;

View File

@@ -158,7 +158,7 @@ public:
}
//! Clear the data structures and set new cell sizes and allocator
void Reset (NCollection_Array1<Standard_Real> theCellSize,
void Reset (NCollection_Array1<Standard_Real>& theCellSize,
const Handle(NCollection_IncAllocator)& theAlloc=0)
{
myCellSize = theCellSize;

View File

@@ -68,7 +68,7 @@ template <class TheObjType, class TheBndType> class NCollection_UBTreeFiller
NCollection_UBTreeFiller (UBTree& theTree,
const Handle(NCollection_BaseAllocator)& theAlloc=0L,
const Standard_Boolean isFullRandom = Standard_True)
: myTree(theTree), mySeqPtr(1000, theAlloc),
: myTree(theTree), mySeqPtr(256, theAlloc),
myRandGen (5489u /* == std::mt19937::default_seed, not defined in older environments, e.g, on Debian 6.0 with GCC 4.4.5 */),
myIsFullRandom (isFullRandom) {}

View File

@@ -54,8 +54,17 @@ Standard_ShortReal OpenGl_BVHClipPrimitiveSet::Center (const Standard_Integer th
{
Graphic3d_BndBox4f aBndBox = myStructs.FindKey (theIdx + 1)->BoundingBox();
return (aBndBox.CornerMin()[theAxis] +
aBndBox.CornerMax()[theAxis]) * 0.5f;
// to prevent float overflow
const Standard_Real aMin = Standard_Real (aBndBox.CornerMin()[theAxis]);
const Standard_Real aMax = Standard_Real (aBndBox.CornerMax()[theAxis]);
const Standard_Real aCenter = (aMin + aMax) * 0.5;
if (aCenter <= Standard_Real (-ShortRealLast()))
return -ShortRealLast();
if (aCenter >= Standard_Real (ShortRealLast()))
return ShortRealLast();
return Standard_ShortReal (aCenter);
}
// =======================================================================

View File

@@ -26,12 +26,12 @@
// purpose :
// =======================================================================
OpenGl_Layer::OpenGl_Layer (const Standard_Integer theNbPriorities)
: myArray (0, theNbPriorities - 1),
myNbStructures (0),
: myArray (0, theNbPriorities - 1),
myNbStructures (0),
myBVHIsLeftChildQueuedFirst (Standard_True),
myIsBVHPrimitivesNeedsReset (Standard_False)
{
//
myIsBoundingBoxNeedsReset[0] = myIsBoundingBoxNeedsReset[1] = true;
}
// =======================================================================
@@ -123,11 +123,257 @@ bool OpenGl_Layer::Remove (const OpenGl_Structure* theStruct,
// function : InvalidateBVHData
// purpose :
// =======================================================================
void OpenGl_Layer::InvalidateBVHData()
void OpenGl_Layer::InvalidateBVHData() const
{
myIsBVHPrimitivesNeedsReset = Standard_True;
}
// =======================================================================
// function : BoundingBox
// purpose :
// =======================================================================
const Graphic3d_BndBox4f& OpenGl_Layer::BoundingBox (const Standard_Integer theViewId,
const Handle(Graphic3d_Camera)& theCamera,
const Standard_Integer theWindowWidth,
const Standard_Integer theWindowHeight,
const Standard_Boolean theToIgnoreInfiniteFlag) const
{
const Standard_Integer aBoxId = theToIgnoreInfiniteFlag == 0 ? 0 : 1;
if (myIsBoundingBoxNeedsReset[aBoxId])
{
// Recompute layer bounding box
myBoundingBox[aBoxId].Clear();
const Standard_Integer aNbPriorities = myArray.Length();
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{
const OpenGl_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);
for (Standard_Integer aStructIdx = 1; aStructIdx <= aStructures.Size(); ++aStructIdx)
{
const OpenGl_Structure* aStructure = aStructures.FindKey (aStructIdx);
if (!aStructure->IsVisible())
{
continue;
}
else if (!aStructure->ViewAffinity.IsNull()
&& !aStructure->ViewAffinity->IsVisible (theViewId))
{
continue;
}
// "FitAll" operation ignores object with transform persistence parameter
// but adds transform persistence point in a bounding box of layer (only zoom pers. objects).
if (aStructure->TransformPersistence.Flags != Graphic3d_TMF_None)
{
if (!theToIgnoreInfiniteFlag && (aStructure->TransformPersistence.Flags & Graphic3d_TMF_ZoomPers))
{
if (!theCamera->IsOrthographic())
{
continue;
}
BVH_Vec4f aTPPoint (static_cast<float> (aStructure->TransformPersistence.Point.x()),
static_cast<float> (aStructure->TransformPersistence.Point.y()),
static_cast<float> (aStructure->TransformPersistence.Point.z()),
1.0f);
myBoundingBox[aBoxId].Combine (aTPPoint);
continue;
}
// Panning and 2d persistence apply changes to projection or/and its translation components.
// It makes them incompatible with z-fitting algorithm. Ignored by now.
else if (!theToIgnoreInfiniteFlag
|| (aStructure->TransformPersistence.Flags & Graphic3d_TMF_2d)
|| (aStructure->TransformPersistence.Flags & Graphic3d_TMF_PanPers)
|| (aStructure->TransformPersistence.Flags & Graphic3d_TMF_TriedronPers))
{
continue;
}
}
Graphic3d_BndBox4f aBox = aStructure->BoundingBox();
if (aStructure->IsInfinite
&& !theToIgnoreInfiniteFlag)
{
const Graphic3d_Vec4 aDiagVec = aBox.CornerMax() - aBox.CornerMin();
if (aDiagVec.xyz().SquareModulus() >= 500000.0f * 500000.0f)
{
// bounding borders of infinite line has been calculated as own point in center of this line
aBox = Graphic3d_BndBox4f ((aBox.CornerMin() + aBox.CornerMax()) * 0.5f);
}
else
{
aBox = Graphic3d_BndBox4f (Graphic3d_Vec4 (ShortRealFirst(), ShortRealFirst(), ShortRealFirst(), 1.0f),
Graphic3d_Vec4 (ShortRealLast(), ShortRealLast(), ShortRealLast(), 1.0f));
}
}
if (aStructure->TransformPersistence.Flags != Graphic3d_TMF_None)
{
const Graphic3d_Mat4& aProjectionMat = theCamera->ProjectionMatrixF();
const Graphic3d_Mat4& aWorldViewMat = theCamera->OrientationMatrixF();
aStructure->TransformPersistence.Apply (aProjectionMat,
aWorldViewMat,
theWindowWidth,
theWindowHeight,
aBox);
}
// To prevent float overflow at camera parameters calculation and further
// rendering, bounding boxes with at least one vertex coordinate out of
// float range are skipped by view fit algorithms
if (Abs (aBox.CornerMax().x()) >= ShortRealLast()
|| Abs (aBox.CornerMax().y()) >= ShortRealLast()
|| Abs (aBox.CornerMax().z()) >= ShortRealLast()
|| Abs (aBox.CornerMin().x()) >= ShortRealLast()
|| Abs (aBox.CornerMin().y()) >= ShortRealLast()
|| Abs (aBox.CornerMin().z()) >= ShortRealLast())
{
continue;
}
myBoundingBox[aBoxId].Combine (aBox);
}
}
myIsBoundingBoxNeedsReset[aBoxId] = false;
}
return myBoundingBox[aBoxId];
}
// =======================================================================
// function : considerZoomPersistenceObjects
// purpose :
// =======================================================================
Standard_Real OpenGl_Layer::considerZoomPersistenceObjects (const Standard_Integer theViewId,
const Handle(Graphic3d_Camera)& theCamera,
Standard_Integer theWindowWidth,
Standard_Integer theWindowHeight,
Standard_Boolean /*theToIgnoreInfiniteFlag*/) const
{
if (NbOfTransformPersistenceObjects() == 0)
{
return 1.0;
}
const Standard_Integer aNbPriorities = myArray.Length();
const Graphic3d_Mat4& aProjectionMat = theCamera->ProjectionMatrixF();
const Graphic3d_Mat4& aWorldViewMat = theCamera->OrientationMatrixF();
Standard_Real aMaxCoef = -std::numeric_limits<double>::max();
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{
const OpenGl_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);
for (Standard_Integer aStructIdx = 1; aStructIdx <= aStructures.Size(); ++aStructIdx)
{
OpenGl_Structure* aStructure = const_cast<OpenGl_Structure*> (aStructures.FindKey (aStructIdx));
if (!aStructure->IsVisible())
{
continue;
}
else if (!aStructure->ViewAffinity.IsNull()
&& !aStructure->ViewAffinity->IsVisible (theViewId))
{
continue;
}
if (!(aStructure->TransformPersistence.Flags & Graphic3d_TMF_ZoomPers))
{
continue;
}
Graphic3d_BndBox4f aBox = aStructure->BoundingBox();
aStructure->TransformPersistence.Apply (aProjectionMat, aWorldViewMat, theWindowWidth, theWindowHeight, aBox);
const BVH_Vec4f& aCornerMin = aBox.CornerMin();
const BVH_Vec4f& aCornerMax = aBox.CornerMax();
const Standard_Integer aNbOfPoints = 8;
const gp_Pnt aPoints[aNbOfPoints] = { gp_Pnt (aCornerMin.x(), aCornerMin.y(), aCornerMin.z()),
gp_Pnt (aCornerMin.x(), aCornerMin.y(), aCornerMax.z()),
gp_Pnt (aCornerMin.x(), aCornerMax.y(), aCornerMin.z()),
gp_Pnt (aCornerMin.x(), aCornerMax.y(), aCornerMax.z()),
gp_Pnt (aCornerMax.x(), aCornerMin.y(), aCornerMin.z()),
gp_Pnt (aCornerMax.x(), aCornerMin.y(), aCornerMax.z()),
gp_Pnt (aCornerMax.x(), aCornerMax.y(), aCornerMin.z()),
gp_Pnt (aCornerMax.x(), aCornerMax.y(), aCornerMax.z()) };
gp_Pnt aConvertedPoints[aNbOfPoints];
Standard_Real aConvertedMinX = std::numeric_limits<double>::max();
Standard_Real aConvertedMaxX = -std::numeric_limits<double>::max();
Standard_Real aConvertedMinY = std::numeric_limits<double>::max();
Standard_Real aConvertedMaxY = -std::numeric_limits<double>::max();
for (Standard_Integer anIdx = 0; anIdx < aNbOfPoints; ++anIdx)
{
aConvertedPoints[anIdx] = theCamera->Project (aPoints[anIdx]);
aConvertedMinX = Min (aConvertedMinX, aConvertedPoints[anIdx].X());
aConvertedMaxX = Max (aConvertedMaxX, aConvertedPoints[anIdx].X());
aConvertedMinY = Min (aConvertedMinY, aConvertedPoints[anIdx].Y());
aConvertedMaxY = Max (aConvertedMaxY, aConvertedPoints[anIdx].Y());
}
const Standard_Boolean isBigObject = (Abs (aConvertedMaxX - aConvertedMinX) > 2.0) // width of zoom pers. object greater than width of window
|| (Abs (aConvertedMaxY - aConvertedMinY) > 2.0); // height of zoom pers. object greater than height of window
const Standard_Boolean isAlreadyInScreen = (aConvertedMinX > -1.0 && aConvertedMinX < 1.0)
&& (aConvertedMaxX > -1.0 && aConvertedMaxX < 1.0)
&& (aConvertedMinY > -1.0 && aConvertedMinY < 1.0)
&& (aConvertedMaxY > -1.0 && aConvertedMaxY < 1.0);
if (isBigObject || isAlreadyInScreen)
{
continue;
}
const gp_Pnt aTPPoint (aStructure->TransformPersistence.Point.x(),
aStructure->TransformPersistence.Point.y(),
aStructure->TransformPersistence.Point.z());
gp_Pnt aConvertedTPPoint = theCamera->Project (aTPPoint);
aConvertedTPPoint.SetZ (0.0);
if (aConvertedTPPoint.Coord().Modulus() < Precision::Confusion())
{
continue;
}
Standard_Real aShiftX = 0.0;
if (aConvertedMinX < -1.0)
{
aShiftX = ((aConvertedMaxX < -1.0) ? (-(1.0 + aConvertedMaxX) + (aConvertedMaxX - aConvertedMinX)) : -(1.0 + aConvertedMinX));
}
else if (aConvertedMaxX > 1.0)
{
aShiftX = ((aConvertedMinX > 1.0) ? ((aConvertedMinX - 1.0) + (aConvertedMaxX - aConvertedMinX)) : (aConvertedMaxX - 1.0));
}
Standard_Real aShiftY = 0.0;
if (aConvertedMinY < -1.0)
{
aShiftY = ((aConvertedMaxY < -1.0) ? (-(1.0 + aConvertedMaxY) + (aConvertedMaxY - aConvertedMinY)) : -(1.0 + aConvertedMinY));
}
else if (aConvertedMaxY > 1.0)
{
aShiftY = ((aConvertedMinY > 1.0) ? ((aConvertedMinY - 1.0) + (aConvertedMaxY - aConvertedMinY)) : (aConvertedMaxY - 1.0));
}
const Standard_Real aDifX = Abs (aConvertedTPPoint.X()) - aShiftX;
const Standard_Real aDifY = Abs (aConvertedTPPoint.Y()) - aShiftY;
if (aDifX > Precision::Confusion())
{
aMaxCoef = Max (aMaxCoef, Abs (aConvertedTPPoint.X()) / aDifX);
}
if (aDifY > Precision::Confusion())
{
aMaxCoef = Max (aMaxCoef, Abs (aConvertedTPPoint.Y()) / aDifY);
}
}
}
return (aMaxCoef > 0.0) ? aMaxCoef : 1.0;
}
// =======================================================================
// function : renderAll
// purpose :

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