mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
68d403eda6 |
@@ -364,15 +364,6 @@ if (MSVC)
|
||||
endif()
|
||||
|
||||
# whether use optional 3rdparty or not
|
||||
set (USE_TK ON CACHE BOOL "${USE_TK_DESCR}")
|
||||
set (USE_FREETYPE ON CACHE BOOL "${USE_FREETYPE_DESCR}")
|
||||
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
|
||||
set (USE_FFMPEG OFF CACHE BOOL "${USE_FFMPEG_DESCR}")
|
||||
set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}")
|
||||
set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}")
|
||||
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
|
||||
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
|
||||
|
||||
if (APPLE)
|
||||
set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}")
|
||||
else()
|
||||
@@ -502,8 +493,7 @@ endif()
|
||||
# search for CSF variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TclTkLibs CAN_USE_TK)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE CAN_USE_FREETYPE)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_OPENGL)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlesLibs CAN_USE_GLES2)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
|
||||
@@ -512,46 +502,27 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
|
||||
# define CSF variable
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
|
||||
|
||||
# Tcl (mandatory for Draw Harness)
|
||||
if (USE_TCL)
|
||||
message (STATUS "Info: TCL is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
|
||||
|
||||
message (STATUS "Info: TK is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TCL")
|
||||
endif()
|
||||
|
||||
# Tk (optional for Draw Harness)
|
||||
if (CAN_USE_TK)
|
||||
if (USE_TK)
|
||||
message (STATUS "Info: TK is used by OCCT")
|
||||
add_definitions (-DHAVE_TK)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tk")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_TK")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
|
||||
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TCL")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
|
||||
endif()
|
||||
|
||||
# FreeType
|
||||
if (CAN_USE_FREETYPE)
|
||||
if (USE_FREETYPE)
|
||||
message (STATUS "Info: FreeType is used by OCCT")
|
||||
add_definitions (-DHAVE_FREETYPE)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE")
|
||||
endif()
|
||||
if (USE_FREETYPE)
|
||||
message (STATUS "Info: Freetype is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_FREETYPE")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE")
|
||||
endif()
|
||||
|
||||
@@ -579,6 +550,8 @@ endif()
|
||||
|
||||
# FREEIMAGE
|
||||
if (CAN_USE_FREEIMAGE)
|
||||
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
|
||||
|
||||
if (USE_FREEIMAGE)
|
||||
add_definitions (-DHAVE_FREEIMAGE)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage")
|
||||
@@ -597,6 +570,8 @@ endif()
|
||||
# search for CSF_OpenVR variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenVR CAN_USE_OPENVR)
|
||||
if (CAN_USE_OPENVR)
|
||||
set (USE_OPENVR OFF CACHE BOOL "${USE_OPENVR_DESCR}")
|
||||
|
||||
if (USE_OPENVR)
|
||||
add_definitions (-DHAVE_OPENVR)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/openvr")
|
||||
@@ -616,6 +591,8 @@ endif()
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FFmpeg CAN_USE_FFMPEG)
|
||||
|
||||
if (CAN_USE_FFMPEG)
|
||||
set (USE_FFMPEG OFF CACHE BOOL "${USE_FFMPEG_DESCR}")
|
||||
|
||||
if (USE_FFMPEG)
|
||||
add_definitions (-DHAVE_FFMPEG)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/ffmpeg")
|
||||
@@ -678,6 +655,8 @@ endif()
|
||||
|
||||
# TBB
|
||||
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
|
||||
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
|
||||
|
||||
if (USE_TBB)
|
||||
add_definitions (-DHAVE_TBB)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
|
||||
@@ -698,6 +677,8 @@ endif()
|
||||
# search for CSF_RapidJSON variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_RapidJSON CAN_USE_RAPIDJSON)
|
||||
if (CAN_USE_RAPIDJSON)
|
||||
set (USE_RAPIDJSON OFF CACHE BOOL "${USE_RAPIDJSON_DESCR}")
|
||||
|
||||
if (USE_RAPIDJSON)
|
||||
add_definitions (-DHAVE_RAPIDJSON)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/rapidjson")
|
||||
@@ -714,6 +695,8 @@ endif()
|
||||
|
||||
# EIGEN
|
||||
if (CAN_USE_EIGEN)
|
||||
set (USE_EIGEN OFF CACHE BOOL "${USE_EIGEN_DESCR}")
|
||||
|
||||
if (USE_EIGEN)
|
||||
add_definitions (-DHAVE_EIGEN)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/eigen")
|
||||
|
@@ -49,28 +49,18 @@ else()
|
||||
set (CSF_OpenVR)
|
||||
endif()
|
||||
|
||||
# TCL
|
||||
# TCL/TK
|
||||
if (USE_TCL)
|
||||
if (WIN32)
|
||||
set (CSF_TclLibs "tcl86")
|
||||
else()
|
||||
if(APPLE)
|
||||
set (CSF_TclLibs Tcl)
|
||||
elseif(UNIX)
|
||||
set (CSF_TclLibs "tcl8.6")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# TK
|
||||
if (USE_TK)
|
||||
if (WIN32)
|
||||
set (CSF_TclTkLibs "tk86")
|
||||
else()
|
||||
if(APPLE)
|
||||
set (CSF_TclTkLibs Tk)
|
||||
set (CSF_TclLibs Tcl)
|
||||
elseif(UNIX)
|
||||
set (CSF_TclTkLibs "tk8.6")
|
||||
set (CSF_TclLibs "tcl8.6")
|
||||
set (CSF_TclTkLibs "tk8.6")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -128,8 +118,6 @@ else()
|
||||
set (CSF_OpenGlesLibs "EGL GLESv2")
|
||||
set (CSF_XwLibs "X11 Xext Xmu Xi")
|
||||
set (CSF_dl "dl")
|
||||
if (USE_FREETYPE)
|
||||
set (CSF_fontconfig "fontconfig")
|
||||
endif()
|
||||
set (CSF_fontconfig "fontconfig")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -155,18 +155,12 @@ set (3RDPARTY_DIR_DESCR
|
||||
third-party product have been found - corresponding CMake variables will be specified
|
||||
(VTK: 3RDPARTY_VTK_DIR, 3RDPARTY_VTK_INCLUDE_DIR, 3RDPARTY_VTK_LIBRARY_DIR)")
|
||||
|
||||
set (USE_TK_DESCR
|
||||
"Indicates whether Tk product should be used by Draw Harness for user interface")
|
||||
|
||||
set (USE_FREETYPE_DESCR
|
||||
"Indicates whether FreeType product should be used in OCCT for text rendering using external font files")
|
||||
|
||||
set (USE_FFMPEG_DESCR
|
||||
"Indicates whether FFmpeg framework is used or not. FFmpeg stands for
|
||||
multimedia data handling, open-source software libraries used for video encoding and decoding.")
|
||||
|
||||
set (USE_FREEIMAGE_DESCR
|
||||
"Indicates whether FreeImage product should be used in OCCT visualization
|
||||
"Indicates whether Freeimage product should be used in OCCT visualization
|
||||
module for support of popular graphics image formats (PNG, BMP etc)")
|
||||
|
||||
set (USE_OPENVR_DESCR
|
||||
|
@@ -175,9 +175,7 @@ proc wokdep:gui:UpdateList {} {
|
||||
set anBin32Errs {}
|
||||
set anBin64Errs {}
|
||||
wokdep:SearchTclTk anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
if { "$::HAVE_FREETYPE" == "true" } {
|
||||
wokdep:SearchFreeType anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
}
|
||||
wokdep:SearchFreeType anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
wokdep:SearchX11 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
if { "$::HAVE_GLES2" == "true" } {
|
||||
wokdep:SearchEGL anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
|
||||
@@ -473,8 +471,6 @@ ttk::label .myFrame.myHxxChecks.myScutsLbl -text "Strategy for filling he
|
||||
ttk::label .myFrame.mySrchLbl -text "3rd-parties search path:" -padding {5 5 80 5}
|
||||
entry .myFrame.mySrchEntry -textvariable PRODUCTS_PATH_INPUT -width 80
|
||||
ttk::button .myFrame.mySrchBrowseBtn -text "Browse" -command wokdep:gui:BrowsePartiesRoot
|
||||
checkbutton .myFrame.myChecks.myFreeTypeCheck -offvalue "false" -onvalue "true" -variable HAVE_FREETYPE -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myFreeTypeLbl -text "Use FreeType"
|
||||
checkbutton .myFrame.myChecks.myFImageCheck -offvalue "false" -onvalue "true" -variable HAVE_FREEIMAGE -command wokdep:gui:UpdateList
|
||||
ttk::label .myFrame.myChecks.myFImageLbl -text "Use FreeImage"
|
||||
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
|
||||
@@ -608,10 +604,10 @@ incr aRowIter
|
||||
|
||||
grid .myFrame.myChecks -row $aRowIter -column 0 -columnspan 10 -sticky w
|
||||
incr aRowIter
|
||||
grid .myFrame.myChecks.myFreeTypeCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
grid .myFrame.myChecks.myFreeTypeLbl -row $aCheckRowIter -column 1 -sticky w
|
||||
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 2 -sticky e
|
||||
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 3 -sticky w
|
||||
grid .myFrame.myChecks.myFImageCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
grid .myFrame.myChecks.myFImageLbl -row $aCheckRowIter -column 1 -sticky w
|
||||
grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
|
||||
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
|
||||
if { "$::tcl_platform(os)" != "Darwin" } {
|
||||
grid .myFrame.myChecks.myGlesCheck -row $aCheckRowIter -column 4 -sticky e
|
||||
grid .myFrame.myChecks.myGlesLbl -row $aCheckRowIter -column 5 -sticky w
|
||||
@@ -625,10 +621,10 @@ grid .myFrame.myChecks.myQtCheck -row $aCheckRowIter -column 12 -sticky e
|
||||
grid .myFrame.myChecks.myQtLbl -row $aCheckRowIter -column 13 -sticky w
|
||||
|
||||
incr aCheckRowIter
|
||||
grid .myFrame.myChecks.myFImageCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
grid .myFrame.myChecks.myFImageLbl -row $aCheckRowIter -column 1 -sticky w
|
||||
grid .myFrame.myChecks.myTbbCheck -row $aCheckRowIter -column 2 -sticky e
|
||||
grid .myFrame.myChecks.myTbbLbl -row $aCheckRowIter -column 3 -sticky w
|
||||
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
grid .myFrame.myChecks.myFFmpegLbl -row $aCheckRowIter -column 1 -sticky w
|
||||
grid .myFrame.myChecks.myVtkCheck -row $aCheckRowIter -column 2 -sticky e
|
||||
grid .myFrame.myChecks.myVtkLbl -row $aCheckRowIter -column 3 -sticky w
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
grid .myFrame.myChecks.myD3dCheck -row $aCheckRowIter -column 4 -sticky e
|
||||
grid .myFrame.myChecks.myD3dLbl -row $aCheckRowIter -column 5 -sticky w
|
||||
@@ -642,10 +638,8 @@ grid .myFrame.myChecks.myJDKCheck -row $aCheckRowIter -column 12 -sticky e
|
||||
grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 13 -sticky w
|
||||
|
||||
incr aCheckRowIter
|
||||
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
grid .myFrame.myChecks.myFFmpegLbl -row $aCheckRowIter -column 1 -sticky w
|
||||
grid .myFrame.myChecks.myVtkCheck -row $aCheckRowIter -column 2 -sticky e
|
||||
grid .myFrame.myChecks.myVtkLbl -row $aCheckRowIter -column 3 -sticky w
|
||||
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 0 -sticky e
|
||||
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 1 -sticky w
|
||||
grid .myFrame.myChecks.myOpenVrCheck -row $aCheckRowIter -column 4 -sticky e
|
||||
grid .myFrame.myChecks.myOpenVrLbl -row $aCheckRowIter -column 5 -sticky w
|
||||
grid .myFrame.myChecks.myE57Check -row $aCheckRowIter -column 6 -sticky e
|
||||
|
@@ -68,11 +68,9 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
|
||||
}
|
||||
|
||||
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
|
||||
set THE_ENV_VARIABLES {HAVE_TK HAVE_FREETYPE HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENVR HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
|
||||
foreach anEnvIter $THE_ENV_VARIABLES { set ${anEnvIter} "false" }
|
||||
set HAVE_TK "true"
|
||||
set HAVE_FREETYPE "true"
|
||||
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENVR HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
|
||||
foreach anEnvIter $THE_ENV_VARIABLES {
|
||||
set ${anEnvIter} "false"
|
||||
if { [info exists ::env(${anEnvIter})] } {
|
||||
set ${anEnvIter} "$::env(${anEnvIter})"
|
||||
}
|
||||
|
@@ -686,17 +686,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
|
||||
# Write specific options
|
||||
if { $docType == "REFMAN" } {
|
||||
|
||||
# always include optional components
|
||||
set aHaveD3dBack ""
|
||||
set aHaveGlesBack ""
|
||||
set aHaveVtkBack ""
|
||||
if { [info exists ::env(HAVE_D3D)] } { set aHaveD3dBack "$::env(HAVE_D3D)" }
|
||||
if { [info exists ::env(HAVE_GLES2)] } { set aHaveGlesBack "$::env(HAVE_GLES2)" }
|
||||
if { [info exists ::env(HAVE_VTK)] } { set aHaveVtkBack "$::env(HAVE_VTK)" }
|
||||
set ::env(HAVE_D3D) "true"
|
||||
set ::env(HAVE_GLES2) "true"
|
||||
set ::env(HAVE_VTK) "true"
|
||||
|
||||
# Load lists of modules scripts
|
||||
if { $productsPath == "" } {
|
||||
set modules_scripts [glob -nocomplain -type f -directory "[OCCDoc_GetSourceDir $productsPath]/OS/" *.tcl]
|
||||
@@ -822,11 +811,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
|
||||
|
||||
puts $doxyFile ""
|
||||
|
||||
# restore environment variables
|
||||
set ::env(HAVE_D3D) "$aHaveD3dBack"
|
||||
set ::env(HAVE_GLES2) "$aHaveGlesBack"
|
||||
set ::env(HAVE_VTK) "$aHaveVtkBack"
|
||||
|
||||
} elseif { $docType == "OVERVIEW" } {
|
||||
|
||||
# Add common options for generation of Overview and User Guides
|
||||
|
@@ -129,7 +129,7 @@ proc osutils:isEqualContent { theContent1 theContent2 } {
|
||||
# Auxiliary function for writing new file content only if it has been actually changed
|
||||
# (e.g. to preserve file timestamp on no change).
|
||||
# Useful for automatically (re)generated files.
|
||||
proc osutils:writeTextFile { theFile theContent {theEol lf} {theToBackup false} } {
|
||||
proc osutils:writeTextFile { theFile theContent {theEol lf} } {
|
||||
if {[file exists "${theFile}"]} {
|
||||
set aFileOld [open "${theFile}" rb]
|
||||
fconfigure $aFileOld -translation crlf
|
||||
@@ -143,10 +143,6 @@ proc osutils:writeTextFile { theFile theContent {theEol lf} {theToBackup false}
|
||||
return false
|
||||
}
|
||||
|
||||
if { $theToBackup == true } {
|
||||
puts "Warning: file ${theFile} is updated. Old content is saved to ${theFile}.bak"
|
||||
file copy -force -- "${theFile}" "${theFile}.bak"
|
||||
}
|
||||
file delete -force "${theFile}"
|
||||
}
|
||||
|
||||
@@ -377,28 +373,29 @@ proc copy_with_warning {from to} {
|
||||
# Generate auxiliary scripts for launching IDE.
|
||||
proc genprojbat {theFormat thePlatform theSolution} {
|
||||
set aTargetPlatformExt sh
|
||||
set aTargetEol lf
|
||||
if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
|
||||
set aTargetPlatformExt bat
|
||||
set aTargetEol crlf
|
||||
}
|
||||
|
||||
if { [file exists "$::path/src/OS/FoundationClasses.tcl"] || ![file exists "$::path/env.${aTargetPlatformExt}"] } {
|
||||
# generate env.bat/sh
|
||||
set anEnvTmplFilePath "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}"
|
||||
set anEnvTmplFile [open "$anEnvTmplFilePath" "r"]
|
||||
set anEnvTmpl [read $anEnvTmplFile]
|
||||
close $anEnvTmplFile
|
||||
if {"$theFormat" != "cmake"} {
|
||||
# copy env.bat/sh only if not yet present
|
||||
if { ! [file exists "$::path/env.${aTargetPlatformExt}"] } {
|
||||
set anEnvTmplFile [open "$::THE_CASROOT/adm/templates/env.${aTargetPlatformExt}" "r"]
|
||||
set anEnvTmpl [read $anEnvTmplFile]
|
||||
close $anEnvTmplFile
|
||||
|
||||
set aCasRoot ""
|
||||
if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } {
|
||||
set aCasRoot [relativePath "$::path" "$::THE_CASROOT"]
|
||||
set aCasRoot ""
|
||||
if { [file normalize "$::path"] != [file normalize "$::THE_CASROOT"] } {
|
||||
set aCasRoot [relativePath "$::path" "$::THE_CASROOT"]
|
||||
}
|
||||
|
||||
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
|
||||
|
||||
set anEnvFile [open "$::path/env.${aTargetPlatformExt}" "w"]
|
||||
puts $anEnvFile $anEnvTmpl
|
||||
close $anEnvFile
|
||||
}
|
||||
|
||||
regsub -all -- {__CASROOT__} $anEnvTmpl "$aCasRoot" anEnvTmpl
|
||||
set aLineList [split $anEnvTmpl "\n"]
|
||||
osutils:writeTextFile "$::path/env.${aTargetPlatformExt}" $aLineList $aTargetEol true
|
||||
|
||||
copy_with_warning "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
|
||||
|
||||
if { "$::BUILD_Inspector" == "true" } {
|
||||
@@ -1412,13 +1409,9 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
|
||||
unset theCsfLibsMap
|
||||
unset theCsfFrmsMap
|
||||
|
||||
if { "$::HAVE_FREETYPE" == "true" } {
|
||||
set aLibsMap(CSF_FREETYPE) "freetype"
|
||||
}
|
||||
set aLibsMap(CSF_FREETYPE) "freetype"
|
||||
set aLibsMap(CSF_TclLibs) "tcl8.6"
|
||||
if { "$::HAVE_TK" == "true" } {
|
||||
set aLibsMap(CSF_TclTkLibs) "tk8.6"
|
||||
}
|
||||
set aLibsMap(CSF_TclTkLibs) "tk8.6"
|
||||
if { "$::HAVE_FREEIMAGE" == "true" } {
|
||||
if { "$theOS" == "wnt" } {
|
||||
set aLibsMap(CSF_FreeImagePlus) "FreeImage"
|
||||
@@ -1474,9 +1467,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
|
||||
|
||||
# the naming is different on Windows
|
||||
set aLibsMap(CSF_TclLibs) "tcl86"
|
||||
if { "$::HAVE_TK" == "true" } {
|
||||
set aLibsMap(CSF_TclTkLibs) "tk86"
|
||||
}
|
||||
set aLibsMap(CSF_TclTkLibs) "tk86"
|
||||
if { "$theRelease" == "true" } {
|
||||
set aLibsMap(CSF_QT) "Qt5Gui Qt5Widgets Qt5Xml Qt5Core"
|
||||
} else {
|
||||
@@ -1505,26 +1496,20 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
|
||||
set aFrmsMap(CSF_Appkit) "AppKit"
|
||||
}
|
||||
set aFrmsMap(CSF_IOKit) "IOKit"
|
||||
set aLibsMap(CSF_TclLibs) ""
|
||||
set aLibsMap(CSF_TclTkLibs) ""
|
||||
set aFrmsMap(CSF_TclLibs) "Tcl"
|
||||
if { "$::HAVE_TK" == "true" } {
|
||||
set aFrmsMap(CSF_TclTkLibs) "Tk"
|
||||
}
|
||||
set aLibsMap(CSF_TclLibs) ""
|
||||
set aFrmsMap(CSF_TclTkLibs) "Tk"
|
||||
set aLibsMap(CSF_TclTkLibs) ""
|
||||
set aLibsMap(CSF_QT) "QtCore QtGui"
|
||||
} elseif { "$theOS" == "android" } {
|
||||
set aLibsMap(CSF_androidlog) "log"
|
||||
} else {
|
||||
if { "$::HAVE_FREETYPE" == "true" } {
|
||||
set aLibsMap(CSF_fontconfig) "fontconfig"
|
||||
}
|
||||
set aLibsMap(CSF_fontconfig) "fontconfig"
|
||||
if { "$theOS" == "qnx" } {
|
||||
# CSF_ThreadLibs - pthread API is part of libc on QNX
|
||||
} else {
|
||||
set aLibsMap(CSF_ThreadLibs) "pthread rt"
|
||||
if { "$::HAVE_TK" == "true" } {
|
||||
set aLibsMap(CSF_TclTkLibs) "tk8.6"
|
||||
}
|
||||
set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
|
||||
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
|
||||
set aLibsMap(CSF_MotifLibs) "X11"
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ aHxxRoot = $$OccGitRoot/inc
|
||||
INCLUDEPATH += $$aHxxRoot
|
||||
|
||||
# CSF variables
|
||||
HAVE_FREETYPE { CSF_FREETYPE = -lfreetype }
|
||||
CSF_FREETYPE = -lfreetype
|
||||
CSF_TclLibs = -ltcl8.6
|
||||
CSF_TclTkLibs = -ltk8.6
|
||||
HAVE_FREEIMAGE { CSF_FreeImagePlus = -lfreeimage } else:win32 { CSF_FreeImagePlus = -lwindowscodecs -lole32 }
|
||||
@@ -64,7 +64,7 @@ win32 {
|
||||
CSF_TclTkLibs = -lX11 -ltk8.6
|
||||
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
|
||||
CSF_MotifLibs = -lX11
|
||||
HAVE_FREETYPE { CSF_fontconfig = -lfontconfig }
|
||||
CSF_fontconfig = -lfontconfig
|
||||
}
|
||||
|
||||
for (aCfgIter, CONFIG) {
|
||||
|
@@ -17,8 +17,6 @@ set "ARCH=64"
|
||||
set "VCVARS="
|
||||
set "HAVE_TBB=false"
|
||||
set "HAVE_OPENCL=false"
|
||||
set "HAVE_TK=true"
|
||||
set "HAVE_FREETYPE=true"
|
||||
set "HAVE_FREEIMAGE=false"
|
||||
set "HAVE_FFMPEG=false"
|
||||
set "HAVE_VTK=false"
|
||||
@@ -58,9 +56,9 @@ rem Decode VCVER variable and define related ones:
|
||||
rem
|
||||
rem VCFMT - "vc" followed by full version number of Visual Studio toolset
|
||||
rem (same as VCVER without optional suffix "-uwp")
|
||||
rem VCLIB - name of folder containing binaries
|
||||
rem VCLIB - name of folder contining binaries
|
||||
rem (same as VCVER except without third version in number)
|
||||
rem VCPROP - name of required Visual Studio Workload (starting with VS 2017)
|
||||
rem VCPROP - name of required Visual Studion Workload (starting with VS 2017)
|
||||
rem
|
||||
rem Note that for VS before 2015 (vc14) always
|
||||
rem VCFMT=VCLIB=VCVER and VCPROP=NativeDesktop
|
||||
@@ -184,8 +182,6 @@ set "CSF_OPT_CMPL="
|
||||
set "PRODUCTS_DEFINES="
|
||||
if ["%HAVE_TBB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB" & set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
|
||||
if ["%HAVE_OPENCL%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL" & set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
|
||||
if ["%HAVE_TK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TK" & set "CSF_DEFINES=HAVE_TK;%CSF_DEFINES%"
|
||||
if ["%HAVE_FREETYPE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREETYPE;%CSF_DEFINES%"
|
||||
if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
|
||||
if ["%HAVE_FFMPEG%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG" & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
|
||||
if ["%HAVE_VTK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK" & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
|
||||
@@ -203,20 +199,20 @@ if ["%CSF_DEFINES%"] == [""] set "CSF_DEFINES=;"
|
||||
rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
|
||||
if not ["%PRODUCTS_DEFINES%"] == [""] set "CSF_OPT_CMPL=%CSF_OPT_CMPL% %PRODUCTS_DEFINES%"
|
||||
|
||||
rem ----- Collect 3rd-parties additional include paths into compiler options -----
|
||||
rem ----- Colect 3rd-parties additional include paths into compiler options -----
|
||||
for %%a in ("%CSF_OPT_INC:;=";"%") do (
|
||||
set "anItem=%%~a"
|
||||
if not ["%%~a"] == [""] call :concatCmplInc %%~a
|
||||
)
|
||||
|
||||
rem ----- Collect 3rd-parties additional library paths (32-bit) into linker options -----
|
||||
rem ----- Colect 3rd-parties additional library paths (32-bit) into linker options -----
|
||||
set "OPT_LIB32="
|
||||
for %%a in ("%CSF_OPT_LIB32:;=";"%") do (
|
||||
set "anItem=%%~a"
|
||||
if not ["%%~a"] == [""] call :concatLib32 %%~a
|
||||
)
|
||||
|
||||
rem ----- Collect 3rd-parties additional library paths (64-bit) into linker options -----
|
||||
rem ----- Colect 3rd-parties additional library paths (64-bit) into linker options -----
|
||||
set "OPT_LIB64="
|
||||
for %%a in ("%CSF_OPT_LIB64:;=";"%") do (
|
||||
set "anItem=%%~a"
|
||||
@@ -248,7 +244,7 @@ if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64D%;%PAT
|
||||
if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32I%;%PATH%"
|
||||
if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64I%;%PATH%"
|
||||
|
||||
rem ----- Set environment variables used by OCCT -----
|
||||
rem ----- Set envoronment variables used by OCCT -----
|
||||
set CSF_LANGUAGE=us
|
||||
set MMGT_CLEAR=1
|
||||
set "CSF_SHMessage=%CSF_OCCTResourcePath%\SHMessage"
|
||||
|
@@ -9,8 +9,6 @@ export CASDEB=""
|
||||
export PRJFMT="";
|
||||
export HAVE_TBB="false";
|
||||
export HAVE_OPENCL="false";
|
||||
export HAVE_TK="true";
|
||||
export HAVE_FREETYPE="true";
|
||||
export HAVE_FREEIMAGE="false";
|
||||
export HAVE_FFMPEG="false";
|
||||
export HAVE_VTK="false";
|
||||
@@ -102,8 +100,6 @@ export CSF_OPT_CMPL=""
|
||||
# Optiona 3rd-parties should be enabled by HAVE macros
|
||||
if [ "$HAVE_TBB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_TBB"; fi
|
||||
if [ "$HAVE_OPENCL" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENCL"; fi
|
||||
if [ "$HAVE_TK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_TK"; fi
|
||||
if [ "$HAVE_FREETYPE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREETYPE"; fi
|
||||
if [ "$HAVE_FREEIMAGE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREEIMAGE"; fi
|
||||
if [ "$HAVE_FFMPEG" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FFMPEG"; fi
|
||||
if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2_EXT"; fi
|
||||
|
@@ -471,7 +471,7 @@ The environment is defined in the file *custom.sh* which can be edited directly:
|
||||
* "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_FREEIMAGE=false
|
||||
export HAVE_GL2PS=false
|
||||
~~~~~
|
||||
|
||||
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:
|
||||
@@ -544,7 +544,7 @@ directly:
|
||||
* "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_FREEIMAGE=false
|
||||
export HAVE_GL2PS=false
|
||||
~~~~~
|
||||
|
||||
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure
|
||||
|
@@ -1,27 +0,0 @@
|
||||
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="188" height="90" fill="white"/>
|
||||
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
|
||||
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
|
||||
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
|
||||
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
|
||||
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
|
||||
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
|
||||
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
|
||||
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
|
||||
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
|
||||
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
|
||||
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
|
||||
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
|
||||
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
|
||||
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
|
||||
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
|
||||
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
|
||||
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
|
||||
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
|
||||
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
|
||||
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
|
||||
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
|
||||
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
|
||||
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
|
||||
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -1040,7 +1040,7 @@ Select* methods of AIS_InteractiveContext accept some selection scheme as parame
|
||||
| :----- | :----- | :----- | :----- | :----- |
|
||||
| AIS_SelectionScheme_Replace | @figure{visualization_selection_scheme_replace.svg, ""} | | AIS_SelectionScheme_XOR | @figure{visualization_selection_scheme_XOR.svg, ""} |
|
||||
| AIS_SelectionScheme_Add | @figure{visualization_selection_scheme_add.svg, ""} | | AIS_SelectionScheme_Clear | @figure{visualization_selection_scheme_clear.svg, ""} |
|
||||
| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | AIS_SelectionScheme_ReplaceExtra | @figure{visualization_selection_scheme_replaceExtra.svg, ""} |
|
||||
| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | | |
|
||||
|
||||
|
||||
@subsection occt_visu_3_5 Standard Interactive Object Classes
|
||||
|
@@ -577,7 +577,7 @@ bool OcctJni_Viewer::saveSnapshot (const TCollection_AsciiString& thePath,
|
||||
}
|
||||
|
||||
Image_AlienPixMap anAlienImage;
|
||||
if (!anAlienImage.InitTrash (Image_Format_BGRA, theWidth, theHeight))
|
||||
if (!anAlienImage.InitTrash (Image_PixMap::ImgBGRA, theWidth, theHeight))
|
||||
{
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "RGBA image " + theWidth + "x" + theHeight + " allocation failed", Message_Fail);
|
||||
return false;
|
||||
@@ -586,7 +586,7 @@ bool OcctJni_Viewer::saveSnapshot (const TCollection_AsciiString& thePath,
|
||||
// OpenGL ES does not support fetching data in BGRA format
|
||||
// while FreeImage does not support RGBA format.
|
||||
Image_PixMap anImage;
|
||||
anImage.InitWrapper (Image_Format_RGBA,
|
||||
anImage.InitWrapper (Image_PixMap::ImgRGBA,
|
||||
anAlienImage.ChangeData(),
|
||||
anAlienImage.SizeX(),
|
||||
anAlienImage.SizeY(),
|
||||
|
@@ -217,7 +217,7 @@ void OCC_2dView::OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI)
|
||||
void OCC_2dView::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
OCC_BaseView::OnSize (nType, cx, cy);
|
||||
// Take care : This function is called before OnInitialUpdate
|
||||
// Take care : This fonction is call before OnInitialUpdate
|
||||
if (!myView.IsNull())
|
||||
myView->MustBeResized();
|
||||
}
|
||||
|
@@ -149,29 +149,6 @@ void AIS_Selection::SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwner
|
||||
{
|
||||
return;
|
||||
}
|
||||
case AIS_SelectionScheme_ReplaceExtra:
|
||||
{
|
||||
// If picked owners is equivalent to the selected then just clear selected
|
||||
// Else go to AIS_SelectionScheme_Replace
|
||||
if (thePickedOwners.Size() == myresult.Size())
|
||||
{
|
||||
Standard_Boolean isTheSame = Standard_True;
|
||||
for (AIS_NArray1OfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
if (!myResultMap.IsBound (aSelIter.Value()))
|
||||
{
|
||||
isTheSame = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isTheSame)
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Standard_FALLTHROUGH
|
||||
case AIS_SelectionScheme_Replace:
|
||||
{
|
||||
Clear();
|
||||
|
@@ -22,9 +22,7 @@ enum AIS_SelectionScheme
|
||||
AIS_SelectionScheme_Add, //!< adds detected object to current selection
|
||||
AIS_SelectionScheme_Remove, //!< removes detected object from the current selection
|
||||
AIS_SelectionScheme_XOR, //!< performs XOR for detected objects, other selected not touched
|
||||
AIS_SelectionScheme_Clear, //!< clears current selection
|
||||
AIS_SelectionScheme_ReplaceExtra, //!< replace with one difference: if result of replace is an empty,
|
||||
//!< and current selection contains detected element, it will be selected
|
||||
AIS_SelectionScheme_Clear //!< clears current selection
|
||||
};
|
||||
|
||||
#endif // _AIS_SelectionScheme_HeaderFile
|
||||
|
@@ -404,11 +404,9 @@ Standard_Boolean AIS_TextLabel::calculateLabelParams (const gp_Pnt& thePosition,
|
||||
{
|
||||
// Get width and height of text
|
||||
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
|
||||
const Graphic3d_RenderingParams& aRendParams = GetContext()->CurrentViewer()->DefaultRenderingParams();
|
||||
Font_FTFontParams aFontParams;
|
||||
aFontParams.PointSize = (unsigned int) anAsp->Height();
|
||||
aFontParams.Resolution = aRendParams.Resolution;
|
||||
aFontParams.FontHinting = aRendParams.FontHinting;
|
||||
aFontParams.Resolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
||||
|
||||
Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(),
|
||||
anAsp->Aspect()->GetTextFontAspect(),
|
||||
|
@@ -576,7 +576,6 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
Standard_Integer aDegMin = -1, aDegMax = -1, aMaxSegments = -1;
|
||||
Standard_Real aMaxDist = -1;
|
||||
AppParCurves_Constraint aBndPnt = AppParCurves_TangencyPoint;
|
||||
Standard_Boolean isExtendSurf = Standard_False;
|
||||
if ((TolReached2d >= 10. * aTR) && (TolReached2d <= aMaxTol || isAnaSurf))
|
||||
{
|
||||
aTR = Min(aMaxTol, 0.1*TolReached2d);
|
||||
@@ -586,34 +585,12 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
|
||||
{
|
||||
aBndPnt = AppParCurves_PassPoint;
|
||||
}
|
||||
isExtendSurf = Standard_True;
|
||||
}
|
||||
else if(TolReached2d > aMaxTol)
|
||||
{
|
||||
aTR = Min(TolReached2d, 1.e3 * aMaxTol);
|
||||
aMaxDist = 1.e2 * aTR;
|
||||
aMaxSegments = 100;
|
||||
isExtendSurf = Standard_True;
|
||||
}
|
||||
if (isExtendSurf)
|
||||
{
|
||||
Handle(Adaptor3d_Surface) anA3dSurf;
|
||||
Standard_Real dt = (aBAHS->LastUParameter() - aBAHS->FirstUParameter());
|
||||
if (!aBAHS->IsUPeriodic() || Abs(dt - aBAHS->UPeriod()) > 0.01 * dt)
|
||||
{
|
||||
dt *= 0.01;
|
||||
anA3dSurf = aBAHS->UTrim(aBAHS->FirstUParameter() - dt, aBAHS->LastUParameter() + dt, 0.);
|
||||
}
|
||||
dt = (aBAHS->LastVParameter() - aBAHS->FirstVParameter());
|
||||
if (!aBAHS->IsVPeriodic() || Abs(dt - aBAHS->VPeriod()) > 0.01 * dt)
|
||||
{
|
||||
dt *= 0.01;
|
||||
anA3dSurf = aBAHS->VTrim(aBAHS->FirstVParameter() - dt, aBAHS->LastVParameter() + dt, 0.);
|
||||
}
|
||||
if (!anA3dSurf.IsNull())
|
||||
{
|
||||
aProjCurv.Load(anA3dSurf);
|
||||
}
|
||||
}
|
||||
aProjCurv.Load(aTR);
|
||||
aProjCurv.SetDegree(aDegMin, aDegMax);
|
||||
|
@@ -2969,25 +2969,13 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
|
||||
// Construction of the shell
|
||||
TopoDS_Shell shell;
|
||||
B.MakeShell(shell);
|
||||
Standard_Integer aNbFaces = 0;
|
||||
for (ipath=1; ipath<=NbPath; ipath++)
|
||||
for (isec=1; isec <=NbLaw; isec++)
|
||||
{
|
||||
const TopoDS_Shape& face = myFaces->Value(isec, ipath);
|
||||
for (isec=1; isec <=NbLaw; isec++) {
|
||||
const TopoDS_Shape& face = myFaces->Value(isec, ipath);
|
||||
if (!face.IsNull() &&
|
||||
(face.ShapeType() == TopAbs_FACE) )
|
||||
{
|
||||
B.Add(shell, face);
|
||||
aNbFaces++;
|
||||
}
|
||||
(face.ShapeType() == TopAbs_FACE) ) B.Add(shell, face);
|
||||
}
|
||||
|
||||
if (aNbFaces == 0)
|
||||
{
|
||||
isDone = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
TopTools_ListIteratorOfListOfShape It(myAuxShape);
|
||||
for (; It.More(); It.Next()) {
|
||||
const TopoDS_Shape& face = It.Value();
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#include <GeometryTest.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@@ -168,13 +167,8 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
|
||||
NbPtsCur->Value(i));
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
Henri.Perform(aProgress->Start());
|
||||
if (aProgress->UserBreak())
|
||||
{
|
||||
di << "Error: UserBreak\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Henri.Perform();
|
||||
|
||||
Standard_Real ErrG0 = 1.1*Henri.G0Error();
|
||||
//std::cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<std::endl;
|
||||
@@ -223,7 +217,7 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
|
||||
// commande gplate : resultat face egale a la surface approchee
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Standard_Integer gplate (Draw_Interpretor & di,Standard_Integer n,const char** a)
|
||||
static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 6 ) return 1;
|
||||
Standard_Integer NbCurFront=Draw::Atoi(a[2]),
|
||||
@@ -304,13 +298,7 @@ static Standard_Integer gplate (Draw_Interpretor & di,Standard_Integer n,const c
|
||||
Henri.Add(PCont);
|
||||
}
|
||||
}
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
Henri.Perform(aProgress->Start());
|
||||
if (aProgress->UserBreak())
|
||||
{
|
||||
di << "Error: UserBreak\n";
|
||||
return 0;
|
||||
}
|
||||
Henri.Perform();
|
||||
Standard_Integer nbcarreau=9;
|
||||
Standard_Integer degmax=8;
|
||||
Standard_Real seuil;
|
||||
@@ -380,13 +368,7 @@ static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,co
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
Henri.Perform(aProgress->Start());
|
||||
if (aProgress->UserBreak())
|
||||
{
|
||||
di << "Error: UserBreak\n";
|
||||
return 0;
|
||||
}
|
||||
Henri.Perform();
|
||||
|
||||
Standard_Real dmax = Henri.G0Error(),
|
||||
anmax = Henri.G1Error();
|
||||
|
@@ -34,8 +34,6 @@ IMPLEMENT_STANDARD_RTTIEXT(BVH_ObjectTransient, Standard_Transient)
|
||||
template class NCollection_Vec2<Standard_Real>;
|
||||
template class NCollection_Vec3<Standard_Real>;
|
||||
template class NCollection_Vec4<Standard_Real>;
|
||||
template class NCollection_Mat3<Standard_Real>;
|
||||
template class NCollection_Mat4<Standard_Real>;
|
||||
|
||||
template class BVH_Box<Standard_Real, 2>;
|
||||
template class BVH_Box<Standard_Real, 3>;
|
||||
|
@@ -343,21 +343,11 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
|
||||
#elif defined(_DEBUG)
|
||||
di << "Debug mode\n";
|
||||
#endif
|
||||
#ifdef HAVE_TK
|
||||
di << "Tk enabled (HAVE_TK)\n";
|
||||
#else
|
||||
di << "Tk disabled\n";
|
||||
#endif
|
||||
#ifdef HAVE_TBB
|
||||
di << "TBB enabled (HAVE_TBB)\n";
|
||||
#else
|
||||
di << "TBB disabled\n";
|
||||
#endif
|
||||
#ifdef HAVE_FREETYPE
|
||||
di << "FreeType enabled (HAVE_FREETYPE)\n";
|
||||
#else
|
||||
di << "FreeType disabled\n";
|
||||
#endif
|
||||
#ifdef HAVE_FREEIMAGE
|
||||
di << "FreeImage enabled (HAVE_FREEIMAGE)\n";
|
||||
#else
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
extern Standard_Boolean Draw_Batch;
|
||||
@@ -110,7 +109,6 @@ defaultPrompt:
|
||||
#include <Draw_Window.hxx>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_TK
|
||||
#if defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
// use forward declaration for small subset of used Tk functions
|
||||
// to workaround broken standard Tk framework installation within OS X SDKs
|
||||
@@ -129,7 +127,6 @@ defaultPrompt:
|
||||
#else
|
||||
#include <tk.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global variables used by the main program:
|
||||
@@ -929,38 +926,41 @@ void Draw_Window::WConfigureNotify(const Standard_Integer,
|
||||
//function : WUnmapNotify
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Draw_Window::WUnmapNotify()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//======================================================
|
||||
// function : ProcessEvents
|
||||
// purpose : process pending X events
|
||||
//======================================================
|
||||
|
||||
static void ProcessEvents(ClientData,int)
|
||||
{
|
||||
// test for X Event
|
||||
while (XPending (Draw_WindowDisplay))
|
||||
{
|
||||
XEvent anEvent = {};
|
||||
XNextEvent (Draw_WindowDisplay, &anEvent);
|
||||
|
||||
// search the window in the window list
|
||||
bool isFound = false;
|
||||
for (Draw_Window* aWinIter = Draw_Window::firstWindow; aWinIter != NULL; aWinIter = aWinIter->next)
|
||||
{
|
||||
if (anEvent.xany.window == aWinIter->win)
|
||||
{
|
||||
ProcessEvent (*aWinIter, anEvent);
|
||||
isFound = true;
|
||||
while (XPending(Draw_WindowDisplay)) {
|
||||
|
||||
XEvent xev;
|
||||
xev.type = 0;
|
||||
|
||||
XNextEvent(Draw_WindowDisplay,&xev);
|
||||
|
||||
/* search the window in the window list */
|
||||
Draw_Window* w = Draw_Window::firstWindow;
|
||||
Standard_Integer found=0;
|
||||
while (w) {
|
||||
if (xev.xany.window == w->win) {
|
||||
ProcessEvent(*w, xev);
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
w = w->next;
|
||||
}
|
||||
if (!isFound)
|
||||
{
|
||||
#ifdef _TK
|
||||
Tk_HandleEvent (&anEvent);
|
||||
#endif
|
||||
if (found==0) {
|
||||
Tk_HandleEvent(&xev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -998,59 +998,96 @@ void GetNextEvent(Event& ev)
|
||||
// function :Run_Appli
|
||||
// purpose :
|
||||
//======================================================
|
||||
|
||||
|
||||
static Standard_Boolean(*Interprete) (const char*);
|
||||
|
||||
void Run_Appli(Standard_Boolean (*interprete) (const char*))
|
||||
{
|
||||
Tcl_Channel outChannel, inChannel ;
|
||||
Interprete = interprete;
|
||||
|
||||
// Commands will come from standard input, so set up an event handler for standard input.
|
||||
// If the input device is aEvaluate the .rc file, if one has been specified,
|
||||
// set up an event handler for standard input, and print a prompt if the input device is a terminal.
|
||||
Tcl_Channel anInChannel = Tcl_GetStdChannel(TCL_STDIN);
|
||||
if (anInChannel)
|
||||
{
|
||||
Tcl_CreateChannelHandler (anInChannel, TCL_READABLE, StdinProc, (ClientData )anInChannel);
|
||||
}
|
||||
#ifdef _TK
|
||||
|
||||
/*
|
||||
* Commands will come from standard input, so set up an event
|
||||
* handler for standard input. If the input device is aEvaluate the
|
||||
* .rc file, if one has been specified, set up an event handler
|
||||
* for standard input, and print a prompt if the input
|
||||
* device is a terminal.
|
||||
*/
|
||||
inChannel = Tcl_GetStdChannel(TCL_STDIN);
|
||||
if (inChannel) {
|
||||
Tcl_CreateChannelHandler(inChannel, TCL_READABLE, StdinProc,
|
||||
(ClientData) inChannel);
|
||||
}
|
||||
|
||||
// Create a handler for the draw display
|
||||
|
||||
// Adding of the casting into void* to be able to compile on AO1
|
||||
// ConnectionNumber(Draw_WindowDisplay) is an int 32 bits
|
||||
// (void*) is a pointer 64 bits ???????
|
||||
|
||||
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
|
||||
Tcl_CreateFileHandler (ConnectionNumber(Draw_WindowDisplay), TCL_READABLE, ProcessEvents, (ClientData) 0);
|
||||
#if TCL_MAJOR_VERSION < 8
|
||||
Tk_CreateFileHandler((void*) ConnectionNumber(Draw_WindowDisplay),
|
||||
TK_READABLE, ProcessEvents,(ClientData) 0 );
|
||||
#else
|
||||
Tk_CreateFileHandler(ConnectionNumber(Draw_WindowDisplay),
|
||||
TK_READABLE, ProcessEvents,(ClientData) 0 );
|
||||
#endif
|
||||
#endif // __APPLE__
|
||||
|
||||
#endif
|
||||
|
||||
Draw_Interpretor& aCommands = Draw::GetInterpretor();
|
||||
|
||||
if (tty) { Prompt (aCommands.Interp(), 0); }
|
||||
Prompt (aCommands.Interp(), 0);
|
||||
if (tty) Prompt(aCommands.Interp(), 0);
|
||||
Prompt(aCommands.Interp(), 0);
|
||||
|
||||
Tcl_Channel anOutChannel = Tcl_GetStdChannel(TCL_STDOUT);
|
||||
if (anOutChannel)
|
||||
{
|
||||
Tcl_Flush (anOutChannel);
|
||||
}
|
||||
Tcl_DStringInit (&command);
|
||||
outChannel = Tcl_GetStdChannel(TCL_STDOUT);
|
||||
if (outChannel) {
|
||||
Tcl_Flush(outChannel);
|
||||
}
|
||||
Tcl_DStringInit(&command);
|
||||
|
||||
/*
|
||||
* Loop infinitely, waiting for commands to execute. When there
|
||||
* are no windows left, Tk_MainLoop returns and we exit.
|
||||
*/
|
||||
|
||||
#ifdef _TK
|
||||
if (Draw_VirtualWindows)
|
||||
{
|
||||
|
||||
if (Draw_VirtualWindows) {
|
||||
// main window will never shown
|
||||
// but main loop will parse all Xlib messages
|
||||
Tcl_Eval(aCommands.Interp(), "wm withdraw .");
|
||||
}
|
||||
// Loop infinitely, waiting for commands to execute.
|
||||
// When there are no windows left, Tk_MainLoop returns and we exit.
|
||||
Tk_MainLoop();
|
||||
#else
|
||||
for (;;)
|
||||
{
|
||||
Tcl_DoOneEvent (0); // practically the same as Tk_MainLoop()
|
||||
}
|
||||
#endif
|
||||
|
||||
for (NCollection_List<Draw_Window::FCallbackBeforeTerminate>::Iterator anIter (MyCallbacks);
|
||||
anIter.More(); anIter.Next())
|
||||
#else
|
||||
|
||||
fd_set readset;
|
||||
Standard_Integer count = ConnectionNumber(Draw_WindowDisplay);
|
||||
Standard_Integer numfd;
|
||||
while (1) {
|
||||
FD_ZERO(&readset);
|
||||
FD_SET(0,&readset);
|
||||
FD_SET(count,&readset);
|
||||
#ifdef HPUX
|
||||
numfd = select(count+1,(Integer*)&readset,NULL,NULL,NULL);
|
||||
#else
|
||||
numfd = select(count+1,&readset,NULL,NULL,NULL);
|
||||
#endif
|
||||
if (FD_ISSET(0,&readset)) StdinProc((ClientData)0,0);
|
||||
if (FD_ISSET(count,&readset)) ProcessEvents((ClientData)0,0);
|
||||
}
|
||||
|
||||
#endif
|
||||
NCollection_List<Draw_Window::FCallbackBeforeTerminate>::Iterator Iter(MyCallbacks);
|
||||
for(; Iter.More(); Iter.Next())
|
||||
{
|
||||
(*anIter.Value())();
|
||||
(*Iter.Value())();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1065,15 +1102,11 @@ Standard_Boolean Init_Appli()
|
||||
Tcl_Interp *interp = aCommands.Interp();
|
||||
Tcl_Init (interp);
|
||||
|
||||
#ifdef _TK
|
||||
try
|
||||
{
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Tk_Init (interp);
|
||||
}
|
||||
catch (Standard_Failure const& theFail)
|
||||
{
|
||||
Message::SendFail() << "TK_Init() failed with " << theFail;
|
||||
Tk_Init(interp) ;
|
||||
} catch (Standard_Failure const&) {
|
||||
std::cout <<" Pb au lancement de TK_Init "<<std::endl;
|
||||
}
|
||||
|
||||
Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);
|
||||
@@ -1094,7 +1127,6 @@ Standard_Boolean Init_Appli()
|
||||
#endif
|
||||
|
||||
Tk_GeometryRequest (aMainWindow, 200, 200);
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
|
||||
if (Draw_DisplayConnection.IsNull())
|
||||
@@ -1103,9 +1135,9 @@ Standard_Boolean Init_Appli()
|
||||
{
|
||||
Draw_DisplayConnection = new Aspect_DisplayConnection();
|
||||
}
|
||||
catch (Standard_Failure const& theFail)
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
std::cout << "Cannot open display (" << theFail << "). Interpret commands in batch mode." << std::endl;
|
||||
std::cout << "Cannot open display. Interpret commands in batch mode." << std::endl;
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
@@ -1281,9 +1313,7 @@ prompt:
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <OSD.hxx>
|
||||
|
||||
#ifdef HAVE_TK
|
||||
#include <tk.h>
|
||||
#endif
|
||||
#include <tk.h>
|
||||
|
||||
#define PENWIDTH 1
|
||||
#define CLIENTWND 0
|
||||
|
@@ -7,7 +7,6 @@ Font_FTFont.cxx
|
||||
Font_FTFont.hxx
|
||||
Font_FTLibrary.cxx
|
||||
Font_FTLibrary.hxx
|
||||
Font_Hinting.hxx
|
||||
Font_NameOfFont.hxx
|
||||
Font_NListOfSystemFont.hxx
|
||||
Font_Rect.hxx
|
||||
|
@@ -23,10 +23,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#endif
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Font_FTFont,Standard_Transient)
|
||||
|
||||
@@ -40,11 +38,7 @@ Font_FTFont::Font_FTFont (const Handle(Font_FTLibrary)& theFTLib)
|
||||
myActiveFTFace(NULL),
|
||||
myFontAspect (Font_FontAspect_Regular),
|
||||
myWidthScaling(1.0),
|
||||
#ifdef HAVE_FREETYPE
|
||||
myLoadFlags (FT_LOAD_NO_HINTING | FT_LOAD_TARGET_NORMAL),
|
||||
#else
|
||||
myLoadFlags (0),
|
||||
#endif
|
||||
myUChar (0U),
|
||||
myToUseUnicodeSubsetFallback (Font_FontMgr::ToUseUnicodeSubsetFallback())
|
||||
{
|
||||
@@ -74,9 +68,7 @@ void Font_FTFont::Release()
|
||||
myUChar = 0;
|
||||
if (myFTFace != NULL)
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
FT_Done_Face (myFTFace);
|
||||
#endif
|
||||
myFTFace = NULL;
|
||||
}
|
||||
myActiveFTFace = NULL;
|
||||
@@ -96,26 +88,6 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
|
||||
myBuffer = theData;
|
||||
myFontPath = theFileName;
|
||||
myFontParams = theParams;
|
||||
|
||||
// manage hinting style
|
||||
if ((theParams.FontHinting & Font_Hinting_Light) != 0
|
||||
&& (theParams.FontHinting & Font_Hinting_Normal) != 0)
|
||||
{
|
||||
throw Standard_ProgramError ("Font_FTFont, Light and Normal hinting styles are mutually exclusive");
|
||||
}
|
||||
setLoadFlag (FT_LOAD_TARGET_LIGHT, (theParams.FontHinting & Font_Hinting_Light) != 0);
|
||||
setLoadFlag (FT_LOAD_NO_HINTING, (theParams.FontHinting & Font_Hinting_Normal) == 0
|
||||
&& (theParams.FontHinting & Font_Hinting_Light) == 0);
|
||||
|
||||
// manage native / autohinting
|
||||
if ((theParams.FontHinting & Font_Hinting_ForceAutohint) != 0
|
||||
&& (theParams.FontHinting & Font_Hinting_NoAutohint) != 0)
|
||||
{
|
||||
throw Standard_ProgramError ("Font_FTFont, ForceAutohint and NoAutohint are mutually exclusive");
|
||||
}
|
||||
setLoadFlag (FT_LOAD_FORCE_AUTOHINT, (theParams.FontHinting & Font_Hinting_ForceAutohint) != 0);
|
||||
setLoadFlag (FT_LOAD_NO_AUTOHINT, (theParams.FontHinting & Font_Hinting_NoAutohint) != 0);
|
||||
|
||||
if (!myFTLib->IsValid())
|
||||
{
|
||||
Message::SendTrace ("FreeType library is unavailable");
|
||||
@@ -123,7 +95,6 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
if (!theData.IsNull())
|
||||
{
|
||||
if (FT_New_Memory_Face (myFTLib->Instance(), theData->Data(), (FT_Long )theData->Size(), (FT_Long )theFaceId, &myFTFace) != 0)
|
||||
@@ -173,10 +144,6 @@ bool Font_FTFont::Init (const Handle(NCollection_Buffer)& theData,
|
||||
}
|
||||
myActiveFTFace = myFTFace;
|
||||
return true;
|
||||
#else
|
||||
(void )theFaceId;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -207,7 +174,6 @@ Handle(Font_FTFont) Font_FTFont::FindAndCreate (const TCollection_AsciiString& t
|
||||
return aFont;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_FREETYPE
|
||||
else if (theStrictLevel == Font_StrictLevel_Any)
|
||||
{
|
||||
switch (theFontAspect)
|
||||
@@ -230,7 +196,6 @@ Handle(Font_FTFont) Font_FTFont::FindAndCreate (const TCollection_AsciiString& t
|
||||
return aFont;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Handle(Font_FTFont)();
|
||||
}
|
||||
|
||||
@@ -257,7 +222,6 @@ bool Font_FTFont::FindAndInit (const TCollection_AsciiString& theFontName,
|
||||
const TCollection_AsciiString& aPath = aRequestedFont->FontPathAny (myFontAspect, aParams.ToSynthesizeItalic, aFaceId);
|
||||
return Init (aPath, aParams, aFaceId);
|
||||
}
|
||||
#ifdef HAVE_FREETYPE
|
||||
else if (theStrictLevel == Font_StrictLevel_Any)
|
||||
{
|
||||
if (theFontAspect == Font_FontAspect_Italic
|
||||
@@ -267,7 +231,6 @@ bool Font_FTFont::FindAndInit (const TCollection_AsciiString& theFontName,
|
||||
}
|
||||
return Init (Font_FontMgr::EmbedFallbackFont(), "Embed Fallback Font", aParams, 0);
|
||||
}
|
||||
#endif
|
||||
Release();
|
||||
return false;
|
||||
}
|
||||
@@ -283,7 +246,6 @@ bool Font_FTFont::findAndInitFallback (Font_UnicodeSubset theSubset)
|
||||
return myFallbackFaces[theSubset]->IsValid();
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
myFallbackFaces[theSubset] = new Font_FTFont (myFTLib);
|
||||
myFallbackFaces[theSubset]->myToUseUnicodeSubsetFallback = false; // no recursion
|
||||
|
||||
@@ -301,7 +263,6 @@ bool Font_FTFont::findAndInitFallback (Font_UnicodeSubset theSubset)
|
||||
+ " for symbols unsupported by '" + myFTFace->family_name + "'");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return myFallbackFaces[theSubset]->IsValid();
|
||||
}
|
||||
|
||||
@@ -311,12 +272,7 @@ bool Font_FTFont::findAndInitFallback (Font_UnicodeSubset theSubset)
|
||||
// =======================================================================
|
||||
bool Font_FTFont::HasSymbol (Standard_Utf32Char theUChar) const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
return FT_Get_Char_Index (myFTFace, theUChar) != 0;
|
||||
#else
|
||||
(void )theUChar;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -330,7 +286,6 @@ bool Font_FTFont::loadGlyph (const Standard_Utf32Char theUChar)
|
||||
return myUChar != 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
myGlyphImg.Clear();
|
||||
myUChar = 0;
|
||||
myActiveFTFace = myFTFace;
|
||||
@@ -359,9 +314,6 @@ bool Font_FTFont::loadGlyph (const Standard_Utf32Char theUChar)
|
||||
|
||||
myUChar = theUChar;
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -374,7 +326,6 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
|
||||
myUChar = 0;
|
||||
myActiveFTFace = myFTFace;
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
if (theUChar != 0
|
||||
&& myToUseUnicodeSubsetFallback
|
||||
&& !HasSymbol (theUChar))
|
||||
@@ -436,10 +387,6 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
|
||||
|
||||
myUChar = theUChar;
|
||||
return true;
|
||||
#else
|
||||
(void )theUChar;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -448,7 +395,6 @@ bool Font_FTFont::RenderGlyph (const Standard_Utf32Char theUChar)
|
||||
// =======================================================================
|
||||
unsigned int Font_FTFont::GlyphMaxSizeX (bool theToIncludeFallback) const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
if (!theToIncludeFallback)
|
||||
{
|
||||
float aWidth = (FT_IS_SCALABLE(myFTFace) != 0)
|
||||
@@ -470,10 +416,6 @@ unsigned int Font_FTFont::GlyphMaxSizeX (bool theToIncludeFallback) const
|
||||
}
|
||||
}
|
||||
return aWidth;
|
||||
#else
|
||||
(void )theToIncludeFallback;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -482,7 +424,6 @@ unsigned int Font_FTFont::GlyphMaxSizeX (bool theToIncludeFallback) const
|
||||
// =======================================================================
|
||||
unsigned int Font_FTFont::GlyphMaxSizeY (bool theToIncludeFallback) const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
if (!theToIncludeFallback)
|
||||
{
|
||||
float aHeight = (FT_IS_SCALABLE(myFTFace) != 0)
|
||||
@@ -504,10 +445,6 @@ unsigned int Font_FTFont::GlyphMaxSizeY (bool theToIncludeFallback) const
|
||||
}
|
||||
}
|
||||
return aHeight;
|
||||
#else
|
||||
(void )theToIncludeFallback;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -516,11 +453,7 @@ unsigned int Font_FTFont::GlyphMaxSizeY (bool theToIncludeFallback) const
|
||||
// =======================================================================
|
||||
float Font_FTFont::Ascender() const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
return float(myFTFace->ascender) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
|
||||
#else
|
||||
return 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -529,11 +462,7 @@ float Font_FTFont::Ascender() const
|
||||
// =======================================================================
|
||||
float Font_FTFont::Descender() const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
return float(myFTFace->descender) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
|
||||
#else
|
||||
return 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -542,11 +471,7 @@ float Font_FTFont::Descender() const
|
||||
// =======================================================================
|
||||
float Font_FTFont::LineSpacing() const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
return float(myFTFace->height) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
|
||||
#else
|
||||
return 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -579,7 +504,6 @@ bool Font_FTFont::getKerning (FT_Vector& theKern,
|
||||
Standard_Utf32Char theUCharCurr,
|
||||
Standard_Utf32Char theUCharNext) const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
theKern.x = 0;
|
||||
theKern.y = 0;
|
||||
if (theUCharNext != 0 && FT_HAS_KERNING(myActiveFTFace) != 0)
|
||||
@@ -595,11 +519,6 @@ bool Font_FTFont::getKerning (FT_Vector& theKern,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
(void )theKern;
|
||||
(void )theUCharCurr;
|
||||
(void )theUCharNext;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -614,15 +533,9 @@ float Font_FTFont::AdvanceX (Standard_Utf32Char theUCharNext) const
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
FT_Vector aKern;
|
||||
getKerning (aKern, myUChar, theUCharNext);
|
||||
return myWidthScaling * fromFTPoints<float> (myActiveFTFace->glyph->advance.x + aKern.x
|
||||
+ myActiveFTFace->glyph->lsb_delta - myActiveFTFace->glyph->rsb_delta);
|
||||
#else
|
||||
(void )theUCharNext;
|
||||
return 0.0f;
|
||||
#endif
|
||||
return myWidthScaling * fromFTPoints<float> (myActiveFTFace->glyph->advance.x + aKern.x);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -636,14 +549,9 @@ float Font_FTFont::AdvanceY (Standard_Utf32Char theUCharNext) const
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
FT_Vector aKern;
|
||||
getKerning (aKern, myUChar, theUCharNext);
|
||||
return fromFTPoints<float> (myActiveFTFace->glyph->advance.y + aKern.y);
|
||||
#else
|
||||
(void )theUCharNext;
|
||||
return 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -652,7 +560,6 @@ float Font_FTFont::AdvanceY (Standard_Utf32Char theUCharNext) const
|
||||
// =======================================================================
|
||||
Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
Standard_Integer aNbGlyphs = myFTFace->num_glyphs;
|
||||
if (theToIncludeFallback)
|
||||
{
|
||||
@@ -666,10 +573,6 @@ Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
|
||||
}
|
||||
}
|
||||
return aNbGlyphs;
|
||||
#else
|
||||
(void )theToIncludeFallback;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -678,15 +581,11 @@ Standard_Integer Font_FTFont::GlyphsNumber (bool theToIncludeFallback) const
|
||||
// =======================================================================
|
||||
void Font_FTFont::GlyphRect (Font_Rect& theRect) const
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
const FT_Bitmap& aBitmap = myActiveFTFace->glyph->bitmap;
|
||||
theRect.Left = float(myActiveFTFace->glyph->bitmap_left);
|
||||
theRect.Top = float(myActiveFTFace->glyph->bitmap_top);
|
||||
theRect.Right = float(myActiveFTFace->glyph->bitmap_left + (int )aBitmap.width);
|
||||
theRect.Bottom = float(myActiveFTFace->glyph->bitmap_top - (int )aBitmap.rows);
|
||||
#else
|
||||
(void )theRect;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -715,15 +614,10 @@ Font_Rect Font_FTFont::BoundingBox (const NCollection_String& theS
|
||||
// =======================================================================
|
||||
const FT_Outline* Font_FTFont::renderGlyphOutline (const Standard_Utf32Char theChar)
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
if (!loadGlyph (theChar)
|
||||
|| myActiveFTFace->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return &myActiveFTFace->glyph->outline;
|
||||
#else
|
||||
(void )theChar;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#define _Font_FTFont_H__
|
||||
|
||||
#include <Font_FontAspect.hxx>
|
||||
#include <Font_Hinting.hxx>
|
||||
#include <Font_Rect.hxx>
|
||||
#include <Font_StrictLevel.hxx>
|
||||
#include <Font_UnicodeSubset.hxx>
|
||||
@@ -38,26 +37,16 @@ struct Font_FTFontParams
|
||||
{
|
||||
unsigned int PointSize; //!< face size in points (1/72 inch)
|
||||
unsigned int Resolution; //!< resolution of the target device in dpi for FT_Set_Char_Size()
|
||||
Font_Hinting FontHinting; //!< request hinting (exclude FT_LOAD_NO_HINTING flag), Font_Hinting_Off by default;
|
||||
//! hinting improves readability of thin text on low-resolution screen,
|
||||
//! but adds distortions to original font depending on font family and font library version
|
||||
bool ToSynthesizeItalic; //!< generate italic style (e.g. for font family having no italic style); FALSE by default
|
||||
bool IsSingleStrokeFont; //!< single-stroke (one-line) font, FALSE by default
|
||||
|
||||
//! Empty constructor.
|
||||
Font_FTFontParams()
|
||||
: PointSize (0), Resolution (72u),
|
||||
FontHinting (Font_Hinting_Off),
|
||||
ToSynthesizeItalic (false),
|
||||
IsSingleStrokeFont (false) {}
|
||||
Font_FTFontParams() : PointSize (0), Resolution (72u), ToSynthesizeItalic (false), IsSingleStrokeFont (false) {}
|
||||
|
||||
//! Constructor.
|
||||
Font_FTFontParams (unsigned int thePointSize,
|
||||
unsigned int theResolution)
|
||||
: PointSize (thePointSize), Resolution (theResolution),
|
||||
FontHinting (Font_Hinting_Off),
|
||||
ToSynthesizeItalic (false),
|
||||
IsSingleStrokeFont (false) {}
|
||||
: PointSize (thePointSize), Resolution (theResolution), ToSynthesizeItalic (false), IsSingleStrokeFont (false) {}
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Font_FTFont, Standard_Transient)
|
||||
@@ -370,19 +359,6 @@ protected:
|
||||
//! Initialize fallback font.
|
||||
Standard_EXPORT bool findAndInitFallback (Font_UnicodeSubset theSubset);
|
||||
|
||||
//! Enable/disable load flag.
|
||||
void setLoadFlag (int32_t theFlag, bool theToEnable)
|
||||
{
|
||||
if (theToEnable)
|
||||
{
|
||||
myLoadFlags |= theFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
myLoadFlags &= ~theFlag;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Font_FTLibrary) myFTLib; //!< handle to the FT library object
|
||||
|
@@ -15,10 +15,8 @@
|
||||
|
||||
#include <Font_FTLibrary.hxx>
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#endif
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Font_FTLibrary,Standard_Transient)
|
||||
|
||||
@@ -29,12 +27,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FTLibrary,Standard_Transient)
|
||||
Font_FTLibrary::Font_FTLibrary()
|
||||
: myFTLib (NULL)
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
if (FT_Init_FreeType (&myFTLib) != 0)
|
||||
{
|
||||
myFTLib = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -45,8 +41,6 @@ Font_FTLibrary::~Font_FTLibrary()
|
||||
{
|
||||
if (IsValid())
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
FT_Done_FreeType (myFTLib);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -28,12 +28,10 @@
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
#include "Font_DejavuSans_Latin_woff.pxx"
|
||||
#include "Font_DejavuSans_Latin_woff.pxx"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#endif
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
|
||||
|
||||
#if defined(_WIN32)
|
||||
@@ -41,7 +39,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_MSC_VER) && defined(HAVE_FREETYPE)
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment (lib, "freetype.lib")
|
||||
#endif
|
||||
|
||||
@@ -84,7 +82,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
|
||||
NULL
|
||||
};
|
||||
|
||||
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
// 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",
|
||||
@@ -151,9 +149,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
|
||||
static bool checkFont (NCollection_Sequence<Handle(Font_SystemFont)>& theFonts,
|
||||
const Handle(Font_FTLibrary)& theFTLib,
|
||||
const TCollection_AsciiString& theFontPath,
|
||||
signed long theFaceId = -1) // FT_Long
|
||||
FT_Long theFaceId = -1)
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
const FT_Long aFaceId = theFaceId != -1 ? theFaceId : 0;
|
||||
FT_Face aFontFace;
|
||||
FT_Error aFaceError = FT_New_Face (theFTLib->Instance(), theFontPath.ToCString(), aFaceId, &aFontFace);
|
||||
@@ -286,13 +283,6 @@ static bool checkFont (NCollection_Sequence<Handle(Font_SystemFont)>& theFonts,
|
||||
|
||||
FT_Done_Face (aFontFace);
|
||||
return true;
|
||||
#else
|
||||
(void )theFonts;
|
||||
(void )theFTLib;
|
||||
(void )theFontPath;
|
||||
(void )theFaceId;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -722,7 +712,7 @@ void Font_FontMgr::InitFontDataBase()
|
||||
#else
|
||||
|
||||
NCollection_Map<TCollection_AsciiString> aMapOfFontsDirs;
|
||||
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
if (FcConfig* aFcCfg = FcInitLoadConfig())
|
||||
{
|
||||
if (FcStrList* aFcFontDir = FcConfigGetFontDirs (aFcCfg))
|
||||
@@ -825,7 +815,7 @@ void Font_FontMgr::InitFontDataBase()
|
||||
for (NCollection_Map<TCollection_AsciiString>::Iterator anIter (aMapOfFontsDirs);
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
OSD_File aReadFile (anIter.Value() + "/fonts.dir");
|
||||
if (!aReadFile.Exists())
|
||||
{
|
||||
@@ -845,7 +835,7 @@ void Font_FontMgr::InitFontDataBase()
|
||||
RegisterFonts (aFonts, false);
|
||||
}
|
||||
|
||||
#if defined(HAVE_FREETYPE) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1164,11 +1154,7 @@ Handle(Font_SystemFont) Font_FontMgr::Font_FontMap::Find (const TCollection_Asci
|
||||
// =======================================================================
|
||||
Handle(NCollection_Buffer) Font_FontMgr::EmbedFallbackFont()
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
return new NCollection_Buffer (Handle(NCollection_BaseAllocator)(),
|
||||
Font_DejavuSans_Latin_woff_size,
|
||||
const_cast<Standard_Byte*>(Font_DejavuSans_Latin_woff));
|
||||
#else
|
||||
return Handle(NCollection_Buffer)();
|
||||
#endif
|
||||
}
|
||||
|
@@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2021 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 _Font_Hinting_HeaderFile
|
||||
#define _Font_Hinting_HeaderFile
|
||||
|
||||
//! Enumeration defining font hinting options.
|
||||
enum Font_Hinting
|
||||
{
|
||||
// hinting style
|
||||
Font_Hinting_Off = 0x00, //!< no hinting (FT_LOAD_NO_HINTING)
|
||||
Font_Hinting_Normal = 0x01, //!< default hinting (FT_LOAD_TARGET_NORMAL)
|
||||
Font_Hinting_Light = 0x02, //!< light hinting (FT_LOAD_TARGET_LIGHT)
|
||||
// native/autohinting flags
|
||||
Font_Hinting_ForceAutohint = 0x10, //!< prefer autohinting over native hinting (FT_LOAD_FORCE_AUTOHINT)
|
||||
Font_Hinting_NoAutohint = 0x20, //!< disallow autohinting (FT_LOAD_NO_AUTOHINT)
|
||||
};
|
||||
|
||||
#endif // _Font_Hinting_HeaderFile
|
@@ -1,17 +1,22 @@
|
||||
GCPnts_AbscissaPoint.cxx
|
||||
GCPnts_AbscissaPoint.pxx
|
||||
GCPnts_AbscissaPoint.hxx
|
||||
GCPnts_AbscissaType.hxx
|
||||
GCPnts_DeflectionType.hxx
|
||||
GCPnts_QuasiUniformAbscissa.cxx
|
||||
GCPnts_QuasiUniformAbscissa.pxx
|
||||
GCPnts_QuasiUniformAbscissa.hxx
|
||||
GCPnts_QuasiUniformDeflection.cxx
|
||||
GCPnts_QuasiUniformDeflection.pxx
|
||||
GCPnts_QuasiUniformDeflection.hxx
|
||||
GCPnts_TangentialDeflection.cxx
|
||||
GCPnts_TangentialDeflection.pxx
|
||||
GCPnts_TangentialDeflection.hxx
|
||||
GCPnts_TCurveTypes.hxx
|
||||
GCPnts_UniformAbscissa.cxx
|
||||
GCPnts_UniformAbscissa.pxx
|
||||
GCPnts_UniformAbscissa.hxx
|
||||
GCPnts_UniformDeflection.cxx
|
||||
GCPnts_UniformDeflection.pxx
|
||||
GCPnts_UniformDeflection.hxx
|
||||
GCPnts_DistFunction.hxx
|
||||
GCPnts_DistFunction.cxx
|
||||
|
@@ -14,593 +14,39 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
|
||||
#include <GCPnts_AbscissaType.hxx>
|
||||
#include <GCPnts_TCurveTypes.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
//! Dimension independent used to implement GCPnts_AbscissaPoint
|
||||
//! compute the type and the length ratio if GCPnts_LengthParametrized.
|
||||
template<class TheCurve>
|
||||
static GCPnts_AbscissaType computeType (const TheCurve& theC,
|
||||
Standard_Real& theRatio)
|
||||
{
|
||||
if (theC.NbIntervals (GeomAbs_CN) > 1)
|
||||
{
|
||||
return GCPnts_AbsComposite;
|
||||
}
|
||||
|
||||
switch (theC.GetType())
|
||||
{
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
theRatio = 1.0;
|
||||
return GCPnts_LengthParametrized;
|
||||
}
|
||||
case GeomAbs_Circle:
|
||||
{
|
||||
theRatio = theC.Circle().Radius();
|
||||
return GCPnts_LengthParametrized;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BezierCurve) aBz = theC.Bezier();
|
||||
if (aBz->NbPoles() == 2
|
||||
&& !aBz->IsRational())
|
||||
{
|
||||
theRatio = aBz->DN (0, 1).Magnitude();
|
||||
return GCPnts_LengthParametrized;
|
||||
}
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BSplineCurve) aBs = theC.BSpline();
|
||||
if (aBs->NbPoles() == 2
|
||||
&& !aBs->IsRational())
|
||||
{
|
||||
theRatio = aBs->DN (aBs->FirstParameter(), 1).Magnitude();
|
||||
return GCPnts_LengthParametrized;
|
||||
}
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Compute a point at distance theAbscis from parameter theU0 using theUi as initial guess
|
||||
template<class TheCurve>
|
||||
static void Compute (CPnts_AbscissaPoint& theComputer,
|
||||
const TheCurve& theC,
|
||||
Standard_Real& theAbscis,
|
||||
Standard_Real& theU0,
|
||||
Standard_Real& theUi,
|
||||
const Standard_Real theEPSILON)
|
||||
{
|
||||
// test for easy solution
|
||||
if (Abs (theAbscis) <= Precision::Confusion())
|
||||
{
|
||||
theComputer.SetParameter (theU0);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aRatio = 1.0;
|
||||
const GCPnts_AbscissaType aType = computeType (theC, aRatio);
|
||||
switch (aType)
|
||||
{
|
||||
case GCPnts_LengthParametrized:
|
||||
{
|
||||
theComputer.SetParameter (theU0 + theAbscis / aRatio);
|
||||
return;
|
||||
}
|
||||
case GCPnts_Parametrized:
|
||||
{
|
||||
theComputer.Init (theC);
|
||||
theComputer.Perform (theAbscis, theU0, theUi, theEPSILON);
|
||||
return;
|
||||
}
|
||||
case GCPnts_AbsComposite:
|
||||
{
|
||||
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_CN);
|
||||
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
|
||||
theC.Intervals (aTI, GeomAbs_CN);
|
||||
Standard_Real aL = 0.0, aSign = 1.0;
|
||||
Standard_Integer anIndex = 1;
|
||||
BSplCLib::Hunt (aTI, theU0, anIndex);
|
||||
Standard_Integer aDirection = 1;
|
||||
if (theAbscis < 0)
|
||||
{
|
||||
aDirection = 0;
|
||||
theAbscis = -theAbscis;
|
||||
aSign = -1.0;
|
||||
}
|
||||
|
||||
while (anIndex >= 1
|
||||
&& anIndex <= aNbIntervals)
|
||||
{
|
||||
aL = CPnts_AbscissaPoint::Length (theC, theU0, aTI (anIndex + aDirection));
|
||||
if (Abs (aL - theAbscis) <= Precision::Confusion())
|
||||
{
|
||||
theComputer.SetParameter (aTI (anIndex + aDirection));
|
||||
return;
|
||||
}
|
||||
|
||||
if (aL > theAbscis)
|
||||
{
|
||||
if (theUi < aTI (anIndex)
|
||||
|| theUi > aTI (anIndex + 1))
|
||||
{
|
||||
theUi = (theAbscis / aL) * (aTI (anIndex + 1) - theU0);
|
||||
if (aDirection)
|
||||
{
|
||||
theUi = theU0 + theUi;
|
||||
}
|
||||
else
|
||||
{
|
||||
theUi = theU0 - theUi;
|
||||
}
|
||||
}
|
||||
theComputer.Init (theC, aTI (anIndex), aTI (anIndex + 1));
|
||||
theComputer.Perform (aSign * theAbscis, theU0, theUi, theEPSILON);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
theU0 = aTI (anIndex + aDirection);
|
||||
theAbscis -= aL;
|
||||
}
|
||||
if (aDirection)
|
||||
{
|
||||
++anIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
--anIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Push a little bit outside the limits (hairy !!!)
|
||||
theUi = theU0 + 0.1;
|
||||
theComputer.Init (theC, theU0, theU0 + 0.2);
|
||||
theComputer.Perform (aSign * theAbscis, theU0, theUi, theEPSILON);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//! Introduced by rbv for curvilinear parametrization
|
||||
//! performs more appropriate tolerance management.
|
||||
template<class TheCurve>
|
||||
static void AdvCompute (CPnts_AbscissaPoint& theComputer,
|
||||
const TheCurve& theC,
|
||||
Standard_Real& theAbscis,
|
||||
Standard_Real& theU0,
|
||||
Standard_Real& theUi,
|
||||
const Standard_Real theEPSILON)
|
||||
{
|
||||
Standard_Real aRatio = 1.0;
|
||||
const GCPnts_AbscissaType aType = computeType (theC, aRatio);
|
||||
switch (aType)
|
||||
{
|
||||
case GCPnts_LengthParametrized:
|
||||
{
|
||||
theComputer.SetParameter (theU0 + theAbscis / aRatio);
|
||||
return;
|
||||
}
|
||||
case GCPnts_Parametrized:
|
||||
{
|
||||
// theComputer.Init (theC);
|
||||
theComputer.Init (theC, theEPSILON); //rbv's modification
|
||||
theComputer.AdvPerform (theAbscis, theU0, theUi, theEPSILON);
|
||||
return;
|
||||
}
|
||||
case GCPnts_AbsComposite:
|
||||
{
|
||||
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_CN);
|
||||
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
|
||||
theC.Intervals (aTI, GeomAbs_CN);
|
||||
Standard_Real aL = 0.0, aSign = 1.0;
|
||||
Standard_Integer anIndex = 1;
|
||||
BSplCLib::Hunt (aTI, theU0, anIndex);
|
||||
|
||||
Standard_Integer aDirection = 1;
|
||||
if (theAbscis < 0)
|
||||
{
|
||||
aDirection = 0;
|
||||
theAbscis = -theAbscis;
|
||||
aSign = -1.0;
|
||||
}
|
||||
|
||||
if (anIndex == 0 && aDirection > 0)
|
||||
{
|
||||
aL = CPnts_AbscissaPoint::Length (theC, theU0, aTI (anIndex + aDirection), theEPSILON);
|
||||
if (Abs (aL - theAbscis) <= /*Precision::Confusion()*/theEPSILON)
|
||||
{
|
||||
theComputer.SetParameter (aTI (anIndex + aDirection));
|
||||
return;
|
||||
}
|
||||
|
||||
if (aL > theAbscis)
|
||||
{
|
||||
if (theUi > aTI (anIndex + 1))
|
||||
{
|
||||
theUi = (theAbscis / aL) * (aTI (anIndex + 1) - theU0);
|
||||
theUi = theU0 + theUi;
|
||||
}
|
||||
theComputer.Init (theC, theU0, aTI (anIndex + 1), theEPSILON);
|
||||
theComputer.AdvPerform (aSign * theAbscis, theU0, theUi, theEPSILON);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
theU0 = aTI (anIndex + aDirection);
|
||||
theAbscis -= aL;
|
||||
}
|
||||
++anIndex;
|
||||
}
|
||||
|
||||
while (anIndex >= 1
|
||||
&& anIndex <= aNbIntervals)
|
||||
{
|
||||
aL = CPnts_AbscissaPoint::Length (theC, theU0, aTI (anIndex + aDirection), theEPSILON);
|
||||
if (Abs (aL - theAbscis) <= Precision::PConfusion())
|
||||
{
|
||||
theComputer.SetParameter (aTI (anIndex + aDirection));
|
||||
return;
|
||||
}
|
||||
|
||||
if (aL > theAbscis)
|
||||
{
|
||||
if (theUi < aTI (anIndex)
|
||||
|| theUi > aTI (anIndex + 1))
|
||||
{
|
||||
theUi = (theAbscis / aL) * (aTI (anIndex + 1) - theU0);
|
||||
if (aDirection)
|
||||
{
|
||||
theUi = theU0 + theUi;
|
||||
}
|
||||
else
|
||||
{
|
||||
theUi = theU0 - theUi;
|
||||
}
|
||||
}
|
||||
theComputer.Init (theC, aTI (anIndex), aTI (anIndex + 1), theEPSILON);
|
||||
theComputer.AdvPerform (aSign * theAbscis, theU0, theUi, theEPSILON);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
theU0 = aTI (anIndex + aDirection);
|
||||
theAbscis -= aL;
|
||||
}
|
||||
if (aDirection)
|
||||
{
|
||||
++anIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
--anIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Push a little bit outside the limits (hairy !!!)
|
||||
const Standard_Boolean isNonPeriodic = !theC.IsPeriodic();
|
||||
theUi = theU0 + aSign * 0.1;
|
||||
Standard_Real aU1 = theU0 + aSign * 0.2;
|
||||
if (isNonPeriodic)
|
||||
{
|
||||
if (aSign > 0)
|
||||
{
|
||||
theUi = Min (theUi, theC.LastParameter());
|
||||
aU1 = Min (aU1, theC.LastParameter());
|
||||
}
|
||||
else
|
||||
{
|
||||
theUi = Max (theUi, theC.FirstParameter());
|
||||
aU1 = Max (aU1, theC.FirstParameter());
|
||||
}
|
||||
}
|
||||
|
||||
theComputer.Init (theC, theU0, aU1, theEPSILON);
|
||||
theComputer.AdvPerform (aSign * theAbscis, theU0, theUi, theEPSILON);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC)
|
||||
{
|
||||
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter());
|
||||
}
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC)
|
||||
{
|
||||
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter());
|
||||
}
|
||||
#define TheCurve Adaptor3d_Curve
|
||||
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter(), theTol);
|
||||
}
|
||||
#include "GCPnts_AbscissaPoint.pxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
return GCPnts_AbscissaPoint::Length (theC, theC.FirstParameter(), theC.LastParameter(), theTol);
|
||||
}
|
||||
#undef TheCurve
|
||||
#undef Handle_TheBezierCurve
|
||||
#undef Handle_TheBSplineCurve
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2)
|
||||
{
|
||||
return length (theC, theU1, theU2, NULL);
|
||||
}
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2)
|
||||
{
|
||||
return length (theC, theU1, theU2, NULL);
|
||||
}
|
||||
#define TheCurve Adaptor2d_Curve2d
|
||||
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
return length (theC, theU1, theU2, &theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GCPnts_AbscissaPoint::Length (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
return length (theC, theU1, theU2, &theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
Standard_Real GCPnts_AbscissaPoint::length (const TheCurve& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real* theTol)
|
||||
{
|
||||
Standard_Real aRatio = 1.0;
|
||||
const GCPnts_AbscissaType aType = computeType (theC, aRatio);
|
||||
switch (aType)
|
||||
{
|
||||
case GCPnts_LengthParametrized:
|
||||
{
|
||||
return Abs (theU2 - theU1) * aRatio;
|
||||
}
|
||||
case GCPnts_Parametrized:
|
||||
{
|
||||
return theTol != NULL
|
||||
? CPnts_AbscissaPoint::Length (theC, theU1, theU2, *theTol)
|
||||
: CPnts_AbscissaPoint::Length (theC, theU1, theU2);
|
||||
}
|
||||
case GCPnts_AbsComposite:
|
||||
{
|
||||
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_CN);
|
||||
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
|
||||
theC.Intervals (aTI, GeomAbs_CN);
|
||||
const Standard_Real aUU1 = Min (theU1, theU2);
|
||||
const Standard_Real aUU2 = Max (theU1, theU2);
|
||||
Standard_Real aL = 0.0;
|
||||
for (Standard_Integer anIndex = 1; anIndex <= aNbIntervals; ++anIndex)
|
||||
{
|
||||
if (aTI (anIndex) > aUU2) { break; }
|
||||
if (aTI (anIndex + 1) < aUU1) { continue; }
|
||||
if (theTol != NULL)
|
||||
{
|
||||
aL += CPnts_AbscissaPoint::Length (theC,
|
||||
Max (aTI (anIndex), aUU1),
|
||||
Min (aTI (anIndex + 1), aUU2),
|
||||
*theTol);
|
||||
}
|
||||
else
|
||||
{
|
||||
aL += CPnts_AbscissaPoint::Length (theC,
|
||||
Max (aTI (anIndex), aUU1),
|
||||
Min (aTI (anIndex + 1), aUU2));
|
||||
}
|
||||
}
|
||||
return aL;
|
||||
}
|
||||
}
|
||||
return RealLast();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
void GCPnts_AbscissaPoint::compute (const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0)
|
||||
{
|
||||
const Standard_Real aL = GCPnts_AbscissaPoint::Length (theC);
|
||||
if (aL < Precision::Confusion())
|
||||
{
|
||||
throw Standard_ConstructionError();
|
||||
}
|
||||
|
||||
Standard_Real anAbscis = theAbscissa;
|
||||
Standard_Real aUU0 = theU0;
|
||||
Standard_Real aUUi = theU0 + (anAbscis / aL) * (theC.LastParameter() - theC.FirstParameter());
|
||||
Compute (myComputer, theC, anAbscis, aUU0, aUUi,
|
||||
theC.Resolution (Precision::Confusion()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0)
|
||||
{
|
||||
compute (theC, theAbscissa, theU0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0)
|
||||
{
|
||||
compute (theC, theAbscissa, theU0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : advCompute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
void GCPnts_AbscissaPoint::advCompute (const Standard_Real theTol,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0)
|
||||
{
|
||||
const Standard_Real aL = GCPnts_AbscissaPoint::Length (theC, theTol);
|
||||
/*if (aL < Precision::Confusion())
|
||||
{
|
||||
throw Standard_ConstructionError ("GCPnts_AbscissaPoint::GCPnts_AbscissaPoint");
|
||||
}*/
|
||||
Standard_Real anAbscis = theAbscissa;
|
||||
Standard_Real aUU0 = theU0;
|
||||
Standard_Real aUUi = 0.0;
|
||||
if (aL >= Precision::Confusion())
|
||||
{
|
||||
aUUi= theU0 + (anAbscis / aL) * (theC.LastParameter() - theC.FirstParameter());
|
||||
}
|
||||
else
|
||||
{
|
||||
aUUi = theU0;
|
||||
}
|
||||
AdvCompute (myComputer, theC, anAbscis, aUU0, aUUi, theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Standard_Real theTol,
|
||||
const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0)
|
||||
{
|
||||
advCompute (theTol, theC, theAbscissa, theU0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Standard_Real theTol,
|
||||
const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0)
|
||||
{
|
||||
advCompute (theTol, theC, theAbscissa, theU0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi)
|
||||
{
|
||||
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
|
||||
Compute (myComputer, theC, anAbscis, aUU0, aUUi, theC.Resolution (Precision::Confusion()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi)
|
||||
{
|
||||
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
|
||||
Compute (myComputer, theC, anAbscis, aUU0, aUUi, theC.Resolution (Precision::Confusion()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
|
||||
AdvCompute (myComputer, theC, anAbscis, aUU0, aUUi, theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Standard_Real anAbscis = theAbscissa, aUU0 = theU0, aUUi = theUi;
|
||||
AdvCompute (myComputer, theC, anAbscis, aUU0, aUUi, theTol);
|
||||
}
|
||||
#include "GCPnts_AbscissaPoint.pxx"
|
||||
|
@@ -19,122 +19,104 @@
|
||||
|
||||
#include <CPnts_AbscissaPoint.hxx>
|
||||
|
||||
class StdFail_NotDone;
|
||||
class Standard_ConstructionError;
|
||||
class Adaptor3d_Curve;
|
||||
class Adaptor2d_Curve2d;
|
||||
|
||||
//! Provides an algorithm to compute a point on a curve
|
||||
//! situated at a given distance from another point on the curve,
|
||||
//! the distance being measured along the curve (curvilinear abscissa on the curve).
|
||||
//! situated at a given distance from another point on the
|
||||
//! curve, the distance being measured along the curve
|
||||
//! (curvilinear abscissa on the curve).
|
||||
//! This algorithm is also used to compute the length of a curve.
|
||||
//! An AbscissaPoint object provides a framework for:
|
||||
//! - defining the point to compute
|
||||
//! - implementing the construction algorithm
|
||||
//! - consulting the result.
|
||||
class GCPnts_AbscissaPoint
|
||||
class GCPnts_AbscissaPoint
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Computes the length of the 3D Curve.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC);
|
||||
|
||||
//! Computes the length of the 2D Curve.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC);
|
||||
//! Computes the length of the Curve <C>.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C);
|
||||
|
||||
//! Computes the length of the 3D Curve with the given tolerance.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theTol);
|
||||
//! Computes the length of the Curve <C>.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C);
|
||||
|
||||
//! Computes the length of the 2D Curve with the given tolerance.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theTol);
|
||||
//! Computes the length of the Curve <C> with the given tolerance.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real Tol);
|
||||
|
||||
//! Computes the length of the 3D Curve.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2);
|
||||
//! Computes the length of the Curve <C> with the given tolerance.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real Tol);
|
||||
|
||||
//! Computes the length of the 2D Curve.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2);
|
||||
//! Computes the length of the Curve <C>.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2);
|
||||
|
||||
//! Computes the length of the Curve <C>.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2);
|
||||
|
||||
//! Computes the length of the Curve <C> with the given tolerance.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
|
||||
|
||||
//! Computes the length of the Curve <C> with the given tolerance.
|
||||
//! Constructs an empty algorithm. This function is used
|
||||
//! only for initializing a framework to compute the length
|
||||
//! of a curve (or a series of curves).
|
||||
//! Warning
|
||||
//! The function IsDone will return the value false after the use of this function.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
|
||||
|
||||
//! Computes the length of the 3D Curve with the given tolerance.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol);
|
||||
|
||||
//! Computes the length of the Curve with the given tolerance.
|
||||
Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol);
|
||||
|
||||
public:
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint();
|
||||
|
||||
//! The algorithm computes a point on a curve at the
|
||||
//! distance theAbscissa from the point of parameter theU0.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0);
|
||||
|
||||
//! The algorithm computes a point on a curve at
|
||||
//! the distance theAbscissa from the point of parameter
|
||||
//! theU0 with the given tolerance.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Standard_Real theTol,
|
||||
const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0);
|
||||
|
||||
//! The algorithm computes a point on a curve at
|
||||
//! the distance theAbscissa from the point of parameter
|
||||
//! theU0 with the given tolerance.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Standard_Real theTol,
|
||||
const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0);
|
||||
|
||||
//! The algorithm computes a point on a curve at the
|
||||
//! distance theAbscissa from the point of parameter theU0.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0);
|
||||
|
||||
//! The algorithm computes a point on a curve at the
|
||||
//! distance theAbscissa from the point of parameter theU0.
|
||||
//! theUi is the starting value used in the iterative process
|
||||
//! which find the solution, it must be close to the final solution.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi);
|
||||
|
||||
//! The algorithm computes a point on a curve at the
|
||||
//! distance theAbscissa from the point of parameter theU0.
|
||||
//! theUi is the starting value used in the iterative process
|
||||
//! which find the solution, it must be closed to the final solution
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi);
|
||||
|
||||
//! The algorithm computes a point on a curve at the
|
||||
//! distance theAbscissa from the point of parameter theU0.
|
||||
//! theUi is the starting value used in the iterative process
|
||||
//! which find the solution, it must be close to the final solution
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi,
|
||||
const Standard_Real theTol);
|
||||
|
||||
//! The algorithm computes a point on a curve at the
|
||||
//! distance theAbscissa from the point of parameter theU0.
|
||||
//! theUi is the starting value used in the iterative process
|
||||
//! which find the solution, it must be close to the final solution
|
||||
Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0, const Standard_Real theUi,
|
||||
const Standard_Real theTol);
|
||||
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at the
|
||||
//! distance <Abscissa> from the point of parameter <U0>.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0);
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at
|
||||
//! the distance <Abscissa> from the point of parameter
|
||||
//! <U0> with the given tolerance.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0);
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at
|
||||
//! the distance <Abscissa> from the point of parameter
|
||||
//! <U0> with the given tolerance.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0);
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at the
|
||||
//! distance <Abscissa> from the point of parameter <U0>.
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0);
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at the
|
||||
//! distance <Abscissa> from the point of parameter <U0>.
|
||||
//! <Ui> is the starting value used in the iterative process
|
||||
//! which find the solution, it must be close to the final
|
||||
//! solution
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui);
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at the
|
||||
//! distance <Abscissa> from the point of parameter <U0>.
|
||||
//! <Ui> is the starting value used in the iterative process
|
||||
//! which find the solution, it must be closed to the final
|
||||
//! solution
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui);
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at the
|
||||
//! distance <Abscissa> from the point of parameter <U0>.
|
||||
//! <Ui> is the starting value used in the iterative process
|
||||
//! which find the solution, it must be close to the final
|
||||
//! solution
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Tol);
|
||||
|
||||
//! the algorithm computes a point on a curve <Curve> at the
|
||||
//! distance <Abscissa> from the point of parameter <U0>.
|
||||
//! <Ui> is the starting value used in the iterative process
|
||||
//! which find the solution, it must be close to the final
|
||||
//! solution
|
||||
Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Tol);
|
||||
|
||||
//! True if the computation was successful, False otherwise.
|
||||
//! IsDone is a protection against:
|
||||
//! - non-convergence of the algorithm
|
||||
@@ -154,27 +136,6 @@ public:
|
||||
return myComputer.Parameter ();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Computes the length of the Curve with the optional tolerance.
|
||||
template<class TheCurve>
|
||||
static Standard_Real length (const TheCurve& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real* theTol);
|
||||
|
||||
//! Performs algorithm from the point of parameter.
|
||||
template<class TheCurve>
|
||||
void compute (const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0);
|
||||
|
||||
//! Performs algorithm from the point of parameter with the given tolerance.
|
||||
template<class TheCurve>
|
||||
void advCompute (const Standard_Real theTol,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU0);
|
||||
|
||||
private:
|
||||
CPnts_AbscissaPoint myComputer;
|
||||
};
|
||||
|
474
src/GCPnts/GCPnts_AbscissaPoint.pxx
Normal file
474
src/GCPnts/GCPnts_AbscissaPoint.pxx
Normal file
@@ -0,0 +1,474 @@
|
||||
// Created on: 1995-05-05
|
||||
// Created by: Modelistation
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 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.
|
||||
|
||||
// Dimension independent used to implement GCPnts_AbscissaPoint
|
||||
|
||||
// compute the type
|
||||
// and the length ratio if GCPnts_LengthParametrized
|
||||
#include <GCPnts_AbscissaType.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
|
||||
static GCPnts_AbscissaType computeType( const TheCurve& C,
|
||||
Standard_Real& Ratio)
|
||||
{
|
||||
GCPnts_AbscissaType LocalType ;
|
||||
|
||||
if (C.NbIntervals(GeomAbs_CN) > 1)
|
||||
return GCPnts_AbsComposite;
|
||||
|
||||
switch (C.GetType()) {
|
||||
|
||||
case GeomAbs_Line:
|
||||
Ratio = 1.0e0 ;
|
||||
return GCPnts_LengthParametrized;
|
||||
|
||||
case GeomAbs_Circle:
|
||||
Ratio = C.Circle().Radius();
|
||||
return GCPnts_LengthParametrized;
|
||||
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle_TheBezierCurve Bz = C.Bezier();
|
||||
if ((Bz->NbPoles() == 2) && !(Bz->IsRational())) {
|
||||
Ratio = Bz->DN(0,1).Magnitude();
|
||||
LocalType = GCPnts_LengthParametrized;
|
||||
}
|
||||
else
|
||||
LocalType = GCPnts_Parametrized;
|
||||
return LocalType ;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle_TheBSplineCurve Bs = C.BSpline();
|
||||
if ((Bs->NbPoles() == 2) && !(Bs->IsRational())) {
|
||||
Ratio = Bs->DN(Bs->FirstParameter(),1).Magnitude();
|
||||
LocalType = GCPnts_LengthParametrized;
|
||||
}
|
||||
else
|
||||
LocalType = GCPnts_Parametrized;
|
||||
return LocalType ;
|
||||
}
|
||||
default:
|
||||
return GCPnts_Parametrized;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// compute a point at distance Abscis from parameter U0
|
||||
// using Ui as initial guess
|
||||
|
||||
static void Compute(CPnts_AbscissaPoint& theComputer,
|
||||
const TheCurve& C,
|
||||
Standard_Real& Abscis,
|
||||
Standard_Real& U0,
|
||||
Standard_Real& Ui,
|
||||
const Standard_Real EPSILON)
|
||||
{
|
||||
// test for easy solution
|
||||
if (Abs(Abscis) <= Precision::Confusion()) {
|
||||
theComputer.SetParameter(U0);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real Ratio = 1.;
|
||||
GCPnts_AbscissaType Type = computeType(C,Ratio);
|
||||
|
||||
switch (Type) {
|
||||
case GCPnts_LengthParametrized :
|
||||
theComputer.SetParameter(U0 + Abscis / Ratio);
|
||||
return;
|
||||
|
||||
case GCPnts_Parametrized :
|
||||
theComputer.Init(C);
|
||||
theComputer.Perform(Abscis, U0, Ui, EPSILON);
|
||||
return;
|
||||
|
||||
case GCPnts_AbsComposite :
|
||||
{
|
||||
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
|
||||
TColStd_Array1OfReal TI(1,NbIntervals+1);
|
||||
C.Intervals(TI,GeomAbs_CN);
|
||||
Standard_Real L = 0.0, sign = 1.;
|
||||
Standard_Integer Index = 1;
|
||||
BSplCLib::Hunt(TI,U0,Index);
|
||||
Standard_Integer Direction = 1;
|
||||
if (Abscis < 0) {
|
||||
Direction = 0;
|
||||
Abscis = -Abscis;
|
||||
sign = -1.;
|
||||
}
|
||||
|
||||
while ((Index >= 1) && (Index <= NbIntervals)) {
|
||||
|
||||
L = CPnts_AbscissaPoint::Length(C, U0, TI(Index+Direction));
|
||||
if (Abs(L - Abscis) <= Precision::Confusion()) {
|
||||
theComputer.SetParameter(TI(Index+Direction));
|
||||
return;
|
||||
}
|
||||
if(L > Abscis) {
|
||||
if ((Ui < TI(Index)) || (Ui > TI(Index+1))) {
|
||||
Ui = (Abscis / L) * (TI(Index+1) - U0);
|
||||
if (Direction)
|
||||
Ui = U0 + Ui;
|
||||
else
|
||||
Ui = U0 - Ui;
|
||||
}
|
||||
theComputer.Init(C,TI(Index),TI(Index+1));
|
||||
theComputer.Perform(sign*Abscis, U0, Ui, EPSILON);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
U0 = TI(Index+Direction);
|
||||
Abscis -= L;
|
||||
}
|
||||
if (Direction)
|
||||
Index++;
|
||||
else
|
||||
Index--;
|
||||
}
|
||||
|
||||
// Push a little bit outside the limits (hairy !!!)
|
||||
Ui = U0 + 0.1;
|
||||
theComputer.Init(C,U0,U0+0.2);
|
||||
theComputer.Perform(sign*Abscis, U0, Ui, EPSILON);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// introduced by rbv for curvilinear parametrization
|
||||
// performs more appropriate tolerance management
|
||||
|
||||
static void AdvCompute(CPnts_AbscissaPoint& theComputer,
|
||||
const TheCurve& C,
|
||||
Standard_Real& Abscis,
|
||||
Standard_Real& U0,
|
||||
Standard_Real& Ui,
|
||||
const Standard_Real EPSILON)
|
||||
{
|
||||
Standard_Real Ratio = 1.0;
|
||||
GCPnts_AbscissaType Type = computeType(C,Ratio);
|
||||
|
||||
switch (Type) {
|
||||
case GCPnts_LengthParametrized :
|
||||
theComputer.SetParameter(U0 + Abscis / Ratio);
|
||||
return;
|
||||
|
||||
case GCPnts_Parametrized :
|
||||
// theComputer.Init(C);
|
||||
theComputer.Init(C, EPSILON); //rbv's modification
|
||||
//
|
||||
theComputer.AdvPerform(Abscis, U0, Ui, EPSILON);
|
||||
return;
|
||||
|
||||
case GCPnts_AbsComposite :
|
||||
{
|
||||
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
|
||||
TColStd_Array1OfReal TI(1,NbIntervals+1);
|
||||
C.Intervals(TI,GeomAbs_CN);
|
||||
Standard_Real L = 0.0, sign = 1.;
|
||||
Standard_Integer Index = 1;
|
||||
BSplCLib::Hunt(TI,U0,Index);
|
||||
|
||||
Standard_Integer Direction = 1;
|
||||
if (Abscis < 0) {
|
||||
Direction = 0;
|
||||
Abscis = -Abscis;
|
||||
sign = -1.;
|
||||
}
|
||||
|
||||
if(Index == 0 && Direction > 0) {
|
||||
L = CPnts_AbscissaPoint::Length(C, U0, TI(Index+Direction), EPSILON);
|
||||
if (Abs(L - Abscis) <= /*Precision::Confusion()*/EPSILON) {
|
||||
theComputer.SetParameter(TI(Index+Direction));
|
||||
return;
|
||||
}
|
||||
if(L > Abscis) {
|
||||
if ( Ui > TI(Index+1) ) {
|
||||
Ui = (Abscis / L) * (TI(Index+1) - U0);
|
||||
Ui = U0 + Ui;
|
||||
}
|
||||
theComputer.Init(C,U0,TI(Index+1), EPSILON);
|
||||
theComputer.AdvPerform(sign*Abscis, U0, Ui, EPSILON);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
U0 = TI(Index+Direction);
|
||||
Abscis -= L;
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
|
||||
|
||||
while ((Index >= 1) && (Index <= NbIntervals)) {
|
||||
|
||||
L = CPnts_AbscissaPoint::Length(C, U0, TI(Index+Direction), EPSILON);
|
||||
if (Abs(L - Abscis) <= Precision::PConfusion()) {
|
||||
theComputer.SetParameter(TI(Index+Direction));
|
||||
return;
|
||||
}
|
||||
if(L > Abscis) {
|
||||
if ((Ui < TI(Index)) || (Ui > TI(Index+1))) {
|
||||
Ui = (Abscis / L) * (TI(Index+1) - U0);
|
||||
if (Direction)
|
||||
Ui = U0 + Ui;
|
||||
else
|
||||
Ui = U0 - Ui;
|
||||
}
|
||||
theComputer.Init(C,TI(Index),TI(Index+1), EPSILON);
|
||||
theComputer.AdvPerform(sign*Abscis, U0, Ui, EPSILON);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
U0 = TI(Index+Direction);
|
||||
Abscis -= L;
|
||||
}
|
||||
if (Direction) {
|
||||
Index++;
|
||||
|
||||
}
|
||||
else {
|
||||
Index--;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Push a little bit outside the limits (hairy !!!)
|
||||
|
||||
Standard_Boolean nonperiodic = !C.IsPeriodic();
|
||||
Ui = U0 + sign*0.1;
|
||||
Standard_Real U1 = U0 + sign*.2;
|
||||
if(nonperiodic) {
|
||||
if(sign > 0) {
|
||||
Ui = Min(Ui,C.LastParameter());
|
||||
U1 = Min(U1, C.LastParameter());
|
||||
}
|
||||
else {
|
||||
Ui = Max(Ui,C.FirstParameter());
|
||||
U1 = Max(U1, C.FirstParameter());
|
||||
}
|
||||
}
|
||||
|
||||
theComputer.Init(C, U0, U1, EPSILON);
|
||||
theComputer.AdvPerform(sign*Abscis, U0, Ui, EPSILON);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C)
|
||||
{
|
||||
return GCPnts_AbscissaPoint::Length(C,C.FirstParameter(),
|
||||
C.LastParameter());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
return GCPnts_AbscissaPoint::Length(C,C.FirstParameter(),
|
||||
C.LastParameter(),Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2)
|
||||
{
|
||||
Standard_Real Ratio = 1.0;
|
||||
GCPnts_AbscissaType Type = computeType(C,Ratio);
|
||||
switch (Type) {
|
||||
|
||||
case GCPnts_LengthParametrized:
|
||||
return Abs(U2-U1) * Ratio;
|
||||
|
||||
case GCPnts_Parametrized:
|
||||
return CPnts_AbscissaPoint::Length(C, U1, U2);
|
||||
|
||||
case GCPnts_AbsComposite:
|
||||
{
|
||||
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
|
||||
TColStd_Array1OfReal TI(1,NbIntervals+1);
|
||||
C.Intervals(TI,GeomAbs_CN);
|
||||
Standard_Real UU1 = Min(U1, U2);
|
||||
Standard_Real UU2 = Max(U1, U2);
|
||||
Standard_Real L = 0.0;
|
||||
for(Standard_Integer Index = 1; Index <= NbIntervals; Index++) {
|
||||
if (TI(Index) > UU2) break;
|
||||
if (TI(Index+1) < UU1) continue;
|
||||
L += CPnts_AbscissaPoint::Length(C,
|
||||
Max(TI(Index),UU1),
|
||||
Min(TI(Index+1),UU2));
|
||||
}
|
||||
return L;
|
||||
}
|
||||
}
|
||||
return RealLast();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real GCPnts_AbscissaPoint::Length(const TheCurve& C,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Standard_Real Ratio = 1.0;
|
||||
GCPnts_AbscissaType Type = computeType(C,Ratio);
|
||||
switch (Type) {
|
||||
|
||||
case GCPnts_LengthParametrized:
|
||||
return Abs(U2-U1) * Ratio;
|
||||
|
||||
case GCPnts_Parametrized:
|
||||
return CPnts_AbscissaPoint::Length(C, U1, U2, Tol);
|
||||
|
||||
case GCPnts_AbsComposite:
|
||||
{
|
||||
Standard_Integer NbIntervals = C.NbIntervals(GeomAbs_CN);
|
||||
TColStd_Array1OfReal TI(1,NbIntervals+1);
|
||||
C.Intervals(TI,GeomAbs_CN);
|
||||
Standard_Real UU1 = Min(U1, U2);
|
||||
Standard_Real UU2 = Max(U1, U2);
|
||||
Standard_Real L = 0.0;
|
||||
for(Standard_Integer Index = 1; Index <= NbIntervals; Index++) {
|
||||
if (TI(Index) > UU2) break;
|
||||
if (TI(Index+1) < UU1) continue;
|
||||
L += CPnts_AbscissaPoint::Length(C,
|
||||
Max(TI(Index),UU1),
|
||||
Min(TI(Index+1),UU2),
|
||||
Tol);
|
||||
}
|
||||
return L;
|
||||
}
|
||||
}
|
||||
return RealLast();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
|
||||
(const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U0)
|
||||
{
|
||||
Standard_Real L = GCPnts_AbscissaPoint::Length(C);
|
||||
if (L < Precision::Confusion()) {
|
||||
throw Standard_ConstructionError();
|
||||
}
|
||||
Standard_Real Abscis = Abscissa;
|
||||
Standard_Real UU0 = U0;
|
||||
Standard_Real UUi = U0 +
|
||||
(Abscis / L) * (C.LastParameter() - C.FirstParameter());
|
||||
Compute(myComputer, C, Abscis, UU0, UUi,
|
||||
C.Resolution(Precision::Confusion()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose : rbv for curvilinear parametrization
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
|
||||
(const Standard_Real Tol,
|
||||
const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U0)
|
||||
{
|
||||
Standard_Real L = GCPnts_AbscissaPoint::Length(C, Tol);
|
||||
/* if (L < Precision::Confusion()) {
|
||||
cout<<"FirstParameter = "<<C.FirstParameter()<<endl;
|
||||
cout<<"LastParameter = "<<C.LastParameter()<<endl;
|
||||
throw Standard_ConstructionError("GCPnts_AbscissaPoint::GCPnts_AbscissaPoint");
|
||||
}
|
||||
*/
|
||||
Standard_Real Abscis = Abscissa;
|
||||
Standard_Real UU0 = U0;
|
||||
Standard_Real UUi;
|
||||
if (L >= Precision::Confusion())
|
||||
UUi= U0 +
|
||||
(Abscis / L) * (C.LastParameter() - C.FirstParameter());
|
||||
else UUi = U0;
|
||||
|
||||
AdvCompute(myComputer, C, Abscis, UU0, UUi, Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
|
||||
(const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real Ui)
|
||||
{
|
||||
Standard_Real Abscis = Abscissa;
|
||||
Standard_Real UU0 = U0;
|
||||
Standard_Real UUi = Ui;
|
||||
Compute(myComputer, C, Abscis, UU0, UUi,
|
||||
C.Resolution(Precision::Confusion()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_AbscissaPoint
|
||||
//purpose : rbv for curvilinear parametrization
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_AbscissaPoint::GCPnts_AbscissaPoint
|
||||
(const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U0,
|
||||
const Standard_Real Ui,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Standard_Real Abscis = Abscissa;
|
||||
Standard_Real UU0 = U0;
|
||||
Standard_Real UUi = Ui;
|
||||
AdvCompute(myComputer, C, Abscis, UU0, UUi, Tol);
|
||||
}
|
@@ -23,7 +23,7 @@ class gp_Pnt;
|
||||
|
||||
//! Class to define function, which calculates square distance between point on curve
|
||||
//! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2)
|
||||
//! This function is used in any minimization algorithm to define maximal deviation between curve and line,
|
||||
//! This function is used in any minimisation algorithm to define maximal deviation between curve and line,
|
||||
//! which required one variable function without derivative (for ex. math_BrentMinimum)
|
||||
class GCPnts_DistFunction : public math_Function
|
||||
{
|
||||
|
@@ -12,200 +12,65 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GCPnts_QuasiUniformAbscissa.hxx>
|
||||
//#include <GCPnts_QuasiUniformAbscissa.ixx>
|
||||
|
||||
#include <GCPnts_TCurveTypes.hxx>
|
||||
#include <GCPnts_UniformAbscissa.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <GCPnts_QuasiUniformAbscissa.hxx>
|
||||
#include <GCPnts_UniformAbscissa.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
//#include <DrawTrSurf.hxx>
|
||||
|
||||
//static Standard_Integer compteur = 0;
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformAbscissa
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa()
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0)
|
||||
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa ()
|
||||
:myDone(Standard_False),
|
||||
myNbPoints(0)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0)
|
||||
{
|
||||
Initialize (theC, theNbPoints);
|
||||
}
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theU1, theU2);
|
||||
}
|
||||
#define TheCurve Adaptor3d_Curve
|
||||
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
|
||||
#define TheArray1OfPnt TColgp_Array1OfPnt
|
||||
#define ThePnt gp_Pnt
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0)
|
||||
{
|
||||
Initialize (theC, theNbPoints);
|
||||
}
|
||||
#include "GCPnts_QuasiUniformAbscissa.pxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theU1, theU2);
|
||||
}
|
||||
#undef TheCurve
|
||||
#undef Handle_TheBezierCurve
|
||||
#undef Handle_TheBSplineCurve
|
||||
#undef TheArray1OfPnt
|
||||
#undef ThePnt
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theC.FirstParameter(), theC.LastParameter());
|
||||
}
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theC.FirstParameter(), theC.LastParameter());
|
||||
}
|
||||
#define TheCurve Adaptor2d_Curve2d
|
||||
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
|
||||
#define TheArray1OfPnt TColgp_Array1OfPnt2d
|
||||
#define ThePnt gp_Pnt2d
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
{
|
||||
initialize (theC, theNbPoints, theU1, theU2);
|
||||
}
|
||||
#include "GCPnts_QuasiUniformAbscissa.pxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
{
|
||||
initialize (theC, theNbPoints, theU1, theU2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
void GCPnts_QuasiUniformAbscissa::initialize (const TheCurve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
{
|
||||
if (theC.GetType() != GeomAbs_BezierCurve
|
||||
&& theC.GetType() != GeomAbs_BSplineCurve)
|
||||
{
|
||||
GCPnts_UniformAbscissa aUA (theC, theNbPoints, theU1, theU2);
|
||||
myDone = aUA.IsDone();
|
||||
myNbPoints = aUA.NbPoints();
|
||||
myParams = new TColStd_HArray1OfReal (1, myNbPoints);
|
||||
for (Standard_Integer aPntIter = 1 ; aPntIter <= myNbPoints; ++aPntIter)
|
||||
{
|
||||
myParams->SetValue (aPntIter, aUA.Parameter (aPntIter));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_ConstructionError_Raise_if (theNbPoints <= 1, "GCPnts_QuasiUniformAbscissa::Initialize(), number of points should be >= 2");
|
||||
|
||||
// evaluate the approximative length of the 3dCurve
|
||||
myNbPoints = theNbPoints;
|
||||
Standard_Real aLength = 0.0;
|
||||
const Standard_Real dU = (theU2 - theU1) / (2 * theNbPoints - 1);
|
||||
|
||||
TColgp_Array1OfPnt2d aLP (1, 2 * theNbPoints); // table Length <-> Param
|
||||
typename GCPnts_TCurveTypes<TheCurve>::Point aP1, aP2;
|
||||
aP1 = theC.Value (theU1);
|
||||
|
||||
// On additionne toutes les distances
|
||||
for (Standard_Integer i = 0; i < 2 * theNbPoints; ++i)
|
||||
{
|
||||
aP2 = theC.Value (theU1 + i * dU);
|
||||
const Standard_Real aDist = aP1.Distance (aP2);
|
||||
aLength += aDist;
|
||||
aLP(i+1) = gp_Pnt2d (aLength, theU1 + (i * dU));
|
||||
aP1 = aP2;
|
||||
}
|
||||
|
||||
// On cherche a mettre NbPoints dans la curve.
|
||||
// on met les points environ a Length/NbPoints.
|
||||
if (IsEqual (aLength, 0.0))
|
||||
{ //use usual analytical grid
|
||||
Standard_Real aStep = (theU2 - theU1) / (theNbPoints - 1);
|
||||
myParams = new TColStd_HArray1OfReal (1, theNbPoints);
|
||||
myParams->SetValue (1, theU1);
|
||||
for (Standard_Integer i = 2; i < theNbPoints; ++i)
|
||||
{
|
||||
myParams->SetValue (i, theU1 + aStep * (i - 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const Standard_Real aDCorde = aLength / (theNbPoints - 1);
|
||||
Standard_Real aCorde = aDCorde;
|
||||
Standard_Integer anIndex = 1;
|
||||
myParams = new TColStd_HArray1OfReal (1, theNbPoints);
|
||||
myParams->SetValue (1, theU1);
|
||||
for (Standard_Integer i = 2; i < theNbPoints; ++i)
|
||||
{
|
||||
while (aLP (anIndex).X() < aCorde)
|
||||
{
|
||||
++anIndex;
|
||||
}
|
||||
Standard_Real anAlpha = (aCorde - aLP(anIndex - 1).X()) / (aLP (anIndex).X() - aLP (anIndex-1).X());
|
||||
Standard_Real aU = aLP (anIndex - 1).Y() + anAlpha * (aLP (anIndex).Y() - aLP (anIndex-1).Y());
|
||||
myParams->SetValue (i, aU);
|
||||
aCorde = i * aDCorde;
|
||||
}
|
||||
}
|
||||
|
||||
myParams->SetValue (theNbPoints, theU2);
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@@ -20,108 +20,89 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
class Standard_DomainError;
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
class StdFail_NotDone;
|
||||
class Adaptor3d_Curve;
|
||||
class Adaptor2d_Curve2d;
|
||||
|
||||
//! This class provides an algorithm to compute a uniform abscissa
|
||||
//! distribution of points on a curve, i.e. a sequence of equidistant points.
|
||||
//! The distance between two consecutive points is measured along the curve.
|
||||
//!
|
||||
//! The distribution is defined by a number of points.
|
||||
//! distribution of points on a curve, i.e. a sequence of
|
||||
//! equidistant points. The distance between two
|
||||
//! consecutive points is measured along the curve.
|
||||
//! The distribution is defined:
|
||||
//! - either by the curvilinear distance between two consecutive points
|
||||
//! - or by a number of points.
|
||||
class GCPnts_QuasiUniformAbscissa
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructs an empty algorithm.
|
||||
//! To define the problem to be solved, use the function Initialize.
|
||||
|
||||
//! Constructs an empty algorithm. To define the problem
|
||||
//! to be solved, use the function Initialize.
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa();
|
||||
|
||||
|
||||
//! Computes a uniform abscissa distribution of points
|
||||
//! - on the curve where Abscissa is the curvilinear distance between
|
||||
//! - on the curve C where Abscissa is the curvilinear distance between
|
||||
//! two consecutive points of the distribution.
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints);
|
||||
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor3d_Curve& C, const Standard_Integer NbPoints);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points
|
||||
//! on the part of curve limited by the two parameter values theU1 and theU2,
|
||||
//! on the part of curve C limited by the two parameter values U1 and U2,
|
||||
//! where Abscissa is the curvilinear distance between
|
||||
//! two consecutive points of the distribution.
|
||||
//! The first point of the distribution is either the origin of
|
||||
//! curve or the point of parameter theU1.
|
||||
//! The following points are computed such that the curvilinear
|
||||
//! curve C or the point of parameter U1. The following
|
||||
//! points are computed such that the curvilinear
|
||||
//! distance between two consecutive points is equal to Abscissa.
|
||||
//! The last point of the distribution is either the end
|
||||
//! point of curve or the point of parameter theU2.
|
||||
//! point of curve C or the point of parameter U2.
|
||||
//! However the curvilinear distance between this last
|
||||
//! point and the point just preceding it in the distribution is,
|
||||
//! of course, generally not equal to Abscissa.
|
||||
//! Use the function IsDone() to verify that the computation was successful,
|
||||
//! the function NbPoints() to obtain the number of points of the computed distribution,
|
||||
//! and the function Parameter() to read the parameter of each point.
|
||||
//!
|
||||
//! point and the point just preceding it in the distribution
|
||||
//! is, of course, generally not equal to Abscissa.
|
||||
//! Use the function IsDone to verify that the
|
||||
//! computation was successful, the function NbPoints
|
||||
//! to obtain the number of points of the computed
|
||||
//! distribution, and the function Parameter to read the
|
||||
//! parameter of each point.
|
||||
//! Warning
|
||||
//! The roles of theU1 and theU2 are inverted if theU1 > theU2.
|
||||
//! The roles of U1 and U2 are inverted if U1 > U2 .
|
||||
//! Warning
|
||||
//! theC is an adapted curve, that is, an object which is an interface between:
|
||||
//! C is an adapted curve, that is, an object which is an
|
||||
//! interface between:
|
||||
//! - the services provided by either a 2D curve from
|
||||
//! the package Geom2d (in the case of an Adaptor2d_Curve2d curve)
|
||||
//! or a 3D curve from the package Geom (in the case of an Adaptor3d_Curve curve),
|
||||
//! the package Geom2d (in the case of an
|
||||
//! Adaptor2d_Curve2d curve) or a 3D curve from
|
||||
//! the package Geom (in the case of an Adaptor3d_Curve curve),
|
||||
//! - and those required on the curve by the computation algorithm.
|
||||
//! @param theC [in] input 3D curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2);
|
||||
|
||||
//! Initialize the algorithms with 3D curve and target number of points.
|
||||
//! @param theC [in] input 3D curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints);
|
||||
|
||||
//! Initialize the algorithms with 3D curve, target number of points and curve parameter range.
|
||||
//! @param theC [in] input 3D curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on the 2D curve.
|
||||
//! @param theC [in] input 2D curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points on a part of the 2D curve.
|
||||
//! @param theC [in] input 2D curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2);
|
||||
|
||||
//! Initialize the algorithms with 2D curve and target number of points.
|
||||
//! @param theC [in] input 2D curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints);
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor3d_Curve& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2);
|
||||
|
||||
//! Initialize the algorithms with <C>, <NbPoints> and
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Integer NbPoints);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <U1>,
|
||||
//! <U2>.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on
|
||||
//! the Curve2d <C>.
|
||||
//! <NbPoints> defines the nomber of desired points.
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points
|
||||
//! on a part of the Curve2d <C>.
|
||||
Standard_EXPORT GCPnts_QuasiUniformAbscissa(const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2);
|
||||
|
||||
//! Initialize the algorithms with <C>, <NbPoints> and
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <U1>,
|
||||
//! <U2>.
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2);
|
||||
|
||||
//! Initialize the algorithms with 2D curve, target number of points and curve parameter range.
|
||||
//! @param theC [in] input 2D curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2);
|
||||
|
||||
//! Returns true if the computation was successful.
|
||||
//! IsDone is a protection against:
|
||||
//! - non-convergence of the algorithm
|
||||
@@ -165,15 +146,6 @@ public:
|
||||
return myParams->Value (Index);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! This function divides given curve on the several parts with equal length.
|
||||
//! It returns array of parameters in the control points.
|
||||
template<class TheCurve>
|
||||
void initialize (const TheCurve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2);
|
||||
|
||||
private:
|
||||
Standard_Boolean myDone;
|
||||
Standard_Integer myNbPoints;
|
||||
|
141
src/GCPnts/GCPnts_QuasiUniformAbscissa.pxx
Normal file
141
src/GCPnts/GCPnts_QuasiUniformAbscissa.pxx
Normal file
@@ -0,0 +1,141 @@
|
||||
// Created on: 1996-08-22
|
||||
// Created by: Stagiaire Mary FABIEN
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 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.
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa(const TheCurve& C,
|
||||
const Standard_Integer NbPoints)
|
||||
{
|
||||
Initialize(C, NbPoints);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_QuasiUniformAbscissa::GCPnts_QuasiUniformAbscissa(const TheCurve& C,
|
||||
const Standard_Integer NbPoints,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2)
|
||||
{
|
||||
Initialize(C, NbPoints, U1, U2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_QuasiUniformAbscissa::Initialize(const TheCurve& C,
|
||||
const Standard_Integer NbPoints)
|
||||
{
|
||||
Initialize(C, NbPoints, C.FirstParameter(),
|
||||
C.LastParameter());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose : This function divides given curve on the several parts with
|
||||
// equal length. It returns array of parameters in the
|
||||
// control points.
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformAbscissa::Initialize(const TheCurve& C,
|
||||
const Standard_Integer NbPoints,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2)
|
||||
{
|
||||
Standard_Integer i;
|
||||
if ((C.GetType() != GeomAbs_BezierCurve) && (C.GetType() != GeomAbs_BSplineCurve))
|
||||
{
|
||||
GCPnts_UniformAbscissa UA(C,NbPoints,U1,U2);
|
||||
myDone = UA.IsDone();
|
||||
myNbPoints = UA.NbPoints();
|
||||
myParams = new TColStd_HArray1OfReal(1,myNbPoints);
|
||||
for( i = 1 ; i <= myNbPoints ; i++ )
|
||||
myParams->SetValue(i,UA.Parameter(i));
|
||||
#ifdef OCCT_DEBUG
|
||||
|
||||
// char name [100];
|
||||
// for( i = 1 ; i <= NbPoints ; i++ ) {
|
||||
// sprintf(name,"%s_%d","pnt2d",i+(compteur++));
|
||||
// DrawTrSurf::Set(name,C->Value(UA.Parameter(i)));
|
||||
// }
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_ConstructionError_Raise_if (NbPoints <= 1,
|
||||
"GCPnts_QuasiUniformAbscissa::Initialize() - number of points should be >= 2");
|
||||
|
||||
// evaluate the approximative length of the 3dCurve
|
||||
myNbPoints = NbPoints;
|
||||
Standard_Real Length = 0.;
|
||||
Standard_Real Dist, dU = (U2 - U1) / ( 2*NbPoints - 1);
|
||||
|
||||
TColgp_Array1OfPnt2d LP(1,2*NbPoints); // tableau Longueur <-> Param
|
||||
ThePnt P1, P2;
|
||||
P1 = C.Value(U1);
|
||||
|
||||
// On additionne toutes les distances
|
||||
for ( i = 0; i < 2*NbPoints ; i++) {
|
||||
P2 = C.Value(U1 + i*dU);
|
||||
Dist = P1.Distance(P2);
|
||||
Length += Dist;
|
||||
LP(i+1) = gp_Pnt2d( Length, U1 + (i*dU));
|
||||
P1 = P2;
|
||||
}
|
||||
|
||||
// On cherche a mettre NbPoints dans la curve.
|
||||
// on met les points environ a Length/NbPoints.
|
||||
|
||||
if(IsEqual(Length, 0.0))
|
||||
{//use usual analytical grid
|
||||
Standard_Real aStep = (U2 - U1) / (NbPoints - 1);
|
||||
myParams = new TColStd_HArray1OfReal(1,NbPoints);
|
||||
myParams->SetValue(1,U1);
|
||||
for ( i = 2; i < NbPoints; i++)
|
||||
{
|
||||
myParams->SetValue(i, U1 + aStep*(i-1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real DCorde = Length / ( NbPoints - 1);
|
||||
Standard_Real Corde = DCorde;
|
||||
Standard_Integer Index = 1;
|
||||
Standard_Real U, Alpha;
|
||||
myParams = new TColStd_HArray1OfReal(1,NbPoints);
|
||||
myParams->SetValue(1,U1);
|
||||
for ( i = 2; i < NbPoints; i++)
|
||||
{
|
||||
while ( LP(Index).X() < Corde) Index ++;
|
||||
Alpha = (Corde - LP(Index-1).X()) / (LP(Index).X() - LP(Index-1).X());
|
||||
U = LP(Index-1).Y() + Alpha * ( LP(Index).Y() - LP(Index-1).Y());
|
||||
myParams->SetValue(i,U);
|
||||
Corde = i*DCorde;
|
||||
}
|
||||
}
|
||||
|
||||
myParams->SetValue(NbPoints,U2);
|
||||
myDone = Standard_True;
|
||||
}
|
||||
}
|
||||
|
@@ -12,590 +12,106 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GCPnts_QuasiUniformDeflection.hxx>
|
||||
|
||||
#include <GCPnts_DeflectionType.hxx>
|
||||
#include <GCPnts_TCurveTypes.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <GCPnts_QuasiUniformDeflection.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
static const Standard_Integer MyMaxQuasiFleshe = 2000;
|
||||
|
||||
// mask the return of a Adaptor2d_Curve2d as a gp_Pnt
|
||||
static gp_Pnt Value (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theParameter)
|
||||
static gp_Pnt Value(const Adaptor3d_Curve & C,
|
||||
const Standard_Real Parameter)
|
||||
{
|
||||
return theC.Value (theParameter);
|
||||
return C.Value(Parameter) ;
|
||||
}
|
||||
static gp_Pnt Value(const Adaptor2d_Curve2d & C,
|
||||
const Standard_Real Parameter)
|
||||
{
|
||||
gp_Pnt aPoint ;
|
||||
gp_Pnt2d a2dPoint(C.Value(Parameter));
|
||||
aPoint.SetCoord(a2dPoint.X(),a2dPoint.Y(),0.);
|
||||
return aPoint ;
|
||||
}
|
||||
|
||||
static gp_Pnt Value (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theParameter)
|
||||
static void D1(const Adaptor3d_Curve & C,
|
||||
const Standard_Real Parameter,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V)
|
||||
{
|
||||
gp_Pnt aPoint;
|
||||
gp_Pnt2d a2dPoint (theC.Value (theParameter));
|
||||
aPoint.SetCoord (a2dPoint.X(), a2dPoint.Y(), 0.0);
|
||||
return aPoint;
|
||||
C.D1(Parameter,P,V);
|
||||
}
|
||||
|
||||
static void D1 (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theParameter,
|
||||
gp_Pnt& theP,
|
||||
gp_Vec& theV)
|
||||
{
|
||||
theC.D1 (theParameter, theP, theV);
|
||||
}
|
||||
|
||||
static void D1 (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theParameter,
|
||||
gp_Pnt& theP,
|
||||
gp_Vec& theV)
|
||||
static void D1(const Adaptor2d_Curve2d & C,
|
||||
const Standard_Real Parameter,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V)
|
||||
{
|
||||
gp_Pnt2d a2dPoint;
|
||||
gp_Vec2d a2dVec;
|
||||
theC.D1 (theParameter, a2dPoint, a2dVec);
|
||||
theP.SetCoord (a2dPoint.X(), a2dPoint.Y(), 0.0);
|
||||
theV.SetCoord (a2dVec.X(), a2dVec.Y(), 0.0);
|
||||
C.D1(Parameter,a2dPoint,a2dVec);
|
||||
P.SetCoord(a2dPoint.X(),a2dPoint.Y(),0.);
|
||||
V.SetCoord(a2dVec.X(),a2dVec.Y(),0.);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : QuasiFleche
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static void QuasiFleche (const TheCurve& theC,
|
||||
const Standard_Real theDeflection2,
|
||||
const Standard_Real theUdeb,
|
||||
const gp_Pnt& thePdeb,
|
||||
const gp_Vec& theVdeb,
|
||||
const Standard_Real theUfin,
|
||||
const gp_Pnt& thePfin,
|
||||
const gp_Vec& theVfin,
|
||||
const Standard_Integer theNbmin,
|
||||
const Standard_Real theEps,
|
||||
TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
Standard_Integer& theNbCalls)
|
||||
{
|
||||
++theNbCalls;
|
||||
if (theNbCalls >= MyMaxQuasiFleshe)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer aPtslength = thePoints.Length();
|
||||
if (theNbCalls > 100 && aPtslength < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aUdelta = theUfin - theUdeb;
|
||||
gp_Pnt aPdelta;
|
||||
gp_Vec aVdelta;
|
||||
if (theNbmin > 2)
|
||||
{
|
||||
aUdelta /= (theNbmin - 1);
|
||||
D1 (theC, theUdeb + aUdelta, aPdelta, aVdelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPdelta = thePfin;
|
||||
aVdelta = theVfin;
|
||||
}
|
||||
|
||||
const Standard_Real aNorme = gp_Vec (thePdeb, aPdelta).SquareMagnitude();
|
||||
Standard_Real aFleche = 0.0;
|
||||
Standard_Boolean isFlecheOk = Standard_False;
|
||||
if (aNorme > theEps)
|
||||
{
|
||||
// Evaluation de la fleche par interpolation . Voir IntWalk_IWalking_5.gxx
|
||||
Standard_Real N1 = theVdeb.SquareMagnitude();
|
||||
Standard_Real N2 = aVdelta.SquareMagnitude();
|
||||
if (N1 > theEps && N2 > theEps)
|
||||
{
|
||||
Standard_Real aNormediff = (theVdeb.Normalized().XYZ() - aVdelta.Normalized().XYZ()).SquareModulus();
|
||||
if (aNormediff > theEps)
|
||||
{
|
||||
aFleche = aNormediff * aNorme / 64.0;
|
||||
isFlecheOk = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isFlecheOk)
|
||||
{
|
||||
gp_Pnt aPmid ((thePdeb.XYZ() + aPdelta.XYZ()) * 0.5);
|
||||
gp_Pnt aPverif (Value (theC, theUdeb + aUdelta * 0.5));
|
||||
aFleche = aPmid.SquareDistance (aPverif);
|
||||
}
|
||||
|
||||
if (aFleche < theDeflection2)
|
||||
{
|
||||
theParameters.Append (theUdeb + aUdelta);
|
||||
thePoints.Append (aPdelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
QuasiFleche (theC, theDeflection2, theUdeb, thePdeb,
|
||||
theVdeb,
|
||||
theUdeb + aUdelta, aPdelta,
|
||||
aVdelta,
|
||||
3,
|
||||
theEps,
|
||||
theParameters, thePoints, theNbCalls);
|
||||
}
|
||||
|
||||
if (theNbmin > 2)
|
||||
{
|
||||
QuasiFleche (theC, theDeflection2, theUdeb + aUdelta, aPdelta,
|
||||
aVdelta,
|
||||
theUfin, thePfin,
|
||||
theVfin,
|
||||
theNbmin - (thePoints.Length() - aPtslength),
|
||||
theEps,
|
||||
theParameters, thePoints, theNbCalls);
|
||||
}
|
||||
--theNbCalls;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : QuasiFleche
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static void QuasiFleche (const TheCurve& theC,
|
||||
const Standard_Real theDeflection2,
|
||||
const Standard_Real theUdeb,
|
||||
const gp_Pnt& thePdeb,
|
||||
const Standard_Real theUfin,
|
||||
const gp_Pnt& thePfin,
|
||||
const Standard_Integer theNbmin,
|
||||
TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
Standard_Integer& theNbCalls)
|
||||
{
|
||||
++theNbCalls;
|
||||
if (theNbCalls >= MyMaxQuasiFleshe)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const Standard_Integer aPtslength = thePoints.Length();
|
||||
if (theNbCalls > 100 && aPtslength < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aUdelta = theUfin - theUdeb;
|
||||
gp_Pnt aPdelta;
|
||||
if (theNbmin > 2)
|
||||
{
|
||||
aUdelta /= (theNbmin - 1);
|
||||
aPdelta = Value (theC, theUdeb + aUdelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPdelta = thePfin;
|
||||
}
|
||||
|
||||
const gp_Pnt aPmid ((thePdeb.XYZ() + aPdelta.XYZ()) * 0.5);
|
||||
const gp_Pnt aPverif (Value (theC, theUdeb + aUdelta * 0.5));
|
||||
const Standard_Real aFleche = aPmid.SquareDistance (aPverif);
|
||||
if (aFleche < theDeflection2)
|
||||
{
|
||||
theParameters.Append (theUdeb + aUdelta);
|
||||
thePoints.Append (aPdelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
QuasiFleche (theC, theDeflection2, theUdeb, thePdeb,
|
||||
theUdeb + aUdelta * 0.5, aPverif,
|
||||
2,
|
||||
theParameters, thePoints, theNbCalls);
|
||||
|
||||
QuasiFleche (theC, theDeflection2, theUdeb + aUdelta * 0.5, aPverif,
|
||||
theUdeb + aUdelta, aPdelta,
|
||||
2,
|
||||
theParameters, thePoints, theNbCalls);
|
||||
}
|
||||
|
||||
if (theNbmin > 2)
|
||||
{
|
||||
QuasiFleche (theC, theDeflection2, theUdeb + aUdelta, aPdelta,
|
||||
theUfin, thePfin,
|
||||
theNbmin - (thePoints.Length() - aPtslength),
|
||||
theParameters, thePoints, theNbCalls);
|
||||
}
|
||||
--theNbCalls;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformLinear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformLinear (const TheCurve& theC,
|
||||
TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
{
|
||||
theParameters.Append (theU1);
|
||||
gp_Pnt aPoint = Value (theC, theU1);
|
||||
thePoints.Append (aPoint);
|
||||
|
||||
theParameters.Append (theU2);
|
||||
aPoint = Value (theC, theU2);
|
||||
thePoints.Append (aPoint);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCircular
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformCircular (const TheCurve& theC,
|
||||
TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
{
|
||||
Standard_Real anAngle = Max (1.0 - (theDeflection / theC.Circle().Radius()), 0.0);
|
||||
anAngle = 2.0 * ACos (anAngle);
|
||||
Standard_Integer aNbPoints = (Standard_Integer )((theU2 - theU1) / anAngle);
|
||||
aNbPoints += 2;
|
||||
anAngle = (theU2 - theU1) / (Standard_Real) (aNbPoints - 1);
|
||||
Standard_Real U = theU1;
|
||||
for (Standard_Integer i = 1; i <= aNbPoints; ++i)
|
||||
{
|
||||
theParameters.Append (U);
|
||||
const gp_Pnt aPoint = Value (theC, U);
|
||||
thePoints.Append (aPoint);
|
||||
U += anAngle;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDefType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static GCPnts_DeflectionType GetDefType (const TheCurve& theC)
|
||||
{
|
||||
if (theC.NbIntervals (GeomAbs_C1) > 1)
|
||||
{
|
||||
return GCPnts_DefComposite;
|
||||
}
|
||||
|
||||
// pour forcer les decoupages aux cassures.
|
||||
// G1 devrait marcher, mais donne des exceptions...
|
||||
switch (theC.GetType())
|
||||
{
|
||||
case GeomAbs_Line: return GCPnts_Linear;
|
||||
case GeomAbs_Circle: return GCPnts_Circular;
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BSplineCurve) aBS = theC.BSpline();
|
||||
return (aBS->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BezierCurve) aBZ = theC.Bezier();
|
||||
return (aBZ->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
default: return GCPnts_Curved;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Real theEPSILON,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
{
|
||||
Standard_Integer aNbmin = 2;
|
||||
Standard_Integer aNbCallQF = 0;
|
||||
|
||||
gp_Pnt aPdeb;
|
||||
if (theContinuity <= GeomAbs_G1)
|
||||
{
|
||||
aPdeb = Value (theC, theU1);
|
||||
theParameters.Append (theU1);
|
||||
thePoints.Append (aPdeb);
|
||||
|
||||
gp_Pnt aPfin (Value (theC, theU2));
|
||||
QuasiFleche (theC, theDeflection * theDeflection,
|
||||
theU1, aPdeb,
|
||||
theU2, aPfin,
|
||||
aNbmin,
|
||||
theParameters, thePoints, aNbCallQF);
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt aPfin;
|
||||
gp_Vec aDdeb, aDfin;
|
||||
D1 (theC, theU1, aPdeb, aDdeb);
|
||||
theParameters.Append (theU1);
|
||||
thePoints.Append (aPdeb);
|
||||
|
||||
const Standard_Real aDecreasedU2 = theU2 - Epsilon (theU2) * 10.0;
|
||||
D1 (theC, aDecreasedU2, aPfin, aDfin);
|
||||
QuasiFleche (theC, theDeflection * theDeflection,
|
||||
theU1, aPdeb,
|
||||
aDdeb,
|
||||
theU2, aPfin,
|
||||
aDfin,
|
||||
aNbmin,
|
||||
theEPSILON * theEPSILON,
|
||||
theParameters, thePoints, aNbCallQF);
|
||||
}
|
||||
// cout << "Nb de pts: " << Points.Length()<< endl;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformComposite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformComposite (TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Real theEPSILON,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
{
|
||||
//
|
||||
// coherence avec Intervals
|
||||
//
|
||||
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_C2);
|
||||
Standard_Integer aPIndex = 0;
|
||||
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
|
||||
theC.Intervals (aTI, GeomAbs_C2);
|
||||
BSplCLib::Hunt (aTI, theU1, aPIndex);
|
||||
|
||||
// iterate by continuous segments
|
||||
Standard_Real aUa = theU1;
|
||||
for (Standard_Integer anIndex = aPIndex;;)
|
||||
{
|
||||
Standard_Real aUb = anIndex + 1 <= aTI.Upper()
|
||||
? Min (theU2, aTI (anIndex + 1))
|
||||
: theU2;
|
||||
if (!PerformCurve (theParameters, thePoints, theC, theDeflection,
|
||||
aUa, aUb, theEPSILON, theContinuity))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
++anIndex;
|
||||
if (anIndex > aNbIntervals || theU2 < aTI (anIndex))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// remove last point to avoid duplication
|
||||
theParameters.Remove (theParameters.Length());
|
||||
thePoints.Remove (thePoints.Length());
|
||||
|
||||
aUa = aUb;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt GCPnts_QuasiUniformDeflection::Value (const Standard_Integer theIndex) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myDone, "GCPnts_QuasiUniformAbscissa::Parameter()");
|
||||
return myPoints.Value (theIndex);
|
||||
}
|
||||
|
||||
gp_Pnt GCPnts_QuasiUniformDeflection::Value
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myDone,
|
||||
"GCPnts_QuasiUniformAbscissa::Parameter()");
|
||||
return myPoints.Value(Index) ;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformDeflection
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection()
|
||||
: myDone (Standard_False),
|
||||
myDeflection (0.0),
|
||||
myCont (GeomAbs_C1)
|
||||
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection ()
|
||||
: myDone(Standard_False),
|
||||
myDeflection(0.0),
|
||||
myCont(GeomAbs_C1)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection),
|
||||
myCont (GeomAbs_C1)
|
||||
{
|
||||
Initialize (theC, theDeflection, theU1, theU2, theContinuity);
|
||||
}
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection),
|
||||
myCont (GeomAbs_C1)
|
||||
{
|
||||
Initialize (theC, theDeflection, theU1, theU2, theContinuity);
|
||||
}
|
||||
#define TheCurve Adaptor3d_Curve
|
||||
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection),
|
||||
myCont (GeomAbs_C1)
|
||||
{
|
||||
Initialize (theC, theDeflection, theContinuity);
|
||||
}
|
||||
#include "GCPnts_QuasiUniformDeflection.pxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection),
|
||||
myCont (GeomAbs_C1)
|
||||
{
|
||||
Initialize (theC, theDeflection, theContinuity);
|
||||
}
|
||||
#undef TheCurve
|
||||
#undef Handle_TheBezierCurve
|
||||
#undef Handle_TheBSplineCurve
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformDeflection::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
{
|
||||
Initialize (theC, theDeflection, theC.FirstParameter(), theC.LastParameter(), theContinuity);
|
||||
}
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
|
||||
#define TheCurve Adaptor2d_Curve2d
|
||||
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
|
||||
|
||||
#include "GCPnts_QuasiUniformDeflection.pxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformDeflection::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
{
|
||||
Initialize (theC, theDeflection, theC.FirstParameter(), theC.LastParameter(), theContinuity);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformDeflection::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
{
|
||||
initialize (theC, theDeflection, theU1, theU2, theContinuity);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformDeflection::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
{
|
||||
initialize (theC, theDeflection, theU1, theU2, theContinuity);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
void GCPnts_QuasiUniformDeflection::initialize (const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity)
|
||||
{
|
||||
myCont = (theContinuity > GeomAbs_G1) ? GeomAbs_C1 : GeomAbs_C0;
|
||||
myDeflection = theDeflection;
|
||||
myDone = Standard_False;
|
||||
myParams.Clear();
|
||||
myPoints.Clear();
|
||||
|
||||
const Standard_Real anEPSILON = Min (theC.Resolution (Precision::Confusion()), 1.e50);
|
||||
const GCPnts_DeflectionType aType = GetDefType (theC);
|
||||
const Standard_Real aU1 = Min (theU1, theU2);
|
||||
const Standard_Real aU2 = Max (theU1, theU2);
|
||||
if (aType == GCPnts_Curved
|
||||
|| aType == GCPnts_DefComposite)
|
||||
{
|
||||
if (theC.GetType() == GeomAbs_BSplineCurve
|
||||
|| theC.GetType() == GeomAbs_BezierCurve)
|
||||
{
|
||||
const Standard_Real aMaxPar = Max (Abs (theC.FirstParameter()), Abs (theC.LastParameter()));
|
||||
if (anEPSILON < Epsilon (aMaxPar))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (aType)
|
||||
{
|
||||
case GCPnts_Linear:
|
||||
{
|
||||
myDone = PerformLinear (theC, myParams, myPoints, aU1, aU2);
|
||||
break;
|
||||
}
|
||||
case GCPnts_Circular:
|
||||
{
|
||||
myDone = PerformCircular (theC, myParams, myPoints, theDeflection, aU1, aU2);
|
||||
break;
|
||||
}
|
||||
case GCPnts_Curved:
|
||||
{
|
||||
myDone = PerformCurve (myParams, myPoints, theC, theDeflection,
|
||||
aU1, aU2, anEPSILON, myCont);
|
||||
break;
|
||||
}
|
||||
case GCPnts_DefComposite:
|
||||
{
|
||||
myDone = PerformComposite (myParams, myPoints, theC, theDeflection,
|
||||
aU1, aU2, anEPSILON, myCont);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,20 +22,26 @@
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
class Standard_DomainError;
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
class StdFail_NotDone;
|
||||
class Adaptor3d_Curve;
|
||||
class Adaptor2d_Curve2d;
|
||||
class gp_Pnt;
|
||||
|
||||
//! This class computes a distribution of points on a curve.
|
||||
//! The points may respect the deflection.
|
||||
//! The algorithm is not based on the classical prediction (with second derivative of curve),
|
||||
//! but either on the evaluation of the distance between the mid point
|
||||
//! and the point of mid parameter of the two points,
|
||||
//! or the distance between the mid point and the point at parameter 0.5
|
||||
//! on the cubic interpolation of the two points and their tangents.
|
||||
//!
|
||||
//! Note: this algorithm is faster than a GCPnts_UniformDeflection algorithm,
|
||||
//! and is able to work with non-"C2" continuous curves.
|
||||
//! This class computes a distribution of points on a
|
||||
//! curve. The points may respect the deflection. The algorithm
|
||||
//! is not based on the classical prediction (with second
|
||||
//! derivative of curve), but either on the evaluation of
|
||||
//! the distance between the mid point and the point of
|
||||
//! mid parameter of the two points, or the distance
|
||||
//! between the mid point and the point at parameter 0.5
|
||||
//! on the cubic interpolation of the two points and their
|
||||
//! tangents.
|
||||
//! Note: this algorithm is faster than a
|
||||
//! GCPnts_UniformDeflection algorithm, and is
|
||||
//! able to work with non-"C2" continuous curves.
|
||||
//! However, it generates more points in the distribution.
|
||||
class GCPnts_QuasiUniformDeflection
|
||||
{
|
||||
@@ -43,132 +49,132 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructs an empty algorithm.
|
||||
//! To define the problem to be solved, use the function Initialize().
|
||||
|
||||
//! Constructs an empty algorithm. To define the problem
|
||||
//! to be solved, use the function Initialize.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection();
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution of points on the Curve.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution of points on the Curve.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution of points on a part of the Curve.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution of points on a part of the Curve.
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution
|
||||
//! of points on the Curve <C>.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection(const Adaptor3d_Curve& C, const Standard_Real Deflection, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution
|
||||
//! of points on the Curve <C>.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection(const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution
|
||||
//! of points on a part of the Curve <C>.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection(const Adaptor3d_Curve& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
//! Computes a QuasiUniform Deflection distribution
|
||||
//! of points on a part of the Curve <C>.
|
||||
//! This and the above algorithms compute a distribution of points:
|
||||
//! - on the curve theC, or
|
||||
//! - on the part of curve theC limited by the two parameter values theU1 and theU2,
|
||||
//! - on the curve C, or
|
||||
//! - on the part of curve C limited by the two
|
||||
//! parameter values U1 and U2,
|
||||
//! where the deflection resulting from the distributed
|
||||
//! points is not greater than theDeflection.
|
||||
//!
|
||||
//! points is not greater than Deflection.
|
||||
//! The first point of the distribution is either the origin of
|
||||
//! curve theC or the point of parameter theU1.
|
||||
//! The last point of the distribution is either the end point
|
||||
//! of curve theC or the point of parameter theU2.
|
||||
//!
|
||||
//! curve C or the point of parameter U1. The last point
|
||||
//! of the distribution is either the end point of curve C or
|
||||
//! the point of parameter U2.
|
||||
//! Intermediate points of the distribution are built such
|
||||
//! that the deflection is not greater than theDeflection.
|
||||
//! that the deflection is not greater than Deflection.
|
||||
//! Using the following evaluation of the deflection:
|
||||
//! if Pi and Pj are two consecutive points of the
|
||||
//! distribution, respectively of parameter ui and uj on the curve,
|
||||
//! the deflection is the distance between:
|
||||
//! - the mid-point of Pi and Pj (the center of the chord joining these two points)
|
||||
//! distribution, respectively of parameter ui and uj on
|
||||
//! the curve, the deflection is the distance between:
|
||||
//! - the mid-point of Pi and Pj (the center of the
|
||||
//! chord joining these two points)
|
||||
//! - and the point of mid-parameter of these two
|
||||
//! points (the point of parameter [(ui+uj) / 2] on curve theC).
|
||||
//! theContinuity, defaulted to GeomAbs_C1, gives the degree of continuity of the curve theC.
|
||||
//! (Note that C is an Adaptor3d_Curve or an Adaptor2d_Curve2d object,
|
||||
//! and does not know the degree of continuity of the underlying curve).
|
||||
//! Use the function IsDone() to verify that the computation was successful,
|
||||
//! the function NbPoints() to obtain the number of points of the computed distribution,
|
||||
//! and the function Parameter() to read the parameter of each point.
|
||||
//!
|
||||
//! points (the point of parameter [(ui+uj) / 2 ] on curve C).
|
||||
//! Continuity, defaulted to GeomAbs_C1, gives the
|
||||
//! degree of continuity of the curve C. (Note that C is an
|
||||
//! Adaptor3d_Curve or an Adaptor2d_Curve2d
|
||||
//! object, and does not know the degree of continuity of
|
||||
//! the underlying curve).
|
||||
//! Use the function IsDone to verify that the
|
||||
//! computation was successful, the function NbPoints
|
||||
//! to obtain the number of points of the computed
|
||||
//! distribution, and the function Parameter to read the
|
||||
//! parameter of each point.
|
||||
//! Warning
|
||||
//! - The roles of theU1 and theU2 are inverted if theU1 > theU2.
|
||||
//! - Derivative functions on the curve are called according to theContinuity.
|
||||
//! An error may occur if theContinuity is greater than
|
||||
//! the real degree of continuity of the curve.
|
||||
//!
|
||||
//! - The roles of U1 and U2 are inverted if U1 > U2.
|
||||
//! - Derivative functions on the curve are called
|
||||
//! according to Continuity. An error may occur if
|
||||
//! Continuity is greater than the real degree of
|
||||
//! continuity of the curve.
|
||||
//! Warning
|
||||
//! theC is an adapted curve, i.e. an object which is an interface between:
|
||||
//! C is an adapted curve, i.e. an object which is an
|
||||
//! interface between:
|
||||
//! - the services provided by either a 2D curve from
|
||||
//! the package Geom2d (in the case of an Adaptor2d_Curve2d curve)
|
||||
//! or a 3D curve from the package Geom (in the case of an Adaptor3d_Curve curve),
|
||||
//! - and those required on the curve by the computation algorithm.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with 3D curve and deflection.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with 2D curve and deflection.
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with 3D curve, deflection and parameter range.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with theC, theDeflection, theU1, theU2.
|
||||
//! the package Geom2d (in the case of an
|
||||
//! Adaptor2d_Curve2d curve) or a 3D curve from
|
||||
//! the package Geom (in the case of an
|
||||
//! Adaptor3d_Curve curve),
|
||||
//! - and those required on the curve by the
|
||||
//! computation algorithm.
|
||||
Standard_EXPORT GCPnts_QuasiUniformDeflection(const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Deflection, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>,
|
||||
//! <U1>,<U2>
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>,
|
||||
//! -- <U1>,<U2>
|
||||
//! This and the above algorithms initialize (or reinitialize)
|
||||
//! this algorithm and compute a distribution of points:
|
||||
//! - on the curve theC, or
|
||||
//! - on the part of curve theC limited by the two parameter values theU1 and theU2,
|
||||
//! - on the curve C, or
|
||||
//! - on the part of curve C limited by the two
|
||||
//! parameter values U1 and U2,
|
||||
//! where the deflection resulting from the distributed
|
||||
//! points is not greater than theDeflection.
|
||||
//!
|
||||
//! points is not greater than Deflection.
|
||||
//! The first point of the distribution is either the origin
|
||||
//! of curve theC or the point of parameter theU1.
|
||||
//! The last point of the distribution is either the end point of
|
||||
//! curve theC or the point of parameter theU2.
|
||||
//!
|
||||
//! of curve C or the point of parameter U1. The last
|
||||
//! point of the distribution is either the end point of
|
||||
//! curve C or the point of parameter U2.
|
||||
//! Intermediate points of the distribution are built in
|
||||
//! such a way that the deflection is not greater than theDeflection.
|
||||
//! Using the following evaluation of the deflection:
|
||||
//! if Pi and Pj are two consecutive points of the distribution,
|
||||
//! respectively of parameter ui and uj on the curve,
|
||||
//! the deflection is the distance between:
|
||||
//! - the mid-point of Pi and Pj (the center of the chord joining these two points)
|
||||
//! such a way that the deflection is not greater than
|
||||
//! Deflection. Using the following evaluation of the deflection:
|
||||
//! if Pi and Pj are two consecutive points of the
|
||||
//! distribution, respectively of parameter ui and uj
|
||||
//! on the curve, the deflection is the distance between:
|
||||
//! - the mid-point of Pi and Pj (the center of the
|
||||
//! chord joining these two points)
|
||||
//! - and the point of mid-parameter of these two
|
||||
//! points (the point of parameter [(ui+uj) / 2] on curve theC).
|
||||
//! theContinuity, defaulted to GeomAbs_C1, gives the degree of continuity of the curve theC.
|
||||
//! (Note that C is an Adaptor3d_Curve or an Adaptor2d_Curve2d object,
|
||||
//! and does not know the degree of continuity of the underlying curve).
|
||||
//! Use the function IsDone to verify that the computation was successful,
|
||||
//! the function NbPoints() to obtain the number of points of the computed distribution,
|
||||
//! and the function Parameter() to read the parameter of each point.
|
||||
//!
|
||||
//! points (the point of parameter [(ui+uj) / 2 ] on curve C).
|
||||
//! Continuity, defaulted to GeomAbs_C1, gives the
|
||||
//! degree of continuity of the curve C. (Note that C is
|
||||
//! an Adaptor3d_Curve or an
|
||||
//! Adaptor2d_Curve2d object, and does not know
|
||||
//! the degree of continuity of the underlying curve).
|
||||
//! Use the function IsDone to verify that the
|
||||
//! computation was successful, the function NbPoints
|
||||
//! to obtain the number of points of the computed
|
||||
//! distribution, and the function Parameter to read
|
||||
//! the parameter of each point.
|
||||
//! Warning
|
||||
//! - The roles of theU1 and theU2 are inverted if theU1 > theU2.
|
||||
//! - Derivative functions on the curve are called according to theContinuity.
|
||||
//! An error may occur if theContinuity is greater than
|
||||
//! the real degree of continuity of the curve.
|
||||
//!
|
||||
//! - The roles of U1 and U2 are inverted if U1 > U2.
|
||||
//! - Derivative functions on the curve are called
|
||||
//! according to Continuity. An error may occur if
|
||||
//! Continuity is greater than the real degree of
|
||||
//! continuity of the curve.
|
||||
//! Warning
|
||||
//! theC is an adapted curve, i.e. an object which is an interface between:
|
||||
//! C is an adapted curve, i.e. an object which is an
|
||||
//! interface between:
|
||||
//! - the services provided by either a 2D curve from
|
||||
//! the package Geom2d (in the case of an Adaptor2d_Curve2d curve)
|
||||
//! or a 3D curve from the package Geom (in the case of an Adaptor3d_Curve curve),
|
||||
//! and those required on the curve by the computation algorithm.
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity = GeomAbs_C1);
|
||||
//! the package Geom2d (in the case of an
|
||||
//! Adaptor2d_Curve2d curve) or a 3D curve from
|
||||
//! the package Geom (in the case of an Adaptor3d_Curve curve),
|
||||
//! and those required on the curve by the computation algorithm.
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const GeomAbs_Shape Continuity = GeomAbs_C1);
|
||||
|
||||
|
||||
//! Returns true if the computation was successful.
|
||||
//! IsDone is a protection against:
|
||||
@@ -232,15 +238,6 @@ public:
|
||||
return myDeflection;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Initializes algorithm.
|
||||
template<class TheCurve>
|
||||
void initialize (const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const GeomAbs_Shape theContinuity);
|
||||
|
||||
private:
|
||||
Standard_Boolean myDone;
|
||||
Standard_Real myDeflection;
|
||||
|
496
src/GCPnts/GCPnts_QuasiUniformDeflection.pxx
Normal file
496
src/GCPnts/GCPnts_QuasiUniformDeflection.pxx
Normal file
@@ -0,0 +1,496 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 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 <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <GCPnts_DeflectionType.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
static void QuasiFleche(const TheCurve&,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
const gp_Pnt&,
|
||||
const gp_Vec&,
|
||||
const Standard_Real,
|
||||
const gp_Pnt&,
|
||||
const gp_Vec&,
|
||||
const Standard_Integer,
|
||||
const Standard_Real,
|
||||
TColStd_SequenceOfReal&,
|
||||
TColgp_SequenceOfPnt&,
|
||||
Standard_Integer&);
|
||||
|
||||
static void QuasiFleche(const TheCurve&,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
const gp_Pnt&,
|
||||
const Standard_Real,
|
||||
const gp_Pnt&,
|
||||
const Standard_Integer,
|
||||
TColStd_SequenceOfReal&,
|
||||
TColgp_SequenceOfPnt&,
|
||||
Standard_Integer&);
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformLinear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformLinear (const TheCurve& C,
|
||||
TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2)
|
||||
{
|
||||
gp_Pnt aPoint;
|
||||
Parameters.Append (U1);
|
||||
aPoint = Value (C, U1);
|
||||
Points.Append (aPoint);
|
||||
|
||||
Parameters.Append (U2);
|
||||
aPoint = Value (C, U2);
|
||||
Points.Append (aPoint);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCircular
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformCircular (const TheCurve& C,
|
||||
TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2)
|
||||
|
||||
{
|
||||
gp_Pnt aPoint;
|
||||
Standard_Real Angle = Max (1.0e0 - (Deflection / C.Circle().Radius()), 0.0e0);
|
||||
Angle = 2.0e0 * ACos (Angle);
|
||||
Standard_Integer NbPoints = (Standard_Integer )((U2 - U1) / Angle);
|
||||
NbPoints += 2;
|
||||
Angle = (U2 - U1) / (Standard_Real) (NbPoints - 1);
|
||||
Standard_Real U = U1;
|
||||
for (Standard_Integer i = 1; i <= NbPoints; ++i)
|
||||
{
|
||||
Parameters.Append (U);
|
||||
aPoint = Value (C,U);
|
||||
Points.Append (aPoint);
|
||||
U += Angle;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDefType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static GCPnts_DeflectionType GetDefType (const TheCurve& C)
|
||||
{
|
||||
if (C.NbIntervals(GeomAbs_C1) > 1)
|
||||
return GCPnts_DefComposite;
|
||||
// pour forcer les decoupages aux cassures. G1 devrait marcher,
|
||||
// mais donne des exceptions...
|
||||
|
||||
switch (C.GetType())
|
||||
{
|
||||
case GeomAbs_Line: return GCPnts_Linear;
|
||||
case GeomAbs_Circle: return GCPnts_Circular;
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle_TheBSplineCurve BS = C.BSpline();
|
||||
return (BS->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle_TheBezierCurve BZ = C.Bezier();
|
||||
return (BZ->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
default: return GCPnts_Curved;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real EPSILON,
|
||||
const GeomAbs_Shape Continuity)
|
||||
{
|
||||
Standard_Integer Nbmin = 2;
|
||||
Standard_Integer aNbCallQF = 0;
|
||||
|
||||
gp_Pnt Pdeb;
|
||||
if (Continuity <= GeomAbs_G1)
|
||||
{
|
||||
|
||||
Pdeb = Value (C, U1);
|
||||
Parameters.Append (U1);
|
||||
Points.Append (Pdeb);
|
||||
|
||||
gp_Pnt Pfin (Value (C, U2));
|
||||
QuasiFleche (C, Deflection * Deflection,
|
||||
U1, Pdeb,
|
||||
U2, Pfin,
|
||||
Nbmin,
|
||||
Parameters, Points, aNbCallQF);
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt Pfin;
|
||||
gp_Vec Ddeb, Dfin;
|
||||
D1 (C, U1, Pdeb, Ddeb);
|
||||
Parameters.Append (U1);
|
||||
Points.Append (Pdeb);
|
||||
|
||||
Standard_Real aDecreasedU2 = U2 - Epsilon(U2) * 10.;
|
||||
D1 (C, aDecreasedU2, Pfin, Dfin);
|
||||
QuasiFleche (C, Deflection * Deflection,
|
||||
U1, Pdeb,
|
||||
Ddeb,
|
||||
U2, Pfin,
|
||||
Dfin,
|
||||
Nbmin,
|
||||
EPSILON * EPSILON,
|
||||
Parameters, Points, aNbCallQF);
|
||||
}
|
||||
// cout << "Nb de pts: " << Points.Length()<< endl;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformComposite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformComposite (TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real EPSILON,
|
||||
const GeomAbs_Shape Continuity)
|
||||
{
|
||||
//
|
||||
// coherence avec Intervals
|
||||
//
|
||||
Standard_Integer NbIntervals = C.NbIntervals (GeomAbs_C2);
|
||||
Standard_Integer PIndex;
|
||||
TColStd_Array1OfReal TI (1, NbIntervals + 1);
|
||||
C.Intervals (TI, GeomAbs_C2);
|
||||
BSplCLib::Hunt (TI, U1, PIndex);
|
||||
|
||||
// iterate by continuous segments
|
||||
Standard_Real Ua = U1;
|
||||
for (Standard_Integer Index = PIndex;;)
|
||||
{
|
||||
Standard_Real Ub = Index + 1 <= TI.Upper()
|
||||
? Min (U2, TI (Index + 1))
|
||||
: U2;
|
||||
if (!PerformCurve (Parameters, Points, C, Deflection,
|
||||
Ua, Ub, EPSILON, Continuity))
|
||||
return Standard_False;
|
||||
|
||||
++Index;
|
||||
if (Index > NbIntervals || U2 < TI (Index))
|
||||
return Standard_True;
|
||||
|
||||
// remove last point to avoid duplication
|
||||
Parameters.Remove (Parameters.Length());
|
||||
Points.Remove (Points.Length());
|
||||
|
||||
Ua = Ub;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection
|
||||
(const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const GeomAbs_Shape Continuity)
|
||||
{
|
||||
Initialize (C, Deflection, U1, U2, Continuity);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_QuasiUniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_QuasiUniformDeflection::GCPnts_QuasiUniformDeflection
|
||||
(const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const GeomAbs_Shape Continuity)
|
||||
{
|
||||
Initialize (C, Deflection, Continuity);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_QuasiUniformDeflection::Initialize (const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const GeomAbs_Shape Continuity)
|
||||
{
|
||||
Initialize (C, Deflection, C.FirstParameter(),
|
||||
C.LastParameter(), Continuity);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_QuasiUniformDeflection::Initialize
|
||||
(const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const GeomAbs_Shape Continuity)
|
||||
{
|
||||
myCont = (Continuity > GeomAbs_G1) ? GeomAbs_C1 : GeomAbs_C0;
|
||||
Standard_Real EPSILON = C.Resolution (Precision::Confusion());
|
||||
EPSILON = Min (EPSILON, 1.e50);
|
||||
myDeflection = Deflection;
|
||||
myDone = Standard_False;
|
||||
myParams.Clear();
|
||||
myPoints.Clear();
|
||||
GCPnts_DeflectionType Type = GetDefType (C);
|
||||
|
||||
Standard_Real U1 = Min (theU1, theU2);
|
||||
Standard_Real U2 = Max (theU1, theU2);
|
||||
|
||||
if (Type == GCPnts_Curved || Type == GCPnts_DefComposite)
|
||||
{
|
||||
if (C.GetType() == GeomAbs_BSplineCurve || C.GetType() == GeomAbs_BezierCurve)
|
||||
{
|
||||
Standard_Real maxpar = Max (Abs (C.FirstParameter()), Abs (C.LastParameter()));
|
||||
if (EPSILON < Epsilon (maxpar)) return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case GCPnts_Linear:
|
||||
myDone = PerformLinear (C, myParams, myPoints, U1, U2);
|
||||
break;
|
||||
case GCPnts_Circular:
|
||||
myDone = PerformCircular (C, myParams, myPoints, Deflection, U1, U2);
|
||||
break;
|
||||
case GCPnts_Curved:
|
||||
myDone = PerformCurve (myParams, myPoints, C, Deflection,
|
||||
U1, U2, EPSILON, myCont);
|
||||
break;
|
||||
case GCPnts_DefComposite:
|
||||
myDone = PerformComposite (myParams, myPoints, C, Deflection,
|
||||
U1, U2, EPSILON, myCont);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : QuasiFleche
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void QuasiFleche (const TheCurve& C,
|
||||
const Standard_Real Deflection2,
|
||||
const Standard_Real Udeb,
|
||||
const gp_Pnt& Pdeb,
|
||||
const gp_Vec& Vdeb,
|
||||
const Standard_Real Ufin,
|
||||
const gp_Pnt& Pfin,
|
||||
const gp_Vec& Vfin,
|
||||
const Standard_Integer Nbmin,
|
||||
const Standard_Real Eps,
|
||||
TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
Standard_Integer& theNbCalls)
|
||||
{
|
||||
theNbCalls++;
|
||||
if (theNbCalls >= MyMaxQuasiFleshe)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Standard_Integer Ptslength = Points.Length();
|
||||
if (theNbCalls > 100 && Ptslength < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Standard_Real Udelta = Ufin - Udeb;
|
||||
gp_Pnt Pdelta;
|
||||
gp_Vec Vdelta;
|
||||
if (Nbmin > 2)
|
||||
{
|
||||
Udelta /= (Nbmin - 1);
|
||||
D1 (C, Udeb + Udelta, Pdelta, Vdelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pdelta = Pfin;
|
||||
Vdelta = Vfin;
|
||||
}
|
||||
|
||||
Standard_Real Norme = gp_Vec (Pdeb, Pdelta).SquareMagnitude();
|
||||
Standard_Real theFleche = 0;
|
||||
Standard_Boolean flecheok = Standard_False;
|
||||
if (Norme > Eps)
|
||||
{
|
||||
// Evaluation de la fleche par interpolation . Voir IntWalk_IWalking_5.gxx
|
||||
Standard_Real N1 = Vdeb.SquareMagnitude();
|
||||
Standard_Real N2 = Vdelta.SquareMagnitude();
|
||||
if (N1 > Eps && N2 > Eps)
|
||||
{
|
||||
Standard_Real Normediff = (Vdeb.Normalized().XYZ() - Vdelta.Normalized().XYZ()).SquareModulus();
|
||||
if (Normediff > Eps)
|
||||
{
|
||||
theFleche = Normediff * Norme / 64.;
|
||||
flecheok = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flecheok)
|
||||
{
|
||||
gp_Pnt Pmid ((Pdeb.XYZ() + Pdelta.XYZ()) * 0.5);
|
||||
gp_Pnt Pverif (Value(C, Udeb + Udelta * 0.5));
|
||||
theFleche = Pmid.SquareDistance (Pverif);
|
||||
}
|
||||
|
||||
if (theFleche < Deflection2)
|
||||
{
|
||||
Parameters.Append (Udeb + Udelta);
|
||||
Points.Append (Pdelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
QuasiFleche (C, Deflection2, Udeb, Pdeb,
|
||||
Vdeb,
|
||||
Udeb + Udelta, Pdelta,
|
||||
Vdelta,
|
||||
3,
|
||||
Eps,
|
||||
Parameters, Points, theNbCalls);
|
||||
}
|
||||
|
||||
if (Nbmin > 2)
|
||||
{
|
||||
QuasiFleche (C, Deflection2, Udeb + Udelta, Pdelta,
|
||||
Vdelta,
|
||||
Ufin, Pfin,
|
||||
Vfin,
|
||||
Nbmin - (Points.Length() - Ptslength),
|
||||
Eps,
|
||||
Parameters, Points, theNbCalls);
|
||||
}
|
||||
theNbCalls--;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : QuasiFleche
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void QuasiFleche (const TheCurve& C,
|
||||
const Standard_Real Deflection2,
|
||||
const Standard_Real Udeb,
|
||||
const gp_Pnt& Pdeb,
|
||||
const Standard_Real Ufin,
|
||||
const gp_Pnt& Pfin,
|
||||
const Standard_Integer Nbmin,
|
||||
TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
Standard_Integer& theNbCalls)
|
||||
{
|
||||
theNbCalls++;
|
||||
if (theNbCalls >= MyMaxQuasiFleshe)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Standard_Integer Ptslength = Points.Length();
|
||||
if (theNbCalls > 100 && Ptslength < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Standard_Real Udelta = Ufin - Udeb;
|
||||
gp_Pnt Pdelta;
|
||||
if (Nbmin > 2)
|
||||
{
|
||||
Udelta /= (Nbmin-1);
|
||||
Pdelta = Value (C, Udeb + Udelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pdelta = Pfin;
|
||||
}
|
||||
|
||||
gp_Pnt Pmid ((Pdeb.XYZ() + Pdelta.XYZ()) * 0.5);
|
||||
gp_Pnt Pverif (Value (C, Udeb + Udelta * 0.5));
|
||||
Standard_Real theFleche = Pmid.SquareDistance (Pverif);
|
||||
|
||||
if (theFleche < Deflection2)
|
||||
{
|
||||
Parameters.Append(Udeb + Udelta);
|
||||
Points.Append (Pdelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
QuasiFleche (C, Deflection2, Udeb, Pdeb,
|
||||
Udeb + Udelta * 0.5, Pverif,
|
||||
2,
|
||||
Parameters, Points, theNbCalls);
|
||||
|
||||
QuasiFleche (C, Deflection2, Udeb + Udelta * 0.5, Pverif,
|
||||
Udeb + Udelta, Pdelta,
|
||||
2,
|
||||
Parameters, Points, theNbCalls);
|
||||
}
|
||||
|
||||
if (Nbmin > 2)
|
||||
{
|
||||
QuasiFleche (C, Deflection2, Udeb + Udelta, Pdelta,
|
||||
Ufin, Pfin,
|
||||
Nbmin - (Points.Length() - Ptslength),
|
||||
Parameters, Points, theNbCalls);
|
||||
}
|
||||
theNbCalls--;
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
// Copyright (c) 2021 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 _GCPnts_TCurveTypes_HeaderFile
|
||||
#define _GCPnts_TCurveTypes_HeaderFile
|
||||
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <GCPnts_DistFunction.hxx>
|
||||
#include <GCPnts_DistFunction2d.hxx>
|
||||
|
||||
//! Auxiliary tool to resolve 2D/3D curve classes.
|
||||
template<class TheCurve> struct GCPnts_TCurveTypes {};
|
||||
|
||||
//! Auxiliary tool to resolve 3D curve classes.
|
||||
template<> struct GCPnts_TCurveTypes<Adaptor3d_Curve>
|
||||
{
|
||||
typedef gp_Pnt Point;
|
||||
typedef Geom_BezierCurve BezierCurve;
|
||||
typedef Geom_BSplineCurve BSplineCurve;
|
||||
typedef GCPnts_DistFunction DistFunction;
|
||||
typedef GCPnts_DistFunctionMV DistFunctionMV;
|
||||
};
|
||||
|
||||
//! Auxiliary tool to resolve 2D curve classes.
|
||||
template<> struct GCPnts_TCurveTypes<Adaptor2d_Curve2d>
|
||||
{
|
||||
typedef gp_Pnt2d Point;
|
||||
typedef Geom2d_BezierCurve BezierCurve;
|
||||
typedef Geom2d_BSplineCurve BSplineCurve;
|
||||
typedef GCPnts_DistFunction2d DistFunction;
|
||||
typedef GCPnts_DistFunction2dMV DistFunctionMV;
|
||||
};
|
||||
|
||||
#endif // _GCPnts_TCurveTypes_HeaderFile
|
File diff suppressed because it is too large
Load Diff
@@ -26,13 +26,16 @@
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
|
||||
//! Computes a set of points on a curve from package
|
||||
//! Adaptor3d such as between two successive points
|
||||
//! P1(u1)and P2(u2) :
|
||||
//! @code
|
||||
//!
|
||||
//! . ||P1P3^P3P2||/||P1P3||*||P3P2||<AngularDeflection
|
||||
//! . ||P1P2^P1P3||/||P1P2||<CurvatureDeflection
|
||||
//! @endcode
|
||||
//!
|
||||
//! where P3 is the point of abscissa ((u1+u2)/2), with
|
||||
//! u1 the abscissa of the point P1 and u2 the abscissa
|
||||
//! of the point P2.
|
||||
@@ -44,220 +47,107 @@
|
||||
//! and CurvatureDeflection > gp::Resolution() must be
|
||||
//! satisfied at the construction time.
|
||||
//!
|
||||
//! A minimum number of points can be fixed for a linear or circular element.
|
||||
//! A minimum number of points can be fixed for a
|
||||
//! linear or circular element.
|
||||
//! Example:
|
||||
//! @code
|
||||
//! Handle(Geom_BezierCurve) aCurve = new Geom_BezierCurve (thePoles);
|
||||
//! GeomAdaptor_Curve aCurveAdaptor (aCurve);
|
||||
//! double aCDeflect = 0.01; // Curvature deflection
|
||||
//! double anADeflect = 0.09; // Angular deflection
|
||||
//! Handle(Geom_BezierCurve) C = new Geom_BezierCurve (Poles);
|
||||
//! GeomAdaptor_Curve Curve (C);
|
||||
//! Real CDeflect = 0.01; //Curvature deflection
|
||||
//! Real ADeflect = 0.09; //Angular deflection
|
||||
//!
|
||||
//! GCPnts_TangentialDeflection aPointsOnCurve;
|
||||
//! aPointsOnCurve.Initialize (aCurveAdaptor, anADeflect, aCDeflect);
|
||||
//! for (int i = 1; i <= aPointsOnCurve.NbPoints(); ++i)
|
||||
//! {
|
||||
//! double aU = aPointsOnCurve.Parameter (i);
|
||||
//! gp_Pnt aPnt = aPointsOnCurve.Value (i);
|
||||
//! GCPnts_TangentialDeflection PointsOnCurve;
|
||||
//! PointsOnCurve.Initialize (Curve, ADeflect, CDeflect);
|
||||
//!
|
||||
//! Real U;
|
||||
//! gp_Pnt P;
|
||||
//! for (Integer i=1; i<=PointsOnCurve.NbPoints();i++) {
|
||||
//! U = PointsOnCurve.Parameter (i);
|
||||
//! P = PointsOnCurve.Value (i);
|
||||
//! }
|
||||
//! @endcode
|
||||
|
||||
class GCPnts_TangentialDeflection
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor.
|
||||
//! @sa Initialize()
|
||||
|
||||
Standard_EXPORT GCPnts_TangentialDeflection();
|
||||
|
||||
//! Constructor for 3D curve.
|
||||
//! @param theC [in] 3d curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTol [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT GCPnts_TangentialDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Constructor for 3D curve with restricted range.
|
||||
//! @param theC [in] 3d curve
|
||||
//! @param theFirstParameter [in] first parameter on curve
|
||||
//! @param theLastParameter [in] last parameter on curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTo l [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT GCPnts_TangentialDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theFirstParameter, const Standard_Real theLastParameter,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Constructor for 2D curve.
|
||||
//! @param theC [in] 2d curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTol [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT GCPnts_TangentialDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Constructor for 2D curve with restricted range.
|
||||
//! @param theC [in] 2d curve
|
||||
//! @param theFirstParameter [in] first parameter on curve
|
||||
//! @param theLastParameter [in] last parameter on curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTol [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT GCPnts_TangentialDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theFirstParameter, const Standard_Real theLastParameter,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Initialize algorithm for 3D curve.
|
||||
//! @param theC [in] 3d curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTol [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Initialize algorithm for 3D curve with restricted range.
|
||||
//! @param theC [in] 3d curve
|
||||
//! @param theFirstParameter [in] first parameter on curve
|
||||
//! @param theLastParameter [in] last parameter on curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTol [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theFirstParameter, const Standard_Real theLastParameter,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Initialize algorithm for 2D curve.
|
||||
//! @param theC [in] 2d curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTol [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Initialize algorithm for 2D curve with restricted range.
|
||||
//! @param theC [in] 2d curve
|
||||
//! @param theFirstParameter [in] first parameter on curve
|
||||
//! @param theLastParameter [in] last parameter on curve
|
||||
//! @param theAngularDeflection [in] angular deflection in radians
|
||||
//! @param theCurvatureDeflection [in] linear deflection
|
||||
//! @param theMinimumOfPoints [in] minimum number of points
|
||||
//! @param theUTol [in] tolerance in curve parametric scope
|
||||
//! @param theMinLen [in] minimal length
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theFirstParameter, const Standard_Real theLastParameter,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints = 2,
|
||||
const Standard_Real theUTol = 1.0e-9,
|
||||
const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
|
||||
Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real FirstParameter, const Standard_Real LastParameter, const Standard_Real AngularDeflection, const Standard_Real CurvatureDeflection, const Standard_Integer MinimumOfPoints = 2, const Standard_Real UTol = 1.0e-9, const Standard_Real theMinLen = 1.0e-7);
|
||||
|
||||
//! Add point to already calculated points (or replace existing)
|
||||
//! Returns index of new added point
|
||||
//! or founded with parametric tolerance (replaced if theIsReplace is true)
|
||||
Standard_EXPORT Standard_Integer AddPoint (const gp_Pnt& thePnt,
|
||||
const Standard_Real theParam,
|
||||
const Standard_Boolean theIsReplace = Standard_True);
|
||||
|
||||
Standard_EXPORT Standard_Integer AddPoint (const gp_Pnt& thePnt, const Standard_Real theParam, const Standard_Boolean theIsReplace = Standard_True);
|
||||
|
||||
Standard_Integer NbPoints () const
|
||||
{
|
||||
return myParameters.Length ();
|
||||
return parameters.Length ();
|
||||
}
|
||||
|
||||
|
||||
Standard_Real Parameter (const Standard_Integer I) const
|
||||
{
|
||||
return myParameters.Value (I);
|
||||
return parameters.Value (I);
|
||||
}
|
||||
|
||||
|
||||
gp_Pnt Value (const Standard_Integer I) const
|
||||
{
|
||||
return myPoints.Value (I);
|
||||
return points.Value (I);
|
||||
}
|
||||
|
||||
|
||||
//! Computes angular step for the arc using the given parameters.
|
||||
Standard_EXPORT static Standard_Real ArcAngularStep (const Standard_Real theRadius,
|
||||
const Standard_Real theLinearDeflection,
|
||||
const Standard_Real theAngularDeflection,
|
||||
const Standard_Real theMinLength);
|
||||
Standard_EXPORT static Standard_Real ArcAngularStep (const Standard_Real theRadius, const Standard_Real theLinearDeflection, const Standard_Real theAngularDeflection, const Standard_Real theMinLength);
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT void PerformLinear (const Adaptor3d_Curve& C);
|
||||
|
||||
Standard_EXPORT void PerformLinear (const Adaptor2d_Curve2d& C);
|
||||
|
||||
Standard_EXPORT void PerformCircular (const Adaptor3d_Curve& C);
|
||||
|
||||
Standard_EXPORT void PerformCircular (const Adaptor2d_Curve2d& C);
|
||||
|
||||
Standard_EXPORT void PerformCurve (const Adaptor3d_Curve& C);
|
||||
|
||||
Standard_EXPORT void PerformCurve (const Adaptor2d_Curve2d& C);
|
||||
|
||||
Standard_EXPORT void EvaluateDu (const Adaptor3d_Curve& C, const Standard_Real U, gp_Pnt& P, Standard_Real& Du, Standard_Boolean& NotDone) const;
|
||||
|
||||
Standard_EXPORT void EvaluateDu (const Adaptor2d_Curve2d& C, const Standard_Real U, gp_Pnt& P, Standard_Real& Du, Standard_Boolean& NotDone) const;
|
||||
|
||||
template<class TheCurve>
|
||||
void initialize (const TheCurve& theC,
|
||||
const Standard_Real theFirstParameter, const Standard_Real theLastParameter,
|
||||
const Standard_Real theAngularDeflection, const Standard_Real theCurvatureDeflection,
|
||||
const Standard_Integer theMinimumOfPoints,
|
||||
const Standard_Real theUTol,
|
||||
const Standard_Real theMinLen);
|
||||
|
||||
template<class TheCurve>
|
||||
void PerformLinear (const TheCurve& theC);
|
||||
|
||||
template<class TheCurve>
|
||||
void PerformCircular (const TheCurve& theC);
|
||||
|
||||
//! Respecting the angle and the deflection,
|
||||
//! we impose a minimum number of points on a curve.
|
||||
template<class TheCurve>
|
||||
void PerformCurve (const TheCurve& theC);
|
||||
|
||||
template<class TheCurve>
|
||||
void EvaluateDu (const TheCurve& theC,
|
||||
const Standard_Real theU,
|
||||
gp_Pnt& theP,
|
||||
Standard_Real& theDu,
|
||||
Standard_Boolean& theNotDone) const;
|
||||
|
||||
//! Estimation of maximal deflection for interval [theU1, theU2]
|
||||
template<class TheCurve>
|
||||
void EstimDefl (const TheCurve& theC,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
Standard_Real& theMaxDefl, Standard_Real& theUMax);
|
||||
Standard_EXPORT void EstimDefl (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2,
|
||||
Standard_Real& MaxDefl, Standard_Real& UMax);
|
||||
|
||||
Standard_EXPORT void EstimDefl (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2,
|
||||
Standard_Real& MaxDefl, Standard_Real& UMax);
|
||||
|
||||
private:
|
||||
Standard_Real myAngularDeflection;
|
||||
Standard_Real myCurvatureDeflection;
|
||||
Standard_Real myUTol;
|
||||
Standard_Integer myMinNbPnts;
|
||||
Standard_Real angularDeflection;
|
||||
Standard_Real curvatureDeflection;
|
||||
Standard_Real uTol;
|
||||
Standard_Integer minNbPnts;
|
||||
Standard_Real myMinLen;
|
||||
Standard_Real myLastU;
|
||||
Standard_Real myFirstu;
|
||||
TColgp_SequenceOfPnt myPoints;
|
||||
TColStd_SequenceOfReal myParameters;
|
||||
Standard_Real lastu;
|
||||
Standard_Real firstu;
|
||||
TColgp_SequenceOfPnt points;
|
||||
TColStd_SequenceOfReal parameters;
|
||||
};
|
||||
|
||||
#endif // _GCPnts_TangentialDeflection_HeaderFile
|
||||
|
687
src/GCPnts/GCPnts_TangentialDeflection.pxx
Normal file
687
src/GCPnts/GCPnts_TangentialDeflection.pxx
Normal file
@@ -0,0 +1,687 @@
|
||||
// Created on: 1996-11-08
|
||||
// Created by: Jean Claude VAUTHIER
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 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 <GCPnts_DeflectionType.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <math_PSO.hxx>
|
||||
#include <math_BrentMinimum.hxx>
|
||||
|
||||
#define Us3 0.3333333333333333333333333333
|
||||
|
||||
void GCPnts_TangentialDeflection::EvaluateDu (
|
||||
const TheCurve& C,
|
||||
const Standard_Real U,
|
||||
gp_Pnt& P,
|
||||
Standard_Real& Du,
|
||||
Standard_Boolean& NotDone) const {
|
||||
|
||||
gp_Vec T, N;
|
||||
D2 (C, U, P, T, N);
|
||||
Standard_Real Lt = T.Magnitude ();
|
||||
Standard_Real LTol = Precision::Confusion ();
|
||||
if (Lt > LTol && N.Magnitude () > LTol) {
|
||||
Standard_Real Lc = N.CrossMagnitude (T);
|
||||
Standard_Real Ln = Lc/Lt;
|
||||
if (Ln > LTol) {
|
||||
Du = sqrt (8.0 * Max(curvatureDeflection, myMinLen) / Ln);
|
||||
NotDone = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_TangentialDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_TangentialDeflection::GCPnts_TangentialDeflection (
|
||||
const TheCurve& C,
|
||||
const Standard_Real AngularDeflection,
|
||||
const Standard_Real CurvatureDeflection,
|
||||
const Standard_Integer MinimumOfPoints,
|
||||
const Standard_Real UTol,
|
||||
const Standard_Real theMinLen)
|
||||
|
||||
{
|
||||
Initialize (C,AngularDeflection,CurvatureDeflection,MinimumOfPoints,UTol,theMinLen);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_TangentialDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_TangentialDeflection::GCPnts_TangentialDeflection (
|
||||
const TheCurve& C,
|
||||
const Standard_Real FirstParameter,
|
||||
const Standard_Real LastParameter,
|
||||
const Standard_Real AngularDeflection,
|
||||
const Standard_Real CurvatureDeflection,
|
||||
const Standard_Integer MinimumOfPoints,
|
||||
const Standard_Real UTol,
|
||||
const Standard_Real theMinLen)
|
||||
|
||||
{
|
||||
Initialize (C,
|
||||
FirstParameter,
|
||||
LastParameter,
|
||||
AngularDeflection,
|
||||
CurvatureDeflection,
|
||||
MinimumOfPoints,
|
||||
UTol, theMinLen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_TangentialDeflection::Initialize (
|
||||
const TheCurve& C,
|
||||
const Standard_Real AngularDeflection,
|
||||
const Standard_Real CurvatureDeflection,
|
||||
const Standard_Integer MinimumOfPoints,
|
||||
const Standard_Real UTol,
|
||||
const Standard_Real theMinLen)
|
||||
|
||||
{
|
||||
Initialize (C,
|
||||
C.FirstParameter (),
|
||||
C.LastParameter (),
|
||||
AngularDeflection,
|
||||
CurvatureDeflection,
|
||||
MinimumOfPoints,
|
||||
UTol, theMinLen);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_TangentialDeflection::Initialize (
|
||||
const TheCurve& C,
|
||||
const Standard_Real FirstParameter,
|
||||
const Standard_Real LastParameter,
|
||||
const Standard_Real AngularDeflection,
|
||||
const Standard_Real CurvatureDeflection,
|
||||
const Standard_Integer MinimumOfPoints,
|
||||
const Standard_Real UTol,
|
||||
const Standard_Real theMinLen)
|
||||
|
||||
{
|
||||
|
||||
Standard_ConstructionError_Raise_if (CurvatureDeflection < Precision::Confusion () ||
|
||||
AngularDeflection < Precision::Angular (),
|
||||
"GCPnts_TangentialDeflection::Initialize - Zero Deflection")
|
||||
|
||||
parameters.Clear ();
|
||||
points .Clear ();
|
||||
if (FirstParameter < LastParameter) {
|
||||
firstu = FirstParameter;
|
||||
lastu = LastParameter;
|
||||
}
|
||||
else {
|
||||
lastu = FirstParameter;
|
||||
firstu = LastParameter;
|
||||
}
|
||||
uTol = UTol;
|
||||
angularDeflection = AngularDeflection;
|
||||
curvatureDeflection = CurvatureDeflection;
|
||||
minNbPnts = Max (MinimumOfPoints, 2);
|
||||
myMinLen = Max(theMinLen, Precision::Confusion());
|
||||
|
||||
switch (C.GetType()) {
|
||||
|
||||
case GeomAbs_Line:
|
||||
PerformLinear (C);
|
||||
break;
|
||||
|
||||
case GeomAbs_Circle:
|
||||
PerformCircular (C);
|
||||
break;
|
||||
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle_TheBSplineCurve BS = C.BSpline() ;
|
||||
if (BS->NbPoles() == 2 ) PerformLinear (C);
|
||||
else PerformCurve (C);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle_TheBezierCurve BZ = C.Bezier();
|
||||
if (BZ->NbPoles() == 2) PerformLinear (C);
|
||||
else PerformCurve (C);
|
||||
break;
|
||||
}
|
||||
default: PerformCurve (C);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformLinear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_TangentialDeflection::PerformLinear (const TheCurve& C) {
|
||||
|
||||
gp_Pnt P;
|
||||
D0 (C, firstu, P);
|
||||
parameters.Append (firstu);
|
||||
points .Append (P);
|
||||
if (minNbPnts > 2)
|
||||
{
|
||||
Standard_Real Du = (lastu - firstu) / minNbPnts;
|
||||
Standard_Real U = firstu + Du;
|
||||
for (Standard_Integer i = 2; i < minNbPnts; i++)
|
||||
{
|
||||
D0 (C, U, P);
|
||||
parameters.Append (U);
|
||||
points .Append (P);
|
||||
U += Du;
|
||||
}
|
||||
}
|
||||
D0 (C, lastu, P);
|
||||
parameters.Append (lastu);
|
||||
points .Append (P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCircular
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_TangentialDeflection::PerformCircular (const TheCurve& C)
|
||||
{
|
||||
// akm 8/01/02 : check the radius before divide by it
|
||||
Standard_Real dfR = C.Circle().Radius();
|
||||
Standard_Real Du = GCPnts_TangentialDeflection::ArcAngularStep(
|
||||
dfR, curvatureDeflection, angularDeflection, myMinLen);
|
||||
|
||||
const Standard_Real aDiff = lastu - firstu;
|
||||
// Round up number of points to satisfy curvatureDeflection more precisely
|
||||
Standard_Integer NbPoints = (Standard_Integer)Min(Ceiling(aDiff / Du), 1.0e+6);
|
||||
NbPoints = Max(NbPoints, minNbPnts - 1);
|
||||
Du = aDiff / NbPoints;
|
||||
|
||||
gp_Pnt P;
|
||||
Standard_Real U = firstu;
|
||||
for (Standard_Integer i = 1; i <= NbPoints; i++)
|
||||
{
|
||||
D0 (C, U, P);
|
||||
parameters.Append (U);
|
||||
points .Append (P);
|
||||
U += Du;
|
||||
}
|
||||
D0 (C, lastu, P);
|
||||
parameters.Append (lastu);
|
||||
points .Append (P);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCurve
|
||||
//purpose : On respecte ll'angle et la fleche, on peut imposer un nombre
|
||||
// minimum de points sur un element lineaire
|
||||
//=======================================================================
|
||||
void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
|
||||
|
||||
{
|
||||
Standard_Integer i, j;
|
||||
gp_XYZ V1, V2;
|
||||
gp_Pnt MiddlePoint, CurrentPoint, LastPoint;
|
||||
Standard_Real Du, Dusave, MiddleU, L1, L2;
|
||||
|
||||
Standard_Real U1 = firstu;
|
||||
Standard_Real LTol = Precision::Confusion (); //protection longueur nulle
|
||||
Standard_Real ATol = 1.e-2 * angularDeflection;
|
||||
if(ATol > 1.e-2)
|
||||
ATol = 1.e-2;
|
||||
else if(ATol < 1.e-7)
|
||||
ATol = 1.e-7;
|
||||
|
||||
D0 (C, lastu, LastPoint);
|
||||
|
||||
//Initialization du calcul
|
||||
|
||||
Standard_Boolean NotDone = Standard_True;
|
||||
Dusave = (lastu - firstu)*Us3;
|
||||
Du = Dusave;
|
||||
EvaluateDu (C, U1, CurrentPoint, Du, NotDone);
|
||||
parameters.Append (U1);
|
||||
points .Append (CurrentPoint);
|
||||
|
||||
// Used to detect "isLine" current bspline and in Du computation in general handling.
|
||||
Standard_Integer NbInterv = C.NbIntervals(GeomAbs_CN);
|
||||
TColStd_Array1OfReal Intervs(1, NbInterv+1);
|
||||
C.Intervals(Intervs, GeomAbs_CN);
|
||||
|
||||
if (NotDone || Du > 5. * Dusave) {
|
||||
//C'est soit une droite, soit une singularite :
|
||||
V1 = (LastPoint.XYZ() - CurrentPoint.XYZ());
|
||||
L1 = V1.Modulus ();
|
||||
if (L1 > LTol)
|
||||
{
|
||||
//Si c'est une droite on verifie en calculant minNbPoints :
|
||||
Standard_Boolean IsLine = Standard_True;
|
||||
Standard_Integer NbPoints = (minNbPnts > 3) ? minNbPnts : 3;
|
||||
switch (C.GetType()) {
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle_TheBSplineCurve BS = C.BSpline() ;
|
||||
NbPoints = Max(BS->Degree() + 1, NbPoints);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle_TheBezierCurve BZ = C.Bezier();
|
||||
NbPoints = Max(BZ->Degree() + 1, NbPoints);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
;}
|
||||
////
|
||||
Standard_Real param = 0.;
|
||||
for (i = 1; i <= NbInterv && IsLine; ++i)
|
||||
{
|
||||
// Avoid usage intervals out of [firstu, lastu].
|
||||
if ((Intervs(i+1) < firstu) ||
|
||||
(Intervs(i) > lastu))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Fix border points in applicable intervals, to avoid be out of target interval.
|
||||
if ((Intervs(i) < firstu) &&
|
||||
(Intervs(i+1) > firstu))
|
||||
{
|
||||
Intervs(i) = firstu;
|
||||
}
|
||||
if ((Intervs(i) < lastu) &&
|
||||
(Intervs(i+1) > lastu))
|
||||
{
|
||||
Intervs(i + 1) = lastu;
|
||||
}
|
||||
|
||||
Standard_Real delta = (Intervs(i+1) - Intervs(i))/NbPoints;
|
||||
for (j = 1; j <= NbPoints && IsLine; ++j)
|
||||
{
|
||||
param = Intervs(i) + j*delta;
|
||||
D0 (C, param, MiddlePoint);
|
||||
V2 = (MiddlePoint.XYZ() - CurrentPoint.XYZ());
|
||||
L2 = V2.Modulus ();
|
||||
if (L2 > LTol)
|
||||
{
|
||||
const Standard_Real aAngle = V2.CrossMagnitude(V1)/(L1*L2);
|
||||
IsLine = (aAngle < ATol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsLine)
|
||||
{
|
||||
parameters.Clear();
|
||||
points .Clear();
|
||||
|
||||
PerformLinear(C);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//c'etait une singularite on continue :
|
||||
//Du = Dusave;
|
||||
EvaluateDu (C, param, MiddlePoint, Du, NotDone);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Du = (lastu-firstu)/2.1;
|
||||
MiddleU = firstu + Du;
|
||||
D0 (C, MiddleU, MiddlePoint);
|
||||
V1 = (MiddlePoint.XYZ() - CurrentPoint.XYZ());
|
||||
L1 = V1.Modulus ();
|
||||
if (L1 < LTol)
|
||||
{
|
||||
// L1 < LTol C'est une courbe de longueur nulle, calcul termine :
|
||||
// on renvoi un segment de 2 points (protection)
|
||||
parameters.Append (lastu);
|
||||
points .Append (LastPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Du > Dusave) Du = Dusave;
|
||||
else Dusave = Du;
|
||||
|
||||
if (Du < uTol) {
|
||||
Du = lastu - firstu;
|
||||
if (Du < uTol) {
|
||||
parameters.Append (lastu);
|
||||
points .Append (LastPoint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Traitement normal pour une courbe
|
||||
Standard_Boolean MorePoints = Standard_True;
|
||||
Standard_Real U2 = firstu;
|
||||
Standard_Real AngleMax = angularDeflection * 0.5; //car on prend le point milieu
|
||||
Standard_Integer aIdx[2] = {Intervs.Lower(), Intervs.Lower()}; // Indexes of intervals of U1 and U2, used to handle non-uniform case.
|
||||
Standard_Boolean isNeedToCheck = Standard_False;
|
||||
gp_Pnt aPrevPoint = points.Last();
|
||||
|
||||
while (MorePoints) {
|
||||
aIdx[0] = getIntervalIdx(U1, Intervs, aIdx[0]);
|
||||
U2 += Du;
|
||||
|
||||
if (U2 >= lastu) { //Bout de courbe
|
||||
U2 = lastu;
|
||||
CurrentPoint = LastPoint;
|
||||
Du = U2-U1;
|
||||
Dusave = Du;
|
||||
}
|
||||
else D0 (C, U2, CurrentPoint); //Point suivant
|
||||
|
||||
Standard_Real Coef = 0.0, ACoef = 0., FCoef = 0.;
|
||||
Standard_Boolean Correction, TooLarge, TooSmall;
|
||||
TooLarge = Standard_False;
|
||||
Correction = Standard_True;
|
||||
TooSmall = Standard_False;
|
||||
|
||||
while (Correction) { //Ajustement Du
|
||||
if (isNeedToCheck)
|
||||
{
|
||||
aIdx[1] = getIntervalIdx(U2, Intervs, aIdx[0]);
|
||||
if (aIdx[1] > aIdx[0]) // Jump to another polynom.
|
||||
{
|
||||
if (Du > (Intervs(aIdx[0] + 1) - Intervs(aIdx[0]) ) * Us3) // Set Du to the smallest value and check deflection on it.
|
||||
{
|
||||
Du = (Intervs(aIdx[0] + 1) - Intervs(aIdx[0]) ) * Us3;
|
||||
U2 = U1 + Du;
|
||||
if (U2 > lastu)
|
||||
U2 = lastu;
|
||||
D0 (C, U2, CurrentPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
MiddleU = (U1+U2)*0.5; //Verif / au point milieu
|
||||
D0 (C, MiddleU, MiddlePoint);
|
||||
|
||||
V1 = (CurrentPoint.XYZ() - aPrevPoint.XYZ()); //Critere de fleche
|
||||
V2 = (MiddlePoint.XYZ() - aPrevPoint.XYZ());
|
||||
L1 = V1.Modulus ();
|
||||
|
||||
FCoef = (L1 > myMinLen) ?
|
||||
V1.CrossMagnitude(V2)/(L1*curvatureDeflection) : 0.0;
|
||||
|
||||
V1 = (CurrentPoint.XYZ() - MiddlePoint.XYZ()); //Critere d'angle
|
||||
L1 = V1.Modulus ();
|
||||
L2 = V2.Modulus ();
|
||||
if (L1 > myMinLen && L2 > myMinLen)
|
||||
{
|
||||
Standard_Real angg = V1.CrossMagnitude(V2) / (L1 * L2);
|
||||
ACoef = angg / AngleMax;
|
||||
}
|
||||
else
|
||||
ACoef = 0.0;
|
||||
|
||||
//On retient le plus penalisant
|
||||
Coef = Max(ACoef, FCoef);
|
||||
|
||||
if (isNeedToCheck && Coef < 0.55)
|
||||
{
|
||||
isNeedToCheck = Standard_False;
|
||||
Du = Dusave;
|
||||
U2 = U1 + Du;
|
||||
if (U2 > lastu)
|
||||
U2 = lastu;
|
||||
D0 (C, U2, CurrentPoint);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Coef <= 1.0) {
|
||||
if (Abs (lastu-U2) < uTol) {
|
||||
parameters.Append (lastu);
|
||||
points .Append (LastPoint);
|
||||
MorePoints = Standard_False;
|
||||
Correction = Standard_False;
|
||||
}
|
||||
else {
|
||||
if (Coef >= 0.55 || TooLarge) {
|
||||
parameters.Append (U2);
|
||||
points .Append (CurrentPoint);
|
||||
aPrevPoint = CurrentPoint;
|
||||
Correction = Standard_False;
|
||||
isNeedToCheck = Standard_True;
|
||||
}
|
||||
else if (TooSmall) {
|
||||
Correction = Standard_False;
|
||||
aPrevPoint = CurrentPoint;
|
||||
}
|
||||
else {
|
||||
TooSmall = Standard_True;
|
||||
//Standard_Real UUU2 = U2;
|
||||
Du += Min((U2-U1)*(1.-Coef), Du*Us3);
|
||||
|
||||
U2 = U1 + Du;
|
||||
if (U2 > lastu)
|
||||
U2 = lastu;
|
||||
D0 (C, U2, CurrentPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (Coef >= 1.5) {
|
||||
if (!aPrevPoint.IsEqual(points.Last(), Precision::Confusion()))
|
||||
{
|
||||
parameters.Append (U1);
|
||||
points .Append (aPrevPoint);
|
||||
}
|
||||
U2 = MiddleU;
|
||||
Du = U2-U1;
|
||||
CurrentPoint = MiddlePoint;
|
||||
}
|
||||
else {
|
||||
Du*=0.9;
|
||||
U2 = U1 + Du;
|
||||
D0 (C, U2, CurrentPoint);
|
||||
TooLarge = Standard_True;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Du = U2-U1;
|
||||
|
||||
if (MorePoints) {
|
||||
if (U1 > firstu) {
|
||||
if (FCoef > ACoef) {
|
||||
//La fleche est critere de decoupage
|
||||
EvaluateDu (C, U2, CurrentPoint, Du, NotDone);
|
||||
if (NotDone) {
|
||||
Du += (Du-Dusave)*(Du/Dusave);
|
||||
if (Du > 1.5 * Dusave) Du = 1.5 * Dusave;
|
||||
if (Du < 0.75* Dusave) Du = 0.75 * Dusave;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//L'angle est le critere de decoupage
|
||||
Du += (Du-Dusave)*(Du/Dusave);
|
||||
if (Du > 1.5 * Dusave) Du = 1.5 * Dusave;
|
||||
if (Du < 0.75* Dusave) Du = 0.75 * Dusave;
|
||||
}
|
||||
}
|
||||
|
||||
if (Du < uTol) {
|
||||
Du = lastu - U2;
|
||||
if (Du < uTol) {
|
||||
parameters.Append (lastu);
|
||||
points .Append (LastPoint);
|
||||
MorePoints = Standard_False;
|
||||
}
|
||||
else if (Du*Us3 > uTol) Du*=Us3;
|
||||
}
|
||||
U1 = U2;
|
||||
Dusave = Du;
|
||||
}
|
||||
}
|
||||
//Recalage avant dernier point :
|
||||
i = points.Length()-1;
|
||||
// Real d = points (i).Distance (points (i+1));
|
||||
// if (Abs(parameters (i) - parameters (i+1))<= 0.000001 || d < Precision::Confusion()) {
|
||||
// cout<<"deux points confondus"<<endl;
|
||||
// parameters.Remove (i+1);
|
||||
// points.Remove (i+1);
|
||||
// i--;
|
||||
// }
|
||||
if (i >= 2) {
|
||||
MiddleU = parameters (i-1);
|
||||
MiddleU = (lastu + MiddleU)*0.5;
|
||||
D0 (C, MiddleU, MiddlePoint);
|
||||
parameters.SetValue (i, MiddleU);
|
||||
points .SetValue (i, MiddlePoint);
|
||||
}
|
||||
|
||||
//-- On rajoute des points aux milieux des segments si le nombre
|
||||
//-- mini de points n'est pas atteint
|
||||
//--
|
||||
Standard_Integer Nbp = points.Length();
|
||||
|
||||
//std::cout << "GCPnts_TangentialDeflection: Number of Points (" << Nbp << " " << minNbPnts << " )" << std::endl;
|
||||
|
||||
while(Nbp < minNbPnts)
|
||||
{
|
||||
for (i = 2; i <= Nbp; i += 2)
|
||||
{
|
||||
MiddleU = (parameters.Value(i-1)+parameters.Value(i))*0.5;
|
||||
D0 (C, MiddleU, MiddlePoint);
|
||||
parameters.InsertBefore(i,MiddleU);
|
||||
points.InsertBefore(i,MiddlePoint);
|
||||
Nbp++;
|
||||
}
|
||||
}
|
||||
//Additional check for intervals
|
||||
Standard_Real MinLen2 = myMinLen * myMinLen;
|
||||
Standard_Integer MaxNbp = 10 * Nbp;
|
||||
for(i = 1; i < Nbp; ++i)
|
||||
{
|
||||
U1 = parameters(i);
|
||||
U2 = parameters(i + 1);
|
||||
|
||||
if (U2 - U1 <= uTol)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check maximal deflection on interval;
|
||||
Standard_Real dmax = 0.;
|
||||
Standard_Real umax = 0.;
|
||||
Standard_Real amax = 0.;
|
||||
EstimDefl(C, U1, U2, dmax, umax);
|
||||
const gp_Pnt& P1 = points(i);
|
||||
const gp_Pnt& P2 = points(i+1);
|
||||
D0(C, umax, MiddlePoint);
|
||||
amax = EstimAngl(P1, MiddlePoint, P2);
|
||||
if(dmax > curvatureDeflection || amax > AngleMax)
|
||||
{
|
||||
if(umax - U1 > uTol && U2 - umax > uTol)
|
||||
{
|
||||
if (P1.SquareDistance(MiddlePoint) > MinLen2 && P2.SquareDistance(MiddlePoint) > MinLen2)
|
||||
{
|
||||
parameters.InsertAfter(i, umax);
|
||||
points.InsertAfter(i, MiddlePoint);
|
||||
++Nbp;
|
||||
--i; //To compensate ++i in loop header: i must point to first part of split interval
|
||||
if(Nbp > MaxNbp)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EstimDefl
|
||||
//purpose : Estimation of maximal deflection for interval [U1, U2]
|
||||
//
|
||||
//=======================================================================
|
||||
void GCPnts_TangentialDeflection::EstimDefl (const TheCurve& C,
|
||||
const Standard_Real U1, const Standard_Real U2,
|
||||
Standard_Real& MaxDefl, Standard_Real& UMax)
|
||||
{
|
||||
Standard_Real Du = (lastu - firstu);
|
||||
//
|
||||
TheMaxCurvLinDist aFunc(C, U1, U2);
|
||||
//
|
||||
const Standard_Integer aNbIter = 100;
|
||||
Standard_Real reltol = Max(1.e-3, 2.*uTol/((Abs(U1) + Abs(U2))));
|
||||
//
|
||||
math_BrentMinimum anOptLoc(reltol, aNbIter, uTol);
|
||||
anOptLoc.Perform(aFunc, U1, (U1+U2)/2., U2);
|
||||
if(anOptLoc.IsDone())
|
||||
{
|
||||
MaxDefl = Sqrt(-anOptLoc.Minimum());
|
||||
UMax = anOptLoc.Location();
|
||||
return;
|
||||
}
|
||||
//
|
||||
math_Vector aLowBorder(1,1);
|
||||
math_Vector aUppBorder(1,1);
|
||||
math_Vector aSteps(1,1);
|
||||
//
|
||||
aSteps(1) = Max(0.1 * Du, 100. * uTol);
|
||||
Standard_Integer aNbParticles = Max(8, RealToInt(32 * (U2 - U1) / Du));
|
||||
//
|
||||
aLowBorder(1) = U1;
|
||||
aUppBorder(1) = U2;
|
||||
//
|
||||
//
|
||||
Standard_Real aValue;
|
||||
math_Vector aT(1,1);
|
||||
TheMaxCurvLinDistMV aFuncMV(aFunc);
|
||||
|
||||
math_PSO aFinder(&aFuncMV, aLowBorder, aUppBorder, aSteps, aNbParticles);
|
||||
aFinder.Perform(aSteps, aValue, aT);
|
||||
//
|
||||
anOptLoc.Perform(aFunc, Max(aT(1) - aSteps(1), U1) , aT(1), Min(aT(1) + aSteps(1),U2));
|
||||
if(anOptLoc.IsDone())
|
||||
{
|
||||
MaxDefl = Sqrt(-anOptLoc.Minimum());
|
||||
UMax = anOptLoc.Location();
|
||||
return;
|
||||
}
|
||||
MaxDefl = Sqrt(-aValue);
|
||||
UMax = aT(1);
|
||||
//
|
||||
}
|
@@ -12,586 +12,47 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GCPnts_UniformAbscissa.hxx>
|
||||
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <GCPnts_AbscissaType.hxx>
|
||||
#include <GCPnts_TCurveTypes.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetParameterLengthRatio
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Real GetParameterLengthRatio (const TheCurve& theC)
|
||||
{
|
||||
switch (theC.GetType())
|
||||
{
|
||||
case GeomAbs_Circle:
|
||||
{
|
||||
return theC.Circle().Radius();
|
||||
}
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
if (!theC.IsRational())
|
||||
{
|
||||
return theC.DN (0.0, 1).Magnitude();
|
||||
}
|
||||
return RealLast();
|
||||
}
|
||||
default:
|
||||
{
|
||||
return RealLast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetAbsType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static GCPnts_AbscissaType GetAbsType (const TheCurve& theC)
|
||||
{
|
||||
if (theC.NbIntervals (GeomAbs_C1) > 1)
|
||||
{
|
||||
return GCPnts_AbsComposite;
|
||||
}
|
||||
|
||||
switch (theC.GetType())
|
||||
{
|
||||
case GeomAbs_Line:
|
||||
case GeomAbs_Circle:
|
||||
{
|
||||
return GCPnts_LengthParametrized;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BezierCurve) aBZ = theC.Bezier();
|
||||
if (aBZ->NbPoles() == 2 && !aBZ->IsRational())
|
||||
{
|
||||
return GCPnts_LengthParametrized;
|
||||
}
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BSplineCurve) aBS = theC.BSpline();
|
||||
if (aBS->NbPoles() == 2 && !aBS->IsRational())
|
||||
{
|
||||
return GCPnts_LengthParametrized;
|
||||
}
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean Perform (TColStd_Array1OfReal& theParameters,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTotalLength,
|
||||
Standard_Integer& theNbPoints,
|
||||
const Standard_Real theEPSILON)
|
||||
{
|
||||
Standard_Boolean isLocalDone = Standard_True;
|
||||
Standard_Real aUU1 = Min (theU1, theU2), aUU2 = Max (theU1, theU2);
|
||||
theNbPoints = 0;
|
||||
|
||||
// this initialization avoids the computation of the Length of the curve
|
||||
Standard_Real aDelta = (theAbscissa / theTotalLength) * (aUU2 - aUU1);
|
||||
Standard_Integer anIndex = 1;
|
||||
theParameters.SetValue (anIndex, aUU1);
|
||||
for (Standard_Boolean isNotDone = Standard_True; isNotDone; )
|
||||
{
|
||||
Standard_Real aUi = theParameters.Value (anIndex) + aDelta;
|
||||
if (aUi > aUU2)
|
||||
{
|
||||
// MSV 21.04.2004: OCC5739 (GCPnts_UniformAbscissa gives incorrect distribution of points)
|
||||
// if (aUU2 - theParameters.Value (anIndex) > 0.01 * aDelta) { Index += 1; }
|
||||
// theParameters.SetValue (anIndex, aUU2);
|
||||
// isNotDone = Standard_False;
|
||||
// break;
|
||||
aUi = aUU2;
|
||||
}
|
||||
GCPnts_AbscissaPoint anAbscissaFinder (theC, theAbscissa,
|
||||
theParameters.Value (anIndex),
|
||||
aUi,
|
||||
theEPSILON);
|
||||
if (anAbscissaFinder.IsDone())
|
||||
{
|
||||
anIndex += 1;
|
||||
aUi = anAbscissaFinder.Parameter();
|
||||
if (Abs (aUi - aUU2) <= theEPSILON)
|
||||
{
|
||||
theParameters.SetValue (anIndex, aUU2);
|
||||
isNotDone = Standard_False;
|
||||
}
|
||||
else if (aUi < aUU2)
|
||||
{
|
||||
theParameters.SetValue (anIndex, aUi);
|
||||
}
|
||||
else
|
||||
{
|
||||
theParameters.SetValue (anIndex, aUU2);
|
||||
isNotDone = Standard_False;
|
||||
}
|
||||
isNotDone = isNotDone && (anIndex + 1 <= theParameters.Length());
|
||||
}
|
||||
else
|
||||
{
|
||||
isLocalDone = Standard_False;
|
||||
isNotDone = Standard_True;
|
||||
aDelta -= aDelta / 10;
|
||||
if (aDelta <= Precision::PConfusion())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
theNbPoints = anIndex;
|
||||
return isLocalDone;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformLengthParametrized
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformLengthParametrized (TColStd_Array1OfReal& theParameters,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTotalLength,
|
||||
Standard_Integer& theNbPoints,
|
||||
const Standard_Real theEPSILON)
|
||||
{
|
||||
Standard_Real aUU1 = Min (theU1, theU2);
|
||||
Standard_Real aUU2 = Max (theU1, theU2);
|
||||
|
||||
// Ratio is defined as dl = Ratio * du
|
||||
// for a circle of gp Ratio is equal to the radius of the circle.
|
||||
// for a line of gp ratio is equal to 1.0
|
||||
const Standard_Real aRatio = GetParameterLengthRatio (theC);
|
||||
if (theAbscissa < 0.0e0)
|
||||
{
|
||||
aUU2 = Min (theU1, theU2);
|
||||
aUU1 = Max (theU1, theU2);
|
||||
}
|
||||
|
||||
const Standard_Real aDelta = (theAbscissa / theTotalLength) * (aUU2 - aUU1);
|
||||
Standard_Integer anIndex = 1;
|
||||
theNbPoints = 0;
|
||||
theParameters.SetValue (anIndex, aUU1);
|
||||
for (Standard_Boolean isNotDone = Standard_True; isNotDone;)
|
||||
{
|
||||
anIndex += 1;
|
||||
const Standard_Real aUi = theParameters.Value (anIndex - 1) + aDelta;
|
||||
if (Abs (aUi - aUU2) <= theEPSILON)
|
||||
{
|
||||
theParameters.SetValue (anIndex, aUU2);
|
||||
isNotDone = Standard_False;
|
||||
}
|
||||
else if (aUi < aUU2)
|
||||
{
|
||||
theParameters.SetValue (anIndex, aUi);
|
||||
}
|
||||
else
|
||||
{
|
||||
isNotDone = Standard_False;
|
||||
if (Abs (theParameters.Value (anIndex - 1) - aUU2) * aRatio / theAbscissa < 0.1)
|
||||
{
|
||||
theParameters.SetValue (anIndex - 1, aUU2);
|
||||
anIndex -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
theParameters.SetValue (anIndex, aUU2);
|
||||
}
|
||||
}
|
||||
isNotDone = (anIndex + 1 <= theParameters.Length()) && isNotDone;
|
||||
}
|
||||
|
||||
theNbPoints = anIndex;
|
||||
return Standard_True;
|
||||
}
|
||||
#include <GCPnts_UniformAbscissa.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa()
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa ()
|
||||
:myDone(Standard_False),
|
||||
myNbPoints(0),
|
||||
myAbscissa(0.)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theAbscissa, theTol);
|
||||
}
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theAbscissa, theTol);
|
||||
}
|
||||
#define TheCurve Adaptor3d_Curve
|
||||
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theAbscissa, theU1, theU2, theTol);
|
||||
}
|
||||
#include "GCPnts_UniformAbscissa.pxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theAbscissa, theU1, theU2, theTol);
|
||||
}
|
||||
#undef TheCurve
|
||||
#undef Handle_TheBezierCurve
|
||||
#undef Handle_TheBSplineCurve
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theTol);
|
||||
}
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theTol);
|
||||
}
|
||||
#define TheCurve Adaptor2d_Curve2d
|
||||
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theU1, theU2, theTol);
|
||||
}
|
||||
#include "GCPnts_UniformAbscissa.pxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
: myDone (Standard_False),
|
||||
myNbPoints (0),
|
||||
myAbscissa (0.0)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theU1, theU2, theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Initialize (theC, theAbscissa, theC.FirstParameter(), theC.LastParameter(), theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Initialize (theC, theAbscissa, theC.FirstParameter(), theC.LastParameter(), theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
initialize (theC, theAbscissa, theU1, theU2, theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
initialize (theC, theAbscissa, theU1, theU2, theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
void GCPnts_UniformAbscissa::initialize (const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
myAbscissa = theAbscissa;
|
||||
myNbPoints = 0;
|
||||
myDone = Standard_False;
|
||||
|
||||
const Standard_Real anEPSILON = theC.Resolution (Max (theTol, Precision::Confusion()));
|
||||
const Standard_Real aL = GCPnts_AbscissaPoint::Length (theC, theU1, theU2, anEPSILON);
|
||||
if (aL <= Precision::Confusion())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// compute the total Length here so that we can guess
|
||||
// the number of points instead of letting the constructor
|
||||
// of CPnts_AbscissaPoint do that and lose the information
|
||||
const Standard_Real aSizeR = aL / Abs (theAbscissa) + 5;
|
||||
if (aSizeR >= IntegerLast()) // modified by Igor Motchalov 23/04/2001
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer aSize = (Standard_Integer )aSizeR;
|
||||
if (!myParams.IsNull())
|
||||
{
|
||||
if (myParams->Length() < aSize)
|
||||
{
|
||||
myParams.Nullify();
|
||||
myParams = new TColStd_HArray1OfReal (1, aSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myParams = new TColStd_HArray1OfReal (1, aSize);
|
||||
}
|
||||
|
||||
const GCPnts_AbscissaType aType = GetAbsType (theC);
|
||||
switch (aType)
|
||||
{
|
||||
case GCPnts_LengthParametrized:
|
||||
{
|
||||
myDone = PerformLengthParametrized (myParams->ChangeArray1(),
|
||||
theC,
|
||||
theAbscissa,
|
||||
theU1, theU2,
|
||||
aL,
|
||||
myNbPoints,
|
||||
anEPSILON);
|
||||
break;
|
||||
}
|
||||
case GCPnts_Parametrized:
|
||||
case GCPnts_AbsComposite:
|
||||
{
|
||||
myDone = Perform (myParams->ChangeArray1(),
|
||||
theC,
|
||||
theAbscissa,
|
||||
theU1, theU2,
|
||||
aL,
|
||||
myNbPoints,
|
||||
anEPSILON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theC.FirstParameter(), theC.LastParameter(), theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Initialize (theC, theNbPoints, theC.FirstParameter(), theC.LastParameter(), theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
initialize (theC, theNbPoints, theU1, theU2, theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformAbscissa::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
initialize (theC, theNbPoints, theU1, theU2, theTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
void GCPnts_UniformAbscissa::initialize (const TheCurve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if (theNbPoints <= 1, "GCPnts_UniformAbscissa::Initialize() - number of points should be >= 2");
|
||||
myNbPoints = 0;
|
||||
myDone = Standard_False;
|
||||
|
||||
const Standard_Real anEPSILON = theC.Resolution (Max (theTol, Precision::Confusion()));
|
||||
// although very similar to Initialize with Abscissa this avoid
|
||||
// the computation of the total length of the curve twice
|
||||
const Standard_Real aL = GCPnts_AbscissaPoint::Length (theC, theU1, theU2, anEPSILON);
|
||||
if (aL <= Precision::Confusion())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Real anAbscissa = myAbscissa = aL / (theNbPoints - 1);
|
||||
|
||||
// compute the total Length here so that we can guess
|
||||
// the number of points instead of letting the constructor
|
||||
// of CPnts_AbscissaPoint do that and lose the information
|
||||
const Standard_Integer aSize = theNbPoints + 5;
|
||||
if (!myParams.IsNull())
|
||||
{
|
||||
if (myParams->Length() < aSize)
|
||||
{
|
||||
myParams.Nullify();
|
||||
myParams = new TColStd_HArray1OfReal (1, aSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myParams = new TColStd_HArray1OfReal (1, aSize);
|
||||
}
|
||||
|
||||
myNbPoints = 0;
|
||||
const GCPnts_AbscissaType aType = GetAbsType (theC);
|
||||
switch (aType)
|
||||
{
|
||||
case GCPnts_LengthParametrized:
|
||||
{
|
||||
myDone = PerformLengthParametrized (myParams->ChangeArray1(),
|
||||
theC,
|
||||
anAbscissa,
|
||||
theU1, theU2,
|
||||
aL,
|
||||
myNbPoints,
|
||||
anEPSILON);
|
||||
break;
|
||||
}
|
||||
case GCPnts_Parametrized:
|
||||
case GCPnts_AbsComposite:
|
||||
{
|
||||
myDone = Perform (myParams->ChangeArray1(),
|
||||
theC,
|
||||
anAbscissa,
|
||||
theU1, theU2,
|
||||
aL,
|
||||
myNbPoints,
|
||||
anEPSILON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,190 +20,101 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
class Standard_DomainError;
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
class StdFail_NotDone;
|
||||
class Adaptor3d_Curve;
|
||||
class Adaptor2d_Curve2d;
|
||||
|
||||
//! This class allows to compute a uniform distribution of points
|
||||
//! on a curve (i.e. the points will all be equally distant).
|
||||
//! on a curve (ie the points will all be equally distant).
|
||||
class GCPnts_UniformAbscissa
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creation of a indefinite UniformAbscissa
|
||||
Standard_EXPORT GCPnts_UniformAbscissa();
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on the 3D curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points on a part of the 3D Curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on the 3D Curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points on a part of the 3D Curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 3D curve, Abscissa, and Tolerance.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 3D curve, Abscissa, Tolerance, and parameter range.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 3D curve, number of points, and Tolerance.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 3D curve, number of points, Tolerance, and parameter range.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
public:
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on the 2D curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points on a part of the 2D Curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on the 2D Curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points on a part of the 2D Curve.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT GCPnts_UniformAbscissa (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 2D curve, Abscissa, and Tolerance.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 2D curve, Abscissa, Tolerance, and parameter range.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theAbscissa [in] abscissa (distance between two consecutive points)
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 2D curve, number of points, and Tolerance.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
//! Initialize the algorithms with 2D curve, number of points, Tolerance, and parameter range.
|
||||
//! @param theC [in] input curve
|
||||
//! @param theNbPoints [in] defines the number of desired points
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theToler [in] used for more precise calculation of curve length
|
||||
//! (Precision::Confusion() by default)
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theToler = -1);
|
||||
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on
|
||||
//! the Curve <C>. Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real Toler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points
|
||||
//! on a part of the Curve <C>. Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on
|
||||
//! the Curve <C>.
|
||||
//! <NbPoints> defines the nomber of desired points.
|
||||
//! Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& C, const Standard_Integer NbPoints, const Standard_Real Toler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points
|
||||
//! on a part of the Curve <C>.
|
||||
//! Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <Toler>
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <U1>,
|
||||
//! <U2>, <Toler>
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <NbPoints>, <Toler> and
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Integer NbPoints, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <U1>,
|
||||
//! <U2>, <Toler>.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on
|
||||
//! the Curve2d <C>.
|
||||
//! Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real Toler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points
|
||||
//! on a part of the Curve2d <C>.
|
||||
//! Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
//! Computes a uniform abscissa distribution of points on
|
||||
//! the Curve2d <C>.
|
||||
//! <NbPoints> defines the nomber of desired points.
|
||||
//! Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints, const Standard_Real Toler = -1);
|
||||
|
||||
//! Computes a Uniform abscissa distribution of points
|
||||
//! on a part of the Curve2d <C>.
|
||||
//! Parameter Toler is equal Precision::Confusion by default.
|
||||
//! It Is used for more precise calculation of curve length
|
||||
Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <Toler>
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <U1>,
|
||||
//! <U2>, <Toler>
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <NbPoints>, <Toler> and
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints, const Standard_Real Toler = -1);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Abscissa>, <U1>,
|
||||
//! <U2>, <Toler>.
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Integer NbPoints, const Standard_Real U1, const Standard_Real U2, const Standard_Real Toler = -1);
|
||||
|
||||
Standard_Boolean IsDone () const
|
||||
{
|
||||
return myDone;
|
||||
@@ -221,30 +132,15 @@ public:
|
||||
StdFail_NotDone_Raise_if (!myDone, "GCPnts_UniformAbscissa::Parameter()");
|
||||
return myParams->Value (Index);
|
||||
}
|
||||
|
||||
//! Returns the current abscissa, i.e. the distance between two consecutive points.
|
||||
|
||||
//! returne the current abscissa
|
||||
//! ie the distance between two consecutive points
|
||||
Standard_Real Abscissa () const
|
||||
{
|
||||
StdFail_NotDone_Raise_if (!myDone, "GCPnts_UniformAbscissa::Abscissa()");
|
||||
return myAbscissa;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Initializes algorithm.
|
||||
template<class TheCurve>
|
||||
void initialize (const TheCurve& theC,
|
||||
const Standard_Real theAbscissa,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol);
|
||||
|
||||
//! Initializes algorithm.
|
||||
template<class TheCurve>
|
||||
void initialize (const TheCurve& theC,
|
||||
const Standard_Integer theNbPoints,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Real theTol);
|
||||
|
||||
private:
|
||||
Standard_Boolean myDone;
|
||||
Standard_Integer myNbPoints;
|
||||
|
477
src/GCPnts/GCPnts_UniformAbscissa.pxx
Normal file
477
src/GCPnts/GCPnts_UniformAbscissa.pxx
Normal file
@@ -0,0 +1,477 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 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 <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <GCPnts_AbscissaType.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <CPnts_AbscissaPoint.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
|
||||
|
||||
static Standard_Real GetParameterLengthRatio(const TheCurve& C)
|
||||
{
|
||||
switch (C.GetType()) {
|
||||
|
||||
case GeomAbs_Circle :
|
||||
return C.Circle().Radius();
|
||||
|
||||
case GeomAbs_Line :
|
||||
return 1.;
|
||||
|
||||
case GeomAbs_BezierCurve :
|
||||
case GeomAbs_BSplineCurve :
|
||||
{
|
||||
if (!C.IsRational())
|
||||
return C.DN(0., 1).Magnitude();
|
||||
else
|
||||
return RealLast();
|
||||
}
|
||||
|
||||
default :
|
||||
return RealLast();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static GCPnts_AbscissaType GetAbsType(const TheCurve& C)
|
||||
{
|
||||
if (C.NbIntervals(GeomAbs_C1) > 1)
|
||||
return GCPnts_AbsComposite;
|
||||
|
||||
switch (C.GetType()) {
|
||||
|
||||
case GeomAbs_Line:
|
||||
case GeomAbs_Circle:
|
||||
return GCPnts_LengthParametrized;
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle_TheBezierCurve BZ = C.Bezier();
|
||||
if (BZ->NbPoles() == 2 && !BZ->IsRational())
|
||||
return GCPnts_LengthParametrized;
|
||||
else
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle_TheBSplineCurve BS = C.BSpline() ;
|
||||
if (BS->NbPoles() == 2 && !BS->IsRational())
|
||||
return GCPnts_LengthParametrized;
|
||||
else
|
||||
return GCPnts_Parametrized;
|
||||
}
|
||||
default:
|
||||
return GCPnts_Parametrized ;
|
||||
}
|
||||
}
|
||||
|
||||
static Standard_Boolean Perform(Handle(TColStd_HArray1OfReal)& HParameters,
|
||||
const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real TotalLength,
|
||||
Standard_Integer &NbPoints,
|
||||
const Standard_Real EPSILON)
|
||||
{
|
||||
Standard_Boolean NotDone = Standard_True;
|
||||
Standard_Boolean LocalDone = Standard_True;
|
||||
// Standard_Boolean Forward = Standard_True ;
|
||||
Standard_Real UU1 = Min(U1, U2), UU2 = Max(U1, U2) ;
|
||||
Standard_Integer Index ;
|
||||
// Standard_Real UCurrent, Delta, Ui;
|
||||
Standard_Real Delta, Ui;
|
||||
NbPoints = 0 ;
|
||||
|
||||
//
|
||||
// this initialization avoids the computation of the Length
|
||||
// of the curve
|
||||
|
||||
Delta = (Abscissa/TotalLength) * (UU2 - UU1) ;
|
||||
Index = 1 ;
|
||||
HParameters->SetValue(Index,UU1) ;
|
||||
while (NotDone) {
|
||||
Ui = HParameters->Value(Index) + Delta;
|
||||
if (Ui > UU2) {
|
||||
// MSV 21.04.2004: OCC5739 (GCPnts_UniformAbscissa gives incorrect
|
||||
// distribution of points)
|
||||
// if (UU2 - HParameters->Value(Index) > 0.01*Delta) {
|
||||
// Index += 1;
|
||||
// }
|
||||
// HParameters->SetValue(Index, UU2);
|
||||
// NotDone = Standard_False;
|
||||
// break;
|
||||
Ui = UU2;
|
||||
}
|
||||
GCPnts_AbscissaPoint AbscissaFinder(C,
|
||||
Abscissa,
|
||||
HParameters->Value(Index),
|
||||
Ui,
|
||||
EPSILON) ;
|
||||
if (AbscissaFinder.IsDone()) {
|
||||
Index += 1 ;
|
||||
Ui = AbscissaFinder.Parameter();
|
||||
if (Abs(Ui-UU2) <= EPSILON) {
|
||||
HParameters->SetValue(Index, UU2);
|
||||
NotDone = Standard_False;
|
||||
}
|
||||
else if (Ui < UU2) {
|
||||
HParameters->SetValue(Index, Ui);
|
||||
}
|
||||
else {
|
||||
HParameters->SetValue(Index, UU2);
|
||||
NotDone = Standard_False;
|
||||
}
|
||||
NotDone = NotDone && (Index + 1 <= HParameters->Length()) ;
|
||||
}
|
||||
else {
|
||||
|
||||
LocalDone = Standard_False ;
|
||||
NotDone = Standard_True ;
|
||||
Delta -= Delta/10;
|
||||
if (Delta <= Precision::PConfusion()) break;
|
||||
}
|
||||
}
|
||||
NbPoints = Index ;
|
||||
return (LocalDone) ;
|
||||
}
|
||||
|
||||
|
||||
static Standard_Boolean
|
||||
PerformLengthParametrized( Handle(TColStd_HArray1OfReal)& HParameters,
|
||||
const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real TotalLength,
|
||||
Standard_Integer &NbPoints,
|
||||
const Standard_Real EPSILON)
|
||||
{
|
||||
Standard_Boolean NotDone = Standard_True;
|
||||
// Standard_Boolean LocalDone = Standard_True;
|
||||
Standard_Real UU1 = Min(U1, U2);
|
||||
// Standard_Real UCurrent;
|
||||
Standard_Real Delta, Ui;
|
||||
Standard_Real UU2 = Max(U1, U2);
|
||||
Standard_Integer Index ;
|
||||
|
||||
// Ratio is defined as dl = Ratio * du
|
||||
// for a circle of gp Ratio is equal to the radius of the circle.
|
||||
// for a line of gp ratio is equal to 1.0
|
||||
Standard_Real Ratio = GetParameterLengthRatio(C);
|
||||
|
||||
|
||||
if (Abscissa < 0.0e0) {
|
||||
UU2 = Min(U1, U2);
|
||||
UU1 = Max(U1, U2);
|
||||
}
|
||||
Delta = (Abscissa/TotalLength) * (UU2 - UU1) ;
|
||||
Index = 1 ;
|
||||
NbPoints = 0 ;
|
||||
HParameters->SetValue(Index,UU1) ;
|
||||
while (NotDone) {
|
||||
Index += 1 ;
|
||||
Ui = HParameters->Value(Index-1) + Delta;
|
||||
if (Abs(Ui-UU2) <= EPSILON) {
|
||||
HParameters->SetValue(Index, UU2);
|
||||
NotDone = Standard_False;
|
||||
}
|
||||
else if (Ui < UU2) {
|
||||
HParameters->SetValue(Index, Ui);
|
||||
}
|
||||
else {
|
||||
NotDone = Standard_False;
|
||||
if (Abs(HParameters->Value(Index-1) - UU2)*Ratio/Abscissa < 0.1) {
|
||||
HParameters->SetValue(Index-1, UU2);
|
||||
Index -= 1;
|
||||
}
|
||||
else
|
||||
HParameters->SetValue(Index, UU2);
|
||||
}
|
||||
NotDone = (Index+1 <= HParameters->Length()) && NotDone ;
|
||||
}
|
||||
|
||||
NbPoints = Index ;
|
||||
return Standard_True ;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_UniformAbscissa::Initialize (const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(C, Abscissa, C.FirstParameter(),
|
||||
C.LastParameter(), Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(C, Abscissa, Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa (const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(C, Abscissa, U1, U2, Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa(const TheCurve& C,
|
||||
const Standard_Integer NbPoints,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(C, NbPoints, Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformAbscissa
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GCPnts_UniformAbscissa::GCPnts_UniformAbscissa(const TheCurve& C,
|
||||
const Standard_Integer NbPoints,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(C, NbPoints, U1, U2, Tol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_UniformAbscissa::Initialize(const TheCurve& C,
|
||||
const Standard_Real Abscissa,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Standard_Real L ;
|
||||
myAbscissa = Abscissa;
|
||||
myNbPoints = 0 ;
|
||||
myDone = Standard_False;
|
||||
Standard_Real EPSILON;
|
||||
|
||||
if(Tol < Precision::Confusion())
|
||||
EPSILON = C.Resolution(Precision::Confusion());
|
||||
else
|
||||
EPSILON = C.Resolution(Tol);
|
||||
|
||||
L = GCPnts_AbscissaPoint::Length(C, U1, U2, EPSILON);
|
||||
if (L <= Precision::Confusion()) {
|
||||
return;
|
||||
}
|
||||
Standard_Integer size ;
|
||||
|
||||
//
|
||||
// compute the total Length here so that we can
|
||||
// guess the number of points instead of letting the
|
||||
// constructor of CPnts_AbscissaPoint do that and lose
|
||||
// the information
|
||||
//
|
||||
//
|
||||
|
||||
// modified by Igor Motchalov 23/04/2001
|
||||
// size = (Standard_Integer )( (L/Abs(Abscissa)) + 5 );
|
||||
Standard_Real sizeR=L/Abs(Abscissa) + 5;
|
||||
if (sizeR < IntegerLast()) {
|
||||
size=(Standard_Integer) sizeR;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myParams.IsNull()) {
|
||||
if (myParams->Length() < size) {
|
||||
myParams.Nullify() ;
|
||||
myParams = new
|
||||
TColStd_HArray1OfReal(1,size) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
myParams = new
|
||||
TColStd_HArray1OfReal(1,size) ;
|
||||
}
|
||||
|
||||
// Standard_Real EPSILON = C.Resolution(Precision::Confusion());
|
||||
GCPnts_AbscissaType Type = GetAbsType(C);
|
||||
switch (Type) {
|
||||
case GCPnts_LengthParametrized :
|
||||
myDone = PerformLengthParametrized(myParams,
|
||||
C,
|
||||
Abscissa,
|
||||
U1,
|
||||
U2,
|
||||
L,
|
||||
myNbPoints,
|
||||
EPSILON);
|
||||
break;
|
||||
case GCPnts_Parametrized:
|
||||
case GCPnts_AbsComposite:
|
||||
myDone = Perform(myParams,
|
||||
C,
|
||||
Abscissa,
|
||||
U1,
|
||||
U2,
|
||||
L,
|
||||
myNbPoints,
|
||||
EPSILON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_UniformAbscissa::Initialize(const TheCurve& C,
|
||||
const Standard_Integer NbPoints,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Initialize(C, NbPoints, C.FirstParameter(),
|
||||
C.LastParameter(), Tol);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GCPnts_UniformAbscissa::Initialize(const TheCurve& C,
|
||||
const Standard_Integer NbPoints,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if (NbPoints <= 1,
|
||||
"GCPnts_UniformAbscissa::Initialize() - number of points should be >= 2");
|
||||
Standard_Real Abscissa ;
|
||||
myNbPoints = 0 ;
|
||||
myDone = Standard_False;
|
||||
Standard_Real EPSILON;
|
||||
|
||||
if(Tol < Precision::Confusion())
|
||||
EPSILON = C.Resolution(Precision::Confusion());
|
||||
else
|
||||
EPSILON = C.Resolution(Tol);
|
||||
|
||||
//
|
||||
// although very similar to Initialize with Abscissa this avoid
|
||||
// the computation of the total length of the curve twice
|
||||
//
|
||||
Standard_Real L = GCPnts_AbscissaPoint::Length(C, U1, U2, EPSILON) ;
|
||||
|
||||
if (L <= Precision::Confusion()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Abscissa =
|
||||
myAbscissa = L / (NbPoints - 1);
|
||||
|
||||
Standard_Integer size ;
|
||||
|
||||
//
|
||||
// compute the total Length here so that we can
|
||||
// guess the number of points instead of letting the
|
||||
// constructor of CPnts_AbscissaPoint do that and lose
|
||||
// the information
|
||||
//
|
||||
//
|
||||
|
||||
size = NbPoints + 5 ;
|
||||
|
||||
|
||||
if (!myParams.IsNull()) {
|
||||
if (myParams->Length() < size) {
|
||||
myParams.Nullify() ;
|
||||
myParams = new
|
||||
TColStd_HArray1OfReal(1,size) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
myParams = new
|
||||
TColStd_HArray1OfReal(1,size) ;
|
||||
}
|
||||
|
||||
|
||||
myNbPoints = 0 ;
|
||||
GCPnts_AbscissaType Type = GetAbsType(C);
|
||||
switch (Type) {
|
||||
case GCPnts_LengthParametrized:
|
||||
myDone = PerformLengthParametrized(myParams,
|
||||
C,
|
||||
Abscissa,
|
||||
U1,
|
||||
U2,
|
||||
L,
|
||||
myNbPoints,
|
||||
EPSILON);
|
||||
break;
|
||||
case GCPnts_Parametrized:
|
||||
case GCPnts_AbsComposite:
|
||||
myDone = Perform(myParams,
|
||||
C,
|
||||
Abscissa,
|
||||
U1,
|
||||
U2,
|
||||
L,
|
||||
myNbPoints,
|
||||
EPSILON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -12,11 +12,10 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <GCPnts_UniformDeflection.hxx>
|
||||
|
||||
#include <CPnts_UniformDeflection.hxx>
|
||||
#include <GCPnts_DeflectionType.hxx>
|
||||
#include <GCPnts_TCurveTypes.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <GCPnts_UniformDeflection.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
@@ -26,357 +25,68 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
// mask the return of a Adaptor2d_Curve2d as a gp_Pnt
|
||||
static gp_Pnt Value (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theParameter)
|
||||
static gp_Pnt Value(const Adaptor3d_Curve & C,
|
||||
const Standard_Real Parameter)
|
||||
{
|
||||
return theC.Value (theParameter);
|
||||
return C.Value(Parameter) ;
|
||||
}
|
||||
|
||||
static gp_Pnt Value (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theParameter)
|
||||
static gp_Pnt Value(const Adaptor2d_Curve2d & C,
|
||||
const Standard_Real Parameter)
|
||||
{
|
||||
const gp_Pnt2d a2dPoint = theC.Value (theParameter);
|
||||
return gp_Pnt (a2dPoint.X(), a2dPoint.Y(), 0.0);
|
||||
gp_Pnt aPoint ;
|
||||
gp_Pnt2d a2dPoint =
|
||||
C.Value(Parameter) ;
|
||||
aPoint.SetX ( a2dPoint.X()) ;
|
||||
aPoint.SetY ( a2dPoint.Y()) ;
|
||||
aPoint.SetZ ( 0.0e0) ;
|
||||
return aPoint ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection()
|
||||
: myDone (Standard_False),
|
||||
myDeflection (0.0)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection)
|
||||
{
|
||||
Initialize (theC, theDeflection, theU1, theU2, theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection)
|
||||
{
|
||||
Initialize (theC, theDeflection, theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection)
|
||||
{
|
||||
Initialize (theC, theDeflection, theU1, theU2, theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl)
|
||||
: myDone (Standard_False),
|
||||
myDeflection (theDeflection)
|
||||
{
|
||||
Initialize (theC, theDeflection, theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformDeflection::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl)
|
||||
{
|
||||
Initialize (theC, theDeflection, theC.FirstParameter(), theC.LastParameter(), theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformDeflection::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl)
|
||||
{
|
||||
Initialize (theC, theDeflection, theC.FirstParameter(), theC.LastParameter(), theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformDeflection::Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl)
|
||||
{
|
||||
initialize (theC, theDeflection, theU1, theU2, theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformDeflection::Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl)
|
||||
{
|
||||
initialize (theC, theDeflection, theU1, theU2, theWithControl);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt GCPnts_UniformDeflection::Value (const Standard_Integer theIndex) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myDone, "GCPnts_UniformAbscissa::Parameter()");
|
||||
return myPoints.Value (theIndex);
|
||||
|
||||
gp_Pnt GCPnts_UniformDeflection::Value
|
||||
(const Standard_Integer Index) const
|
||||
{
|
||||
StdFail_NotDone_Raise_if(!myDone,
|
||||
"GCPnts_UniformAbscissa::Parameter()");
|
||||
return myPoints.Value(Index) ;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
//! Control of the last points.
|
||||
template<class TheCurve>
|
||||
static void Controle (const TheCurve& theC,
|
||||
TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const Standard_Real theU2)
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection ()
|
||||
: myDone(Standard_False),
|
||||
myDeflection(0.0)
|
||||
{
|
||||
const Standard_Integer aNbPnts = thePoints.Length();
|
||||
if (aNbPnts > 2)
|
||||
{
|
||||
const Standard_Real aUa = theParameters (aNbPnts - 2);
|
||||
const Standard_Real aUb = theParameters (aNbPnts - 1);
|
||||
if (theU2 - aUb < 0.33 * (theU2 - aUa))
|
||||
{
|
||||
const Standard_Real aUc = (theU2 + aUa) * 0.5;
|
||||
theParameters (aNbPnts - 1) = aUc;
|
||||
thePoints (aNbPnts - 1) = Value (theC, aUc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformLinear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformLinear (const TheCurve& theC,
|
||||
TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
{
|
||||
theParameters.Append (theU1);
|
||||
gp_Pnt aPoint = Value (theC, theU1);
|
||||
thePoints.Append (aPoint);
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
theParameters.Append (theU2);
|
||||
aPoint = Value (theC, theU2);
|
||||
thePoints.Append (aPoint);
|
||||
return Standard_True;
|
||||
}
|
||||
#define TheCurve Adaptor3d_Curve
|
||||
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
|
||||
#include "GCPnts_UniformDeflection.pxx"
|
||||
#undef TheCurve
|
||||
#undef Handle_TheBezierCurve
|
||||
#undef Handle_TheBSplineCurve
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCircular
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformCircular (const TheCurve& theC,
|
||||
TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2)
|
||||
{
|
||||
gp_Pnt aPoint;
|
||||
Standard_Real anAngle = Max (1.0 - (theDeflection / theC.Circle().Radius()), 0.0);
|
||||
anAngle = 2.0e0 * ACos (anAngle);
|
||||
Standard_Integer aNbPoints = (Standard_Integer )((theU2 - theU1) / anAngle);
|
||||
aNbPoints += 2;
|
||||
anAngle = (theU2 - theU1) / (Standard_Real) (aNbPoints - 1);
|
||||
Standard_Real aU = theU1;
|
||||
for (Standard_Integer i = 1; i <= aNbPoints; ++i)
|
||||
{
|
||||
theParameters.Append (aU);
|
||||
aPoint = Value (theC, aU);
|
||||
thePoints.Append (aPoint);
|
||||
aU += anAngle;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDefType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static GCPnts_DeflectionType GetDefType (const TheCurve& theC)
|
||||
{
|
||||
if (theC.NbIntervals (GeomAbs_C2) > 1)
|
||||
{
|
||||
return GCPnts_DefComposite;
|
||||
}
|
||||
|
||||
switch (theC.GetType())
|
||||
{
|
||||
case GeomAbs_Line: return GCPnts_Linear;
|
||||
case GeomAbs_Circle: return GCPnts_Circular;
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BSplineCurve) aBSpline = theC.BSpline();
|
||||
return (aBSpline->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle(typename GCPnts_TCurveTypes<TheCurve>::BezierCurve) aBezier = theC.Bezier();
|
||||
return (aBezier->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return GCPnts_Curved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Real theEPSILON,
|
||||
const Standard_Boolean theWithControl)
|
||||
{
|
||||
CPnts_UniformDeflection anIterator (theC, theDeflection, theU1, theU2, theEPSILON, theWithControl);
|
||||
for (; anIterator.More(); anIterator.Next())
|
||||
{
|
||||
theParameters.Append (anIterator.Value());
|
||||
thePoints.Append (anIterator.Point());
|
||||
}
|
||||
return anIterator.IsAllDone();
|
||||
}
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#define TheCurve Adaptor2d_Curve2d
|
||||
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
|
||||
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
|
||||
#include "GCPnts_UniformDeflection.pxx"
|
||||
#undef TheCurve
|
||||
#undef Handle_TheBezierCurve
|
||||
#undef Handle_TheBSplineCurve
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformComposite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
static Standard_Boolean PerformComposite (TColStd_SequenceOfReal& theParameters,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Real theEPSILON,
|
||||
const Standard_Boolean theWithControl)
|
||||
{
|
||||
const Standard_Integer aNbIntervals = theC.NbIntervals (GeomAbs_C2);
|
||||
Standard_Integer aPIndex = 0;
|
||||
|
||||
TColStd_Array1OfReal aTI (1, aNbIntervals + 1);
|
||||
theC.Intervals (aTI, GeomAbs_C2);
|
||||
BSplCLib::Hunt (aTI, theU1, aPIndex);
|
||||
|
||||
// iterate by continuous segments
|
||||
Standard_Real aUa = theU1;
|
||||
for (Standard_Integer anIndex = aPIndex;;)
|
||||
{
|
||||
Standard_Real aUb = anIndex + 1 <= aTI.Upper()
|
||||
? Min (theU2, aTI (anIndex + 1))
|
||||
: theU2;
|
||||
if (!PerformCurve (theParameters, thePoints, theC, theDeflection,
|
||||
aUa, aUb, theEPSILON, theWithControl))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
++anIndex;
|
||||
if (anIndex > aNbIntervals || theU2 < aTI (anIndex))
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
// remove last point to avoid duplication
|
||||
theParameters.Remove (theParameters.Length());
|
||||
thePoints.Remove (thePoints.Length());
|
||||
|
||||
aUa = aUb;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
template<class TheCurve>
|
||||
void GCPnts_UniformDeflection::initialize (const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl)
|
||||
{
|
||||
const Standard_Real anEPSILON = theC.Resolution (Precision::Confusion());
|
||||
myDeflection = theDeflection;
|
||||
myDone = Standard_False;
|
||||
myParams.Clear();
|
||||
myPoints.Clear();
|
||||
|
||||
const Standard_Real aU1 = Min (theU1, theU2);
|
||||
const Standard_Real aU2 = Max (theU1, theU2);
|
||||
const GCPnts_DeflectionType aType = GetDefType (theC);
|
||||
switch (aType)
|
||||
{
|
||||
case GCPnts_Linear:
|
||||
myDone = PerformLinear (theC, myParams, myPoints, aU1, aU2);
|
||||
break;
|
||||
case GCPnts_Circular:
|
||||
myDone = PerformCircular (theC, myParams, myPoints, theDeflection, aU1, aU2);
|
||||
break;
|
||||
case GCPnts_Curved:
|
||||
myDone = PerformCurve (myParams, myPoints, theC, theDeflection,
|
||||
aU1, aU2, anEPSILON, theWithControl);
|
||||
break;
|
||||
case GCPnts_DefComposite:
|
||||
myDone = PerformComposite (myParams, myPoints, theC, theDeflection,
|
||||
aU1, aU2, anEPSILON, theWithControl);
|
||||
break;
|
||||
}
|
||||
|
||||
// control of the last points
|
||||
Controle (theC, myParams, myPoints, aU2);
|
||||
}
|
||||
|
@@ -21,125 +21,112 @@
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
|
||||
class Standard_DomainError;
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
class StdFail_NotDone;
|
||||
class Adaptor3d_Curve;
|
||||
class Adaptor2d_Curve2d;
|
||||
class gp_Pnt;
|
||||
|
||||
//! Provides an algorithm to compute a distribution of
|
||||
//! points on a 'C2' continuous curve.
|
||||
//! The algorithm respects a criterion of maximum deflection between
|
||||
//! points on a 'C2' continuous curve. The algorithm
|
||||
//! respects a criterion of maximum deflection between
|
||||
//! the curve and the polygon that results from the computed points.
|
||||
//! Note: This algorithm is relatively time consuming.
|
||||
//! A GCPnts_QuasiUniformDeflection algorithm is quicker;
|
||||
//! it can also work with non-'C2' continuous curves,
|
||||
//! but it generates more points in the distribution.
|
||||
class GCPnts_UniformDeflection
|
||||
//! Note: This algorithm is relatively time consuming. A
|
||||
//! GCPnts_QuasiUniformDeflection algorithm is
|
||||
//! quicker; it can also work with non-'C2' continuous
|
||||
//! curves, but it generates more points in the distribution.
|
||||
class GCPnts_UniformDeflection
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Constructs an empty algorithm.
|
||||
//! To define the problem to be solved, use the function Initialize.
|
||||
|
||||
//! Constructs an empty algorithm. To define the problem
|
||||
//! to be solved, use the function Initialize.
|
||||
Standard_EXPORT GCPnts_UniformDeflection();
|
||||
|
||||
//! Computes a uniform Deflection distribution of points on the curve.
|
||||
//! @param theC [in] input 3D curve
|
||||
//! @param theDeflection [in] target deflection
|
||||
//! @param theWithControl [in] when TRUE, the algorithm controls the estimate deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
|
||||
//! Computes a uniform Deflection distribution of points on the curve.
|
||||
//! @param theC [in] input 2D curve
|
||||
//! @param theDeflection [in] target deflection
|
||||
//! @param theWithControl [in] when TRUE, the algorithm controls the estimate deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
|
||||
//! Computes a Uniform Deflection distribution of points on a part of the curve.
|
||||
//! @param theC [in] input 3D curve
|
||||
//! @param theDeflection [in] target deflection
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theWithControl [in] when TRUE, the algorithm controls the estimate deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
|
||||
//! Computes a Uniform Deflection distribution of points on a part of the curve.
|
||||
//! @param theC [in] input 2D curve
|
||||
//! @param theDeflection [in] target deflection
|
||||
//! @param theU1 [in] first parameter on curve
|
||||
//! @param theU2 [in] last parameter on curve
|
||||
//! @param theWithControl [in] when TRUE, the algorithm controls the estimate deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with 3D curve and deflection.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with 2D curve and deflection.
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with 3D curve, deflection, parameter range.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
//! Computes a uniform Deflection distribution of points on
|
||||
//! the Curve <C>.
|
||||
//! if <WithControl> is True,the algorithm controls the estimate
|
||||
//! deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection(const Adaptor3d_Curve& C, const Standard_Real Deflection, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with curve, deflection, parameter range.
|
||||
//! Computes a uniform Deflection distribution of points on
|
||||
//! the Curve <C>.
|
||||
//! if <WithControl> is True,the algorithm controls the estimate
|
||||
//! deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection(const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Computes a Uniform Deflection distribution of points
|
||||
//! on a part of the Curve <C>.
|
||||
//! if <WithControl> is True,the algorithm controls the estimate
|
||||
//! deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection(const Adaptor3d_Curve& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Computes a Uniform Deflection distribution of points
|
||||
//! on a part of the Curve <C>.
|
||||
//! if <WithControl> is True,the algorithm controls the estimate
|
||||
//! deflection
|
||||
Standard_EXPORT GCPnts_UniformDeflection(const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Deflection, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>,
|
||||
//! <U1>,<U2>
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Curve& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Initialize the algorithms with <C>, <Deflection>,
|
||||
//! <U1>,<U2>
|
||||
//! This and the above methods initialize (or reinitialize) this algorithm and
|
||||
//! compute a distribution of points:
|
||||
//! - on the curve theC, or
|
||||
//! - on the part of curve theC limited by the two parameter values theU1 and theU2,
|
||||
//! where the maximum distance between theC and the
|
||||
//! - on the curve C, or
|
||||
//! - on the part of curve C limited by the two
|
||||
//! parameter values U1 and U2,
|
||||
//! where the maximum distance between C and the
|
||||
//! polygon that results from the points of the
|
||||
//! distribution is not greater than theDeflection.
|
||||
//! distribution is not greater than Deflection.
|
||||
//! The first point of the distribution is either the origin
|
||||
//! of curve theC or the point of parameter theU1.
|
||||
//! The last point of the distribution is either the end point of
|
||||
//! curve theC or the point of parameter theU2.
|
||||
//! Intermediate points of the distribution are built using
|
||||
//! interpolations of segments of the curve limited at the 2nd degree.
|
||||
//! The construction ensures, in a first step,
|
||||
//! that the chordal deviation for this
|
||||
//! interpolation of the curve is less than or equal to theDeflection.
|
||||
//! However, it does not ensure that the chordal deviation
|
||||
//! for the curve itself is less than or equal to theDeflection.
|
||||
//! To do this a check is necessary,
|
||||
//! which may generate (second step) additional intermediate points.
|
||||
//! This check is time consuming, and can be avoided by setting theWithControl to false.
|
||||
//! Note that by default theWithControl is true and check is performed.
|
||||
//! Use the function IsDone to verify that the computation was successful,
|
||||
//! the function NbPoints() to obtain the number of points of the computed distribution,
|
||||
//! and the function Parameter to read the parameter of each point.
|
||||
//!
|
||||
//! of curve C or the point of parameter U1. The last
|
||||
//! point of the distribution is either the end point of
|
||||
//! curve C or the point of parameter U2. Intermediate
|
||||
//! points of the distribution are built using
|
||||
//! interpolations of segments of the curve limited at
|
||||
//! the 2nd degree. The construction ensures, in a first
|
||||
//! step, that the chordal deviation for this
|
||||
//! interpolation of the curve is less than or equal to
|
||||
//! Deflection. However, it does not ensure that the
|
||||
//! chordal deviation for the curve itself is less than or
|
||||
//! equal to Deflection. To do this a check is
|
||||
//! necessary, which may generate (second step)
|
||||
//! additional intermediate points. This check is time
|
||||
//! consuming, and can be avoided by setting
|
||||
//! WithControl to false. Note that by default
|
||||
//! WithControl is true and check is performed.
|
||||
//! Use the function IsDone to verify that the
|
||||
//! computation was successful, the function NbPoints
|
||||
//! to obtain the number of points of the computed
|
||||
//! distribution, and the function Parameter to read
|
||||
//! the parameter of each point.
|
||||
//! Warning
|
||||
//! - theC is necessary, 'C2' continuous.
|
||||
//! This property is not checked at construction time.
|
||||
//! - The roles of theU1 and theU2 are inverted if theU1 > theU2.
|
||||
//!
|
||||
//! - C is necessary, 'C2' continuous. This property is
|
||||
//! not checked at construction time.
|
||||
//! - The roles of U1 and U2 are inverted if U1 > U2.
|
||||
//! Warning
|
||||
//! theC is an adapted curve, i.e. an object which is an interface between:
|
||||
//! C is an adapted curve, i.e. an object which is an interface between:
|
||||
//! - the services provided by either a 2D curve from
|
||||
//! the package Geom2d (in the case of an Adaptor2d_Curve2d curve)
|
||||
//! or a 3D curve from the package Geom (in the case of an Adaptor3d_Curve curve),
|
||||
//! the package Geom2d (in the case of an
|
||||
//! Adaptor2d_Curve2d curve) or a 3D curve from
|
||||
//! the package Geom (in the case of an Adaptor3d_Curve curve),
|
||||
//! - and those required on the curve by the computation algorithm.
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1, const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl = Standard_True);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor2d_Curve2d& C, const Standard_Real Deflection, const Standard_Real U1, const Standard_Real U2, const Standard_Boolean WithControl = Standard_True);
|
||||
|
||||
//! Returns true if the computation was successful.
|
||||
//! IsDone is a protection against:
|
||||
//! - non-convergence of the algorithm
|
||||
@@ -202,16 +189,6 @@ public:
|
||||
return myDeflection;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Initialize the algorithm.
|
||||
template<class TheCurve>
|
||||
void initialize (const TheCurve& theC,
|
||||
const Standard_Real theDeflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean theWithControl);
|
||||
|
||||
private:
|
||||
Standard_Boolean myDone;
|
||||
Standard_Real myDeflection;
|
||||
|
274
src/GCPnts/GCPnts_UniformDeflection.pxx
Normal file
274
src/GCPnts/GCPnts_UniformDeflection.pxx
Normal file
@@ -0,0 +1,274 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 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 <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <GCPnts_DeflectionType.hxx>
|
||||
#include <CPnts_UniformDeflection.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Controle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Controle (const TheCurve& C,
|
||||
TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const Standard_Real U2)
|
||||
{
|
||||
Standard_Integer nbp = Points.Length();
|
||||
|
||||
if (nbp > 2)
|
||||
{
|
||||
Standard_Real Ua = Parameters (nbp - 2);
|
||||
Standard_Real Ub = Parameters (nbp - 1);
|
||||
if (U2 - Ub < 0.33 * (U2 - Ua))
|
||||
{
|
||||
Standard_Real Uc = (U2 + Ua) * 0.5;
|
||||
Parameters (nbp - 1) = Uc;
|
||||
Points (nbp - 1) = Value (C, Uc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformLinear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformLinear (const TheCurve& C,
|
||||
TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2)
|
||||
{
|
||||
gp_Pnt aPoint;
|
||||
Parameters.Append (U1);
|
||||
aPoint = Value (C, U1);
|
||||
Points.Append (aPoint);
|
||||
|
||||
Parameters.Append (U2);
|
||||
aPoint = Value (C, U2);
|
||||
Points.Append (aPoint);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCircular
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformCircular (const TheCurve& C,
|
||||
TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2)
|
||||
{
|
||||
gp_Pnt aPoint;
|
||||
Standard_Real Angle = Max (1.0e0 - (Deflection / C.Circle().Radius()), 0.0e0);
|
||||
Angle = 2.0e0 * ACos (Angle);
|
||||
Standard_Integer NbPoints = (Standard_Integer )((U2 - U1) / Angle);
|
||||
NbPoints += 2;
|
||||
Angle = (U2 - U1) / (Standard_Real) (NbPoints - 1);
|
||||
Standard_Real U = U1;
|
||||
for (Standard_Integer i = 1; i <= NbPoints; ++i)
|
||||
{
|
||||
Parameters.Append (U);
|
||||
aPoint = Value (C, U);
|
||||
Points.Append (aPoint);
|
||||
U += Angle;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
static GCPnts_DeflectionType GetDefType (const TheCurve& C)
|
||||
{
|
||||
if (C.NbIntervals (GeomAbs_C2) > 1)
|
||||
return GCPnts_DefComposite;
|
||||
|
||||
switch (C.GetType())
|
||||
{
|
||||
case GeomAbs_Line: return GCPnts_Linear;
|
||||
case GeomAbs_Circle: return GCPnts_Circular;
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle_TheBSplineCurve aBSpline = C.BSpline();
|
||||
return (aBSpline->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
case GeomAbs_BezierCurve:
|
||||
{
|
||||
Handle_TheBezierCurve aBezier = C.Bezier();
|
||||
return (aBezier->NbPoles() == 2) ? GCPnts_Linear : GCPnts_Curved;
|
||||
}
|
||||
default: return GCPnts_Curved;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real EPSILON,
|
||||
const Standard_Boolean WithControl)
|
||||
{
|
||||
CPnts_UniformDeflection Iterator (C, Deflection, U1, U2, EPSILON, WithControl);
|
||||
for(; Iterator.More(); Iterator.Next())
|
||||
{
|
||||
Parameters.Append (Iterator.Value());
|
||||
Points.Append (Iterator.Point());
|
||||
}
|
||||
return Iterator.IsAllDone();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PerformComposite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Boolean PerformComposite (TColStd_SequenceOfReal& Parameters,
|
||||
TColgp_SequenceOfPnt& Points,
|
||||
const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real EPSILON,
|
||||
const Standard_Boolean WithControl)
|
||||
{
|
||||
Standard_Integer NbIntervals = C.NbIntervals (GeomAbs_C2);
|
||||
Standard_Integer PIndex;
|
||||
|
||||
TColStd_Array1OfReal TI (1, NbIntervals + 1);
|
||||
C.Intervals (TI, GeomAbs_C2);
|
||||
BSplCLib::Hunt (TI, U1, PIndex);
|
||||
|
||||
// iterate by continuous segments
|
||||
Standard_Real Ua = U1;
|
||||
for (Standard_Integer Index = PIndex;;)
|
||||
{
|
||||
Standard_Real Ub = Index + 1 <= TI.Upper()
|
||||
? Min (U2, TI (Index + 1))
|
||||
: U2;
|
||||
if (!PerformCurve (Parameters, Points, C, Deflection,
|
||||
Ua, Ub, EPSILON, WithControl))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
++Index;
|
||||
if (Index > NbIntervals || U2 < TI (Index))
|
||||
return Standard_True;
|
||||
|
||||
// remove last point to avoid duplication
|
||||
Parameters.Remove (Parameters.Length());
|
||||
Points.Remove (Points.Length());
|
||||
|
||||
Ua = Ub;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection (const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Boolean WithControl)
|
||||
{
|
||||
Initialize (C, Deflection, U1, U2, WithControl);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GCPnts_UniformDeflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GCPnts_UniformDeflection::GCPnts_UniformDeflection (const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Boolean WithControl)
|
||||
{
|
||||
Initialize(C, Deflection, WithControl);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformDeflection::Initialize (const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Boolean WithControl)
|
||||
{
|
||||
Initialize (C, Deflection, C.FirstParameter(), C.LastParameter(), WithControl);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts_UniformDeflection::Initialize (const TheCurve& C,
|
||||
const Standard_Real Deflection,
|
||||
const Standard_Real theU1,
|
||||
const Standard_Real theU2,
|
||||
const Standard_Boolean WithControl)
|
||||
{
|
||||
Standard_Real EPSILON = C.Resolution (Precision::Confusion());
|
||||
myDeflection = Deflection;
|
||||
myDone = Standard_False;
|
||||
myParams.Clear();
|
||||
myPoints.Clear();
|
||||
Standard_Real U1 = Min (theU1, theU2);
|
||||
Standard_Real U2 = Max (theU1, theU2);
|
||||
GCPnts_DeflectionType Type = GetDefType (C);
|
||||
switch (Type)
|
||||
{
|
||||
case GCPnts_Linear:
|
||||
myDone = PerformLinear (C, myParams, myPoints, U1, U2);
|
||||
break;
|
||||
case GCPnts_Circular:
|
||||
myDone = PerformCircular (C, myParams, myPoints, Deflection, U1, U2);
|
||||
break;
|
||||
case GCPnts_Curved:
|
||||
myDone = PerformCurve (myParams, myPoints, C, Deflection,
|
||||
U1, U2, EPSILON, WithControl);
|
||||
break;
|
||||
case GCPnts_DefComposite:
|
||||
myDone = PerformComposite (myParams, myPoints, C, Deflection,
|
||||
U1, U2, EPSILON, WithControl);
|
||||
break;
|
||||
}
|
||||
|
||||
// controle des derniers points:
|
||||
Controle (C, myParams, myPoints, U2);
|
||||
}
|
@@ -470,7 +470,7 @@ void GeomPlate_BuildPlateSurface::Perform(const Message_ProgressRange& theProgre
|
||||
//======================================================================
|
||||
// Initial Surface
|
||||
//======================================================================
|
||||
Message_ProgressScope aPS(theProgress, "Calculating the surface filled", 100, Standard_True);
|
||||
Message_ProgressScope aPS(theProgress, NULL, 100, Standard_True);
|
||||
if (!mySurfInitIsGive)
|
||||
{
|
||||
ComputeSurfInit (aPS.Next(10));
|
||||
@@ -1716,8 +1716,7 @@ void GeomPlate_BuildPlateSurface::ComputeSurfInit(const Message_ProgressRange& t
|
||||
//====================================================================
|
||||
// Construction of the surface
|
||||
//====================================================================
|
||||
Message_ProgressScope aPS(theProgress, "ComputeSurfInit", 1);
|
||||
myPlate.SolveTI(2, ComputeAnisotropie(), aPS.Next());
|
||||
myPlate.SolveTI(2, ComputeAnisotropie(), theProgress);
|
||||
if (theProgress.UserBreak())
|
||||
{
|
||||
return;
|
||||
|
@@ -16,7 +16,6 @@
|
||||
#ifndef _Graphic3d_RenderingParams_HeaderFile
|
||||
#define _Graphic3d_RenderingParams_HeaderFile
|
||||
|
||||
#include <Font_Hinting.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_TransformPers.hxx>
|
||||
#include <Graphic3d_RenderTransparentMethod.hxx>
|
||||
@@ -98,8 +97,6 @@ public:
|
||||
: Method (Graphic3d_RM_RASTERIZATION),
|
||||
ShadingModel (Graphic3d_TOSM_FRAGMENT),
|
||||
TransparencyMethod (Graphic3d_RTM_BLEND_UNORDERED),
|
||||
Resolution (THE_DEFAULT_RESOLUTION),
|
||||
FontHinting (Font_Hinting_Off),
|
||||
LineFeather (1.0f),
|
||||
// PBR parameters
|
||||
PbrEnvPow2Size (9),
|
||||
@@ -157,7 +154,9 @@ public:
|
||||
StatsNbFrames (1),
|
||||
StatsMaxChartTime (0.1f),
|
||||
CollectedStats (PerfCounters_Basic),
|
||||
ToShowStats (Standard_False)
|
||||
ToShowStats (Standard_False),
|
||||
//
|
||||
Resolution (THE_DEFAULT_RESOLUTION)
|
||||
{
|
||||
const Graphic3d_Vec4 aZero (0.0f, 0.0f, 0.0f, 0.0f);
|
||||
AnaglyphLeft .SetRow (0, Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f));
|
||||
@@ -182,28 +181,18 @@ public:
|
||||
{
|
||||
return Resolution / static_cast<Standard_ShortReal> (THE_DEFAULT_RESOLUTION);
|
||||
}
|
||||
|
||||
|
||||
//! Dumps the content of me into the stream
|
||||
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
|
||||
|
||||
public: //! @name general parameters
|
||||
public:
|
||||
|
||||
Graphic3d_RenderingMode Method; //!< specifies rendering mode, Graphic3d_RM_RASTERIZATION by default
|
||||
Graphic3d_TypeOfShadingModel ShadingModel; //!< specified default shading model, Graphic3d_TOSM_FRAGMENT by default
|
||||
Graphic3d_RenderTransparentMethod TransparencyMethod; //!< specifies rendering method for transparent graphics
|
||||
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
|
||||
//! (when defined in screen-space units rather than in 3D) to be properly displayed
|
||||
//! on device (screen / printer). 72 is default value.
|
||||
//! Note that using difference resolution in different Views in same Viewer
|
||||
//! will lead to performance regression (for example, text will be recreated every time).
|
||||
Font_Hinting FontHinting; //!< enables/disables text hinting within textured fonts, Font_Hinting_Off by default;
|
||||
//! hinting improves readability of thin text on low-resolution screen,
|
||||
//! but adds distortions to original font depending on font family and font library version
|
||||
Standard_ShortReal LineFeather; //!< line feather width in pixels (> 0.0), 1.0 by default;
|
||||
Standard_ShortReal LineFeather; //!< line feater width in pixels (> 0.0), 1.0 by default;
|
||||
//! high values produce blurred results, small values produce sharp (aliased) edges
|
||||
|
||||
public: //! @name rendering resolution parameters
|
||||
|
||||
Standard_Integer PbrEnvPow2Size; //!< size of IBL maps side can be calculated as 2^PbrEnvPow2Size (> 0), 9 by default
|
||||
Standard_Integer PbrEnvSpecMapNbLevels; //!< number of levels used in specular IBL map (> 1), 6 by default
|
||||
Standard_Integer PbrEnvBakingDiffNbSamples; //!< number of samples used in Monte-Carlo integration during diffuse IBL map's
|
||||
@@ -222,8 +211,6 @@ public: //! @name rendering resolution parameters
|
||||
Standard_Boolean ToEnableDepthPrepass; //!< enables/disables depth pre-pass, False by default
|
||||
Standard_Boolean ToEnableAlphaToCoverage; //!< enables/disables alpha to coverage, True by default
|
||||
|
||||
public: //! @name Ray-Tracing/Path-Tracing parameters
|
||||
|
||||
Standard_Boolean IsGlobalIlluminationEnabled; //!< enables/disables global illumination effects (path tracing)
|
||||
Standard_Integer SamplesPerPixel; //!< number of samples per pixel (SPP)
|
||||
Standard_Integer RaytracingDepth; //!< maximum ray-tracing depth, 3 by default
|
||||
@@ -252,8 +239,6 @@ public: //! @name Ray-Tracing/Path-Tracing parameters
|
||||
Standard_ShortReal Exposure; //!< exposure value used for tone mapping (path tracing), 0.0 by default
|
||||
Standard_ShortReal WhitePoint; //!< white point value used in filmic tone mapping (path tracing), 1.0 by default
|
||||
|
||||
public: //! @name VR / stereoscopic parameters
|
||||
|
||||
Graphic3d_StereoMode StereoMode; //!< stereoscopic output mode, Graphic3d_StereoMode_QuadBuffer by default
|
||||
Standard_ShortReal HmdFov2d; //!< sharp field of view range in degrees for displaying on-screen 2D elements, 30.0 by default;
|
||||
Anaglyph AnaglyphFilter; //!< filter for anaglyph output, Anaglyph_RedCyan_Optimized by default
|
||||
@@ -262,8 +247,6 @@ public: //! @name VR / stereoscopic parameters
|
||||
Standard_Boolean ToReverseStereo; //!< flag to reverse stereo pair, FALSE by default
|
||||
Standard_Boolean ToMirrorComposer; //!< if output device is an external composer - mirror rendering results in window in addition to sending frame to composer, TRUE by default
|
||||
|
||||
public: //! @name on-screen display parameters
|
||||
|
||||
Handle(Graphic3d_TransformPers) StatsPosition; //!< location of stats, upper-left position by default
|
||||
Handle(Graphic3d_TransformPers) ChartPosition; //!< location of stats chart, upper-right position by default
|
||||
Graphic3d_Vec2i ChartSize; //!< chart size in pixels, (-1, -1) by default which means that chart will occupy a portion of viewport
|
||||
@@ -282,6 +265,11 @@ public: //! @name on-screen display parameters
|
||||
//! note that counters specified within CollectedStats will be updated nevertheless
|
||||
//! of visibility of widget managed by ToShowStats flag (e.g. stats can be retrieved by application for displaying using other methods)
|
||||
|
||||
unsigned int Resolution; //!< Pixels density (PPI), defines scaling factor for parameters like text size
|
||||
//! (when defined in screen-space units rather than in 3D) to be properly displayed
|
||||
//! on device (screen / printer). 72 is default value.
|
||||
//! Note that using difference resolution in different Views in same Viewer
|
||||
//! will lead to performance regression (for example, text will be recreated every time).
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_RenderingParams_HeaderFile
|
||||
|
@@ -313,7 +313,7 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
|
||||
{
|
||||
TopLoc_Location L;
|
||||
TopExp_Explorer exface,exedge;
|
||||
Standard_Integer f = 0, i;
|
||||
Standard_Integer f = 0,i,j;
|
||||
Standard_Integer nbFaceShell = 0;
|
||||
Standard_Boolean reversed;
|
||||
Standard_Boolean closed = Standard_False;
|
||||
@@ -450,62 +450,49 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
|
||||
HLRAlgo_Array1OfTData* TData = &pid->TData();
|
||||
HLRAlgo_Array1OfPISeg* PISeg = &pid->PISeg();
|
||||
HLRAlgo_Array1OfPINod* PINod = &pid->PINod();
|
||||
HLRAlgo_TriangleData* NT = &TData->ChangeValue(1);
|
||||
|
||||
for (i = 1; i <= nbT; i++)
|
||||
{
|
||||
const Poly_Triangle& aPolyTri = Tr->Triangle (i);
|
||||
HLRAlgo_TriangleData& aTriData = TData->ChangeValue (i);
|
||||
aTriData.Flags = 0;
|
||||
if (reversed)
|
||||
{
|
||||
aPolyTri.Get (aTriData.Node3, aTriData.Node2, aTriData.Node1);
|
||||
}
|
||||
else
|
||||
{
|
||||
aPolyTri.Get (aTriData.Node1, aTriData.Node2, aTriData.Node3);
|
||||
Tr->Triangle (i).Get (NT->Node1, NT->Node2, NT->Node3);
|
||||
NT->Flags = 0;
|
||||
if (reversed) {
|
||||
j = NT->Node1;
|
||||
NT->Node1 = NT->Node3;
|
||||
NT->Node3 = j;
|
||||
}
|
||||
NT++;
|
||||
}
|
||||
|
||||
for (i = 1; i <= nbN; i++)
|
||||
{
|
||||
const gp_Pnt& aPnt = Tr->Node (i);
|
||||
const Handle(HLRAlgo_PolyInternalNode)& aPolyINode = PINod->ChangeValue (i);
|
||||
HLRAlgo_PolyInternalNode::NodeData& aNod1RValues = aPolyINode->Data();
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices = aPolyINode->Indices();
|
||||
Handle(HLRAlgo_PolyInternalNode)* NN = &PINod->ChangeValue(1);
|
||||
|
||||
for (i = 1; i <= nbN; i++) {
|
||||
HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*NN)->Data();
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices = (*NN)->Indices();
|
||||
aNodIndices.NdSg = 0;
|
||||
aNodIndices.Flag = 0;
|
||||
aNod1RValues.Point = aPnt.XYZ();
|
||||
TTMultiply (aNod1RValues.Point);
|
||||
Nod1RValues.Point = Tr->Node (i).Coord();
|
||||
TTMultiply(Nod1RValues.Point);
|
||||
NN++;
|
||||
}
|
||||
pid->UpdateLinks(TData,PISeg,PINod);
|
||||
if (Tr->HasUVNodes())
|
||||
{
|
||||
const bool hasSurf = BRep_Tool::IsGeometric (F);
|
||||
myBSurf.Initialize (F, Standard_False);
|
||||
for (i = 1; i <= nbN; i++)
|
||||
{
|
||||
const Handle(HLRAlgo_PolyInternalNode)& aPolyINode = PINod->ChangeValue (i);
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices = aPolyINode->Indices();
|
||||
HLRAlgo_PolyInternalNode::NodeData& aNod1RValues = aPolyINode->Data();
|
||||
if (Tr->HasUVNodes())
|
||||
{
|
||||
aNod1RValues.UV = Tr->UVNode (i).XY();
|
||||
}
|
||||
if (Tr->HasNormals())
|
||||
{
|
||||
aNod1RValues.Normal = Tr->Normal (i).XYZ();
|
||||
}
|
||||
|
||||
if ((Tr->HasNormals()
|
||||
|| (hasSurf && Tr->HasUVNodes()))
|
||||
&& Normal (i, aNodIndices, aNod1RValues, TData, PISeg, PINod, Standard_False))
|
||||
{
|
||||
if (Tr->HasUVNodes()) {
|
||||
myBSurf.Initialize(F,Standard_False);
|
||||
NN = &(((HLRAlgo_Array1OfPINod*)PINod)->
|
||||
ChangeValue(1));
|
||||
|
||||
for (i = 1; i <= nbN; i++) {
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& aNodIndices = (*NN)->Indices();
|
||||
HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*NN)->Data();
|
||||
Nod1RValues.UV = Tr->UVNode (i).Coord();
|
||||
if (Normal(i,aNodIndices,Nod1RValues,
|
||||
TData,PISeg,PINod,Standard_False))
|
||||
aNodIndices.Flag |= NMsk_Norm;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
aNodIndices.Flag &= ~NMsk_Norm;
|
||||
aNod1RValues.Scal = 0;
|
||||
Nod1RValues.Scal = 0;
|
||||
}
|
||||
NN++;
|
||||
}
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
@@ -514,14 +501,23 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
|
||||
std::cout << f << " non triangulated" << std::endl;
|
||||
}
|
||||
#endif
|
||||
NT = &(((HLRAlgo_Array1OfTData*)TData)->ChangeValue(1));
|
||||
|
||||
for (i = 1; i <= nbT; i++)
|
||||
{
|
||||
HLRAlgo_TriangleData& aTriData = TData->ChangeValue (i);
|
||||
const Handle(HLRAlgo_PolyInternalNode)& aPN1 = PINod->ChangeValue (aTriData.Node1);
|
||||
const Handle(HLRAlgo_PolyInternalNode)& aPN2 = PINod->ChangeValue (aTriData.Node2);
|
||||
const Handle(HLRAlgo_PolyInternalNode)& aPN3 = PINod->ChangeValue (aTriData.Node3);
|
||||
OrientTriangle (i, aTriData, aPN1->Indices(), aPN1->Data(), aPN2->Indices(), aPN2->Data(), aPN3->Indices(), aPN3->Data());
|
||||
for (i = 1; i <= nbT; i++) {
|
||||
const Handle(HLRAlgo_PolyInternalNode)* PN1 =
|
||||
&PINod->ChangeValue(NT->Node1);
|
||||
const Handle(HLRAlgo_PolyInternalNode)* PN2 =
|
||||
&PINod->ChangeValue(NT->Node2);
|
||||
const Handle(HLRAlgo_PolyInternalNode)* PN3 =
|
||||
&PINod->ChangeValue(NT->Node3);
|
||||
HLRAlgo_PolyInternalNode::NodeData& Nod1RValues = (*PN1)->Data();
|
||||
HLRAlgo_PolyInternalNode::NodeData& Nod2RValues = (*PN2)->Data();
|
||||
HLRAlgo_PolyInternalNode::NodeData& Nod3RValues = (*PN3)->Data();
|
||||
OrientTriangle(i,*NT,
|
||||
(*PN1)->Indices(),Nod1RValues,
|
||||
(*PN2)->Indices(),Nod2RValues,
|
||||
(*PN3)->Indices(),Nod3RValues);
|
||||
NT++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -599,67 +595,61 @@ void HLRBRep_PolyAlgo::StoreShell (const TopoDS_Shape& Shape,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean HLRBRep_PolyAlgo::Normal (const Standard_Integer theNodeIndex,
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& theNodIndices,
|
||||
HLRAlgo_PolyInternalNode::NodeData& theNod1RValues,
|
||||
HLRAlgo_Array1OfTData*& theTriData,
|
||||
HLRAlgo_Array1OfPISeg*& thePISeg,
|
||||
HLRAlgo_Array1OfPINod*& thePINod,
|
||||
const Standard_Boolean theToOrient) const
|
||||
Standard_Boolean HLRBRep_PolyAlgo::
|
||||
Normal (const Standard_Integer iNode,
|
||||
HLRAlgo_PolyInternalNode::NodeIndices& theNodIndices,
|
||||
HLRAlgo_PolyInternalNode::NodeData& Nod1RValues,
|
||||
HLRAlgo_Array1OfTData*& TData,
|
||||
HLRAlgo_Array1OfPISeg*& PISeg,
|
||||
HLRAlgo_Array1OfPINod*& PINod,
|
||||
const Standard_Boolean orient) const
|
||||
{
|
||||
if (theNod1RValues.Normal.SquareModulus() < Precision::Confusion())
|
||||
{
|
||||
gp_Vec aD1U, aD1V;
|
||||
gp_Pnt aPnt;
|
||||
CSLib_DerivativeStatus aStatus = CSLib_D1IsNull;
|
||||
myBSurf.D1 (theNod1RValues.UV.X(), theNod1RValues.UV.Y(), aPnt, aD1U, aD1V);
|
||||
gp_Dir aNorm;
|
||||
CSLib::Normal (aD1U, aD1V, Precision::Angular(), aStatus, aNorm);
|
||||
if (aStatus != CSLib_Done)
|
||||
{
|
||||
gp_Vec aD2U, aD2V, aD2UV;
|
||||
bool isOK = false;
|
||||
CSLib_NormalStatus aNromStatus;
|
||||
myBSurf.D2 (theNod1RValues.UV.X(), theNod1RValues.UV.Y(), aPnt, aD1U, aD1V, aD2U, aD2V, aD2UV);
|
||||
CSLib::Normal (aD1U, aD1V, aD2U, aD2V, aD2UV,
|
||||
Precision::Angular(), isOK, aNromStatus, aNorm);
|
||||
if (!isOK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
theNod1RValues.Normal = aNorm.XYZ();
|
||||
gp_Vec D1U,D1V,D2U,D2V,D2UV;
|
||||
gp_Pnt P;
|
||||
gp_Dir Norma;
|
||||
Standard_Boolean OK;
|
||||
CSLib_DerivativeStatus aStatus;
|
||||
CSLib_NormalStatus NStat;
|
||||
myBSurf.D1(Nod1RValues.UV.X(), Nod1RValues.UV.Y(), P, D1U, D1V);
|
||||
CSLib::Normal(D1U,D1V,Standard_Real(Precision::Angular()),
|
||||
aStatus,Norma);
|
||||
if (aStatus != CSLib_Done) {
|
||||
myBSurf.D2(Nod1RValues.UV.X(), Nod1RValues.UV.Y(), P, D1U, D1V, D2U, D2V, D2UV);
|
||||
CSLib::Normal(D1U,D1V,D2U,D2V,D2UV,
|
||||
Precision::Angular(),OK,NStat,Norma);
|
||||
if (!OK)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Real EyeX = 0;
|
||||
Standard_Real EyeY = 0;
|
||||
Standard_Real EyeZ = -1;
|
||||
if (myProj.Perspective()) {
|
||||
EyeX = Nod1RValues.Point.X();
|
||||
EyeY = Nod1RValues.Point.Y();
|
||||
EyeZ = Nod1RValues.Point.Z() - myProj.Focus();
|
||||
Standard_Real d = sqrt(EyeX * EyeX + EyeY * EyeY + EyeZ * EyeZ);
|
||||
if (d > 0) {
|
||||
EyeX /= d;
|
||||
EyeY /= d;
|
||||
EyeZ /= d;
|
||||
}
|
||||
}
|
||||
Nod1RValues.Normal = Norma.XYZ();
|
||||
// TMultiply(Nod1NrmX,Nod1NrmY,Nod1NrmZ);
|
||||
TMultiply (theNod1RValues.Normal, myProj.Perspective()); //OCC349
|
||||
|
||||
gp_XYZ anAverNorm;
|
||||
if (AverageNormal (theNodeIndex, theNodIndices, theTriData, thePISeg, thePINod, anAverNorm))
|
||||
TMultiply(Nod1RValues.Normal,myProj.Perspective()); //OCC349
|
||||
gp_XYZ Norm;
|
||||
|
||||
if (AverageNormal(iNode,theNodIndices,TData,PISeg,PINod,Norm))
|
||||
{
|
||||
if (theNod1RValues.Normal * anAverNorm < 0)
|
||||
if (Nod1RValues.Normal * Norm < 0)
|
||||
{
|
||||
theNod1RValues.Normal.Reverse();
|
||||
Nod1RValues.Normal.Reverse();
|
||||
}
|
||||
|
||||
gp_XYZ anEyeDir (0.0, 0.0, -1.0);
|
||||
if (myProj.Perspective())
|
||||
{
|
||||
anEyeDir.SetCoord (theNod1RValues.Point.X(),
|
||||
theNod1RValues.Point.Y(),
|
||||
theNod1RValues.Point.Z() - myProj.Focus());
|
||||
const Standard_Real anEyeMod = anEyeDir.Modulus();
|
||||
if (anEyeMod > 0.0)
|
||||
{
|
||||
anEyeDir /= anEyeMod;
|
||||
}
|
||||
}
|
||||
theNod1RValues.Scal = (theNod1RValues.Normal * anEyeDir);
|
||||
Nod1RValues.Scal = (Nod1RValues.Normal * gp_XYZ(EyeX, EyeY, EyeZ));
|
||||
}
|
||||
else
|
||||
{
|
||||
theNod1RValues.Scal = 0;
|
||||
theNod1RValues.Normal = gp_XYZ(1., 0., 0.);
|
||||
else {
|
||||
Nod1RValues.Scal = 0;
|
||||
Nod1RValues.Normal = gp_XYZ(1., 0., 0.);
|
||||
#ifdef OCCT_DEBUG
|
||||
if (DoError) {
|
||||
std::cout << "HLRBRep_PolyAlgo::Normal : AverageNormal error";
|
||||
@@ -667,27 +657,20 @@ Standard_Boolean HLRBRep_PolyAlgo::Normal (const Standard_Integer theNodeIndex,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (theNod1RValues.Scal > 0)
|
||||
{
|
||||
if ( theNod1RValues.Scal < myTolAngular)
|
||||
{
|
||||
theNod1RValues.Scal = 0;
|
||||
if (Nod1RValues.Scal > 0) {
|
||||
if ( Nod1RValues.Scal < myTolAngular) {
|
||||
Nod1RValues.Scal = 0;
|
||||
theNodIndices.Flag |= NMsk_OutL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-theNod1RValues.Scal < myTolAngular)
|
||||
{
|
||||
theNod1RValues.Scal = 0;
|
||||
else {
|
||||
if (-Nod1RValues.Scal < myTolAngular) {
|
||||
Nod1RValues.Scal = 0;
|
||||
theNodIndices.Flag |= NMsk_OutL;
|
||||
}
|
||||
}
|
||||
|
||||
if (theToOrient)
|
||||
{
|
||||
UpdateAroundNode (theNodeIndex, theNodIndices, theTriData, thePISeg, thePINod);
|
||||
}
|
||||
if (orient) UpdateAroundNode(iNode,theNodIndices,
|
||||
TData,PISeg,PINod);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -2121,22 +2104,10 @@ HLRBRep_PolyAlgo::InsertOnOutLine (TColStd_Array1OfTransient& PID)
|
||||
insP3 = NewNode(Nod1RValues,Nod2RValues,coef3,mP3P1);
|
||||
if (insP3) {
|
||||
UVNode(Nod1RValues,Nod2RValues,coef3,U3,V3);
|
||||
if (!myGSurf.IsNull())
|
||||
{
|
||||
const gp_Pnt aPT3 = myGSurf->Value(U3,V3);
|
||||
X3 = aPT3.X();
|
||||
Y3 = aPT3.Y();
|
||||
Z3 = aPT3.Z();
|
||||
}
|
||||
else
|
||||
{
|
||||
// simple averaging - this could be improved
|
||||
const Standard_Real aCoef2 = 1.0 - coef3;
|
||||
const gp_Pnt aPT3 = aCoef2 * Nod1RValues.Point + coef3 * Nod2RValues.Point;
|
||||
X3 = aPT3.X();
|
||||
Y3 = aPT3.Y();
|
||||
Z3 = aPT3.Z();
|
||||
}
|
||||
const gp_Pnt& PT3 = myGSurf->Value(U3,V3);
|
||||
X3 = PT3.X();
|
||||
Y3 = PT3.Y();
|
||||
Z3 = PT3.Z();
|
||||
TTMultiply(X3,Y3,Z3);
|
||||
}
|
||||
|
||||
|
@@ -193,7 +193,7 @@ static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
|
||||
GTranslate2d = Standard_False;
|
||||
|
||||
if (GTranslate3d && GTranslate2d) {
|
||||
//Setting preference in the case of inconsistency between 3D and 2D
|
||||
//Setting preference in the case of inconsitency between 3D and 2D
|
||||
if (surfcurv == 2) Preferred3d = Standard_False;
|
||||
else if (surfcurv == 3) Preferred2d = Standard_False;
|
||||
else if (myfilepreference == 2) Preferred3d = Standard_False;
|
||||
|
@@ -108,7 +108,7 @@ public:
|
||||
Standard_EXPORT gp_Dir TransformedAxis() const;
|
||||
|
||||
//! Returns a Definition computed from equation, easier to use
|
||||
//! <Center> : the center of the conic (meaningless for
|
||||
//! <Center> : the center of the the conic (meaningless for
|
||||
//! a parabola) (defined with Z displacement)
|
||||
//! <MainAxis> : the Main Axis of the conic (for a Circle,
|
||||
//! arbitrary the X Axis)
|
||||
|
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
//! Sets Main Format to a new value
|
||||
//! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
|
||||
//! independent
|
||||
//! independant
|
||||
Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
|
||||
|
||||
//! Sets Format for Range to a new value with its range of
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
Standard_EXPORT IGESSelect_SelectPCurves(const Standard_Boolean basic);
|
||||
|
||||
//! Explores an entity, to take its contained PCurves
|
||||
//! An independent curve is IGNORED : only faces are explored
|
||||
//! An independant curve is IGNORED : only faces are explored
|
||||
Standard_EXPORT Standard_Boolean Explore (const Standard_Integer level, const Handle(Standard_Transient)& ent, const Interface_Graph& G, Interface_EntityIterator& explored) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns a text defining the criterium : "Basic PCurves" or
|
||||
|
@@ -37,14 +37,14 @@ DEFINE_STANDARD_HANDLE(IGESSelect_SelectSubordinate, IFSelect_SelectExtract)
|
||||
|
||||
//! This selections uses Subordinate Status as sort criterium
|
||||
//! It is an integer number which can be :
|
||||
//! 0 Independent
|
||||
//! 1 Physically Dependent
|
||||
//! 2 Logically Dependent
|
||||
//! 0 Independant
|
||||
//! 1 Physically Dependant
|
||||
//! 2 Logically Dependant
|
||||
//! 3 Both (recorded)
|
||||
//! + to sort :
|
||||
//! 4 : 1 or 3 -> at least Physically
|
||||
//! 5 : 2 or 3 -> at least Logically
|
||||
//! 6 : 1 or 2 or 3 -> any kind of dependence
|
||||
//! 6 : 1 or 2 or 3 -> any kind of dependance
|
||||
//! (corresponds to 0 reversed)
|
||||
class IGESSelect_SelectSubordinate : public IFSelect_SelectExtract
|
||||
{
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
//! Status matching the criterium
|
||||
Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the Selection criterium : "IGES Entity, Independent"
|
||||
//! Returns the Selection criterium : "IGES Entity, Independant"
|
||||
//! etc...
|
||||
Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -172,7 +172,7 @@ IGESToBRep_IGESBoundary::IGESToBRep_IGESBoundary(const IGESToBRep_CurveAndSurfac
|
||||
GTranslate2d = Standard_False;
|
||||
|
||||
if (GTranslate3d && GTranslate2d) {
|
||||
//Setting preference in the case of inconsistency between 3D and 2D
|
||||
//Setting preference in the case of inconsitency between 3D and 2D
|
||||
if (myfilepreference == 2) Preferred3d = Standard_False;
|
||||
else if (myfilepreference == 3) Preferred2d = Standard_False;
|
||||
else Preferred3d = Standard_False;
|
||||
|
@@ -72,7 +72,7 @@ public:
|
||||
//! and may contain pcurves)
|
||||
Handle(ShapeExtend_WireData) WireData3d() const;
|
||||
|
||||
//! Returns the wire from 2D curves (edges contain pcurves
|
||||
//! Returns the the wire from 2D curves (edges contain pcurves
|
||||
//! only)
|
||||
Handle(ShapeExtend_WireData) WireData2d() const;
|
||||
|
||||
|
@@ -16,11 +16,10 @@
|
||||
#ifndef __IVTK_ISHAPEDATA_H__
|
||||
#define __IVTK_ISHAPEDATA_H__
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IVtk_Interface.hxx>
|
||||
#include <IVtk_Types.hxx>
|
||||
#include <NCollection_Vec3.hxx>
|
||||
|
||||
class IVtk_IShapeData;
|
||||
DEFINE_STANDARD_HANDLE( IVtk_IShapeData, IVtk_Interface )
|
||||
|
||||
//! @class IVtk_IShapeData
|
||||
@@ -35,11 +34,11 @@ public:
|
||||
DEFINE_STANDARD_RTTIEXT(IVtk_IShapeData,IVtk_Interface)
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] thePnt point position
|
||||
//! @param [in] theNorm point normal
|
||||
//! @param [in] theX X coordinate
|
||||
//! @param [in] theY Y coordinate
|
||||
//! @param [in] theZ Z coordinate
|
||||
//! @return id of added point
|
||||
virtual IVtk_PointId InsertPoint (const gp_Pnt& thePnt,
|
||||
const NCollection_Vec3<float>& theNorm) = 0;
|
||||
virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) = 0;
|
||||
|
||||
//! Insert a vertex.
|
||||
//! @param [in] theShapeID id of the sub-shape to which the vertex belongs.
|
||||
@@ -78,27 +77,6 @@ public:
|
||||
const IVtk_PointId thePointId2,
|
||||
const IVtk_PointId thePointId3,
|
||||
const IVtk_MeshType theMeshType = MT_Undefined) = 0;
|
||||
|
||||
public:
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] theX X coordinate
|
||||
//! @param [in] theY Y coordinate
|
||||
//! @param [in] theZ Z coordinate
|
||||
//! @return id of added point
|
||||
virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ)
|
||||
{
|
||||
return InsertCoordinate (gp_Pnt (theX, theY, theZ));
|
||||
}
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] thePnt point position
|
||||
//! @return id of added point
|
||||
IVtk_PointId InsertCoordinate (const gp_Pnt& thePnt)
|
||||
{
|
||||
return InsertPoint (thePnt, NCollection_Vec3<float>(0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // __IVTK_ISHAPEDATA_H__
|
||||
|
@@ -17,10 +17,10 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtk_IShapeMesher,IVtk_Interface)
|
||||
|
||||
// ================================================================
|
||||
// Function : initialize
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//! Executes the mesh generation algorithms. To be defined in implementation class.
|
||||
void IVtk_IShapeMesher::initialize (const IVtk_IShape::Handle& theShape,
|
||||
const IVtk_IShapeData::Handle& theData)
|
||||
{
|
||||
@@ -28,10 +28,9 @@ void IVtk_IShapeMesher::initialize (const IVtk_IShape::Handle& theShape,
|
||||
myShapeData = theData;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : Build
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
//! Main entry point for building shape representation
|
||||
//! @param [in] shape IShape to be meshed
|
||||
//! @param [in] data IShapeData interface visualization data is passed to.
|
||||
void IVtk_IShapeMesher::Build (const IVtk_IShape::Handle& theShape,
|
||||
const IVtk_IShapeData::Handle& theData)
|
||||
{
|
||||
|
@@ -31,15 +31,11 @@ public:
|
||||
typedef Handle(IVtk_IShapeMesher) Handle;
|
||||
virtual ~IVtk_IShapeMesher() { }
|
||||
|
||||
//! Main entry point for building shape representation
|
||||
//! @param [in] shape IShape to be meshed
|
||||
//! @param [in] data IShapeData interface visualization data is passed to.
|
||||
Standard_EXPORT void Build (const IVtk_IShape::Handle& theShape, const IVtk_IShapeData::Handle& theData);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IVtk_IShapeMesher,IVtk_Interface)
|
||||
|
||||
protected:
|
||||
//! Executes the mesh generation algorithms. To be defined in implementation class.
|
||||
Standard_EXPORT virtual void initialize (const IVtk_IShape::Handle& theShapeObj,
|
||||
const IVtk_IShapeData::Handle& theShapeData);
|
||||
virtual void internalBuild() = 0;
|
||||
|
@@ -83,6 +83,7 @@
|
||||
#include <Xw_Window.hxx>
|
||||
#include <vtkXRenderWindowInteractor.h>
|
||||
#include <vtkXOpenGLRenderWindow.h>
|
||||
#include <tk.h>
|
||||
#endif
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
@@ -166,22 +167,6 @@ static Handle(PipelinePtr) PipelineByActorName (const TCollection_AsciiString& t
|
||||
return PipelineByActor (anActor);
|
||||
}
|
||||
|
||||
//! Create global presentation attributes.
|
||||
static Handle(Prs3d_Drawer) createDefaultDrawer()
|
||||
{
|
||||
Handle(Prs3d_Drawer) aGlobalDrawer = new Prs3d_Drawer();
|
||||
aGlobalDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||
aGlobalDrawer->SetDeviationCoefficient (0.0001);
|
||||
return aGlobalDrawer;
|
||||
}
|
||||
|
||||
//! Get global presentation attributes (analog of AIS_InteractiveContext::DefaultDrawer()).
|
||||
static const Handle(Prs3d_Drawer)& GetDefaultDrawer()
|
||||
{
|
||||
static Handle(Prs3d_Drawer) aGlobalDrawer = createDefaultDrawer();
|
||||
return aGlobalDrawer;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static Handle(WNT_Window)& GetWindow()
|
||||
@@ -510,106 +495,12 @@ vtkActor* CreateActor (const Standard_Integer theId,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Handle(PipelinePtr) aPL = new PipelinePtr (theShape, theId, GetDefaultDrawer());
|
||||
Handle(PipelinePtr) aPL = new PipelinePtr (theShape, theId);
|
||||
GetPipelines()->Bind (theId, aPL);
|
||||
|
||||
aPL->Actor()->GetProperty()->SetInterpolationToPhong();
|
||||
return aPL->Actor();
|
||||
}
|
||||
|
||||
|
||||
//===============================================================================================
|
||||
//function : VtkDefaults
|
||||
//purpose :
|
||||
//===============================================================================================
|
||||
static int VtkDefaults (Draw_Interpretor& theDi,
|
||||
Standard_Integer theArgsNb,
|
||||
const char** theArgVec)
|
||||
{
|
||||
const Handle(Prs3d_Drawer)& aDefParams = GetDefaultDrawer();
|
||||
if (theArgsNb < 2)
|
||||
{
|
||||
if (aDefParams->TypeOfDeflection() == Aspect_TOD_RELATIVE)
|
||||
{
|
||||
theDi << "DeflType: relative\n"
|
||||
<< "DeviationCoeff: " << aDefParams->DeviationCoefficient() << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
theDi << "DeflType: absolute\n"
|
||||
<< "AbsoluteDeflection: " << aDefParams->MaximalChordialDeviation() << "\n";
|
||||
}
|
||||
theDi << "AngularDeflection: " << (180.0 * aDefParams->DeviationAngle() / M_PI) << "\n";
|
||||
theDi << "AutoTriangulation: " << (aDefParams->IsAutoTriangulation() ? "on" : "off") << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
|
||||
{
|
||||
TCollection_AsciiString anArg (theArgVec[anArgIter]);
|
||||
anArg.UpperCase();
|
||||
if (anArg == "-ABSDEFL"
|
||||
|| anArg == "-ABSOLUTEDEFLECTION"
|
||||
|| anArg == "-DEFL"
|
||||
|| anArg == "-DEFLECTION")
|
||||
{
|
||||
if (++anArgIter >= theArgsNb)
|
||||
{
|
||||
theDi << "Syntax error at " << anArg;
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE);
|
||||
aDefParams->SetMaximalChordialDeviation (Draw::Atof (theArgVec[anArgIter]));
|
||||
}
|
||||
else if (anArg == "-RELDEFL"
|
||||
|| anArg == "-RELATIVEDEFLECTION"
|
||||
|| anArg == "-DEVCOEFF"
|
||||
|| anArg == "-DEVIATIONCOEFF"
|
||||
|| anArg == "-DEVIATIONCOEFFICIENT")
|
||||
{
|
||||
if (++anArgIter >= theArgsNb)
|
||||
{
|
||||
theDi << "Syntax error at " << anArg;
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||
aDefParams->SetDeviationCoefficient (Draw::Atof (theArgVec[anArgIter]));
|
||||
}
|
||||
else if (anArg == "-ANGDEFL"
|
||||
|| anArg == "-ANGULARDEFL"
|
||||
|| anArg == "-ANGULARDEFLECTION")
|
||||
{
|
||||
if (++anArgIter >= theArgsNb)
|
||||
{
|
||||
theDi << "Syntax error at " << anArg;
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetDeviationAngle (M_PI * Draw::Atof (theArgVec[anArgIter]) / 180.0);
|
||||
}
|
||||
else if (anArg == "-AUTOTR"
|
||||
|| anArg == "-AUTOTRIANG"
|
||||
|| anArg == "-AUTOTRIANGULATION")
|
||||
{
|
||||
++anArgIter;
|
||||
bool toTurnOn = true;
|
||||
if (anArgIter >= theArgsNb
|
||||
|| !Draw::ParseOnOff (theArgVec[anArgIter], toTurnOn))
|
||||
{
|
||||
theDi << "Syntax error at '" << anArg << "'";
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetAutoTriangulation (toTurnOn);
|
||||
}
|
||||
else
|
||||
{
|
||||
theDi << "Syntax error: unknown argument '" << anArg << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : VtkDisplay
|
||||
// Purpose :
|
||||
@@ -828,159 +719,158 @@ static Standard_Integer VtkRemove (Draw_Interpretor& ,
|
||||
|
||||
//================================================================
|
||||
// Function : VtkSetDisplayMode
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
// Draw args : ivtksetdispmode [name] mode(0,1)
|
||||
//================================================================
|
||||
static Standard_Integer VtkSetDisplayMode (Draw_Interpretor& theDI,
|
||||
static Standard_Integer VtkSetDisplayMode (Draw_Interpretor& ,
|
||||
Standard_Integer theArgNum,
|
||||
const char** theArgs)
|
||||
{
|
||||
if (!GetInteractor()
|
||||
|| !GetInteractor()->IsEnabled())
|
||||
{
|
||||
theDI << "Error: call ivtkinit before";
|
||||
Message::SendFail() << "Error: call ivtkinit before";
|
||||
return 1;
|
||||
}
|
||||
else if (theArgNum != 2 && theArgNum != 3)
|
||||
{
|
||||
Message::SendFail() << "Syntax error: expects 1 or 2 arguments";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer aDispMode = -1;
|
||||
Standard_Integer isFaceBoundaryDraw = -1, isSmoothShading = -1;
|
||||
Graphic3d_TypeOfShadingModel aShadingModel = Graphic3d_TOSM_DEFAULT;
|
||||
NCollection_Sequence< vtkSmartPointer<vtkActor> > anActors;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgNum; ++anArgIter)
|
||||
if (theArgNum == 2)
|
||||
{
|
||||
TCollection_AsciiString anArgCase (theArgs[anArgIter]);
|
||||
anArgCase.LowerCase();
|
||||
if (anArgCase == "-faceboundarydraw"
|
||||
|| anArgCase == "-drawfaceboundary"
|
||||
|| anArgCase == "-faceboundary")
|
||||
// Set disp mode for all objects
|
||||
Standard_Integer aMode = Draw::Atoi (theArgs[1]); // Get mode
|
||||
DoubleMapOfActorsAndNames::Iterator anIter (GetMapOfActors());
|
||||
while (anIter.More())
|
||||
{
|
||||
bool toDraw = Draw::ParseOnOffNoIterator (theArgNum, theArgs, anArgIter);
|
||||
isFaceBoundaryDraw = toDraw ? 1 : 0;
|
||||
}
|
||||
else if (anArgCase == "-smoothshading"
|
||||
|| anArgCase == "-smooth")
|
||||
{
|
||||
bool toEnable = Draw::ParseOnOffNoIterator (theArgNum, theArgs, anArgIter);
|
||||
isSmoothShading = toEnable ? 1 : 0;
|
||||
}
|
||||
else if (anArgIter + 1 < theArgNum
|
||||
&& (anArgCase == "-shadingmodel"))
|
||||
{
|
||||
TCollection_AsciiString aModelName (theArgs[++anArgIter]);
|
||||
aModelName.LowerCase();
|
||||
if (aModelName == "fragment"
|
||||
|| aModelName == "frag"
|
||||
|| aModelName == "phong")
|
||||
vtkSmartPointer<vtkActor> anActor = anIter.Key1();
|
||||
IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
aShadingModel = Graphic3d_TOSM_FRAGMENT;
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline ( anOccShape->GetId() )->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode((IVtk_DisplayMode)aMode);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
else if (aModelName == "vertex"
|
||||
|| aModelName == "vert"
|
||||
|| aModelName == "gouraud")
|
||||
{
|
||||
aShadingModel = Graphic3d_TOSM_VERTEX;
|
||||
}
|
||||
else if (aModelName == "facet"
|
||||
|| aModelName == "flat")
|
||||
{
|
||||
aShadingModel = Graphic3d_TOSM_FACET;
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << "Syntax error: unknown shading model '" << theArgs[anArgIter] << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (aDispMode == -1
|
||||
&& (anArgCase == "0"
|
||||
|| anArgCase == "1"))
|
||||
{
|
||||
aDispMode = Draw::Atoi (theArgs[anArgIter]);
|
||||
}
|
||||
else if (aDispMode == -1
|
||||
&& (anArgCase == "-shaded"
|
||||
|| anArgCase == "-shading"))
|
||||
{
|
||||
aDispMode = DM_Shading;
|
||||
}
|
||||
else if (aDispMode == -1
|
||||
&& anArgCase == "-wireframe")
|
||||
{
|
||||
aDispMode = DM_Wireframe;
|
||||
}
|
||||
else
|
||||
{
|
||||
TCollection_AsciiString aName = theArgs[anArgIter];
|
||||
vtkSmartPointer<vtkActor> anActor;
|
||||
if (!GetMapOfActors().Find2 (aName, anActor))
|
||||
{
|
||||
theDI << "Syntax error: object '" << aName << "' not found";
|
||||
return 1;
|
||||
}
|
||||
anActors.Append (anActor);
|
||||
anIter.Next();
|
||||
}
|
||||
}
|
||||
if (aDispMode == -1)
|
||||
// Set disp mode for named object
|
||||
else
|
||||
{
|
||||
theDI << "Syntax error: wrong number of arguments";
|
||||
TCollection_AsciiString aName = theArgs[1];
|
||||
vtkSmartPointer<vtkActor> anActor;
|
||||
if (!GetMapOfActors().Find2 (aName, anActor))
|
||||
{
|
||||
Message::SendFail() << "Syntax error: object '" << aName << "' not found";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer aMode = atoi(theArgs[2]);
|
||||
vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline (anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode ((IVtk_DisplayMode)aMode);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redraw window
|
||||
GetInteractor()->Render();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : VtkSetBoundaryDraw
|
||||
// Purpose :
|
||||
//================================================================
|
||||
static Standard_Integer VtkSetBoundaryDraw (Draw_Interpretor& ,
|
||||
Standard_Integer theArgNum,
|
||||
const char** theArgs)
|
||||
{
|
||||
if (!GetInteractor()
|
||||
|| !GetInteractor()->IsEnabled())
|
||||
{
|
||||
Message::SendFail() << "Error: call ivtkinit before";
|
||||
return 1;
|
||||
}
|
||||
else if (theArgNum != 2 && theArgNum != 3)
|
||||
{
|
||||
Message::SendFail() << "Syntax error: expects 1 or 2 arguments";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (anActors.IsEmpty())
|
||||
if (theArgNum == 2)
|
||||
{
|
||||
// update all objects
|
||||
for (DoubleMapOfActorsAndNames::Iterator anIter (GetMapOfActors()); anIter.More(); anIter.Next())
|
||||
// Set disp mode for all objects
|
||||
Standard_Boolean toDraw = true;
|
||||
Draw::ParseOnOff (theArgs[1], toDraw);
|
||||
DoubleMapOfActorsAndNames::Iterator anIter(GetMapOfActors());
|
||||
while (anIter.More())
|
||||
{
|
||||
anActors.Append (anIter.Key1());
|
||||
vtkSmartPointer<vtkActor> anActor = anIter.Key1();
|
||||
// Set Red color for boundary edges
|
||||
vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
|
||||
IVtkTools::SetLookupTableColor(aTable, MT_SharedEdge, 1., 0., 0., 1.);
|
||||
|
||||
IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource(anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline(anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode(DM_Shading);
|
||||
aFilter->SetFaceBoundaryDraw(toDraw != 0);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
anIter.Next();
|
||||
}
|
||||
}
|
||||
|
||||
for (NCollection_Sequence< vtkSmartPointer<vtkActor> >::Iterator anActorIter (anActors); anActorIter.More(); anActorIter.Next())
|
||||
else
|
||||
{
|
||||
vtkSmartPointer<vtkActor> anActor = anActorIter.Value();
|
||||
IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc == NULL)
|
||||
// Set disp mode for named object
|
||||
TCollection_AsciiString aName = theArgs[1];
|
||||
vtkSmartPointer<vtkActor> anActor;
|
||||
if (!GetMapOfActors().Find2 (aName, anActor))
|
||||
{
|
||||
continue;
|
||||
Message::SendFail() << "Syntax error: object '" << aName << "' not found";
|
||||
return 1;
|
||||
}
|
||||
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline ( anOccShape->GetId() )->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode ((IVtk_DisplayMode)aDispMode);
|
||||
if (isFaceBoundaryDraw != -1)
|
||||
{
|
||||
// Set Red color for boundary edges
|
||||
vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
|
||||
IVtkTools::SetLookupTableColor (aTable, MT_SharedEdge, 1., 0., 0., 1.);
|
||||
aFilter->SetFaceBoundaryDraw (isFaceBoundaryDraw == 1);
|
||||
}
|
||||
if (isSmoothShading != -1)
|
||||
{
|
||||
aFilter->SetSmoothShading (isSmoothShading == 1);
|
||||
}
|
||||
switch (aShadingModel)
|
||||
{
|
||||
case Graphic3d_TOSM_FACET:
|
||||
{
|
||||
anActor->GetProperty()->SetInterpolationToFlat();
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOSM_VERTEX:
|
||||
{
|
||||
anActor->GetProperty()->SetInterpolationToGouraud();
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOSM_FRAGMENT:
|
||||
{
|
||||
anActor->GetProperty()->SetInterpolationToPhong();
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
Standard_Boolean toDraw = true;
|
||||
Draw::ParseOnOff (theArgs[2], toDraw);
|
||||
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
// Set Red color for boundary edges
|
||||
vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
|
||||
IVtkTools::SetLookupTableColor (aTable, MT_SharedEdge, 1., 0., 0., 1.);
|
||||
|
||||
vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline (anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode (DM_Shading);
|
||||
aFilter->SetFaceBoundaryDraw (toDraw != 0);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1619,14 +1509,6 @@ void IVtkDraw::Commands (Draw_Interpretor& theCommands)
|
||||
"ivtkclose : Closes the Vtk window.",
|
||||
__FILE__, VtkClose, group);
|
||||
|
||||
theCommands.Add("ivtkdefaults",
|
||||
"ivtkdefaults [-absDefl value]"
|
||||
"\n\t\t: [-devCoeff value]"
|
||||
"\n\t\t: [-angDefl value]"
|
||||
"\n\t\t: [-autoTriang {off/on | 0/1}]"
|
||||
"\n\t\t: Sets default VTK meshing parameters."
|
||||
, __FILE__, VtkDefaults, group);
|
||||
|
||||
theCommands.Add("ivtkrenderparams",
|
||||
"ivtkrenderparams [-depthPeeling NbLayers] [-shadows {on|off}]"
|
||||
"\n\t\t: Sets Vtk rendering parameters."
|
||||
@@ -1656,14 +1538,16 @@ void IVtkDraw::Commands (Draw_Interpretor& theCommands)
|
||||
__FILE__, VtkRemove, group);
|
||||
|
||||
theCommands.Add("ivtksetdispmode",
|
||||
"ivtksetdispmode [name] mode={0|1} [-faceBoundaryDraw {0|1}] [-smoothShading {0|1}]"
|
||||
"\n\t\t: [-shadingModel {phong|gouraud|flat}]"
|
||||
"\n\t\t: Sets or unsets display mode to the object with the given name or to all objects."
|
||||
"\n\t\t: -faceBoundaryDraw show/hide boundaries within shading display mode"
|
||||
"\n\t\t: -smoothShading enable/disable vertex normals for smooth shading"
|
||||
"\n\t\t: -shadingModel sets specified shading model",
|
||||
"ivtksetdispmode [name] mode={0|1}"
|
||||
"\n\t\t: Sets or unsets display mode 'mode' to the object with name 'name' or to all objects.",
|
||||
__FILE__, VtkSetDisplayMode, group);
|
||||
|
||||
theCommands.Add("ivtksetboundingdraw",
|
||||
"ivtksetboundingdraw [name] {on|off}"
|
||||
"\n\t\t: Sets or unsets boundaries drawing for shading display mode"
|
||||
"\n\t\t: to the object with name 'name' or to all objects.",
|
||||
__FILE__, VtkSetBoundaryDraw, group);
|
||||
|
||||
theCommands.Add("ivtksetselmode",
|
||||
"ivtksetselmode [name] mode {on|off}"
|
||||
"\n\t\t: Sets or unsets selection mode 'mode' to the object with name 'name'"
|
||||
|
@@ -39,8 +39,7 @@ IMPLEMENT_STANDARD_RTTIEXT(IVtkDraw_HighlightAndSelectionPipeline,Standard_Trans
|
||||
//===========================================================
|
||||
|
||||
IVtkDraw_HighlightAndSelectionPipeline::IVtkDraw_HighlightAndSelectionPipeline (const TopoDS_Shape& theShape,
|
||||
const Standard_Integer theShapeID,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink)
|
||||
const Standard_Integer theShapeID)
|
||||
: Standard_Transient()
|
||||
{
|
||||
/* ===========================
|
||||
@@ -58,7 +57,7 @@ IVtkDraw_HighlightAndSelectionPipeline::IVtkDraw_HighlightAndSelectionPipeline (
|
||||
* ======================== */
|
||||
|
||||
myActor = vtkSmartPointer<vtkActor>::New();
|
||||
IVtkOCC_Shape::Handle anIVtkShape = new IVtkOCC_Shape (theShape, theDrawerLink);
|
||||
IVtkOCC_Shape::Handle anIVtkShape = new IVtkOCC_Shape (theShape);
|
||||
anIVtkShape->SetId (theShapeID);
|
||||
vtkSmartPointer<IVtkTools_ShapeDataSource> aDataSource = vtkSmartPointer<IVtkTools_ShapeDataSource>::New();
|
||||
aDataSource->SetShape (anIVtkShape);
|
||||
|
@@ -37,8 +37,6 @@
|
||||
typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_DisplayModeFilter> > DisplayModeFiltersMap;
|
||||
typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_SubPolyDataFilter> > SubShapesFiltersMap;
|
||||
|
||||
class Prs3d_Drawer;
|
||||
|
||||
class IVtkDraw_HighlightAndSelectionPipeline;
|
||||
DEFINE_STANDARD_HANDLE(IVtkDraw_HighlightAndSelectionPipeline, Standard_Transient)
|
||||
|
||||
@@ -63,8 +61,7 @@ public:
|
||||
public:
|
||||
|
||||
IVtkDraw_HighlightAndSelectionPipeline (const TopoDS_Shape& theShape,
|
||||
const Standard_Integer theShapeID,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink);
|
||||
const Standard_Integer theShapeID);
|
||||
~IVtkDraw_HighlightAndSelectionPipeline() {}
|
||||
|
||||
public:
|
||||
|
@@ -202,8 +202,13 @@ void IVtkDraw_Interactor::Enable()
|
||||
SetWindowLongPtr(this->myWindowId, GWLP_USERDATA, (LONG_PTR)this);
|
||||
SetWindowLongPtr(this->myWindowId, GWLP_WNDPROC, (LONG_PTR)WndProc);
|
||||
#else
|
||||
Tcl_CreateFileHandler (ConnectionNumber(this->myDisplayId),
|
||||
TCL_READABLE, ProcessEvents, (ClientData) this);
|
||||
#if TCL_MAJOR_VERSION < 8
|
||||
Tk_CreateFileHandler((void*)ConnectionNumber(this->myDisplayId),
|
||||
TK_READABLE, ProcessEvents, (ClientData) this);
|
||||
#else
|
||||
Tk_CreateFileHandler(ConnectionNumber(this->myDisplayId),
|
||||
TK_READABLE, ProcessEvents, (ClientData) this);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
this->Enabled = 1;
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
@@ -28,9 +27,12 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_SelectableObject,SelectMgr_SelectableObject)
|
||||
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Method: Constructor
|
||||
// Purpose:
|
||||
// Purpose: Constructs a selectable object initialized by the given shape
|
||||
//============================================================================
|
||||
IVtkOCC_SelectableObject::IVtkOCC_SelectableObject (const IVtkOCC_Shape::Handle& theShape)
|
||||
: SelectMgr_SelectableObject (PrsMgr_TOP_AllView),
|
||||
@@ -40,35 +42,37 @@ IVtkOCC_SelectableObject::IVtkOCC_SelectableObject (const IVtkOCC_Shape::Handle&
|
||||
{
|
||||
myShape->SetSelectableObject (this);
|
||||
}
|
||||
|
||||
// Minor stuff - but it facilitates usage of OCCT selection
|
||||
// classes dealing with deflection, see ComputeSelection() below
|
||||
myOCCTDrawer = new Prs3d_Drawer();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: Constructor
|
||||
// Purpose:
|
||||
// Purpose: Constructs uninitialized selectable object.
|
||||
// setShape() should be called later.
|
||||
//============================================================================
|
||||
IVtkOCC_SelectableObject::IVtkOCC_SelectableObject()
|
||||
: SelectMgr_SelectableObject (PrsMgr_TOP_AllView)
|
||||
{
|
||||
//
|
||||
}
|
||||
: SelectMgr_SelectableObject (PrsMgr_TOP_AllView),
|
||||
myShape (0)
|
||||
{ }
|
||||
|
||||
//============================================================================
|
||||
// Method: Destructor
|
||||
// Purpose:
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
IVtkOCC_SelectableObject::~IVtkOCC_SelectableObject()
|
||||
{
|
||||
//
|
||||
}
|
||||
{ }
|
||||
|
||||
//============================================================================
|
||||
// Method: SetShape
|
||||
// Purpose:
|
||||
// Purpose: Sets the selectable shape
|
||||
//============================================================================
|
||||
void IVtkOCC_SelectableObject::SetShape (const IVtkOCC_Shape::Handle& theShape)
|
||||
{
|
||||
myShape = theShape;
|
||||
if (!myShape.IsNull())
|
||||
if (! myShape.IsNull())
|
||||
{
|
||||
myShape->SetSelectableObject (this);
|
||||
}
|
||||
@@ -80,7 +84,7 @@ void IVtkOCC_SelectableObject::SetShape (const IVtkOCC_Shape::Handle& theShape)
|
||||
|
||||
//============================================================================
|
||||
// Method: ComputeSelection
|
||||
// Purpose:
|
||||
// Purpose: Internal method, computes selection data for viewer selector
|
||||
//============================================================================
|
||||
void IVtkOCC_SelectableObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
@@ -90,17 +94,33 @@ void IVtkOCC_SelectableObject::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
return;
|
||||
}
|
||||
|
||||
const TopoDS_Shape& anOcctShape = myShape->GetShape();
|
||||
if (anOcctShape.ShapeType() == TopAbs_COMPOUND
|
||||
&& anOcctShape.NbChildren() == 0)
|
||||
TopoDS_Shape anOcctShape = myShape->GetShape();
|
||||
|
||||
if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
|
||||
{
|
||||
// Shape empty -> go away
|
||||
return;
|
||||
}
|
||||
|
||||
const TopAbs_ShapeEnum aTypeOfSel = AIS_Shape::SelectionType (theMode);
|
||||
const Handle(Prs3d_Drawer)& aDrawer = myShape->Attributes();
|
||||
const Standard_Real aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (anOcctShape, aDrawer);
|
||||
TopAbs_ShapeEnum aTypeOfSel = AIS_Shape::SelectionType (theMode);
|
||||
|
||||
Standard_Real aDeflection = myOCCTDrawer->MaximalChordialDeviation();
|
||||
if (myOCCTDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
|
||||
{
|
||||
Bnd_Box aBndBox;
|
||||
BRepBndLib::Add (anOcctShape, aBndBox);
|
||||
if (!aBndBox.IsVoid())
|
||||
{
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
aBndBox.Get (aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
aDeflection = Max (aXmax - aXmin, Max (aYmax - aYmin, aZmax - aZmin)) *
|
||||
myOCCTDrawer->DeviationCoefficient();
|
||||
}
|
||||
}
|
||||
|
||||
// Assume the shape has been displayed already -> triangulation should exist
|
||||
Standard_Boolean isAutoTriangulation = Standard_False;
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
@@ -109,8 +129,8 @@ void IVtkOCC_SelectableObject::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
anOcctShape,
|
||||
aTypeOfSel,
|
||||
aDeflection,
|
||||
aDrawer->DeviationAngle(),
|
||||
aDrawer->IsAutoTriangulation());
|
||||
myOCCTDrawer->DeviationAngle(),
|
||||
isAutoTriangulation);
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
@@ -138,7 +158,8 @@ const Bnd_Box& IVtkOCC_SelectableObject::BoundingBox()
|
||||
return myBndBox;
|
||||
}
|
||||
|
||||
const TopoDS_Shape& anOcctShape = myShape->GetShape();
|
||||
TopoDS_Shape anOcctShape = myShape->GetShape();
|
||||
|
||||
if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
|
||||
{
|
||||
// Shape empty -> nothing to do
|
||||
|
@@ -73,6 +73,7 @@ private:
|
||||
private:
|
||||
IVtkOCC_Shape::Handle myShape;
|
||||
Bnd_Box myBndBox;
|
||||
Handle(Prs3d_Drawer) myOCCTDrawer;
|
||||
};
|
||||
|
||||
#endif // __IVTKOCC_SELECTABLEOBJECT_H__
|
||||
|
@@ -14,29 +14,20 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IVtkOCC_Shape.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_Shape,IVtk_IShape)
|
||||
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Method: Constructor
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
IVtkOCC_Shape::IVtkOCC_Shape (const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink)
|
||||
: myTopoDSShape (theShape),
|
||||
myOCCTDrawer (new Prs3d_Drawer())
|
||||
IVtkOCC_Shape::IVtkOCC_Shape (const TopoDS_Shape& theShape)
|
||||
: myTopoDSShape (theShape)
|
||||
{
|
||||
if (!theDrawerLink.IsNull())
|
||||
{
|
||||
myOCCTDrawer->SetLink (theDrawerLink);
|
||||
}
|
||||
else
|
||||
{
|
||||
// these old defaults have been moved from IVtkOCC_ShapeMesher constructor
|
||||
myOCCTDrawer->SetDeviationCoefficient (0.0001); // Aspect_TOD_RELATIVE
|
||||
}
|
||||
buildSubShapeIdMap();
|
||||
}
|
||||
|
||||
@@ -47,24 +38,26 @@ IVtkOCC_Shape::IVtkOCC_Shape (const TopoDS_Shape& theShape,
|
||||
IVtkOCC_Shape::~IVtkOCC_Shape() { }
|
||||
|
||||
//============================================================================
|
||||
// Method: GetSubShapeId
|
||||
// Purpose:
|
||||
// Method: getSubShapeId
|
||||
// Purpose: Returns unique ID of the given sub-shape within the top-level shape.
|
||||
//============================================================================
|
||||
IVtk_IdType IVtkOCC_Shape::GetSubShapeId (const TopoDS_Shape& theSubShape) const
|
||||
{
|
||||
Standard_Integer anIndex = theSubShape.IsSame (myTopoDSShape) ?
|
||||
-1 :
|
||||
mySubShapeIds.FindIndex (theSubShape);
|
||||
if (anIndex == 0) // Not found in the map
|
||||
|
||||
if (!anIndex) // Not found in the map
|
||||
{
|
||||
return (IVtk_IdType )-1;
|
||||
anIndex = -1;
|
||||
}
|
||||
|
||||
return (IVtk_IdType)anIndex;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: getSubIds
|
||||
// Purpose:
|
||||
// Purpose: Get ids of sub-shapes composing a sub-shape with the given id.
|
||||
//============================================================================
|
||||
IVtk_ShapeIdList IVtkOCC_Shape::GetSubIds (const IVtk_IdType theId) const
|
||||
{
|
||||
@@ -80,7 +73,7 @@ IVtk_ShapeIdList IVtkOCC_Shape::GetSubIds (const IVtk_IdType theId) const
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find all composing vertices, edges and faces of the found sub-shape
|
||||
// Find all composing vertices, edges and faces of the the found sub-shape
|
||||
// and append their ids to the result.
|
||||
TopTools_IndexedMapOfShape aSubShapes;
|
||||
if (aShape.IsSame (myTopoDSShape))
|
||||
|
@@ -32,23 +32,19 @@ public:
|
||||
|
||||
typedef Handle(IVtkOCC_Shape) Handle;
|
||||
|
||||
//! Constructor for OCC IShape implementation.
|
||||
//! @param theShape [in] shape to display
|
||||
//! @param theDrawerLink [in] default attributes to link
|
||||
Standard_EXPORT IVtkOCC_Shape (const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink = Handle(Prs3d_Drawer)());
|
||||
//! Constructor for OCC IShape implementation
|
||||
Standard_EXPORT IVtkOCC_Shape (const TopoDS_Shape& theShape);
|
||||
|
||||
//! Destructor
|
||||
Standard_EXPORT virtual ~IVtkOCC_Shape();
|
||||
|
||||
//! Returns unique ID of the given sub-shape within the top-level shape.
|
||||
Standard_EXPORT IVtk_IdType GetSubShapeId (const IVtk_IShape::Handle&) const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IVtkOCC_Shape,IVtk_IShape)
|
||||
|
||||
//! Get the wrapped original OCCT shape
|
||||
//! @return TopoDS_Shape the wrapped original OCCT shape
|
||||
const TopoDS_Shape& GetShape() const
|
||||
TopoDS_Shape GetShape() const
|
||||
{
|
||||
return myTopoDSShape;
|
||||
}
|
||||
@@ -82,17 +78,11 @@ public:
|
||||
}
|
||||
|
||||
//! @return Handle to the selectable object for this shape.
|
||||
const Handle(SelectMgr_SelectableObject)& GetSelectableObject() const
|
||||
Handle(SelectMgr_SelectableObject) GetSelectableObject() const
|
||||
{
|
||||
return mySelectable;
|
||||
}
|
||||
|
||||
//! Return presentation attributes.
|
||||
const Handle(Prs3d_Drawer)& Attributes() const { return myOCCTDrawer; }
|
||||
|
||||
//! Set presentation attributes.
|
||||
void SetAttributes (const Handle(Prs3d_Drawer)& theDrawer) { myOCCTDrawer = theDrawer; }
|
||||
|
||||
private:
|
||||
//! @brief Build a map of sub-shapes by their IDs
|
||||
//!
|
||||
@@ -104,7 +94,6 @@ private:
|
||||
private:
|
||||
TopTools_IndexedMapOfShape mySubShapeIds; //!< Map of sub-shapes by their IDs
|
||||
TopoDS_Shape myTopoDSShape; //!< The wrapped main OCCT shape
|
||||
Handle(Prs3d_Drawer) myOCCTDrawer; //!< presentation attributes
|
||||
Handle(SelectMgr_SelectableObject) mySelectable; //!< Link to a holder of selection primitives
|
||||
};
|
||||
|
||||
|
@@ -15,71 +15,54 @@
|
||||
|
||||
#include <IVtkOCC_ShapeMesher.hxx>
|
||||
|
||||
#include <Adaptor3d_IsoCurve.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepMesh_DiscretFactory.hxx>
|
||||
#include <BRepMesh_DiscretRoot.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Hatch_Hatcher.hxx>
|
||||
#include <GCPnts_QuasiUniformDeflection.hxx>
|
||||
#include <GCPnts_TangentialDeflection.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <StdPrs_Isolines.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ShapeMesher,IVtk_IShapeMesher)
|
||||
|
||||
//================================================================
|
||||
// Function : IVtkOCC_ShapeMesher
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapeMesher::IVtkOCC_ShapeMesher()
|
||||
{
|
||||
//
|
||||
}
|
||||
// Handle implementation
|
||||
|
||||
//================================================================
|
||||
// Function : ~IVtkOCC_ShapeMesher
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapeMesher::~IVtkOCC_ShapeMesher()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : internalBuild
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::internalBuild()
|
||||
{
|
||||
const TopoDS_Shape& anOcctShape = GetShapeObj()->GetShape();
|
||||
if (anOcctShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Drawer)& anOcctDrawer = GetShapeObj()->Attributes();
|
||||
const Standard_Real aShapeDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (anOcctShape, anOcctDrawer);
|
||||
if (anOcctDrawer->IsAutoTriangulation())
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (anOcctShape, anOcctDrawer, true);
|
||||
StdPrs_ToolTriangulatedShape::Tessellate (anOcctShape, anOcctDrawer);
|
||||
}
|
||||
for (TopExp_Explorer aFaceIter (anOcctShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
TopLoc_Location aLoc;
|
||||
if (const Handle(Poly_Triangulation)& anOcctTriangulation = BRep_Tool::Triangulation (anOcctFace, aLoc))
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ComputeNormals (anOcctFace, anOcctTriangulation);
|
||||
}
|
||||
}
|
||||
// TODO: do we need any protection here so as not to triangualte
|
||||
// the shape twice??? This can be done e.g. by checking if
|
||||
// triangulation exists for TopoDS_Shape..
|
||||
meshShape();
|
||||
|
||||
// Free vertices and free edges should always be shown.
|
||||
// Shared edges are needed in WF representation only.
|
||||
@@ -88,79 +71,83 @@ void IVtkOCC_ShapeMesher::internalBuild()
|
||||
addEdges();
|
||||
|
||||
// Build wireframe points and cells (lines for isolines)
|
||||
for (TopExp_Explorer aFaceIter (anOcctShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
addWFFace (anOcctFace, GetShapeObj()->GetSubShapeId (anOcctFace), aShapeDeflection);
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: addWireFrameFaces() wireframe presentation builder has failed (")
|
||||
+ anException.GetMessageString() + ")");
|
||||
}
|
||||
}
|
||||
addWireFrameFaces();
|
||||
|
||||
// Build shaded representation (based on Poly_Triangulation)
|
||||
for (TopExp_Explorer aFaceIter (anOcctShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
addShadedFace (anOcctFace, GetShapeObj()->GetSubShapeId (anOcctFace));
|
||||
}
|
||||
addShadedFaces();
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetShapeObj
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
const IVtkOCC_Shape::Handle IVtkOCC_ShapeMesher::GetShapeObj() const
|
||||
{
|
||||
return IVtkOCC_Shape::Handle::DownCast(myShapeObj);
|
||||
return (IVtkOCC_Shape::Handle::DownCast(myShapeObj));
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetDeflection
|
||||
// Purpose :
|
||||
// Purpose : Returns absolute deflection used by this algorithm.
|
||||
//================================================================
|
||||
Standard_Real IVtkOCC_ShapeMesher::GetDeflection() const
|
||||
{
|
||||
if (myDeflection < Precision::Confusion()) // if not yet initialized
|
||||
{
|
||||
Handle(Prs3d_Drawer) aDefDrawer = new Prs3d_Drawer();
|
||||
aDefDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||
aDefDrawer->SetDeviationCoefficient (GetDeviationCoeff());
|
||||
myDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (GetShapeObj()->GetShape(), aDefDrawer);
|
||||
}
|
||||
|
||||
return myDeflection;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : meshShape
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::meshShape()
|
||||
{
|
||||
const TopoDS_Shape& anOcctShape = GetShapeObj()->GetShape();
|
||||
return !anOcctShape.IsNull()
|
||||
? StdPrs_ToolTriangulatedShape::GetDeflection (anOcctShape, GetShapeObj()->Attributes())
|
||||
: 0.0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetDeflection
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Real IVtkOCC_ShapeMesher::GetDeviationCoeff() const
|
||||
{
|
||||
if (IVtkOCC_Shape::Handle aShape = GetShapeObj())
|
||||
if (anOcctShape.IsNull())
|
||||
{
|
||||
return aShape->Attributes()->DeviationCoefficient();
|
||||
return;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetDeviationAngle
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Real IVtkOCC_ShapeMesher::GetDeviationAngle() const
|
||||
{
|
||||
if (IVtkOCC_Shape::Handle aShape = GetShapeObj())
|
||||
//Clean triangulation before compute incremental mesh
|
||||
BRepTools::Clean (anOcctShape);
|
||||
|
||||
//Compute triangulation
|
||||
Standard_Real aDeflection = GetDeflection();
|
||||
if (aDeflection < Precision::Confusion())
|
||||
{
|
||||
return aShape->Attributes()->DeviationAngle();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
Handle(BRepMesh_DiscretRoot) anAlgo;
|
||||
anAlgo = BRepMesh_DiscretFactory::Get().Discret (anOcctShape,
|
||||
aDeflection,
|
||||
GetDeviationAngle());
|
||||
if (!anAlgo.IsNull())
|
||||
{
|
||||
anAlgo->Perform();
|
||||
}
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: IVtkOCC_ShapeMesher::meshShape() triangulation builder has failed (")
|
||||
+ anException.GetMessageString() + ")");
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addFreeVertices
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addFreeVertices()
|
||||
{
|
||||
@@ -189,7 +176,7 @@ void IVtkOCC_ShapeMesher::addFreeVertices()
|
||||
|
||||
//================================================================
|
||||
// Function : addEdges
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addEdges()
|
||||
{
|
||||
@@ -226,9 +213,54 @@ void IVtkOCC_ShapeMesher::addEdges()
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addWireFrameFaces
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addWireFrameFaces()
|
||||
{
|
||||
// Check the deflection value once for all faces
|
||||
if (GetDeflection() < Precision::Confusion())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TopExp_Explorer aFaceIter (GetShapeObj()->GetShape(), TopAbs_FACE);
|
||||
for (; aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
addWFFace (anOcctFace,
|
||||
GetShapeObj()->GetSubShapeId (anOcctFace));
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: addWireFrameFaces() wireframe presentation builder has failed (")
|
||||
+ anException.GetMessageString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addShadedFaces
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addShadedFaces()
|
||||
{
|
||||
TopExp_Explorer aFaceIter (GetShapeObj()->GetShape(), TopAbs_FACE);
|
||||
for (; aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
addShadedFace (anOcctFace,
|
||||
GetShapeObj()->GetSubShapeId (anOcctFace));
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addVertex
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addVertex (const TopoDS_Vertex& theVertex,
|
||||
const IVtk_IdType theShapeId,
|
||||
@@ -241,14 +273,53 @@ void IVtkOCC_ShapeMesher::addVertex (const TopoDS_Vertex& theVertex,
|
||||
|
||||
gp_Pnt aPnt3d = BRep_Tool::Pnt (theVertex);
|
||||
|
||||
IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt3d);
|
||||
IVtk_PointId anId =
|
||||
myShapeData->InsertCoordinate (aPnt3d.X(), aPnt3d.Y(), aPnt3d.Z());
|
||||
myShapeData->InsertVertex (theShapeId, anId, theMeshType);
|
||||
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : processPolyline
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::processPolyline (Standard_Integer theNbNodes,
|
||||
const TColgp_Array1OfPnt& thePoints,
|
||||
const TColStd_Array1OfInteger& thePointIds,
|
||||
const IVtk_IdType theOcctId,
|
||||
bool theNoTransform,
|
||||
gp_Trsf theTransformation,
|
||||
const IVtk_MeshType theMeshType)
|
||||
{
|
||||
if (theNbNodes < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IVtk_PointIdList aPolyPointIds;
|
||||
|
||||
IVtk_PointId anId;
|
||||
for (Standard_Integer aJ = 0; aJ < theNbNodes; aJ++)
|
||||
{
|
||||
Standard_Integer aPntId = thePointIds (aJ + 1);
|
||||
gp_Pnt point = thePoints (aPntId);
|
||||
|
||||
if (!theNoTransform)
|
||||
{
|
||||
// Apply the transformation to points
|
||||
point.Transform (theTransformation);
|
||||
}
|
||||
|
||||
anId = myShapeData->InsertCoordinate (point.X(), point.Y(), point.Z());
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
|
||||
myShapeData->InsertLine (theOcctId, &aPolyPointIds, theMeshType);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addEdge
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addEdge (const TopoDS_Edge& theEdge,
|
||||
const IVtk_IdType theShapeId,
|
||||
@@ -259,69 +330,81 @@ void IVtkOCC_ShapeMesher::addEdge (const TopoDS_Edge& theEdge,
|
||||
return;
|
||||
}
|
||||
|
||||
// Two discrete representations of an OCCT edge are possible:
|
||||
// 1. Polygon on trinagulation - holds Ids of points
|
||||
// contained in Poly_Triangulation object
|
||||
Handle(Poly_PolygonOnTriangulation) aPolyOnTriangulation;
|
||||
Handle(Poly_Triangulation) aTriangulation;
|
||||
TopLoc_Location aLoc;
|
||||
BRep_Tool::PolygonOnTriangulation (theEdge, aPolyOnTriangulation, aTriangulation, aLoc, 1);
|
||||
if (!aPolyOnTriangulation.IsNull()
|
||||
&& aPolyOnTriangulation->NbNodes() >= 2)
|
||||
{
|
||||
// prefer polygon on triangulation when defined
|
||||
const gp_Trsf aTrsf = aLoc.Transformation();
|
||||
const bool hasTransform = !aLoc.IsIdentity();
|
||||
TopLoc_Location aLocation;
|
||||
BRep_Tool::PolygonOnTriangulation (theEdge,
|
||||
aPolyOnTriangulation,
|
||||
aTriangulation,
|
||||
aLocation,
|
||||
1);
|
||||
|
||||
// 2. 3D polygon - holds 3D points
|
||||
Handle(Poly_Polygon3D) aPoly3d;
|
||||
if (aPolyOnTriangulation.IsNull())
|
||||
{
|
||||
aPoly3d = BRep_Tool::Polygon3D (theEdge, aLocation);
|
||||
}
|
||||
|
||||
if (aPoly3d.IsNull() && aPolyOnTriangulation.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle a non-identity transofmation applied to the edge
|
||||
gp_Trsf anEdgeTransf;
|
||||
bool noTransform = true;
|
||||
if (!aLocation.IsIdentity())
|
||||
{
|
||||
noTransform = false;
|
||||
anEdgeTransf = aLocation.Transformation();
|
||||
}
|
||||
|
||||
if (!aPoly3d.IsNull())
|
||||
{
|
||||
Standard_Integer aNbNodes = aPoly3d->NbNodes();
|
||||
const TColgp_Array1OfPnt& aPoints = aPoly3d->Nodes();
|
||||
TColStd_Array1OfInteger aPointIds (1, aNbNodes);
|
||||
|
||||
for (Standard_Integer anI = 1; anI <= aNbNodes; anI++)
|
||||
{
|
||||
aPointIds.SetValue (anI, anI);
|
||||
}
|
||||
|
||||
processPolyline (aNbNodes,
|
||||
aPoints,
|
||||
aPointIds,
|
||||
theShapeId,
|
||||
noTransform,
|
||||
anEdgeTransf,
|
||||
theMeshType);
|
||||
}
|
||||
else if (aPolyOnTriangulation->NbNodes() >= 2)
|
||||
{
|
||||
IVtk_PointIdList aPolyPointIds;
|
||||
const Standard_Integer aNbNodes = aPolyOnTriangulation->NbNodes();
|
||||
for (Standard_Integer aJ = 0; aJ < aNbNodes; aJ++)
|
||||
{
|
||||
const Standard_Integer aPntId = aPolyOnTriangulation->Node (aJ + 1);
|
||||
gp_Pnt aPoint = aTriangulation->Node (aPntId);
|
||||
gp_Dir aNorm = aTriangulation->HasNormals() ? aTriangulation->Normal (aPntId) : gp::DZ();
|
||||
if (hasTransform)
|
||||
{
|
||||
aPoint.Transform (aTrsf);
|
||||
aNorm .Transform (aTrsf);
|
||||
}
|
||||
if (!noTransform) { aPoint.Transform (anEdgeTransf); }
|
||||
|
||||
IVtk_PointId anId = myShapeData->InsertPoint (aPoint, Graphic3d_Vec3 ((float )aNorm.X(), (float )aNorm.Y(), (float )aNorm.Z()));
|
||||
IVtk_PointId anId = myShapeData->InsertCoordinate (aPoint.X(), aPoint.Y(), aPoint.Z());
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
myShapeData->InsertLine (theShapeId, &aPolyPointIds, theMeshType);
|
||||
return;
|
||||
}
|
||||
|
||||
// try polygon 3d
|
||||
Handle(Poly_Polygon3D) aPoly3d = BRep_Tool::Polygon3D (theEdge, aLoc);
|
||||
if (aPoly3d.IsNull()
|
||||
|| aPoly3d->NbNodes() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const gp_Trsf anEdgeTransf = aLoc.Transformation();
|
||||
const bool noTransform = aLoc.IsIdentity();
|
||||
IVtk_PointIdList aPolyPointIds;
|
||||
for (Standard_Integer aNodeIter = 1; aNodeIter <= aPoly3d->NbNodes(); ++aNodeIter)
|
||||
{
|
||||
gp_Pnt aPnt = aPoly3d->Nodes().Value (aNodeIter);
|
||||
if (!noTransform)
|
||||
{
|
||||
aPnt.Transform (anEdgeTransf);
|
||||
}
|
||||
|
||||
const IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt);
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
myShapeData->InsertLine (theShapeId, &aPolyPointIds, theMeshType);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addWFFace
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId,
|
||||
const Standard_Real theDeflection)
|
||||
void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId)
|
||||
{
|
||||
if (theFace.IsNull())
|
||||
{
|
||||
@@ -331,6 +414,12 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
TopoDS_Face aFaceToMesh = theFace;
|
||||
aFaceToMesh.Orientation (TopAbs_FORWARD);
|
||||
|
||||
// The code that builds wireframe representation for a TopoDS_Face
|
||||
// has been adapted from some OCCT 6.5.1 methods:
|
||||
// - Prs3d_WFShape::Add()
|
||||
// - StdPrs_WFDeflectionRestrictedFace::Add()
|
||||
// - StdPrs_DeflectionCurve::Add()
|
||||
|
||||
// Add face's edges here but with the face ID
|
||||
for (TopExp_Explorer anEdgeIter (aFaceToMesh, TopAbs_EDGE); anEdgeIter.More(); anEdgeIter.Next())
|
||||
{
|
||||
@@ -345,8 +434,16 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Real aDeflection = GetDeflection();
|
||||
Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
|
||||
aDrawer->SetUIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0f, myNbIsos[0]));
|
||||
aDrawer->SetVIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0f, myNbIsos[1]));
|
||||
aDrawer->SetDeviationAngle (myDevAngle);
|
||||
aDrawer->SetDeviationCoefficient (myDevCoeff);
|
||||
aDrawer->SetMaximalChordialDeviation (aDeflection);
|
||||
|
||||
Prs3d_NListOfSequenceOfPnt aPolylines;
|
||||
StdPrs_Isolines::Add (theFace, GetShapeObj()->Attributes(), theDeflection, aPolylines, aPolylines);
|
||||
StdPrs_Isolines::Add (theFace, aDrawer, aDeflection, aPolylines, aPolylines);
|
||||
for (Prs3d_NListOfSequenceOfPnt::Iterator aPolyIter (aPolylines); aPolyIter.More(); aPolyIter.Next())
|
||||
{
|
||||
const Handle(TColgp_HSequenceOfPnt)& aPoints = aPolyIter.Value();
|
||||
@@ -360,7 +457,7 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
for (TColgp_HSequenceOfPnt::Iterator aNodeIter (*aPoints); aNodeIter.More(); aNodeIter.Next())
|
||||
{
|
||||
const gp_Pnt& aPnt = aNodeIter.Value();
|
||||
const IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt);
|
||||
const IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt.X(), aPnt.Y(), aPnt.Z());
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
|
||||
@@ -370,7 +467,7 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
|
||||
//================================================================
|
||||
// Function : addShadedFace
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addShadedFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId)
|
||||
@@ -380,17 +477,21 @@ void IVtkOCC_ShapeMesher::addShadedFace (const TopoDS_Face& theFace,
|
||||
return;
|
||||
}
|
||||
|
||||
// Build triangulation of the face.
|
||||
TopLoc_Location aLoc;
|
||||
const Handle(Poly_Triangulation)& anOcctTriangulation = BRep_Tool::Triangulation (theFace, aLoc);
|
||||
Handle(Poly_Triangulation) anOcctTriangulation = BRep_Tool::Triangulation (theFace, aLoc);
|
||||
if (anOcctTriangulation.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Determinant of transform matrix less then 0 means that mirror transform applied
|
||||
const gp_Trsf aTrsf = aLoc.Transformation();
|
||||
const bool hasTransform = !aLoc.IsIdentity();
|
||||
const bool isMirrored = aTrsf.VectorialPart().Determinant() < 0;
|
||||
gp_Trsf aPntTransform;
|
||||
Standard_Boolean noTransform = Standard_True;
|
||||
if (!aLoc.IsIdentity())
|
||||
{
|
||||
noTransform = Standard_False;
|
||||
aPntTransform = aLoc.Transformation();
|
||||
}
|
||||
|
||||
// Get triangulation points.
|
||||
Standard_Integer aNbPoints = anOcctTriangulation->NbNodes();
|
||||
@@ -398,40 +499,30 @@ void IVtkOCC_ShapeMesher::addShadedFace (const TopoDS_Face& theFace,
|
||||
// Keep inserted points id's of triangulation in an array.
|
||||
NCollection_Array1<IVtk_PointId> aPointIds (1, aNbPoints);
|
||||
IVtk_PointId anId;
|
||||
for (Standard_Integer anI = 1; anI <= aNbPoints; anI++)
|
||||
|
||||
Standard_Integer anI;
|
||||
for (anI = 1; anI <= aNbPoints; anI++)
|
||||
{
|
||||
gp_Pnt aPoint = anOcctTriangulation->Node (anI);
|
||||
gp_Dir aNorm = anOcctTriangulation->HasNormals() ? anOcctTriangulation->Normal (anI) : gp::DZ();
|
||||
if ((theFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
|
||||
|
||||
if (!noTransform)
|
||||
{
|
||||
aNorm.Reverse();
|
||||
}
|
||||
if (hasTransform)
|
||||
{
|
||||
aPoint.Transform (aTrsf);
|
||||
aNorm .Transform (aTrsf);
|
||||
aPoint.Transform (aPntTransform);
|
||||
}
|
||||
|
||||
// Add a point into output shape data and keep its id in the array.
|
||||
anId = myShapeData->InsertPoint (aPoint, Graphic3d_Vec3 ((float )aNorm.X(), (float )aNorm.Y(), (float )aNorm.Z()));
|
||||
anId = myShapeData->InsertCoordinate (aPoint.X(), aPoint.Y(), aPoint.Z());
|
||||
aPointIds.SetValue (anI, anId);
|
||||
}
|
||||
|
||||
// Create triangles on the created triangulation points.
|
||||
const Standard_Integer aNbTriangles = anOcctTriangulation->NbTriangles();
|
||||
Standard_Integer aNbTriangles = anOcctTriangulation->NbTriangles();
|
||||
Standard_Integer aN1, aN2, aN3;
|
||||
for (Standard_Integer anI = 1; anI <= aNbTriangles; anI++)
|
||||
for (anI = 1; anI <= aNbTriangles; anI++)
|
||||
{
|
||||
if (theFace.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
anOcctTriangulation->Triangle (anI).Get (aN1, aN3, aN2);
|
||||
}
|
||||
else
|
||||
{
|
||||
anOcctTriangulation->Triangle (anI).Get (aN1, aN2, aN3);
|
||||
}
|
||||
|
||||
anOcctTriangulation->Triangle (anI).Get (aN1, aN2, aN3); // get indexes of triangle's points
|
||||
// Insert new triangle on these points into output shape data.
|
||||
myShapeData->InsertTriangle (theShapeId, aPointIds(aN1), aPointIds(aN2), aPointIds(aN3), MT_ShadedFace);
|
||||
myShapeData->InsertTriangle (
|
||||
theShapeId, aPointIds(aN1), aPointIds(aN2), aPointIds(aN3), MT_ShadedFace);
|
||||
}
|
||||
}
|
||||
|
@@ -16,22 +16,24 @@
|
||||
#ifndef __IVTKOCC_SHAPEMESHER_H__
|
||||
#define __IVTKOCC_SHAPEMESHER_H__
|
||||
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <IVtkOCC_Shape.hxx>
|
||||
#include <IVtk_IShapeMesher.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
typedef NCollection_DataMap <TopoDS_Shape, IVtk_MeshType, TopTools_ShapeMapHasher> IVtk_ShapeTypeMap;
|
||||
typedef NCollection_Sequence <gp_Pnt> IVtk_Polyline;
|
||||
typedef NCollection_List <IVtk_Polyline> IVtk_PolylineList;
|
||||
|
||||
class Prs3d_Drawer;
|
||||
|
||||
class IVtkOCC_ShapeMesher;
|
||||
DEFINE_STANDARD_HANDLE( IVtkOCC_ShapeMesher, IVtk_IShapeMesher )
|
||||
|
||||
@@ -45,11 +47,19 @@ DEFINE_STANDARD_HANDLE( IVtkOCC_ShapeMesher, IVtk_IShapeMesher )
|
||||
class IVtkOCC_ShapeMesher : public IVtk_IShapeMesher
|
||||
{
|
||||
public:
|
||||
//! Main constructor.
|
||||
Standard_EXPORT IVtkOCC_ShapeMesher();
|
||||
IVtkOCC_ShapeMesher (const Standard_Real& theDevCoeff = 0.0001,
|
||||
const Standard_Real& theDevAngle = 12.0 * M_PI / 180.0,
|
||||
const Standard_Integer theNbUIsos = 1,
|
||||
const Standard_Integer theNbVIsos = 1)
|
||||
: myDevCoeff (theDevCoeff),
|
||||
myDevAngle (theDevAngle),
|
||||
myDeflection (0.0)
|
||||
{
|
||||
myNbIsos[0] = theNbUIsos;
|
||||
myNbIsos[1] = theNbVIsos;
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~IVtkOCC_ShapeMesher();
|
||||
virtual ~IVtkOCC_ShapeMesher() { }
|
||||
|
||||
//! Returns absolute deflection used by this algorithm.
|
||||
//! This value is calculated on the basis of the shape's bounding box.
|
||||
@@ -61,19 +71,28 @@ public:
|
||||
|
||||
//! Returns relative deviation coefficient used by this algorithm.
|
||||
//! @return relative deviation coefficient
|
||||
Standard_EXPORT Standard_Real GetDeviationCoeff() const;
|
||||
Standard_Real GetDeviationCoeff() const
|
||||
{
|
||||
return myDevCoeff;
|
||||
}
|
||||
|
||||
//! Returns deviation angle used by this algorithm.
|
||||
//! This is the maximum allowed angle between the normals to the
|
||||
//! curve/surface and the normals to polyline/faceted representation.
|
||||
//! @return deviation angle (in radians)
|
||||
Standard_EXPORT Standard_Real GetDeviationAngle() const;
|
||||
Standard_Real GetDeviationAngle() const
|
||||
{
|
||||
return myDevAngle;
|
||||
}
|
||||
|
||||
protected:
|
||||
//! Executes the mesh generation algorithms. To be defined in implementation class.
|
||||
Standard_EXPORT virtual void internalBuild() Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
//! Internal method, generates OCCT triangulation starting from TopoDS_Shape
|
||||
//! @see IVtkOCC_ShapeMesher::addEdge, IVtkOCC_ShapeMesher::addShadedFace
|
||||
void meshShape();
|
||||
|
||||
//! Extracts free vertices from the shape (i.e. those not belonging to any edge)
|
||||
//! and passes the geometry to IPolyData.
|
||||
@@ -83,6 +102,12 @@ private:
|
||||
//! Adds all the edges (free and non-free) to IPolyData.
|
||||
void addEdges();
|
||||
|
||||
//! Adds wireframe representations of all faces to IPolyData.
|
||||
void addWireFrameFaces();
|
||||
|
||||
//! Adds shaded representations of all faces to IPolyData.
|
||||
void addShadedFaces();
|
||||
|
||||
//! Adds the point coordinates, connectivity info and
|
||||
//! sub-shape ID for the OCCT vertex.
|
||||
//!
|
||||
@@ -105,22 +130,33 @@ private:
|
||||
//! Generates wireframe representation of the given TopoDS_Face object
|
||||
//! with help of OCCT algorithms. The resulting polylines are passed to IPolyData
|
||||
//! interface and associated with the given sub-shape ID.
|
||||
//! @param [in] theFace TopoDS_Face object to build wireframe representation for
|
||||
//! @param [in] theShapeId The face' sub-shape ID
|
||||
//! @param [in] theDeflection curve deflection
|
||||
void addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId,
|
||||
const Standard_Real theDeflection);
|
||||
//! @param [in] faceToMesh TopoDS_Face object to build wireframe representation for.
|
||||
//! @param [in] shapeId The face' sub-shape ID
|
||||
void addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId);
|
||||
|
||||
//! Creates shaded representation of the given TopoDS_Face object
|
||||
//! starting from OCCT triangulation that should be created in advance.
|
||||
//! The resulting triangles are passed to IPolyData
|
||||
//! interface and associated with the given sub-shape ID.
|
||||
//! @param [in] theFace TopoDS_Face object to build shaded representation for
|
||||
//! @param [in] theShapeId the face' sub-shape ID
|
||||
//! @param [in] faceToMesh TopoDS_Face object to build shaded representation for.
|
||||
//! @param [in] shapeId The face' sub-shape ID
|
||||
//! @see IVtkOCC_ShapeMesher::meshShape, IVtkOCC_ShapeMesher::addEdge
|
||||
void addShadedFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId);
|
||||
void addShadedFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId);
|
||||
|
||||
//! Internal helper method that unpacks the input arrays of points and
|
||||
//! connectivity and creates the polyline using IPolyData interface.
|
||||
//! Optionally, the transformation specified through the last argument
|
||||
//! can be applied to each point's coordinates (noTransform == true).
|
||||
//! The polyline is associated with the given sub-shape ID.
|
||||
void processPolyline (Standard_Integer theNbNodes,
|
||||
const TColgp_Array1OfPnt& thePoints,
|
||||
const TColStd_Array1OfInteger& thePointIds,
|
||||
const IVtk_IdType theOcctId,
|
||||
bool theNoTransform,
|
||||
gp_Trsf theTransformation,
|
||||
const IVtk_MeshType theMeshType);
|
||||
|
||||
//! Get the IShape as OCC implementation
|
||||
const IVtkOCC_Shape::Handle GetShapeObj() const;
|
||||
@@ -128,7 +164,11 @@ private:
|
||||
DEFINE_STANDARD_RTTIEXT(IVtkOCC_ShapeMesher,IVtk_IShapeMesher)
|
||||
|
||||
private:
|
||||
IVtk_ShapeTypeMap myEdgesTypes;
|
||||
IVtk_ShapeTypeMap myEdgesTypes;
|
||||
Standard_Real myDevCoeff;
|
||||
Standard_Real myDevAngle;
|
||||
mutable Standard_Real myDeflection;
|
||||
Standard_Integer myNbIsos[2];
|
||||
};
|
||||
|
||||
#endif // __IVTKOCC_SHAPEMESHER_H__
|
||||
|
@@ -23,9 +23,12 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ShapePickerAlgo,IVtk_IShapePickerAlgo)
|
||||
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapePickerAlgo::IVtkOCC_ShapePickerAlgo() :
|
||||
myViewerSelector (new IVtkOCC_ViewerSelector())
|
||||
@@ -33,7 +36,7 @@ myViewerSelector (new IVtkOCC_ViewerSelector())
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapePickerAlgo::~IVtkOCC_ShapePickerAlgo()
|
||||
{ }
|
||||
@@ -54,29 +57,30 @@ void IVtkOCC_ShapePickerAlgo::SetView (const IVtk_IView::Handle& theView)
|
||||
IVtk_SelectionModeList IVtkOCC_ShapePickerAlgo::GetSelectionModes (
|
||||
const IVtk_IShape::Handle& theShape) const
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return IVtk_SelectionModeList();
|
||||
}
|
||||
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj = Handle(IVtkOCC_SelectableObject)::DownCast(aShapeImpl->GetSelectableObject());
|
||||
if (aSelObj.IsNull())
|
||||
{
|
||||
return IVtk_SelectionModeList();
|
||||
}
|
||||
|
||||
IVtk_SelectionModeList aRes;
|
||||
for (IVtk_SelectionMode aSelMode = SM_Shape; aSelMode <= SM_Compound; aSelMode = (IVtk_SelectionMode)(aSelMode + 1))
|
||||
|
||||
if (! theShape.IsNull())
|
||||
{
|
||||
if (myViewerSelector->IsActive (aSelObj, aSelMode))
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj =
|
||||
Handle(IVtkOCC_SelectableObject)::DownCast(aShapeImpl->GetSelectableObject());
|
||||
|
||||
if (!aSelObj.IsNull())
|
||||
{
|
||||
aRes.Append (aSelMode);
|
||||
IVtk_SelectionMode aSelMode;
|
||||
for (aSelMode = SM_Shape; aSelMode <= SM_Compound; aSelMode = (IVtk_SelectionMode)(aSelMode + 1))
|
||||
{
|
||||
if (myViewerSelector->IsActive (aSelObj, aSelMode))
|
||||
{
|
||||
aRes.Append (aSelMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aRes;
|
||||
}
|
||||
|
||||
@@ -98,7 +102,8 @@ void IVtkOCC_ShapePickerAlgo::SetSelectionMode (const IVtk_IShape::Handle& theSh
|
||||
// are destroyed when shapes are deactivated...
|
||||
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
Handle(IVtkOCC_Shape) aShapeImpl =
|
||||
Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj =
|
||||
@@ -175,9 +180,11 @@ void IVtkOCC_ShapePickerAlgo::SetSelectionMode (const IVtk_ShapePtrList& theShap
|
||||
const IVtk_SelectionMode theMode,
|
||||
const bool /*theIsTurnOn*/)
|
||||
{
|
||||
for (IVtk_ShapePtrList::Iterator anIt (theShapes); anIt.More(); anIt.Next())
|
||||
IVtk_IShape::Handle aShape;
|
||||
IVtk_ShapePtrList::Iterator anIt (theShapes);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
IVtk_IShape::Handle aShape = anIt.Value();
|
||||
aShape = anIt.Value();
|
||||
SetSelectionMode (aShape, theMode);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +371,8 @@ void IVtkOCC_ShapePickerAlgo::RemoveSelectableObject(const IVtk_IShape::Handle&
|
||||
{
|
||||
clearPicked();
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
Handle(IVtkOCC_Shape) aShapeImpl =
|
||||
Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj =
|
||||
@@ -373,4 +381,4 @@ void IVtkOCC_ShapePickerAlgo::RemoveSelectableObject(const IVtk_IShape::Handle&
|
||||
myViewerSelector->RemoveSelectableObject(aSelObj);
|
||||
myViewerSelector->Clear();
|
||||
aShapeImpl->SetSelectableObject(NULL);
|
||||
}
|
||||
}
|
@@ -14,11 +14,11 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IVtkOCC_ViewerSelector.hxx>
|
||||
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ViewerSelector,SelectMgr_ViewerSelector)
|
||||
|
||||
//============================================================================
|
||||
@@ -27,8 +27,8 @@ IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ViewerSelector,SelectMgr_ViewerSelector)
|
||||
//============================================================================
|
||||
IVtkOCC_ViewerSelector::IVtkOCC_ViewerSelector()
|
||||
: SelectMgr_ViewerSelector(),
|
||||
myPixTol(2),
|
||||
myToUpdateTol(Standard_True)
|
||||
myPixTol(2),
|
||||
myToUpdateTol(Standard_True)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
//! @brief Class that implements OCCT selection algorithm.
|
||||
//!
|
||||
//! Inspired by StdSelect_ViewerSelector3d class from OCCT 6.5.1
|
||||
|
||||
class IVtkOCC_ViewerSelector : public SelectMgr_ViewerSelector
|
||||
{
|
||||
public:
|
||||
@@ -65,5 +66,4 @@ private:
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE( IVtkOCC_ViewerSelector, SelectMgr_ViewerSelector )
|
||||
|
||||
#endif // __IVTKOCC_VIEWERSELECTOR_H__
|
||||
|
@@ -34,10 +34,9 @@ vtkStandardNewMacro(IVtkTools_DisplayModeFilter)
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
IVtkTools_DisplayModeFilter::IVtkTools_DisplayModeFilter()
|
||||
: myDisplayMode (DM_Wireframe),
|
||||
myDoDisplaySharedVertices (false),
|
||||
myDrawFaceBoundaries (false),
|
||||
myIsSmoothShading (true)
|
||||
: myDisplayMode (DM_Wireframe),
|
||||
myDoDisplaySharedVertices (false),
|
||||
myDrawFaceBoundaries( false )
|
||||
{
|
||||
// Filter according to values in subshapes types array.
|
||||
myIdsArrayName = IVtkVTK_ShapeData::ARRNAME_MESH_TYPES();
|
||||
@@ -79,7 +78,6 @@ int IVtkTools_DisplayModeFilter::RequestData (vtkInformation *theRequest,
|
||||
vtkInformationVector *theOutputVector)
|
||||
{
|
||||
SetData (myModesDefinition[myDisplayMode]);
|
||||
myToCopyNormals = myIsSmoothShading && (myDisplayMode == DM_Shading);
|
||||
return Superclass::RequestData (theRequest, theInputVector, theOutputVector);
|
||||
}
|
||||
|
||||
@@ -186,16 +184,3 @@ void IVtkTools_DisplayModeFilter::SetFaceBoundaryDraw(bool theToDraw)
|
||||
}
|
||||
Modified();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: SetSmoothShading
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
void IVtkTools_DisplayModeFilter::SetSmoothShading (bool theIsSmooth)
|
||||
{
|
||||
if (myIsSmoothShading != theIsSmooth)
|
||||
{
|
||||
myIsSmoothShading = theIsSmooth;
|
||||
Modified();
|
||||
}
|
||||
}
|
||||
|
@@ -58,26 +58,21 @@ public:
|
||||
//! Returns True if drawing Boundary of faces for shading mode is defined.
|
||||
bool FaceBoundaryDraw() const { return myDrawFaceBoundaries; }
|
||||
|
||||
//! Returns TRUE if vertex normals should be included for smooth shading within DM_Shading mode or not.
|
||||
bool IsSmoothShading() const { return myIsSmoothShading; }
|
||||
|
||||
//! Set if vertex normals should be included for smooth shading or not.
|
||||
void SetSmoothShading (bool theIsSmooth);
|
||||
|
||||
protected:
|
||||
//! Filter cells according to the given set of ids.
|
||||
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) Standard_OVERRIDE;
|
||||
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||
|
||||
IVtkTools_DisplayModeFilter();
|
||||
virtual ~IVtkTools_DisplayModeFilter();
|
||||
|
||||
protected:
|
||||
IVtk_DisplayMode myDisplayMode; //!< Display mode defining mesh types to pass through this filter
|
||||
//! Display mode defining mesh types to pass through this filter.
|
||||
IVtk_DisplayMode myDisplayMode;
|
||||
IVtk_IdTypeMap myModesDefinition[2];
|
||||
bool myDoDisplaySharedVertices;
|
||||
|
||||
bool myDrawFaceBoundaries; //!< Draw Face boundaries within shading display mode
|
||||
bool myIsSmoothShading; //!< include vertex normals for smooth shading or not
|
||||
//! Draw Face boundaries flag is applicable only for shading display mode.
|
||||
bool myDrawFaceBoundaries;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -38,10 +38,10 @@ vtkStandardNewMacro(IVtkTools_ShapeDataSource)
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_ShapeDataSource::IVtkTools_ShapeDataSource()
|
||||
: myPolyData (new IVtkVTK_ShapeData()),
|
||||
: myPolyData (new IVtkVTK_ShapeData),
|
||||
myIsFastTransformMode (Standard_False),
|
||||
myIsTransformOnly (Standard_False)
|
||||
{
|
||||
@@ -51,112 +51,130 @@ IVtkTools_ShapeDataSource::IVtkTools_ShapeDataSource()
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_ShapeDataSource::~IVtkTools_ShapeDataSource()
|
||||
{
|
||||
//
|
||||
}
|
||||
{ }
|
||||
|
||||
//================================================================
|
||||
// Function : SetShape
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkTools_ShapeDataSource::SetShape (const IVtkOCC_Shape::Handle& theOccShape)
|
||||
{
|
||||
myIsTransformOnly = myIsFastTransformMode
|
||||
&& !myOccShape.IsNull()
|
||||
&& theOccShape->GetShape().IsPartner (myOccShape->GetShape());
|
||||
if (myIsFastTransformMode && !myOccShape.IsNull() &&
|
||||
theOccShape->GetShape().IsPartner (myOccShape->GetShape() ) )
|
||||
{
|
||||
myIsTransformOnly = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
myIsTransformOnly = Standard_False;
|
||||
}
|
||||
|
||||
myOccShape = theOccShape;
|
||||
this->Modified();
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetShape
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_Shape::Handle IVtkTools_ShapeDataSource::GetShape()
|
||||
{
|
||||
return myOccShape;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : RequestData
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
int IVtkTools_ShapeDataSource::RequestData(vtkInformation *vtkNotUsed(theRequest),
|
||||
vtkInformationVector **vtkNotUsed(theInputVector),
|
||||
vtkInformationVector *theOutputVector)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyData> aPolyData = vtkPolyData::GetData (theOutputVector);
|
||||
if (aPolyData.GetPointer() == NULL)
|
||||
if (aPolyData.GetPointer() != NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
aPolyData->Allocate();
|
||||
vtkSmartPointer<vtkPoints> aPts = vtkSmartPointer<vtkPoints>::New();
|
||||
aPolyData->SetPoints (aPts);
|
||||
|
||||
aPolyData->Allocate();
|
||||
vtkSmartPointer<vtkPoints> aPts = vtkSmartPointer<vtkPoints>::New();
|
||||
aPolyData->SetPoints (aPts);
|
||||
vtkSmartPointer<vtkPolyData> aTransformedData;
|
||||
TopoDS_Shape aShape = myOccShape->GetShape();
|
||||
TopLoc_Location aShapeLoc = aShape.Location();
|
||||
|
||||
vtkSmartPointer<vtkPolyData> aTransformedData;
|
||||
TopoDS_Shape aShape = myOccShape->GetShape();
|
||||
const TopLoc_Location aShapeLoc = aShape.Location();
|
||||
if (myIsTransformOnly)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyData> aPrevData = myPolyData->getVtkPolyData();
|
||||
if (!aShapeLoc.IsIdentity())
|
||||
if (myIsTransformOnly)
|
||||
{
|
||||
aTransformedData = this->transform (aPrevData, aShapeLoc);
|
||||
vtkSmartPointer<vtkPolyData> aPrevData = myPolyData->getVtkPolyData();
|
||||
if ( !aShapeLoc.IsIdentity() )
|
||||
{
|
||||
aTransformedData = this->transform (aPrevData, aShapeLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aPrevData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aPrevData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IVtkOCC_Shape::Handle aShapeWrapperCopy = myOccShape;
|
||||
if (myIsFastTransformMode
|
||||
&& !aShapeLoc.IsIdentity())
|
||||
{
|
||||
// Reset location before meshing
|
||||
aShape.Location (TopLoc_Location());
|
||||
aShapeWrapperCopy = new IVtkOCC_Shape (aShape);
|
||||
aShapeWrapperCopy->SetAttributes (myOccShape->Attributes());
|
||||
aShapeWrapperCopy->SetId (myOccShape->GetId());
|
||||
IVtkOCC_Shape::Handle aShapeWrapperCopy;
|
||||
if ( myIsFastTransformMode && !aShapeLoc.IsIdentity() )
|
||||
{
|
||||
// Reset location before meshing
|
||||
aShape.Location (TopLoc_Location());
|
||||
aShapeWrapperCopy = new IVtkOCC_Shape (aShape);
|
||||
aShapeWrapperCopy->SetId (myOccShape->GetId());
|
||||
}
|
||||
else
|
||||
{
|
||||
aShapeWrapperCopy = myOccShape;
|
||||
}
|
||||
|
||||
myPolyData = new IVtkVTK_ShapeData;
|
||||
IVtkOCC_ShapeMesher::Handle aMesher = new IVtkOCC_ShapeMesher;
|
||||
aMesher->Build (aShapeWrapperCopy, myPolyData);
|
||||
vtkSmartPointer<vtkPolyData> aMeshData = myPolyData->getVtkPolyData();
|
||||
|
||||
if ( myIsFastTransformMode && !aShapeLoc.IsIdentity() )
|
||||
{
|
||||
aTransformedData = this->transform (aMeshData, aShapeLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aMeshData;
|
||||
}
|
||||
}
|
||||
|
||||
myPolyData = new IVtkVTK_ShapeData();
|
||||
IVtkOCC_ShapeMesher::Handle aMesher = new IVtkOCC_ShapeMesher();
|
||||
aMesher->Build (aShapeWrapperCopy, myPolyData);
|
||||
vtkSmartPointer<vtkPolyData> aMeshData = myPolyData->getVtkPolyData();
|
||||
if (myIsFastTransformMode
|
||||
&& !aShapeLoc.IsIdentity())
|
||||
{
|
||||
aTransformedData = this->transform (aMeshData, aShapeLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aMeshData;
|
||||
}
|
||||
aPolyData->CopyStructure (aTransformedData); // Copy points and cells
|
||||
aPolyData->CopyAttributes (aTransformedData); // Copy data arrays (sub-shapes IDs)
|
||||
|
||||
// We store the OccShape instance in a IVtkTools_ShapeObject
|
||||
// wrapper in vtkInformation object of vtkDataObject, then pass it
|
||||
// to the actors through pipelines, so selection logic can access
|
||||
// OccShape easily given the actor instance.
|
||||
IVtkTools_ShapeObject::SetShapeSource (this, aPolyData);
|
||||
aPolyData->GetAttributes (vtkDataObject::CELL)->SetPedigreeIds (SubShapeIDs());
|
||||
}
|
||||
|
||||
aPolyData->CopyStructure (aTransformedData); // Copy points and cells
|
||||
aPolyData->CopyAttributes (aTransformedData); // Copy data arrays (sub-shapes IDs)
|
||||
|
||||
// We store the OccShape instance in a IVtkTools_ShapeObject
|
||||
// wrapper in vtkInformation object of vtkDataObject, then pass it
|
||||
// to the actors through pipelines, so selection logic can access
|
||||
// OccShape easily given the actor instance.
|
||||
IVtkTools_ShapeObject::SetShapeSource (this, aPolyData);
|
||||
aPolyData->GetAttributes (vtkDataObject::CELL)->SetPedigreeIds (SubShapeIDs());
|
||||
return 1;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : SubShapeIDs
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
vtkSmartPointer<vtkIdTypeArray> IVtkTools_ShapeDataSource::SubShapeIDs()
|
||||
{
|
||||
vtkSmartPointer<vtkDataArray> anArr = GetOutput()->GetCellData()->GetArray(IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS());
|
||||
return vtkSmartPointer<vtkIdTypeArray> (vtkIdTypeArray::SafeDownCast (anArr.GetPointer()));
|
||||
vtkSmartPointer<vtkDataArray> arr =
|
||||
GetOutput()->GetCellData()->GetArray(IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS());
|
||||
return vtkSmartPointer<vtkIdTypeArray>(
|
||||
vtkIdTypeArray::SafeDownCast(arr.GetPointer()) );
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetId
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtk_IdType IVtkTools_ShapeDataSource::GetId() const
|
||||
{
|
||||
@@ -165,16 +183,16 @@ IVtk_IdType IVtkTools_ShapeDataSource::GetId() const
|
||||
|
||||
//================================================================
|
||||
// Function : Contains
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean IVtkTools_ShapeDataSource::Contains (const IVtkOCC_Shape::Handle& theShape) const
|
||||
Standard_Boolean IVtkTools_ShapeDataSource::Contains (const IVtkOCC_Shape::Handle& shape) const
|
||||
{
|
||||
return myOccShape == theShape;
|
||||
return ((myOccShape == shape) ? Standard_True : Standard_False);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : transform
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
vtkSmartPointer<vtkPolyData> IVtkTools_ShapeDataSource::transform (vtkPolyData* theSource,
|
||||
const gp_Trsf& theTrsf) const
|
||||
@@ -187,12 +205,10 @@ vtkSmartPointer<vtkPolyData> IVtkTools_ShapeDataSource::transform (vtkPolyData*
|
||||
vtkSmartPointer<vtkTransform> aTransform = vtkSmartPointer<vtkTransform>::New();
|
||||
vtkSmartPointer<vtkMatrix4x4> aMx = vtkSmartPointer<vtkMatrix4x4>::New();
|
||||
for (Standard_Integer aRow = 0; aRow < 3; ++aRow)
|
||||
{
|
||||
for (Standard_Integer aCol = 0; aCol < 4; ++aCol)
|
||||
{
|
||||
aMx->SetElement (aRow, aCol, theTrsf.Value (aRow + 1, aCol + 1) );
|
||||
}
|
||||
}
|
||||
|
||||
aTransform->SetMatrix (aMx);
|
||||
vtkSmartPointer<vtkTransformPolyDataFilter> aTrsfFilter
|
||||
|
@@ -51,8 +51,7 @@ public: //! @name Initialization
|
||||
|
||||
//! Get the source OCCT shape.
|
||||
//! @return occShape OCCT shape wrapper.
|
||||
const IVtkOCC_Shape::Handle& GetShape() { return myOccShape; }
|
||||
|
||||
IVtkOCC_Shape::Handle GetShape();
|
||||
inline void FastTransformModeOn() { myIsFastTransformMode = true; }
|
||||
inline void FastTransformModeOff() { myIsFastTransformMode = false; }
|
||||
|
||||
@@ -83,7 +82,7 @@ protected: //! @name Interface to override
|
||||
//! @param theOutputVector [in] the pointer to output data, that is filled in this method.
|
||||
virtual int RequestData(vtkInformation* theRequest,
|
||||
vtkInformationVector** theInputVector,
|
||||
vtkInformationVector* theOutputVector) Standard_OVERRIDE;
|
||||
vtkInformationVector* theOutputVector);
|
||||
|
||||
protected: //! @name Internals
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class IVtkTools_ShapeDataSource;
|
||||
//! @class IVtkTools_ShapeObject
|
||||
//! @brief VTK holder class for OCC shapes to pass them through pipelines.
|
||||
//!
|
||||
//! It is descendant of vtkObject (data). Logically it is a one of milestones of VTK pipeline.
|
||||
//! It is descendent of vtkObject (data). Logically it is a one of milestones of VTK pipeline.
|
||||
//! It stores data of OCC shape (the OccShape instance) in vtkInformation object of vtkDataObject.
|
||||
//! Then pass it to the actors through pipelines,
|
||||
//! so selection logic can access OccShape easily given the actor instance.
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
//! Pick entities in the given point.
|
||||
//! @return Number of detected entities.
|
||||
virtual int Pick (double theX, double theY, double theZ, vtkRenderer *theRenderer = NULL) Standard_OVERRIDE;
|
||||
int Pick (double theX, double theY, double theZ, vtkRenderer *theRenderer = NULL);
|
||||
|
||||
//! Pick entities in the given rectangle area.
|
||||
//! @return Number of detected entities.
|
||||
|
@@ -21,109 +21,30 @@
|
||||
#pragma warning(push)
|
||||
#endif
|
||||
#include <vtkCellData.h>
|
||||
#include <vtkFloatArray.h>
|
||||
#include <vtkGenericCell.h>
|
||||
#include <vtkIdList.h>
|
||||
#include <vtkIdTypeArray.h>
|
||||
#include <vtkInformation.h>
|
||||
#include <vtkInformationVector.h>
|
||||
#include <vtkObjectFactory.h>
|
||||
#include <vtkPointData.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Modified version of vtkPolyData::CopyCells() that includes copying of normals.
|
||||
//! How to ask vtkPolyData::CopyCells() to do that automatically?
|
||||
static void copyCells (vtkPolyData* theDst,
|
||||
vtkPolyData* theSrc,
|
||||
vtkIdList* theIdList)
|
||||
{
|
||||
//theDst->CopyCells (theSrc, theIdList);
|
||||
|
||||
const vtkIdType aNbPts = theSrc->GetNumberOfPoints();
|
||||
vtkDataArray* anOldNormals = theSrc->GetPointData()->GetNormals();
|
||||
|
||||
if (theDst->GetPoints() == NULL)
|
||||
{
|
||||
theDst->SetPoints (vtkSmartPointer<vtkPoints>::New());
|
||||
}
|
||||
|
||||
vtkSmartPointer<vtkIdList> aNewCellPts = vtkSmartPointer<vtkIdList>::New();
|
||||
vtkSmartPointer<vtkGenericCell> aCell = vtkSmartPointer<vtkGenericCell>::New();
|
||||
NCollection_Vec3<double> anXYZ;
|
||||
vtkPointData* aNewPntData = theDst->GetPointData();
|
||||
vtkCellData* aNewCellData = theDst->GetCellData();
|
||||
vtkPoints* aNewPoints = theDst->GetPoints();
|
||||
vtkSmartPointer<vtkFloatArray> aNewNormals;
|
||||
if (anOldNormals != NULL)
|
||||
{
|
||||
aNewNormals = vtkSmartPointer<vtkFloatArray>::New();
|
||||
aNewNormals->SetName ("Normals");
|
||||
aNewNormals->SetNumberOfComponents (3);
|
||||
theDst->GetPointData()->SetNormals (aNewNormals);
|
||||
}
|
||||
|
||||
vtkSmartPointer<vtkIdList> aPntMap = vtkSmartPointer<vtkIdList>::New(); // maps old pt ids into new
|
||||
aPntMap->SetNumberOfIds (aNbPts);
|
||||
for (vtkIdType i = 0; i < aNbPts; ++i)
|
||||
{
|
||||
aPntMap->SetId (i, -1);
|
||||
}
|
||||
|
||||
// Filter the cells
|
||||
for (vtkIdType aCellIter = 0; aCellIter < theIdList->GetNumberOfIds(); ++aCellIter)
|
||||
{
|
||||
theSrc->GetCell (theIdList->GetId (aCellIter), aCell);
|
||||
vtkIdList* aCellPts = aCell->GetPointIds();
|
||||
const vtkIdType aNbCellPts = aCell->GetNumberOfPoints();
|
||||
for (vtkIdType i = 0; i < aNbCellPts; ++i)
|
||||
{
|
||||
const vtkIdType aPtId = aCellPts->GetId (i);
|
||||
vtkIdType aNewId = aPntMap->GetId (aPtId);
|
||||
if (aNewId < 0)
|
||||
{
|
||||
theSrc->GetPoint (aPtId, anXYZ.ChangeData());
|
||||
|
||||
aNewId = aNewPoints->InsertNextPoint (anXYZ.GetData());
|
||||
aPntMap->SetId (aPtId, aNewId);
|
||||
aNewPntData->CopyData (theSrc->GetPointData(), aPtId, aNewId);
|
||||
|
||||
if (anOldNormals != NULL)
|
||||
{
|
||||
anOldNormals->GetTuple (aPtId, anXYZ.ChangeData());
|
||||
aNewNormals->InsertNextTuple (anXYZ.GetData());
|
||||
}
|
||||
}
|
||||
aNewCellPts->InsertId (i, aNewId);
|
||||
}
|
||||
|
||||
const vtkIdType aNewCellId = theDst->InsertNextCell (aCell->GetCellType(), aNewCellPts);
|
||||
aNewCellData->CopyData (theSrc->GetCellData(), theIdList->GetId (aCellIter), aNewCellId);
|
||||
aNewCellPts->Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vtkStandardNewMacro(IVtkTools_SubPolyDataFilter)
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_SubPolyDataFilter::IVtkTools_SubPolyDataFilter()
|
||||
: myIdsArrayName (IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS()),
|
||||
myDoFiltering (true),
|
||||
myToCopyNormals (true)
|
||||
{
|
||||
//
|
||||
myIdsArrayName = IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS();
|
||||
myDoFiltering = true;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_SubPolyDataFilter::~IVtkTools_SubPolyDataFilter() { }
|
||||
|
||||
@@ -149,17 +70,18 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
|
||||
|
||||
if (myDoFiltering)
|
||||
{
|
||||
vtkSmartPointer<vtkCellData> anInputCellData = anInput->GetCellData();
|
||||
vtkSmartPointer<vtkCellData> anOutputCellData = anOutput->GetCellData();
|
||||
vtkSmartPointer<vtkIdTypeArray> aDataArray = vtkIdTypeArray::SafeDownCast (anInputCellData->GetArray (myIdsArrayName));
|
||||
vtkSmartPointer<vtkCellData> aCellData = anInput->GetCellData();
|
||||
vtkIdType aSize = 0;
|
||||
vtkSmartPointer<vtkIdTypeArray> aDataArray =
|
||||
vtkIdTypeArray::SafeDownCast (aCellData->GetArray (myIdsArrayName));
|
||||
|
||||
// List of cell ids to be passed
|
||||
vtkSmartPointer<vtkIdList> anIdList = vtkSmartPointer<vtkIdList>::New();
|
||||
anIdList->Allocate (myIdsSet.Extent()); // Allocate the list of ids
|
||||
anIdList->Allocate(myIdsSet.Extent()); // Allocate the list of ids
|
||||
|
||||
const vtkIdType aSize = aDataArray.GetPointer() != NULL ? aDataArray->GetNumberOfTuples() : 0;
|
||||
if (aSize != 0)
|
||||
if (aDataArray.GetPointer() != NULL)
|
||||
{
|
||||
aSize = aDataArray->GetNumberOfTuples();
|
||||
anIdList->Allocate (aSize); // Allocate the list of ids
|
||||
}
|
||||
|
||||
@@ -178,41 +100,39 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
|
||||
}
|
||||
|
||||
// Copy cells with their points according to the prepared list of cell ids.
|
||||
anOutputCellData->AllocateArrays (anInputCellData->GetNumberOfArrays());
|
||||
anOutput->Allocate (anInput, anIdList->GetNumberOfIds()); // Allocate output cells
|
||||
|
||||
anOutput->GetCellData()->AllocateArrays(anInput->GetCellData()->GetNumberOfArrays());
|
||||
anOutput->Allocate(anInput, anIdList->GetNumberOfIds()); // Allocate output cells
|
||||
// Pass data arrays.
|
||||
// Create new arrays for output data
|
||||
for (Standard_Integer anI = 0; anI < anInputCellData->GetNumberOfArrays(); anI++)
|
||||
{
|
||||
vtkSmartPointer<vtkDataArray> anInArr = anInputCellData->GetArray (anI);
|
||||
vtkSmartPointer<vtkDataArray> anOutArr = vtkSmartPointer<vtkDataArray>::Take (vtkDataArray::CreateDataArray(anInArr->GetDataType()));
|
||||
vtkSmartPointer<vtkCellData> anInData = anInput->GetCellData();
|
||||
vtkSmartPointer<vtkCellData> anOutData = anOutput->GetCellData();
|
||||
vtkSmartPointer<vtkDataArray> anInArr, anOutArr;
|
||||
|
||||
anOutArr->SetName (anInArr->GetName());
|
||||
anOutArr->Allocate (anIdList->GetNumberOfIds() * anInArr->GetNumberOfComponents());
|
||||
for (Standard_Integer anI = 0; anI < anInData->GetNumberOfArrays(); anI++)
|
||||
{
|
||||
anInArr = anInData->GetArray (anI);
|
||||
anOutArr = vtkSmartPointer<vtkDataArray>::Take(
|
||||
vtkDataArray::CreateDataArray(anInArr->GetDataType()));
|
||||
anOutArr->SetName(anInArr->GetName());
|
||||
anOutArr->Allocate(anIdList->GetNumberOfIds() * anInArr->GetNumberOfComponents());
|
||||
anOutArr->SetNumberOfTuples (anIdList->GetNumberOfIds());
|
||||
anOutArr->SetNumberOfComponents (anInArr->GetNumberOfComponents());
|
||||
anOutputCellData->AddArray (anOutArr);
|
||||
anOutData->AddArray(anOutArr);
|
||||
}
|
||||
|
||||
// Copy cells with ids from our list.
|
||||
if (myToCopyNormals)
|
||||
{
|
||||
copyCells (anOutput, anInput, anIdList);
|
||||
}
|
||||
else
|
||||
{
|
||||
anOutput->CopyCells (anInput, anIdList);
|
||||
}
|
||||
anOutput->CopyCells (anInput, anIdList);
|
||||
|
||||
// Copy filtered arrays data
|
||||
for (Standard_Integer anI = 0; anI < anInputCellData->GetNumberOfArrays(); anI++)
|
||||
vtkIdType anOutId, anInId;
|
||||
|
||||
for (Standard_Integer anI = 0; anI < anInData->GetNumberOfArrays(); anI++)
|
||||
{
|
||||
vtkSmartPointer<vtkDataArray> anInArr = anInputCellData ->GetArray (anI);
|
||||
vtkSmartPointer<vtkDataArray> anOutArr = anOutputCellData->GetArray (anI);
|
||||
for (vtkIdType anOutId = 0; anOutId < anIdList->GetNumberOfIds(); anOutId++)
|
||||
anInArr = anInData->GetArray (anI);
|
||||
anOutArr = anOutData->GetArray(anI);
|
||||
for (anOutId = 0; anOutId < anIdList->GetNumberOfIds(); anOutId++)
|
||||
{
|
||||
const vtkIdType anInId = anIdList->GetId (anOutId);
|
||||
anInId = anIdList->GetId (anOutId);
|
||||
anOutArr->SetTuple (anOutId, anInId, anInArr);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +148,7 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
|
||||
|
||||
//================================================================
|
||||
// Function : SetDoFiltering
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::SetDoFiltering (const bool theDoFiltering)
|
||||
{
|
||||
@@ -249,12 +169,12 @@ void IVtkTools_SubPolyDataFilter::PrintSelf (std::ostream& theOs, vtkIndent theI
|
||||
IVtk_IdTypeMap::Iterator anIter(myIdsSet);
|
||||
while (anIter.More())
|
||||
{
|
||||
theOs << " " << anIter.Value();
|
||||
anIter.Next();
|
||||
if (anIter.More())
|
||||
{
|
||||
theOs << "; ";
|
||||
}
|
||||
theOs << " " << anIter.Value();
|
||||
anIter.Next();
|
||||
if (anIter.More())
|
||||
{
|
||||
theOs << "; ";
|
||||
}
|
||||
}
|
||||
theOs << "}" << "\n";
|
||||
}
|
||||
@@ -283,7 +203,8 @@ void IVtkTools_SubPolyDataFilter::SetData (const IVtk_IdTypeMap theSet)
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::AddData (const IVtk_IdTypeMap theSet)
|
||||
{
|
||||
for (IVtk_IdTypeMap::Iterator anIt (theSet); anIt.More(); anIt.Next())
|
||||
IVtk_IdTypeMap::Iterator anIt (theSet);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
if (!myIdsSet.Contains (anIt.Value()))
|
||||
{
|
||||
@@ -308,7 +229,8 @@ void IVtkTools_SubPolyDataFilter::SetData (const IVtk_ShapeIdList theIdList)
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::AddData (const IVtk_ShapeIdList theIdList)
|
||||
{
|
||||
for (IVtk_ShapeIdList::Iterator anIt (theIdList); anIt.More(); anIt.Next())
|
||||
IVtk_ShapeIdList::Iterator anIt (theIdList);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
if (!myIdsSet.Contains (anIt.Value()))
|
||||
{
|
||||
@@ -317,9 +239,10 @@ void IVtkTools_SubPolyDataFilter::AddData (const IVtk_ShapeIdList theIdList)
|
||||
}
|
||||
}
|
||||
|
||||
//! Set ids to be passed through this filter.
|
||||
//================================================================
|
||||
// Function : SetIdsArrayName
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::SetIdsArrayName (const char* theArrayName)
|
||||
{
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
protected:
|
||||
//! @brief Filter cells according to the given set of ids.
|
||||
//! Note: Data arrays are not passed through if filtering is turned on.
|
||||
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) Standard_OVERRIDE;
|
||||
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||
|
||||
IVtkTools_SubPolyDataFilter();
|
||||
virtual ~IVtkTools_SubPolyDataFilter();
|
||||
@@ -70,7 +70,6 @@ protected:
|
||||
IVtk_IdTypeMap myIdsSet;
|
||||
const char* myIdsArrayName;
|
||||
bool myDoFiltering;
|
||||
bool myToCopyNormals;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -19,9 +19,7 @@
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <vtkCellData.h>
|
||||
#include <vtkDoubleArray.h>
|
||||
#include <vtkFloatArray.h>
|
||||
#include <vtkIdList.h>
|
||||
#include <vtkPointData.h>
|
||||
#include <vtkPoints.h>
|
||||
#include <vtkPolyData.h>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
@@ -30,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(IVtkVTK_ShapeData,IVtk_IShapeData)
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkVTK_ShapeData::IVtkVTK_ShapeData()
|
||||
{
|
||||
@@ -38,11 +36,6 @@ IVtkVTK_ShapeData::IVtkVTK_ShapeData()
|
||||
myPolyData->Allocate();
|
||||
myPolyData->SetPoints (vtkSmartPointer<vtkPoints>::New());
|
||||
|
||||
myNormals = vtkSmartPointer<vtkFloatArray>::New();
|
||||
myNormals->SetName ("Normals");
|
||||
myNormals->SetNumberOfComponents (3);
|
||||
myPolyData->GetPointData()->SetNormals (myNormals);
|
||||
|
||||
mySubShapeIDs = vtkSmartPointer<vtkIdTypeArray>::New();
|
||||
mySubShapeIDs->SetName (IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS());
|
||||
mySubShapeIDs->SetNumberOfComponents (1);
|
||||
@@ -56,29 +49,25 @@ IVtkVTK_ShapeData::IVtkVTK_ShapeData()
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkVTK_ShapeData::~IVtkVTK_ShapeData()
|
||||
{ }
|
||||
|
||||
//================================================================
|
||||
// Function : InsertPoint
|
||||
// Purpose :
|
||||
// Function : InsertCoordinate
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtk_PointId IVtkVTK_ShapeData::InsertPoint (const gp_Pnt& thePnt,
|
||||
const NCollection_Vec3<float>& theNorm)
|
||||
IVtk_PointId IVtkVTK_ShapeData::InsertCoordinate (double theX,
|
||||
double theY,
|
||||
double theZ)
|
||||
{
|
||||
IVtk_PointId aPointId = myPolyData->GetPoints()->InsertNextPoint (thePnt.X(), thePnt.Y(), thePnt.Z());
|
||||
if (myNormals.GetPointer() != NULL)
|
||||
{
|
||||
myNormals->InsertNextTuple (theNorm.GetData());
|
||||
}
|
||||
return aPointId;
|
||||
return myPolyData->GetPoints()->InsertNextPoint (theX, theY, theZ);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : InsertVertex
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertVertex (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointId thePointId,
|
||||
@@ -91,7 +80,7 @@ void IVtkVTK_ShapeData::InsertVertex (const IVtk_IdType theShapeID,
|
||||
|
||||
//================================================================
|
||||
// Function : InsertLine
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointId thePointId1,
|
||||
@@ -105,7 +94,7 @@ void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
|
||||
//================================================================
|
||||
// Function : InsertLine
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointIdList* thePointIds,
|
||||
@@ -130,7 +119,7 @@ void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
|
||||
//================================================================
|
||||
// Function : InsertTriangle
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertTriangle (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointId thePointId1,
|
||||
|
@@ -16,8 +16,6 @@
|
||||
#ifndef __IVTKVTK_SHAPEDATA_H__
|
||||
#define __IVTKVTK_SHAPEDATA_H__
|
||||
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IVtk_IShapeData.hxx>
|
||||
|
||||
// prevent disabling some MSVC warning messages by VTK headers
|
||||
@@ -28,7 +26,6 @@
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
class vtkIdTypeArray;
|
||||
class vtkFloatArray;
|
||||
|
||||
class IVtkVTK_ShapeData;
|
||||
DEFINE_STANDARD_HANDLE( IVtkVTK_ShapeData, IVtk_IShapeData )
|
||||
@@ -54,11 +51,11 @@ public:
|
||||
DEFINE_STANDARD_RTTIEXT(IVtkVTK_ShapeData,IVtk_IShapeData)
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] thePnt point position
|
||||
//! @param [in] theNorm point normal
|
||||
//! @param [in] theX X coordinate
|
||||
//! @param [in] theY Y coordinate
|
||||
//! @param [in] theZ Z coordinate
|
||||
//! @return id of added point
|
||||
Standard_EXPORT virtual IVtk_PointId InsertPoint (const gp_Pnt& thePnt,
|
||||
const NCollection_Vec3<float>& theNorm) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) Standard_OVERRIDE;
|
||||
|
||||
//! Insert a vertex.
|
||||
//! @param [in] theShapeID id of the subshape to which the vertex belongs.
|
||||
@@ -124,7 +121,6 @@ private:
|
||||
|
||||
private:
|
||||
vtkSmartPointer< vtkPolyData > myPolyData; //!< Shape geometry as vtkPolyData
|
||||
vtkSmartPointer< vtkFloatArray > myNormals; //!< vertex normals
|
||||
vtkSmartPointer< vtkIdTypeArray > mySubShapeIDs; //!< Array of sub-shapes ids
|
||||
vtkSmartPointer< vtkIdTypeArray > myMeshTypes; //!< Array of type codes of mesh parts
|
||||
};
|
||||
|
@@ -13,6 +13,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <IVtkVTK_View.hxx>
|
||||
|
||||
// prevent disabling some MSVC warning messages by VTK headers
|
||||
|
@@ -1227,8 +1227,8 @@ Standard_Integer project6(const IntPolyh_Point &ax,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : TriContact
|
||||
//purpose : This function checks if two triangles are in
|
||||
// contact or not, return 1 if yes, return 0
|
||||
//purpose : This fonction Check if two triangles are in
|
||||
// contact or no, return 1 if yes, return 0
|
||||
// if no.
|
||||
//=======================================================================
|
||||
Standard_Integer IntPolyh_MaillageAffinage::TriContact
|
||||
|
@@ -39,11 +39,11 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT IntPolyh_MaillageAffinage(const Handle(Adaptor3d_Surface)& S1, const Standard_Integer NbSU1, const Standard_Integer NbSV1, const Handle(Adaptor3d_Surface)& S2, const Standard_Integer NbSU2, const Standard_Integer NbSV2, const Standard_Integer PRINT);
|
||||
|
||||
|
||||
Standard_EXPORT IntPolyh_MaillageAffinage(const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_Surface)& S2, const Standard_Integer PRINT);
|
||||
|
||||
|
||||
|
||||
//! Makes the sampling of the surface -
|
||||
//! Fills the arrays with the parametric values of the sampling points (triangulation nodes).
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
//! Computes points on one surface and fills an array of points;
|
||||
//! standard (default) method
|
||||
Standard_EXPORT void FillArrayOfPnt (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! isShiftFwd flag is added. The purpose is to define shift
|
||||
//! of points along normal to the surface in this point. The
|
||||
//! shift length represents maximal deflection of triangulation.
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
//! advanced method
|
||||
Standard_EXPORT void FillArrayOfPnt (const Standard_Integer SurfID,
|
||||
const Standard_Boolean isShiftFwd);
|
||||
|
||||
|
||||
//! Compute points on one surface and fill an array of points;
|
||||
//! If given, <theDeflTol> is the deflection tolerance of the given sampling.
|
||||
//! standard (default) method
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
const TColStd_Array1OfReal& Upars,
|
||||
const TColStd_Array1OfReal& Vpars,
|
||||
const Standard_Real *theDeflTol = NULL);
|
||||
|
||||
|
||||
//! isShiftFwd flag is added. The purpose is to define shift
|
||||
//! of points along normal to the surface in this point. The
|
||||
//! shift length represents maximal deflection of triangulation.
|
||||
@@ -103,90 +103,97 @@ public:
|
||||
//! of the two bounding boxes, and mark the points of
|
||||
//! the two surfaces that are inside.
|
||||
Standard_EXPORT void CommonBox (const Bnd_Box& B1, const Bnd_Box& B2, Standard_Real& xMin, Standard_Real& yMin, Standard_Real& zMin, Standard_Real& xMax, Standard_Real& yMax, Standard_Real& zMax);
|
||||
|
||||
|
||||
//! Compute edges from the array of points
|
||||
Standard_EXPORT void FillArrayOfEdges (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! Compute triangles from the array of points, and --
|
||||
//! mark the triangles that use marked points by the
|
||||
//! CommonBox function.
|
||||
Standard_EXPORT void FillArrayOfTriangles (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! Refine systematicaly all marked triangles of both surfaces
|
||||
Standard_EXPORT void CommonPartRefinement();
|
||||
|
||||
|
||||
//! Refine systematicaly all marked triangles of ONE surface
|
||||
Standard_EXPORT void LocalSurfaceRefinement (const Standard_Integer SurfId);
|
||||
|
||||
|
||||
//! Compute deflection for all triangles of one
|
||||
//! surface,and sort min and max of deflections
|
||||
Standard_EXPORT void ComputeDeflections (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! Refine both surfaces using BoundSortBox as --
|
||||
//! rejection. The criterions used to refine a --
|
||||
//! triangle are: The deflection The size of the --
|
||||
//! bounding boxes (one surface may be very small
|
||||
//! compared to the other)
|
||||
Standard_EXPORT void TrianglesDeflectionsRefinementBSB();
|
||||
|
||||
//! This function checks if two triangles are in contact or not,
|
||||
//! return 1 if yes, return 0 if not.
|
||||
|
||||
//! This fonction Check if two triangles are in
|
||||
//! contact or no, return 1 if yes, return 0
|
||||
//! if no.
|
||||
Standard_EXPORT Standard_Integer TriContact (const IntPolyh_Point& P1, const IntPolyh_Point& P2, const IntPolyh_Point& P3, const IntPolyh_Point& Q1, const IntPolyh_Point& Q2, const IntPolyh_Point& Q3, Standard_Real& Angle) const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer TriangleEdgeContact (const Standard_Integer TriSurfID, const Standard_Integer EdgeIndice, const IntPolyh_Triangle& Tri1, const IntPolyh_Triangle& Tri2, const IntPolyh_Point& P1, const IntPolyh_Point& P2, const IntPolyh_Point& P3, const IntPolyh_Point& C1, const IntPolyh_Point& C2, const IntPolyh_Point& C3, const IntPolyh_Point& Pe1, const IntPolyh_Point& Pe2, const IntPolyh_Point& E, const IntPolyh_Point& N, IntPolyh_StartPoint& SP1, IntPolyh_StartPoint& SP2) const;
|
||||
|
||||
//! From two triangles compute intersection points.
|
||||
//! If we found more than two intersection points
|
||||
//! that means that those triangles are coplanar
|
||||
|
||||
//! From two triangles compute intersection points.
|
||||
//! If I found more than two intersection points
|
||||
//! that's mean that those triangle are coplanar
|
||||
Standard_EXPORT Standard_Integer StartingPointsResearch (const Standard_Integer T1, const Standard_Integer T2, IntPolyh_StartPoint& SP1, IntPolyh_StartPoint& SP2) const;
|
||||
|
||||
//! from two triangles and an intersection point I
|
||||
//! search the other point (if it exists).
|
||||
|
||||
//! from two triangles and an intersection point I
|
||||
//! search the other point (if it exist).
|
||||
//! This function is used by StartPointChain
|
||||
Standard_EXPORT Standard_Integer NextStartingPointsResearch (const Standard_Integer T1, const Standard_Integer T2, const IntPolyh_StartPoint& SPInit, IntPolyh_StartPoint& SPNext) const;
|
||||
|
||||
//! Analyse each couple of triangles from the two -- array of triangles,
|
||||
//! to see if they are in contact, and compute the incidence.
|
||||
//! Then put couples in contact in the array of couples
|
||||
|
||||
//! Analyse each couple of triangles from the two --
|
||||
//! array of triangles, to see if they are in
|
||||
//! contact, and compute the incidence. Then put
|
||||
//! couples in contact in the array of couples
|
||||
Standard_EXPORT Standard_Integer TriangleCompare();
|
||||
|
||||
|
||||
//! Loop on the array of couples. Compute StartPoints.
|
||||
//! Try to chain the StartPoints into SectionLines or
|
||||
//! put the point in the ArrayOfTangentZones if
|
||||
//! chaining it, is not possible.
|
||||
Standard_EXPORT Standard_Integer StartPointsChain (IntPolyh_ArrayOfSectionLines& TSectionLines, IntPolyh_ArrayOfTangentZones& TTangentZones);
|
||||
|
||||
|
||||
//! Mainly used by StartPointsChain(), this function
|
||||
//! try to compute the next StartPoint.
|
||||
Standard_EXPORT Standard_Integer GetNextChainStartPoint (const IntPolyh_StartPoint& SPInit, IntPolyh_StartPoint& SPNext, IntPolyh_SectionLine& MySectionLine, IntPolyh_ArrayOfTangentZones& TTangentZones, const Standard_Boolean Prepend = Standard_False);
|
||||
|
||||
|
||||
Standard_EXPORT const IntPolyh_ArrayOfPoints& GetArrayOfPoints (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT const IntPolyh_ArrayOfEdges& GetArrayOfEdges (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT const IntPolyh_ArrayOfTriangles& GetArrayOfTriangles (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer GetFinTE (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer GetFinTT (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT Bnd_Box GetBox (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
//! This method returns list of couples of contact triangles.
|
||||
Standard_EXPORT IntPolyh_ListOfCouples& GetCouples();
|
||||
|
||||
|
||||
Standard_EXPORT void SetEnlargeZone (const Standard_Boolean EnlargeZone);
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetEnlargeZone() const;
|
||||
|
||||
|
||||
//! returns FlecheMin
|
||||
Standard_EXPORT Standard_Real GetMinDeflection (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
//! returns FlecheMax
|
||||
Standard_EXPORT Standard_Real GetMaxDeflection (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(Adaptor3d_Surface) MaSurface1;
|
||||
Handle(Adaptor3d_Surface) MaSurface2;
|
||||
Bnd_Box MyBox1;
|
||||
|
@@ -128,10 +128,10 @@ void IntRes2d_Intersection::SetValues(const IntRes2d_Intersection& Other) {
|
||||
//-- parameter of the bounds of the composite Curve
|
||||
//-- Merge of two Intersection Segments S1 and S2 when :
|
||||
//--
|
||||
//-- S1 : U1First,PosU1First --> U1Last,PosU1Last
|
||||
//-- V1First,PosV1First --> V1Last,PosV1Last
|
||||
//-- S2 : U2First,PosU2First --> U2Last,PosU2Last
|
||||
//-- V2First,PosV2First --> V2Last,PosV2Last
|
||||
//-- S1 : U1First,PosU1Fisrt --> U1Last,PosU1Last
|
||||
//-- V1First,PosV1Fisrt --> V1Last,PosV1Last
|
||||
//-- S2 : U2First,PosU2Fisrt --> U2Last,PosU2Last
|
||||
//-- V2First,PosV2Fisrt --> V2Last,PosV2Last
|
||||
//--
|
||||
//-- 1 U : X------1-------E H-----2-------X U -->
|
||||
//-- V : X------1-------X X-----2-------X <- V -> ?
|
||||
|
@@ -4,9 +4,15 @@ IntTools_Array1OfRange.hxx
|
||||
IntTools_Array1OfRoots.hxx
|
||||
IntTools_BaseRangeSample.cxx
|
||||
IntTools_BaseRangeSample.hxx
|
||||
IntTools_BaseRangeSample.lxx
|
||||
IntTools_BeanFaceIntersector.cxx
|
||||
IntTools_BeanFaceIntersector.hxx
|
||||
IntTools_CArray1.gxx
|
||||
IntTools_CArray1.lxx
|
||||
IntTools_CArray1OfInteger.hxx
|
||||
IntTools_CArray1OfInteger_0.cxx
|
||||
IntTools_CArray1OfReal.hxx
|
||||
IntTools_CArray1OfReal_0.cxx
|
||||
IntTools_CommonPrt.cxx
|
||||
IntTools_CommonPrt.hxx
|
||||
IntTools_Context.cxx
|
||||
@@ -15,9 +21,12 @@ IntTools_Curve.cxx
|
||||
IntTools_Curve.hxx
|
||||
IntTools_CurveRangeLocalizeData.cxx
|
||||
IntTools_CurveRangeLocalizeData.hxx
|
||||
IntTools_CurveRangeLocalizeData.lxx
|
||||
IntTools_CurveRangeSample.cxx
|
||||
IntTools_CurveRangeSample.hxx
|
||||
IntTools_CurveRangeSample.lxx
|
||||
IntTools_CurveRangeSampleMapHasher.hxx
|
||||
IntTools_CurveRangeSampleMapHasher.lxx
|
||||
IntTools_DataMapIteratorOfDataMapOfCurveSampleBox.hxx
|
||||
IntTools_DataMapIteratorOfDataMapOfSurfaceSampleBox.hxx
|
||||
IntTools_DataMapOfCurveSampleBox.hxx
|
||||
@@ -43,6 +52,7 @@ IntTools_MapOfCurveSample.hxx
|
||||
IntTools_MapOfSurfaceSample.hxx
|
||||
IntTools_MarkedRangeSet.cxx
|
||||
IntTools_MarkedRangeSet.hxx
|
||||
IntTools_MarkedRangeSet.lxx
|
||||
IntTools_PntOn2Faces.cxx
|
||||
IntTools_PntOn2Faces.hxx
|
||||
IntTools_PntOnFace.cxx
|
||||
@@ -65,9 +75,10 @@ IntTools_SurfaceRangeSample.cxx
|
||||
IntTools_SurfaceRangeSample.hxx
|
||||
IntTools_SurfaceRangeSample.lxx
|
||||
IntTools_SurfaceRangeSampleMapHasher.hxx
|
||||
IntTools_SurfaceRangeSampleMapHasher.lxx
|
||||
IntTools_Tools.cxx
|
||||
IntTools_Tools.hxx
|
||||
IntTools_TopolTool.cxx
|
||||
IntTools_TopolTool.hxx
|
||||
IntTools_WLineTool.hxx
|
||||
IntTools_WLineTool.cxx
|
||||
IntTools_WLineTool.cxx
|
@@ -13,7 +13,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntTools.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@@ -25,14 +24,15 @@
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <IntTools.hxx>
|
||||
#include <IntTools_Array1OfRoots.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_Root.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
||||
#include <TColStd_ListOfReal.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools::GetRadius
|
||||
//purpose :
|
||||
@@ -89,17 +89,17 @@
|
||||
//function : PrepareArgs
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools::PrepareArgs (BRepAdaptor_Curve& C,
|
||||
const Standard_Real Tmax,
|
||||
const Standard_Real Tmin,
|
||||
const Standard_Integer Discret,
|
||||
const Standard_Real Deflection,
|
||||
TColStd_Array1OfReal& anArgs)
|
||||
Standard_Integer IntTools::PrepareArgs(BRepAdaptor_Curve& C,
|
||||
const Standard_Real Tmax,
|
||||
const Standard_Real Tmin,
|
||||
const Standard_Integer Discret,
|
||||
const Standard_Real Deflection,
|
||||
IntTools_CArray1OfReal& anArgs)
|
||||
{
|
||||
|
||||
TColStd_ListOfReal aPars;
|
||||
Standard_Real dt, tCurrent, tNext, aR, anAbsDeflection;
|
||||
Standard_Integer ip, i, j, aNbDeflectionPoints;
|
||||
Standard_Integer ip, i, j, aNbDeflectionPoints, aDiscretBis;
|
||||
Standard_Boolean aRFlag;
|
||||
|
||||
GeomAbs_CurveType aCurveType;
|
||||
@@ -150,12 +150,11 @@ Standard_Integer IntTools::PrepareArgs (BRepAdaptor_Curve& C,
|
||||
}
|
||||
|
||||
aPars.Append(Tmax);
|
||||
const Standard_Integer aDiscretBis = aPars.Extent();
|
||||
anArgs.Resize (0, aDiscretBis - 1, false);
|
||||
aDiscretBis=aPars.Extent();
|
||||
anArgs.Resize(aDiscretBis);
|
||||
TColStd_ListIteratorOfListOfReal anIt(aPars);
|
||||
for (i = 0; anIt.More(); anIt.Next(), i++)
|
||||
{
|
||||
anArgs.SetValue (i, anIt.Value());
|
||||
for (i=0; anIt.More(); anIt.Next(), i++) {
|
||||
anArgs(i)=anIt.Value();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -16,43 +16,123 @@
|
||||
#ifndef _IntTools_HeaderFile
|
||||
#define _IntTools_HeaderFile
|
||||
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_SequenceOfRoots.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <IntTools_SequenceOfRoots.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class TopoDS_Edge;
|
||||
class gp_Pnt;
|
||||
class Geom_Curve;
|
||||
class BRepAdaptor_Curve;
|
||||
class IntTools_CArray1OfReal;
|
||||
class IntTools_Context;
|
||||
class IntTools_ShrunkRange;
|
||||
class IntTools_Range;
|
||||
class IntTools_CommonPrt;
|
||||
class IntTools_Root;
|
||||
class IntTools_EdgeEdge;
|
||||
class IntTools_EdgeFace;
|
||||
class IntTools_FClass2d;
|
||||
class IntTools_MarkedRangeSet;
|
||||
class IntTools_BaseRangeSample;
|
||||
class IntTools_CurveRangeSample;
|
||||
class IntTools_SurfaceRangeSample;
|
||||
class IntTools_CurveRangeLocalizeData;
|
||||
class IntTools_SurfaceRangeLocalizeData;
|
||||
class IntTools_BeanFaceIntersector;
|
||||
class IntTools_Curve;
|
||||
class IntTools_PntOnFace;
|
||||
class IntTools_PntOn2Faces;
|
||||
class IntTools_TopolTool;
|
||||
class IntTools_FaceFace;
|
||||
class IntTools_Tools;
|
||||
class IntTools_CArray1;
|
||||
class IntTools_CArray1OfInteger;
|
||||
class IntTools_CArray1OfReal;
|
||||
class IntTools_CurveRangeSampleMapHasher;
|
||||
class IntTools_SurfaceRangeSampleMapHasher;
|
||||
|
||||
//! Contains classes for intersection and classification purposes and accompanying classes.
|
||||
|
||||
//! Contains classes for intersection and classification
|
||||
//! purposes and accompanying classes
|
||||
class IntTools
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! returns the length of the edge;
|
||||
Standard_EXPORT static Standard_Real Length (const TopoDS_Edge& E);
|
||||
|
||||
|
||||
//! Remove from the sequence aSeq the Roots that have
|
||||
//! values ti and tj such as |ti-tj] < anEpsT.
|
||||
Standard_EXPORT static void RemoveIdenticalRoots (IntTools_SequenceOfRoots& aSeq, const Standard_Real anEpsT);
|
||||
|
||||
//! Sort the sequence aSeq of the Roots to arrange the Roots in increasing order.
|
||||
|
||||
//! Sort the sequence aSeq of the Roots to arrange the
|
||||
//! Roons in increasing order
|
||||
Standard_EXPORT static void SortRoots (IntTools_SequenceOfRoots& aSeq, const Standard_Real anEpsT);
|
||||
|
||||
//! Find the states (before and after) for each Root from the sequence aSeq
|
||||
|
||||
//! Find the states (before and after) for each Root
|
||||
//! from the sequence aSeq
|
||||
Standard_EXPORT static void FindRootStates (IntTools_SequenceOfRoots& aSeq, const Standard_Real anEpsNull);
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Integer Parameter (const gp_Pnt& P, const Handle(Geom_Curve)& Curve, Standard_Real& aParm);
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Integer GetRadius (const BRepAdaptor_Curve& C, const Standard_Real t1, const Standard_Real t3, Standard_Real& R);
|
||||
|
||||
Standard_EXPORT static Standard_Integer PrepareArgs (BRepAdaptor_Curve& C, const Standard_Real tMax, const Standard_Real tMin, const Standard_Integer Discret, const Standard_Real Deflect, IntTools_CArray1OfReal& anArgs);
|
||||
|
||||
Standard_EXPORT static Standard_Integer PrepareArgs (BRepAdaptor_Curve& C,
|
||||
const Standard_Real tMax, const Standard_Real tMin,
|
||||
const Standard_Integer Discret, const Standard_Real Deflect,
|
||||
TColStd_Array1OfReal& anArgs);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class IntTools_Context;
|
||||
friend class IntTools_ShrunkRange;
|
||||
friend class IntTools_Range;
|
||||
friend class IntTools_CommonPrt;
|
||||
friend class IntTools_Root;
|
||||
friend class IntTools_EdgeEdge;
|
||||
friend class IntTools_EdgeFace;
|
||||
friend class IntTools_FClass2d;
|
||||
friend class IntTools_MarkedRangeSet;
|
||||
friend class IntTools_BaseRangeSample;
|
||||
friend class IntTools_CurveRangeSample;
|
||||
friend class IntTools_SurfaceRangeSample;
|
||||
friend class IntTools_CurveRangeLocalizeData;
|
||||
friend class IntTools_SurfaceRangeLocalizeData;
|
||||
friend class IntTools_BeanFaceIntersector;
|
||||
friend class IntTools_Curve;
|
||||
friend class IntTools_PntOnFace;
|
||||
friend class IntTools_PntOn2Faces;
|
||||
friend class IntTools_TopolTool;
|
||||
friend class IntTools_FaceFace;
|
||||
friend class IntTools_Tools;
|
||||
friend class IntTools_CArray1;
|
||||
friend class IntTools_CArray1OfInteger;
|
||||
friend class IntTools_CArray1OfReal;
|
||||
friend class IntTools_CurveRangeSampleMapHasher;
|
||||
friend class IntTools_SurfaceRangeSampleMapHasher;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_HeaderFile
|
||||
|
@@ -19,8 +19,10 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
|
||||
//! base class for range index management
|
||||
class IntTools_BaseRangeSample
|
||||
{
|
||||
@@ -28,18 +30,38 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT IntTools_BaseRangeSample();
|
||||
|
||||
|
||||
Standard_EXPORT IntTools_BaseRangeSample(const Standard_Integer theDepth);
|
||||
|
||||
void SetDepth (const Standard_Integer theDepth);
|
||||
|
||||
Standard_Integer GetDepth() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
void SetDepth (const Standard_Integer theDepth) { myDepth = theDepth; }
|
||||
|
||||
Standard_Integer GetDepth() const { return myDepth; }
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myDepth;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntTools_BaseRangeSample.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_BaseRangeSample_HeaderFile
|
||||
|
25
src/IntTools/IntTools_BaseRangeSample.lxx
Normal file
25
src/IntTools/IntTools_BaseRangeSample.lxx
Normal file
@@ -0,0 +1,25 @@
|
||||
// Created on: 2005-10-05
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-2014 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.
|
||||
|
||||
inline void IntTools_BaseRangeSample::SetDepth(const Standard_Integer theDepth)
|
||||
{
|
||||
myDepth = theDepth;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_BaseRangeSample::GetDepth() const
|
||||
{
|
||||
return myDepth;
|
||||
}
|
169
src/IntTools/IntTools_CArray1.gxx
Normal file
169
src/IntTools/IntTools_CArray1.gxx
Normal file
@@ -0,0 +1,169 @@
|
||||
// Created on: 2000-05-26
|
||||
// Created by: Peter KURNEV
|
||||
// Copyright (c) 2000-2014 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.
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CArray1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CArray1::IntTools_CArray1 (const Standard_Integer Length):
|
||||
myStart(NULL),
|
||||
myLength(0),
|
||||
myIsAllocated(Standard_False)
|
||||
{
|
||||
Resize(Length);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CArray1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CArray1::IntTools_CArray1 (const Array1Item& Item,
|
||||
const Standard_Integer Length):
|
||||
myLength(Length),
|
||||
myIsAllocated(Standard_False)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if(Length < 0,"IntTools_CArray1:: Length < 0");
|
||||
myStart = (void*)(&Item);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Init (const Array1Item& V)
|
||||
{
|
||||
Array1Item* p = (Array1Item*) myStart;
|
||||
for(Standard_Integer i = 0; i < Length() ; i++) {
|
||||
*p++ = V;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Destroy()
|
||||
{
|
||||
if (myIsAllocated) {
|
||||
delete [] (Array1Item *)myStart;
|
||||
myIsAllocated = Standard_False;
|
||||
}
|
||||
myStart = NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_CArray1::IsEqual(const IntTools_CArray1& Other) const
|
||||
{
|
||||
if (&Other == this)
|
||||
return Standard_True;
|
||||
else if (Length() != Other.Length())
|
||||
return Standard_False;
|
||||
else if (Length() == 0)
|
||||
return Standard_True;
|
||||
//
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Resize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Resize(const Standard_Integer theNewLength)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if(theNewLength < 0,"IntTools_CArray1: length < 0");
|
||||
|
||||
Array1Item* p = NULL;
|
||||
|
||||
Destroy();
|
||||
|
||||
myLength = theNewLength;
|
||||
|
||||
if (theNewLength > 0) {
|
||||
// default creator called for each item of the array
|
||||
p = new Array1Item[theNewLength];
|
||||
if (!p) throw Standard_OutOfMemory("IntTools_CArray1 : Allocation failed.");
|
||||
myIsAllocated = Standard_True;
|
||||
}
|
||||
|
||||
myStart = (void*) p;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Append (const Array1Item& Value)
|
||||
{
|
||||
const Standard_Integer theNewLength=myLength+1;
|
||||
|
||||
Array1Item* p = NULL;
|
||||
|
||||
if (theNewLength > 0) {
|
||||
// default creator called for each item of the array
|
||||
p = new Array1Item[theNewLength];
|
||||
if (!p) throw Standard_OutOfMemory("IntTools_CArray1 : Allocation failed.");
|
||||
|
||||
if (myLength!=0) {
|
||||
Standard_Integer aBytesPerItem=sizeof(Array1Item);
|
||||
memcpy (p, myStart, myLength*aBytesPerItem);
|
||||
}
|
||||
|
||||
*(p+myLength)=Value;
|
||||
Destroy();
|
||||
myLength = theNewLength;
|
||||
myIsAllocated = Standard_True;
|
||||
}
|
||||
|
||||
myStart = (void*) p;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Array1Item& IntTools_CArray1::Value(const Standard_Integer Index) const
|
||||
{
|
||||
if (myLength <1 || Index < 0 || Index >= myLength)
|
||||
throw Standard_OutOfRange("IntTools_CArray1::Value");
|
||||
|
||||
return ((Array1Item *)myStart)[Index];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::SetValue (const Standard_Integer Index,
|
||||
const Array1Item& Value)
|
||||
{
|
||||
ChangeValue(Index) = Value;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Array1Item& IntTools_CArray1::ChangeValue(const Standard_Integer Index)
|
||||
{
|
||||
if (myLength < 1 || Index < 0 || Index >= myLength)
|
||||
throw Standard_OutOfRange("IntTools_CArray1::ChangeValue");
|
||||
|
||||
return ((Array1Item *)myStart)[Index];
|
||||
}
|
||||
|
26
src/IntTools/IntTools_CArray1.lxx
Normal file
26
src/IntTools/IntTools_CArray1.lxx
Normal file
@@ -0,0 +1,26 @@
|
||||
// Created on: 2000-05-26
|
||||
// Created by: Peter KURNEV
|
||||
// Copyright (c) 2000-2014 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 <Standard_OutOfRange.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer IntTools_CArray1::Length() const
|
||||
{
|
||||
return myLength;
|
||||
}
|
||||
|
153
src/IntTools/IntTools_CArray1OfInteger.hxx
Normal file
153
src/IntTools/IntTools_CArray1OfInteger.hxx
Normal file
@@ -0,0 +1,153 @@
|
||||
// Created on: 2000-05-18
|
||||
// Created by: Peter KURNEV
|
||||
// Copyright (c) 2000-2014 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 _IntTools_CArray1OfInteger_HeaderFile
|
||||
#define _IntTools_CArray1OfInteger_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_OutOfMemory;
|
||||
|
||||
|
||||
|
||||
class IntTools_CArray1OfInteger
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
//! Creates an array of given Length.
|
||||
Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer Length = 0);
|
||||
|
||||
|
||||
//! Creates an array sharing datas with an other.
|
||||
//! Example:
|
||||
//! Item tab[100];
|
||||
//! CArray1OfItem thetab (tab[0],100);
|
||||
//!
|
||||
//! CArray1OfItem aArray1(100);
|
||||
//! CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length());
|
||||
//!
|
||||
//! Warning:
|
||||
//! The validity of length are under the responsibility
|
||||
//! of the user.
|
||||
//! The sahred array must have a valid address during the life of
|
||||
//! the Array1.
|
||||
Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer& Item, const Standard_Integer Length);
|
||||
|
||||
|
||||
//! Initializes the array with a given value.
|
||||
Standard_EXPORT void Init (const Standard_Integer& V);
|
||||
|
||||
|
||||
//! destroy current content and realloc the new size
|
||||
//! does nothing if Length() == theLength
|
||||
Standard_EXPORT void Resize (const Standard_Integer theNewLength);
|
||||
|
||||
|
||||
//! Frees the allocated area corresponding to the
|
||||
//! array.
|
||||
Standard_EXPORT void Destroy();
|
||||
~IntTools_CArray1OfInteger()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
//! Returns the number of elements of <me>.
|
||||
Standard_Integer Length() const;
|
||||
|
||||
Standard_EXPORT void Append (const Standard_Integer& Value);
|
||||
|
||||
|
||||
//! Sets the <Index>th element of the array to
|
||||
//! <Value>.
|
||||
Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Integer& Value);
|
||||
|
||||
|
||||
//! Returns the value of the <Index>th element of the
|
||||
//! array.
|
||||
Standard_EXPORT const Standard_Integer& Value (const Standard_Integer Index) const;
|
||||
const Standard_Integer& operator () (const Standard_Integer Index) const
|
||||
{
|
||||
return Value(Index);
|
||||
}
|
||||
|
||||
|
||||
//! Returns the value of the <Index>th element of the
|
||||
//! array.
|
||||
Standard_EXPORT Standard_Integer& ChangeValue (const Standard_Integer Index);
|
||||
Standard_Integer& operator () (const Standard_Integer Index)
|
||||
{
|
||||
return ChangeValue(Index);
|
||||
}
|
||||
|
||||
|
||||
//! Applyies the == operator on each array item
|
||||
Standard_EXPORT Standard_Boolean IsEqual (const IntTools_CArray1OfInteger& Other) const;
|
||||
Standard_Boolean operator == (const IntTools_CArray1OfInteger& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Prohibits the creator by copy
|
||||
Standard_EXPORT IntTools_CArray1OfInteger(const IntTools_CArray1OfInteger& AnArray);
|
||||
|
||||
|
||||
Standard_Address myStart;
|
||||
Standard_Integer myLength;
|
||||
Standard_Boolean myIsAllocated;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define Array1Item Standard_Integer
|
||||
#define Array1Item_hxx <Standard_Integer.hxx>
|
||||
#define IntTools_CArray1 IntTools_CArray1OfInteger
|
||||
#define IntTools_CArray1_hxx <IntTools_CArray1OfInteger.hxx>
|
||||
|
||||
#include <IntTools_CArray1.lxx>
|
||||
|
||||
#undef Array1Item
|
||||
#undef Array1Item_hxx
|
||||
#undef IntTools_CArray1
|
||||
#undef IntTools_CArray1_hxx
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_CArray1OfInteger_HeaderFile
|
28
src/IntTools/IntTools_CArray1OfInteger_0.cxx
Normal file
28
src/IntTools/IntTools_CArray1OfInteger_0.cxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Created on: 2000-05-18
|
||||
// Created by: Peter KURNEV
|
||||
// Copyright (c) 2000-2014 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 <IntTools_CArray1OfInteger.hxx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_OutOfMemory.hxx>
|
||||
|
||||
|
||||
#define Array1Item Standard_Integer
|
||||
#define Array1Item_hxx <Standard_Integer.hxx>
|
||||
#define IntTools_CArray1 IntTools_CArray1OfInteger
|
||||
#define IntTools_CArray1_hxx <IntTools_CArray1OfInteger.hxx>
|
||||
#include <IntTools_CArray1.gxx>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user