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

Compare commits

...

56 Commits

Author SHA1 Message Date
ski
b3b55601fb 0025490: Error appears trying to start QT OCCT sample
Separate msvc.bat files were created for each qt sample to avoid errors.
2015-05-08 14:09:54 +03:00
vpa
2cf5ec3f1c 0026139: AIS_InteractiveContext::Display performance regression
Regression with VIS tests in release mode was fixed
2015-05-08 13:50:15 +03:00
apn
2124e769d1 0026194: Sometimes "testgrid" command runs every test many times
Added check for equal test directories in variable CSF_TestScriptsPath.
2015-05-08 10:15:18 +03:00
bugmaster
b767425413 Incrementation of OCCT version up to 6.9.0 2015-05-08 08:56:49 +03:00
vpa
ec81011f5b 0026139: AIS_InteractiveContext::Display performance regression
NCollection_Sequence in SelectMgr_SensitiveEntitySet was replaced by indexed data map
2015-05-08 08:56:33 +03:00
dbp
d4aaad5b82 0026029: Visualization - Poor performance of connected objects
Fix performance issue with SelectMgr_SelectableObjectSet.
2015-05-08 08:54:30 +03:00
apn
9319499b57 Update of unstable Boolean test cases 2015-05-08 08:54:29 +03:00
abv
bf3977c9f9 0026146: Visualization, Select3D_ISensitivePointSet - eliminate crash when clearing selections [only with TBB]
Remove classes Select3D_ISensitivePointSet and Select3D_BoundarySensitivePointSet; use Select3D_SensitivePoly directly for boundary selection.
Make last argument in Select3D_SensitiveFace non-default to ensure that value is always explicitly specified by the caller.
Inherit SelectMgr_FrustumBuilder from Standard_Transient to use normal Handle instead of NCollection_Handle.

Add test case bugs/vis/bug26146.
2015-05-08 08:54:28 +03:00
vpa
2157d6ac63 0026147: Visualization - restore the ability to pick only fully included objects in rectangular selection
2 modes of rectangular selection are available: inclusion-only and overlap-allowing;
The modes can be switched using method AllowOverlapDetection from StdSelect_ViewerSelector3d;
BVH for sensitive entities now builds if there is more than max number of leafs in collection;
Added option -allowoverlap to command vselect;
Interactive rectangular selection in Draw is now available in 2 modes:
- if the user starts selection from upper corners, only fully included objects will be selected;
- if the user starts selection from lower corners, both partially and fully overlapped objects will be selected.
2015-05-08 08:54:08 +03:00
apl
35c4a17c46 0025760: Visualization - precision factor added to ZNear, ZFar in method ZFitAll() of Graphic3d_Camera is not enough
Partial fix: increased epsilon to value reported in #0025670
2015-05-08 08:52:16 +03:00
apn
30a7308729 0026191: Different behavior of "bugs moddata_3 bug23471" test script on Windows and Linux platform
Deleted variable "res" which appears during loading draw
2015-05-08 08:51:49 +03:00
vpa
28ee613b27 0026159: Visualization - revise tolerance implementation for selection
Max tolerance is now applied to all objects and entities by default;
if there is an entity with a lower tolerance, selecting frustum will be recalculated for it.
The ability to set sensitivity for each entity individually is moved to protected section of SelectBasics_SensitiveEntity
SetPixelTolerance from AIS_InteractiveContext now sets custom tolerance that is applied to all sensitives.
Added -unset option to vselprecision command to disable custom tolerances.
Test case for issue #26159
2015-05-08 08:51:48 +03:00
kgv
fe3a29bc9a 0026165: Visualization, TKOpenGl - fix FBO blitting on some mobile devices
OpenGl_Texture::Init() - initialize FBO textures with GL_TEXTURE_WRAP_ set to GL_CLAMP_TO_EDGE,
since some devices do not support GL_REPEAT (which is default) in such combination.
OpenGl_Font::createTexture() - define texture parameters explicitly.

OpenGl_FrameBuffer::Init() create Depth render buffer object instead of texture
on devices which do not support GL_DEPTH24_STENCIL8.
2015-05-08 08:51:47 +03:00
mkv
2ff806d1ab 0025271: Wrong result obtained by solid classifier algorithm
Shape name was corrected
2015-05-08 08:51:46 +03:00
ski
edbca3bf00 0025825: Draw Harness, XSDRAWSTLVRML - drop command tovrml and XSDRAWSTLVRML_ToVRML
Command tovrml was eliminated.
2015-05-08 08:51:45 +03:00
apl
c070aa3915 0026172: Visualization, AIS_LocalContext - locally selected object should not stay in the viewer after deactivation in the local context
Fix for AIS_LocalContext::ClearOutdatedSelection()
Added test case bugs/vis/bug26172
2015-05-08 08:51:44 +03:00
nbv
9d32c463ad 0025890: Intersection algorithm produces curves overlaped
1. Function IntImp_Int2S::ChangePoint() has been added (see cdl for detail information).
2. Attempt to forbidden break WLine if it goes along surface boundary.

Code optimization.

2nd optimization

Test case for issue CR25890
2015-05-08 08:51:43 +03:00
mkv
4946f2d8ef 0025737: GCPnts_TangentialDeflection does not produce points to approximate a knee 2015-05-08 08:51:42 +03:00
abv
0bbdddae85 0026182: Calling ShapeFix_FixSmallFace.RemoveSmallFaces() always leads to stack overflow
Unused methods RemoveSmallFaces() and SplitFaces() are removed.
2015-05-08 08:51:41 +03:00
kgv
a7f510bfae 0026177: Coding rules - eliminate -Wdeprecated-register CLang warnings 2015-05-06 17:25:24 +03:00
kgv
11bf7051d9 0026167: Coding rules - eliminate -Wlogical-not-parentheses CLang warnings in GeomToStep 2015-05-06 17:22:49 +03:00
apl
0df8756310 0026155: TNaming, CurrentShape: order of shapes in Modification compound is unpredictable
CurrentShape(): replace TopTools_MapOfShapes with TopTools_IndexedMapOfShape
Added case: tests/bugs/caf/bug26155
2015-05-06 17:20:22 +03:00
msv
ff0a70a157 0026148: BRep_Tool::IsClosed failed to judge a closed edge on Poly_Triangulation.
The method signature has been changed by adding an argument TopLoc_Location.
2015-05-06 17:14:45 +03:00
ski
2f697f2f74 0026145: Geometry Sample crashes
Unacceptable usage of quantity coefficient was removed.
2015-05-06 17:11:10 +03:00
solomin_s
95db72f1f6 0026128: Visualization, TKOpenGl - fix misprint in external GLX context initialization
OpenGl_Window, GLX - push warning about missing caps in window Visual.
Allow initialization of alien GLX context.

Correction of misprinting
2015-05-06 17:06:59 +03:00
vpa
1c22cc2d27 0026121: Visualization - revise implementation of point sets used in Select3D_SensitiveFace
Code duplication was eliminated by removing constructors with handle input arrays
2015-05-06 17:02:54 +03:00
nbv
7693827d4a 0026118: Implement FastSewing algorithm
1. Develop special sewing algorithm.
2. DRAW-command "fastsewing" has been created (see help for detail information).
3. BRepLib::EnsureNormalConsistency() method has been added (see help for detail information).
4. DRAW-command correctnormals has been created (see help for detail information).

Test cases for this issue.

Correction of elapsed time in test-cases
2015-05-06 16:59:57 +03:00
mkv
97f3106c05 0026010: [OCCT 6.8.0 regression] BRepFeat_SplitShape returns invalid shapes 2015-05-06 16:48:29 +03:00
mkv
63073e35ce 0025844: Command checkshape does not detect error for case when degenerated edge does not contain geometric representation. 2015-05-06 16:44:28 +03:00
ibs
c259930b8e 0025713: CMake configuring procedure should allow to build OCCT as static libraries
BUILD_LIBRARY_TYPE variable added
2015-05-06 16:41:57 +03:00
ysn
2683e647de 0025390: Redesign of Technical Overview
Technical overview refactored; text duplicating information contained in user guides removed.
Some images are regenerated for better presentation.
Problems with formatting and section tags corrected in user guides.
2015-05-06 16:37:26 +03:00
mkv
4422364ec3 0025050: Shape can not be stored to VRML format 2015-05-06 16:34:36 +03:00
isk
29e2c6d247 0022785: Draw Harness - add possibility to remove a text drawn by the command vdrawtext
AIS_TextLabel - new public class to display simple text labels (based on MyTextClass private class from Draw Harness).
ViewerTest::Display() - add more reliable replacement for VDisplayAISObject() with no viewer update flag.

vdrawtext command redesign:
- Use new AIS_TextLabel class instead of private MyTextClass.
- Take object name and allow to clear labels from the Viewer.
- Use parameter name + parameter value syntax instead of strict list of mandatory arguments.
- Use [0; 1] range for colors and accept names.
- Drop redundant argument "isMultiByte".
- Support argument -noupdate to skip Viewer update.

Update test cases to new syntax of vdrawtext.
2015-05-06 15:06:47 +03:00
apv
2b5097c676 Modification due to behavior changes after integration for issues CR26138 and CR24923 2015-05-06 15:03:09 +03:00
bugmaster
16f82a28dc Update overview for OCCT 6.9.0 2015-05-06 15:03:05 +03:00
apn
806b45f2f2 0025670: Incorrect sprops/vprops/lprops check in heal drop_small_solids test cases
Procedure cmpprops in tests/heal/drop_small_solids/end is modified to correctly access top-level variables
2015-05-06 15:03:00 +03:00
ika
31024507f6 0026138: Problems with writing periodic BSplines into IGES
Remove making BSpline surfaces rational,
Add shifting of pcurves on periodic BSpline surfaces,
Add cutting of segment from such surfaces.
Add additional check for need of make segment

Update of test-cases according to the new behavior
2015-05-06 15:02:55 +03:00
drazmyslovich
ec26bf88a2 0024923: BRepMesh_CircleTool produces bad circles
Calculate radius of circumcircle as maximum difference between its center and vertices or reference triangle.
Draw test command OCC25547 has been implemented.
Small optimizations for speed.

Update of test-cases according to the new behaviour

Update of test-cases in group mesh
2015-05-06 15:02:50 +03:00
apn
cd37e04879 0026021: Integration boolean test cases
Added subgroups volumemaker, gdml_private and gdml_public

Moved scripts from public repository ti test cases

Added more TODOs to unstable test cases

Small corrections for unstable test cases
2015-05-06 15:02:44 +03:00
apl
985aed12ec 0026157: NCollection, TCollection packages - IndexedMap, IndexedDataMap ::Substitute() do not allow passing equal key for the same index
cosmetic remarks from msv
2015-05-06 15:02:37 +03:00
jgv
d66bd706ce 0026009: Wrong result of the test blend bfuseblend B7
Correction to avoid infinite loop

Minor correction

Update of test-case for issue #26009

Fix of compiler's warning
2015-04-30 14:47:57 +03:00
pkv
905522eef8 0025880: fuzzy booleans with multiple tools
New features:
class BOPTools_AlgoTools2D
method:
 Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
   (const TopoDS_Edge& aEold,
    const TopoDS_Edge& aEnew,
    const TopoDS_Face& aF,
    const Handle(IntTools_Context)& aCtx)
has been added.

Purpose:
  To attach P-Curve on surface of the face <aF>  from the edge <aEold>
   to the edge <aEnew>
   It returns 0 in case of success.

Changes:
1. class BOPTools_AlgoTools
method:
 Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
  (const TopoDS_Face& theFSp,
   const TopoDS_Face& theFSr,
   Handle(IntTools_Context)& theContext)

The condition for a point on the surface of a face has been changed.

2. class BOPAlgo_PaveFiller
method:
 void BOPAlgo_PaveFiller::MakePCurves()

The treatment of E/E common bocks has been changed
to use mechanism of attacment P-Curves [ I.1 ]

Test case for issue CR25880
2015-04-30 14:42:59 +03:00
mkv
76a2b7d1fb 0026152: Wrong result obtained by projection algorithm.
Test cases for issue CR26152
2015-04-30 14:37:40 +03:00
mkv
6ab722979b 0026130: PCurve creation failure 2015-04-30 14:34:11 +03:00
msv
46b2b6afa0 0025908: BSpline (U2 < U1) in HLRBRep_HLRToShape
Test case for issue CR25908
2015-04-30 14:26:06 +03:00
Roman Lygin
7b1c1b7cbb 0025971: Near B-Spline knots get merged after saving/restoring (exporting/importing)
Precision used to consider B-Spline knots identical is restricted to be not less than Precision::PConfusion() in Geom2d_BSplineCurve::Segment().

Affected tests updated (improvements)

Test case for issue CR25971
2015-04-30 14:19:34 +03:00
ink
062d7dfd62 0021727: BRepBuilderAPI_Copy (and possibly other similar tools) create new shape in Frozen state
Set the value of flag Frozen to false for shape created in BRepTools_Modifier. If shape is not newly created then value of flag Frozen don't changed.

Test-case for issue #21727
2015-04-30 14:11:07 +03:00
azn
96f3baccc5 0025619: CAST analysis: Avoid classes with a non-empty destructor and not implementing both an assignment operator and a copy constructor
- Fix compilation errors.
- Branch has been rebased on new master.

0025619: CAST analysis: Avoid classes with a non-empty destructor and not implementing both an assignment operator and a copy constructor

The problem has been removed from following classes:
- tsee_entity
- Select3D_PointData
- Standard_MMgrFactory
- ProjLib_OnSurface
- BinomAllocator
- OSD_PerfMeter
- StorageInfo
- OpenGl_UnpackAlignmentSentry
- IntPatch_InfoPD
- TableauRejection
- Draw_View
- BOPTest_Session
- BOPCol_MemBlock
- BSB_T3Bits
- NCollection_Handle::Ptr
- Buffer (from Standard_Boolean Message_MsgFile::LoadFile (const Standard_CString))
2015-04-30 14:04:02 +03:00
nbv
6b5b88d707 0024161: boolean operation hanging
The reason of hanging has been eliminated.

Test case for issue CR24161

Small correction of test case for this issue
2015-04-30 13:58:51 +03:00
pkv
f47b8d2b37 0025937: Failed Cut Edge or Face by HalfSpace.
Addressing the causes of warnings.

Test cases for issue CR25937
2015-04-30 13:51:04 +03:00
emv
5e18f91719 0026112: Exception is raised during perform of General Fuse operation
class BOPAlgo_WireSplitter
method
Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
                               const TopoDS_Edge& aE,
                               const TopoDS_Face& myFace,
                               const Standard_Real aA1,
                               const Standard_Real aA2,
                               Standard_Real& aA)

Protection from null vector.

Test case for issue CR26112
2015-04-30 13:33:11 +03:00
vpa
7ab159522a 0026069: Coding Rules - eliminate new warnings about redundant const qualifier in SelectMgr
SelectMgr_SensitiveEntity is now inherited from Standard_Transient;
Redundant const type qualifiers were removed from selection classes.
2015-04-30 13:26:34 +03:00
dbp
e99a2f7cae 0026081: Visualization, TKOpenGl - rebuild vertex attributes in order to not render large index arrays in OpenGL ES 2015-04-30 13:21:52 +03:00
abv
6ca1fa7070 0026064: distmini of two edges locks up
Method Extrema_GenExtCC::Perform() refactored to avoid very inefficient (O(N^2)) algorithm of removal of duplicate points at the end. Instead, duplications are checked when new points are added.

Fields are initialized in constructors of the class Extrema_GenExtCC; unused instances of generic classes (duplications) ELCC and ELCC2d removed.

Test case bugs/modalg_6/bug26064 added.
2015-04-30 13:19:23 +03:00
ibs
0a66e59dad 0025653: DRAW doesn't use installed 3rdparty libraries from its library folder located in install folder 2015-04-30 13:01:03 +03:00
ysn
ae3eaf7b15 0026087: Review of changes introduced into documentation since ver. 68
Proofreading of documentation changes that were not verified earlier and some date- and version- related changes in the overview.
2015-04-29 14:09:43 +03:00
784 changed files with 15661 additions and 6842 deletions

View File

@@ -10,6 +10,18 @@ endif()
set (CMAKE_CONFIGURATION_TYPES ${BUILD_CONFIGURATION} CACHE INTERNAL "" FORCE)
# set type of OCCT libraries
if (NOT BUILD_LIBRARY_TYPE)
set (BUILD_LIBRARY_TYPE "Shared" CACHE STRING "The type of OCCT libraries" FORCE)
SET_PROPERTY(CACHE BUILD_LIBRARY_TYPE PROPERTY STRINGS Shared Static)
endif()
if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
set (BUILD_SHARED_LIBS ON)
else()
unset (BUILD_SHARED_LIBS)
endif()
# the name of the project
project (OCCT)

View File

@@ -179,6 +179,15 @@ macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME LIBRARY_NAME_DEB
else()
install (FILES "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
endif()
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR}")
else()
set (USED_3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
endif()
endif()
mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY 3RDPARTY_${PRODUCT_NAME}_DLL)

View File

@@ -3,12 +3,13 @@ echo off
if "%VCVER%" == "@COMPILER@" (
if "%ARCH%" == "@COMPILER_BITNESS@" (
if "%CASDEB%" == "@BUILD_POSTFIX@" (
set "TCL_DIR=@3RDPARTY_TCL_DLL_DIR@"
set "FREETYPE_DIR=@3RDPARTY_FREETYPE_DLL_DIR@"
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIR@"
set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIR@"
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
set "TCL_DIR=@USED_3RDPARTY_TCL_DIR@"
set "FREETYPE_DIR=@USED_3RDPARTY_FREETYPE_DIR@"
set "FREEIMAGE_DIR=@USED_3RDPARTY_FREEIMAGE_DIR@"
set "FREEIMAGEPLUS_DIR=@USED_3RDPARTY_FREEIMAGEPLUS_DIR@"
set "GL2PS_DIR=@USED_3RDPARTY_GL2PS_DIR@"
set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
)
)
)

View File

@@ -3,12 +3,12 @@
if [ "$COMPILER" == "@COMPILER@" ]; then
if [ "$ARCH" == "@COMPILER_BITNESS@" ]; then
if [ "$CASDEB" == "@BUILD_POSTFIX@" ]; then
export TCL_DIR="@3RDPARTY_TCL_LIBRARY_DIR@"
export FREETYPE_DIR="@3RDPARTY_FREETYPE_LIBRARY_DIR@"
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIR@"
export GL2PS_DIR="@3RDPARTY_GL2PS_LIBRARY_DIR@"
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
export TCL_DIR="@USED_3RDPARTY_TCL_DIR@"
export FREETYPE_DIR="@USED_3RDPARTY_FREETYPE_DIR@"
export FREEIMAGE_DIR="@USED_3RDPARTY_FREEIMAGE_DIR@"
export GL2PS_DIR="@USED_3RDPARTY_GL2PS_DIR@"
export TBB_DIR="@USED_3RDPARTY_TBB_DIR@"
export VTK_DIR="@USED_3RDPARTY_VTK_DIR@"
fi
fi
fi

View File

@@ -22,12 +22,13 @@ if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
set "ORIGIN_PATH=%PATH%"
if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%"
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
if not ["%FREEIMAGEPLUS_DIR%"] == [""] set "PATH=%FREEIMAGEPLUS_DIR%;%PATH%"
if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%"
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
rem ----- Set path to 3rd party and OCCT libraries -----
set "BIN_TAIL=win%ARCH%/%VCVER%/bin%CASDEB%"

View File

@@ -223,6 +223,15 @@ if (INSTALL_FREETYPE)
else()
install (FILES "${3RDPARTY_FREETYPE_LIBRARY}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
endif()
set (USED_3RDPARTY_FREETYPE_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
else()
set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
endif()
endif()
# unset all redundant variables

View File

@@ -236,6 +236,15 @@ if (INSTALL_TBB)
else()
install (FILES ${3RDPARTY_TBB_LIBRARY} ${3RDPARTY_TBBMALLOC_LIBRARY} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}")
endif()
set (USED_3RDPARTY_TBB_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
endif()
endif()
mark_as_advanced (3RDPARTY_TBB_LIBRARY 3RDPARTY_TBBMALLOC_LIBRARY 3RDPARTY_TBB_DLL 3RDPARTY_TBBMALLOC_DLL)

View File

@@ -318,6 +318,15 @@ if (INSTALL_TCL)
message (STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.")
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
endif()
set (USED_3RDPARTY_TCL_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_DLL_DIR})
else()
set (USED_3RDPARTY_TCL_DIR ${3RDPARTY_TCL_LIBRARY_DIR})
endif()
endif()
mark_as_advanced (3RDPARTY_TCL_LIBRARY 3RDPARTY_TK_LIBRARY 3RDPARTY_TCL_DLL 3RDPARTY_TK_DLL)

View File

@@ -151,6 +151,15 @@ if (INSTALL_VTK)
install(FILES "${3RDPARTY_VTK_LIBRARY_DIR}/lib${VTK_DLL_NAME}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME "lib${VTK_DLL_NAME}")
endforeach()
endif()
set (USED_3RDPARTY_VTK_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_VTK_DIR ${3RDPARTY_VTK_DLL_DIR})
else()
set (USED_3RDPARTY_VTK_DIR ${3RDPARTY_VTK_LIBRARY_DIR})
endif()
endif()
mark_as_advanced (VTK_INCLUDE_DIRS VTK_LIBRARY_DIRS VTK_DIR)

View File

@@ -35,41 +35,6 @@ This feature can be activated by defining environment variable *CSF_DEBUG_BOP*,
The diagnostic code checks validity of the input arguments and the result of each Boolean operation. When an invalid situation is detected, the report consisting of argument shapes and a DRAW script to reproduce the problematic operation is saved to the directory pointed by *CSF_DEBUG_BOP*.
@section occt_debug_commands DRAW debugging commands
In this section description and usage of several debug commands represented.
@subsection occt_debug_commands_xdist "xdist" commands family
Commands with prefix "xdist" provides functionality to check distance between two objects on even grid:
* xdistef - distance between edge and face.
* xdistcs - distance between curve and surface. This means that projection to surface of each sample point computed.
* xdistcc - distance between two 3d curves.
* xdistcc2ds - distance between 3d curve and 2d curve on surface.
* xdistc2dc2dss - distance between two 2d curves on surface.
**Usage:**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
xdistef edge face
xdistcs curve surface firstParam lastParam [NumberOfSamplePoints]
xdistcc curve1 curve2 startParam finishParam [NumberOfSamplePoints]
xdistcc2ds c curve2d surf startParam finishParam [NumberOfSamplePoints]
xdistc2dc2dss curve2d_1 curve2d_2 surface_1 surface_2 startParam finishParam [NumberOfSamplePoints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is assumed that curves have same parametrization range and startParam < finishParam.
**Examples:**
~~~~~
bopcurves b1 b2 -2d
mksurf s1 b1
mksurf s2 b2
xdistcs c_1 s1 0 1 100
xdistcc2ds c_1 c2d2_1 s2 0 1
xdistc2dc2dss c2d1_1 c2d2_1 s1 s2 0 1 1000
~~~~~
@section occt_debug_call Functions for calling from debugger
Modern interactive debuggers provide the possibility to execute application code at a program break point. This feature can be used to analyse the temporary objects available only in the context of the debugged code. OCCT provides several global functions that can be used in this way.

View File

@@ -69,8 +69,8 @@ Example:
Draw[]> testgrid
~~~~~
For running only a subset of test cases, give masks for group, grid, and test case names to be executed.
Each argument is a list of comma- or space-separated file masks; by default "*" is assumed.
To run only a subset of test cases, give masks for group, grid, and test case names to be executed.
Each argument is a list of file masks separated with commas or spaces; by default "*" is assumed.
Example:
@@ -78,7 +78,6 @@ Example:
Draw[]> testgrid bugs caf,moddata*,xde
~~~~~
As the tests progress, the result of each test case is reported.
At the end of the log a summary of test cases is output,
including the list of detected regressions and improvements, if any.
@@ -102,13 +101,13 @@ Example:
The tests are considered as non-regressive if only OK, BAD (i.e. known problem), and SKIPPED (i.e. not executed, typically because of lack of a data file) statuses are reported. See <a href="#testmanual_3_5">Interpretation of test results</a> for details.
The results and detailed logs of the tests are saved by default to a new subdirectory of the subdirectory *results* in the current folder, whose name is generated automatically using the current date and time, prefixed by Git branch name (if Git is available and current sources are managed by Git).
If necessary, a non-default output directory can be specified using option <i> outdir</i> followed by a path to the directory. This directory should be new or empty; use option overwrite to allow writing results in existing non-empty directory.
If necessary, a non-default output directory can be specified using option <i> outdir</i> followed by a path to the directory. This directory should be new or empty; use option <i>overwrite</i> to allow writing results in the existing non-empty directory.
Example:
~~~~~
Draw[]> testgrid -outdir d:/occt/last_results -overwrite
~~~~~
In the output directory, a cumulative HTML report summary.html provides links to reports on each test case. An additional report in JUnit-style XML format can be output for use in Jenkins or other continuous integration system.
In the output directory, a cumulative HTML report <i>summary.html</i> provides links to reports on each test case. An additional report in JUnit-style XML format can be output for use in Jenkins or other continuous integration system.
Type <i>help testgrid</i> in DRAW prompt to get help on options supported by *testgrid* command:
@@ -144,7 +143,7 @@ Note that normally an intermediate output of the script is not shown. The detail
To see intermediate commands and their output during the test execution, add one more argument
<i>"echo"</i> at the end of the command line. Note that with this option the log is not collected and summary is not produced.
Type <i>help testgrid</i> in DRAW prompt to get help on options supported by *testgrid* command:
Type <i>help test</i> in DRAW prompt to get help on options supported by *test* command:
~~~~~
Draw[3]> help test
@@ -170,10 +169,10 @@ test: Run specified test case
The detailed rules of creation of new tests are given in <a href="#testmanual_3">section 3</a>. The following short description covers the most typical situations:
Use prefix "bug" followed by Mantis issue ID and, if necessary, additional suffixes, for naming the test script and DRAW commands specific for this test case.
Use prefix <i>bug</i> followed by Mantis issue ID and, if necessary, additional suffixes, for naming the test script and DRAW commands specific for this test case.
1. If the test requires C++ code, add it as new DRAW command(s) in one of files in *QABugs* package. Note that this package defines macros *QVERIFY* and *QCOMPARE*, thus code created for QTest or GoogleTest frameworks can be used with minimal modifications.
2. Add script(s) for the test case in grid (subfolder) corresponding to the relevant OCCT module of the group bugs <i>($CASROOT/tests/bugs)</i>. See <a href="#testmanual_5_2">the correspondence map</a>.
2. Add script(s) for the test case in the subfolder corresponding to the relevant OCCT module of the group bugs <i>($CASROOT/tests/bugs)</i>. See <a href="#testmanual_5_2">the correspondence map</a>.
3. In the test script:
* Load all necessary DRAW modules by command *pload*.
* Use command *locate_data_file* to get a path to data files used by test script. (Make sure to have this command not inside catch statement if it is used.)
@@ -213,7 +212,7 @@ checkshape result
Standard OCCT tests are located in subdirectory tests of the OCCT root folder ($CASROOT).
Additional test folders can be added to the test system by defining environment variable *CSF_TestScriptsPath*. This should be list of paths separated by semicolons (*;*) on Windows
or colons (*:*) on Linux or Mac. Upon DRAW launch, path to tests sub-folder of OCCT is added at the end of this variable automatically.
or colons (*:*) on Linux or Mac. Upon DRAW launch, path to tests subfolder of OCCT is added at the end of this variable automatically.
Each test folder is expected to contain:
* Optional file parse.rules defining patterns for interpretation of test results, common for all groups in this folder
@@ -456,15 +455,15 @@ If the new test corresponds to a functionality already covered by the existing s
@subsection testmanual_3_2 Adding Data Files Required for a Test
It is advisable to make self-contained test scripts whenever possible, so as they could be used in environments where data files are not available. For that simple geometric objects and shapes can be created using DRAW commands in the test script itself.
It is advisable to make self-contained test scripts whenever possible, so as they could be used in the environments where data files are not available. For that simple geometric objects and shapes can be created using DRAW commands in the test script itself.
If the test requires a data file, it should be put to directory listed in environment variable *CSF_TestDataPath*.
If the test requires a data file, it should be put to the directory listed in environment variable *CSF_TestDataPath*.
Alternatively, it can be put to subdirectory *data* of the test grid.
It is recommended to prefix the data file with the corresponding issue id prefixed by *bug*, e.g. *bug12345_face1.brep*, to avoid possible conflicts with names of existing data files.
Note that when the test is integrated to the master branch, OCC team will move the data file to data files repository, so as to keep OCCT sources repository clean from data files.
Note that when the test is integrated to the master branch, OCC team will move the data file to the data files repository, to keep OCCT sources repository clean from data files.
When preparing a test script, try to minimize the size of involved data model. For instance, if the problem detected on a big shape can be reproduced on a single face extracted from that shape, use only that face in the test.
When you prepare a test script, try to minimize the size of involved data model. For instance, if the problem detected on a big shape can be reproduced on a single face extracted from that shape, use only that face in the test.
@subsection testmanual_3_3 Adding new DRAW commands
@@ -475,7 +474,7 @@ If the test cannot be implemented using available DRAW commands, consider the fo
* Otherwise the new command implementing the actions needed for this particular test should be added in *QABugs* package. The command name should be formed by the Mantis issue ID prefixed by *bug*, e.g. *bug12345*.
Note that a DRAW command is expected to return 0 in case of a normal completion, and 1 (Tcl exception) if it is incorrectly used (e.g. a wrong number of input arguments). Thus if the new command needs to report a test error, this should be done by outputting an appropriate error message rather than by returning a non-zero value.
Also file names must not be encoded in DRAW command but in script, and passed to DRAW command as argument.
File names must be encoded in the script rather than in the DRAW command and passed to the DRAW command as an argument.
@subsection testmanual_3_4 Script Implementation
@@ -522,13 +521,16 @@ stepread [locate_data_file CAROSKI_COUPELLE.step] a *
~~~~~
When the test needs to produce some snapshots or other artefacts, use Tcl variable *imagedir* as the location where such files should be put.
Command *testgrid* sets this variable to the subdirectory of the results folder corresponding to the grid.
Command *test* by default creates dedicated temporary directory in the system temporary folder (normally the one specified by environment variable *TempDir*, *TEMP*, or *TMP*) for each execution, and sets *imagedir* to that location.
However if variable *imagedir* is defined on top level of Tcl interpretor, command *test* will use it instead of creating a new directory.
* Command *testgrid* sets this variable to the subdirectory of the results folder corresponding to the grid.
* Command *test* by default creates a dedicated temporary directory in the system temporary folder (normally the one specified by environment variable *TempDir*, *TEMP*, or *TMP*) for each execution, and sets *imagedir* to that location.
However if variable *imagedir* is defined on the top level of Tcl interpretor, command *test* will use it instead of creating a new directory.
Use Tcl variable *casename* to prefix all files produced by the test.
This variable is set to the name of the test case.
For the image file (snapshot) to be recognized by the test system (for inclusion in HTML log and differences), its name should start with name of the test case (use variable *casename*), optionally followed by underscore or dash and arbitrary suffix.
The test system can recognize an image file (snapshot) and include it in HTML log and differences if its name starts with the name of the test case (use variable *casename*), optionally followed by underscore or dash and arbitrary suffix.
The image format (defined by extension) should be *png*.
Example:
@@ -550,9 +552,9 @@ A1-front.png
Note that OCCT must be built with FreeImage support to be able to produce usable images.
Other Tcl variables defined during the test execution are:
- *groupname*: name of the test group
- *gridname*: name of the test grid
- *dirname*: path to the root directory of the current set of test scripts
- *groupname*: name of the test group;
- *gridname*: name of the test grid;
- *dirname*: path to the root directory of the current set of test scripts.
In order to ensure that the test works as expected in different environments, observe the following additional rules:
* Avoid using external commands such as *grep, rm,* etc., as these commands can be absent on another system (e.g. on Windows); use facilities provided by Tcl instead.
@@ -576,7 +578,7 @@ The new test created for an unsolved problem should return BAD. The new test cre
@subsection testmanual_3_6 Marking BAD cases
If the test produces an invalid result at a certain moment then corresponding bug should be created in the OCCT issue tracker located at http://tracker.dev.opencascade.org, and the problem should be marked as TODO in the test script.
If the test produces an invalid result at a certain moment then the corresponding bug should be created in the OCCT issue tracker located at http://tracker.dev.opencascade.org, and the problem should be marked as TODO in the test script.
The following statement should be added to such a test script:
~~~~~
@@ -585,7 +587,7 @@ puts "TODO BugNumber ListOfPlatforms: RegularExpression"
Here:
* *BugNumber* is the bug ID in the tracker. For example: #12345.
* *ListOfPlatforms* is a list of platforms at which the bug is reproduced (e.g. Mandriva2008, Windows or All). Note that the platform name is custom for the OCCT test system; it corresponds to the value of environment variable *os_type* defined in DRAW.
* *ListOfPlatforms* is a list of platforms, at which the bug is reproduced (e.g. Mandriva2008, Windows or All). Note that the platform name is custom for the OCCT test system; it corresponds to the value of environment variable *os_type* defined in DRAW.
Example:
~~~~~
@@ -593,7 +595,7 @@ Draw[2]> puts $env(os_type)
windows
~~~~~
* RegularExpression is a regular expression which should be matched against the line indicating the problem in the script output.
* RegularExpression is a regular expression, which should be matched against the line indicating the problem in the script output.
Example:
~~~~~
@@ -620,7 +622,7 @@ puts "TODO OCC22817 All: TEST INCOMPLETE"
@subsection testmanual_4_1 Running Tests on Older Versions of OCCT
Sometimes it might be necessary to run tests on previous versions of OCCT (<= 6.5.4) that do not include this test system. This can be done by adding DRAW configuration file *DrawAppliInit* in the directory which is current by the moment of DRAW start-up, to load test commands and to define necessary environment.
Sometimes it might be necessary to run tests on the previous versions of OCCT (<= 6.5.4) that do not include this test system. This can be done by adding DRAW configuration file *DrawAppliInit* in the directory, which is current by the moment of DRAW start-up, to load test commands and to define the necessary environment.
Note: in OCCT 6.5.3, file *DrawAppliInit* already exists in <i>$CASROOT/src/DrawResources</i>, new commands should be added to this file instead of a new one in the current directory.
@@ -634,7 +636,7 @@ set env(CSF_TestDataPath) $env(CASROOT)/data;d:/test-data
return
~~~~~
Note that on older versions of OCCT the tests are run in compatibility mode and not all output of the test command can be captured; this can lead to absence of some error messages (can be reported as either a failure or an improvement).
Note that on older versions of OCCT the tests are run in compatibility mode and thus not all output of the test command can be captured; this can lead to absence of some error messages (can be reported as either a failure or an improvement).
@subsection testmanual_4_2 Adding custom tests

View File

@@ -480,8 +480,11 @@ This automatically takes you to the root directory of the workbench
@subsubsection occt_wok_3_3_8 Using Existing Resources
Before creating new data types, you should look for existing components that you can reuse. In particular, you should look through the existing resources of your Open CASCADE Technology platform to see if any of the required components already exist, or if any existing generic components can be suitably implemented. This search can be conducted using the online documentation. You should note the packages and classes, which you can reuse.
@subsection occt_wok_3_4 Creating Software Components
@subsubsection occt_wok_3_4_1 Creating a Package
To develop new software components, you usually need to create one or more packages. You do this, by using the following command:
~~~~~
> ucreate p <MyPackage>
@@ -613,6 +616,7 @@ The umake steps for development units of package type are explained below.
* *obj.lib*    Generates the shared library for the development unit.
@subsubsection occt_wok_3_4_2 Creating a Nocdlpack
If your executable requires the use of a nocdlpack, create a development unit of nocdlpack type and move to its structure using the commands below:
~~~~~
> ucreate -n <MyNoCDLPack>
@@ -656,7 +660,8 @@ The *umake* steps for development units of *nocdlpack* type are explained below.
+ Implementation dependencies in terms of the unit suppliers. (Unit.ImplDep)
* *obj.lib* Generates the shared library for the unit.
@subsubsection occt_wok_3_3_3 Creating a Schema
@subsubsection occt_wok_3_4_3 Creating a Schema
If the application, which you intend to build, stores data in a file, you need to define a schema for the persistent data types that are known.
You create a schema and go to its root directory using the commands:
@@ -735,7 +740,9 @@ The umake steps for development units of schema type are explained below.
* *obj.idep*   Generates dependency information for the schema.
@subsection occt_wok_3_5 Building an Executable
@subsubsection occt_wok_3_5_1 Creating an Executable
To make an executable from one or more of the packages, which you have created, write a .cdl file to specify the packages to use.
#### Writing an Executable
@@ -805,7 +812,9 @@ The umake steps for development units of executable type are explained below.
* *exec.link* Links each part of the executable.
@subsection occt_wok_3_6 Test Environments
@subsubsection occt_wok_3_3_1 Testing an Executable
@subsubsection occt_wok_3_6_1 Testing an Executable
To test an executable, you create an executable development unit and move to its structure.
When you write the .cdl file for your test executable, specify the packages to test, for example:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -20,7 +20,7 @@ http://www.opencascade.org
@section OCCT_OVW_SECTION_2 Copyrights
Open CASCADE Technology and all materials, including this documentation, is
Copyright (c) 1999-2013 by OPEN CASCADE S.A.S. All rights reserved.
Copyright (c) 1999-2015 by OPEN CASCADE S.A.S. All rights reserved.
@htmlonly<center>@endhtmlonly
http://www.opencascade.com
@@ -168,7 +168,7 @@ See @ref occt_dev_guides__documentation "OCCT Documentation Guide" for details o
**Generation of HTML documentation**
To generate HTML documentation from sources contained in *dox* subdirectory,
you need to have Tcl and Doxygen 1.8.4 (or above) installed on your system.
you need to have Tcl and Doxygen 1.8.5 (or above) installed on your system.
In Tcl prompt, cd to OCCT root folder and run
@@ -184,7 +184,7 @@ is available for download from www.opencascade.org and dev.opencascade.org sites
Prerequisites:
* Doxygen version 1.8.4 or higher
* Doxygen version 1.8.5 or higher
* Graphviz version 2.28.0 or higher
Run WOK (cd \<WOK_INSTALL_DIR\>/site folder):
@@ -224,7 +224,7 @@ for which OCCT is certified to work.
| Minimum memory | 512 MB, 1 GB recommended |
| Free disk space (complete installation) | 600 MB approx. |
| Video card | See \ref overview_req_graphics |
| Graphic library | OpenGL 1.1+ (OpenGL 2.1+ is recommended)|
| Graphic library | OpenGL 3.3+, OpenGL ES 2.0+ |
| C++ | GNU gcc 4.0. - 4.7.3. |
| TCL (for testing tools) | Tcl/Tk 8.5 or 8.6 http://www.tcl.tk/software/tcltk/download.html |
| Qt (for demonstration tools) | Qt 4.8.6 http://qt-project.org/downloads |
@@ -243,7 +243,7 @@ for which OCCT is certified to work.
| Minimum memory | 512 MB, 1 GB recommended |
| Free disk space (complete installation) | 600 MB approx. |
| Video card | See \ref overview_req_graphics |
| Graphic library | OpenGL 1.1+ (OpenGL 2.1+ is recommended)|
| Graphic library | OpenGL 3.3+, OpenGL ES 2.0+ |
| C++ | Microsoft Visual Studio: 2005 SP1, 2008 SP1, 2010 SP1 \*, 2012 Update 3, 2013 <br>Intel C++ Composer XE 2013 SP1 |
| TCL (for testing tools) | Tcl/Tk 8.5 or 8.6 http://www.tcl.tk/software/tcltk/download.html |
| Qt (for demonstration tools) | Qt 4.8.6 http://qt-project.org/downloads |
@@ -253,7 +253,7 @@ for which OCCT is certified to work.
| Intel TBB (optional, for multithreaded algorithms) | TBB 3.x or 4.x http://www.threadingbuildingblocks.org/ |
| VTK (for VTK Integration Services | VTK 6.1.0 http://www.vtk.org/VTK/resources/software.html |
* VC++ 10 32-bit is used for certification of contributions and for building
* VC++ 10 64-bit is used for certification of contributions and for building
binary package of official release of OCCT on Windows.
@subsection OCCT_OVW_SECTION_5_3 MAC OS X
@@ -331,14 +331,14 @@ OCCT installation with reference documentation requires 1,4 Gb on disk.
* Launch the installer and follow the instructions.
The includes and binaries of third-party libraries necessary for building and launching
OCCT are included into binary distribution (built with Visual C++ 2008).
OCCT are included into binary distribution (built with Visual C++ 2010).
When the installation is complete, you will find the directories for 3rd party products
(some might be absent in case of custom installation) and the main **OCCT** directory:
@image html /overview/images/overview_3rdparty.png
@image latex /overview/images/overview_3rdparty.png
The contents of the OCCT-6.8.0 directory (called further "OCCT root", or $CASROOT) are as follows:
The contents of the OCCT-6.9.0 directory (called further "OCCT root", or $CASROOT) are as follows:
@image html /overview/images/overview_installation.png "The directory tree"
@image latex /overview/images/overview_installation.png "The directory tree"
@@ -354,7 +354,7 @@ The contents of the OCCT-6.8.0 directory (called further "OCCT root", or $CASROO
* **samples** This folder contains sample applications.
* **src** This folder contains OCCT source files. They are organized in folders, one per development unit;
* **tests** This folder contains scripts for OCCT testing.
* **win32/vc10** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2010;
* **win64/vc10** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2010;
@section OCCT_OVW_SECTION_4_2 Environment Variables

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -4790,7 +4790,7 @@ circle c 50 0 0 20
revsurf s c 0 0 0 0 1 0
~~~~~
@subsubsection occt_draw_6_3*11 extsurf
@subsubsection occt_draw_6_3_11 extsurf
Syntax:
~~~~~
@@ -7023,13 +7023,14 @@ buildevol
~~~~~
@subsection occt_draw_7_9 Topological analysis
@subsection occt_draw_7_9 Analysis of topology and geometry
Analysis of shapes includes commands to compute length, area, volumes and inertial properties.
* Use **lprops**, **sprops**, **vprops** to compute integral properties.
* Use **bounding** to display the bounding box of a shape.
* Use **distmini** to calculate the minimum distance between two shapes.
* Use **xdistef**, **xdistcs**, **xdistcc**, **xdistc2dc2dss**, **xdistcc2ds** to check the distance between two objects on even grid.
@subsubsection occt_draw_7_9_1 lprops, sprops, vprops
@@ -7132,6 +7133,37 @@ are:
==d1_val d1 d12
~~~~~
@subsubsection occt_draw_7_9_4 xdistef, xdistcs, xdistcc, xdistc2dc2dss, xdistcc2ds
Syntax:
~~~~~
xdistef edge face
xdistcs curve surface firstParam lastParam [NumberOfSamplePoints]
xdistcc curve1 curve2 startParam finishParam [NumberOfSamplePoints]
xdistcc2ds c curve2d surf startParam finishParam [NumberOfSamplePoints]
xdistc2dc2dss curve2d_1 curve2d_2 surface_1 surface_2 startParam finishParam [NumberOfSamplePoints]
~~~~~
It is assumed that curves have the same parametrization range and *startParam* is less than *finishParam*.
Commands with prefix *xdist* allow checking the distance between two objects on even grid:
* **xdistef** - distance between edge and face;
* **xdistcs** - distance between curve and surface. This means that the projection of each sample point to the surface is computed;
* **xdistcc** - distance between two 3D curves;
* **xdistcc2ds** - distance between 3d curve and 2d curve on surface;
* **xdistc2dc2dss** - distance between two 2d curves on surface.
**Examples**
~~~~~
bopcurves b1 b2 -2d
mksurf s1 b1
mksurf s2 b2
xdistcs c_1 s1 0 1 100
xdistcc2ds c_1 c2d2_1 s2 0 1
xdistc2dc2dss c2d1_1 c2d2_1 s1 s2 0 1 1000
~~~~~
@subsection occt_draw_7_10 Surface creation
Surface creation commands include surfaces created from boundaries and from spaces between shapes.

View File

@@ -195,7 +195,7 @@ AnInterpolator.Load (StartingTangent, EndingTangent);
@subsection occt_modalg_2_4 Lines and Circles from Constraints
@subsibsection occt_modalg_2_4_1 Types of constraints
@subsubsection occt_modalg_2_4_1 Types of constraints
The algorithms for construction of 2D circles or lines can be described with numeric or geometric constraints in relation to other curves.
@@ -244,7 +244,7 @@ GccAna_Circ2d2TanRad
This expression finds all circles of radius *Rad*, which are tangent to both circle *C1* and *C2*, while *C1* is outside and *C2* is inside.
@subsection occt_modalg_2_4_2 Available types of lines and circles
@subsubsection occt_modalg_2_4_2 Available types of lines and circles
The following analytic algorithms using value-handled entities for creation of 2D lines or circles with geometric constraints are available:
* circle tangent to three elements (lines, circles, curves, points),
@@ -448,7 +448,7 @@ GccAna_Circ2d2TanRad Solver(GccEnt::Unqualified(C1),
~~~~~
@subsection occt_modalg_2_4_2 Types of algorithms
@subsubsection occt_modalg_2_4_3 Types of algorithms
OCCT implements several categories of algorithms:
@@ -555,7 +555,7 @@ The class *GeomFill_BezierCurves* allows producing a Bezier surface from contigu
The class *GeomFill_BSplineCurves* allows producing a BSpline surface from contiguous BSpline curves. Note that problems may occur with rational BSplines.
@subsubsection occt_modalg_2_5_2 Pipe Surfaces
@subsubsection occt_modalg_2_5_3 Pipe Surfaces
The class *GeomFill_Pipe* allows producing a pipe by sweeping a curve (the section) along another curve (the path). The result is a BSpline surface.
@@ -565,14 +565,14 @@ The following types of construction are available:
* pipes with a section evolving between two given curves.
@subsubsection occt_modalg_2_5_3 Filling a contour
@subsubsection occt_modalg_2_5_4 Filling a contour
It is often convenient to create a surface from two or more curves which will form the boundaries that define the new surface.
This is done by the class *GeomFill_ConstrainedFilling*, which allows filling a contour defined by two, three or four curves as well as by tangency constraints. The resulting surface is a BSpline.
A case in point is the intersection of two fillets at a corner. If the radius of the fillet on one edge is different from that of the fillet on another, it becomes impossible to sew together all the edges of the resulting surfaces. This leaves a gap in the overall surface of the object which you are constructing.
@figure{/technical_overview/images/modeling_algos_image059.png,"Intersecting filleted edges with differing radiuses"}
@figure{/user_guides/modeling_algos/images/modeling_algos_image059.png,"Intersecting filleted edges with differing radiuses"}
These algorithms allow you to fill this gap from two, three or four curves. This can be done with or without constraints, and the resulting surface will be either a Bezier or a BSpline surface in one of a range of filling styles.
@@ -595,7 +595,7 @@ The enumerations *FillingStyle* specify the styles used to build the surface. Th
@image html /user_guides/modeling_algos/images/modeling_algos_image018.png "Intersecting filleted edges with different radii leave a gap, is filled by a surface"
@image latex /user_guides/modeling_algos/images/modeling_algos_image018.png "Intersecting filleted edges with different radii leave a gap, is filled by a surface"
@subsubsection occt_modalg_2_5_4 Plate surfaces
@subsubsection occt_modalg_2_5_5 Plate surfaces
In CAD, it is often necessary to generate a surface which has no exact mathematical definition, but which is defined by respective constraints. These can be of a mathematical, a technical or an aesthetic order.
@@ -605,7 +605,7 @@ curve constraints and the point constraint respectively. The resulting surface c
The surface is built using a variational spline algorithm. It uses the principle of deformation of a thin plate by localised mechanical forces. If not already given in the input, an initial surface is calculated. This corresponds to the plate prior
to deformation. Then, the algorithm is called to calculate the final surface. It looks for a solution satisfying constraints and minimizing energy input.
@figure{/technical_overview/images/modeling_algos_image061.png,"Surface generated from two curves and a point"}
@figure{/user_guides/modeling_algos/images/modeling_algos_image061.png,"Surface generated from two curves and a point"}
The package *GeomPlate* provides the following services for creating surfaces respecting curve and point constraints:
@@ -631,7 +631,7 @@ The class *Surface* allows describing the characteristics of plate surface objec
The class *MakeApprox* allows converting a *GeomPlate* surface into a *Geom_BSplineSurface*.
@figure{/technical_overview/images/modeling_algos_image060.png,"Surface generated from four curves and a point"}
@figure{/user_guides/modeling_algos/images/modeling_algos_image060.png,"Surface generated from four curves and a point"}
Let us create a Plate surface and approximate it from a polyline as a curve constraint and a point constraint
@@ -1200,7 +1200,7 @@ There are two root classes for their construction and modification:
* The deferred class *BRepBuilderAPI_MakeShape* is the root of all *BRepBuilderAPI* classes, which build shapes. It inherits from the class *BRepBuilderAPI_Command* and provides a field to store the constructed shape.
* The deferred class *BRepBuilderAPI_ModifyShape* is used as a root for the shape modifications. It inherits *BRepBuilderAPI_MakeShape* and implements the methods used to trace the history of all sub-shapes.
@subection occt_modalg_3_1 Vertex
@subsection occt_modalg_3_1 Vertex
*BRepBuilderAPI_MakeVertex* creates a new vertex from a 3D point from gp.
~~~~~

View File

@@ -4,7 +4,7 @@ Visualization {#occt_user_guides__visualization}
@section occt_visu_1 Introduction
Visualization in Open CASCADE Technology is based on the separation of:
Visualization in Open CASCADE Technology is based on the separation of:
* on the one hand - the data which stores the geometry and topology of the entities you want to display and select, and
* on the other hand - its **presentation** (what you see when an object is displayed in a scene) and **selection** (possibility to choose the whole object or its sub-parts interactively to apply application-defined operations to the selected entities).
@@ -16,7 +16,7 @@ Presentations are managed through the **Presentation** component, and selection
If, however, you require types of interactive objects and filters other than those provided, you will need to know the mechanics of presentable and selectable objects, specifically how to implement their virtual functions. To do this requires familiarity with such fundamental concepts as the sensitive primitive and the presentable object.
The the following packages are used to display 3D objects :
The the following packages are used to display 3D objects:
* *AIS*;
* *StdPrs*;
* *Prs3d*;
@@ -31,12 +31,12 @@ The figure below presents a schematic overview of the relations between the key
@image html visualization_image003.png "Key concepts and packages in visualization"
@image latex visualization_image003.png "Key concepts and packages in visualization"
To answer different needs of CASCADE users, this Users Guide offers the following three paths in reading it.
 
To answer different needs of CASCADE users, this User's Guide offers the following three paths in reading it.
* If the 3D services proposed in AIS meet your requirements, you need only read chapter 3 <a href="#occt_visu_3">AIS: Application Interactive Services</a>.
* If you need more detail, for example, a selection filter on another type of entity - you should read chapter 2 <a href="#occt_visu_2">Fundamental Concepts</a>, chapter 3 <a href="#occt_visu_3">AIS: Application Interactive Services</a>, and 4 <a href="#occt_visu_4">3D Presentations</a>. You may want to begin with the chapter presenting AIS.
@section occt_visu_2  Fundamental Concepts
@section occt_visu_2 Fundamental Concepts
@subsection occt_visu_2_1 Presentation
@@ -44,7 +44,7 @@ In Open CASCADE Technology, presentation services are separated from the data,
@subsubsection occt_visu_2_1_1 Structure of the Presentation
Displaying an object on the screen involves three kinds of entities:
Displaying an object on the screen involves three kinds of entities:
* a presentable object, the *AIS_InteractiveObject*
* a viewer
* an interactive context, the *AIS_InteractiveContext*.
@@ -71,16 +71,16 @@ Presentation involves at least the *AIS, PrsMgr, StdPrs* and *V3d* packages. Ad
* *StdPrs* package provides ready-to-use standard presentation algorithms for specific geometries: points, curves and shapes of the geometry and topology toolkits.
* *Prs3d* package provides generic presentation algorithms such as wireframe, shading and hidden line removal associated with a *Drawer* class, which controls the attributes of the presentation to be created in terms of color, line type, thickness, etc.
* *V3d* package provides the services supported by the 3D viewer.
* *Graphic3d* package provides resources to create 3D graphic structures.
* *Graphic3d* package provides resources to create 3D graphic structures.
* *Visual3d* package contains classes implementing commands for 3D viewer.
* *DsgPrs* package provides tools for display of dimensions, relations and XYZ trihedrons.
@subsubsection occt_visu_2_1_3 A Basic Example: How to display a 3D object
~~~~~
Void Standard_Real dx  = ...; //Parameters
Void Standard_Real dy  = ...; //to build a wedge
Void Standard_Real dz  = ...;
Void Standard_Real dx = ...; //Parameters
Void Standard_Real dy = ...; //to build a wedge
Void Standard_Real dz = ...;
Void Standard_Real ltx = ...;
Handle(V3d_Viewer)aViewer = ...;
@@ -104,29 +104,29 @@ The shape is created using the *BRepPrimAPI_MakeWedge* command. An *AIS_Shape*
Objects that may be selected graphically, are displayed as sets of sensitive primitives, which provide sensitive zones in 2D graphic space. These zones are sorted according to their position on the screen when starting the selection process.
@image html visualization_image006.png "A model"
@image latex visualization_image006.png "A model"
@image html visualization_image006.png "A model"
@image latex visualization_image006.png "A model"
The position of the mouse is also associated with a sensitive zone. When moving within the window where objects are displayed, the areas touched by the zone of the mouse are analyzed. The owners of these areas are then highlighted or signaled by other means such as the name of the object highlighted in a list. That way, you are informed of the identity of the detected element.
@image html visualization_image007.png "Modeling faces with sensitive primitives"
@image latex visualization_image007.png "Modeling faces with sensitive primitives"
@image html visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle"  
@image html visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle"
@image latex visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle"
@image html visualization_image009.png "Reference to the sensitive primitive, then to the owner"
@image latex visualization_image009.png "Reference to the sensitive primitive, then to the owner"
@subsubsection occt_visu_2_2_1 The Sensitive Primitive
@subsubsection occt_visu_2_2_1 The Sensitive Primitive
The sensitive primitive along with the entity owner allows defining what can be made selectable, and providing the link between the applicative object and the sensitive zones defined by the 2D bounding boxes. To be dynamically selectable, an object has to be represented either as a sensitive primitive or a set of them, e.g. 2D boxes that will be included in a sorting algorithm.
The use of 2D boxes allows a pre-selection of the detected entities. After pre-selection, the algorithm checks which sensitive primitives are actually detected. When detected, the primitives provide their owners identity.
The use of 2D boxes allows a pre-selection of the detected entities. After pre-selection, the algorithm checks which sensitive primitives are actually detected. When detected, the primitives provide their owners' identity.
@image html visualization_image010.png "Example of sensitive primitives"
@image latex visualization_image010.png "Example of sensitive primitives"
@image latex visualization_image010.png "Example of sensitive primitives"
In the example, the sensitive line segment proposes a bounding box to the selector. During selection, positions 1 and 2 of the mouse detect the box but after sorting, only position 2 retains the line segment as selected by the algorithm.
@@ -148,7 +148,7 @@ as the mouse cursor moves over them. This allows the user to be certain that th
<h4>Selectable Object</h4>
A selectable object presents a given number of selection modes which can be redefined, and which will be activated or deactivated in the selection managers selectors.
A selectable object presents a given number of selection modes which can be redefined, and which will be activated or deactivated in the selection manager's selectors.
Note that the selection mode of a selectable object, can refer to the selection mode of the object itself or to the selection mode of its part.
@@ -167,7 +167,7 @@ See also <a href="#occt_visu_3">AIS: Application Interactive Services</a>.
Let us consider, for example, a 3D selectable shape object, which corresponds to a topological shape.
For this class, seven selection modes can be defined:
* mode 0 - selection of the shape itself
* mode 0 - selection of the shape itself
* mode 1 - selection of vertices
* mode 2 - selection of edges
* mode 3 - selection of wires
@@ -335,7 +335,7 @@ When all these steps have been carried out, follow the procedure below:
1. Create an interactive context.
2. Create the selectable objects and calculate their various possible selections.
3. Load these selectable objects in the interactive context. The objects may be common to all the selectors, i.e. they will be seen by all the selectors in the selection manager, or local to one selector or more.
4. Activate or deactivate the objects selection modes in the selector(s). When activating a selection mode in a selector for a given object, the manager sends the order to make the sensitive primitives in this selector selectable. If the primitives are to projected from 3D to 2D, the selector calls the specific method used to carry out this projection.
4. Activate or deactivate the objects' selection modes in the selector(s). When activating a selection mode in a selector for a given object, the manager sends the order to make the sensitive primitives in this selector selectable. If the primitives are to projected from 3D to 2D, the selector calls the specific method used to carry out this projection.
At this stage, the selection of selectable entities in the selectors is available.
The selection loop informs constantly the selectors with the position of the mouse and questions them about the detected entities.
@@ -361,11 +361,11 @@ To build the selection, which corresponds to the mode "selection of the rooms"
Void House::ComputeSelection
(Const Handle(SelectMgr_Selection)& Sel,
 const Standard_Integer mode {
 switch(mode){  
const Standard_Integer mode {
switch(mode){
case 0: //Selection of the rooms
{  
for(Standard_Integer i = 1; i <= myNbRooms; i++)  
{
for(Standard_Integer i = 1; i <= myNbRooms; i++)
{
//for every room, create an instance of the owner, the given room and its name.
Handle(RoomOwner) aRoomOwner = new RoomOwner (Room(i), NameRoom(i));
@@ -373,10 +373,10 @@ Void House::ComputeSelection
Handle(Select3d_SensitiveBox) aSensitiveBox;
aSensitiveBox = new Select3d_SensitiveBox
(aRoomOwner, Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
 Sel -> Add(aSensitiveBox);  
}  
break;  
Case 1: ... //Selection of the doors  
Sel -> Add(aSensitiveBox);
}
break;
Case 1: ... //Selection of the doors
} //Switch
) // ComputeSelection
~~~~~
@@ -387,8 +387,8 @@ Void House::ComputeSelection
@image html visualization_image013.png "Activated sensitive rectangles in the selector during dynamic selection in view 1"
@image latex visualization_image013.png "Activated sensitive rectangles in the selector during dynamic selection in view 1"
@image html visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)"
@image latex visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)"
@image html visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)"
@image latex visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)"
@image html visualization_image015.png "Sensitive rectangles in the selector during dynamic selection in view 2"
@image latex visualization_image015.png "Sensitive rectangles in the selector during dynamic selection in view 2"
@@ -448,20 +448,20 @@ If you are creating your own type of interactive object, you must implement the
~~~~~
void PackageName_ClassName::Compute
(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
 const Handle(Prs3d_Presentation)& aPresentation,
 const Standard_Integer aMode = 0);
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode = 0);
~~~~~
#### For hidden line removal (HLR) mode in 3D:
~~~~~
void PackageName_ClassName::Compute
(const Handle(Prs3d_Projector)& aProjector,
 const Handle(Prs3d_Presentation)& aPresentation);
const Handle(Prs3d_Presentation)& aPresentation);
~~~~~
@subsubsection occt_visu_3_2_2 Hidden Line Removal
The view can have two states: the normal mode or the computed mode (Hidden Line Removal mode). When the latter is active, the view looks for all presentations displayed in the normal mode, which have been signalled as accepting HLR mode. An internal mechanism allows calling the interactive objects own *Compute*, that is projector function.
The view can have two states: the normal mode or the computed mode (Hidden Line Removal mode). When the latter is active, the view looks for all presentations displayed in the normal mode, which have been signalled as accepting HLR mode. An internal mechanism allows calling the interactive object's own *Compute*, that is projector function.
By convention, the Interactive Object accepts or rejects the representation of HLR mode. It is possible to make this declaration in one of two ways:
@@ -472,8 +472,8 @@ By convention, the Interactive Object accepts or rejects the representation of
* Later by using the function *PrsMgr_PresentableObject::SetTypeOfPresentation*
*AIS_Shape* class is an example of an interactive object that supports HLR representation. It supports two types of the HLR algorithm:
* the polygonal algorithm based on the shapes triangulation;
* the exact algorithm that works with the shapes real geometry.
* the polygonal algorithm based on the shape's triangulation;
* the exact algorithm that works with the shape's real geometry.
The type of the HLR algorithm is stored in *AIS_Drawer* of the shape. It is a value of the *Prs3d_TypeOfHLR* enumeration and can be set to:
* *Prs3d_TOH_PolyAlgo* for a polygonal algorithm;
@@ -521,17 +521,17 @@ Note that the same presentation (and consequently the same highlight mode) is u
For example, you want to systematically highlight the wireframe presentation of a shape - non regarding if it is visualized in wireframe presentation or with shading. Thus, you set the highlight mode to *0* in the constructor of the interactive object. Do not forget to implement this representation mode in the *Compute* functions.
#### Infinite Status
If you dont want an object to be affected by a *FitAll* view, you must declare it infinite; you can cancel its "infinite" status using *AIS_InteractiveObject::SetInfiniteState* and *AIS_InteractiveObject::IsInfinite* functions.
If you do not want an object to be affected by a *FitAll* view, you must declare it infinite; you can cancel its "infinite" status using *AIS_InteractiveObject::SetInfiniteState* and *AIS_InteractiveObject::IsInfinite* functions.
Let us take for example the class called *IShape* representing an interactive object :
~~~~~
myPk_IShape::myPK_IShape
(const TopoDS_Shape& SH, PrsMgr_TypeOfPresentation aType):
AIS_InteractiveObject(aType), myShape(SH), myDrwr(new AIS_Drawer()) {SetHilightMode(0);} 
AIS_InteractiveObject(aType), myShape(SH), myDrwr(new AIS_Drawer()) {SetHilightMode(0);}
void myPk_IShape::Compute
(const Handle(PrsMgr_PresentationManager3d) & PM,
const Handle(Prs3d_Presentation)& P,  
const Handle(Prs3d_Presentation)& P,
const Standard_Integer TheMode)
{
switch (TheMode){
@@ -577,7 +577,7 @@ These functions can be useful if you decide that the *0* mode used by default w
* *AIS_InteractiveObject::SetSelectionPriority* sets a priority;
* *AIS_InteractiveObject::UnsetSelectionPriority* unsets the priority.
    
@subsubsection occt_visu_3_2_5 Graphic attributes
Graphic attributes manager, or *AIS Drawer*, stores graphic attributes for specific interactive objects and for interactive objects controlled by interactive context.
@@ -603,7 +603,7 @@ The following virtual functions provide settings for color, width, material and
* *AIS_InteractiveObject::SetWidth*
* *AIS_InteractiveObject::UnsetWidth*
* *AIS_InteractiveObject::SetMaterial (const Graphic3d_NameOfPhysicalMaterial & aName)*
* *AIS_InteractiveObject::SetMaterial  (const Graphic3d_MaterialAspect & aMat)*
* *AIS_InteractiveObject::SetMaterial (const Graphic3d_MaterialAspect & aMat)*
* *AIS_InteractiveObject::UnsetMaterial*
* *AIS_InteractiveObject::SetTransparency*
* *AIS_InteractiveObject::UnsetTransparency*
@@ -645,7 +645,7 @@ Due to the fact that the accuracy of three-dimensional graphics coordinates has
To the problem when the elements of two or more Interactive Objects are coincident you can apply the polygon offset. It is a sort of graphics computational offset, or depth buffer offset, that allows you to arrange elements (by modifying their depth value) without changing their coordinates. The graphical elements that accept this kind of offsets are solid polygons or displayed as boundary lines and points. The polygons could be displayed as lines or points by setting the appropriate interior style.
The method *AIS_InteractiveObject::SetPolygonOffsets (const Standard_Integer aMode, const Standard_Real aFactor, const Standard_Real aUnits)* allows setting up the polygon offsets.
The method *AIS_InteractiveObject::SetPolygonOffsets (const Standard_Integer aMode, const Standard_Real aFactor, const Standard_Real aUnits)* allows setting up the polygon offsets.
The parameter *aMode* can contain various combinations of *Aspect_PolygonOffsetMode* enumeration elements:
* *Aspect_POM_None*
@@ -665,14 +665,14 @@ Negative offset values move polygons closer to the viewer while positive values
**Warning**
This method has a side effect it creates its own shading aspect if not yet created, so it is better to set up the object shading aspect first.
This method has a side effect - it creates its own shading aspect if not yet created, so it is better to set up the object shading aspect first.
You can use the following functions to obtain the current settings for polygon offsets:
~~~~~
void AIS_InteractiveObject::PolygonOffsets
(Standard_Integer &aMode,
 Standard_Real &aFactor,
 Standard_Real &aUnits)
Standard_Real &aFactor,
Standard_Real &aUnits)
Standard_Boolean AIS_InteractiveObject::HasPolygonOffsets()
~~~~~
@@ -680,15 +680,15 @@ The same operation could be performed for the interactive object known by the *
~~~~~
void AIS_InteractiveContext::SetPolygonOffsets
(const Handle(AIS_InteractiveObject) &anObj,
 const Standard_Integer aMode,
 const Standard_Real aFactor,
 const Standard_Real aUnits)
const Standard_Integer aMode,
const Standard_Real aFactor,
const Standard_Real aUnits)
void AIS_InteractiveContext::PolygonOffsets
(const Handle(AIS_InteractiveObject) &anObj,
 Standard_Integer &aMode,
 Standard_Real &aFactor,
 Standard_Real &aUnits)
Standard_Boolean     AIS_InteractiveContext::HasPolygonOffsets
Standard_Integer &aMode,
Standard_Real &aFactor,
Standard_Real &aUnits)
Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets
(const Handle(AIS_InteractiveObject) &anObj)
~~~~~
@@ -803,7 +803,7 @@ Closing Local Contexts is done by:
~~~~~
*Warning*
When the index isnt specified in the first function, the current Context is closed. This option can be dangerous, as other Interactive Functions can open local contexts without necessarily warning the user. For greater security, you have to close the context with the index given on opening.
When the index is not specified in the first function, the current Context is closed. This option can be dangerous, as other Interactive Functions can open local contexts without necessarily warning the user. For greater security, you have to close the context with the index given on opening.
To get the index of the current context, use function *AIS_InteractiveContext::IndexOfCurrentLocal*. It allows closing all open local contexts at one go. In this case, you find yourself directly at Neutral Point.
@@ -819,14 +819,14 @@ Neutral Point should be used to visualize the interactive objects, which repres
~~~~~
AIS_InteractiveContext::Display
(const Handle(AIS_InteractiveObject)& anIobj,
 const Standard_Boolean updateviewer=Standard_True);
const Standard_Boolean updateviewer=Standard_True);
AIS_InteractiveContext::Display
(const Handle(AIS_InteractiveObject)& anIobj,
 const Standard_Integer amode,
 const Standard_Integer aSelectionMode,
 const Standard_Boolean updateviewer = Standard_True,
 const Standard_Boolean allowdecomposition = Standard_True);
const Standard_Integer amode,
const Standard_Integer aSelectionMode,
const Standard_Boolean updateviewer = Standard_True,
const Standard_Boolean allowdecomposition = Standard_True);
AIS_InteractiveContext::Erase
AIS_InteractiveContext::EraseMode
@@ -840,12 +840,12 @@ AIS_InteractiveContext::Display
Bear in mind the following points:
* It is recommended to display and erase interactive objects when no local context is opened, and open a local context for local selection only.
* The first *Display* function among the two ones available in *InteractiveContext* visualizes the object in its default mode (set with help of SetDisplayMode() method of InteractiveObject prior to Display() call), or in the default context mode, if applicable. If it has neither, the function displays it in 0 presentation mode. The objects default selection mode is automatically activated (0 mode by convention).
* The first *Display* function among the two ones available in *InteractiveContext* visualizes the object in its default mode (set with help of SetDisplayMode() method of InteractiveObject prior to Display() call), or in the default context mode, if applicable. If it has neither, the function displays it in 0 presentation mode. The object's default selection mode is automatically activated (0 mode by convention).
* Activating the displayed object by default can be turned off with help of *SetAutoActivateSelection()* method. This might be efficient if you are not interested in selection immediately after displaying an object.
* The second *Display* function should only be used in Neutral Point to visualize a supplementary mode for the object, which you can erase by *EraseMode (...)*. You activate the selection mode. This is passed as an argument. By convention, if you do not want to activate a selection mode, you must set the *SelectionMode* argument to -1. This function is especially interesting in open local context, as we will see below.
* In Neutral Point, it is not advisable to activate other selection modes than the default selection one. It is preferable to open a local context in order to activate particular selection modes.
* When you call *Erase(Interactive object)* function, the *PutIncollector* argument, which is *FALSE* by default, allows you to visualize the object directly in the Collector and makes it selectable (by activation of 0 mode). You can nonetheless block its passage through the Collector by changing the value of this option. In this case, the object is present in the Interactive Context, but is not seen anywhere.
* *Erase()* with *putInCollector = Standard_True* might be slow as it recomputes the object presentation in the Collector. Set *putInCollector* to *Standard_False* if you simply want to hide the objects presentation temporarily.
* *Erase()* with *putInCollector = Standard_True* might be slow as it recomputes the object presentation in the Collector. Set *putInCollector* to *Standard_False* if you simply want to hide the object's presentation temporarily.
* Visualization attributes and graphic behavior can be modified through a set of functions similar to those for the interactive object (color, thickness of line, material, transparency, locations, etc.) The context then manages immediate and deferred updates.
* Call *Remove()* method of *InteractiveContext* as soon as the interactive object is no longer needed and you want to destroy it.. Otherwise, references to *InteractiveObject* are kept by *InteractiveContext*, and the *Object* is not destroyed, which results in memory leaks. In general, if the presentation of an interactive object can be computed quickly, it is recommended to *Remove()* it instead of using *Erase()* method.
@@ -855,7 +855,7 @@ In open local context, the *Display* functions presented above can be as well.
**WARNING**
The function *AIS_InteractiveObject::Display* automatically activates the objects default selection mode. When you only want to visualize an Interactive Object in open Context, you must call the function *AIS_InteractiveContext::Display*.
The function *AIS_InteractiveObject::Display* automatically activates the object's default selection mode. When you only want to visualize an Interactive Object in open Context, you must call the function *AIS_InteractiveContext::Display*.
You can activate or deactivate specific selection modes in the local open context in several different ways:
Use the Display functions with the appropriate modes.
@@ -934,7 +934,7 @@ myContext->Display(myAIShape,1,-1,Standard_True,Standard_True);
Handle(StdSelect_FaceFilter) Fil1= new
StdSelect_FaceFilter(StdSelect_Revol);
Handle(StdSelect_FaceFilter) Fil2= new
      StdSelect_FaceFilter(StdSelect_Plane);
StdSelect_FaceFilter(StdSelect_Plane);
myContext->AddFilter(Fil1);
myContext->AddFilter(Fil2);
@@ -1004,7 +1004,7 @@ while (myAISCtx->MoreSelected())
{
TopoDS_Shape ashape = myAISCtx->SelectedShape();
// to be able to use the picked shape
            }
}
else
{
Handle_AIS_InteractiveObject anyobj = myAISCtx->Interactive();
@@ -1080,8 +1080,8 @@ For your applicative function, you need an axis to create a revolved object. Yo
~~~~~
myIHMEditor::myIHMEditor
(const Handle(AIS_InteractiveContext)& Ctx,
 ....) :
 myCtx(Ctx),
....) :
myCtx(Ctx),
...
{
}
@@ -1092,7 +1092,7 @@ myIndex =myCtx->OpenLocalContext();
//the filters
Handle(AIS_SignatureFilter) F1 = new  AIS_SignatureFilter(AIS_KOI_Datum,AIS_SD_Point);
Handle(AIS_SignatureFilter) F1 = new AIS_SignatureFilter(AIS_KOI_Datum,AIS_SD_Point);
//filter on the points
Handle(AIS_SignatureFilter) F2 = new AIS_SignatureFilter(AIS_KOI_Datum,AIS_SD_Axis);
@@ -1122,8 +1122,8 @@ Standard_Boolean myIHMEditor::Select()
myCTX->Select();
myCTX->InitSelected();
if(myCTX->MoreSelected())
 {
 if(myCTX->HasSelectedShape())
{
if(myCTX->HasSelectedShape())
{ const TopoDS_Shape& sh = myCTX->SelectedShape();
if( vertex){
if(myFirstV...)
@@ -1136,19 +1136,19 @@ Standard_Boolean myIHMEditor::Select()
// the filter on the AIS_Points
myFirstV = Standard_False;
return Standard_True;
 }
}
else
 {
{
mypoint2 =...;
// construction of the axis return Standard_False;
}
 }
 else
  {
}
else
{
//it is a cylindrical face : you recover the axis; visualize it; and stock it.
return Standard_False;
}
  }
}
// it is not a shape but is no doubt a point.
else
{
@@ -1242,7 +1242,7 @@ And at maximum seven selection modes, depending on the shape complexity:
* *AIS_Triangulation* is a simple interactive object for displaying triangular mesh contained in *Poly_Triangulation* container.
* *AIS_ConnectedInteractive* is an Interactive Object connecting to another interactive object reference, and located elsewhere in the viewer makes it possible not to calculate presentation and selection, but to deduce them from your object reference.
* *AIS_ConnectedShape* is an object connected to interactive objects having a shape; this class has the same decompositions as *AIS_Shape*. Whats more, it allows a presentation of hidden parts, which are calculated automatically from the shape of its reference.
* *AIS_ConnectedShape* is an object connected to interactive objects having a shape; this class has the same decompositions as *AIS_Shape*. Furthermore, it allows a presentation of hidden parts, which are calculated automatically from the shape of its reference.
* *AIS_MultipleConnectedInteractive* is an object connected to a list of interactive objects (which can also be Connected objects. It does not require memory hungry calculations of presentation)
* *AIS_MultipleConnectedShape* is an interactive Object connected to a list of interactive objects having a Shape <i>(AIS_Shape, AIS_ConnectedShape, AIS_MultipleConnectedShape)</i>. The presentation of hidden parts is calculated automatically.
* *AIS_TexturedShape* is an Interactive Object that supports texture mapping. It is constructed as a usual AIS_Shape, but has additional methods that allow to map a texture on it.
@@ -1319,7 +1319,7 @@ The list of relations is not exhaustive.
*MeshVS_Mesh* is an Interactive Object that represents meshes. This object differs from the *AIS_Shape* as its geometrical data is supported by the data source *MeshVS_DataSource* that describes nodes and elements of the object. As a result, you can provide your own data source.
However, the *DataSource* does not provide any information on attributes, for example nodal colors, but you can apply them in a special way by choosing the appropriate presentation builder.
However, the *DataSource* does not provide any information on attributes, for example nodal colors, but you can apply them in a special way - by choosing the appropriate presentation builder.
The presentations of *MeshVS_Mesh* are built with the presentation builders *MeshVS_PrsBuilder*. You can choose between the builders to represent the object in a different way. Moreover, you can redefine the base builder class and provide your own presentation builder.
@@ -1391,14 +1391,14 @@ aMesh->AddBuilder (aBuilder, Standard_True);
*MeshVS_NodalColorPrsBuilder* allows representing a mesh with a color scaled texture mapped on it.
To do this you should define a color map for the color scale, pass this map to the presentation builder,
and define an appropriate value in the range of 0.0 1.0 for every node.
and define an appropriate value in the range of 0.0 - 1.0 for every node.
The following example demonstrates how you can do this (check if the view has been set up to display textures):
~~~~~
// assign nodal builder to the mesh
Handle (MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder
    (aMesh,MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask);
(aMesh,MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask);
aBuilder->UseTexture (Standard_True);
// prepare color map
@@ -1408,10 +1408,10 @@ aColorMap.Append ((Quantity_NameOfColor) Quantity_NOC_BLUE1);
// assign color scale map values (0..1) to nodes
TColStd_DataMapOfIntegerReal aScaleMap;
...
// iterate through the nodes and add an node id and an appropriate value to the map
aScaleMap.Bind (anId, aValue);
 
// pass color map and color scale values to the builder
aBuilder->SetColorMap (aColorMap);
aBuilder->SetInvalidColor (Quantity_NOC_BLACK);
@@ -1474,7 +1474,7 @@ The *ComputeSelection* function for the interactive box can have the following
~~~~~
void InteractiveBox::ComputeSelection
(const Handle(SelectMgr_Selection)& Sel,
 const Standard_Integer Mode)
const Standard_Integer Mode)
{
switch(Mode)
{ case 0: //locating the whole box by making its faces sensitive...
@@ -1487,8 +1487,8 @@ void InteractiveBox::ComputeSelection
Sel->Add(new Select3D_SensitiveFace(Ownr,Array,Sensitivity));
}
break;
   }
  case 1:
}
case 1:
// locates the edges {
for(Standard_Integer i=1;i<=12;i++)
{
@@ -1527,7 +1527,7 @@ for(VS->Init();VS->More();VS->Next())
{
VS->Picked();
// picking of all owners detected
  }
}
SM->Deactivate(box1);
// deactivate all active modes of box1
~~~~~
@@ -1608,7 +1608,7 @@ The following example shows how to disable the VBO support:
~~~~~
// get the graphic driver
Handle (Graphic3d_GraphicDriver) aDriver =
  myAISContext->CurrentViewer()->Driver();
myAISContext->CurrentViewer()->Driver();
// disable VBO support
aDriver->EnableVBO (Standard_False);
@@ -1639,7 +1639,7 @@ You can also modify the values assigned to the vertex or query these values by
* *void Graphic3d_ArrayOfPrimitives::SetVertexNormal*
* *void Graphic3d_ArrayOfPrimitives::SetVertexTexel*
* *gp_Pnt Graphic3d_ArrayOfPrimitives::Vertices*
* *gp_Dir  Graphic3d_ArrayOfPrimitives::VertexNormal*
* *gp_Dir Graphic3d_ArrayOfPrimitives::VertexNormal*
* *gp_Pnt3d Graphic3d_ArrayOfPrimitives::VertexTexel*
* *Quantity_Color Graphic3d_ArrayOfPrimitives::VertexColor*
* *void Graphic3d_ArrayOfPrimitives::Vertices*
@@ -1674,26 +1674,26 @@ The following example shows how to define an array of triangles:
~~~~~
// create an array
Standard_Boolean IsNormals     = Standard_False;
Standard_Boolean IsColors      = Standard_False;
Standard_Boolean IsNormals = Standard_False;
Standard_Boolean IsColors = Standard_False;
Standard_Boolean IsTextureCrds = Standard_False;
Handle (Graphic3d_ArrayOfTriangles) anArray =
          new Graphic3d_ArrayOfTriangles (aVerticesMaxCount,
                                          aEdgesMaxCount,
                                          IsNormals,
                                          IsColors,
                                          IsTextureCrds);
new Graphic3d_ArrayOfTriangles (aVerticesMaxCount,
aEdgesMaxCount,
IsNormals,
IsColors,
IsTextureCrds);
// add vertices to the array
anArray->AddVertex (-1.0, 0.0, 0.0);   // vertex 1
anArray->AddVertex ( 1.0, 0.0, 0.0);   // vertex 2
anArray->AddVertex ( 0.0, 1.0, 0.0);   // vertex 3
anArray->AddVertex ( 0.0,-1.0, 0.0);   // vertex 4
anArray->AddVertex (-1.0, 0.0, 0.0); // vertex 1
anArray->AddVertex ( 1.0, 0.0, 0.0); // vertex 2
anArray->AddVertex ( 0.0, 1.0, 0.0); // vertex 3
anArray->AddVertex ( 0.0,-1.0, 0.0); // vertex 4
// add edges to the array
anArray->AddEdge (1);  // first triangle
anArray->AddEdge (1); // first triangle
anArray->AddEdge (2);
anArray->AddEdge (3);
anArray->AddEdge (1);  // second triangle
anArray->AddEdge (1); // second triangle
anArray->AddEdge (2);
anArray->AddEdge (4);
@@ -1717,31 +1717,31 @@ The following example shows how to define an array of polygons:
~~~~~
// create an array
Standard_Boolean IsNormals      = Standard_False;
Standard_Boolean IsNormals = Standard_False;
Standard_Boolean IsVertexColors = Standard_False;
Standard_Boolean IsFaceColors   = Standard_False;
Standard_Boolean IsTextureCrds  = Standard_False;
Standard_Boolean IsFaceColors = Standard_False;
Standard_Boolean IsTextureCrds = Standard_False;
Handle (Graphic3d_ArrayOfPolygons) anArray =
          new Graphic3d_ArrayOfPolygons (aVerticesMaxCount,
                                         aBoundsMaxCount,
                                         aEdgesMaxCount,
                                         IsNormals,
                                         IsVertexColors,
                                         IsFaceColors,
                                         IsTextureCrds);
new Graphic3d_ArrayOfPolygons (aVerticesMaxCount,
aBoundsMaxCount,
aEdgesMaxCount,
IsNormals,
IsVertexColors,
IsFaceColors,
IsTextureCrds);
// add bounds to the array, first polygon
anArray->AddBound (3);
anArray->AddVertex (-1.0, 0.0, 0.0);  
anArray->AddVertex ( 1.0, 0.0, 0.0);  
anArray->AddVertex ( 0.0, 1.0, 0.0);  
anArray->AddVertex (-1.0, 0.0, 0.0);
anArray->AddVertex ( 1.0, 0.0, 0.0);
anArray->AddVertex ( 0.0, 1.0, 0.0);
// add bounds to the array, second polygon
anArray->AddBound (4);
anArray->AddVertex (-1.0, 0.0, 0.0);  
anArray->AddVertex ( 1.0, 0.0, 0.0);  
anArray->AddVertex ( 1.0,-1.0, 0.0);  
anArray->AddVertex (-1.0,-1.0, 0.0);  
anArray->AddVertex (-1.0, 0.0, 0.0);
anArray->AddVertex ( 1.0, 0.0, 0.0);
anArray->AddVertex ( 1.0,-1.0, 0.0);
anArray->AddVertex (-1.0,-1.0, 0.0);
// add the array to the structure
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
@@ -1784,41 +1784,41 @@ To add any text to the graphic structure you can use the following methods:
~~~~~
void Graphic3d_Group::Text
(const Standard_CString AText,
 const Graphic3d_Vertex& APoint,
 const Standard_Real AHeight,
 const Quantity_PlaneAngle AAngle,
 const Graphic3d_TextPath ATp,
 const Graphic3d_HorizontalTextAlignment AHta,
 const Graphic3d_VerticalTextAlignment AVta,
 const Standard_Boolean EvalMinMax),
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Quantity_PlaneAngle AAngle,
const Graphic3d_TextPath ATp,
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax),
~~~~~
*AText* parameter is the text string, *APoint* is the three-dimensional position of the text, *AHeight* is the text height, *AAngle* is the orientation of the text (at the moment, this parameter has no effect, but you can specify the text orientation through the *Graphic3d_AspectText3d* attributes).
*ATp* parameter defines the text path, *AHta* is the horizontal alignment of the text, *AVta* is the vertical alignment of the text.
You can pass *Standard_False* as *EvalMinMax* if you dont want the graphic3d structure boundaries to be affected by the text position.
You can pass *Standard_False* as *EvalMinMax* if you do not want the graphic3d structure boundaries to be affected by the text position.
**Note** that the text orientation angle can be defined by *Graphic3d_AspectText3d* attributes.
~~~~~
void Graphic3d_Group::Text
(const Standard_CString AText,
 const Graphic3d_Vertex& APoint,
 const Standard_Real AHeight,
 const Standard_Boolean EvalMinMax)
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax)
void Graphic3d_Group::Text
(const TCcollection_ExtendedString &AText,
const Graphic3d_Vertex& APoint,
 const Standard_Real AHeight,
 const Quantity_PlaneAngle AAngle,
 const Graphic3d_TextPath ATp,
 const Graphic3d_HorizontalTextAlignment AHta,
 const Graphic3d_VerticalTextAlignment AVta,
 const Standard_Boolean EvalMinMax)
const Standard_Real AHeight,
const Quantity_PlaneAngle AAngle,
const Graphic3d_TextPath ATp,
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax)
void Graphic3d_Group::Text
(const TCcollection_ExtendedString &AText,
 const Graphic3d_Vertex& APoint,
 const Standard_Real AHeight,
 const Standard_Boolean EvalMinMax)
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax)
~~~~~
See the example:
@@ -2036,7 +2036,7 @@ aView->Update();
@subsubsection occt_visu_4_4_5 Perspective Projection
**Field of view (FOVy)** - defines the field of camera view by y axis in degrees (45° is default).
**Field of view (FOVy)** - defines the field of camera view by y axis in degrees (45<EFBFBD> is default).
@image html camera_perspective.png "Perspective frustum"
@@ -2058,7 +2058,7 @@ There are two types of IOD:
* _IODType_Absolute_ : Intraocular distance is defined as an absolute value.
* _IODType_Relative_ : Intraocular distance is defined relative to the camera focal length (as its coefficient).
**Field of view (FOV)** - defines the field of camera view by y axis in degrees (45° is default).
**Field of view (FOV)** - defines the field of camera view by y axis in degrees (45<EFBFBD> is default).
**ZFocus** - defines the distance to the point of stereographic focus.
@@ -2132,21 +2132,21 @@ The following example demonstrates how to draw overlay graphics by the *V3d_Laye
// redefined method of V3d_LayerMgr
void MyLayerMgr::Redraw ()
{
  Quantity_Color aRed (Quantity_NOC_RED);
  myOverlayLayer->SetColor (aRed);
  myOverlayLayer->DrawRectangle (0, 0, 100, 100);
Quantity_Color aRed (Quantity_NOC_RED);
myOverlayLayer->SetColor (aRed);
myOverlayLayer->DrawRectangle (0, 0, 100, 100);
}
~~~~~
The layer contains layer items that will be displayed on view redraw. Such items are *Visual3d_LayerItem* entities. To manipulate *Visual3d_LayerItem* entities assigned to the layers internal list you can use the following methods:
The layer contains layer items that will be displayed on view redraw. Such items are *Visual3d_LayerItem* entities. To manipulate *Visual3d_LayerItem* entities assigned to the layer's internal list you can use the following methods:
~~~~~
void Visual3d_Layer::AddLayerItem (const Handle (Visual3d_LayerItem)& Item)
void Visual3d_Layer::RemoveLayerItem (const Handle (Visual3d_LayerItem)& Item) 
void Visual3d_Layer::RemoveLayerItem (const Handle (Visual3d_LayerItem)& Item)
void Visual3d_Layer::RemoveAllLayerItems ()
const Visual3d_NListOfLayerItem& Visual3d_Layer::GetLayerItemList ()  
const Visual3d_NListOfLayerItem& Visual3d_Layer::GetLayerItemList ()
~~~~~
The layers items are rendered when the method *void Visual3d_Layer::RenderLayerItems()* is called by the graphical driver.
The layer's items are rendered when the method *void Visual3d_Layer::RenderLayerItems()* is called by the graphical driver.
The *Visual3d_LayerItem* has virtual methods that are used to render the item:
~~~~~
@@ -2160,8 +2160,8 @@ The item presentation can be computed before drawing by the *ComputeLayerPrs* me
Standard_Boolean Visual3d_LayerItem::IsNeedToRecompute
~~~~~
An example of *Visual3d_LayerItem* is *V3d_ColorScaleLayerItem* that represents the color scale entity as the layers item.
The *V3d_ColorScaleLayerItem* sends render requests to the color scale entity represented by it. As this entity (*V3d_ColorScale*) is assigned to the *V3d_LayerMgr* it uses its overlay layers services for drawing:
An example of *Visual3d_LayerItem* is *V3d_ColorScaleLayerItem* that represents the color scale entity as the layer's item.
The *V3d_ColorScaleLayerItem* sends render requests to the color scale entity represented by it. As this entity (*V3d_ColorScale*) is assigned to the *V3d_LayerMgr* it uses its overlay layer's services for drawing:
<h4>Example </h4>
@@ -2169,29 +2169,29 @@ The *V3d_ColorScaleLayerItem* sends render requests to the color scale entity r
// tell V3d_ColorScale to draw itself
void V3d_ColorScaleLayerItem::RedrawLayerPrs ()
{
  Visual3d_LayerItem::RedrawLayerPrs ()
  if (!MyColorScale.IsNull ())
    MyColorScale->DrawScale ();
Visual3d_LayerItem::RedrawLayerPrs ()
if (!MyColorScale.IsNull ())
MyColorScale->DrawScale ();
}
// V3d_ColorScale has a reference to a LayerMgr
void V3d_ColorScale::DrawScale ()
{
    // calls V3d_ColorScale::PaintRect, V3d_ColorScale::PaintText, etc
// calls V3d_ColorScale::PaintRect, V3d_ColorScale::PaintText, etc.
}
// PaintRect method uses overlay layer of LayerMgr to draw a rectangle
void V3d_ColorScale::PaintRect
       (const Standard_Integer X, const Standard_Integer Y,
        const Standard_Integer W, const Standard_Integer H,
        const Quantity_Color aColor,
        const Standard_Boolean aFilled)
(const Standard_Integer X, const Standard_Integer Y,
const Standard_Integer W, const Standard_Integer H,
const Quantity_Color aColor,
const Standard_Boolean aFilled)
{
  const Handle (Visual3d_Layer)& theLayer = myLayerMgr->Overlay ();
   ...
  theLayer->SetColor (aColor);
  theLayer->DrawRectangle (X, Y, W, H);
   ...
const Handle (Visual3d_Layer)& theLayer = myLayerMgr->Overlay ();
...
theLayer->SetColor (aColor);
theLayer->DrawRectangle (X, Y, W, H);
...
}
~~~~~
@@ -2202,9 +2202,9 @@ To set solid color for the background you can use the following methods:
~~~~~
void V3d_View::SetBackgroundColor
(const Quantity_TypeOfColor Type,
 const Quantity_Parameter V1,
 const Quantity_Parameter V2,
 const Quantity_Parameter V3)
const Quantity_Parameter V1,
const Quantity_Parameter V2,
const Quantity_Parameter V3)
~~~~~
This method allows you to specify the background color in RGB (red, green, blue) or HLS (hue, lightness, saturation) color spaces, so the appropriate values of the Type parameter are *Quantity_TOC_RGB* and *Quantity_TOC_HLS*.
@@ -2220,15 +2220,15 @@ The gradient background style could be set up with the following methods:
~~~~~
void V3d_View::SetBgGradientColors
(const Quantity_Color& Color1,
 const Quantity_Color& Color2,
 const Aspect_GradientFillMethod FillStyle,
 const Standard_Boolean update)
const Quantity_Color& Color2,
const Aspect_GradientFillMethod FillStyle,
const Standard_Boolean update)
void V3d_View::SetBgGradientColors
(const Quantity_NameOfColor Color1,
 const Quantity_NameOfColor Color2,
 const Aspect_GradientFillMethod FillStyle,
 const Standard_Boolean update)
const Quantity_NameOfColor Color2,
const Aspect_GradientFillMethod FillStyle,
const Standard_Boolean update)
~~~~~
The *Color1* and *Color2* parameters define the boundary colors of interpolation, the *FillStyle* parameter defines the direction of interpolation. You can pass *Standard_True* as the last parameter to update the view.
@@ -2239,9 +2239,9 @@ To get the current background color you can use the following methods:
~~~~~
void V3d_View::BackgroundColor
(const Quantity_TypeOfColor Type,
 Quantity_Parameter &V1,
 Quantity_Parameter &V2,
 Quantity_Parameter &V3)
Quantity_Parameter &V1,
Quantity_Parameter &V2,
Quantity_Parameter &V3)
Quantity_Color V3d_View::BackgroundColor()
void V3d_View::GradientBackgroundColors(Quantity_Color& Color1, Quantity_Color& Color2)
Aspect_GradientBackground GradientBackground()
@@ -2251,15 +2251,15 @@ To set the image as a background and change the background image style you can
~~~~~
void V3d_View::SetBackgroundImage
(const Standard_CString FileName,
 const Aspect_FillMethod FillStyle,
 const Standard_Boolean update)
const Aspect_FillMethod FillStyle,
const Standard_Boolean update)
void V3d_View::SetBgImageStyle
(const Aspect_FillMethod FillStyle,
 const Standard_Boolean update)
const Standard_Boolean update)
~~~~~
The *FileName* parameter defines the image file name and the path to it, the *FillStyle* parameter defines the method of filling the background with the image. The methods are:
* *Aspect_FM_NONE* -  draws the image in the default position;
* *Aspect_FM_NONE* - draws the image in the default position;
* *Aspect_FM_CENTERED* - draws the image at the center of the view;
* *Aspect_FM_TILED* tiles the view with the image;
* *Aspect_FM_STRETCH* stretches the image over the view.
@@ -2326,21 +2326,21 @@ Handle(Aspect_DisplayConnection) aDisplayConnection;
Handle (Graphic3d_GraphicDriver) aDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
// create a window
Standard_Integer aDefWidth  = 800;
Standard_Integer aDefWidth = 800;
Standard_Integer aDefHeight = 600;
Handle (WNT_WClass) aWClass = new WNT_WClass ("Virtual Class",DefWindowProc,
                             CS_VREDRAW | CS_HREDRAW, 0, 0,
                             ::LoadCursor (NULL, IDC_ARROW));
Handle (WNT_Window) aWindow = new WNT_Window ("VirtualWnd",  aWClass,
                             WS_OVERLAPPEDWINDOW, 0, 0,
                             aDefWidth, aDefHeight);
CS_VREDRAW | CS_HREDRAW, 0, 0,
::LoadCursor (NULL, IDC_ARROW));
Handle (WNT_Window) aWindow = new WNT_Window ("VirtualWnd", aWClass,
WS_OVERLAPPEDWINDOW, 0, 0,
aDefWidth, aDefHeight);
// set up the window as virtual
aWindow->SetVirtual (Standard_True);
// create a view and an interactive context
Handle (V3d_Viewer) aViewer = new V3d_Viewer (aDriver,
                             Standard_ExtString ("Virtual"));
Standard_ExtString ("Virtual"));
Handle (AIS_InteractiveContext) aContext = new AIS_InteractiveContext (aViewer);
Handle (V3d_View) aView = aViewer->CreateView ();
@@ -2360,7 +2360,7 @@ aView->Dump ("3dscene.png");
The contents of a view can be printed out. Moreover, the OpenGl graphic driver used by the v3d view supports printing in high resolution. The print method uses the OpenGl frame buffer (Frame Buffer Object) for rendering the view contents and advanced print algorithms that allow printing in, theoretically, any resolution.
The method *void V3d_View::Print(const Aspect_Handle hPrnDC, const Standard_Boolean showDialog, const Standard_Boolean showBackground, const Standard_CString  filename, const Aspect_PrintAlgo printAlgorithm)* prints the view contents:
The method *void V3d_View::Print(const Aspect_Handle hPrnDC, const Standard_Boolean showDialog, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm)* prints the view contents:
*hPrnDC* is the printer device handle. You can pass your own printer handle or *NULL* to select the printer by the default dialog. In that case you can use the default dialog or pass *Standard_False* as the *showDialog* argument to select the default printer automatically.
@@ -2439,14 +2439,14 @@ Structure display priorities control the order, in which structures are drawn. W
@subsubsection occt_visu_4_4_15 Z-layer support
OCCT features depth-arranging functionality called z-layer. A graphical presentation can be put into a z-layer. In general, this function can be used for implementing "bring to front"<EFBFBD> functionality in a graphical application.
OCCT features depth-arranging functionality called z-layer. A graphical presentation can be put into a z-layer. In general, this function can be used for implementing "bring to front" functionality in a graphical application.
Example:
~~~~~
// set z-layer to an interactive object
Handle(AIS_InteractiveContext) aContext =
Handle(AIS_InteractiveObject) anInterObj =
Handle(AIS_InteractiveContext) aContext = ...
Handle(AIS_InteractiveObject) anInterObj = ...
Standard_Integer anId = 3;
aViewer->AddZLayer (anId);
aContext->SetZLayer (anInterObj, anId);
@@ -2458,7 +2458,7 @@ For each z-layer, it is allowed to:
* Enable / disable depth buffer clearing.
* Enable / disable polygon offset.
The corresponding method *SetZLayerOption ()* is available in *Graphic3d_GraphicDriver* interface. You can get the options using getter from *Visual3d_ViewManager* and *V3d_Viewer*. It returns *Graphic3d_ZLayerSettings* cached in *Visual3d_ViewManager* for a given *LayerId*.
The corresponding method *SetZLayerOption (...)* is available in *Graphic3d_GraphicDriver* interface. You can get the options using getter from *Visual3d_ViewManager* and *V3d_Viewer*. It returns *Graphic3d_ZLayerSettings* cached in *Visual3d_ViewManager* for a given *LayerId*.
Example:
~~~~~
@@ -2503,10 +2503,10 @@ Let us see for example how to create a new clipping plane with custom parameters
// create a new clipping plane
const Handle(Graphic3d_ClipPlane)& aClipPlane = new Graphic3d_ClipPlane();
// change equation of the clipping plane
Standard_Real aCoeffA =
Standard_Real aCoeffB =
Standard_Real aCoeffC =
Standard_Real aCoeffD =
Standard_Real aCoeffA = ...
Standard_Real aCoeffB = ...
Standard_Real aCoeffC = ...
Standard_Real aCoeffD = ...
aClipPlane->SetEquation (gp_Pln (aCoeffA, aCoeffB, aCoeffC, aCoeffD));
// set capping
aClipPlane->SetCapping (aCappingArg == "on");
@@ -2517,12 +2517,12 @@ aMat.SetAmbientColor (aColor);
aMat.SetDiffuseColor (aColor);
aClipPlane->SetCappingMaterial (aMat);
// set the texture of clipping plane
Handle(Graphic3d_Texture2Dmanual) aTexture =
Handle(Graphic3d_Texture2Dmanual) aTexture = ...
aTexture->EnableModulate();
aTexture->EnableRepeat();
aClipPlane->SetCappingTexture (aTexture);
// add the clipping plane to an interactive object
Handle(AIS_InteractiveObject) aIObj =
Handle(AIS_InteractiveObject) aIObj = ...
aIObj->AddClipPlane (aClipPlane);
// or to the whole view
aView->AddClipPlane (aClipPlane);
@@ -2662,7 +2662,7 @@ Handle(AIS_Shape) anAISShape = new AIS_Shape(aShape);
myAISContext->Display (anAISShape);
~~~~~
@subsubsection occt_visu_4_5_4 Create your own interactive object
@subsubsection occt_visu_4_5_5 Create your own interactive object
Follow the procedure below to compute the presentable object:

View File

@@ -54,17 +54,20 @@ void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType)
}
void GeomSources::PostProcess (CGeometryDoc* aDoc, UINT anID, DisplayType aDisplayType,
const TCollection_AsciiString& theString, Quantity_Coefficient Coef)
const TCollection_AsciiString& theString, Standard_Boolean UpdateViewer, Quantity_Coefficient Coef)
{
Standard_CString aString = theString.ToCString();
if (aDisplayType == No2D3D || aDisplayType == a2D3D)
{
aDoc->Fit3DViews(Coef);
}
if (UpdateViewer)
{
if (aDisplayType == No2D3D || aDisplayType == a2D3D)
{
aDoc->Fit3DViews(Coef);
}
if (aDisplayType == a2DNo3D || aDisplayType == a2D3D)
{
aDoc->Fit2DViews();
if (aDisplayType == a2DNo3D || aDisplayType == a2D3D)
{
aDoc->Fit2DViews();
}
}
TCollection_AsciiString Message("Results are ");
@@ -196,6 +199,13 @@ void GeomSources::DisplaySurface(CGeometryDoc* aDoc,
aDoc->GetAISContext()->Display(aGraphicalSurface,UpdateViewer);
}
void GeomSources::ResetView(CGeometryDoc* aDoc)
{
aDoc->GetAISContext()->CurrentViewer()->InitActiveViews();
Handle(V3d_View) aView = aDoc->GetAISContext()->CurrentViewer()->ActiveView();
aView->Reset();
}
// Function name : GeomSources::gpTest1
// Description :
// Return type : void
@@ -253,8 +263,9 @@ gp_Pnt P1(1,2,3); \n\
\n");
AddSeparator(aDoc,Message);
//--------------------------------------------------------------
DisplayPoint(aDoc,P1,"P1 (1,2,3)",false,0.5);
PostProcess(aDoc,ID_BUTTON_Test_2,TheDisplayType,Message,1.0);
DisplayPoint(aDoc,P1,"P1 (1,2,3)",false,30);
PostProcess(aDoc,ID_BUTTON_Test_2,TheDisplayType,Message,Standard_False);
ResetView(aDoc);
}
@@ -279,8 +290,9 @@ gp_Pnt P2(A); \n\
\n");
AddSeparator(aDoc,Message);
//--------------------------------------------------------------
DisplayPoint(aDoc,P2,"P2 (1,2,3)",false,0.5);
PostProcess(aDoc,ID_BUTTON_Test_3,TheDisplayType,Message,1.0 /*0.02*/);
DisplayPoint(aDoc,P2,"P2 (1,2,3)",false,30);
PostProcess(aDoc,ID_BUTTON_Test_3,TheDisplayType,Message,Standard_False);
ResetView(aDoc);
}
@@ -310,7 +322,7 @@ Standard_Real TheZ = P3.Z(); \n\
\n");
AddSeparator(aDoc,Message);
//--------------------------------------------------------------
DisplayPoint(aDoc,P3,"P3 = gp::Origin()",false,0.5);
DisplayPoint(aDoc,P3,"P3 = gp::Origin()",false,30);
TCollection_AsciiString Message2 (TheX);
TCollection_AsciiString Message3 (TheY);
@@ -324,7 +336,8 @@ Standard_Real TheZ = P3.Z(); \n\
Message4 = TheZ;
Message += Message4;
PostProcess(aDoc,ID_BUTTON_Test_4,TheDisplayType,Message,1.0 /*0.02*/);
PostProcess(aDoc,ID_BUTTON_Test_4,TheDisplayType,Message,Standard_False);
ResetView(aDoc);
}

View File

@@ -77,8 +77,12 @@ private:
a2DNo3D , // 0 1 0
a2D3D }; // 1 1 1
static void PreProcess (CGeometryDoc* aDoc,DisplayType aDisplayType);
static void PostProcess(CGeometryDoc* aDoc,UINT anID,DisplayType aDisplayType,
const TCollection_AsciiString& aString,Quantity_Coefficient Coef = -1);
static void PostProcess(CGeometryDoc* aDoc,
UINT anID,
DisplayType aDisplayType,
const TCollection_AsciiString& aString,
Standard_Boolean UpdateViewer = Standard_True,
Quantity_Coefficient Coef = -1);
static void DisplayPoint(CGeometryDoc* aDoc,
const gp_Pnt2d& aPoint,
const char* aText,
@@ -122,7 +126,7 @@ private:
Handle(Geom_Surface) aSurface,
Standard_Boolean UpdateViewer = false);
static void ResetView(CGeometryDoc* aDoc);
static void AddSeparator(CGeometryDoc* aDoc,TCollection_AsciiString& aMessage);

View File

@@ -1,7 +1,38 @@
@echo off
rem Setup environment
call "%~dp0env.bat" %1 %2 %3
if ["%CASDEB%"] == [""] (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% "" "%~dp0IESample-%VCVER%.sln"
rem Define path to project file
set "PRJFILE=%~dp0IESample-%VCVER%.sln"
set "VisualStudioExpressName=VCExpress"
if "%VCVER%" == "vc8" (
set "DevEnvDir=%VS80COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc9" (
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc10" (
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc11" (
set "DevEnvDir=%VS110COMNTOOLS%..\IDE"
rem Visual Studio Express starting from VS 2012 is called "for Windows Desktop"
rem and has a new name for executable - WDExpress
set "VisualStudioExpressName=WDExpress"
) else if "%VCVER%" == "vc12" (
set "DevEnvDir=%VS120COMNTOOLS%..\IDE"
set "VisualStudioExpressName=WDExpress"
) else (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% %CASDEB% "%~dp0IESample-%VCVER%.sln"
)
echo Error: wrong VS identifier
exit /B
)
rem Launch Visual Studio - either professional (devenv) or Express, as available
if exist "%DevEnvDir%\devenv.exe" (
start "%DevEnvDir%\devenv.exe" "%PRJFILE%"
) else if exist "%DevEnvDir%\%VisualStudioExpressName%.exe" (
start "%DevEnvDir%\%VisualStudioExpressName%.exe" "%PRJFILE%"
) else (
echo Error: Could not find MS Visual Studio ^(%VCVER%^)
echo Check relevant environment variable ^(e.g. VS80COMNTOOLS for vc8^)
)

View File

@@ -1,7 +1,38 @@
@echo off
rem Setup environment
call "%~dp0env.bat" %1 %2 %3
if ["%CASDEB%"] == [""] (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% "" "%~dp0Tutorial-%VCVER%.sln"
rem Define path to project file
set "PRJFILE=%~dp0Tutorial-%VCVER%.sln"
set "VisualStudioExpressName=VCExpress"
if "%VCVER%" == "vc8" (
set "DevEnvDir=%VS80COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc9" (
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc10" (
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc11" (
set "DevEnvDir=%VS110COMNTOOLS%..\IDE"
rem Visual Studio Express starting from VS 2012 is called "for Windows Desktop"
rem and has a new name for executable - WDExpress
set "VisualStudioExpressName=WDExpress"
) else if "%VCVER%" == "vc12" (
set "DevEnvDir=%VS120COMNTOOLS%..\IDE"
set "VisualStudioExpressName=WDExpress"
) else (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% %CASDEB% "%~dp0Tutorial-%VCVER%.sln"
)
echo Error: wrong VS identifier
exit /B
)
rem Launch Visual Studio - either professional (devenv) or Express, as available
if exist "%DevEnvDir%\devenv.exe" (
start "%DevEnvDir%\devenv.exe" "%PRJFILE%"
) else if exist "%DevEnvDir%\%VisualStudioExpressName%.exe" (
start "%DevEnvDir%\%VisualStudioExpressName%.exe" "%PRJFILE%"
) else (
echo Error: Could not find MS Visual Studio ^(%VCVER%^)
echo Check relevant environment variable ^(e.g. VS80COMNTOOLS for vc8^)
)

View File

@@ -1,7 +1,38 @@
@echo off
rem Setup environment
call "%~dp0..\..\..\env.bat" %1 %2 %3
if ["%CASDEB%"] == [""] (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% "" "%~dp0VoxelDemo-%VCVER%.sln"
rem Define path to project file
set "PRJFILE=%~dp0VoxelDemo-%VCVER%.sln"
set "VisualStudioExpressName=VCExpress"
if "%VCVER%" == "vc8" (
set "DevEnvDir=%VS80COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc9" (
set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc10" (
set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
) else if "%VCVER%" == "vc11" (
set "DevEnvDir=%VS110COMNTOOLS%..\IDE"
rem Visual Studio Express starting from VS 2012 is called "for Windows Desktop"
rem and has a new name for executable - WDExpress
set "VisualStudioExpressName=WDExpress"
) else if "%VCVER%" == "vc12" (
set "DevEnvDir=%VS120COMNTOOLS%..\IDE"
set "VisualStudioExpressName=WDExpress"
) else (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% %CASDEB% "%~dp0VoxelDemo-%VCVER%.sln"
)
echo Error: wrong VS identifier
exit /B
)
rem Launch Visual Studio - either professional (devenv) or Express, as available
if exist "%DevEnvDir%\devenv.exe" (
start "%DevEnvDir%\devenv.exe" "%PRJFILE%"
) else if exist "%DevEnvDir%\%VisualStudioExpressName%.exe" (
start "%DevEnvDir%\%VisualStudioExpressName%.exe" "%PRJFILE%"
) else (
echo Error: Could not find MS Visual Studio ^(%VCVER%^)
echo Check relevant environment variable ^(e.g. VS80COMNTOOLS for vc8^)
)

View File

@@ -82,4 +82,4 @@ vsetcolor b10 0 0.48046875 0.73828125
# set material to plastic for better look
for {set i 1} {$i <= 10} {incr i} {vsetmaterial b$i plastic}
vdrawtext "Which\nbox\nis\ncloser\nto\nyou?" 0 -6 -2 0 0 0 left top 0 0 40 Bold
vdrawtext label "Which\nbox\nis\ncloser\nto\nyou?" -pos 0 -6 -2 -color 0 0 0 -halign left -valign bottom -angle 0 -zoom 0 -height 40

View File

@@ -10,30 +10,30 @@ set THE_ROW_DIST 35
proc drawLabels {} {
set x 20
set y 15
set r 25
set g 25
set b 25
set r 0.098
set g 0.098
set b 0.098
foreach aMatIter $::THE_MATERIALS {
vdrawtext "$aMatIter" $x $y 0 $r $g $b 2 1 000 0 14 1 Arial
vdrawtext "$aMatIter" "$aMatIter" -pos $x $y 0 -color $r $g $b -halign right -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
incr y 10
}
set x 40
set y 5
foreach aColIter $::THE_COLORS {
if { $aColIter == "red" } {
set r 255
set g 0
set r 1.0
set g 0.0
set b 0
} elseif { $aColIter == "green" } {
set r 0
set g 255
set b 0
set r 0.0
set g 1.0
set b 0.0
} elseif { $aColIter == "blue1" } {
set r 0
set g 0
set b 255
set r 0.0
set g 0.0
set b 1.0
}
vdrawtext "$aColIter" $x $y 0 $r $g $b 1 1 000 0 14 1 Arial
vdrawtext "$aColIter" "$aColIter" -pos $x $y 0 -color $r $g $b -halign center -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
incr x $::THE_ROW_DIST
}
}

View File

@@ -429,10 +429,11 @@ is
-- aMode provides the selection mode index of the entity aniobj.
SetPixelTolerance(me:mutable;
aPrecision: Real from Standard = 4.0);
aPrecision: Real from Standard = 2.0);
---Level: Public
---Purpose: Define the current selection pixel sensitivity
-- for this context or local context if any one is activated.
---Purpose: Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
-- sets the given tolerance for ALL sensitive entities activated. For more information, see
-- SelectMgr_ViewerSelector documentation
-- Warning: When a local context is open the sensitivity is apply on it
-- instead on the main context.

View File

@@ -1703,6 +1703,7 @@ void AIS_InteractiveContext::redisplayPrsRecModes (const Handle(AIS_InteractiveO
{
theIObj->Update (aModes.Value(), Standard_False);
}
theIObj->UpdateSelection();
theIObj->SetRecomputeOk();
}
@@ -2590,7 +2591,10 @@ void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObj
//=======================================================================
//function : SetPixelTolerance
//purpose :
//purpose : Disables the mechanism of adaptive tolerance calculation in
// SelectMgr_ViewerSelector and sets the given tolerance for ALL
// sensitive entities activated. For more information, see
// SelectMgr_ViewerSelector.hxx
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Real thePrecision)
{
@@ -2672,8 +2676,8 @@ void AIS_InteractiveContext::InitAttributes()
aLineAspect->SetWidth (1.0);
aLineAspect->SetTypeOfLine (Aspect_TOL_DASH);
// tolerance to 4 pixels...
SetPixelTolerance();
// tolerance to 2 pixels...
SetPixelTolerance (2.0);
// Customizing the drawer for trihedrons and planes...
Handle(Prs3d_DatumAspect) aTrihAspect = myDefaultDrawer->DatumAspect();

View File

@@ -905,7 +905,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
Standard_Boolean isAISRemainsDetected = Standard_False;
// 3. Remove entity owners from AIS_Selection
// 3. AIS_Selection : remove entity owners from AIS_Selection
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
Handle(AIS_Selection) aSelection = AIS_Selection::Selection (mySelName.ToCString());
AIS_NListTransient::Iterator anIter (aSelection->Objects());
@@ -922,22 +922,23 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
{
isAISRemainsDetected = Standard_True;
}
aRemoveEntites.Append (anOwner);
anOwner->SetSelected (Standard_False);
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
else
{
Unhilight (anOwner, aViewer->ActiveView());
aRemoveEntites.Append (anOwner);
anOwner->SetSelected (Standard_False);
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
{
Unhilight (anOwner, aViewer->ActiveView());
}
}
}
AIS_NListTransient::Iterator anIterRemove (aRemoveEntites);
for (; anIterRemove.More(); anIterRemove.Next())
{
aSelection->Select (anIterRemove.Value());
}
// 4. Remove entity owners from myMapOfOwner
// 4. AIS_LocalContext - myMapOfOwner : remove entity owners from myMapOfOwner
SelectMgr_IndexedMapOfOwner anOwnersToKeep;
for (Standard_Integer anIdx = 1; anIdx <= myMapOfOwner.Extent(); anIdx++)
{

View File

@@ -47,8 +47,6 @@
#include <UnitsAPI.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Select3D_SensitiveFace.hxx>
void ExtremityPoints(TColgp_Array1OfPnt& PP,const Handle(Geom_Plane)& myPlane,const Handle(Prs3d_Drawer)& myDrawer);
//=======================================================================

182
src/AIS/AIS_TextLabel.cxx Normal file
View File

@@ -0,0 +1,182 @@
// Created on: 2014-11-10
// Copyright (c) 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 <AIS_TextLabel.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Select3D_SensitivePoint.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_EntityOwner.hxx>
IMPLEMENT_STANDARD_HANDLE (AIS_TextLabel, AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel, AIS_InteractiveObject)
//=======================================================================
//function : AIS_TextLabel
//purpose :
//=======================================================================
AIS_TextLabel::AIS_TextLabel()
: myText ("?"),
myPosition (0.0, 0.0, 0.0),
myFont ("Courier"),
myFontAspect (Font_FA_Regular)
{
myDrawer->SetTextAspect (new Prs3d_TextAspect());
SetDisplayMode (0);
}
//=======================================================================
//function : SetColor
//purpose :
//=======================================================================
void AIS_TextLabel::SetColor (const Quantity_Color& theColor)
{
hasOwnColor = Standard_True;
myOwnColor = theColor;
myDrawer->TextAspect()->SetColor (theColor);
}
//=======================================================================
//function : SetColor
//purpose :
//=======================================================================
void AIS_TextLabel::SetColor (const Quantity_NameOfColor theColor)
{
SetColor (Quantity_Color (theColor));
}
//=======================================================================
//function : SetText
//purpose :
//=======================================================================
void AIS_TextLabel::SetText (const TCollection_ExtendedString& theText)
{
myText = theText;
}
//=======================================================================
//function : SetPosition
//purpose :
//=======================================================================
void AIS_TextLabel::SetPosition (const gp_Pnt& thePosition)
{
myPosition = thePosition;
}
//=======================================================================
//function : SetHJustification
//purpose :
//=======================================================================
void AIS_TextLabel::SetHJustification (const Graphic3d_HorizontalTextAlignment theHJust)
{
myDrawer->TextAspect()->SetHorizontalJustification (theHJust);
}
//=======================================================================
//function : SetVJustification
//purpose : Setup vertical justification.
//=======================================================================
void AIS_TextLabel::SetVJustification (const Graphic3d_VerticalTextAlignment theVJust)
{
myDrawer->TextAspect()->SetVerticalJustification (theVJust);
}
//=======================================================================
//function : SetAngle
//purpose :
//=======================================================================
void AIS_TextLabel::SetAngle (const Standard_Real theAngle)
{
myDrawer->TextAspect()->Aspect()->SetTextAngle (theAngle * 180.0 / M_PI);
}
//=======================================================================
//function : SetZoom
//purpose :
//=======================================================================
void AIS_TextLabel::SetZoomable (const Standard_Boolean theIsZoomable)
{
myDrawer->TextAspect()->Aspect()->SetTextZoomable (theIsZoomable);
}
//=======================================================================
//function : SetHeight
//purpose :
//=======================================================================
void AIS_TextLabel::SetHeight (const Standard_Real theHeight)
{
myDrawer->TextAspect()->SetHeight (theHeight);
}
//=======================================================================
//function : SetAngle
//purpose :
//=======================================================================
void AIS_TextLabel::SetFontAspect (const Font_FontAspect theFontAspect)
{
myDrawer->TextAspect()->Aspect()->SetTextFontAspect (theFontAspect);
}
//=======================================================================
//function : SetFont
//purpose :
//=======================================================================
void AIS_TextLabel::SetFont (Standard_CString theFont)
{
myFont = theFont;
myDrawer->TextAspect()->SetFont (myFont.ToCString());
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePrsMgr*/,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
switch (theMode)
{
case 0:
{
Handle(Prs3d_TextAspect) anAsp = myDrawer->TextAspect();
Prs3d_Text::Draw (thePrs, anAsp, myText, myPosition);
break;
}
}
}
//=======================================================================
//function : ComputeSelection
//purpose :
//=======================================================================
void AIS_TextLabel::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode)
{
switch (theMode)
{
case 0:
{
Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this, 10);
Handle(Select3D_SensitivePoint) aSensitivePoint = new Select3D_SensitivePoint (anEntityOwner, myPosition);
theSelection->Add (aSensitivePoint);
break;
}
}
}

94
src/AIS/AIS_TextLabel.hxx Normal file
View File

@@ -0,0 +1,94 @@
// Created on: 2014-11-10
// Copyright (c) 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 _AIS_TextLabel_HeaderFile
#define _AIS_TextLabel_HeaderFile
#include <AIS_InteractiveObject.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Font_FontAspect.hxx>
#include <TCollection_ExtendedString.hxx>
//! Presentation of the text.
class AIS_TextLabel : public AIS_InteractiveObject
{
public:
//! Default constructor
Standard_EXPORT AIS_TextLabel();
//! Setup color of entire text.
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
//! Setup color of entire text.
Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE;
//! Setup text.
Standard_EXPORT void SetText (const TCollection_ExtendedString& theText);
//! Setup position.
Standard_EXPORT void SetPosition (const gp_Pnt& thePosition);
//! Setup horizontal justification.
Standard_EXPORT void SetHJustification (const Graphic3d_HorizontalTextAlignment theHJust);
//! Setup vertical justification.
Standard_EXPORT void SetVJustification (const Graphic3d_VerticalTextAlignment theVJust);
//! Setup angle.
Standard_EXPORT void SetAngle (const Standard_Real theAngle);
//! Setup zoomable property.
Standard_EXPORT void SetZoomable (const Standard_Boolean theIsZoomable);
//! Setup height.
Standard_EXPORT void SetHeight (const Standard_Real theHeight);
//! Setup font aspect.
Standard_EXPORT void SetFontAspect (const Font_FontAspect theFontAspect);
//! Setup font.
Standard_EXPORT void SetFont (Standard_CString theFont);
private:
//! Compute
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
protected:
TCollection_ExtendedString myText;
gp_Pnt myPosition;
TCollection_AsciiString myFont;
Font_FontAspect myFontAspect;
public:
//! CASCADE RTTI
DEFINE_STANDARD_RTTI(AIS_TextLabel);
};
DEFINE_STANDARD_HANDLE(AIS_TextLabel, AIS_InteractiveObject)
#endif // _AIS_TextLabel_HeaderFile

View File

@@ -19,7 +19,6 @@
#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveFace.hxx>
#include <Select3D_SensitivePoint.hxx>
#include <Geom_Axis2Placement.hxx>
#include <Geom_Line.hxx>

View File

@@ -23,3 +23,5 @@ AIS_RadiusDimension.hxx
AIS_RadiusDimension.cxx
AIS_PointCloud.hxx
AIS_PointCloud.cxx
AIS_TextLabel.hxx
AIS_TextLabel.cxx

View File

@@ -10157,15 +10157,13 @@ void AdvApp2Var_MathBase::mmwprcs_(doublereal *epsil1,
doublereal AdvApp2Var_MathBase::pow__di (doublereal *x,
integer *n)
{
register integer ii ;
doublereal result ;
integer absolute ;
result = 1.0e0 ;
if ( *n > 0 ) {absolute = *n;}
else {absolute = -*n;}
/* System generated locals */
for(ii = 0 ; ii < absolute ; ii++) {
for(integer ii = 0 ; ii < absolute ; ii++) {
result *= *x ;
}
if (*n < 0) {
@@ -10216,14 +10214,13 @@ integer pow__ii(integer *x,
integer *n)
{
register integer ii ;
integer result ;
integer absolute ;
result = 1 ;
if ( *n > 0 ) {absolute = *n;}
else {absolute = -*n;}
/* System generated locals */
for(ii = 0 ; ii < absolute ; ii++) {
for(integer ii = 0 ; ii < absolute ; ii++) {
result *= *x ;
}
if (*n < 0) {

View File

@@ -2423,18 +2423,18 @@ int AdvApp2Var_SysBase::mcrfill_(integer *size,
void *tout)
{
register char *jmin=static_cast<char*> (tin);
register char *jmout=static_cast<char*> (tout);
char *jmin=static_cast<char*> (tin);
char *jmout=static_cast<char*> (tout);
if (mcrfill_ABS(jmout-jmin) >= *size)
memcpy( tout, tin, *size);
else if (tin > tout)
{
register integer n = *size;
integer n = *size;
while (n-- > 0) *jmout++ = *jmin++;
}
else
{
register integer n = *size;
integer n = *size;
jmin+=n;
jmout+=n;
while (n-- > 0) *--jmout = *--jmin;

View File

@@ -480,6 +480,17 @@ void BOPAlgo_BuilderFace::PerformAreas()
//
myAreas.Clear();
//
if (myLoops.IsEmpty()) {
if (myContext->IsInfiniteFace(myFace)) {
aBB.MakeFace(aFace, aS, aLoc, aTol);
if (BRep_Tool::NaturalRestriction(myFace)) {
aBB.NaturalRestriction(aFace, Standard_True);
}
myAreas.Append(aFace);
}
return;
}
//
// 1. Growthes and Holes -> aDMISB: [Index/ShapeBox2D]
aIt1.Initialize(myLoops);
for (k=0 ; aIt1.More(); aIt1.Next(), ++k) {

View File

@@ -463,7 +463,17 @@ void BOPAlgo_BuilderSolid::PerformLoops()
// 1. Shells Usual
aIt.Initialize (myShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
if (myContext->IsInfiniteFace(aF)) {
TopoDS_Shell aSh;
BRep_Builder aBB;
//
aBB.MakeShell(aSh);
aBB.Add(aSh, aF);
myLoops.Append(aSh);
continue;
}
//
if (!myShapesToAvoid.Contains(aF)) {
aSSp.AddStartElement(aF);
}
@@ -511,9 +521,11 @@ void BOPAlgo_BuilderSolid::PerformLoops()
// c. add all edges that are not processed to myShapesToAvoid
aIt.Initialize (myShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value();
if (!aMP.Contains(aF)) {
myShapesToAvoid.Add(aF);
const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
if (!myContext->IsInfiniteFace(aF)) {
if (!aMP.Contains(aF)) {
myShapesToAvoid.Add(aF);
}
}
}
//=================================================

View File

@@ -202,9 +202,47 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
return myFlag;
}
//
void SetData(const TopoDS_Edge& aEz,
const TopoDS_Vertex& aV1,
const Standard_Real aT1,
const TopoDS_Vertex& aV2,
const Standard_Real aT2) {
myEz=aEz;
myV1=aV1;
myT1=aT1;
myV2=aV2;
myT2=aT2;
}
//
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF);
Standard_Integer iErr;
//
iErr=1;
if (!myEz.IsNull()) {
TopoDS_Edge aSpz;
//
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
myV2, myT2, aSpz);
//
iErr=
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
myE,
myF,
myContext);
}
//
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF);
}
//
if (myFlag) {
UpdateVertices(myE, myF);
}
@@ -214,19 +252,29 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
Standard_Boolean myFlag;
TopoDS_Edge myE;
TopoDS_Face myF;
TopoDS_Edge myEz;
TopoDS_Vertex myV1;
Standard_Real myT1;
TopoDS_Vertex myV2;
Standard_Real myT2;
//
Handle(IntTools_Context) myContext;
};
//
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
//
typedef BOPCol_Functor
typedef BOPCol_ContextFunctor
<BOPAlgo_MPC,
BOPAlgo_VectorOfMPC> BOPAlgo_MPCFunctor;
BOPAlgo_VectorOfMPC,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_MPCFunctor;
//
typedef BOPCol_Cnt
typedef BOPCol_ContextCnt
<BOPAlgo_MPCFunctor,
BOPAlgo_VectorOfMPC> BOPAlgo_MPCCnt;
BOPAlgo_VectorOfMPC,
Handle(IntTools_Context)> BOPAlgo_MPCCnt;
//
//=======================================================================
//class : BOPAlgo_BPC
@@ -422,8 +470,8 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
//=======================================================================
void BOPAlgo_PaveFiller::MakePCurves()
{
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI;
Standard_Boolean bHasPC;
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI, nEx;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
TopoDS_Face aF1F, aF2F;
@@ -460,15 +508,64 @@ void BOPAlgo_PaveFiller::MakePCurves()
aItMPB.Initialize(aMPBOn);
for(; aItMPB.More(); aItMPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
if (myDS->IsCommonBlockOnEdge(aPB)) {
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
BOPAlgo_MPC& aMPC=aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(myProgressIndicator);
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
bHasPC=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF1F);
if (bHasPC) {
continue;
}
//
Handle(BOPDS_CommonBlock) aCB=myDS->CommonBlock(aPB);
if (!aCB) {
continue;
}
//
const BOPDS_ListOfPaveBlock& aLPB=aCB->PaveBlocks();
if (aLPB.Extent()<2) {
continue;
}
//
BOPAlgo_MPC& aMPC=aVMPC.Append1();
//
aItLPB.Initialize(aLPB);
for(; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBx=aItLPB.Value();
if (aPBx==aPB) {
continue;
}
//
nEx=aPBx->OriginalEdge();
const TopoDS_Edge& aEx=(*(TopoDS_Edge *)(&myDS->Shape(nEx)));
bHasPC=BOPTools_AlgoTools2D::HasCurveOnSurface (aEx, aF1F);
if (!bHasPC) {
continue;
}
//
Standard_Integer nV1x, nV2x;
Standard_Real aT1x, aT2x;
TopoDS_Vertex aV1x, aV2x;
TopoDS_Edge aEz;
//
aEz=aEx;
aEz.Orientation(TopAbs_FORWARD);
//
aPBx->Indices(nV1x, nV2x);
aPBx->Range(aT1x, aT2x);
//
aV1x=(*(TopoDS_Vertex *)(&myDS->Shape(nV1x)));
aV1x.Orientation(TopAbs_FORWARD);
//
aV2x=(*(TopoDS_Vertex *)(&myDS->Shape(nV2x)));
aV2x.Orientation(TopAbs_REVERSED);
//
aMPC.SetData(aEz, aV1x, aT1x, aV2x, aT2x);
//
break;
}
//
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}// for (i=0; i<aNbFI; ++i) {
//
@@ -519,7 +616,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
}//if (bPCurveOnS1 || bPCurveOnS2 ) {
//
//======================================================
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC);
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
//======================================================
}
//=======================================================================

View File

@@ -1061,6 +1061,9 @@ Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
}
//
dT = aTOp - aT1max;
if (Abs(dT) < aTolInt) {
continue;
}
//
aT=aT1max + aCf*dT;
aC2D->D0(aT, aP);

View File

@@ -110,7 +110,12 @@ class BOPTest_Session {
return myFuzzyValue;
};
//
protected:
protected:
//
BOPTest_Session(const BOPTest_Session&);
BOPTest_Session& operator=(const BOPTest_Session&);
//
protected:
//
BOPAlgo_PaveFiller* myPaveFiller;
BOPAlgo_Builder* myBuilder;

View File

@@ -1156,7 +1156,7 @@ Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
//
aProjector.LowerDistanceParameters(aU, aV);
gp_Pnt2d aP2D(aU, aV);
bInFace=theContext->IsPointInFace (theFSr, aP2D);
bInFace=theContext->IsPointInOnFace (theFSr, aP2D);
if (!bInFace) {
return bRet;
}

View File

@@ -27,7 +27,8 @@ uses
Surface from BRepAdaptor,
Curve from Geom2d,
Curve from Geom,
ProjectedCurve from ProjLib,
ProjectedCurve from ProjLib,
Context from IntTools,
ListOfShape from BOPCol
is
@@ -205,5 +206,15 @@ is
---Purpose:
--- Make empty P-Curve <aC> of relevant to <PC> type
---
AttachExistingPCurve (myclass;
aEold : Edge from TopoDS;
aEnew : Edge from TopoDS;
aF : Face from TopoDS;
aCtx : Context from IntTools)
returns Integer from Standard;
---Purpose:
--- Attach P-Curve from the edge <aEold> on surface <aF>
--- to the edge <aEnew>
--- Returns 0 in case of success
end AlgoTools2D;

View File

@@ -0,0 +1,311 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2015 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 <BOPTools_AlgoTools2D.hxx>
#include <Precision.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Dir2d.hxx>
#include <TopLoc_Location.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom_Surface.hxx>
#include <GeomLib.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepLib.hxx>
#include <TopExp_Explorer.hxx>
#include <IntTools_Context.hxx>
#include <BOPTools_AlgoTools2D.hxx>
static
Standard_Integer UpdateClosedPCurve(const TopoDS_Edge& ,
const TopoDS_Edge& ,
const TopoDS_Face& ,
const Handle(IntTools_Context)& );
static
Standard_Boolean IsToReverse(const TopoDS_Edge& ,
const TopoDS_Edge& ,
const Handle(IntTools_Context)& );
static
Standard_Boolean IsClosed(const TopoDS_Edge& ,
const TopoDS_Face& );
//=======================================================================
//function : AttachExistingPCurve
//purpose :
//=======================================================================
Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
(const TopoDS_Edge& aE2, // old
const TopoDS_Edge& aE1, // new
const TopoDS_Face& aF,
const Handle(IntTools_Context)& aCtx)
{
Standard_Boolean bIsToReverse, bIsClosed;
Standard_Integer iRet;
Standard_Real aTol, aT11, aT12, aT21, aT22, aTolPPC;
Handle(Geom2d_Curve) aC2Dold, aC2DoldC;
Handle(Geom2d_TrimmedCurve) aC2DT;
BRep_Builder aBB;
//
iRet=0;
//
aC2Dold=BRep_Tool::CurveOnSurface(aE2, aF, aT21, aT22);
if (aC2Dold.IsNull()){
iRet=1;
return iRet;
}
//
aC2DoldC=Handle(Geom2d_Curve)::DownCast(aC2Dold->Copy());
//
bIsToReverse=IsToReverse(aE2, aE1, aCtx);
if (bIsToReverse) {
aC2DoldC->Reverse();
//
gp_Pnt2d aP1, aP2;
//
aC2Dold->D0(aT22, aP2);
aC2DoldC->D0(aT21, aP1);
aC2DoldC->Translate(aP1, aP2);
}
//
aC2DT=new Geom2d_TrimmedCurve(aC2DoldC, aT21, aT22);
//
aTol=BRep_Tool::Tolerance(aE1);
BRep_Tool::Range (aE1, aT11, aT12);
aBB.SameRange(aE1, Standard_False);
aBB.SameParameter(aE1, Standard_False);
aTolPPC=Precision::PConfusion();
//
GeomLib::SameRange(aTolPPC, aC2DT, aT21, aT22, aT11, aT12, aC2DT);
//
if (aC2DT.IsNull()){
iRet=2;
return iRet;
}
//
aBB.UpdateEdge(aE1, aC2DT, aF, aTol);
BRepLib::SameParameter(aE1);
BRepLib::SameRange(aE1);
//
bIsClosed=IsClosed(aE2, aF);
if (bIsClosed) {
iRet=UpdateClosedPCurve(aE2, aE1, aF, aCtx);
if(iRet) {
iRet=3;
}
}
//
return iRet;
}
//=======================================================================
//function : UpdateClosedPCurve
//purpose :
//=======================================================================
Standard_Integer UpdateClosedPCurve(const TopoDS_Edge& aEold,
const TopoDS_Edge& aEnew,
const TopoDS_Face& aF,
const Handle(IntTools_Context)& aCtx)
{
Standard_Boolean bUClosed, bRevOrder;
Standard_Integer aNbPoints, iRet;
Standard_Real aTS1, aTS2, aTS, aScPr, aUS1, aVS1, aUS2, aVS2, aT, aU, aV;
Standard_Real aT1, aT2, aTol;
gp_Pnt2d aP2DS1, aP2DS2, aP2D;
gp_Vec2d aV2DT, aV2D, aV2DS1, aV2DS2;
gp_Pnt aP;
Handle(Geom2d_Curve) aC2D, aC2DS1, aC2DS2, aC2Dnew, aC2DoldCT;
Handle(Geom2d_Curve) aC2Dold;
Handle(Geom2d_TrimmedCurve) aC2DTnew;
Handle(Geom_Surface) aS;
TopoDS_Edge aES;
BRep_Builder aBB;
//
iRet=0;
aTol=BRep_Tool::Tolerance(aEnew);
//
// aC2DoldCT is alone p-curve of aEnew that we've built
// The task is to build closed p-curves for aEnew
aC2DoldCT=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2);
//
// aC2Dold is p-curve of aEold
aC2Dold=BRep_Tool::CurveOnSurface(aEold, aF, aT1, aT2);
//
// As aEold is closed on aF, it is possible to retrieve
// the two p-curves:
// aC2DS1 -first p-curve
// aC2DS2 -second p-curve
aES=aEold;
aES.Orientation(TopAbs_FORWARD);
aC2DS1=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
//
aES.Orientation(TopAbs_REVERSED);
aC2DS2=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
//
aTS=BOPTools_AlgoTools2D::IntermediatePoint(aTS1, aTS2);
//
aC2DS1->D1(aTS, aP2DS1, aV2DS1);
aC2DS2->D1(aTS, aP2DS2, aV2DS2);
//
// aV2DS12 - translation vector
gp_Vec2d aV2DS12(aP2DS1, aP2DS2);
gp_Dir2d aD2DS12(aV2DS12);
const gp_Dir2d& aD2DX=gp::DX2d();
//
// Directoion of closeness: U-Closed or V-Closed
aScPr=aD2DS12*aD2DX;
bUClosed=Standard_True;
if (fabs(aScPr) < aTol) {
bUClosed=!bUClosed;
}
//
aP2DS1.Coord(aUS1, aVS1);
aP2DS2.Coord(aUS2, aVS2);
//
// aP - some 3D-point on seam edge of the surface aS
aS=BRep_Tool::Surface(aF);
aS->D0(aUS1, aVS1, aP);
//
GeomAPI_ProjectPointOnCurve& aProjPC=aCtx->ProjPC(aEnew);
//
aProjPC.Perform(aP);
aNbPoints=aProjPC.NbPoints();
if (!aNbPoints) {
iRet=1;
return iRet;
}
//
// aT - parameter for aP on the curves of aEnew
aT=aProjPC.LowerDistanceParameter();
//
aC2D=aC2DoldCT;
aC2D->D1(aT, aP2D, aV2D);
aP2D.Coord(aU, aV);
//
aC2Dnew=Handle(Geom2d_Curve)::DownCast(aC2D->Copy());
aC2DTnew=new Geom2d_TrimmedCurve(aC2Dnew, aT1, aT2);
//
aV2DT=aV2DS12;
if (!bUClosed) { // V Closed
if (fabs(aV-aVS2)<aTol) {
aV2DT.Reverse();
}
}
else { // U Closed
if (fabs(aU-aUS2)<aTol) {
aV2DT.Reverse();
}
}
//
// Translate aC2DTnew
aC2DTnew->Translate(aV2DT);
//
// 4 Order the 2D curves
bRevOrder=Standard_False;
aScPr=aV2D*aV2DS1;
if(aScPr<0.) {
bRevOrder=!bRevOrder;
}
//
if (!bRevOrder) {
aBB.UpdateEdge(aEnew, aC2D, aC2DTnew, aF, aTol);
}
else {
aBB.UpdateEdge(aEnew, aC2DTnew, aC2D , aF, aTol);
}
return iRet;
}
//=======================================================================
//function : IsToReverse
//purpose :
//=======================================================================
Standard_Boolean IsToReverse(const TopoDS_Edge& aEold,
const TopoDS_Edge& aEnew,
const Handle(IntTools_Context)& aCtx)
{
Standard_Boolean bRet, bFlag, bIsDegenerated;
Standard_Real aTnew, aTold, aScPr, aTa, aTb, aT1, aT2;
gp_Vec aVold, aVnew, aVE, aVS;
gp_Pnt aP;
Handle(Geom_Curve) aCold, aCnew;
//
bRet=Standard_False;
//
bIsDegenerated=(BRep_Tool::Degenerated(aEold) ||
BRep_Tool::Degenerated(aEnew));
if (bIsDegenerated) {
return bRet;
}
//
aCold=BRep_Tool::Curve(aEold, aT1, aT2);
aCnew=BRep_Tool::Curve(aEnew, aTa, aTb);
//
if (aCold==aCnew) {
return bRet;
}
//
aTnew=BOPTools_AlgoTools2D::IntermediatePoint(aTa, aTb);
aCnew->D1(aTnew, aP, aVnew);
aVnew.Normalize();
//
bFlag=aCtx->ProjectPointOnEdge(aP, aEold, aTold);
aCold->D1(aTold, aP, aVold);
aVold.Normalize();
//
aScPr=aVnew*aVold;
bRet=(aScPr<0.);
//
return bRet;
}
//=======================================================================
//function : IsClosed
//purpose :
//=======================================================================
Standard_Boolean IsClosed(const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
Standard_Boolean bRet;
//
bRet=BRep_Tool::IsClosed(aE, aF);
if (bRet) {
Standard_Integer iCnt;
//
iCnt=0;
TopExp_Explorer aExp(aF, TopAbs_EDGE);
for (; (aExp.More() || iCnt==2); aExp.Next()) {
const TopoDS_Shape& aEx=aExp.Current();
if(aEx.IsSame(aE)) {
++iCnt;
}
}
bRet=(iCnt==2);
}
return bRet;
}

View File

@@ -10,3 +10,5 @@ BOPTools_ListOfCoupleOfShape.hxx
BOPTools_ListOfEdgeSet.hxx
BOPTools_MapOfSet.hxx
BOPTools_DataMapOfShapeSet.hxx
BOPTools_AlgoTools2D_1.cxx

View File

@@ -366,7 +366,8 @@ is
-----------------------------------------------------------
IsClosed(myclass; E : Edge from TopoDS;
T : Triangulation from Poly)
T : Triangulation from Poly;
L : Location from TopLoc)
returns Boolean
---Purpose: Returns True if <E> has two arrays of indices in

View File

@@ -706,7 +706,8 @@ Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E,
TopLoc_Location l;
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
if (IsClosed(E,S,l)) return Standard_True;
return IsClosed(E, BRep_Tool::Triangulation(F,l));
const Handle(Poly_Triangulation)& T = BRep_Tool::Triangulation(F,l);
return IsClosed(E, T, l);
}
//=======================================================================
@@ -749,9 +750,10 @@ Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E,
//=======================================================================
Standard_Boolean BRep_Tool::IsClosed(const TopoDS_Edge& E,
const Handle(Poly_Triangulation)& T)
const Handle(Poly_Triangulation)& T,
const TopLoc_Location& L)
{
TopLoc_Location l = E.Location();
TopLoc_Location l = L.Predivided(E.Location());
// find the representation
BRep_ListIteratorOfListOfCurveRepresentation itcr

View File

@@ -258,6 +258,7 @@ is
--
class Sewing;
imported transient class FastSewing;
--
-- Construction of composite topologies

View File

@@ -0,0 +1,768 @@
// Created on: 2015-04-24
// Created by: NIKOLAI BUKHALOV
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepBuilderAPI_FastSewing.hxx>
#include <BRepTools_Quilt.hxx>
#include <Bnd_Box.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Surface.hxx>
#include <Precision.hxx>
#include <Standard_NullObject.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopTools_MapOfShape.hxx>
IMPLEMENT_STANDARD_HANDLE(BRepBuilderAPI_FastSewing, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(BRepBuilderAPI_FastSewing, Standard_Transient)
//=======================================================================
//function : IntersetctionOfSets
//purpose : Returns minimal value of intersection result
//=======================================================================
static Standard_Integer
IntersectionOfSets( const NCollection_List<Standard_Integer>& theSet1,
const NCollection_List<Standard_Integer>& theSet2)
{
const Standard_Integer anIntMax = IntegerLast();
Standard_Integer aRetVal = anIntMax;
for(NCollection_List<Standard_Integer>::Iterator
anIt1 = theSet1.begin().Iterator();
anIt1.More(); anIt1.Next())
{
const Standard_Integer aVal1 = anIt1.Value();
for(NCollection_List<Standard_Integer>::Iterator
anIt2 = theSet2.begin().Iterator();
anIt2.More(); anIt2.Next())
{
const Standard_Integer aVal2 = anIt2.Value();
if(aVal1 == aVal2)
{
//theIntersectionResult.Append(aVal1);
if(aVal1 < aRetVal)
aRetVal = aVal1;
}
}
}
if(aRetVal == anIntMax)
return -1;
return aRetVal;
}
//=======================================================================
//function : Get2DCurve
//purpose :
//=======================================================================
static Handle(Geom2d_Curve)
Get2DCurve( const Standard_Integer theIndex,
const Standard_Real theUfirst,
const Standard_Real theUlast,
const Standard_Real theVfirst,
const Standard_Real theVlast,
const Standard_Boolean theIsReverse = Standard_False)
{
if((theIndex < 0) || (theIndex > 3))
Standard_OutOfRange::Raise("BRepBuilderAPI_FastSewing.cxx, Get2DCurve(): OUT of Range");
Handle(Geom2d_Curve) a2dCurv;
if(!theIsReverse)
{
switch(theIndex)
{
case 0:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(0.0, theVfirst), gp_Dir2d(1.0,0.0)),
theUfirst, theUlast);
break;
case 1:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(theUlast, 0.0), gp_Dir2d(0.0,1.0)),
theVfirst, theVlast);
break;
case 2:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(0.0, theVlast), gp_Dir2d(1.0,0.0)),
theUfirst, theUlast);
break;
case 3:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(theUfirst, 0.0), gp_Dir2d(0.0,1.0)),
theVfirst, theVlast);
break;
default:
break;
}
}
else
{
switch(theIndex)
{
case 0:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(theUfirst+theUlast, theVfirst),
gp_Dir2d(-1.0,0.0)),
theUfirst, theUlast);
break;
case 1:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(theUlast, theVfirst+theVlast),
gp_Dir2d(0.0,-1.0)),
theVfirst, theVlast);
break;
case 2:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(theUfirst+theUlast, theVlast),
gp_Dir2d(-1.0,0.0)),
theUfirst, theUlast);
break;
case 3:
a2dCurv =
new Geom2d_TrimmedCurve(new Geom2d_Line(
gp_Pnt2d(theUfirst, theVfirst+theVlast),
gp_Dir2d(0.0,-1.0)),
theVfirst, theVlast);
break;
default:
break;
}
}
return a2dCurv;
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepBuilderAPI_FastSewing::
BRepBuilderAPI_FastSewing( const Standard_Real theTol):
myTolerance(theTol),
myStatusList(0)
{
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
Standard_Boolean BRepBuilderAPI_FastSewing::Add(const TopoDS_Shape& theShape)
{
Standard_Boolean aResult = Standard_False;
if(theShape.IsNull())
{
SetStatus(FS_EmptyInput);
return aResult;
}
TopTools_MapOfShape aMS;
//aMS.Add(theShape);
TopExp_Explorer aFExp(theShape,TopAbs_FACE);
for (; aFExp.More(); aFExp.Next())
{
const TopoDS_Face& aFace = TopoDS::Face(aFExp.Current());
if(aMS.Add(aFace))
{
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
if(aSurf.IsNull())
{
SetStatus(FS_FaceWithNullSurface);
continue;
}
if(aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
{
SetStatus(FS_NotNaturalBoundsFace);
continue;
}
Standard_Real aUf = 0.0, aUl = 0.0, aVf = 0.0, aVl = 0.0;
aSurf->Bounds(aUf, aUl, aVf, aVl);
if(Precision::IsInfinite(aUf) || Precision::IsInfinite(aUl) ||
Precision::IsInfinite(aVf) || Precision::IsInfinite(aVl))
{
SetStatus(FS_InfiniteSurface);
continue;
}
FS_Face aFFace;
aFFace.mySrcFace = aFace;
aFFace.myID = myFaceVec.Length();//because start index is 0
myFaceVec.Append(aFFace);
aResult = Standard_True;
}
}
return aResult;
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
Standard_Boolean BRepBuilderAPI_FastSewing::Add(const Handle(Geom_Surface)& theSurface)
{
if(theSurface.IsNull())
{
SetStatus(FS_FaceWithNullSurface);
return Standard_False;
}
if(theSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
{
SetStatus(FS_NotNaturalBoundsFace);
return Standard_False;
}
Standard_Real aUf = 0.0, aUl = 0.0, aVf = 0.0, aVl = 0.0;
theSurface->Bounds(aUf, aUl, aVf, aVl);
if(Precision::IsInfinite(aUf) || Precision::IsInfinite(aUl) ||
Precision::IsInfinite(aVf) || Precision::IsInfinite(aVl))
{
SetStatus(FS_InfiniteSurface);
return Standard_False;
}
FS_Face aFace;
BRep_Builder aBuilder;
aBuilder.MakeFace(aFace.mySrcFace);
aBuilder.MakeFace(aFace.mySrcFace, theSurface, myTolerance);
aBuilder.NaturalRestriction(aFace.mySrcFace, Standard_True);
aFace.myID = myFaceVec.Length();//because start index is 0
myFaceVec.Append(aFace);
return Standard_True;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepBuilderAPI_FastSewing::Perform(void)
{
if(myFaceVec.IsEmpty())
{
SetStatus(FS_EmptyInput);
return;
}
try
{
{
// create vertices having unique coordinates
Standard_Real aRange = Compute3DRange();
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
NCollection_CellFilter<NodeInspector>
aCells(Max(myTolerance, aRange/IntegerLast()), anAlloc);
for(Standard_Integer i = myFaceVec.Lower(); i <= myFaceVec.Upper(); i++)
{
FindVertexes(i, aCells);
}
}
for(Standard_Integer i = myFaceVec.Lower(); i <= myFaceVec.Upper(); i++)
{
FindEdges(i);
}
//Create topological structures
for(Standard_Integer i = myVertexVec.Lower(); i <= myVertexVec.Upper(); i++)
{
myVertexVec.ChangeValue(i).CreateTopologicalVertex(myTolerance);
}
//Edges
for(Standard_Integer i = myEdgeVec.Lower(); i <= myEdgeVec.Upper(); i++)
{
myEdgeVec.ChangeValue(i).CreateTopologicalEdge(myVertexVec, myFaceVec, myTolerance);
}
//Shell
BRepTools_Quilt aQuilt;
//Faces
for(Standard_Integer i = myFaceVec.Lower(); i <= myFaceVec.Upper(); i++)
{
FS_Face& aFace = myFaceVec.ChangeValue(i);
aFace.CreateTopologicalWire(myEdgeVec, myTolerance);
aFace.CreateTopologicalFace();
aQuilt.Add(aFace.myRetFace);
}
myResShape = aQuilt.Shells();
}
catch(Standard_Failure)
{
SetStatus(FS_Exception);
#ifdef OCCT_DEBUG
//Standard_Failure::Caught()->Print(cout);
#endif
return;
}
}
//=======================================================================
//function : UpdateEdgeInfo
//purpose :
//=======================================================================
void BRepBuilderAPI_FastSewing::UpdateEdgeInfo( const Standard_Integer theIDPrevVertex,
const Standard_Integer theIDCurrVertex,
const Standard_Integer theFaceID,
const Standard_Integer theIDCurvOnFace)
{
//Indeed, two vertices combine into one edge only.
const Standard_Integer anEdgeID =
IntersectionOfSets(myVertexVec.Value(theIDPrevVertex).myEdges,
myVertexVec.Value(theIDCurrVertex).myEdges);
//For DEBUG mode only
Standard_ProgramError_Raise_if(anEdgeID < 0,
"BRepBuilderAPI_FastSewing::UpdateEdgeInfo: Update not existing edge.");
FS_Edge& anEdge = myEdgeVec.ChangeValue(anEdgeID);
anEdge.myFaces.Append(theFaceID);
FS_Face& aFace = myFaceVec.ChangeValue(theFaceID);
aFace.SetEdge(theIDCurvOnFace, anEdge.myID);
}
//=======================================================================
//function : CreateNewEdge
//purpose : Creates FS_Edge
//=======================================================================
void BRepBuilderAPI_FastSewing::CreateNewEdge(const Standard_Integer theIDPrevVertex,
const Standard_Integer theIDCurrVertex,
const Standard_Integer theFaceID,
const Standard_Integer theIDCurvOnFace)
{
FS_Edge anEdge(theIDPrevVertex, theIDCurrVertex);
anEdge.myID = myEdgeVec.Length(); //because start index is 0
anEdge.myFaces.Append(theFaceID);
FS_Face& aFace = myFaceVec.ChangeValue(theFaceID);
aFace.SetEdge(theIDCurvOnFace, anEdge.myID);
myVertexVec.ChangeValue(theIDPrevVertex).myEdges.Append(anEdge.myID);
if(theIDPrevVertex == theIDCurrVertex)
{//the Edge is degenerated
SetStatus(FS_Degenerated);
}
else
{
myVertexVec.ChangeValue(theIDCurrVertex).myEdges.Append(anEdge.myID);
}
myEdgeVec.Append(anEdge);
}
//=======================================================================
//function : FindVertexes
//purpose :
//=======================================================================
void BRepBuilderAPI_FastSewing::
FindVertexes(const Standard_Integer theSurfID,
NCollection_CellFilter<NodeInspector>& theCells)
{
const Standard_Integer aNbPoints = 4;
FS_Face& aFace = myFaceVec.ChangeValue(theSurfID);
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace.mySrcFace);
Standard_Real aUf = 0.0, aUl = 0.0, aVf = 0.0, aVl = 0.0;
aSurf->Bounds(aUf, aUl, aVf, aVl);
const gp_Pnt aPnts[aNbPoints] = { aSurf->Value(aUf, aVf),
aSurf->Value(aUl, aVf),
aSurf->Value(aUl, aVl),
aSurf->Value(aUf, aVl)};
for(Standard_Integer i = 0; i < aNbPoints; i++)
{
FS_Vertex aVert;
NodeInspector anInspector(myVertexVec, aPnts[i], myTolerance);
Bnd_Box aBox;
aBox.Add(aPnts[i]);
aBox.Enlarge(myTolerance);
theCells.Inspect(aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ(), anInspector);
NodeInspector::Target aResID = anInspector.GetResult();
if(aResID < 0)
{//Add new Vertex
aVert.myID = myVertexVec.Length(); //because start index is 0
aVert.myPnt = aPnts[i];
aVert.myFaces.Append(theSurfID);
myVertexVec.Append(aVert);
aFace.SetVertex(i, aVert.myID);
theCells.Add(aVert.myID, aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ());
}
else
{//Change existing vertex
aFace.SetVertex(i, aResID);
myVertexVec.ChangeValue(aResID).myFaces.Append(theSurfID);
}
}
}
//=======================================================================
//function : FindEdges
//purpose :
//=======================================================================
void BRepBuilderAPI_FastSewing::FindEdges(const Standard_Integer theSurfID)
{
const Standard_Integer aNbPoints = 4;
FS_Face& aFace = myFaceVec.ChangeValue(theSurfID);
const Standard_Integer aFirstInd[aNbPoints] = {0, 1, 3, 0};
const Standard_Integer aLastInd[aNbPoints] = {1, 2, 2, 3};
for(Standard_Integer i = 0; i < aNbPoints; i++)
{
const Standard_Integer aFirstVertIndex = aFirstInd[i],
aLastVertIndex = aLastInd[i];
const Standard_Integer aFirstVertID = aFace.myVertices[aFirstVertIndex],
aLastVertID = aFace.myVertices[aLastVertIndex];
if(aFirstVertID == aLastVertID)
{//Edge is degenerated.
CreateNewEdge(aFirstVertID, aLastVertID, theSurfID, i);
continue;
}
//Must be minimal element from list
const Standard_Integer anIntRes =
IntersectionOfSets(myVertexVec.Value(aFirstVertID).myFaces,
myVertexVec.Value(aLastVertID).myFaces);
if((anIntRes < 0) || (anIntRes >= theSurfID))
{
CreateNewEdge(aFirstVertID, aLastVertID, theSurfID, i);
}
else
{//if(theSurfID > anIntRes) => The edge has been processed earlier
UpdateEdgeInfo(aFirstVertID, aLastVertID, theSurfID, i);
}
}
}
//=======================================================================
//function : GetStatuses
//purpose :
//=======================================================================
BRepBuilderAPI_FastSewing::FS_VARStatuses
BRepBuilderAPI_FastSewing::GetStatuses(Standard_OStream* const theOS)
{
if(!theOS)
return myStatusList;
if(!myStatusList)
{
*theOS << "Fast Sewing OK!\n";
return myStatusList;
}
//Number of bits
const Standard_Integer aNumMax = 8*sizeof(myStatusList);
FS_Statuses anIDS = static_cast<FS_Statuses>(0x0001);
for(Standard_Integer i = 1; i <= aNumMax; i++,
anIDS = static_cast<FS_Statuses>(anIDS << 1))
{
if((anIDS & myStatusList) == 0)
continue;
switch(anIDS)
{
case FS_Degenerated:
*theOS << "Degenerated case. Try to reduce tolerance.\n";
break;
case FS_FindVertexError:
*theOS << "Error while creating list of vertices.\n";
break;
case FS_FindEdgeError:
*theOS << "Error while creating list of edges.\n";
break;
case FS_Exception:
*theOS << "Exception during the operation.\n";
break;
case FS_FaceWithNullSurface:
*theOS << "Source face has null surface.\n";
break;
case FS_NotNaturalBoundsFace:
*theOS << "Source face has trimmed surface.\n";
break;
case FS_InfiniteSurface:
*theOS << "Source face has the surface with infinite boundaries.\n";
break;
case FS_EmptyInput:
*theOS << "Empty source data.\n";
break;
default:
return myStatusList;
}
}
return myStatusList;
}
//=======================================================================
//function : Compute3DRange
//purpose :
//=======================================================================
Standard_Real BRepBuilderAPI_FastSewing::Compute3DRange()
{
Bnd_Box aBox;
for(Standard_Integer i = myFaceVec.Lower(); i <= myFaceVec.Upper(); i++)
{
FS_Face& aFace = myFaceVec.ChangeValue(i);
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace.mySrcFace);
if(aSurf.IsNull())
continue;
Standard_Real aUf = 0.0, aUl = 0.0, aVf = 0.0, aVl = 0.0;
aSurf->Bounds(aUf, aUl, aVf, aVl);
aBox.Add(aSurf->Value(aUf, aVf));
aBox.Add(aSurf->Value(aUl, aVf));
aBox.Add(aSurf->Value(aUl, aVl));
aBox.Add(aSurf->Value(aUf, aVl));
}
Standard_Real aXm = 0.0, aYm = 0.0, aZm = 0.0, aXM = 0.0, aYM = 0.0, aZM = 0.0;
aBox.Get(aXm, aYm, aZm, aXM, aYM, aZM);
Standard_Real aDelta = aXM - aXm;
aDelta = Max(aDelta, aYM - aYm);
aDelta = Max(aDelta, aZM - aZm);
return aDelta;
}
//=======================================================================
//function : NodeInspector constructor
//purpose :
//=======================================================================
BRepBuilderAPI_FastSewing::NodeInspector::
NodeInspector(const NCollection_Vector<FS_Vertex>& theVec,
const gp_Pnt& thePnt,
const Standard_Real theTol):
myVecOfVertexes(theVec), myPoint(thePnt), myResID(-1)
{
mySQToler = theTol*theTol;
}
//=======================================================================
//function : ::NodeInspector::Inspect
//purpose :
//=======================================================================
NCollection_CellFilter_Action BRepBuilderAPI_FastSewing::
NodeInspector::Inspect(const Target theID)
{
const gp_Pnt& aPt = myVecOfVertexes.Value(theID).myPnt;
const Standard_Real aSQDist = aPt.SquareDistance(myPoint);
if(aSQDist < mySQToler)
{
mySQToler = aSQDist;
myResID = theID;
}
return CellFilter_Keep;
}
//=======================================================================
//function : ::FS_Edge::CreateTopologicalEdge
//purpose :
//=======================================================================
void BRepBuilderAPI_FastSewing::FS_Edge::
CreateTopologicalEdge(const NCollection_Vector<FS_Vertex>& theVertexVec,
const NCollection_Vector<FS_Face>& theFaceVec,
const Standard_Real theTol)
{
BRep_Builder aBuilder;
TopoDS_Vertex aV1 = theVertexVec(myVertices[0]).myTopoVert;
TopoDS_Vertex aV2 = theVertexVec(myVertices[1]).myTopoVert;
aV1.Orientation(TopAbs_FORWARD);
aV2.Orientation(TopAbs_REVERSED);
Handle(Geom_Curve) a3dCurv;
TopLoc_Location aLocation;
const FS_Face& aFace = theFaceVec.Value(myFaces.Value(myFaces.Lower()));
//3D-curves in 1st and 2nd faces are considered to be in same-range
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(aFace.mySrcFace, aLocation);
Standard_Real aUf = 0.0, aUl = 0.0, aVf = 0.0, aVl = 0.0;
aSurf->Bounds(aUf, aUl, aVf, aVl);
Standard_Integer anEdgeID = -1;
for(Standard_Integer anInd = 0; anInd < 4; anInd++)
{
if(myID == aFace.myEdges[anInd])
{
anEdgeID = anInd;
break;
}
}
//For DEBUG mode only
Standard_ProgramError_Raise_if(anEdgeID < 0,
"BRepBuilderAPI_FastSewing::FS_Edge::CreateTopologicalEdge: Single edge.");
if(IsDegenerated())
{
Handle(Geom2d_Curve) a2dCurv = Get2DCurve(anEdgeID, aUf, aUl, aVf, aVl);
const Standard_Real aFPar = a2dCurv->FirstParameter(),
aLPar = a2dCurv->LastParameter();
aBuilder.MakeEdge(myTopoEdge);
aBuilder.UpdateEdge(myTopoEdge, a2dCurv, aSurf, aLocation, theTol);
aBuilder.Add(myTopoEdge, aV1);
aBuilder.Add(myTopoEdge, aV2);
aBuilder.Range(myTopoEdge, aFPar, aLPar);
aBuilder.Degenerated(myTopoEdge, Standard_True);
return;
}
switch(anEdgeID)
{
case 0:
a3dCurv = aSurf->VIso(aVf);
break;
case 1:
a3dCurv = aSurf->UIso(aUl);
break;
case 2:
a3dCurv = aSurf->VIso(aVl);
break;
case 3:
a3dCurv = aSurf->UIso(aUf);
break;
default:
Standard_OutOfRange::Raise("FS_Edge::CreateTopologicalEdge()");
break;
}
aBuilder.MakeEdge(myTopoEdge, a3dCurv, theTol);
aBuilder.Add(myTopoEdge, aV1);
aBuilder.Add(myTopoEdge, aV2);
aBuilder.Range(myTopoEdge, a3dCurv->FirstParameter(), a3dCurv->LastParameter());
}
//=======================================================================
//function : ::FS_Face::CreateTopologicalWire
//purpose :
//=======================================================================
void BRepBuilderAPI_FastSewing::FS_Face::
CreateTopologicalWire(const NCollection_Vector<FS_Edge>& theEdgeVec,
const Standard_Real theToler)
{
TopLoc_Location aLocation;
//3D-curves in 1st and 2nd faces are considered to be in same-range
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(mySrcFace, aLocation);
Standard_Real aUf = 0.0, aUl = 0.0, aVf = 0.0, aVl = 0.0;
aSurf->Bounds(aUf, aUl, aVf, aVl);
BRep_Builder aB;
aB.MakeWire(myWire);
for(Standard_Integer anEdge = 0; anEdge < 4; anEdge++)
{
Standard_ProgramError_Raise_if(myEdges[anEdge] < 0,
"BRepBuilderAPI_FastSewing::FS_Face::CreateTopologicalWire: Wire is not closed.");
const BRepBuilderAPI_FastSewing::FS_Edge& aFSEdge = theEdgeVec.Value(myEdges[anEdge]);
TopAbs_Orientation anOri = anEdge < 2 ? TopAbs_FORWARD : TopAbs_REVERSED;
TopoDS_Edge anTopE = aFSEdge.myTopoEdge;
if(aFSEdge.IsDegenerated())
{
anTopE.Orientation(anOri);
aB.Add(myWire, anTopE);
continue;
}
//Check if 3D and 2D-curve have same-orientation.
//If it is not, 2d-curve will be reversed.
{
Standard_Real aFirstPar = 0.0, aLastPar = 0.0;
const Handle(Geom_Curve) a3dCurv = BRep_Tool::Curve(anTopE, aFirstPar, aLastPar);
Handle(Geom2d_Curve) a2dCurv = Get2DCurve(anEdge, aUf, aUl, aVf, aVl);
const gp_Pnt aPref(a3dCurv->Value(aFirstPar));
const gp_Pnt2d aP2df(a2dCurv->Value(aFirstPar)), aP2dl(a2dCurv->Value(aLastPar));
gp_Pnt aP3df(aSurf->Value(aP2df.X(), aP2df.Y()));
gp_Pnt aP3dl(aSurf->Value(aP2dl.X(), aP2dl.Y()));
aP3df.Transform(aLocation);
aP3dl.Transform(aLocation);
const Standard_Real aSqD1 = aP3df.SquareDistance(aPref);
const Standard_Real aSqD2 = aP3dl.SquareDistance(aPref);
if(aSqD2 < aSqD1)
{
a2dCurv = Get2DCurve(anEdge, aUf, aUl, aVf, aVl, Standard_True);
anOri = TopAbs::Reverse(anOri);
}
aB.UpdateEdge(anTopE, a2dCurv, aSurf, aLocation, theToler);
}
anTopE.Orientation(anOri);
aB.Add(myWire, anTopE);
}
myWire.Closed(Standard_True);
}
//=======================================================================
//function : ::FS_Face::CreateTopologicalFace
//purpose :
//=======================================================================
void BRepBuilderAPI_FastSewing::FS_Face::CreateTopologicalFace()
{
Standard_ProgramError_Raise_if(myWire.IsNull(),
"BRepBuilderAPI_FastSewing::FS_Face::CreateTopologicalFace: Cannot create wire.");
BRep_Builder aBuilder;
myRetFace = TopoDS::Face(mySrcFace.EmptyCopied());
aBuilder.Add(myRetFace, myWire);
aBuilder.NaturalRestriction(myRetFace, Standard_True);
}

View File

@@ -0,0 +1,306 @@
//! Created on: 2015-04-24
//! Created by: NIKOLAI BUKHALOV
//! Copyright (c) 2015 OPEN CASCADE SAS
//!
//! This file is part of Open CASCADE Technology software library.
//!
//! This library is free software; you can redistribute it and/or modify it under
//! the terms of the GNU Lesser General Public License version 2.1 as published
//! by the Free Software Foundation, with special exception defined in the file
//! OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
//! distribution for complete text of the license and disclaimer of any warranty.
//!
//! Alternatively, this file may be used under the terms of Open CASCADE
//! commercial license or contractual agreement.
#ifndef _BRepBuilderAPI_FastSewing_HeaderFile
#define _BRepBuilderAPI_FastSewing_HeaderFile
#include <Standard_Transient.hxx>
#include <BRep_Builder.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Sequence.hxx>
#include <NCollection_Vector.hxx>
#include <NCollection_CellFilter.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
class Handle(NCollection_IncAllocator);
class Handle(Geom_Surface);
//! This class performs fast sewing of surfaces (faces). It supposes
//! that all surfaces are finite and are naturally restricted by their bounds.
//! Moreover, it supposes that stitched together surfaces have the same parameterization
//! along common boundaries, therefore it does not perform time-consuming check for
//! SameParameter property of edges.
//!
//! For sewing, use this function as following:
//! - set tolerance value (default tolerance is 1.E-06)
//! - add all necessary surfaces (faces)
//! - check status if adding is correctly completed.
//! - compute -> Perform
//! - retrieve the error status if any
//! - retrieve the resulted shape
class BRepBuilderAPI_FastSewing : public Standard_Transient
{
public:
typedef unsigned int FS_VARStatuses;
//! Enumeration of result statuses
//ATTENTION!!! If you add new status, please
// describe it in GetStatuses() method
enum FS_Statuses
{
FS_OK = 0x00000000,
FS_Degenerated = 0x00000001,
FS_FindVertexError = 0x00000002,
FS_FindEdgeError = 0x00000004,
FS_FaceWithNullSurface = 0x00000008,
FS_NotNaturalBoundsFace = 0x00000010,
FS_InfiniteSurface = 0x00000020,
FS_EmptyInput = 0x00000040,
FS_Exception = 0x00000080
};
//! Creates an object with tolerance of connexity
Standard_EXPORT BRepBuilderAPI_FastSewing(const Standard_Real theTolerance = 1.0e-06);
//! Adds faces of a shape
Standard_EXPORT Standard_Boolean Add(const TopoDS_Shape& theShape);
//! Adds a surface
Standard_EXPORT Standard_Boolean Add(const Handle(Geom_Surface)& theSurface);
//! Compute resulted shape
Standard_EXPORT void Perform (void) ;
//! Sets tolerance
void SetTolerance (const Standard_Real theToler)
{
myTolerance = theToler;
}
//! Returns tolerance
Standard_Real GetTolerance() const
{
return myTolerance;
}
//! Returns resulted shape
const TopoDS_Shape& GetResult() const
{
return myResShape;
}
//! Returns list of statuses. Print message if theOS != 0
Standard_EXPORT FS_VARStatuses GetStatuses(Standard_OStream* const theOS = 0);
DEFINE_STANDARD_RTTI(BRepBuilderAPI_FastSewing)
protected:
class NodeInspector;
Standard_EXPORT void FindVertexes(const Standard_Integer theSurfID,
NCollection_CellFilter<NodeInspector>& theCells);
Standard_EXPORT void FindEdges(const Standard_Integer theSurfID);
Standard_EXPORT void UpdateEdgeInfo(const Standard_Integer theIDPrevVertex,
const Standard_Integer theIDCurrVertex,
const Standard_Integer theFaceID,
const Standard_Integer theIDCurvOnFace);
Standard_EXPORT void CreateNewEdge( const Standard_Integer theIDPrevVertex,
const Standard_Integer theIDCurrVertex,
const Standard_Integer theFaceID,
const Standard_Integer theIDCurvOnFace);
Standard_EXPORT Standard_Real Compute3DRange();
//! Sets status. Returns numeric value of the status set
FS_VARStatuses SetStatus(FS_Statuses theStatus)
{
const FS_VARStatuses aStatusID = (FS_VARStatuses)(theStatus);
myStatusList |= aStatusID;
return aStatusID;
}
class FS_Edge;
// Classes FS_Vertex, FS_Face and FS_Edge keep information about
// relations between resulted members (e.g. which faces share this vertex? etc.)
//! The struct corresponding to a vertex
struct FS_Vertex
{
public:
FS_Vertex(): myID(-1){};
//! Creates topological member (vertex)
void CreateTopologicalVertex(const Standard_Real theToler)
{
BRep_Builder aBuilder;
aBuilder.MakeVertex(myTopoVert, myPnt, theToler);
}
//! Geometry point of this Vertex
gp_Pnt myPnt;
TopoDS_Vertex myTopoVert;
//! List of faces and edges which share this vertex
NCollection_List<Standard_Integer> myFaces;
NCollection_List<Standard_Integer> myEdges;
//! Indentifies the place of this Vertex in
//! BRepBuilderAPI_FastSewing::myVertexVec list
Standard_Integer myID;
};
//! The struct corresponding to an face
struct FS_Face
{
FS_Face(): myID(-1)
{
for (Standard_Integer i = 0; i < 4; i++)
{
myVertices[i] = -1;
myEdges[i] = -1;
}
};
//! Creates topological members (wire and face)
void CreateTopologicalWire(const NCollection_Vector<FS_Edge>& theEdgeVec,
const Standard_Real theToler);
void CreateTopologicalFace();
//! Sets vertex
void SetVertex(const Standard_Integer thePlaceID, const Standard_Integer theVertID)
{
Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 3),
"FS_Face::SetVertex(): OUT of Range");
myVertices[thePlaceID] = theVertID;
}
//! Sets edge
void SetEdge(const Standard_Integer thePlaceID, const Standard_Integer theEdgeID)
{
Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 3),
"FS_Face::SetEdge(): OUT of Range");
myEdges[thePlaceID] = theEdgeID;
}
TopoDS_Face mySrcFace;
TopoDS_Wire myWire;
TopoDS_Face myRetFace;
//! myEdges[i] number of the edge in myEdgeVec
//! (i==0) <-> (V=Vf); (i==1) <-> (U=Ul);
//! (i==2) <-> (V=Vl); (i==3) <-> (U=Uf)
Standard_Integer myEdges[4];
//! myVertices[i] is Start point of myEdges[i]
Standard_Integer myVertices[4];
//! Indentifies the place of this Face in
//! BRepBuilderAPI_FastSewing::myFaceVec list
Standard_Integer myID;
};
//! The struct corresponding to a edge
class FS_Edge
{
public:
FS_Edge(): myID(-1)
{
myVertices[0] = -1;
myVertices[1] = -1;
}
FS_Edge(const Standard_Integer theIDVert1, const Standard_Integer theIDVert2): myID(-1)
{
myVertices[0] = theIDVert1;
myVertices[1] = theIDVert2;
};
//! Creates topological member (TopoDS_Edge)
void CreateTopologicalEdge( const NCollection_Vector<FS_Vertex>& theVertexVec,
const NCollection_Vector<FS_Face>& theFaceVec,
const Standard_Real theTol);
//! Sets vertex
void SetVertex(const Standard_Integer thePlaceID, const Standard_Integer theVertID)
{
Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 1),
"FS_Face::SetVertex(): OUT of Range");
myVertices[thePlaceID] = theVertID;
}
Standard_Boolean IsDegenerated() const
{
return (myVertices[0] == myVertices[1]);
}
//! List of faces which are shared with this edge
//! Value is the index of this shape in myFaceVec array
NCollection_Sequence<Standard_Integer> myFaces;
//! Indentifies the place of this Edge in
//! BRepBuilderAPI_FastSewing::myEdgeVec list
Standard_Integer myID;
TopoDS_Edge myTopoEdge;
private:
//! Index of the vertex in myVertexVec array
Standard_Integer myVertices[2];
};
//! This inspector will find a node nearest to the given point
//! not far than on the given tolerance
class NodeInspector: public NCollection_CellFilter_InspectorXYZ
{
public:
typedef Standard_Integer Target;
NodeInspector(const NCollection_Vector<FS_Vertex>& theVec,
const gp_Pnt& thePnt, const Standard_Real theTol);
Standard_EXPORT NCollection_CellFilter_Action Inspect (const Target theId);
Target GetResult()
{
return myResID;
}
private:
NodeInspector& operator = (const NodeInspector&);
const NCollection_Vector<FS_Vertex>& myVecOfVertexes;
gp_Pnt myPoint;
Standard_Real mySQToler;
Target myResID;
Standard_Boolean myIsFindingEnable;
};
private:
TopoDS_Shape myResShape;
// myFaceVec, myVertexVec and myEdgeVec lists are filled only once!!!!!
//! Vector of faces
NCollection_Vector<FS_Face> myFaceVec;
//! Vector of Vertices
NCollection_Vector<FS_Vertex> myVertexVec;
//! Vector of edges
NCollection_Vector<FS_Edge> myEdgeVec;
//! Tolerance
Standard_Real myTolerance;
//! Bits of computation status
FS_VARStatuses myStatusList;
};
#endif // _BRepBuilderAPI_FastSewing_HeaderFile
DEFINE_STANDARD_HANDLE(BRepBuilderAPI_FastSewing, Standard_Transient)

View File

@@ -1,4 +1,5 @@
BRepBuilderAPI_VertexInspector.hxx
BRepBuilderAPI_CellFilter.hxx
BRepBuilderAPI_BndBoxTreeSelector.hxx
BRepBuilderAPI_FastSewing.hxx
BRepBuilderAPI_FastSewing.cxx

View File

@@ -311,5 +311,14 @@ is
---Purpose: Sorts in LF the Faces of S on the reverse
-- complexity of their surfaces
-- (other,Torus,Sphere,Cone,Cylinder,Plane)
EnsureNormalConsistency (S : Shape from TopoDS;
theAngTol: Real from Standard = 0.001;
ForceComputeNormals: Boolean from Standard = Standard_False)
returns Boolean;
---Purpose: Corrects the normals in Poly_Triangulation of faces,
-- in such way that normals at nodes lying along smooth
-- edges have the same value on both adjacent triangulations.
-- Returns TRUE if any correction is done.
end BRepLib;

View File

@@ -82,6 +82,10 @@
#include <Approx_CurvilinearParameter.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Poly_Triangulation.hxx>
#include <TShort_HArray1OfShortReal.hxx>
#include <GeomLProp_SLProps.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
// TODO - not thread-safe static variables
static Standard_Real thePrecision = Precision::Confusion();
@@ -1657,6 +1661,146 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
}
}
//=======================================================================
// function : EnsureNormalConsistency
// purpose : Corrects the normals in Poly_Triangulation of faces.
// Returns TRUE if any correction is done.
//=======================================================================
Standard_Boolean BRepLib::
EnsureNormalConsistency(const TopoDS_Shape& theShape,
const Standard_Real theAngTol,
const Standard_Boolean theForceComputeNormals)
{
const Standard_Real aThresDot = cos(theAngTol);
Standard_Boolean aRetVal = Standard_False, isNormalsFound = Standard_False;
// compute normals if they are absent
TopExp_Explorer anExpFace(theShape,TopAbs_FACE);
for (; anExpFace.More(); anExpFace.Next())
{
const TopoDS_Face& aFace = TopoDS::Face(anExpFace.Current());
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
if(aSurf.IsNull())
continue;
TopLoc_Location aLoc;
const Handle(Poly_Triangulation)& aPT = BRep_Tool::Triangulation(aFace, aLoc);
if(aPT.IsNull())
continue;
if (!theForceComputeNormals && aPT->HasNormals())
{
isNormalsFound = Standard_True;
continue;
}
GeomLProp_SLProps aSLP(aSurf, 2, Precision::Confusion());
const Standard_Integer anArrDim = 3*aPT->NbNodes();
Handle(TShort_HArray1OfShortReal) aNormArr = new TShort_HArray1OfShortReal(1, anArrDim);
Standard_Integer anNormInd = aNormArr->Lower();
for(Standard_Integer i = aPT->UVNodes().Lower(); i <= aPT->UVNodes().Upper(); i++)
{
const gp_Pnt2d &aP2d = aPT->UVNodes().Value(i);
aSLP.SetParameters(aP2d.X(), aP2d.Y());
gp_XYZ aNorm(0.,0.,0.);
if(!aSLP.IsNormalDefined())
{
#ifdef OCCT_DEBUG
cout << "BRepLib::EnsureNormalConsistency(): Cannot find normal!" << endl;
#endif
}
else
{
aNorm = aSLP.Normal().XYZ();
if (aFace.Orientation() == TopAbs_REVERSED)
aNorm.Reverse();
}
aNormArr->ChangeValue(anNormInd++) = static_cast<Standard_ShortReal>(aNorm.X());
aNormArr->ChangeValue(anNormInd++) = static_cast<Standard_ShortReal>(aNorm.Y());
aNormArr->ChangeValue(anNormInd++) = static_cast<Standard_ShortReal>(aNorm.Z());
}
aRetVal = Standard_True;
isNormalsFound = Standard_True;
aPT->SetNormals(aNormArr);
}
if(!isNormalsFound)
{
return aRetVal;
}
// loop by edges
TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,aMapEF);
for(Standard_Integer anInd = 1; anInd <= aMapEF.Extent(); anInd++)
{
const TopoDS_Edge& anEdg = TopoDS::Edge(aMapEF.FindKey(anInd));
const TopTools_ListOfShape& anEdgList = aMapEF.FindFromIndex(anInd);
if (anEdgList.Extent() != 2)
continue;
TopTools_ListIteratorOfListOfShape anItF(anEdgList);
const TopoDS_Face aFace1 = TopoDS::Face(anItF.Value());
anItF.Next();
const TopoDS_Face aFace2 = TopoDS::Face(anItF.Value());
TopLoc_Location aLoc1, aLoc2;
const Handle(Poly_Triangulation)& aPT1 = BRep_Tool::Triangulation(aFace1, aLoc1);
const Handle(Poly_Triangulation)& aPT2 = BRep_Tool::Triangulation(aFace2, aLoc2);
if(aPT1.IsNull() || aPT2.IsNull())
continue;
if(!aPT1->HasNormals() || !aPT2->HasNormals())
continue;
const Handle(Poly_PolygonOnTriangulation)& aPTEF1 =
BRep_Tool::PolygonOnTriangulation(anEdg, aPT1, aLoc1);
const Handle(Poly_PolygonOnTriangulation)& aPTEF2 =
BRep_Tool::PolygonOnTriangulation(anEdg, aPT2, aLoc2);
TShort_Array1OfShortReal& aNormArr1 = aPT1->ChangeNormals();
TShort_Array1OfShortReal& aNormArr2 = aPT2->ChangeNormals();
for(Standard_Integer anEdgNode = aPTEF1->Nodes().Lower();
anEdgNode <= aPTEF1->Nodes().Upper(); anEdgNode++)
{
//Number of node
const Standard_Integer aFNodF1 = aPTEF1->Nodes().Value(anEdgNode);
const Standard_Integer aFNodF2 = aPTEF2->Nodes().Value(anEdgNode);
const Standard_Integer aFNorm1FirstIndex = aNormArr1.Lower() + 3*
(aFNodF1 - aPT1->Nodes().Lower());
const Standard_Integer aFNorm2FirstIndex = aNormArr2.Lower() + 3*
(aFNodF2 - aPT2->Nodes().Lower());
gp_XYZ aNorm1(aNormArr1.Value(aFNorm1FirstIndex),
aNormArr1.Value(aFNorm1FirstIndex+1),
aNormArr1.Value(aFNorm1FirstIndex+2));
gp_XYZ aNorm2(aNormArr2.Value(aFNorm2FirstIndex),
aNormArr2.Value(aFNorm2FirstIndex+1),
aNormArr2.Value(aFNorm2FirstIndex+2));
const Standard_Real aDot = aNorm1 * aNorm2;
if(aDot > aThresDot)
{
gp_XYZ aNewNorm = (aNorm1 + aNorm2).Normalized();
aNormArr1.ChangeValue(aFNorm1FirstIndex) =
aNormArr2.ChangeValue(aFNorm2FirstIndex) =
static_cast<Standard_ShortReal>(aNewNorm.X());
aNormArr1.ChangeValue(aFNorm1FirstIndex+1) =
aNormArr2.ChangeValue(aFNorm2FirstIndex+1) =
static_cast<Standard_ShortReal>(aNewNorm.Y());
aNormArr1.ChangeValue(aFNorm1FirstIndex+2) =
aNormArr2.ChangeValue(aFNorm2FirstIndex+2) =
static_cast<Standard_ShortReal>(aNewNorm.Z());
aRetVal = Standard_True;
}
}
}
return aRetVal;
}
//=======================================================================
//function : SortFaces
//purpose :

View File

@@ -104,6 +104,59 @@ void BRepMesh_CircleTool::Bind(const Standard_Integer theIndex,
bind(theIndex, aCoord, aRadius);
}
//=======================================================================
//function : MakeCircle
//purpose :
//=======================================================================
Standard_Boolean BRepMesh_CircleTool::MakeCircle(const gp_XY& thePoint1,
const gp_XY& thePoint2,
const gp_XY& thePoint3,
gp_XY& theLocation,
Standard_Real& theRadius)
{
static const Standard_Real aPrecision = Precision::PConfusion();
static const Standard_Real aSqPrecision = aPrecision * aPrecision;
if ((thePoint1 - thePoint3).SquareModulus() < aSqPrecision)
return Standard_False;
gp_XY aLink1(thePoint2 - thePoint1);
if (aLink1.SquareModulus() < aSqPrecision)
return Standard_False;
gp_XY aLink2(thePoint3 - thePoint2);
if (aLink2.SquareModulus() < aSqPrecision)
return Standard_False;
gp_XY aMidPnt1 = (thePoint1 + thePoint2) / 2.;
gp_XY aNorm1 = gp_XY(aLink1.Y(), -aLink1.X());
aNorm1.Add(aMidPnt1);
if (aLink2.SquareModulus() < aSqPrecision)
return Standard_False;
gp_XY aMidPnt2 = (thePoint2 + thePoint3) / 2.;
gp_XY aNorm2 = gp_XY(aLink2.Y(), -aLink2.X());
aNorm2.Add(aMidPnt2);
gp_XY aIntPnt;
Standard_Real aParam[2];
BRepMesh_GeomTool::IntFlag aIntFlag =
BRepMesh_GeomTool::IntLinLin(aMidPnt1, aNorm1,
aMidPnt2, aNorm2, aIntPnt, aParam);
if (aIntFlag != BRepMesh_GeomTool::Cross)
return Standard_False;
theLocation = aIntPnt;
theRadius = Sqrt(Max(Max((thePoint1 - aIntPnt).SquareModulus(),
(thePoint2 - aIntPnt).SquareModulus()),
(thePoint3 - aIntPnt).SquareModulus())) + aPrecision;
return Standard_True;
}
//=======================================================================
//function : Bind
//purpose :
@@ -113,39 +166,12 @@ Standard_Boolean BRepMesh_CircleTool::Bind(const Standard_Integer theIndex,
const gp_XY& thePoint2,
const gp_XY& thePoint3)
{
const Standard_Real aPrecision = Precision::PConfusion();
const Standard_Real aSqPrecision = aPrecision * aPrecision;
const gp_XY aPoints[3] = { thePoint1, thePoint2, thePoint3 };
gp_XY aNorm[3];
gp_XY aMidPnt[3];
for (Standard_Integer i = 0; i < 3; ++i)
{
const gp_XY& aPnt1 = aPoints[i];
const gp_XY& aPnt2 = aPoints[(i + 1) % 3];
aMidPnt[i] = (aPnt1 + aPnt2) / 2.;
gp_XY aLink(aPnt2 - aPnt1);
if (aLink.SquareModulus() < aSqPrecision)
return Standard_False;
aNorm[i] = gp_XY(aLink.Y(), -aLink.X());
aNorm[i].Add(aMidPnt[i]);
}
gp_XY aIntPnt;
Standard_Real aParam[2];
BRepMesh_GeomTool::IntFlag aIntFlag =
BRepMesh_GeomTool::IntLinLin(aMidPnt[0], aNorm[0],
aMidPnt[1], aNorm[1], aIntPnt, aParam);
if (aIntFlag != BRepMesh_GeomTool::Cross)
gp_XY aLocation;
Standard_Real aRadius;
if (!MakeCircle(thePoint1, thePoint2, thePoint3, aLocation, aRadius))
return Standard_False;
Standard_Real aRadius = (aPoints[0] - aIntPnt).Modulus();
bind(theIndex, aIntPnt, aRadius);
bind(theIndex, aLocation, aRadius);
return Standard_True;
}

View File

@@ -87,6 +87,20 @@ public:
Standard_EXPORT void Bind(const Standard_Integer theIndex,
const gp_Circ2d& theCircle);
//! Computes circle on three points.
//! @param thePoint1 first point.
//! @param thePoint2 second point.
//! @param thePoint3 third point.
//! @param[out] theLocation center of computed circle.
//! @param[out] theRadius radius of computed circle.
//! @return FALSE in case of impossibility to build a circle
//! on the given points, TRUE elsewhere.
Standard_EXPORT static Standard_Boolean MakeCircle(const gp_XY& thePoint1,
const gp_XY& thePoint2,
const gp_XY& thePoint3,
gp_XY& theLocation,
Standard_Real& theRadius);
//! Computes circle on three points and bind it to the tool.
//! @param theIndex index a circle should be bound with.
//! @param thePoint1 first point.

View File

@@ -42,6 +42,8 @@
#include <TopTools_SequenceOfShape.hxx>
#include <Precision.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <NCollection_Vector.hxx>
#include <BRepBuilderAPI_FastSewing.hxx>
#ifdef _WIN32
//#define strcasecmp strcmp Already defined
@@ -404,6 +406,66 @@ static Standard_Integer sewing (Draw_Interpretor& theDi,
return 0;
}
//=======================================================================
//function : fastsewing
//purpose :
//=======================================================================
Standard_Integer fastsewing (Draw_Interpretor& theDI,
Standard_Integer theNArg,
const char** theArgVal)
{
if(theNArg < 3)
{
// 0 1 2 3 4
theDI << "Use: fastsewing result [-tol <value>] <list_of_faces>\n";
return 1;
}
BRepBuilderAPI_FastSewing aFS;
Standard_Integer aStartIndex = 2;
if(!strcmp(theArgVal[aStartIndex], "-tol"))
{
aFS.SetTolerance(Draw::Atof (theArgVal[aStartIndex+1]));
aStartIndex = 4;
}
for(Standard_Integer i = aStartIndex; i < theNArg; i++)
{
TopoDS_Shape aS = DBRep::Get(theArgVal[i]);
if(!aFS.Add(aS))
{
theDI << "Face is not added. See statuses.\n";
}
}
BRepBuilderAPI_FastSewing::FS_VARStatuses aStatus = aFS.GetStatuses();
if(aStatus)
{
theDI << "Error: There are some problems while adding (" <<
(static_cast<Standard_Integer>(aStatus)) << ")\n";
aFS.GetStatuses(&cout);
}
aFS.Perform();
aStatus = aFS.GetStatuses();
if(aStatus)
{
theDI << "Error: There are some problems while performing (" <<
(static_cast<Standard_Integer>(aStatus)) << ")\n";
aFS.GetStatuses(&cout);
}
DBRep::Set(theArgVal[1], aFS.GetResult());
return 0;
}
//=======================================================================
// continuity
//=======================================================================
@@ -508,5 +570,8 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
theCommands.Add("encoderegularity",
"encoderegularity shape [tolerance (in degree)]",
__FILE__,encoderegularity, g);
theCommands.Add ("fastsewing", "fastsewing result [-tol <value>] <list_of_faces>",
__FILE__, fastsewing, g);
}

View File

@@ -32,6 +32,7 @@
#include <gp_Trsf.hxx>
#include <gp_Trsf2d.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_Curve.hxx>
@@ -64,6 +65,8 @@
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopoDS.hxx>
@@ -390,6 +393,25 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRWire ::TransferEdge (const TopoDS_Edge&
}
else Curve2d = Handle(Geom2d_Curve)::DownCast(Curve2d->Copy());
//shift pcurves on periodic BSpline surfaces (issue 26138)
if (Surf->IsKind(STANDARD_TYPE(Geom_BSplineSurface))) {
Handle(Geom_BSplineSurface) aBSpline = Handle(Geom_BSplineSurface)::DownCast(Surf);
Standard_Real uShift = 0., vShift = 0.;
Standard_Real U0, U1, V0, V1;
Surf->Bounds(U0, U1, V0, V1);
if (aBSpline->IsUPeriodic() && Abs(Ufirst - U0) > Precision::PConfusion()) {
uShift = ShapeAnalysis::AdjustToPeriod(Ufirst, U0, U1);
}
if (aBSpline->IsVPeriodic() && Abs(Vfirst - V0) > Precision::PConfusion()) {
vShift = ShapeAnalysis::AdjustToPeriod(Vfirst, V0, V1);
}
if (Abs(uShift) > Precision::PConfusion() || Abs(vShift) > Precision::PConfusion()) {
gp_Trsf2d TR;
TR.SetTranslation(gp_Pnt2d(0.,0.),gp_Pnt2d(uShift,vShift));
Curve2d = Handle(Geom2d_Curve)::DownCast(Curve2d->Transformed(TR));
}
}
if (!analyticMode&&((Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) ||
(Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) ||
(Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))))) {

View File

@@ -544,7 +544,6 @@ Standard_Boolean BRepTools_Modifier::Rebuild
// Set flag of the shape.
result.Orientation(ResOr);
result.Free (S.Free());
result.Modified (S.Modified());
result.Checked (S.Checked());
result.Orientable(S.Orientable());

View File

@@ -16,6 +16,8 @@
#include <Extrema_ExtPS.hxx>
#include <Extrema_ExtPC.hxx>
static const Standard_Real CosRef3D = 0.88;
static void RecadreIfPeriodic(Standard_Real& NewU,
Standard_Real& NewV,
const Standard_Real OldU,
@@ -92,6 +94,7 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Standard_Real Bound)
{
Standard_Real Cosi = 0., Cosi2 = 0.;
Standard_Real stepw = pasmax;
Standard_Integer nbp = line->NbPoints();
@@ -105,6 +108,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
stepw = Max(stepw,100.*tolgui);
}
Standard_Real parprec = param;
gp_Vec TgOnGuide, PrevTgOnGuide;
gp_Pnt PtOnGuide;
hguide->D1(parprec, PtOnGuide, TgOnGuide);
PrevTgOnGuide = TgOnGuide;
if (sens*(parprec - Bound) >= -tolgui) {
return;
@@ -145,6 +152,37 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
sectioncalculee = 0;
nbcomputedsection++;
#endif
hguide->D1(param, PtOnGuide, TgOnGuide);
//Check deflection on guide
Cosi = PrevTgOnGuide * TgOnGuide;
if (Cosi < gp::Resolution()) //angle>=pi/2 or null magnitude
Cosi2 = 0.;
else
Cosi2 = Cosi * Cosi / PrevTgOnGuide.SquareMagnitude() / TgOnGuide.SquareMagnitude();
if (Cosi2 < CosRef3D) //angle 3d too great
{
State = Blend_StepTooLarge;
stepw = stepw/2.;
param = parprec + sens*stepw; // on ne risque pas de depasser Bound.
if (Abs(stepw) < tolgui) {
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
}
Arrive = Standard_True;
}
continue;
}
PrevTgOnGuide = TgOnGuide;
//////////////////////////
Standard_Boolean bonpoint = 1;
Func.Set(param);
rsnld.Perform(Func,parinit,infbound,supbound);

406
src/Draw/Draw_View.cxx Normal file
View File

@@ -0,0 +1,406 @@
#include <Draw_View.hxx>
#include <Draw_Viewer.hxx>
#include <gp_Trsf.hxx>
//=======================================================================
//function : Draw_View
//purpose : Constructor
//=======================================================================
Draw_View::Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
Standard_Integer theX,
Standard_Integer theY,
Standard_Integer theWidth,
Standard_Integer theHeight)
: Draw_Window("Win", theX, theY, theWidth, theHeight),
myId (theId),
myViewer (theViewer),
myIsPers (Standard_False),
myIs2D (Standard_False),
myFocalDistance(0.0),
myZoom (0.0),
myDx (0),
myDy (0),
myFrameX0 (0),
myFrameY0 (0),
myFrameX1 (0),
myFrameY1 (0)
{
}
//=======================================================================
//function : Draw_View
//purpose : Constructor
//=======================================================================
#if defined(_WIN32) || defined(__WIN32__)
Draw_View::Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
Standard_Integer theX,
Standard_Integer theY,
Standard_Integer theWidth,
Standard_Integer theHeight,
HWND theWindow)
: Draw_Window("Win", theX, theY, theWidth, theHeight, theWindow),
myId (theId),
myViewer (theViewer),
myIsPers (Standard_False),
myIs2D (Standard_False),
myFocalDistance(0.0),
myZoom (0.0),
myDx (0),
myDy (0),
myFrameX0 (0),
myFrameY0 (0),
myFrameX1 (0),
myFrameY1 (0)
{
}
//=======================================================================
//function : Draw_View
//purpose : Constructor
//=======================================================================
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
Draw_View::Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
Standard_Integer theX,
Standard_Integer theY,
Standard_Integer theWidth,
Standard_Integer theHeight,
NSWindow* theWindow)
: Draw_Window(theWindow, "Win", theX, theY, theWidth, theHeight),
myId (theId),
myViewer (theViewer),
myIsPers (Standard_False),
myIs2D (Standard_False),
myFocalDistance(0.0),
myZoom (0.0),
myDx (0),
myDy (0),
myFrameX0 (0),
myFrameY0 (0),
myFrameX1 (0),
myFrameY1 (0)
{
}
#endif
//=======================================================================
//function : Draw_View
//purpose : Constructor
//=======================================================================
#if defined(_WIN32) || defined (__WIN32__) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX))
Draw_View::Draw_View(Standard_Integer /*theId*/,
Draw_Viewer* /*theViewer*/,
const char* /*theTitle*/)
: Draw_Window (),
myId (-1),
myViewer (NULL),
#else
Draw_View::Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
const char* theTitle)
: Draw_Window (theTitle),
myId (theId),
myViewer (theViewer),
#endif
myIsPers (Standard_False),
myIs2D (Standard_False),
myFocalDistance(0.0),
myZoom (0.0),
myDx (0),
myDy (0),
myFrameX0 (0),
myFrameY0 (0),
myFrameX1 (0),
myFrameY1 (0)
{
}
//=======================================================================
//function : ~Draw_View
//purpose : Destructor
//=======================================================================
Draw_View::~Draw_View()
{
Draw_Window::Destroy();
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
Standard_Boolean Draw_View::Init(const char* theType)
{
{ // default fields
myFocalDistance = 500.;
myIsPers = Standard_False;
myIs2D = strcmp("-2D-", theType) ? Standard_False : Standard_True;
myZoom = 1;
ResetFrame();
}
gp_Trsf aRotation;
gp_Pnt Pvise(0.0, 0.0, 0.0);
if (!strcmp("+X+Y", theType) || myIs2D)
{
myMatrix = aRotation;
}
else if (!strcmp("-Y+X", theType))
{
const gp_Dir aD(0., 0., 1.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), 0.5 * M_PI);
}
else if (!strcmp("-X-Y", theType))
{
const gp_Dir aD(0., 0., 1.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), M_PI);
}
else if (!strcmp("+Y-X", theType))
{
const gp_Dir aD(0., 0., 1.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), -0.5 * M_PI);
}
else if (!strcmp("+Y+X", theType))
{
const gp_Dir aD1(0., 0., 1.);
const gp_Dir aD2(0., 1., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("-X+Y", theType))
{
const gp_Dir aD(0., 1., 0.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), M_PI);
}
else if (!strcmp("-Y-X", theType))
{
const gp_Dir aD1(0., 0., 1.);
const gp_Dir aD2(1., 0., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("+X-Y", theType))
{
const gp_Dir aD(1., 0., 0.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), M_PI);
}
else if (!strcmp("+X+Z", theType))
{
const gp_Dir aD(1., 0., 0.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), -0.5 * M_PI);
}
else if (!strcmp("-Z+X", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 1., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), -0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("-X-Z", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 1., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), -M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("+Z-X", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 1., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), 0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("+Z+X", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 1., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), 0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), 0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("-X+Z", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 1., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), 0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("-Z-X", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 1., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), 0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), -0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("+X-Z", theType))
{
const gp_Dir aD(1., 0., 0.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), 0.5 * M_PI);
}
else if (!strcmp("+Y+Z", theType))
{
const gp_Dir aD1(0., 1., 0.);
const gp_Dir aD2(1., 0., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), -0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("-Z+Y", theType))
{
const gp_Dir aD(0., 1., 0.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), -0.5 * M_PI);
}
else if (!strcmp("-Y-Z", theType))
{
const gp_Dir aD1(0., 1., 0.);
const gp_Dir aD2(1., 0., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), 0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("+Z-Y", theType))
{
const gp_Dir aD1(0., 1., 0.);
const gp_Dir aD2(1., 0., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("+Z+Y", theType))
{
const gp_Dir aD(0., 1., 0.);
myMatrix.SetRotation(gp_Ax1(Pvise, aD), 0.5 * M_PI);
}
else if (!strcmp("-Y+Z", theType))
{
const gp_Dir aD1(0., 1., 0.);
const gp_Dir aD2(1., 0., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), 0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), -0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("-Z-Y", theType))
{
const gp_Dir aD1(0., 1., 0.);
const gp_Dir aD2(1., 0., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), 0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("+Y-Z", theType))
{
const gp_Dir aD1(0., 1., 0.);
const gp_Dir aD2(1., 0., 0.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), 0.5 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), 0.5 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("AXON", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 0., 1.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.25 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), -0.25 * M_PI);
myMatrix.Multiply(aRotation);
}
else if (!strcmp("PERS", theType))
{
const gp_Dir aD1(1., 0., 0.);
const gp_Dir aD2(0., 0., 1.);
myMatrix.SetRotation (gp_Ax1(Pvise, aD1), -0.25 * M_PI);
aRotation.SetRotation(gp_Ax1(Pvise, aD2), -0.25 * M_PI);
myMatrix.Multiply(aRotation);
myIsPers = Standard_True;
}
else
{
return Standard_False;
}
strcpy(myType, theType);
return Standard_True;
}
//=======================================================================
//function : Transform
//purpose :
//=======================================================================
void Draw_View::Transform(const gp_Trsf& theTransformation)
{
myMatrix.Multiply(theTransformation);
}
//=======================================================================
//function : ResetFrame
//purpose :
//=======================================================================
void Draw_View::ResetFrame()
{
myFrameX0 = 0;
myFrameY0 = 0;
myFrameX1 = 0;
myFrameY1 = 0;
}
//=======================================================================
//function : GetFrame
//purpose :
//=======================================================================
void Draw_View::GetFrame(Standard_Integer& theX0,Standard_Integer& theY0,
Standard_Integer& theX1,Standard_Integer& theY1)
{
if ( myFrameX0 == myFrameX1 )
{
myViewer->GetFrame(myId, theX0, theY0, theX1, theY1);
myFrameX0 = theX0;
myFrameX1 = theX1;
myFrameY0 = theY0;
myFrameY1 = theY1;
}
else
{
theX0 = myFrameX0;
theX1 = myFrameX1;
theY0 = myFrameY0;
theY1 = myFrameY1;
}
}
//=======================================================================
//function : WExpose
//purpose :
//=======================================================================
void Draw_View::WExpose()
{
ResetFrame();
myViewer->RepaintView(myId);
}

165
src/Draw/Draw_View.hxx Normal file
View File

@@ -0,0 +1,165 @@
#ifndef Draw_View_Header
#define Draw_View_Header
#include <gp_Trsf.hxx>
#include <Draw_Window.hxx>
class Draw_Viewer;
class Draw_View : public Draw_Window
{
public:
//! Constructor
Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
Standard_Integer theX,
Standard_Integer theY,
Standard_Integer theWidth,
Standard_Integer theHeight);
#if defined(_WIN32) || defined(__WIN32__)
Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
Standard_Integer theX,
Standard_Integer theY,
Standard_Integer theWidth,
Standard_Integer theHeight,
HWND theWindow);
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
Standard_Integer theX,
Standard_Integer theY,
Standard_Integer theWidth,
Standard_Integer theHeight,
NSWindow* theWindow);
#endif
//! Constructor.
Draw_View(Standard_Integer theId,
Draw_Viewer* theViewer,
const char* theTitle);
//! Destructor.
~Draw_View();
public: // @name getters and setters
//! Sets horizontal offset.
void SetDx(const Standard_Integer theDx)
{
myDx = theDx;
}
//! Sets vertical offset.
void SetDy(const Standard_Integer theDy)
{
myDy = theDy;
}
//! Sets parameter of zoom.
void SetZoom(const Standard_Real theZoom)
{
myZoom = theZoom;
}
//! Sets view matrix.
void SetMatrix(const gp_Trsf& theMatrix)
{
myMatrix = theMatrix;
}
//! Sets focal distance.
void SetFocalDistance(const Standard_Real theDistance)
{
myFocalDistance = theDistance;
}
//! Gets horizontal offset.
const Standard_Integer GetDx() const
{
return myDx;
}
//! Gets vertical offset.
const Standard_Integer GetDy() const
{
return myDy;
}
//! Gets parameter of zoom.
const Standard_Real GetZoom() const
{
return myZoom;
}
//! Gets matrix of view.
const gp_Trsf& GetMatrix() const
{
return myMatrix;
}
//! Gets focal distance.
const Standard_Real GetFocalDistance() const
{
return myFocalDistance;
}
public: //! @name public inline methods
//! Returns type of view.
const char* Type()
{
return myType;
}
//! Returns true value if current view in 2D mode.
const Standard_Boolean Is2D() const
{
return myIs2D;
}
//! Returns true value if current view in perspective mode.
const Standard_Real IsPerspective() const
{
return myIsPers;
}
public: //! @name view API
//! Initialize view by the type.
Standard_Boolean Init(const char* theType);
//! Transformates view matrix.
void Transform(const gp_Trsf& theTransformation);
//! Resets frame of current view.
void ResetFrame();
//! Returns parameters of frame corners.
void GetFrame(Standard_Integer& theX0,Standard_Integer& theY0,
Standard_Integer& theX1,Standard_Integer& theY1);
//! Perform window exposing.
void WExpose();
protected:
Standard_Integer myId;
Draw_Viewer* myViewer;
char myType[5];
Standard_Boolean myIsPers;
Standard_Boolean myIs2D;
Standard_Real myFocalDistance;
Standard_Real myZoom;
gp_Trsf myMatrix;
Standard_Integer myDx;
Standard_Integer myDy;
Standard_Integer myFrameX0;
Standard_Integer myFrameY0;
Standard_Integer myFrameX1;
Standard_Integer myFrameY1;
};
#endif

View File

@@ -20,6 +20,7 @@
// see : SaveView(filename)
#include <Draw_Viewer.hxx>
#include <Draw_View.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
@@ -58,319 +59,6 @@ static Standard_Real ps_gray[MAXCOLOR];
enum DrawingMode {DRAW, PICK, POSTSCRIPT};
static DrawingMode CurrentMode = DRAW;
/* local window class */
//=======================================================================
// class View
//=======================================================================
class Draw_View : public Draw_Window {
public :
Draw_View(Standard_Integer i,
Draw_Viewer* v,
Standard_Integer X,
Standard_Integer Y,
Standard_Integer W,
Standard_Integer H);
#if defined(_WIN32) || defined(__WIN32__)
Draw_View(Standard_Integer i,
Draw_Viewer* v,
Standard_Integer X,
Standard_Integer Y,
Standard_Integer W,
Standard_Integer H,
HWND win);
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
Draw_View(Standard_Integer i,
Draw_Viewer* v,
Standard_Integer X,
Standard_Integer Y,
Standard_Integer W,
Standard_Integer H,
NSWindow* theWindow);
#endif
Draw_View(Standard_Integer i,
Draw_Viewer* v,
const char *w);
void WExpose();
Standard_Boolean Init(const char* typ);
~Draw_View() {Destroy();}
void ResetFrame() { Framex0=Framey0=Framex1=Framey1=0; }
void GetFrame(Standard_Integer& x0,Standard_Integer& y0,
Standard_Integer& x1,Standard_Integer& y1) {
if(Framex0==Framex1) {
viewer->GetFrame(id,x0,y0,x1,y1);
Framex0=x0; Framex1=x1; Framey0=y0; Framey1=y1;
}
else {
x0=Framex0; x1=Framex1;
y0=Framey0; y1=Framey1;
}
}
Standard_Integer id;
Draw_Viewer* viewer;
char type[5];
Standard_Integer FlagPers;
Standard_Integer Flag2d;
Standard_Real FocalDist;
Standard_Real Zoom;
gp_Trsf Matrix;
Standard_Integer dX;
Standard_Integer dY;
Standard_Integer lastX;
Standard_Integer lastY;
Standard_Integer Framex0,Framey0,Framex1,Framey1;
};
//=======================================================================
//function : Draw_View
//purpose :
//=======================================================================
Draw_View::Draw_View(Standard_Integer i, Draw_Viewer* v,
Standard_Integer X,
Standard_Integer Y,
Standard_Integer W,
Standard_Integer H) :
Draw_Window("Win", X, Y, W, H),
id(i),
viewer(v),
FlagPers(0),
Flag2d(0),
FocalDist(0.),
Zoom(0.),
dX(0),dY(0),
lastX(0),lastY(0)
{
Framex0=Framey0=Framex1=Framey1=0;
}
#if defined(_WIN32) || defined(__WIN32__)
//=======================================================================
//function : Draw_View
//purpose :
//=======================================================================
Draw_View::Draw_View(Standard_Integer i, Draw_Viewer* v,
Standard_Integer X,
Standard_Integer Y,
Standard_Integer W,
Standard_Integer H,
HWND theWin) :
Draw_Window("Win", X, Y, W, H, theWin), id(i), viewer(v)
{
Framex0=Framey0=Framex1=Framey1=0;
}
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
Draw_View::Draw_View(Standard_Integer i, Draw_Viewer* v,
Standard_Integer X,
Standard_Integer Y,
Standard_Integer W,
Standard_Integer H,
NSWindow* theWindow) :
Draw_Window(theWindow, "Win", X, Y, W, H), id(i), viewer(v),
FlagPers(0),
Flag2d(0),
FocalDist(0.),
Zoom(0.),
dX(0),dY(0),
lastX(0),lastY(0),
Framex0(0),Framey0(0),
Framex1(0),Framey1(0)
{
}
#endif
//=======================================================================
//function : Draw_View
//purpose :
//=======================================================================
#if defined(_WIN32) || defined (__WIN32__) || (defined(__APPLE__) && !defined(MACOSX_USE_GLX))
Draw_View::Draw_View(Standard_Integer /*i*/, Draw_Viewer* /*v*/, const char* /*w*/) : viewer( NULL )
#else
Draw_View::Draw_View(Standard_Integer i, Draw_Viewer* v, const char* w) :
Draw_Window(w), id(i), viewer(v)
#endif
{
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
Standard_Boolean Draw_View::Init (const char* typ)
{
// default fields
Framex0=Framey0=Framex1=Framey1=0;
FocalDist = 500.;
FlagPers = 0;
Flag2d = !strcmp("-2D-",typ);
Zoom = 1;
gp_Trsf T;
gp_Pnt Pvise(0,0,0);
if (!strcmp("+X+Y",typ) || Flag2d)
{
Matrix = T;
}
else if (!strcmp("-Y+X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,0,1)),M_PI/2);
}
else if (!strcmp("-X-Y",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,0,1)),M_PI);
}
else if (!strcmp("+Y-X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,0,1)),-M_PI/2);
}
else if (!strcmp("+Y+X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,0,1)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI);
Matrix.Multiply(T);
}
else if (!strcmp("-X+Y",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI);
}
else if (!strcmp("-Y-X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,0,1)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI);
Matrix.Multiply(T);
}
else if (!strcmp("+X-Y",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI);
}
else if (!strcmp("+X+Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/2);
}
else if (!strcmp("-Z+X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),-M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("-X-Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),-M_PI);
Matrix.Multiply(T);
}
else if (!strcmp("+Z-X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("+Z+X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("-X+Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI);
Matrix.Multiply(T);
}
else if (!strcmp("-Z-X",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),-M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("+X-Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI/2);
}
else if (!strcmp("+Y+Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("-Z+Y",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),-M_PI/2);
}
else if (!strcmp("-Y-Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("+Z-Y",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),-M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI);
Matrix.Multiply(T);
}
else if (!strcmp("+Z+Y",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI/2);
}
else if (!strcmp("-Y+Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("-Z-Y",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI);
Matrix.Multiply(T);
}
else if (!strcmp("+Y-Z",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(0,1,0)),M_PI/2);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),M_PI/2);
Matrix.Multiply(T);
}
else if (!strcmp("AXON",typ))
{
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/4);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,0,1)),-M_PI/4);
Matrix.Multiply(T);
}
else if (!strcmp("PERS",typ))
{
FlagPers =1;
Matrix.SetRotation(gp_Ax1(Pvise,gp_Dir(1,0,0)),-M_PI/4);
T.SetRotation(gp_Ax1(Pvise,gp_Dir(0,0,1)),-M_PI/4);
Matrix.Multiply(T);
}
else {
return Standard_False;
}
strcpy(type,typ);
return Standard_True;
}
//=======================================================================
//function : WExpose
//purpose :
//=======================================================================
void Draw_View::WExpose()
{
Framex0=Framey0=Framex1=Framey1=0;
viewer->RepaintView(id);
}
//=======================================================================
//function : Create
//purpose :
@@ -416,8 +104,8 @@ void Draw_Viewer::MakeView(const Standard_Integer id,
myViews[id] = new Draw_View(id,this,X , Y, W, H);
// View fields
myViews[id]->dX = W / 2;
myViews[id]->dY = - H / 2;
myViews[id]->SetDx(W / 2);
myViews[id]->SetDy(- H / 2);
if (!myViews[id]->Init(typ))
DeleteView(id);
@@ -446,8 +134,8 @@ void Draw_Viewer::MakeView(const Standard_Integer id,
myViews[id]->SetUseBuffer(useBuffer);
// View fields
myViews[id]->dX = W / 2;
myViews[id]->dY = - H / 2;
myViews[id]->SetDx( W / 2);
myViews[id]->SetDy(-H / 2);
if (!myViews[id]->Init(typ))
DeleteView(id);
@@ -472,8 +160,8 @@ void Draw_Viewer::MakeView (const Standard_Integer id,
myViews[id] = new Draw_View(id,this,window);
myViews[id]->dX = myViews[id]->WidthWin() / 2;
myViews[id]->dY = - myViews[id]->HeightWin() / 2;
myViews[id]->SetDx(myViews[id]->WidthWin() / 2);
myViews[id]->SetDy(-myViews[id]->HeightWin() / 2);
if (!myViews[id]->Init(typ))
DeleteView(id);
@@ -503,7 +191,7 @@ void Draw_Viewer::ResetView(const Standard_Integer id)
{
if (Draw_Batch) return;
if (myViews[id]) {
myViews[id]->Init(myViews[id]->type);
myViews[id]->Init(myViews[id]->Type());
ConfigView(id);
}
}
@@ -515,16 +203,27 @@ void Draw_Viewer::ResetView(const Standard_Integer id)
void Draw_Viewer::SetZoom (const Standard_Integer id, const Standard_Real z)
{
if (Draw_Batch) return;
if (myViews[id]) {
Standard_Real zz = z / myViews[id]->Zoom;
myViews[id]->Zoom = z;
if (Draw_Batch)
return;
Draw_View* aView = myViews[id];
if (aView)
{
Standard_Real zz = z / aView->GetZoom();
aView->SetZoom(z);
Standard_Integer X,Y,W,H;
GetPosSize(id,X,Y,W,H);
Standard_Real w = W;
myViews[id]->dX = (Standard_Integer )( w / 2 - zz * (w/2 - myViews[id]->dX));
Standard_Real h = H;
myViews[id]->dY = (Standard_Integer )( - h / 2 + zz * (h/2 + myViews[id]->dY));
const Standard_Real w = 0.5 * static_cast<Standard_Real>(W);
const Standard_Real h = 0.5 * static_cast<Standard_Real>(H);
const Standard_Integer aDx = static_cast<Standard_Integer>
( w - zz * (w - aView->GetDx()) );
const Standard_Integer aDy = static_cast<Standard_Integer>
( -h + zz * (h + aView->GetDy()) );
aView->SetDx(aDx);
aView->SetDy(aDy);
}
}
@@ -539,7 +238,7 @@ void Draw_Viewer::RotateView (const Standard_Integer id,
{
if (Draw_Batch) return;
if (myViews[id]) {
gp_Trsf T = myViews[id]->Matrix;
gp_Trsf T = myViews[id]->GetMatrix();
T.Invert();
gp_Pnt PP(0,0,0);
@@ -564,7 +263,7 @@ void Draw_Viewer::RotateView (const Standard_Integer id,
if (myViews[id]) {
gp_Trsf T;
T.SetRotation(gp_Ax1(P,D),A);
myViews[id]->Matrix.Multiply(T);
myViews[id]->Transform(T);
}
}
@@ -578,7 +277,7 @@ void Draw_Viewer::SetFocal (const Standard_Integer id, const Standard_Real F)
{
if (Draw_Batch) return;
if (myViews[id])
myViews[id]->FocalDist = F;
myViews[id]->SetFocalDistance(F);
}
//=======================================================================
@@ -590,7 +289,7 @@ char* Draw_Viewer::GetType (const Standard_Integer id) const
{
if (Draw_Batch) return blank;
if (myViews[id])
return myViews[id]->type;
return const_cast<char*>(myViews[id]->Type());
else
return blank;
}
@@ -604,9 +303,9 @@ Standard_Real Draw_Viewer::Zoom (const Standard_Integer id) const
{
if (Draw_Batch) return Standard_False;
if (myViews[id])
return myViews[id]->Zoom;
return myViews[id]->GetZoom();
else
return 0;
return 0.0;
}
//=======================================================================
@@ -618,7 +317,7 @@ Standard_Real Draw_Viewer::Focal (const Standard_Integer id) const
{
if (Draw_Batch) return 1.;
if (myViews[id])
return myViews[id]->FocalDist;
return myViews[id]->GetFocalDistance();
else
return 0;
}
@@ -632,7 +331,7 @@ void Draw_Viewer::GetTrsf (const Standard_Integer id,gp_Trsf& T) const
{
if (Draw_Batch) return;
if (myViews[id])
T = myViews[id]->Matrix;
T = myViews[id]->GetMatrix();
}
//=======================================================================
@@ -644,7 +343,7 @@ Standard_Boolean Draw_Viewer::Is3D (const Standard_Integer id) const
{
if (Draw_Batch) return Standard_False;
if (myViews[id])
return !myViews[id]->Flag2d;
return !myViews[id]->Is2D();
else
return Standard_False;
}
@@ -658,7 +357,7 @@ void Draw_Viewer::SetTrsf (const Standard_Integer id,gp_Trsf& T)
{
if (Draw_Batch) return;
if (myViews[id])
myViews[id]->Matrix = T;
myViews[id]->SetMatrix(T);
}
//=======================================================================
@@ -691,10 +390,10 @@ void Draw_Viewer::GetFrame(const Standard_Integer id,
if (myViews[id]) {
Standard_Integer X,Y,H,W;
GetPosSize(id,X,Y,W,H);
xminf = - myViews[id]->dX;
xmaxf = W - myViews[id]->dX;
yminf = - myViews[id]->dY - H;
ymaxf = - myViews[id]->dY;
xminf = - myViews[id]->GetDx();
xmaxf = W - myViews[id]->GetDx();
yminf = - myViews[id]->GetDy() - H;
ymaxf = - myViews[id]->GetDy();
}
}
@@ -709,11 +408,12 @@ void Draw_Viewer::FitView(const Standard_Integer id, const Standard_Integer fram
if (myViews[id]) {
// is this the only view in its category
Standard_Integer is2d = myViews[id]->Flag2d;
Standard_Boolean is2d = myViews[id]->Is2D();
Standard_Integer i,nbviews = 0;
for (i = 1; i < MAXVIEW; i++) {
if (myViews[i]) {
if (myViews[i]->Flag2d == is2d) nbviews++;
if (myViews[i]->Is2D() == is2d)
++nbviews;
}
}
Standard_Boolean only = (nbviews == 1);
@@ -744,10 +444,10 @@ void Draw_Viewer::FitView(const Standard_Integer id, const Standard_Integer fram
}
}
Standard_Real z;
umin = umin / curview->Zoom;
vmin = vmin / curview->Zoom;
umax = umax / curview->Zoom;
vmax = vmax / curview->Zoom;
umin = umin / curview->GetZoom();
vmin = vmin / curview->GetZoom();
umax = umax / curview->GetZoom();
vmax = vmax / curview->GetZoom();
if ((umax - umin) < 1.e-6) {
if ((vmax - vmin) < 1.e-6)
return;
@@ -761,9 +461,9 @@ void Draw_Viewer::FitView(const Standard_Integer id, const Standard_Integer fram
if (z2 < z) z = z2;
}
}
curview->Zoom = z;
curview->dX = (Standard_Integer )( W / 2 - ((umin+umax) / 2) * z);
curview->dY = (Standard_Integer )( - H / 2 - ((vmin+vmax) / 2) * z);
curview->SetZoom(z);
curview->SetDx( static_cast<Standard_Integer>( W / 2 - 0.5 * (umin+umax) * z) );
curview->SetDy( static_cast<Standard_Integer>(-H / 2 - 0.5 * (vmin+vmax) * z) );
}
}
@@ -777,8 +477,8 @@ void Draw_Viewer::PanView(const Standard_Integer id,
{
if (Draw_Batch) return;
if (myViews[id]) {
myViews[id]->dX += DX;
myViews[id]->dY += DY;
myViews[id]->SetDx(myViews[id]->GetDx() + DX);
myViews[id]->SetDy(myViews[id]->GetDy() + DY);
}
}
@@ -793,8 +493,8 @@ void Draw_Viewer::SetPan(const Standard_Integer id,
{
if (Draw_Batch) return;
if (myViews[id]) {
myViews[id]->dX = DX;
myViews[id]->dY = DY;
myViews[id]->SetDx(DX);
myViews[id]->SetDy(DY);
}
}
@@ -808,8 +508,8 @@ void Draw_Viewer::GetPan(const Standard_Integer id,
{
if (Draw_Batch) return;
if (myViews[id]) {
DX = myViews[id]->dX;
DY = myViews[id]->dY;
DX = myViews[id]->GetDx();
DY = myViews[id]->GetDy();
}
}
@@ -929,10 +629,10 @@ void Draw_Viewer::UpdateView (const Standard_Integer id, const Standard_Boolean
void Draw_Viewer::ConfigView (const Standard_Integer id) const
{
if (Draw_Batch) return;
if (myViews[id]) {
myViews[id]->dX = myViews[id]->WidthWin() / 2;
myViews[id]->dY = - myViews[id]->HeightWin() / 2;
if (myViews[id])
{
myViews[id]->SetDx(myViews[id]->WidthWin() / 2);
myViews[id]->SetDy(-myViews[id]->HeightWin() / 2);
}
}
@@ -965,7 +665,7 @@ void Draw_Viewer::PostScriptView (const Standard_Integer id,
if (n == 0) return;
CurrentMode = POSTSCRIPT;
Draw_Display DF = MakeDisplay(id);
Standard_Boolean view2d = myViews[id]->Flag2d;
Standard_Boolean view2d = myViews[id]->Is2D();
for (Standard_Integer i = 1; i <= n; i++)
if (myDrawables(i)->Is3D()) {
if (!view2d) myDrawables(i)->DrawOn(DF);
@@ -1035,7 +735,8 @@ void Draw_Viewer::Repaint2D () const
if (Draw_Batch) return;
for (Standard_Integer id = 0; id < MAXVIEW; id++)
if (myViews[id]) {
if (myViews[id]->Flag2d) RepaintView(id);
if (myViews[id]->Is2D())
RepaintView(id);
}
}
@@ -1049,7 +750,8 @@ void Draw_Viewer::Repaint3D () const
if (Draw_Batch) return;
for (Standard_Integer id = 0; id < MAXVIEW; id++)
if (myViews[id]) {
if (!myViews[id]->Flag2d) RepaintView(id);
if (!myViews[id]->Is2D())
RepaintView(id);
}
}
@@ -1101,8 +803,8 @@ void Draw_Viewer::Clear2D()
}
for (Standard_Integer id = 0; id < MAXVIEW; id++) {
if (myViews[id]) {
if (myViews[id]->Flag2d)
ClearView(id);
if (myViews[id]->Is2D())
ClearView(id);
}
}
}
@@ -1126,8 +828,8 @@ void Draw_Viewer::Clear3D()
}
for (Standard_Integer id = 0; id < MAXVIEW; id++) {
if (myViews[id]) {
if (!myViews[id]->Flag2d)
ClearView(id);
if (!myViews[id]->Is2D())
ClearView(id);
}
}
}
@@ -1157,14 +859,13 @@ void Draw_Viewer::DrawOnView(const Standard_Integer id,
xmin = ymin = DRAWINFINITE;
xmax = ymax = -DRAWINFINITE;
Standard_Boolean view2d = myViews[id]->Flag2d;
Standard_Boolean view2d = myViews[id]->Is2D();
myViews[id]->ResetFrame();
if ((D->Is3D() && !view2d) ||
(!D->Is3D() && view2d)) {
if ((D->Is3D() && !view2d) || (!D->Is3D() && view2d))
{
D->DrawOn(d);
if (CurrentMode == DRAW)
D->SetBounds(xmin,xmax,ymin,ymax);
D->SetBounds(xmin,xmax,ymin,ymax);
d.Flush();
}
}
@@ -1304,8 +1005,8 @@ void Draw_Viewer::Select (Standard_Integer& id, Standard_Integer& X, Standard_In
}
if (id != -1) {
X = X - myViews[id]->dX;
Y = -Y - myViews[id]->dY;
X = X - myViews[id]->GetDx();
Y = -Y - myViews[id]->GetDy();
}
if (!wait) myViews[id]->Wait(!wait);
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
@@ -1315,7 +1016,7 @@ void Draw_Viewer::Select (Standard_Integer& id, Standard_Integer& X, Standard_In
while (id >= MAXVIEW)
{
GetNextEvent(wait, aWindowNumber, X, Y, Button);
if (Y < 0)
{
continue; // mouse clicked on window title
@@ -1330,8 +1031,8 @@ void Draw_Viewer::Select (Standard_Integer& id, Standard_Integer& X, Standard_In
}
}
X = X - myViews[id]->dX;
Y = -Y - myViews[id]->dY;
X = X - myViews[id]->GetDx();
Y = -Y - myViews[id]->GetDy();
#else
HANDLE hWnd;
@@ -1347,8 +1048,8 @@ void Draw_Viewer::Select (Standard_Integer& id, Standard_Integer& X, Standard_In
for(int i=0 ; i<MAXVIEW ; i++)
if (myViews[i] && myViews[i]->win == hWnd ) id = i;
}
X = X - myViews[id]->dX;
Y = -Y - myViews[id]->dY;
X = X - myViews[id]->GetDx();
Y = -Y - myViews[id]->GetDy();
#endif
}
@@ -1367,12 +1068,13 @@ Standard_Integer Draw_Viewer::Pick(const Standard_Integer id,
return 0;
// is this the only view in its category
Standard_Integer is2d = myViews[id]->Flag2d;
Standard_Boolean is2d = myViews[id]->Is2D();
Standard_Integer i,nbviews = 0;
for (i = 0; i < MAXVIEW; i++) {
if (myViews[i]) {
if (myViews[i]->Flag2d == is2d) nbviews++;
}
for (i = 0; i < MAXVIEW; i++)
{
if (myViews[i])
if (myViews[i]->Is2D() == is2d)
++nbviews;
}
Standard_Boolean only = (nbviews == 1);
@@ -1526,7 +1228,7 @@ void Draw_Display::SetMode (const Standard_Integer M) const
Standard_Real Draw_Display::Zoom() const
{
if (Draw_Batch) return 1.;
return curview->Zoom;
return curview->GetZoom();
}
//=======================================================================
@@ -1554,7 +1256,7 @@ void Draw_Display::DrawString(const gp_Pnt2d& ppt,
if (ppt.X() > 1.e09 || ppt.X() < -1.e09 ) return;
if (ppt.Y() > 1.e09 || ppt.Y() < -1.e09 ) return;
gp_Pnt2d pt(ppt.X()*curview->Zoom,ppt.Y()*curview->Zoom);
gp_Pnt2d pt(ppt.X()*curview->GetZoom(),ppt.Y()*curview->GetZoom());
if (pt.X() > 1.e09 || pt.X() < -1.e09 ) return;
if (pt.Y() > 1.e09 || pt.Y() < -1.e09 ) return;
@@ -1563,8 +1265,8 @@ void Draw_Display::DrawString(const gp_Pnt2d& ppt,
case DRAW :
{
int X = (int) ( pt.X() + moveX + curview->dX);
int Y = (int) (-pt.Y() + moveY - curview->dY);
int X = (int) ( pt.X() + moveX + curview->GetDx());
int Y = (int) (-pt.Y() + moveY - curview->GetDy());
curview->DrawString(X,Y,(char *)S);
if (Draw_Bounds) {
if (pt.X() + moveX > xmax) xmax = pt.X();
@@ -1644,12 +1346,13 @@ void Draw_Display::Project(const gp_Pnt& p, gp_Pnt2d& p2d) const
{
if (Draw_Batch) return;
gp_Pnt pt = p;
pt.Transform(curview->Matrix);
pt.Transform(curview->GetMatrix());
Standard_Real xp,yp,zp;
pt.Coord(xp,yp,zp);
if (curview->FlagPers) {
xp = xp*curview->FocalDist/(curview->FocalDist-zp);
yp = yp*curview->FocalDist/(curview->FocalDist-zp);
if (curview->IsPerspective()) {
const Standard_Real aDistance = curview->GetFocalDistance();
xp = xp * aDistance / (aDistance-zp);
yp = yp * aDistance / (aDistance-zp);
}
p2d.SetCoord(xp,yp);
}
@@ -1663,9 +1366,9 @@ Draw_Display::Draw_Display ()
{
if (Draw_Batch) return;
if (curview) {
PtPers.SetCoord(0,0,0);
PtPers.Transform(curview->Matrix);
PtCur.SetCoord(PtPers.X()*curview->Zoom,PtPers.Y()*curview->Zoom);
PtPers.SetCoord(0., 0., 0.);
PtPers.Transform(curview->GetMatrix());
PtCur.SetCoord(PtPers.X()*curview->GetZoom(),PtPers.Y()*curview->GetZoom());
}
}
@@ -1677,7 +1380,8 @@ Draw_Display::Draw_Display ()
void Draw_Display::MoveTo (const gp_Pnt2d& pp)
{
if (Draw_Batch) return;
gp_Pnt2d pt(pp.X() * curview->Zoom, pp.Y() * curview->Zoom);
const Standard_Real aZoom = curview->GetZoom();
gp_Pnt2d pt(pp.X() * aZoom, pp.Y() * aZoom);
switch (CurrentMode) {
case DRAW :
@@ -1789,7 +1493,7 @@ void Draw_Display::DrawTo (const gp_Pnt2d& pp2)
if (pp2.X() > 1.e09 || pp2.X() < -1.e09 ) return;
if (pp2.Y() > 1.e09 || pp2.Y() < -1.e09 ) return;
gp_Pnt2d p2(pp2.X() * curview->Zoom, pp2.Y() * curview->Zoom);
gp_Pnt2d p2(pp2.X() * curview->GetZoom(), pp2.Y() * curview->GetZoom());
if (p2.X() > 1.e09 || p2.X() < -1.e09 ) return;
if (p2.Y() > 1.e09 || p2.Y() < -1.e09 ) return;
@@ -1820,20 +1524,19 @@ void Draw_Display::DrawTo (const gp_Pnt2d& pp2)
gp_Pnt2d PI1(p1);
gp_Pnt2d PI2(p2);
if(Trim(PI1,PI2,x0,y0,x1,y1)) {
segm[nbseg].Init((Standard_Integer )( PI1.X() + curview->dX),
(Standard_Integer )(-PI1.Y() - curview->dY),
(Standard_Integer )( PI2.X() + curview->dX),
(Standard_Integer )(-PI2.Y() - curview->dY));
nbseg++;
if(Trim(PI1,PI2,x0,y0,x1,y1))
{
segm[nbseg].Init(static_cast<Standard_Integer>( PI1.X() + curview->GetDx()),
static_cast<Standard_Integer>(-PI1.Y() - curview->GetDy()),
static_cast<Standard_Integer>( PI2.X() + curview->GetDx()),
static_cast<Standard_Integer>(-PI2.Y() - curview->GetDy()));
++nbseg;
}
#else
segm[nbseg].Init(( p1.X() + curview->dX),
(-p1.Y() - curview->dY),
( p2.X() + curview->dX),
(-p2.Y() - curview->dY));
segm[nbseg].Init(static_cast<Standard_Integer>( p1.X() + curview->GetDx()),
static_cast<Standard_Integer>(-p1.Y() - curview->GetDy()),
static_cast<Standard_Integer>( p2.X() + curview->GetDx()),
static_cast<Standard_Integer>(-p2.Y() - curview->GetDy()));
nbseg++;
#endif
if (nbseg == MAXSEGMENT) {
@@ -1959,14 +1662,17 @@ void Draw_Display::MoveTo (const gp_Pnt& pt)
else return;
}
PtPers = pt;
PtPers.Transform(curview->Matrix);
PtPers.Transform(curview->GetMatrix());
Standard_Real xp = PtPers.X();
Standard_Real yp = PtPers.Y();
if (curview->FlagPers) {
if (curview->IsPerspective())
{
Standard_Real ZPers = PtPers.Z();
if (ZPers < curview->FocalDist*precpers) {
xp=xp*curview->FocalDist/(curview->FocalDist-ZPers);
yp=yp*curview->FocalDist/(curview->FocalDist-ZPers);
const Standard_Real aDistance = curview->GetFocalDistance();
if (ZPers < aDistance * precpers)
{
xp=xp * aDistance / (aDistance-ZPers);
yp=yp * aDistance / (aDistance-ZPers);
}
}
MoveTo(gp_Pnt2d(xp,yp));
@@ -1982,35 +1688,41 @@ void Draw_Display::DrawTo (const gp_Pnt& pt)
if (Draw_Batch) return;
if ((CurrentMode == PICK) && found) return;
gp_Pnt pt2 = pt.Transformed(curview->Matrix);
gp_Pnt pt2 = pt.Transformed(curview->GetMatrix());
Standard_Real xp2 = pt2.X();
Standard_Real yp2 = pt2.Y();
if (curview->FlagPers) {
if (curview->IsPerspective())
{
const Standard_Real aZoom = curview->GetZoom();
const Standard_Real aDistance = curview->GetFocalDistance();
Standard_Real xp1 = PtPers.X();
Standard_Real yp1 = PtPers.Y();
Standard_Real zp1 = PtPers.Z();
Standard_Real zp2 = pt2.Z();
PtPers = pt2;
if ((zp1 >= curview->FocalDist*precpers) &&
(zp2 >= curview->FocalDist*precpers) ) {
if ((zp1 >= aDistance*precpers) && (zp2 >= aDistance*precpers) )
{
return; // segment is not visible in perspective (behind the eye)
}
else if (zp1 >= curview->FocalDist*precpers) {
xp1=xp1+(xp2-xp1)*(curview->FocalDist*precpers-zp1)/(zp2-zp1);
yp1=yp1+(yp2-yp1)*(curview->FocalDist*precpers-zp1)/(zp2-zp1);
zp1=curview->FocalDist*precpers;
xp1=xp1*curview->FocalDist/(curview->FocalDist-zp1);
yp1=yp1*curview->FocalDist/(curview->FocalDist-zp1);
MoveTo(gp_Pnt2d(xp1*curview->Zoom,yp1*curview->Zoom));
else if (zp1 >= aDistance*precpers)
{
xp1=xp1+(xp2-xp1)*(aDistance*precpers-zp1)/(zp2-zp1);
yp1=yp1+(yp2-yp1)*(aDistance*precpers-zp1)/(zp2-zp1);
zp1=aDistance*precpers;
xp1=xp1*aDistance/(aDistance-zp1);
yp1=yp1*aDistance/(aDistance-zp1);
MoveTo( gp_Pnt2d(xp1 * aZoom, yp1 * aZoom) );
}
else if (zp2 >= curview->FocalDist*precpers) {
xp2=xp2+(xp1-xp2)*(curview->FocalDist*precpers-zp2)/(zp1-zp2);
yp2=yp2+(yp1-yp2)*(curview->FocalDist*precpers-zp2)/(zp1-zp2);
zp2=curview->FocalDist*precpers;
else if (zp2 >= aDistance*precpers)
{
xp2=xp2+(xp1-xp2)*(aDistance*precpers-zp2)/(zp1-zp2);
yp2=yp2+(yp1-yp2)*(aDistance*precpers-zp2)/(zp1-zp2);
zp2=aDistance*precpers;
}
xp2=xp2*curview->FocalDist/(curview->FocalDist-zp2);
yp2=yp2*curview->FocalDist/(curview->FocalDist-zp2);
xp2 = xp2 * aDistance / (aDistance - zp2);
yp2 = yp2 * aDistance / (aDistance - zp2);
}
DrawTo(gp_Pnt2d(xp2,yp2));
if (CurrentMode == PICK) {

View File

@@ -9,9 +9,10 @@ Draw_UnitCommands.cxx
Draw_Appli.hxx
Draw_Interpretor.hxx
Draw_Interpretor.cxx
Draw_View.hxx
Draw_View.cxx
Draw_Viewer.cxx
Draw_Viewer.hxx
Draw_Viewer.hxx
Draw_Window.cxx
Draw_Window.hxx
Draw_PInterp.hxx

View File

@@ -87,7 +87,7 @@ if { [file readable $draw_appli_init_file] } {
# on Windows, set special handler to update automatically environment variables
# in C subsystem when Tcl environment changes (see Mantis issue #23197)
if { $tcl_platform(platform) == "windows" && ! [catch {dgetenv PATH} res] } {
if { $tcl_platform(platform) == "windows" && ! [catch {dgetenv PATH}] } {
proc _update_c_env {envenv var op} {
global env
if { $op == "unset" } {

View File

@@ -278,7 +278,7 @@ proc testgrid {args} {
set tests_list {}
# iterate by all script paths
foreach dir [_split_path $env(CSF_TestScriptsPath)] {
foreach dir [lsort -unique [_split_path $env(CSF_TestScriptsPath)]] {
# protection against empty paths
set dir [string trim $dir]
if { $dir == "" } { continue }

View File

@@ -138,16 +138,6 @@ is
class LocateExtCC;
class ELCC instantiates GenExtCC from Extrema
(Curve from Adaptor3d,
CurveTool from Extrema,
Curve from Adaptor3d,
CurveTool from Extrema,
HArray1OfPnt from TColgp,
POnCurv from Extrema,
Pnt from gp,
Vec from gp);
class LocECC instantiates GenLocateExtCC from Extrema
(Curve from Adaptor3d,
CurveTool from Extrema,
@@ -172,17 +162,6 @@ is
class LocateExtCC2d;
class ELCC2d instantiates GenExtCC from Extrema
(Curve2d from Adaptor2d,
Curve2dTool from Extrema,
Curve2d from Adaptor2d,
Curve2dTool from Extrema,
HArray1OfPnt2d from TColgp,
POnCurv2d from Extrema,
Pnt2d from gp,
Vec2d from gp);
class LocECC2d instantiates GenLocateExtCC from Extrema
(Curve2d from Adaptor2d,
Curve2dTool from Extrema,

View File

@@ -99,7 +99,6 @@ fields
myCurveMinTol : Real from Standard;
myLowBorder : Vector from math;
myUppBorder : Vector from math;
mySolCount : Integer from Standard;
myPoints1 : SequenceOfReal from TColStd;
myPoints2 : SequenceOfReal from TColStd;
myC : Address from Standard [2];

View File

@@ -27,10 +27,12 @@
//purpose :
//=======================================================================
Extrema_GenExtCC::Extrema_GenExtCC()
: myLowBorder(1,2),
: myCurveMinTol(Precision::PConfusion()),
myLowBorder(1,2),
myUppBorder(1,2),
myDone(Standard_False)
{
myC[0] = myC[1] = 0;
}
//=======================================================================
@@ -39,7 +41,8 @@ Extrema_GenExtCC::Extrema_GenExtCC()
//=======================================================================
Extrema_GenExtCC::Extrema_GenExtCC(const Curve1& C1,
const Curve2& C2)
: myLowBorder(1,2),
: myCurveMinTol(Precision::PConfusion()),
myLowBorder(1,2),
myUppBorder(1,2),
myDone(Standard_False)
{
@@ -49,7 +52,6 @@ Extrema_GenExtCC::Extrema_GenExtCC(const Curve1& C1,
myLowBorder(2) = C2.FirstParameter();
myUppBorder(1) = C1.LastParameter();
myUppBorder(2) = C2.LastParameter();
myCurveMinTol = 1.0e-9;
}
//=======================================================================
@@ -62,7 +64,8 @@ Extrema_GenExtCC::Extrema_GenExtCC(const Curve1& C1,
const Standard_Real Usup,
const Standard_Real Vinf,
const Standard_Real Vsup)
: myLowBorder(1,2),
: myCurveMinTol(Precision::PConfusion()),
myLowBorder(1,2),
myUppBorder(1,2),
myDone(Standard_False)
{
@@ -72,7 +75,6 @@ Extrema_GenExtCC::Extrema_GenExtCC(const Curve1& C1,
myLowBorder(2) = Vinf;
myUppBorder(1) = Usup;
myUppBorder(2) = Vsup;
myCurveMinTol = 1.0e-9;
}
//=======================================================================
@@ -122,13 +124,16 @@ void Extrema_GenExtCC::Perform()
C1.Intervals(anIntervals1, GeomAbs_C2);
C2.Intervals(anIntervals2, GeomAbs_C2);
math_MultipleVarFunction *aFunc = new Extrema_GlobOptFuncCCC2(C1, C2);
math_GlobOptMin aFinder(aFunc, myLowBorder, myUppBorder);
Extrema_GlobOptFuncCCC2 aFunc (C1, C2);
math_GlobOptMin aFinder(&aFunc, myLowBorder, myUppBorder);
Standard_Real aDiscTol = 1.0e-2;
Standard_Real aValueTol = 1.0e-2;
Standard_Real aSameTol = myCurveMinTol / (aDiscTol);
aFinder.SetTol(aDiscTol, aSameTol);
Standard_Real anEps1 = (myUppBorder(1) - myLowBorder(1)) * Precision::Confusion();
Standard_Real anEps2 = (myUppBorder(2) - myLowBorder(2)) * Precision::Confusion();
Standard_Integer i,j,k;
math_Vector aFirstBorderInterval(1,2);
math_Vector aSecondBorderInterval(1,2);
@@ -146,60 +151,49 @@ void Extrema_GenExtCC::Perform()
aFinder.SetLocalParams(aFirstBorderInterval, aSecondBorderInterval);
aFinder.Perform();
// check that solution found on current interval is not worse than previous
aCurrF = aFinder.GetF();
if (aCurrF < aF + aSameTol * aValueTol)
if (aCurrF >= aF + aSameTol * aValueTol)
{
if (aCurrF > aF - aSameTol * aValueTol)
{
if (aCurrF < aF)
aF = aCurrF;
continue;
}
math_Vector sol(1,2);
Standard_Integer myTmpSolCount = aFinder.NbExtrema();
for(k = 1; k <= myTmpSolCount; k++)
{
aFinder.Points(k, sol);
myPoints1.Append(sol(1));
myPoints2.Append(sol(2));
}
mySolCount += myTmpSolCount;
} // if (aCurrF > aF - aSameTol * aValueTol)
else
{
// clean previously computed solution if current one is better
if (aCurrF > aF - aSameTol * aValueTol)
{
if (aCurrF < aF)
aF = aCurrF;
mySolCount = aFinder.NbExtrema();
myPoints1.Clear();
myPoints2.Clear();
math_Vector sol(1,2);
for(k = 1; k <= mySolCount; k++)
{
aFinder.Points(k, sol);
myPoints1.Append(sol(1));
myPoints2.Append(sol(2));
}
} // else
} //if (aCurrF < aF + aSameTol * aValueTol)
}
}
// Clear solutions clusters if it is necessary.
for(i = 1; i <= mySolCount - 1; i++)
{
for(j = i + 1; j <= mySolCount; j++)
{
if (Abs(myPoints1(i) - myPoints1(j)) < (myUppBorder(1) - myLowBorder(1)) * Precision::Confusion() &&
Abs(myPoints2(i) - myPoints2(j)) < (myUppBorder(2) - myLowBorder(2)) * Precision::Confusion())
}
else
{
// Points with indexes i and j is in same cluster, delete j point from extrema array.
myPoints1.Remove(j);
myPoints2.Remove(j);
j--;
mySolCount--;
aF = aCurrF;
myPoints1.Clear();
myPoints2.Clear();
}
// save found solutions avoiding repetitions
math_Vector sol(1,2);
for(k = 1; k <= aFinder.NbExtrema(); k++)
{
aFinder.Points(k, sol);
// avoid duplicated points
Standard_Boolean isNew = Standard_True;
for (Standard_Integer iSol = 1; isNew && iSol <= myPoints1.Length(); iSol++)
{
if (Abs(myPoints1(iSol) - sol(1)) < anEps1 &&
Abs(myPoints2(iSol) - sol(2)) < anEps2)
isNew = Standard_False;
}
if (isNew)
{
myPoints1.Append(sol(1));
myPoints2.Append(sol(2));
}
}
}
}
delete aFunc;
myDone = Standard_True;
}
@@ -220,7 +214,7 @@ Standard_Integer Extrema_GenExtCC::NbExt() const
{
StdFail_NotDone_Raise_if (!myDone, "Extrema_GenExtCC::NbExt()")
return mySolCount;
return myPoints1.Length();
}
//=======================================================================

View File

@@ -33,6 +33,7 @@
#include <BSplCLib.hxx>
#include <BSplCLib_KnotDistribution.hxx>
#include <BSplCLib_MultDistribution.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
@@ -686,7 +687,7 @@ void Geom2d_BSplineCurve::Segment(const Standard_Real aU1,
Standard_DomainError_Raise_if ( aU2 < aU1, "Geom2d_BSplineCurve::Segment");
//
Standard_Real AbsUMax = Max(Abs(FirstParameter()),Abs(LastParameter()));
Standard_Real Eps = Epsilon(AbsUMax);
Standard_Real Eps = Max (Epsilon(AbsUMax), Precision::PConfusion());
Standard_Real NewU1, NewU2;
Standard_Real U, DU=0;
Standard_Integer i, k, index;

View File

@@ -952,18 +952,9 @@ void GeomLib::SameRange(const Standard_Real Tolerance,
else { // On segmente le resultat
Handle(Geom2d_TrimmedCurve) TC =
new Geom2d_TrimmedCurve( CurvePtr, FirstOnCurve, LastOnCurve );
Standard_Real newFirstOnCurve = TC->FirstParameter(), newLastOnCurve = TC->LastParameter();
//
Handle(Geom2d_BSplineCurve) BS =
Geom2dConvert::CurveToBSplineCurve(TC);
if (BS->IsPeriodic())
BS->Segment( newFirstOnCurve, newLastOnCurve) ;
else
BS->Segment( Max(newFirstOnCurve, BS->FirstParameter()),
Min(newLastOnCurve, BS->LastParameter()) );
TColStd_Array1OfReal Knots(1,BS->NbKnots());
BS->Knots(Knots);
@@ -1007,9 +998,8 @@ void GeomLib_CurveOnSurfaceEvaluator::Evaluate (Standard_Integer *,/*Dimension*/
Standard_Integer *DerivativeRequest,
Standard_Real *Result,// [Dimension]
Standard_Integer *ReturnCode)
{
register Standard_Integer ii ;
gp_Pnt Point ;
{
gp_Pnt Point;
//Gestion des positionnements gauche / droite
if ((DebutFin[0] != FirstParam) || (DebutFin[1] != LastParam))
@@ -1024,21 +1014,21 @@ void GeomLib_CurveOnSurfaceEvaluator::Evaluate (Standard_Integer *,/*Dimension*/
{
TrimCurve->D0((*Parameter), Point) ;
for (ii = 0 ; ii < 3 ; ii++)
for (Standard_Integer ii = 0 ; ii < 3 ; ii++)
Result[ii] = Point.Coord(ii + 1);
}
if (*DerivativeRequest == 1)
{
gp_Vec Vector;
TrimCurve->D1((*Parameter), Point, Vector);
for (ii = 0 ; ii < 3 ; ii++)
for (Standard_Integer ii = 0 ; ii < 3 ; ii++)
Result[ii] = Vector.Coord(ii + 1) ;
}
if (*DerivativeRequest == 2)
{
gp_Vec Vector, VecBis;
TrimCurve->D2((*Parameter), Point, VecBis, Vector);
for (ii = 0 ; ii < 3 ; ii++)
for (Standard_Integer ii = 0 ; ii < 3 ; ii++)
Result[ii] = Vector.Coord(ii + 1) ;
}
ReturnCode[0] = 0;

View File

@@ -90,6 +90,10 @@
#include <Precision.hxx>
#include <ShapeAnalysis.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>
#include <TColgp_HArray2OfXYZ.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_HArray2OfReal.hxx>
@@ -244,29 +248,90 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle
Standard_Boolean PeriodU = start->IsUPeriodic();
Standard_Boolean PeriodV = start->IsVPeriodic();
if (PeriodU || PeriodV) {
mysurface = Handle(Geom_BSplineSurface)::DownCast(start->Copy());
mysurface = Handle(Geom_BSplineSurface)::DownCast(start->Copy());
//szv#10:PRO19566:05Oct99
Standard_Boolean workaround = !(mysurface->IsURational() || mysurface->IsVRational());
if (workaround) mysurface->SetWeight(1,1,0.3);
Standard_Real Umin = Udeb, Umax = Ufin, Vmin = Vdeb, Vmax = Vfin;
Standard_Real U0,U1,V0,V1;
Standard_Real uShift = 0, vShift = 0;
mysurface->Bounds(U0,U1,V0,V1);
if ( PeriodU ) mysurface->SetUNotPeriodic();
if ( PeriodV ) mysurface->SetVNotPeriodic();
//szv#10:PRO19566:05Oct99
if (workaround) mysurface->SetWeight(1,1,1.);
// cut segment from periodic surfaces for syncronization of pcurves ranges
// and surface bounds (issue 26138)
if (!PeriodU) {
if (Umin < U0)
Umin = U0;
if (U1 < Umax)
Umax = U1;
}
else {
mysurface = start;
if (Abs(Umin - U0) < Precision::PConfusion())
Umin = U0;
if (Abs(Umax - U1) < Precision::PConfusion())
Umax = U1;
uShift = ShapeAnalysis::AdjustToPeriod(Umin, U0, U1);
Umin += uShift;
Umax += uShift;
}
if (!PeriodV) {
if (Vmin < V0)
Vmin = V0;
if (V1 < Vmax)
Vmax = V1;
}
else {
if (Abs(Vmin - V0) < Precision::PConfusion())
Vmin = V0;
if (Abs(Vmax - V1) < Precision::PConfusion())
Vmax = V1;
vShift = ShapeAnalysis::AdjustToPeriod(Vmin, V0, V1);
Vmin += vShift;
Vmax += vShift;
}
if ( Abs(uShift) > Precision::PConfusion() || Abs(vShift) > Precision::PConfusion()) {
Standard_Boolean isNeedSegment = Standard_True;
isNeedSegment = Abs(Umax-Umin) > Precision::PConfusion() &&
Abs(Vmax-Vmin) > Precision::PConfusion();
Standard_Real uMaxShift = 0, vMaxShift = 0;
uMaxShift = ShapeAnalysis::AdjustToPeriod(Ufin, U0, U1);
vMaxShift = ShapeAnalysis::AdjustToPeriod(Vfin, V0, V1);
isNeedSegment &=
(PeriodU && Abs(uShift - uMaxShift) > Precision::PConfusion()) ||
(PeriodV && Abs(vShift - vMaxShift) > Precision::PConfusion());
if (isNeedSegment) {
try {
OCC_CATCH_SIGNALS
Handle(Geom_BSplineSurface) bspl = Handle(Geom_BSplineSurface)::DownCast ( start->Copy() );
if ( ! bspl.IsNull() ) {
bspl->CheckAndSegment(Umin, Umax, Vmin, Vmax);
if ((U1 - U0) - (Umax - Umin) > Precision::PConfusion())
PeriodU = Standard_False;
if ((V1 - V0) - (Vmax - Vmin) > Precision::PConfusion())
PeriodV = Standard_False;
mysurface = bspl;
}
}
catch ( Standard_Failure ) {
#ifdef DEB
cout << "Warning: GeomToIGES_GeomSurface: can't trim bspline" << endl;
cout << "Warning: Exception in Segment(): " ;
Standard_Failure::Caught()->Print(cout);
#endif
}
}
}
//unperiodize surface to get neccessary for IGES standard number of knots and mults
if ( mysurface->IsUPeriodic() ) {
mysurface->SetUNotPeriodic();
}
if ( mysurface->IsVPeriodic() ) {
mysurface->SetVNotPeriodic();
}
Standard_Integer DegU = mysurface->UDegree();
Standard_Integer DegV = mysurface->VDegree();
Standard_Boolean CloseU = mysurface->IsUClosed();
Standard_Boolean CloseV = mysurface->IsVClosed();
//Standard_Boolean PeriodU = start->IsUPeriodic();
//Standard_Boolean PeriodV = start->IsVPeriodic();
Standard_Boolean RationU = mysurface->IsURational();
Standard_Boolean RationV = mysurface->IsVRational();
Standard_Integer NbUPoles = mysurface->NbUPoles();
@@ -348,18 +413,6 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle
UIndex++;
VIndex = Poles->LowerCol();
}
// mjm le 9/10/97 mise en place d`une protection
Standard_Real U1,U2,V1,V2;
Standard_Real Umin = Udeb;
Standard_Real Umax = Ufin;
Standard_Real Vmin = Vdeb;
Standard_Real Vmax = Vfin;
mysurface->Bounds(U1,U2,V1,V2);
if ( U1 > Umin ) Umin = U1;
if ( V1 > Vmin ) Vmin = V1;
if ( U2 < Umax ) Umax = U2;
if ( V2 < Vmax ) Vmax = V2;
BSpline-> Init (IndexU, IndexV, DegU, DegV, CloseU, CloseV, Polynom, PeriodU,
PeriodV, KnotsU, KnotsV, Weights, Poles, Umin, Umax, Vmin, Vmax);

View File

@@ -78,6 +78,6 @@ GeomToStep_MakeAxis1Placement::GeomToStep_MakeAxis1Placement
const Handle(StepGeom_Axis1Placement) &
GeomToStep_MakeAxis1Placement::Value() const
{
StdFail_NotDone_Raise_if(!done == Standard_True,"");
StdFail_NotDone_Raise_if(!done, "");
return theAxis1Placement;
}

View File

@@ -110,6 +110,6 @@ GeomToStep_MakeAxis2Placement2d::GeomToStep_MakeAxis2Placement2d
const Handle(StepGeom_Axis2Placement2d) &
GeomToStep_MakeAxis2Placement2d::Value() const
{
StdFail_NotDone_Raise_if(!done == Standard_True,"");
StdFail_NotDone_Raise_if(!done, "");
return theAxis2Placement2d;
}

View File

@@ -65,6 +65,6 @@ GeomToStep_MakeBSplineCurveWithKnots::
const Handle(StepGeom_BSplineCurveWithKnots) &
GeomToStep_MakeBSplineCurveWithKnots::Value() const
{
StdFail_NotDone_Raise_if(!done == Standard_True,"");
StdFail_NotDone_Raise_if(!done, "");
return theBSplineCurveWithKnots;
}

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