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

Compare commits

..

22 Commits

Author SHA1 Message Date
kgv
f8e960bc85 0025466: Visualization - Impossible to change the display mode when a local context is opened
Remove irrelevant check from method AIS_InteractiveContext::SetDisplayMode().

Test case for issue CR25466
2015-01-20 10:12:12 +03:00
kgv
49dd2f7d93 0025511: Visualization - drop redundant viewer option V3d_View::Transparency()
Visual3d_ViewManager, activate texturing by default.

Update Qt sample

Conflicts:
	src/AIS/AIS_InteractiveContext.cxx
2015-01-15 09:38:11 +03:00
kgv
147dfa6daa 0025664: Visualization - dynamic highlighting should not be discarded on re-displaying independent object
Clear list of immediate presentations in proper place - in AIS_LocalContext::manageDetected()
instead of AIS_LocalContext::Unhilight().
2015-01-14 15:03:34 +03:00
kgv
e168ba53aa Apply changes made in CR25466: code cleanup 2014-12-29 16:28:56 +03:00
jgv
35f8794fb2 0025657: Bad result of Fillet operation 2014-12-27 14:40:45 +03:00
kgv
971feb7608 0025637: Objects displayed in LocalContext are not listed in displayed objects of interactive context
Revert OCCT_DEBUG changes in method AIS_InteractiveContext::DisplayedObjects().
2014-12-24 12:45:05 +03:00
jgv
0435af7b21 0025592: Bad result of Fillet operation 2014-12-23 12:16:07 +03:00
aml
b8265cb716 0025559: SIGSEGV in TKMath when computing max tolerance of curve on surface
Fixed possible being outside the boundaries.
2014-12-08 14:13:18 +03:00
vsr
5c4a9ab709 0025559: SIGSEGV in TKMath when computing max tolerance of curve on surface 2014-12-08 11:24:49 +03:00
aba
80712f4646 0025492: the selected subshape does not have topological relationship with orginal shape in OCC680:
returned identity owner location if the selectable object has identity transformation.
2014-12-08 11:24:26 +03:00
vsr
79fb9ef82f Adjusting testing cases 2014-12-08 11:22:09 +03:00
nbv
af4b075434 0025465: Excess vertex in the result of CUT operation
1. Methods ClearVertexes(), RemoveVertex(...) and InsertVertexBefore(...) was added to the IntPatch_WLine class.
2. Function IsSame(...) for IntSurf_PntOn2S was added (see IntSurf_PntOn2S.cdl for detail information).
3. Concatenate WLine got if it is possible.

Some test cases were changed according to their new behavior.
2014-12-04 10:19:39 +03:00
san
4ece81d4a9 0025528: Visualization - Exception on removing an interactive object from a local context
AIS_LocalContext::Remove() corrected to unbind the argument from
myActiveObjects at the very end. Also some code clean up applied
(e.g. duplicated AddOrRemoveSelected() call removed, formatting corrected).
2014-12-04 09:51:06 +03:00
bugmaster
c35f2ea77d 0025494: Wrong result obtained by projection algorithm
Calculation of last parameter of projected curve was changed for the projecting of a curve to surface of revolution, if the curve is intersected with the axis of revolution

Test case for issue CR25494
2014-12-04 09:41:25 +03:00
pkv
99c01c8ae2 0025505: General Fuse produces self-intersection shape
Changes:
class BOPAlgo_BuilderSolid
method:
void BOPAlgo_BuilderSolid::PerformAreas()

The misprint has been corrected

Test case for issue CR25505
2014-12-04 09:41:10 +03:00
gka
a54ca2f54c 0025455: fixshape works at the second attempt
Added check and fix of tolerances of all vertices after performing all fixes.
It is necessary to avoid situation when point of vertex belonging a few faces was changed for current face
but edges containing this vertex belonging before fixed face are not taking into account.
Mode FixVertexTolMode to manage check tolerance of vertices was added in ShapeFix_Shape
class. (default value is equal to -1)
Method to change FixVertexTolMode mode  FixVertexTolMode() was added in ShapeFix_Shape class

Test case for CR25455
2014-12-04 09:40:40 +03:00
nbv
cb793355eb 0025488: Wrong result of two trimmed cylinders intersection
1. Function IsSame(...) for IntSurf_PntOn2S was added (see IntSurf_PntOn2S.cdl for detail information).
2. Inserting additional points is forbidden if existing WLine contains only two points coincided.

Test-case for issue #25488
2014-12-04 09:40:09 +03:00
jgv
aba7d78e18 0025480: Incorrect result of BRepOffsetAPI_MakePipe
Test case for CR25480
2014-12-04 09:39:58 +03:00
pkv
a055a8d960 0025456: BOPAlgo_CheckerSI reports an error on the given shape
Changes:
1. class IntTools_FaceFace
         method:
         void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
                                    const Handle(Adaptor3d_TopolTool)& dom1,
                                    const Handle(Adaptor3d_TopolTool)& dom2)

The value of testing parameter has been changed for the cases of infinite curves

Test case for issue CR25456
2014-12-04 09:39:38 +03:00
pkv
7c5f06ad43 0025449: Excess vertex in result of General Fuse operation.
Changes:
1. class IntTools_EdgeFace
     method:
     Standard_Boolean IntTools_EdgeFace::CheckTouchVertex
     (const IntTools_CommonPrt& aCP,
     Standard_Real& aTx)

The parametric size of the contact zone between vertex and face has been changed

Test cases for issue CR25449
2014-12-04 09:38:31 +03:00
pkv
87f9c8d218 0025450: Common operation returns wrong shape
Changes:
class BOPAlgo_PaveFiller
 method:
 void BOPAlgo_PaveFiller::PerformEF()

 The index of the face has been added in post-treatment map

Test cases for issue CR25450

Correction of test case for issue CR25450
2014-12-04 09:38:18 +03:00
pkv
1f349b3c2c 0025432: Wrong result obtained by MakerVolume operator.
Changes:
class BOPTools_AlgoTools
static function:
Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
                                 const gp_Pnt& aP,
                                 gp_Dir& aDB,
                                 gp_Pnt& aPOut,
                                 Handle(IntTools_Context)& theContext,
                                 GeomAPI_ProjectPointOnSurf& aProjPL,
                                 const Standard_Real aDt,
                                 const Standard_Real aTolE)

Binormal calculation starts from the point located outside the tolerance circle of the edge

Test case for issue CR25432

Correction of test cases for issue CR25432
2014-12-04 09:37:40 +03:00
540 changed files with 8433 additions and 15703 deletions

View File

@@ -182,19 +182,15 @@ if (3RDPARTY_NOT_INCLUDED)
message (FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" )
endif()
if (3RDPARTY_INCLUDE_DIRS)
list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS)
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}")
message (STATUS "The directories containing 3rdparty headers: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}")
include_directories (${3RDPARTY_INCLUDE_DIRS})
endif()
list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS)
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}")
message (STATUS "The directories containing 3rdparty headers: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}")
include_directories (${3RDPARTY_INCLUDE_DIRS})
if (3RDPARTY_LIBRARY_DIRS)
list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
message (STATUS "The directories containing 3rdparty libraries: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
link_directories (${3RDPARTY_LIBRARY_DIRS})
endif()
list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
message (STATUS "The directories containing 3rdparty libraries: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
link_directories (${3RDPARTY_LIBRARY_DIRS})
OCCT_MAKE_BUILD_POSTFIX()

View File

@@ -63,21 +63,11 @@ Download the necessary archive from http://www.tcl.tk/software/tcltk/download.ht
This is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools.
3. By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used.
You may wish to link Tcl library with static version of run-time to avoid this dependency.
For that:
* Edit file *makefile.vc* replacing strings "crt = -MD" by "crt = -MT"
* Edit source file *tclMain.c* (located in folder *generic*) commenting out forward declaration of function *isatty()*.
4. In the command prompt, run *buildall.vc.bat*
3. In the command prompt, run *buildall.vc.bat*
You might need to run this script twice to have *tclsh* executable installed; check subfolder *bin* of specified installation path to verify this.
5. For convenience of use, we recommend making a copy of *tclsh* executable created in subfolder *bin* of *INSTALLDIR* and named with Tcl version number suffix, as *tclsh.exe* (with no suffix)
4. For convenience of use, we recommend making a copy of *tclsh* executable created in subfolder *bin* of *INSTALLDIR* and named with Tcl version number suffix, as *tclsh.exe* (with no suffix)
> cd D:\OCCT\3rdparty\tcltk-86-32\bin
> cp tclsh86.exe tclsh.exe

View File

@@ -3,10 +3,6 @@ Debugging tools and hints {#occt_dev_guides__debug}
@tableofcontents
@section occt_debug_intro Introduction
This manual describes facilities included in OCCT to support debugging, and provides some hints for more efficient debug.
@section occt_debug_macro Compiler macro to enable extended debug messages
Many OCCT algorithms can produce extended debug messages, usually printed to cout.
@@ -27,6 +23,10 @@ Note that some header files are modified when *OCCT_DEBUG* is enabled, hence bin
On Windows platform when using Visual Studio compiler there is a possibility to start the debugger automatically if an exception is caught in a program running OCCT. For this, set environment variable *CSF_DEBUG* to any value. Note that this feature works only if you enable OCCT exception handler in your application by calling *OSD::SetSignal()*.
@section occt_debug_intro Introduction
This manual describes facilities included in OCCT to support debugging, and provides some hints for more efficient debug.
@section occt_debug_bop Self-diagnostics in Boolean operations algorithm
In real-world applications modeling operations are often performed in a long sequence, while the user sees only the final result of the whole sequence. If the final result is wrong, the first debug step is to identify the offending operation to be debugged further. Boolean operation algorithm in OCCT provides a self-diagnostic feature which can help to do that step.

View File

@@ -58,7 +58,8 @@ OPEN CASCADE S.A.S.
**Windows** is a registered trademark of Microsoft Corporation in the United States and other countries.
**Mac** and the Mac logo are trademarks of Apple Inc., registered in the U.S. and other countries.
**Mac** and the Mac logo, **OpenCL** and the OpenCL logo, are trademarks of
Apple Inc., registered in the U.S. and other countries.
Acknowledgements
------------------
@@ -219,14 +220,14 @@ for which OCCT is certified to work.
@subsection OCCT_OVW_SECTION_5_1 Linux
| Operating System | Mandriva 2010, CentOS 5.5, CentOS 6.3, Fedora 17, Fedora 18, Ubuntu 13.04, Debian 6.0\* |
| Operating System | Mandriva 2010, CentOS 5.5, CentOS 6.3, Fedora 17, Fedora 18, Ubuntu-1304, Debian 6.0\* |
| ----- | ----- |
| 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)|
| 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 |
| TCL (for testing tools) | Tcltk 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 |
| Freetype (for text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.16.0 http://sourceforge.net/projects/freeimage/files |
@@ -234,17 +235,17 @@ 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 |
* Debian 6.0 64 bit is a platform used for regular testing of contributions
* Debian 60 64 bit is a platform used for regular testing of contributions
@subsection OCCT_OVW_SECTION_5_2 Windows
| Operating System | Windows 8.1 / 7 SP1 / Vista SP2 / XP SP3 |
| Operating System | Windows 8 / 7 SP1 / Vista SP2 / XP SP3 |
| ----- | ----- |
| 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)|
| C++ | Microsoft Visual Studio: 2005 SP1, 2008 SP1, 2010 SP1 \*, 2012 Update 3, 2013 <br>Intel C++ Composer XE 2013 SP1 |
| 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 |
| Freetype (OCCT Text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
@@ -258,12 +259,14 @@ for which OCCT is certified to work.
@subsection OCCT_OVW_SECTION_5_3 MAC OS X
| Operating System | OS X 10.10 Yosemite / 10.9 Mavericks / 10.8 Mountain Lion / 10.7 Lion / 10.6.8 Snow Leopard |
| Operating System | Mac OS X 10.9 Mavericks / 10.8 Mountain Lion / 10.7 Lion / 10.6.8 Snow Leopard |
| ----- | ----- |
| 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)|
| C++ | XCode 3.2 or newer (4.x is recommended) |
| TCL (for testing tools) | Tcl/Tk 8.5 or 8.6 http://www.tcl.tk/software/tcltk/download.html |
| TCL (for testing tools) | Tcltk 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 |
| Freetype (OCCT Text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (Support of common graphic formats) | FreeImage 3.16.0 http://sourceforge.net/projects/freeimage/files |
@@ -274,31 +277,27 @@ for which OCCT is certified to work.
| Operating System | Android 4.0.4+ |
| ----- | ----- |
| Minimum memory | 512 MB, 1 GB recommended |
| C++ | NDK r10, GNU gcc 4.8 or newer |
| Qt (for demonstration tools) | Qt 5.3.2 http://qt-project.org/downloads |
| Minimum memory | 512 MB, 1 GB recommended |
| Freetype (for text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
@subsection overview_req_graphics Graphic cards
On desktop, 3D viewer requires graphic card or software implementation supporting OpenGL 1.1 or above. OpenGL 2.1+ is highly recommended.
Ray tracing requires OpenGL 4.0+ or OpenGL 3.1+ with GL_ARB_texture_buffer_object_rgb32 extension. Textures within ray tracing will be available only when GL_ARB_bindless_texture extension is provided by driver.
On mobile platforms, OpenGL ES 2.0+ is required for 3D viewer. The ray tracing is not yet available on mobile platforms.
Some old hardware might be unable to execute complex GLSL programs (e.g. with high number of light sources, clipping planes).
For 3d viewer, graphic card or software implementation supporting OpenGL 1.1
or above is required. OpenGL 2.1+ is highly recommended.
For ray tracing, hardware implementation of OpenCL 1.1+ is required.
The following table lists graphic cards tested to work with OCCT.
| Graphic card | Driver | OS | OpenGL (fixed pipeline) | OpenGL (shaders) | OpenGL (ray tracing) |
| Graphic card | Driver/GL/GLSL/CL version | OS | OpenGL (fixed pipeline) | OpenGL (shaders) | OpenCL (ray tracing) |
| ---- | ---- | ---- | :----: | :----: | :----: |
| NVIDIA GeForce GTX 650 | Driver 340.52, OpenGL 4.4 | Windows 7 64 bit | OK | OK | OK |
| AMD/ATI RadeOn HD 7870 | Driver 14.100, OpenGL 4.4 | Windows 7 64-bit | OK | OK | OK |
| Intel(R) HD Graphics 2500 | Driver 10.18.10.3621, OpenGL 4.0 | Windows 7 64 bit | OK | OK | limited (no textures) |
| RadeOn 9600 | OpenGL 2.1.8454 | Windows XP 32-bit | OK | bad | unsupported by hardware |
| NVIDIA GeForce 6600 GT | OpenGL 2.1 | Windows XP 32-bit | OK | OK | unsupported by hardware |
| NVIDIA GeForce 320 | N/A | Mac OS X 10.6 / OS X 10.10 | OK | OK | not yet supported by OCCT |
| Apple software OpenGL | N/A | Mac OS X 10.6 / OS X 10.10 | OK | OK | N/A |
| Mesa 10.2.4 \* | "Gallium 0.4 on llvmpipe (LLVM 3.4, 256 bits)" OpenGL 3.0 | Windows 7 64 bit | OK | OK | unsupported by software |
| NVIDIA GeForce GT 610, 630M, 640 | Driver 311.44, GL 4.3.0, GLSL 4.30 | Windows 7 64 bit | OK | OK | OK |
| Intel(R) HD Graphics 3000 | GL 3.1.0, GLSL 1.40 | Windows 7 64 bit | OK | OK | none |
| RadeOn 9600 | GL 2.1.8454, GLSL 1.20 | | OK | bad | none |
| AMD/ATI RadeOn HD 7870 | Driver 6.14.10.12002, GL 4.2.12002, GLSL 4.20 | Windows 7 64-bit | OK | OK | OK |
| Mesa 7.8.2 Windows GDI Driver\* | GL 2.1, GLSL version 1.20 | Mac OS X 10.6 / OS X 10.9 | OK | artifacts | none |
| NVIDIA GeForce 320 | | Mac OS X 10.6 / OS X 10.9 | OK | OK | OK on OSX 10.6, bad on OSX 10.9 |
| NVIDIA GeForce 6600 GT | GL 2.1.2, GLSL 1.20 | Windows XP 32-bit | OK | OK | none |
| Apple software OpenGL | | Mac OS X 10.6 / OS X 10.9 | OK | OK | OK |
* Mesa implementation of OpenGL is used for certification testing of OCCT

View File

@@ -7,6 +7,7 @@
#include "GeometryView2D.h"
#include ".\Resource2d\RectangularGrid.h"
#include ".\Resource2d\CircularGrid.h"
#include <Aspect.hxx>
/////////////////////////////////////////////////////////////////////////////
// CNSGView

View File

@@ -28,13 +28,14 @@ ISession_Text::ISession_Text
const Standard_Real anX , // = 0
const Standard_Real anY , // = 0
const Standard_Real aZ , // = 0
const Aspect_TypeOfText aType, // = SOLID,
const Quantity_PlaneAngle anAngle, // = 0.0
const Standard_Real aslant, // = 0.0
const Standard_Integer aColorIndex, // = 0
const Standard_Integer aFontIndex, // = 1
const Quantity_Factor aScale) // = 1
:AIS_InteractiveObject(),MyText(aText),MyX(anX),MyY(anY),MyZ(aZ),
MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyTypeOfText(aType),MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0)
{
@@ -43,13 +44,14 @@ ISession_Text::ISession_Text
ISession_Text::ISession_Text
(const TCollection_AsciiString& aText,
gp_Pnt& aPoint,
const Aspect_TypeOfText aType, // = SOLID,
const Quantity_PlaneAngle anAngle, // = 0.0
const Standard_Real aslant, // = 0.0
const Standard_Integer aColorIndex, // = 0
const Standard_Integer aFontIndex, // = 1
const Quantity_Factor aScale) // = 1
:AIS_InteractiveObject(),MyText(aText),MyX(aPoint.X()),MyY(aPoint.Y()),MyZ(aPoint.Z()),
MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyTypeOfText(aType),MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0)
{

View File

@@ -12,6 +12,7 @@
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Quantity_Factor.hxx>
@@ -36,6 +37,7 @@ public:
const Standard_Real anX = 0 ,
const Standard_Real anY = 0 ,
const Standard_Real aZ = 0 ,
const Aspect_TypeOfText aType = Aspect_TOT_SOLID,
const Quantity_PlaneAngle anAngle = 0.0 ,
const Standard_Real aSlant = 0.0 ,
const Standard_Integer aColorIndex = 1 ,
@@ -44,6 +46,7 @@ public:
ISession_Text
(const TCollection_AsciiString& aText,
gp_Pnt& aPoint,
const Aspect_TypeOfText aType = Aspect_TOT_SOLID,
const Quantity_PlaneAngle anAngle = 0.0 ,
const Standard_Real aSlant = 0.0 ,
const Standard_Integer aColorIndex = 1 ,
@@ -57,6 +60,8 @@ inline TCollection_AsciiString GetText() const;
inline void SetText(const TCollection_AsciiString& atext) ;
inline void GetCoord(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const ;
inline void SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z=0);
inline Aspect_TypeOfText GetTypeOfText() const;
inline void SetTypeOfText(const Aspect_TypeOfText aNewTypeOfText) ;
inline Standard_Real GetAngle() const;
inline void SetAngle(const Standard_Real aNewAngle) ;
inline Standard_Real GetSlant() const;
@@ -88,6 +93,7 @@ TCollection_AsciiString MyText ;
Standard_Real MyX ;
Standard_Real MyY ;
Standard_Real MyZ ;
Aspect_TypeOfText MyTypeOfText ;
Standard_Real MyAngle ;
Standard_Real MySlant ;
Standard_Integer MyColorIndex ;
@@ -114,6 +120,12 @@ inline void ISession_Text::GetCoord(Standard_Real& X, Standard_Real& Y, Standard
inline void ISession_Text::SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
{ MyX = X ; MyY = Y ; MyZ = Z ;}
inline Aspect_TypeOfText ISession_Text::GetTypeOfText() const
{ return MyTypeOfText; }
inline void ISession_Text::SetTypeOfText(const Aspect_TypeOfText aNewTypeOfText)
{ MyTypeOfText = aNewTypeOfText; }
inline Standard_Real ISession_Text::GetAngle() const
{ return MyAngle; }

View File

@@ -83,6 +83,7 @@
#include <Aspect_TypeOfline.hxx>
#include <Aspect_WidthOfline.hxx>
#include <Aspect_Background.hxx>
#include <Aspect_TypeOfText.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRep_Builder.hxx>

View File

@@ -72,6 +72,7 @@ void CViewer2dDoc::OnBUTTONTestText()
Handle (Sample2D_Text) aText =
new Sample2D_Text(Text,
gp_Pnt(0.0,15.0*(j-15.0),0.0), // thePosition
Aspect_TOT_SOLID, // theType
10.0*M_PI, // theAngle
(Quantity_NameOfColor)(aColor++), // theColor
Font_FA_Regular, // theFontAspect
@@ -90,6 +91,7 @@ void CViewer2dDoc::OnBUTTONTestText()
Handle (Sample2D_Text) aText =
new Sample2D_Text(Text,
gp_Pnt(80.,15.0*(j-10.0),0.0), // thePosition
Aspect_TOT_SOLID, // theType
0.0, // theAngle
(Quantity_NameOfColor)(aColor++), // theColor
Font_FA_BoldItalic, // theFontAspect
@@ -108,6 +110,7 @@ void CViewer2dDoc::OnBUTTONTestText()
Handle (Sample2D_Text) aText =
new Sample2D_Text(Text,
gp_Pnt(140.0,15.0*(j-5.0),0.0), // thePosition
Aspect_TOT_SOLID, // theType
0.0, // theAngle
(Quantity_NameOfColor)(aColor++), // theColor
Font_FA_Bold, // theFontAspect
@@ -124,6 +127,7 @@ for (j=10;j<=15;j++)
Handle (Sample2D_Text) aText =
new Sample2D_Text(Text,
gp_Pnt(200.0,15.0*(j-10.0),0.0), // thePosition
Aspect_TOT_SOLID, // theType
0.0, // theAngle
(Quantity_NameOfColor)(aColor++),// theColor
Font_FA_Italic, // theFontAspect

View File

@@ -10,6 +10,7 @@
#include "Viewer3dDoc.h"
#include <V3d_View.hxx>
#include <Aspect.hxx>
#include <Quantity_NameOfColor.hxx>
#include "..\res\resource.h"

View File

@@ -51,6 +51,7 @@
#include <Aspect_Background.hxx>
#include <Aspect_TypeOfline.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Aspect_WidthOfline.hxx>
#include <Aspect_Window.hxx>
#include <Bnd_Box2d.hxx>

View File

@@ -48,6 +48,7 @@
#include <Aspect_Background.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Aspect_WidthOfLine.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>

View File

@@ -114,6 +114,7 @@
#include <Aspect_Background.hxx>
#include <Aspect_TypeOfline.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Aspect_WidthOfline.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>

View File

@@ -125,6 +125,7 @@ enum CurrentAction3d {
#include <Aspect_Background.hxx>
#include <Aspect_TypeOfline.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Aspect_WidthOfline.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>

View File

@@ -5,6 +5,7 @@
#include <OSD_File.hxx>
#include <Quantity_Length.hxx>
#include <Aspect_CardinalPoints.hxx>
#include <Quantity_Factor.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>

View File

@@ -7,6 +7,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Text,AIS_InteractiveObject)
Sample2D_Text::Sample2D_Text (const TCollection_AsciiString& theText,
const gp_Pnt& thePosition,
const Aspect_TypeOfText theType,
const Quantity_PlaneAngle theAngle,
const Quantity_Color theColor,
const Font_FontAspect theFontAspect,
@@ -19,6 +20,7 @@ Sample2D_Text::Sample2D_Text (const TCollection_AsciiString& theText,
{
myText = theText ;
myPosition = thePosition ;
myTypeOfText = theType ;
myAngle = theAngle ;
myColor = theColor ;
myFontAspect = theFontAspect;

View File

@@ -15,6 +15,7 @@ public:
Standard_EXPORT
Sample2D_Text (const TCollection_AsciiString& theText,const gp_Pnt& thePosition,
const Aspect_TypeOfText theType = Aspect_TOT_SOLID,
const Quantity_PlaneAngle theAngle = 0.0 ,
const Quantity_Color theColor = Quantity_NOC_YELLOW,
const Font_FontAspect theFontAspect = Font_FA_Regular,
@@ -28,6 +29,8 @@ inline TCollection_AsciiString GetText() const { return myText ; }
inline void SetText(const TCollection_AsciiString& theText) { myText = theText; }
inline void GetCoord(gp_Pnt& thePosition) const { thePosition=gp_Pnt(myPosition); }
inline void SetCoord(const gp_Pnt& thePosition) { myPosition = thePosition; }
inline Standard_Integer GetTypeOfText() const { return myTypeOfText; }
inline void SetTypeOfText(const Aspect_TypeOfText theTypeOfText) { myTypeOfText = theTypeOfText; }
inline Standard_Real GetAngle() const { return myAngle; }
inline void SetAngle(const Standard_Real theAngle) { myAngle = theAngle; }
inline Quantity_Color GetColor() const { return myColor; }
@@ -55,6 +58,7 @@ private:
TCollection_AsciiString myText ;
gp_Pnt myPosition ;
Aspect_TypeOfText myTypeOfText ;
Standard_Real myAngle ;
Quantity_Color myColor ;
Standard_CString myFont ;

View File

@@ -35,6 +35,7 @@
#include <AIS_TexturedShape.hxx>
#include <Aspect_Grid.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Aspect_DisplayConnection.hxx>
#include <Aspect_AspectMarker.hxx>

View File

@@ -19,6 +19,7 @@ IMPLEMENT_STANDARD_RTTIEXT(User_Cylinder,AIS_InteractiveObject)
#include <TColgp_Array1OfDir.hxx>
#include <GProp_PGProps.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Aspect_Array1OfEdge.hxx>
#include <Quantity_Color.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <Prs3d.hxx>

View File

@@ -48,7 +48,7 @@
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
@@ -123,7 +123,7 @@
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool

View File

@@ -12,7 +12,7 @@ Timer::Timer():myWriter(0) {}
Timer::Timer(const char* filename)
{
fopen_s(&myWriter,filename, "a");
myWriter = fopen(filename, "a");
}
Timer::~Timer()

View File

@@ -323,7 +323,7 @@ static void setColor(const Quantity_Color& color, const Standard_Boolean highlig
{
static Quantity_Color highlight_color(Quantity_NOC_BLUE1);
if(highlight)
glColor3f((GLfloat)highlight_color.Red(), (GLfloat)highlight_color.Green(), (GLfloat)highlight_color.Blue());
glColor3f(highlight_color.Red(), highlight_color.Green(), highlight_color.Blue());
else
glColor3d(color.Red(), color.Green(), color.Blue());
}

View File

@@ -1,28 +1,29 @@
#Category: Demos
#Title: Dimensions in 3d viewer
# Demo script for dimensions
puts "Dimensions demo: it shows capability of OCC to create different kinds "
puts "of dimensions (linear and angular) with 2D or 3D text."
# Dimensions demo
#
# It shows capability of OCC to create different kinds
# of dimensions (linear and angular) with 2D or 3D text.
set dispScriptFile [file normalize [info script]]
set scriptFolder [file dirname $dispScriptFile]
set aTopLoc [locate_data_file occ/Top.brep]
set aBotLoc [locate_data_file occ/Bottom.brep]
set aHatch [locate_data_file images/hatch_1.png]
pload MODELING VISUALIZATION
if { ![file exist "$aTopLoc"] || ![file exist "$aBotLoc"] } {
puts "No model file in current directory!"
puts "Please put Bottom.brep and Top.brep in current directory and try again"
}
puts "Importing shapes..."
pload MODELING VISUALIZATION
restore $aTopLoc a
restore $aBotLoc b
vinit View1 w=768 h=768
vclear
vsetdispmode 0
vsetcolorbg 255 255 255
vbottom
puts "Getting cut projection..."
# Get cut projection
box bb -150 -250 0 150 250 100
bsection bs b bb
bsection as a bb
@@ -32,58 +33,58 @@ vfit
set anAEdges [explode as E]
set aBEbges [explode bs E]
#foreach e [concat $anAEdges $aBEbges] { vdisplay $e }
set anArrAngle [expr 3.14 * 12.0 / 180.0]
# Form dimension names list to set parameters with vdimparam command
set aList {rd_1 rd_2 ad_1 ad_2 ad_3}
for {set i 1} {$i <= 10} {incr i} {
lappend aList ld_$i
}
set aList {das_7 dbs_27 dbs_6 dbs_19 das_25 das_26 dbs_22 das_43 das_12 das_41 dbs_39 dbs_59 das_3944 dbs_1826 das_4843}
puts "Creating dimensions..."
vdimension ld_1 -length -shapes bs_27 -plane xoy -color black -flyout -15
vdimension ld_2 -length -shapes bs_14 -plane xoy -color black -flyout 15
vdimension ld_3 -length -shapes bs_28 -plane xoy -color black -label right -flyout -27
vdimension ld_4 -length -shapes as_7 -plane xoy -color black -flyout -20
vdimension ld_5 -length -shapes as_28 -plane xoy -color black -flyout -15
vdimension ld_6 -length -shapes as_18 -plane xoy -color black -flyout 30
vdimension ld_7 -length -shapes bs_20 -plane xoy -color black -flyout -20
vdimension ld_8 -length -shapes as_43 -plane xoy -color black -flyout 55 -label right
vdimension ld_9 -length -shapes as_12 -plane xoy -color black -flyout 35 -label right
vdimension ld_10 -length -shapes as_40 -plane xoy -color black -flyout 15
vdimension dbs_19 -length -shapes bs_27 -plane xoy -color black -flyout -15
vdimension dbs_6 -length -shapes bs_14 -plane xoy -color black -flyout 15
vdimension dbs_27 -length -shapes bs_28 -plane xoy -color black -label right -flyout -27
vdimension das_7 -length -shapes as_7 -plane xoy -color black -flyout -20
vdimension das_25 -length -shapes as_28 -plane xoy -color black -flyout -15
vdimension das_26 -length -shapes as_18 -plane xoy -color black -flyout 30
vdimension dbs_22 -length -shapes bs_20 -plane xoy -color black -flyout -20
vdimension das_43 -length -shapes as_43 -plane xoy -color black -flyout 55 -label right
vdimension das_12 -length -shapes as_12 -plane xoy -color black -flyout 35 -label right
vdimension das_41 -length -shapes as_40 -plane xoy -color black -flyout 15
vdimension rd_1 -radius -shapes bs_45 -color black -label right
vdimension rd_2 -radius -shapes bs_63 -color black
vdimension dbs_39 -radius -shapes bs_45 -color black -label right
vdimension dbs_59 -radius -shapes bs_63 -color black
vdimension ad_1 -angle -shapes as_38 as_49 -color black
vdimension ad_2 -angle -shapes bs_24 bs_25 -color black
vdimension ad_3 -angle -shapes as_48 as_43 -color black
vdimension das_3944 -angle -shapes as_38 as_49 -color black
vdimension dbs_1826 -angle -shapes bs_24 bs_25 -color black
vdimension das_4843 -angle -shapes as_48 as_43 -color black
puts "Changing text and arrow paramaters of dimensions..."
foreach i $aList {
vdimparam $i -text 3d sh 6 -arrowlength 4 -arrowangle $anArrAngle
vdimparam $i text=3d textsize=6 textmode=s arlength=4 arangle=$anArrAngle
}
# Final fit
foreach e [concat $anAEdges $aBEbges] {
vremove $e
}
vfit
puts "Displaying exported shapes..."
vdisplay a b
vsetdispmode a 1
vsetdispmode b 1
vaspects a -setmaterial steel
vaspects b -setmaterial bronze
puts "Clipping shapes for better view..."
# set clipping plane
vclipplane create pa
vclipplane change pa equation 0 0 1 0
vclipplane change pa capping on
vclipplane change pa capping color 0.9 0.9 0.9
#vclipplane change pa capping hatch on
vclipplane set pa object a
vclipplane create pb
vclipplane change pb equation 0 0 1 0
vclipplane change pb capping on
vclipplane change pb capping color 1.0 0.8 0.0
#vclipplane change pb capping hatch on
vclipplane set pb object b
vsettexturemode Driver1/Viewer1/View1 2
@@ -92,9 +93,8 @@ vclipplane change pa capping texscale 0.05 -0.05
vclipplane change pb capping texname $aHatch
vclipplane change pb capping texscale 0.05 0.05
# nice view
vbottom
vrotate -0.3 -0.3 0
vfit
vzoom 1.2
puts "Done."

View File

@@ -180,22 +180,21 @@ is
TOI_IsoV,
TOI_Both;
---Purpose: Declares the type of isoparameter displayed.
enumeration DisplayStatus is
DS_Displayed,
DS_Erased,
DS_Temporary,
DS_DispImmediate,
DS_None;
---Purpose:
-- To give the display status of an Interactive Object.
-- This will be one of the following:
-- - DS_Displayed: the Interactive Object is displayed in the main viewer;
-- - DS_Erased: the Interactive Object is hidden in main viewer;
-- - DS_Temporary: temporarily displayed (in local context);
-- - DS_DispImmediate: displayed in the list of immediate presentations (highly interactive);
-- - DS_None: nowhere displayed.
enumeration DisplayStatus is
DS_Displayed,
DS_Erased,
DS_Temporary,
DS_None;
---Purpose:
-- To give the display status of an Interactive Object.
-- This will be one of the following:
-- - DS_Displayed: the Interactive Object is
-- displayed in the main viewer;
-- - DS_Erased: the Interactive Object is hidden in main viewer;
-- - DS_Temporary: the Interactive Object is temporarily displayed;
-- - DS_None: the Interactive Object is nowhere displayed.
enumeration SelectStatus is
SS_Added,
SS_Removed,

View File

@@ -269,28 +269,6 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
}
}
//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================
void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
{
setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
//myOwnMaterial = theMaterial;
hasOwnMaterial = Standard_True;
LoadRecomputable (AIS_Shaded);
for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
//if (aDrawer->HasOwnMaterial()) continue;
if (aDrawer->HasShadingAspect())
{
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), Standard_False); // aDrawer->IsTransparent()
}
}
}
//=======================================================================
//function : Compute
//purpose :
@@ -447,30 +425,6 @@ Standard_Boolean AIS_ColoredShape::dispatchColors (const TopoDS_Shape& th
return isOverriden || isSubOverride;
}
//! Function to check if specified compound is sub-shape of another one
inline Standard_Boolean isContainCompound (const TopoDS_Shape& theShape,
const TopoDS_Compound& theCompound)
{
if (theShape.ShapeType() != TopAbs_COMPOUND)
{
return Standard_False;
}
for (TopoDS_Iterator aSubShapeIter (theShape); aSubShapeIter.More(); aSubShapeIter.Next())
{
if (aSubShapeIter.Value().ShapeType() != TopAbs_COMPOUND)
{
continue;
}
else if (aSubShapeIter.Value() == theCompound
|| isContainCompound (aSubShapeIter.Value(), theCompound))
{
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : dispatchColors
//purpose :
@@ -484,11 +438,11 @@ void AIS_ColoredShape::dispatchColors (const TopoDS_Shape& theBaseShape,
// This needed when colored shape is not part of <theBaseShape>
// (but subshapes are) and actually container for subshapes.
DataMapOfShapeShape aSubshapeKeyshapeMap;
for (DataMapOfShapeColor::Iterator aKeyShapeIter (theKeyshapeColorMap);
aKeyShapeIter.More(); aKeyShapeIter.Next())
for (DataMapOfShapeColor::Iterator anIt (theKeyshapeColorMap);
anIt.More(); anIt.Next())
{
const TopoDS_Shape& aKeySh = aKeyShapeIter.Key();
const TopAbs_ShapeEnum aType = aKeySh.ShapeType();
const TopoDS_Shape& aSh = anIt.Key();
TopAbs_ShapeEnum aType = aSh.ShapeType();
TopAbs_ShapeEnum aSubType = (aType == TopAbs_SOLID || aType == TopAbs_SHELL)
? TopAbs_FACE
: (aType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_SHAPE);
@@ -496,30 +450,16 @@ void AIS_ColoredShape::dispatchColors (const TopoDS_Shape& theBaseShape,
{
case TopAbs_SHAPE:
{
if (aType == TopAbs_COMPOUND
&& !isContainCompound (theBaseShape, TopoDS::Compound (aKeySh)))
{
for (TopoDS_Iterator aSubShapeIter (aKeySh); aSubShapeIter.More(); aSubShapeIter.Next())
{
if (!aSubshapeKeyshapeMap.IsBound (aSubShapeIter.Value()))
{
aSubshapeKeyshapeMap.Bind (aSubShapeIter.Value(), aKeySh);
}
}
}
else
{
aSubshapeKeyshapeMap.Bind (aKeySh, aKeySh);
}
aSubshapeKeyshapeMap.Bind (aSh, aSh);
break;
}
default:
{
for (TopExp_Explorer anExp (aKeySh, aSubType); anExp.More(); anExp.Next())
for (TopExp_Explorer anExp (aSh, aSubType); anExp.More(); anExp.Next())
{
if (!aSubshapeKeyshapeMap.IsBound (anExp.Current()))
{
aSubshapeKeyshapeMap.Bind (anExp.Current(), aKeySh);
aSubshapeKeyshapeMap.Bind (anExp.Current(), aSh);
}
}
}

View File

@@ -104,9 +104,6 @@ public: //! @name global aspects
//! Sets transparency value.
Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE;
//! Sets the material aspect.
Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theAspect) Standard_OVERRIDE;
protected: //! @name override presentation computation
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,

View File

@@ -172,31 +172,30 @@ is
-- local context without selection, use the syntax below,
-- setting aSelectionMode to -1.
Display (me : mutable;
theIObj : InteractiveObject from AIS;
theDispMode : Integer from Standard;
theSelectionMode : Integer from Standard;
theToUpdateViewer : Boolean from Standard = Standard_True;
theToAllowDecomposition : Boolean from Standard = Standard_True;
theDispStatus : DisplayStatus from AIS = AIS_DS_None);
Display(me : mutable;
anIobj : InteractiveObject from AIS;
amode : Integer from Standard ;
aSelectionMode : Integer from Standard ;
updateviewer : Boolean from Standard = Standard_True;
allowdecomposition : Boolean from Standard = Standard_True);
---Purpose: Controls the choice between the using the display
-- and selection modes of open local context which you
-- have defined and activating those available by default.
-- If no Local Context is opened. and the Interactive
-- Object theIObj has no display mode of its own, the
-- default display mode, 0, is used. Likewise, if theIObj
-- Object aniobj has no display mode of its own, the
-- default display mode, 0, is used. Likewise, if aniobj
-- has no selection mode of its own, the default one, 0, is used.
-- If a local context is open and if theToUpdateViewer equals
-- If a local context is open and if updateviewer equals
-- Standard_False, the presentation of the Interactive
-- Object activates the selection mode; the object is
-- displayed but no viewer will be updated.
-- If theSelectionMode equals -1, theIObj will not be
-- If aSelectionMode equals -1, anIobj will not be
-- activated: it will be displayed but will not be selectable.
-- Use this if you want to view the object in open local
-- context without selection. Note: This option is only
-- available in Local Context.
-- If theToAllowDecomposition equals true, theIObj can have
-- subshapes detected by selection mechanisms. theIObj
-- If allowDecomposition equals true, anIObj can have
-- subshapes detected by selection mechanisms. anIObj
-- must be able to give a shape selection modes which
-- fit the AIS_Shape selection modes:
-- - vertices: 1
@@ -2031,19 +2030,6 @@ is
---Purpose: returns if possible,
-- the first local context where the object is seen
SetViewAffinity (me : mutable;
theIObj : InteractiveObject from AIS;
theView : View from V3d;
theIsVisible : Boolean from Standard) is static;
---Purpose: setup object visibility in specified view,
-- has no effect if object is not disaplyed in this context.
ObjectsForView (me;
theListOfIO : in out ListOfInteractive from AIS;
theView : View from V3d;
theIsVisibleInView : Boolean from Standard;
theStatus : DisplayStatus from AIS = AIS_DS_None) is static;
---Purpose: Query objects visible or hidden in specified view due to affinity mask.
InitAttributes(me:mutable) is static private;

245
src/AIS/AIS_InteractiveContext.cxx Normal file → Executable file
View File

@@ -33,7 +33,6 @@
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <Visual3d_ViewManager.hxx>
#include <Visual3d_View.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <AIS_Shape.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
@@ -267,12 +266,8 @@ void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_KindOfInteractive
{
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (theStatus != AIS_DS_None
&& anObjIter.Value()->GraphicStatus() != theStatus)
{
continue;
}
else if (anObjIter.Key()->Type() != theKind)
if (anObjIter.Value()->GraphicStatus() != theStatus
|| anObjIter.Key()->Type() != theKind)
{
continue;
}
@@ -318,35 +313,6 @@ void AIS_InteractiveContext::ObjectsInside (AIS_ListOfInteractive& theListO
}
}
//=======================================================================
//function : ObjectsForView
//purpose :
//=======================================================================
void AIS_InteractiveContext::ObjectsForView (AIS_ListOfInteractive& theListOfIO,
const Handle(V3d_View)& theView,
const Standard_Boolean theIsVisibleInView,
const AIS_DisplayStatus theStatus) const
{
const Graphic3d_CView* aCView = reinterpret_cast<const Graphic3d_CView* >(theView->View()->CView());
const Standard_Integer aViewId = aCView->ViewId;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (theStatus != AIS_DS_None
&& anObjIter.Value()->GraphicStatus() != theStatus)
{
theListOfIO.Append (anObjIter.Key());
continue;
}
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->ObjectAffinity (anObjIter.Key());
const Standard_Boolean isVisible = anAffinity->IsVisible (aViewId);
if (isVisible == theIsVisibleInView)
{
theListOfIO.Append (anObjIter.Key());
}
}
}
//=======================================================================
//function : Display
//purpose :
@@ -366,33 +332,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
theToUpdateViewer, theIObj->AcceptShapeDecomposition());
}
//=======================================================================
//function : SetViewAffinity
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj,
const Handle(V3d_View)& theView,
const Standard_Boolean theIsVisible)
{
if (theIObj.IsNull()
|| !myObjects.IsBound (theIObj))
{
return;
}
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->ObjectAffinity (theIObj);
const Graphic3d_CView* aCView = reinterpret_cast<const Graphic3d_CView* >(theView->View()->CView());
anAffinity->SetVisible (aCView->ViewId, theIsVisible == Standard_True);
if (theIsVisible)
{
theView->View()->ChangeHiddenObjects()->Remove (theIObj);
}
else
{
theView->View()->ChangeHiddenObjects()->Add (theIObj);
}
}
//=======================================================================
//function : Display
//purpose :
@@ -401,67 +340,33 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theToAllowDecomposition,
const AIS_DisplayStatus theDispStatus)
const Standard_Boolean theToAllowDecomposition)
{
if (theIObj.IsNull())
{
return;
}
if (theDispStatus == AIS_DS_Erased)
{
Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition);
return;
}
if (!theIObj->HasInteractiveContext())
{
theIObj->SetContext (this);
}
if (theDispStatus == AIS_DS_Temporary
&& !HasOpenedContext())
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
}
return;
}
else if (HasOpenedContext())
{
if (theDispStatus == AIS_DS_None
|| theDispStatus == AIS_DS_Temporary)
{
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
}
return;
}
}
const AIS_DisplayStatus aDispStatus = theDispStatus != AIS_DS_None ? theDispStatus : AIS_DS_Displayed;
if (!myObjects.IsBound (theIObj))
{
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (aDispStatus, theDispMode, theSelectionMode);
myObjects.Bind (theIObj, aStatus);
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->RegisterObject (theIObj);
switch (aDispStatus)
{
case AIS_DS_Displayed:
{
myMainPM->Display (theIObj, theDispMode, Standard_False);
break;
}
case AIS_DS_DispImmediate:
{
myMainPM->Display (theIObj, theDispMode, Standard_True);
break;
}
default: break;
}
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
myObjects.Bind (theIObj, aStatus);
myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1)
{
if (!mgrSelector->Contains (theIObj))
@@ -474,7 +379,8 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
else
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Temporary)
if (aStatus->GraphicStatus() != AIS_DS_Displayed
&& aStatus->GraphicStatus() != AIS_DS_Erased)
{
return;
}
@@ -507,8 +413,11 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
aStatus->AddDisplayMode (theDispMode);
}
myMainPM->Display (theIObj, theDispMode, aDispStatus == AIS_DS_DispImmediate);
aStatus->SetGraphicStatus (aDispStatus);
myMainPM->Display (theIObj, theDispMode);
if (aStatus->GraphicStatus() == AIS_DS_Erased)
{
aStatus->SetGraphicStatus (AIS_DS_Displayed);
}
if (aStatus->IsHilighted())
{
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
@@ -558,21 +467,13 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
}
if (theSelMode == -1
&& !theToAllowDecomposition)
&& !theToAllowDecomposition
&& !myObjects.IsBound (theIObj))
{
if (!myObjects.IsBound (theIObj))
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
myObjects.Bind (theIObj, aStatus);
}
// Register theIObj in the selection manager to prepare further activation of selection
if (!mgrSelector->Contains (theIObj))
{
mgrSelector->Load (theIObj);
}
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
myObjects.Bind (theIObj, aStatus);
}
}
@@ -928,8 +829,7 @@ void AIS_InteractiveContext::Hilight (const Handle(AIS_InteractiveObject)& theIO
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
aStatus->SetHilightStatus (Standard_True);
if (aStatus->GraphicStatus() != AIS_DS_Erased
&& aStatus->GraphicStatus() != AIS_DS_Temporary)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
Standard_Integer aHilightMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
myMainPM->Highlight (theIObj, aHilightMode);
@@ -962,15 +862,14 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_True);
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
STATUS->SetHilightStatus (Standard_True);
if (aStatus->GraphicStatus() != AIS_DS_Erased
&& aStatus->GraphicStatus() != AIS_DS_Temporary)
if (STATUS->GraphicStatus() == AIS_DS_Displayed)
{
const Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Color (anIObj, aCol, aHilightMode);
aStatus->SetHilightColor (aCol);
STATUS->SetHilightColor (aCol);
}
}
else
@@ -993,12 +892,11 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightColor(Quantity_NOC_WHITE);
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
STATUS->SetHilightStatus (Standard_False);
STATUS->SetHilightColor(Quantity_NOC_WHITE);
if (aStatus->GraphicStatus() != AIS_DS_Erased
&& aStatus->GraphicStatus() != AIS_DS_Temporary)
if (STATUS->GraphicStatus() == AIS_DS_Displayed)
{
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Unhighlight (anIObj, aHilightMode);
@@ -1532,15 +1430,14 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode theMode,
}
aStatus->AddDisplayMode (theMode);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_DispImmediate)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->Display (anObj, theMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
myMainPM->Display (anObj, theMode);
if (aStatus->IsSubIntensityOn())
{
myMainPM->Color (anObj, mySubIntensity, theMode);
}
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
}
}
@@ -1564,11 +1461,6 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
theIObj->SetContext(this);
}
if (HasOpenedContext())
{
return;
}
if (!myObjects.IsBound (theIObj))
{
theIObj->SetDisplayMode (theMode);
@@ -1580,8 +1472,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
}
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() != AIS_DS_Displayed
&& aStatus->GraphicStatus() != AIS_DS_DispImmediate)
if (aStatus->GraphicStatus() != AIS_DS_Displayed)
{
theIObj->SetDisplayMode (theMode);
return;
@@ -1613,7 +1504,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
aStatus->AddDisplayMode (theMode);
}
myMainPM->Display (theIObj, theMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
myMainPM->Display (theIObj, theMode);
Standard_Integer aDispMode, aHiMode, aSelMode;
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
if (aStatus->IsHilighted())
@@ -1664,15 +1555,14 @@ void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObjec
aStatus->AddDisplayMode (myDisplayMode);
}
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_DispImmediate)
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
if (myMainPM->IsHighlighted (theIObj, anOldMode))
{
myMainPM->Unhighlight (theIObj, anOldMode);
}
myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
myMainPM->Display (theIObj, myDisplayMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
myMainPM->Display (theIObj, myDisplayMode);
Standard_Integer aDispMode, aHiMode, aSelMode;
GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
@@ -2339,39 +2229,35 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Temporary
|| aStatus->GraphicStatus() == AIS_DS_Erased)
Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
return;
}
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
{
if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
{
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
{
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
}
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
}
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
}
if (IsCurrent (theIObj)
&& !aStatus->IsDModeIn (aDispMode))
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
}
if (IsCurrent (theIObj)
&& !aStatus->IsDModeIn (aDispMode))
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
}
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
}
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
if (theToUpdateviewer)
{
myMainVwr->Update();
}
}
aStatus->SetGraphicStatus (AIS_DS_Erased);
if (theToUpdateviewer)
{
myMainVwr->Update();
}
}
//=======================================================================
@@ -2435,11 +2321,6 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
mgrSelector->Remove (theIObj);
myObjects.UnBind (theIObj);
myMainVwr->Viewer()->UnregisterObject (theIObj);
for (myMainVwr->InitDefinedViews(); myMainVwr->MoreDefinedViews(); myMainVwr->NextDefinedViews())
{
myMainVwr->DefinedView()->View()->ChangeHiddenObjects()->Remove (theIObj);
}
if (theToUpdateviewer
&& aStatus->GraphicStatus() == AIS_DS_Displayed)

View File

@@ -43,7 +43,6 @@
#include <V3d_SpotLight.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_AmbientLight.hxx>
#include <Visual3d_View.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <SelectMgr_Selection.hxx>
@@ -85,7 +84,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
Standard_Boolean toUpdateViewer = Standard_False;
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
// allonzy
myMainSel->Pick (theXPix, theYPix, theView);
// filling of myAISDetectedSeq sequence storing information about detected AIS objects

View File

@@ -135,21 +135,13 @@ void AIS_Line::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(G
//purpose :
//=======================================================================
void AIS_Line::ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode)
void AIS_Line::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer)
{
// Do not support selection modes different from 0 currently
if (theMode)
return;
if (!myLineIsSegment)
{
ComputeInfiniteLineSelection(theSelection);
}
else
{
ComputeSegmentLineSelection(theSelection);
}
if (!myLineIsSegment) ComputeInfiniteLineSelection(aSelection);
else ComputeSegmentLineSelection(aSelection);
}

View File

@@ -87,7 +87,6 @@
#include <SelectBasics_SensitiveEntity.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Map.hxx>
#include <Visual3d_View.hxx>
#ifdef OCC9026
#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
@@ -129,7 +128,6 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
myCurDetected = 0;
myDetectedSeq.Clear();
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
myMainVS->Pick (theXpix, theYpix, theView);
const Standard_Integer aDetectedNb = myMainVS->NbPicked();
@@ -155,6 +153,7 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
{
if (mylastindex != 0 && mylastindex <= myMapOfOwner.Extent())
{
myMainPM->ClearImmediateDraw();
Unhilight (myMapOfOwner (mylastindex), theView);
if (theToRedrawImmediate)
{
@@ -378,6 +377,7 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Boolean toUpdateV
if(myAutoHilight)
{
myMainPM->ClearImmediateDraw();
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
{
@@ -547,7 +547,6 @@ void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
return;
}
myMainPM->ClearImmediateDraw();
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
if (IsSelected (theOwner))
{
@@ -1046,6 +1045,10 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
myMapOfOwner.Clear();
myMapOfOwner.Assign (anOwnersToKeep);
mylastindex = myMapOfOwner.FindIndex (aLastPicked);
if (!IsValidIndex (mylastindex))
{
myMainPM->ClearImmediateDraw();
}
if (!isAISRemainsDetected)
{
@@ -1199,6 +1202,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
{
if (thePickOwner.IsNull())
{
myMainPM->ClearImmediateDraw();
if (theToRedrawImmediate)
{
theView->RedrawImmediate();
@@ -1250,6 +1254,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
if (aNewIndex != mylastindex
|| thePickOwner->IsForcedHilight())
{
myMainPM->ClearImmediateDraw();
if (mylastindex != 0
&& mylastindex <= myMapOfOwner.Extent())
{
@@ -1272,7 +1277,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
mylastindex = aNewIndex;
}
if (mylastindex)
if (mylastindex != 0)
{
mylastgood = mylastindex;
}
@@ -1457,10 +1462,9 @@ Standard_Integer AIS_LocalContext::HilightPreviousDetected (const Handle(V3d_Vie
return 0;
}
const Standard_Integer aLen = myDetectedSeq.Length();
if (--myCurDetected < 1)
{
myCurDetected = aLen;
myCurDetected = 1;
}
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (myCurDetected));
if (anOwner.IsNull())

View File

@@ -306,13 +306,6 @@ uses
theValue : Real from Standard)
is protected;
setMaterial (me;
theDrawer : Drawer from AIS;
theMaterial : MaterialAspect from Graphic3d;
theToKeepColor : Boolean from Standard;
theToKeepTransp : Boolean from Standard)
is protected;
fields
myshape : Shape from TopoDS is protected;
myBB : Box from Bnd is protected;

View File

@@ -710,35 +710,6 @@ void AIS_Shape::UnsetWidth()
LoadRecomputable (AIS_WireFrame);
}
//=======================================================================
//function : setMaterial
//purpose :
//=======================================================================
void AIS_Shape::setMaterial (const Handle(AIS_Drawer)& theDrawer,
const Graphic3d_MaterialAspect& theMaterial,
const Standard_Boolean theToKeepColor,
const Standard_Boolean theToKeepTransp) const
{
const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
if (!theDrawer->HasShadingAspect())
{
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
}
theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
if (theToKeepColor)
{
theDrawer->ShadingAspect()->SetColor (aColor, myCurrentFacingModel);
}
if (theToKeepTransp)
{
theDrawer->ShadingAspect()->SetTransparency (aTransp, myCurrentFacingModel);
}
}
//=======================================================================
//function : SetMaterial
//purpose :
@@ -756,9 +727,20 @@ void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
{
setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
if (!myDrawer->HasShadingAspect())
{
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
}
hasOwnMaterial = Standard_True;
myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
if (HasColor())
{
myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
}
myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();

View File

@@ -29,22 +29,45 @@ package AppCont
---Level : Advanced.
-- All methods of all classes will be advanced.
uses AppParCurves, Geom, math, StdFail, TCollection, TColStd, gp,
TColgp, Standard
is
-------------------------------
--- Algorithms:
-------------------------------
imported LeastSquare;
generic class LeastSquare;
------------------------------------------------------
--- Necessary class for approximation a function f(t):
------------------------------------------------------
imported Function;
deferred class Function;
class FunctionTool;
---------------------------------------------------------
--- Necessary class for approximation a 2d function f(t):
---------------------------------------------------------
deferred class Function2d;
class FunctionTool2d;
class FitFunction instantiates LeastSquare from AppCont
(Function from AppCont, FunctionTool from AppCont);
class FitFunction2d instantiates LeastSquare from AppCont
(Function2d from AppCont, FunctionTool2d from AppCont);
end AppCont;

View File

@@ -0,0 +1,50 @@
-- Created on: 1993-09-01
-- Created by: Laurent PAINNOT
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
deferred class Function from AppCont
---Purpose: deferred class describing a continous 3d function f(u)
-- This class must be provided by the user to use the
-- approximation algorithm FittingCurve.
uses Pnt from gp,
Vec from gp
is
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~AppCont_Function(){Delete() ; }"
FirstParameter(me) returns Real
---Purpose: returns the first parameter of the function.
is deferred;
LastParameter(me) returns Real
---Purpose: returns the last parameter of the function.
is deferred;
Value(me; U: Real) returns Pnt
---Purpose: returns the point at parameter <U>.
is deferred;
D1(me; U: Real; P: in out Pnt; V: in out Vec) returns Boolean
---Purpose: returns the point and the derivative values at
-- the parameter <U>.
is deferred;
end Function;

View File

@@ -1,6 +1,5 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -13,7 +12,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_ViewAffinity.hxx>
#include <AppCont_Function.ixx>
IMPLEMENT_STANDARD_HANDLE (Graphic3d_ViewAffinity, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ViewAffinity, Standard_Transient)
void AppCont_Function::Delete()
{}

View File

@@ -1,91 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AppCont_Function_HeaderFile
#define AppCont_Function_HeaderFile
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <NCollection_Array1.hxx>
#include <Standard_Integer.hxx>
//! Class describing a continous 3d and/or function f(u).
//! This class must be provided by the user to use the approximation algorithm FittingCurve.
class AppCont_Function
{
public:
Standard_EXPORT AppCont_Function()
{
myNbPnt = -1;
myNbPnt2d = -1;
}
//! Get number of 3d and 2d points returned by "Value" and "D1" functions.
Standard_EXPORT void GetNumberOfPoints(Standard_Integer& theNbPnt,
Standard_Integer& theNbPnt2d) const
{
theNbPnt = myNbPnt;
theNbPnt2d = myNbPnt2d;
}
//! Get number of 3d points returned by "Value" and "D1" functions.
Standard_EXPORT Standard_Integer GetNbOf3dPoints() const
{
return myNbPnt;
}
//! Get number of 2d points returned by "Value" and "D1" functions.
Standard_EXPORT Standard_Integer GetNbOf2dPoints() const
{
return myNbPnt2d;
}
Standard_EXPORT virtual ~AppCont_Function() {}
//! Returns the first parameter of the function.
Standard_EXPORT virtual Standard_Real FirstParameter() const = 0;
//! Returns the last parameter of the function.
Standard_EXPORT virtual Standard_Real LastParameter() const = 0;
//! Returns the point at parameter <theU>.
Standard_EXPORT virtual Standard_Boolean Value(const Standard_Real theU,
NCollection_Array1<gp_Pnt2d>& thePnt2d,
NCollection_Array1<gp_Pnt>& thePnt) const = 0;
//! Returns the derivative at parameter <theU>.
Standard_EXPORT virtual Standard_Boolean D1(const Standard_Real theU,
NCollection_Array1<gp_Vec2d>& theVec2d,
NCollection_Array1<gp_Vec>& theVec) const = 0;
//! Return information about peridicity in output paramateters space.
//! @param theDimIdx Defines index in output parameters space. 1 <= theDimIdx <= 3 * myNbPnt + 2 * myNbPnt2d.
Standard_EXPORT virtual void PeriodInformation(const Standard_Integer /*theDimIdx*/,
Standard_Boolean& IsPeriodic,
Standard_Real& thePeriod) const
{
IsPeriodic = Standard_False;
thePeriod = 0.0;
};
protected:
Standard_Integer myNbPnt;
Standard_Integer myNbPnt2d;
};
#endif

View File

@@ -0,0 +1,50 @@
-- Created on: 1993-09-01
-- Created by: Laurent PAINNOT
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
deferred class Function2d from AppCont
---Purpose: deferred class describing a continous 2d function f(u)
-- This class must be provided by the user to use the
-- approximation algorithm FittingCurve2d.
uses Pnt2d from gp,
Vec2d from gp
is
Delete(me:out) is virtual;
---C++: alias "Standard_EXPORT virtual ~AppCont_Function2d(){Delete() ; }"
FirstParameter(me) returns Real
---Purpose: returns the first parameter of the function.
is deferred;
LastParameter(me) returns Real
---Purpose: returns the last parameter of the function.
is deferred;
Value(me; U: Real) returns Pnt2d
---Purpose: returns the point at parameter <U>.
is deferred;
D1(me; U: Real; P: in out Pnt2d; V: in out Vec2d) returns Boolean
---Purpose: returns the point and the derivative values at
-- the parameter <U>.
is deferred;
end Function2d;

View File

@@ -1,6 +1,5 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -13,12 +12,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _OpenGl_SequenceOfStructure
#define _OpenGl_SequenceOfStructure
#include <AppCont_Function2d.ixx>
#include <NCollection_Sequence.hxx>
class OpenGl_Structure;
typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
#endif // _OpenGl_SequenceOfStructure
void AppCont_Function2d::Delete()
{}

View File

@@ -0,0 +1,86 @@
-- Created on: 1993-09-01
-- Created by: Laurent PAINNOT
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class FunctionTool from AppCont
---Purpose: This class is the inteface between the Function
-- class and the tool asked by LeastSquare.
uses Function from AppCont,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec from TColgp,
Array1OfVec2d from TColgp
is
FirstParameter(myclass; C: Function from AppCont) returns Real;
---Purpose: returns the first parameter of the Function.
LastParameter(myclass; C: Function from AppCont) returns Real;
---Purpose: returns the last parameter of the Function.
NbP2d(myclass; C: Function from AppCont) returns Integer;
---Purpose: Returns 0.
NbP3d(myclass; C: Function from AppCont) returns Integer;
---Purpose: Returns 1. (the approximation will be done only for one
-- function.
Value(myclass; C: Function from AppCont; U: Real; tabPt: out Array1OfPnt);
---Purpose: <tabP> is an array of only 1 element, the point value at
-- the parameter <U>.
D1(myclass; C: Function from AppCont; U: Real; tabV: out Array1OfVec)
returns Boolean;
---Purpose: <tabV> is an array of only 1 element, the derivative
-- value at the parameter <U>.
----------------------------------------------------------
-- the following methods won t be called by the algorithms
-- but the description must exist in the tool.
----------------------------------------------------------
Value(myclass; C: Function from AppCont;U: Real;
tabPt2d: out Array1OfPnt2d);
Value(myclass; C: Function from AppCont; U: Real;
tabPt: out Array1OfPnt;
tabPt2d: out Array1OfPnt2d);
D1(myclass;C: Function from AppCont;U: Real;
tabV2d: out Array1OfVec2d)
returns Boolean;
D1(myclass; C: Function from AppCont; U: Real;
tabV: out Array1OfVec;
tabV2d: out Array1OfVec2d)
returns Boolean;
end FunctionTool;

View File

@@ -0,0 +1,109 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AppCont_FunctionTool.ixx>
#include <AppCont_Function.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfVec.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
Standard_Real AppCont_FunctionTool::FirstParameter
(const AppCont_Function& F)
{
return F.FirstParameter();
}
Standard_Real AppCont_FunctionTool::LastParameter
(const AppCont_Function& F)
{
return F.LastParameter();
}
Standard_Integer AppCont_FunctionTool::NbP2d
(const AppCont_Function&)
{
return (0);
}
Standard_Integer AppCont_FunctionTool::NbP3d
(const AppCont_Function&)
{
return (1);
}
void AppCont_FunctionTool::Value(const AppCont_Function& F,
const Standard_Real U,
TColgp_Array1OfPnt& tabPt)
{
tabPt(tabPt.Lower()) = F.Value(U);
}
Standard_Boolean AppCont_FunctionTool::D1
(const AppCont_Function& F,
const Standard_Real U,
TColgp_Array1OfVec& tabV)
{
gp_Pnt P;
gp_Vec V;
Standard_Boolean Ok = F.D1(U, P, V);
tabV(tabV.Lower()) = V;
return Ok;
}
void AppCont_FunctionTool::Value(const AppCont_Function&,
const Standard_Real,
TColgp_Array1OfPnt2d&)
{
}
void AppCont_FunctionTool::Value(const AppCont_Function&,
const Standard_Real,
TColgp_Array1OfPnt&,
TColgp_Array1OfPnt2d&)
{
}
Standard_Boolean AppCont_FunctionTool::D1
(const AppCont_Function&,
const Standard_Real,
TColgp_Array1OfVec2d&)
{
return (Standard_True);
}
Standard_Boolean AppCont_FunctionTool::D1
(const AppCont_Function&,
const Standard_Real,
TColgp_Array1OfVec&,
TColgp_Array1OfVec2d&)
{
return (Standard_True);
}

View File

@@ -0,0 +1,86 @@
-- Created on: 1993-09-01
-- Created by: Laurent PAINNOT
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class FunctionTool2d from AppCont
---Purpose: This class is the inteface between the Function2d
-- class and the tool asked by LeastSquare.
uses Function2d from AppCont,
Pnt from gp,
Pnt2d from gp,
Vec from gp,
Vec2d from gp,
Array1OfPnt from TColgp,
Array1OfPnt2d from TColgp,
Array1OfVec from TColgp,
Array1OfVec2d from TColgp
is
FirstParameter(myclass; C: Function2d from AppCont) returns Real;
---Purpose: returns the first parameter of the Function.
LastParameter(myclass; C: Function2d from AppCont) returns Real;
---Purpose: returns the last parameter of the Function.
NbP2d(myclass; C: Function2d from AppCont) returns Integer;
---Purpose: Returns 1. (the approximation will be done only for one
-- function.
NbP3d(myclass; C: Function2d from AppCont) returns Integer;
---Purpose: Returns 0.
Value(myclass; C: Function2d from AppCont;
U: Real; tabPt: out Array1OfPnt2d);
---Purpose: <tabP> is an array of only 1 element, the point value at
-- the parameter <U>.
D1(myclass; C: Function2d from AppCont; U: Real; tabV: out Array1OfVec2d)
returns Boolean;
---Purpose: <tabV> is an array of only 1 element, the derivative
-- value at the parameter <U>.
----------------------------------------------------------
-- the following methods won t be called by the algorithms
-- but the description must exist in the tool.
----------------------------------------------------------
Value(myclass; C: Function2d from AppCont;U: Real;
tabPt2d: out Array1OfPnt);
Value(myclass; C: Function2d from AppCont; U: Real;
tabPt: out Array1OfPnt;
tabPt2d: out Array1OfPnt2d);
D1(myclass;C: Function2d from AppCont;U: Real;
tabV2d: out Array1OfVec)
returns Boolean;
D1(myclass; C: Function2d from AppCont; U: Real;
tabV: out Array1OfVec;
tabV2d: out Array1OfVec2d)
returns Boolean;
end FunctionTool2d;

View File

@@ -0,0 +1,109 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AppCont_FunctionTool2d.ixx>
#include <AppCont_Function2d.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColgp_Array1OfVec2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
Standard_Real AppCont_FunctionTool2d::FirstParameter
(const AppCont_Function2d& F)
{
return F.FirstParameter();
}
Standard_Real AppCont_FunctionTool2d::LastParameter
(const AppCont_Function2d& F)
{
return F.LastParameter();
}
Standard_Integer AppCont_FunctionTool2d::NbP2d
(const AppCont_Function2d&)
{
return (1);
}
Standard_Integer AppCont_FunctionTool2d::NbP3d
(const AppCont_Function2d&)
{
return (0);
}
void AppCont_FunctionTool2d::Value(const AppCont_Function2d& F,
const Standard_Real U,
TColgp_Array1OfPnt2d& tabPt)
{
tabPt(tabPt.Lower()) = F.Value(U);
}
Standard_Boolean AppCont_FunctionTool2d::D1
(const AppCont_Function2d& F,
const Standard_Real U,
TColgp_Array1OfVec2d& tabV)
{
gp_Pnt2d P;
gp_Vec2d V;
Standard_Boolean Ok = F.D1(U, P, V);
tabV(tabV.Lower()) = V;
return Ok;
}
void AppCont_FunctionTool2d::Value(const AppCont_Function2d&,
const Standard_Real,
TColgp_Array1OfPnt&)
{
}
void AppCont_FunctionTool2d::Value(const AppCont_Function2d&,
const Standard_Real,
TColgp_Array1OfPnt&,
TColgp_Array1OfPnt2d&)
{
}
Standard_Boolean AppCont_FunctionTool2d::D1
(const AppCont_Function2d&,
const Standard_Real,
TColgp_Array1OfVec&)
{
return (Standard_False);
}
Standard_Boolean AppCont_FunctionTool2d::D1
(const AppCont_Function2d&,
const Standard_Real,
TColgp_Array1OfVec&,
TColgp_Array1OfVec2d&)
{
return (Standard_False);
}

View File

@@ -0,0 +1,108 @@
-- Created on: 1993-04-22
-- Created by: Laurent PAINNOT
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class LeastSquare from AppCont(MultiLine as any;
LineTool as any)
---as TheToolLine(MultiLine)
---Purpose: Makes an approximation of a continous Line described by
-- the tool TheLineTool.
-- Minimizing the difference between the approximate result
-- Curve and a continous MultiLine
uses Matrix from math,
Vector from math,
Constraint from AppParCurves,
MultiCurve from AppParCurves
raises NotDone from StdFail,
OutOfRange from Standard,
DimensionError from Standard
is
Create(SSP: MultiLine; U0, U1: Real; FirstCons, LastCons: Constraint;
Deg: Integer; NbPoints: Integer = 24)
---Purpose: given a continous MultiLine, this algorithm computes
-- the approximation into Bezier curves.
-- NbPoints points are taken on the initial MultiLine for
-- minimizing the surface between the MultiLine and the
-- Bezier curves doing the approximation.
-- The first point will be the point of parameter U0 with
-- a constraint FirstCons.
-- The last point will be the point of parameter U1 with
-- a constraint LastCons.
returns LeastSquare from AppCont
raises DimensionError from Standard;
IsDone(me)
---Purpose: returns True if all has been correctly done.
returns Boolean
is static;
Value(me: in out)
---Purpose: returns the result of the approximation, i.e. a
-- MultiCurve.
-- An exception is raised if NotDone.
---C++: return const &
returns MultiCurve from AppParCurves
raises NotDone from StdFail
is static;
NbBColumns(me; SSP: MultiLine)
---Purpose: is internally used by the constuctor.
returns Integer
is static protected;
Error(me; F: in out Real; MaxE3d, MaxE2d: in out Real)
---Purpose: F is the sum of the square errors at each of the
-- NbPoints of the MultiLine.
-- MaxE3d is the maximum 3d value of these errors.
-- MaxE2d is the maximum 2d value of these errors.
-- An exception is raised if NotDone.
raises NotDone from StdFail
is static;
fields
Done: Boolean;
SCU: MultiCurve from AppParCurves;
Degre: Integer;
Nbdiscret: Integer;
nbP: Integer;
nbP2d: Integer;
Points: Matrix;
Poles: Matrix;
myParam: Vector;
VB: Matrix;
end LeastSquare from AppCont;

View File

@@ -1,566 +0,0 @@
// Created on: 1995-03-14
// Created by: Modelistation
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef OCCT_DEBUG
#define No_Standard_OutOfRange
#define No_Standard_RangeError
#endif
#include <AppCont_LeastSquare.hxx>
#include <math.hxx>
#include <AppParCurves_MultiPoint.hxx>
#include <AppCont_ContMatrices.hxx>
#include <PLib.hxx>
//=======================================================================
//function : AppCont_LeastSquare
//purpose :
//=======================================================================
void AppCont_LeastSquare::FixSingleBorderPoint(const AppCont_Function& theSSP,
const Standard_Real theU,
const Standard_Real theU0,
const Standard_Real theU1,
NCollection_Array1<gp_Pnt2d>& theFix2d,
NCollection_Array1<gp_Pnt>& theFix)
{
Standard_Real aMaxIter = 15.0;
Standard_Integer j, i2;
NCollection_Array1<gp_Pnt> aTabP(1, Max (myNbP, 1)), aPrevP(1, Max (myNbP, 1));
NCollection_Array1<gp_Pnt2d> aTabP2d(1, Max (myNbP2d, 1)), aPrevP2d(1, Max (myNbP2d, 1));
Standard_Real aMult = ((theU - theU0) > (theU1 - theU)) ? 1.0: -1.0;
Standard_Real aStartParam = (theU0 + theU1) / 2.0,
aCurrParam, aPrevDist = 1.0, aCurrDist = 1.0;
for (Standard_Real anIter = 1.0; anIter < aMaxIter; anIter += 1.0)
{
aCurrParam = aStartParam + aMult * (1 - pow(10, -anIter)) * (theU1 - theU0) / 2.0;
theSSP.Value(aCurrParam, aTabP2d, aTabP);
// from second iteration
if (anIter > 1.5)
{
aCurrDist = 0.0;
i2 = 1;
for (j = 1; j <= myNbP; j++)
{
aCurrDist += aTabP(j).Distance(aPrevP(j));
i2 += 3;
}
for (j = 1; j <= myNbP2d; j++)
{
aCurrDist += aTabP2d(j).Distance(aPrevP2d(j));
i2 += 2;
}
// from the third iteration
if (anIter > 2.5 && aCurrDist / aPrevDist > 10.0)
break;
}
aPrevP = aTabP;
aPrevP2d = aTabP2d;
aPrevDist = aCurrDist;
}
theFix2d = aPrevP2d;
theFix = aPrevP;
}
//=======================================================================
//function : AppCont_LeastSquare
//purpose :
//=======================================================================
AppCont_LeastSquare::AppCont_LeastSquare(const AppCont_Function& SSP,
const Standard_Real U0,
const Standard_Real U1,
const AppParCurves_Constraint FirstCons,
const AppParCurves_Constraint LastCons,
const Standard_Integer Deg,
const Standard_Integer myNbPoints)
: mySCU(Deg+1),
myPoints(1, myNbPoints, 1, 3 * SSP.GetNbOf3dPoints() + 2 * SSP.GetNbOf2dPoints()),
myPoles(1, Deg + 1, 1, 3 * SSP.GetNbOf3dPoints() + 2 * SSP.GetNbOf2dPoints(), 0.0),
myParam(1, myNbPoints),
myVB(1, Deg+1, 1, myNbPoints),
myPerInfo(1, 3 * SSP.GetNbOf3dPoints() + 2 * SSP.GetNbOf2dPoints() )
{
myDone = Standard_False;
myDegre = Deg;
math_Matrix InvM(1, Deg+1, 1, Deg + 1);
Standard_Integer i, j, k, c, i2;
Standard_Integer classe = Deg + 1, cl1 = Deg;
Standard_Real U, dU, Coeff, Coeff2;
Standard_Real IBij, IBPij;
Standard_Integer FirstP = 1, LastP = myNbPoints;
Standard_Integer nbcol = 3 * SSP.GetNbOf3dPoints() + 2 * SSP.GetNbOf2dPoints();
math_Matrix B(1, classe, 1, nbcol, 0.0);
Standard_Integer bdeb = 1, bfin = classe;
AppParCurves_Constraint myFirstC = FirstCons, myLastC = LastCons;
SSP.GetNumberOfPoints(myNbP, myNbP2d);
Standard_Integer i2plus1, i2plus2;
myNbdiscret = myNbPoints;
NCollection_Array1<gp_Pnt> aTabP(1, Max (myNbP, 1));
NCollection_Array1<gp_Pnt2d> aTabP2d(1, Max (myNbP2d, 1));
NCollection_Array1<gp_Vec> aTabV(1, Max (myNbP, 1));
NCollection_Array1<gp_Vec2d> aTabV2d(1, Max (myNbP2d, 1));
for(Standard_Integer aDimIdx = 1; aDimIdx <= myNbP * 3 + myNbP2d * 2; aDimIdx++)
{
SSP.PeriodInformation(aDimIdx,
myPerInfo(aDimIdx).isPeriodic,
myPerInfo(aDimIdx).myPeriod);
}
Standard_Boolean Ok;
if (myFirstC == AppParCurves_TangencyPoint)
{
Ok = SSP.D1(U0, aTabV2d, aTabV);
if (!Ok) myFirstC = AppParCurves_PassPoint;
}
if (myLastC == AppParCurves_TangencyPoint)
{
Ok = SSP.D1(U1, aTabV2d, aTabV);
if (!Ok) myLastC = AppParCurves_PassPoint;
}
// Compute control points params on which approximation will be built.
math_Vector GaussP(1, myNbPoints), GaussW(1, myNbPoints);
math::GaussPoints(myNbPoints, GaussP);
math::GaussWeights(myNbPoints, GaussW);
math_Vector TheWeights(1, myNbPoints), VBParam(1, myNbPoints);
dU = 0.5*(U1-U0);
for (i = FirstP; i <= LastP; i++)
{
U = 0.5 * (U1 + U0) + dU * GaussP(i);
if (i <= (myNbPoints+1)/2)
{
myParam(LastP - i + 1) = U;
VBParam(LastP - i + 1) = 0.5 * (1 + GaussP(i));
TheWeights(LastP - i + 1) = 0.5 * GaussW(i);
}
else
{
VBParam(i - (myNbPoints + 1) / 2) = 0.5*(1 + GaussP(i));
myParam(i - (myNbPoints + 1) / 2) = U;
TheWeights(i - (myNbPoints+ 1) / 2) = 0.5 * GaussW(i);
}
}
// Compute control points.
for (i = FirstP; i <= LastP; i++)
{
U = myParam(i);
SSP.Value(U, aTabP2d, aTabP);
i2 = 1;
for (j = 1; j <= myNbP; j++)
{
(aTabP(j)).Coord(myPoints(i, i2), myPoints(i, i2+1), myPoints(i, i2+2));
i2 += 3;
}
for (j = 1; j <= myNbP2d; j++)
{
(aTabP2d(j)).Coord(myPoints(i, i2), myPoints(i, i2+1));
i2 += 2;
}
}
// Fix possible "period jump".
Standard_Integer aMaxDim = 3 * myNbP + 2 * myNbP2d;
for(Standard_Integer aDimIdx = 1; aDimIdx <= aMaxDim; aDimIdx++)
{
if (myPerInfo(aDimIdx).isPeriodic &&
Abs (myPoints(1, aDimIdx) - myPoints(2, aDimIdx)) > myPerInfo(aDimIdx).myPeriod / 2.01 &&
Abs (myPoints(2, aDimIdx) - myPoints(3, aDimIdx)) < myPerInfo(aDimIdx).myPeriod / 2.01)
{
Standard_Real aPeriodMult = (myPoints(1, aDimIdx) < myPoints(2, aDimIdx)) ? 1.0 : -1.0;
Standard_Real aNewParam = myPoints(1, aDimIdx) + aPeriodMult * myPerInfo(aDimIdx).myPeriod;
myPoints(1, aDimIdx) = aNewParam;
}
}
for (Standard_Integer aPntIdx = 1; aPntIdx < myNbPoints; aPntIdx++)
{
for(Standard_Integer aDimIdx = 1; aDimIdx <= aMaxDim; aDimIdx++)
{
if (myPerInfo(aDimIdx).isPeriodic &&
Abs ( myPoints(aPntIdx, aDimIdx) - myPoints(aPntIdx + 1, aDimIdx) ) > myPerInfo(aDimIdx).myPeriod / 2.01)
{
Standard_Real aPeriodMult = (myPoints(aPntIdx, aDimIdx) > myPoints(aPntIdx + 1, aDimIdx)) ? 1.0 : -1.0;
Standard_Real aNewParam = myPoints(aPntIdx + 1, aDimIdx) + aPeriodMult * myPerInfo(aDimIdx).myPeriod;
myPoints(aPntIdx + 1, aDimIdx) = aNewParam;
}
}
}
VBernstein(classe, myNbPoints, myVB);
// Traitement du second membre:
NCollection_Array1<Standard_Real> tmppoints(1, nbcol);
for (c = 1; c <= classe; c++)
{
tmppoints.Init(0.0);
for (i = 1; i <= myNbPoints; i++)
{
Coeff = TheWeights(i) * myVB(c, i);
for (j = 1; j <= nbcol; j++)
{
tmppoints(j) += myPoints(i, j)*Coeff;
}
}
for (k = 1; k <= nbcol; k++)
{
B(c, k) += tmppoints(k);
}
}
if (myFirstC == AppParCurves_NoConstraint &&
myLastC == AppParCurves_NoConstraint) {
math_Matrix InvM(1, classe, 1, classe);
InvMMatrix(classe, InvM);
// Calcul direct des poles:
for (i = 1; i <= classe; i++) {
for (j = 1; j <= classe; j++) {
IBij = InvM(i, j);
for (k = 1; k <= nbcol; k++) {
myPoles(i, k) += IBij * B(j, k);
}
}
}
}
else
{
math_Matrix M(1, classe, 1, classe);
MMatrix(classe, M);
NCollection_Array1<gp_Pnt2d> aFixP2d(1, Max (myNbP2d, 1));
NCollection_Array1<gp_Pnt> aFixP(1, Max (myNbP, 1));
if (myFirstC == AppParCurves_PassPoint ||
myFirstC == AppParCurves_TangencyPoint)
{
SSP.Value(U0, aTabP2d, aTabP);
FixSingleBorderPoint(SSP, U0, U0, U1, aFixP2d, aFixP);
i2 = 1;
for (k = 1; k<= myNbP; k++)
{
if (aFixP(k).Distance(aTabP(k)) > 0.1)
(aFixP(k)).Coord(myPoles(1, i2), myPoles(1, i2 + 1), myPoles(1, i2 + 2));
else
(aTabP(k)).Coord(myPoles(1, i2), myPoles(1, i2 + 1), myPoles(1, i2 + 2));
i2 += 3;
}
for (k = 1; k<= myNbP2d; k++)
{
if (aFixP2d(k).Distance(aTabP2d(k)) > 0.1)
(aFixP2d(k)).Coord(myPoles(1, i2), myPoles(1, i2 + 1));
else
(aTabP2d(k)).Coord(myPoles(1, i2), myPoles(1, i2 + 1));
i2 += 2;
}
for (Standard_Integer aDimIdx = 1; aDimIdx <= aMaxDim; aDimIdx++)
{
if (myPerInfo(aDimIdx).isPeriodic &&
Abs ( myPoles(1, aDimIdx) - myPoints(1, aDimIdx) ) > myPerInfo(aDimIdx).myPeriod / 2.01 )
{
Standard_Real aMult = myPoles(1, aDimIdx) < myPoints(1, aDimIdx)? 1.0: -1.0;
myPoles(1,aDimIdx) += aMult * myPerInfo(aDimIdx).myPeriod;
}
}
}
if (myLastC == AppParCurves_PassPoint ||
myLastC == AppParCurves_TangencyPoint)
{
SSP.Value(U1, aTabP2d, aTabP);
FixSingleBorderPoint(SSP, U1, U0, U1, aFixP2d, aFixP);
i2 = 1;
for (k = 1; k<= myNbP; k++)
{
if (aFixP(k).Distance(aTabP(k)) > 0.1)
(aFixP(k)).Coord(myPoles(classe, i2), myPoles(classe, i2 + 1), myPoles(classe, i2 + 2));
else
(aTabP(k)).Coord(myPoles(classe, i2), myPoles(classe, i2 + 1), myPoles(classe, i2 + 2));
i2 += 3;
}
for (k = 1; k<= myNbP2d; k++)
{
if (aFixP2d(k).Distance(aTabP2d(k)) > 0.1)
(aFixP2d(k)).Coord(myPoles(classe, i2), myPoles(classe, i2 + 1));
else
(aTabP2d(k)).Coord(myPoles(classe, i2), myPoles(classe, i2 + 1));
i2 += 2;
}
for (Standard_Integer aDimIdx = 1; aDimIdx <= 2; aDimIdx++)
{
if (myPerInfo(aDimIdx).isPeriodic &&
Abs ( myPoles(classe, aDimIdx) - myPoints(myNbPoints, aDimIdx) ) > myPerInfo(aDimIdx).myPeriod / 2.01 )
{
Standard_Real aMult = myPoles(classe, aDimIdx) < myPoints(myNbPoints, aDimIdx)? 1.0: -1.0;
myPoles(classe,aDimIdx) += aMult * myPerInfo(aDimIdx).myPeriod;
}
}
}
if (myFirstC == AppParCurves_PassPoint) {
bdeb = 2;
// mise a jour du second membre:
for (i = 1; i <= classe; i++) {
Coeff = M(i, 1);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= myPoles(1, k)*Coeff;
}
}
}
if (myLastC == AppParCurves_PassPoint) {
bfin = cl1;
for (i = 1; i <= classe; i++) {
Coeff = M(i, classe);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= myPoles(classe, k)*Coeff;
}
}
}
if (myFirstC == AppParCurves_TangencyPoint) {
// On fixe le second pole::
bdeb = 3;
SSP.D1(U0, aTabV2d, aTabV);
i2 = 1;
Coeff = (U1-U0)/myDegre;
for (k = 1; k<= myNbP; k++) {
i2plus1 = i2+1; i2plus2 = i2+2;
myPoles(2, i2) = myPoles(1, i2) + aTabV(k).X()*Coeff;
myPoles(2, i2plus1) = myPoles(1, i2plus1) + aTabV(k).Y()*Coeff;
myPoles(2, i2plus2) = myPoles(1, i2plus2) + aTabV(k).Z()*Coeff;
i2 += 3;
}
for (k = 1; k<= myNbP2d; k++) {
i2plus1 = i2+1;
myPoles(2, i2) = myPoles(1, i2) + aTabV2d(k).X()*Coeff;
myPoles(2, i2plus1) = myPoles(1, i2plus1) + aTabV2d(k).Y()*Coeff;
i2 += 2;
}
for (i = 1; i <= classe; i++) {
Coeff = M(i, 1); Coeff2 = M(i, 2);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= myPoles(1, k)*Coeff+myPoles(2, k)*Coeff2;
}
}
}
if (myLastC == AppParCurves_TangencyPoint) {
bfin = classe-2;
SSP.D1(U1, aTabV2d, aTabV);
i2 = 1;
Coeff = (U1-U0)/myDegre;
for (k = 1; k<= myNbP; k++) {
i2plus1 = i2+1; i2plus2 = i2+2;
myPoles(cl1,i2) = myPoles(classe, i2) - aTabV(k).X()*Coeff;
myPoles(cl1,i2plus1) = myPoles(classe, i2plus1) - aTabV(k).Y()*Coeff;
myPoles(cl1,i2plus2) = myPoles(classe, i2plus2) - aTabV(k).Z()*Coeff;
i2 += 3;
}
for (k = 1; k<= myNbP2d; k++) {
i2plus1 = i2+1;
myPoles(cl1,i2) = myPoles(classe, i2) - aTabV2d(k).X()*Coeff;
myPoles(cl1,i2plus1) = myPoles(classe, i2plus1) - aTabV2d(k).Y()*Coeff;
i2 += 2;
}
for (i = 1; i <= classe; i++) {
Coeff = M(i, classe); Coeff2 = M(i, cl1);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= myPoles(classe, k)*Coeff + myPoles(cl1, k)*Coeff2;
}
}
}
if (bdeb <= bfin) {
math_Matrix B2(bdeb, bfin, 1, B.UpperCol(), 0.0);
for (i = bdeb; i <= bfin; i++) {
for (j = 1; j <= classe; j++) {
Coeff = M(i, j);
for (k = 1; k <= nbcol; k++) {
B2(i, k) += B(j, k)*Coeff;
}
}
}
// Resolution:
// ===========
math_Matrix IBP(bdeb, bfin, bdeb, bfin);
// dans IBPMatrix at IBTMatrix ne sont stockees que les resultats pour
// une classe inferieure ou egale a 26 (pour l instant du moins.)
if (bdeb == 2 && bfin == classe-1 && classe <= 26) {
IBPMatrix(classe, IBP);
}
else if (bdeb == 3 && bfin == classe-2 && classe <= 26) {
IBTMatrix(classe, IBP);
}
else {
math_Matrix MP(1, classe, bdeb, bfin);
for (i = 1; i <= classe; i++) {
for (j = bdeb; j <= bfin; j++) {
MP(i, j) = M(i, j);
}
}
math_Matrix IBP1(bdeb, bfin, bdeb, bfin);
IBP1 = MP.Transposed()*MP;
IBP = IBP1.Inverse();
}
myDone = Standard_True;
for (i = bdeb; i <= bfin; i++) {
for (j = bdeb; j <= bfin; j++) {
IBPij = IBP(i, j);;
for (k = 1; k<= nbcol; k++) {
myPoles(i, k) += IBPij * B2(j, k);
}
}
}
}
}
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const AppParCurves_MultiCurve& AppCont_LeastSquare::Value()
{
Standard_Integer i, j, j2;
gp_Pnt Pt;
gp_Pnt2d Pt2d;
Standard_Integer ideb = 1, ifin = myDegre+1;
// On met le resultat dans les curves correspondantes
for (i = ideb; i <= ifin; i++) {
j2 = 1;
AppParCurves_MultiPoint MPole(myNbP, myNbP2d);
for (j = 1; j <= myNbP; j++) {
Pt.SetCoord(myPoles(i, j2), myPoles(i, j2+1), myPoles(i,j2+2));
MPole.SetPoint(j, Pt);
j2 += 3;
}
for (j = myNbP+1;j <= myNbP+myNbP2d; j++) {
Pt2d.SetCoord(myPoles(i, j2), myPoles(i, j2+1));
MPole.SetPoint2d(j, Pt2d);
j2 += 2;
}
mySCU.SetValue(i, MPole);
}
return mySCU;
}
//=======================================================================
//function : Error
//purpose :
//=======================================================================
void AppCont_LeastSquare::Error(Standard_Real& F,
Standard_Real& MaxE3d,
Standard_Real& MaxE2d) const
{
Standard_Integer i, j, k, c, i2, classe = myDegre + 1;
Standard_Real Coeff, err3d = 0.0, err2d = 0.0;
Standard_Integer ncol = myPoints.UpperCol() - myPoints.LowerCol() + 1;
math_Matrix MyPoints(1, myNbdiscret, 1, ncol);
MyPoints = myPoints;
MaxE3d = MaxE2d = F = 0.0;
NCollection_Array1<Standard_Real> tmppoles(1, ncol);
for (c = 1; c <= classe; c++)
{
for (k = 1; k <= ncol; k++)
{
tmppoles(k) = myPoles(c, k);
}
for (i = 1; i <= myNbdiscret; i++)
{
Coeff = myVB(c, i);
for (j = 1; j <= ncol; j++)
{
MyPoints(i, j) -= tmppoles(j) * Coeff;
}
}
}
Standard_Real e1, e2, e3;
for (i = 1; i <= myNbdiscret; i++)
{
i2 = 1;
for (j = 1; j<= myNbP; j++) {
e1 = MyPoints(i, i2);
e2 = MyPoints(i, i2+1);
e3 = MyPoints(i, i2+2);
err3d = e1*e1+e2*e2+e3*e3;
MaxE3d = Max(MaxE3d, err3d);
F += err3d;
i2 += 3;
}
for (j = 1; j<= myNbP2d; j++) {
e1 = MyPoints(i, i2);
e2 = MyPoints(i, i2+1);
err2d = e1*e1+e2*e2;
MaxE2d = Max(MaxE2d, err2d);
F += err2d;
i2 += 2;
}
}
MaxE3d = Sqrt(MaxE3d);
MaxE2d = Sqrt(MaxE2d);
}
//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean AppCont_LeastSquare::IsDone() const
{
return myDone;
}

View File

@@ -0,0 +1,504 @@
// Created on: 1995-03-14
// Created by: Modelistation
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef OCCT_DEBUG
#define No_Standard_OutOfRange
#define No_Standard_RangeError
#endif
#include <math.hxx>
#include <math_Vector.hxx>
#include <math_Matrix.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <TColgp_Array1OfVec.hxx>
#include <TColgp_Array1OfVec2d.hxx>
#include <AppParCurves_MultiPoint.hxx>
#include <AppCont_ContMatrices.hxx>
#include <PLib.hxx>
//=======================================================================
//function : AppCont_LeastSquare
//purpose :
//=======================================================================
AppCont_LeastSquare::AppCont_LeastSquare
(const MultiLine& SSP,
const Standard_Real U0,
const Standard_Real U1,
const AppParCurves_Constraint FirstCons,
const AppParCurves_Constraint LastCons,
const Standard_Integer Deg,
const Standard_Integer NbPoints):
SCU(Deg+1),
Points(1, NbPoints, 1, NbBColumns(SSP)),
Poles(1, Deg+1, 1, NbBColumns(SSP), 0.0),
myParam(1, NbPoints),
VB(1, Deg+1, 1, NbPoints)
{
Done = Standard_False;
Degre = Deg;
math_Matrix InvM(1, Deg+1, 1, Deg+1);
Standard_Integer i, j, k, c, i2;
Standard_Integer classe = Deg+1, cl1 = Deg;
Standard_Real U, dU, Coeff, Coeff2;
Standard_Real IBij, IBPij;
Standard_Integer FirstP = 1, LastP = NbPoints;
Standard_Integer nbcol = NbBColumns(SSP);
math_Matrix B(1, classe, 1, nbcol, 0.0);
Standard_Integer bdeb = 1, bfin = classe;
AppParCurves_Constraint myFirstC = FirstCons, myLastC = LastCons;
nbP = LineTool::NbP3d(SSP);
nbP2d = LineTool::NbP2d(SSP);
Standard_Integer mynbP = nbP, mynbP2d = nbP2d;
if (nbP == 0) mynbP = 1;
if (nbP2d == 0) mynbP2d = 1;
Standard_Integer i2plus1, i2plus2;
Nbdiscret = NbPoints;
TColgp_Array1OfPnt TabP(1, mynbP);
TColgp_Array1OfVec TabV(1, mynbP);
TColgp_Array1OfPnt2d TabP2d(1, mynbP2d);
TColgp_Array1OfVec2d TabV2d(1, mynbP2d);
Standard_Boolean Ok;
if (myFirstC == AppParCurves_TangencyPoint) {
if (nbP != 0 && nbP2d != 0) Ok=LineTool::D1(SSP, U0, TabV, TabV2d);
else if (nbP != 0) Ok=LineTool::D1(SSP, U0, TabV);
else Ok=LineTool::D1(SSP, U0, TabV2d);
if (!Ok) myFirstC = AppParCurves_PassPoint;
}
if (myLastC == AppParCurves_TangencyPoint) {
if (nbP != 0 && nbP2d != 0) Ok=LineTool::D1(SSP, U1, TabV, TabV2d);
else if (nbP != 0) Ok=LineTool::D1(SSP, U1, TabV);
else Ok=LineTool::D1(SSP, U1, TabV2d);
if (!Ok) myLastC = AppParCurves_PassPoint;
}
math_Vector GaussP(1, NbPoints), GaussW(1, NbPoints);
math::GaussPoints(NbPoints, GaussP);
math::GaussWeights(NbPoints, GaussW);
math_Vector TheWeights(1, NbPoints), VBParam(1, NbPoints);
dU = 0.5*(U1-U0);
// calcul et mise en ordre des parametres et des poids:
for (i = FirstP; i <= LastP; i++) {
U = 0.5*(U1+U0) + dU*GaussP(i);
if (i <= (NbPoints+1)/2) {
myParam(LastP-i+1) = U;
VBParam(LastP-i+1) = 0.5*(1 + GaussP(i));
TheWeights(LastP-i+1) = 0.5*GaussW(i);
}
else {
VBParam(i-(NbPoints+1)/2) = 0.5*(1 + GaussP(i));
myParam(i-(NbPoints+1)/2) = U;
TheWeights(i-(NbPoints+1)/2) = 0.5*GaussW(i);
}
}
for (i = FirstP; i <= LastP; i++) {
U = myParam(i);
if (nbP != 0 && nbP2d != 0) LineTool::Value(SSP, U, TabP, TabP2d);
else if (nbP != 0) LineTool::Value(SSP, U, TabP);
else LineTool::Value(SSP, U, TabP2d);
i2 = 1;
for (j = 1; j <= nbP; j++) {
(TabP(j)).Coord(Points(i, i2), Points(i, i2+1), Points(i, i2+2));
i2 += 3;
}
for (j = 1; j <= nbP2d; j++) {
(TabP2d(j)).Coord(Points(i, i2), Points(i, i2+1));
i2 += 2;
}
}
// Calcul du VB ( Valeur des fonctions de Bernstein):
// for (i = 1; i <= classe; i++) {
// for (j = 1; j <= NbPoints; j++) {
// VB(i,j)=PLib::Binomial(cl1,i-1)*Pow((1-VBParam(j)),classe-i)*
// Pow(VBParam(j),i-1);
// }
// }
VBernstein(classe, NbPoints, VB);
// Traitement du second membre:
Standard_Real *tmppoints, *tmpbis;
tmppoints = new Standard_Real[nbcol];
for (c = 1; c <= classe; c++) {
tmpbis = tmppoints;
for (k = 1; k <= nbcol; k++, tmpbis++) {
*tmpbis = 0.0;
}
for (i = 1; i <= NbPoints; i++) {
Coeff = TheWeights(i)*VB(c, i);
tmpbis = tmppoints;
for (j = 1; j <= nbcol; j++, tmpbis++) {
*tmpbis += Points(i, j)*Coeff;
//B(c, j) += Points(i, j)*Coeff;
}
}
tmpbis = tmppoints;
for (k = 1; k <= nbcol; k++, tmpbis++) {
B(c, k) += *tmpbis;
}
}
delete [] tmppoints;
if (myFirstC == AppParCurves_NoConstraint &&
myLastC == AppParCurves_NoConstraint) {
math_Matrix InvM(1, classe, 1, classe);
InvMMatrix(classe, InvM);
// Calcul direct des poles:
for (i = 1; i <= classe; i++) {
for (j = 1; j <= classe; j++) {
IBij = InvM(i, j);
for (k = 1; k <= nbcol; k++) {
Poles(i, k) += IBij * B(j, k);
}
}
}
}
else {
math_Matrix M(1, classe, 1, classe);
MMatrix(classe, M);
if (myFirstC == AppParCurves_PassPoint ||
myFirstC == AppParCurves_TangencyPoint) {
if (nbP != 0 && nbP2d != 0) LineTool::Value(SSP, U0, TabP, TabP2d);
else if (nbP != 0) LineTool::Value(SSP, U0, TabP);
else LineTool::Value(SSP, U0, TabP2d);
i2 =1;
for (k = 1; k<= nbP; k++) {
(TabP(k)).Coord(Poles(1, i2), Poles(1, i2+1), Poles(1, i2+2));
i2 += 3;
}
for (k = 1; k<= nbP2d; k++) {
(TabP2d(k)).Coord(Poles(1, i2), Poles(1, i2+1));
i2 += 2;
}
}
if (myLastC == AppParCurves_PassPoint ||
myLastC == AppParCurves_TangencyPoint) {
i2 = 1;
if (nbP != 0 && nbP2d != 0) LineTool::Value(SSP, U1, TabP, TabP2d);
else if (nbP != 0) LineTool::Value(SSP, U1, TabP);
else LineTool::Value(SSP, U1, TabP2d);
for (k = 1; k<= nbP; k++) {
(TabP(k)).Coord(Poles(classe,i2),
Poles(classe,i2+1),
Poles(classe,i2+2));
i2 += 3;
}
for (k = 1; k<= nbP2d; k++) {
(TabP2d(k)).Coord(Poles(classe, i2), Poles(classe, i2+1));
i2 += 2;
}
}
if (myFirstC == AppParCurves_PassPoint) {
bdeb = 2;
// mise a jour du second membre:
for (i = 1; i <= classe; i++) {
Coeff = M(i, 1);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= Poles(1, k)*Coeff;
}
}
}
if (myLastC == AppParCurves_PassPoint) {
bfin = cl1;
for (i = 1; i <= classe; i++) {
Coeff = M(i, classe);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= Poles(classe, k)*Coeff;
}
}
}
if (myFirstC == AppParCurves_TangencyPoint) {
// On fixe le second pole::
bdeb = 3;
if (nbP != 0 && nbP2d != 0) LineTool::D1(SSP, U0, TabV, TabV2d);
else if (nbP != 0) LineTool::D1(SSP, U0, TabV);
else LineTool::D1(SSP, U0, TabV2d);
i2 = 1;
Coeff = (U1-U0)/Degre;
for (k = 1; k<= nbP; k++) {
i2plus1 = i2+1; i2plus2 = i2+2;
Poles(2, i2) = Poles(1, i2) + TabV(k).X()*Coeff;
Poles(2, i2plus1) = Poles(1, i2plus1) + TabV(k).Y()*Coeff;
Poles(2, i2plus2) = Poles(1, i2plus2) + TabV(k).Z()*Coeff;
i2 += 3;
}
for (k = 1; k<= nbP2d; k++) {
i2plus1 = i2+1;
Poles(2, i2) = Poles(1, i2) + TabV2d(k).X()*Coeff;
Poles(2, i2plus1) = Poles(1, i2plus1) + TabV2d(k).Y()*Coeff;
i2 += 2;
}
for (i = 1; i <= classe; i++) {
Coeff = M(i, 1); Coeff2 = M(i, 2);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= Poles(1, k)*Coeff+Poles(2, k)*Coeff2;
}
}
}
if (myLastC == AppParCurves_TangencyPoint) {
bfin = classe-2;
if (nbP != 0 && nbP2d != 0) LineTool::D1(SSP, U1, TabV, TabV2d);
else if (nbP != 0) LineTool::D1(SSP, U1, TabV);
else LineTool::D1(SSP, U1, TabV2d);
i2 = 1;
Coeff = (U1-U0)/Degre;
for (k = 1; k<= nbP; k++) {
i2plus1 = i2+1; i2plus2 = i2+2;
Poles(cl1,i2) = Poles(classe, i2) - TabV(k).X()*Coeff;
Poles(cl1,i2plus1) = Poles(classe, i2plus1) - TabV(k).Y()*Coeff;
Poles(cl1,i2plus2) = Poles(classe, i2plus2) - TabV(k).Z()*Coeff;
i2 += 3;
}
for (k = 1; k<= nbP2d; k++) {
i2plus1 = i2+1;
Poles(cl1,i2) = Poles(classe, i2) - TabV2d(k).X()*Coeff;
Poles(cl1,i2plus1) = Poles(classe, i2plus1) - TabV2d(k).Y()*Coeff;
i2 += 2;
}
for (i = 1; i <= classe; i++) {
Coeff = M(i, classe); Coeff2 = M(i, cl1);
for (k = 1; k <= nbcol; k++) {
B(i, k) -= Poles(classe, k)*Coeff + Poles(cl1, k)*Coeff2;
}
}
}
if (bdeb <= bfin) {
math_Matrix B2(bdeb, bfin, 1, B.UpperCol(), 0.0);
for (i = bdeb; i <= bfin; i++) {
for (j = 1; j <= classe; j++) {
Coeff = M(i, j);
for (k = 1; k <= nbcol; k++) {
B2(i, k) += B(j, k)*Coeff;
}
}
}
// Resolution:
// ===========
math_Matrix IBP(bdeb, bfin, bdeb, bfin);
// dans IBPMatrix at IBTMatrix ne sont stockees que les resultats pour
// une classe inferieure ou egale a 26 (pour l instant du moins.)
if (bdeb == 2 && bfin == classe-1 && classe <= 26) {
IBPMatrix(classe, IBP);
}
else if (bdeb == 3 && bfin == classe-2 && classe <= 26) {
IBTMatrix(classe, IBP);
}
else {
math_Matrix MP(1, classe, bdeb, bfin);
for (i = 1; i <= classe; i++) {
for (j = bdeb; j <= bfin; j++) {
MP(i, j) = M(i, j);
}
}
math_Matrix IBP1(bdeb, bfin, bdeb, bfin);
IBP1 = MP.Transposed()*MP;
IBP = IBP1.Inverse();
}
Done = Standard_True;
for (i = bdeb; i <= bfin; i++) {
for (j = bdeb; j <= bfin; j++) {
IBPij = IBP(i, j);;
for (k = 1; k<= nbcol; k++) {
Poles(i, k) += IBPij * B2(j, k);
}
}
}
}
}
}
//=======================================================================
//function : NbBColumns
//purpose :
//=======================================================================
Standard_Integer AppCont_LeastSquare::NbBColumns(
const MultiLine& SSP) const
{
Standard_Integer BCol;
BCol = (LineTool::NbP3d(SSP))*3 +
(LineTool::NbP2d(SSP))*2;
return BCol;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const AppParCurves_MultiCurve& AppCont_LeastSquare::Value()
{
Standard_Integer i, j, j2;
gp_Pnt Pt;
gp_Pnt2d Pt2d;
Standard_Integer ideb = 1, ifin = Degre+1;
// On met le resultat dans les curves correspondantes
for (i = ideb; i <= ifin; i++) {
j2 = 1;
AppParCurves_MultiPoint MPole(nbP, nbP2d);
for (j = 1; j <= nbP; j++) {
Pt.SetCoord(Poles(i, j2), Poles(i, j2+1), Poles(i,j2+2));
MPole.SetPoint(j, Pt);
j2 += 3;
}
for (j = nbP+1;j <= nbP+nbP2d; j++) {
Pt2d.SetCoord(Poles(i, j2), Poles(i, j2+1));
MPole.SetPoint2d(j, Pt2d);
j2 += 2;
}
SCU.SetValue(i, MPole);
}
return SCU;
}
//=======================================================================
//function : Error
//purpose :
//=======================================================================
void AppCont_LeastSquare::Error(Standard_Real& F,
Standard_Real& MaxE3d,
Standard_Real& MaxE2d) const
{
Standard_Integer i, j, k, c, i2, classe = Degre+1;
// Standard_Real Coeff, val = 0.0, err3d = 0.0, err2d =0.0;
Standard_Real Coeff, err3d = 0.0, err2d =0.0;
Standard_Integer ncol = Points.UpperCol()-Points.LowerCol()+1;
math_Matrix MyPoints(1, Nbdiscret, 1, ncol);
MyPoints = Points;
MaxE3d = MaxE2d = F = 0.0;
Standard_Real *tmppoles, *tmpbis;
tmppoles = new Standard_Real[ncol];
for (c = 1; c <= classe; c++) {
tmpbis = tmppoles;
for (k = 1; k <= ncol; k++, tmpbis++) {
*tmpbis = Poles(c, k);
}
for (i = 1; i <= Nbdiscret; i++) {
Coeff = VB(c, i);
tmpbis = tmppoles;
for (j = 1; j <= ncol; j++, tmpbis++) {
MyPoints(i, j) -= (*tmpbis)*Coeff; // Poles(c, j)*Coeff;
}
}
}
delete [] tmppoles;
Standard_Real e1, e2, e3;
for (i = 1; i <= Nbdiscret; i++) {
i2 = 1;
for (j = 1; j<= nbP; j++) {
e1 = MyPoints(i, i2);
e2 = MyPoints(i, i2+1);
e3 = MyPoints(i, i2+2);
err3d = e1*e1+e2*e2+e3*e3;
MaxE3d = Max(MaxE3d, err3d);
F += err3d;
i2 += 3;
}
for (j = 1; j<= nbP2d; j++) {
e1 = MyPoints(i, i2);
e2 = MyPoints(i, i2+1);
err2d = e1*e1+e2*e2;
MaxE2d = Max(MaxE2d, err2d);
F += err2d;
i2 += 2;
}
}
MaxE3d = Sqrt(MaxE3d);
MaxE2d = Sqrt(MaxE2d);
}
//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
Standard_Boolean AppCont_LeastSquare::IsDone() const
{
return Done;
}

View File

@@ -1,75 +0,0 @@
// Created on: 1995-03-14
// Created by: Modelistation
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AppCont_LeastSquare_HeaderFile
#define AppCont_LeastSquare_HeaderFile
#include <AppCont_Function.hxx>
#include <AppParCurves_MultiCurve.hxx>
#include <math_Vector.hxx>
#include <math_Matrix.hxx>
#include <NCollection_Array1.hxx>
#include <AppParCurves_Constraint.hxx>
struct PeriodicityInfo
{
Standard_Boolean isPeriodic;
Standard_Real myPeriod;
};
class AppCont_LeastSquare
{
public:
Standard_EXPORT AppCont_LeastSquare(const AppCont_Function& SSP,
const Standard_Real U0,
const Standard_Real U1,
const AppParCurves_Constraint FirstCons,
const AppParCurves_Constraint LastCons,
const Standard_Integer Deg,
const Standard_Integer NbPoints);
Standard_EXPORT const AppParCurves_MultiCurve& Value();
Standard_EXPORT void Error(Standard_Real& F,
Standard_Real& MaxE3d,
Standard_Real& MaxE2d) const;
Standard_EXPORT Standard_Boolean IsDone() const;
private:
//! Fix border point evaluation.
void FixSingleBorderPoint(const AppCont_Function& theSSP,
const Standard_Real theU,
const Standard_Real theU0,
const Standard_Real theU1,
NCollection_Array1<gp_Pnt2d>& theFix2d,
NCollection_Array1<gp_Pnt>& theFix);
AppParCurves_MultiCurve mySCU;
math_Matrix myPoints;
math_Matrix myPoles;
math_Vector myParam;
math_Matrix myVB;
NCollection_Array1<PeriodicityInfo> myPerInfo;
Standard_Boolean myDone;
Standard_Integer myDegre;
Standard_Integer myNbdiscret, myNbP, myNbP2d;
};
#endif

View File

@@ -4,6 +4,3 @@ AppCont_ContMatrices_1.cxx
AppCont_ContMatrices_2.cxx
AppCont_ContMatrices_3.cxx
AppCont_ContMatrices_4.cxx
AppCont_Function.hxx
AppCont_LeastSquare.hxx
AppCont_LeastSquare.cxx

View File

@@ -62,7 +62,7 @@ end;
generic class ComputeLine, MyGradient;
generic class ComputeCLine;
generic class ComputeCLine, MyLeastSquare;
----------------------------------------------
---Algorithms for BSpline curves construction:
@@ -108,10 +108,10 @@ end;
-----------------------------------------------------------------
class FitAndDivide instantiates ComputeCLine from Approx
(Function from AppCont);
(Function from AppCont, FunctionTool from AppCont);
class FitAndDivide2d instantiates ComputeCLine from Approx
(Function from AppCont);
(Function2d from AppCont, FunctionTool2d from AppCont);
class SameParameter from Approx ;

View File

@@ -15,7 +15,8 @@
-- commercial license or contractual agreement.
generic class ComputeCLine from Approx
(MultiLine as any)
(MultiLine as any;
LineTool as any)
---Purpose: Approximate a continous MultiLine with a cutting.
-- The Tool of the line is the tool from AppCont.
@@ -28,6 +29,11 @@ uses ParametrizationType from Approx,
Vector from math
private class MyLeastSquare instantiates LeastSquare from AppCont
(MultiLine,
LineTool);
is
@@ -154,7 +160,7 @@ currenttol3d: Real;
currenttol2d: Real;
mycut: Boolean;
myfirstC: Constraint;
mylastC: Constraint;
mylastC: Constraint;
end ComputeCLine;

View File

@@ -19,7 +19,7 @@
#include <Approx_ParametrizationType.hxx>
#include <AppCont_LeastSquare.hxx>
#include Approx_MyLeastSquare_hxx
#include <TColStd_Array1OfReal.hxx>
#include <AppParCurves_Constraint.hxx>
#include <Approx_Status.hxx>
@@ -89,17 +89,15 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
Standard_Boolean Finish = Standard_False,
begin = Standard_True, Ok = Standard_False;
Standard_Real thetol3d = Precision::Confusion(), thetol2d = Precision::Confusion();
UFirst = Line.FirstParameter();
ULast = Line.LastParameter();
UFirst = LineTool::FirstParameter(Line);
ULast = LineTool::LastParameter(Line);
Standard_Real TolU = (ULast-UFirst)*1.e-05;
Standard_Real myfirstU = UFirst;
Standard_Real mylastU = ULast;
if (!mycut)
{
if (!mycut) {
alldone = Compute(Line, UFirst, ULast, thetol3d, thetol2d);
if (!alldone)
{
if (!alldone) {
tolreached = Standard_False;
myfirstparam.Append(UFirst);
mylastparam.Append(ULast);
@@ -108,69 +106,70 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
Tolers2d.Append(currenttol2d);
}
}
else
{
else {
// previous decision to be taken if we get worse with next cut (eap)
AppParCurves_MultiCurve KeptMultiCurve;
Standard_Real KeptUfirst = 0., KeptUlast = 0., KeptT3d = RealLast(), KeptT2d = 0.;
Standard_Integer NbWorseDecis = 0, NbAllowedBadDecis = 10;
while (!Finish)
{
while (!Finish) {
// Gestion du decoupage de la multiline pour approximer:
if (!begin)
{
if (Ok)
{
// Calcul de la partie a approximer.
myfirstU = mylastU;
mylastU = ULast;
if (Abs(ULast-myfirstU) <= RealEpsilon())
{
Finish = Standard_True;
alldone = Standard_True;
return;
}
KeptT3d = RealLast(); KeptT2d = 0;
KeptUfirst = myfirstU;
KeptUlast = mylastU;
}
else
{
// keep best decison
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d))
{
KeptMultiCurve = TheMultiCurve;
KeptUfirst = myfirstU;
KeptUlast = mylastU;
KeptT3d = thetol3d;
KeptT2d = thetol2d;
}
// cut an interval
mylastU = (myfirstU + mylastU)/2;
}
if (!begin) {
if (Ok) {
// Calcul de la partie a approximer.
myfirstU = mylastU;
mylastU = ULast;
if (Abs(ULast-myfirstU) <= RealEpsilon()) {
Finish = Standard_True;
alldone = Standard_True;
return;
}
KeptT3d = RealLast(); KeptT2d = 0;
NbWorseDecis = 0;
}
else {
// keep best decison
if ((thetol3d + thetol2d) < (KeptT3d + KeptT2d)) {
KeptMultiCurve = TheMultiCurve;
KeptUfirst = myfirstU;
KeptUlast = mylastU;
KeptT3d = thetol3d;
KeptT2d = thetol2d;
}
// cut an interval
mylastU = (myfirstU + mylastU)/2;
}
}
if (Abs(myfirstU-mylastU) <= TolU) /*break;*/ // pour ne pas planter
NbAllowedBadDecis /= 2; // la station.
// Calcul des parametres sur ce nouvel intervalle.
Ok = Compute(Line, myfirstU, mylastU, thetol3d, thetol2d);
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
// is new decision better?
if (!Ok && Abs(myfirstU-mylastU) <= TolU)
if ( !Ok && (thetol3d + thetol2d) > (KeptT3d + KeptT2d) )
{
Ok = Standard_True; // stop interval cutting, approx the rest part
mylastU = KeptUlast;
NbWorseDecis++;
tolreached = Standard_False; // helas
myMultiCurves.Append(KeptMultiCurve);
Tolers3d.Append (KeptT3d);
Tolers2d.Append (KeptT2d);
myfirstparam.Append (KeptUfirst);
mylastparam.Append (KeptUlast);
}
if (NbWorseDecis > NbAllowedBadDecis) {
Ok = Standard_True; // stop interval cutting, approx the rest part
mylastU = KeptUlast;
tolreached = Standard_False; // helas
myMultiCurves.Append(KeptMultiCurve);
Tolers3d.Append (KeptT3d);
Tolers2d.Append (KeptT2d);
myfirstparam.Append (KeptUfirst);
mylastparam.Append (KeptUlast);
}
}
begin = Standard_False;
} // while (!Finish)
@@ -219,7 +218,8 @@ Standard_Boolean Approx_ComputeCLine::Compute(const MultiLine& Line,
for (deg = mydegremin; deg <= mydegremax; deg++) {
AppParCurves_MultiCurve mySCU(deg+1);
AppCont_LeastSquare LSquare(Line, Ufirst, Ulast, myfirstC, mylastC, deg, NbPoints);
Approx_MyLeastSquare LSquare(Line, Ufirst, Ulast, myfirstC, mylastC,
deg, NbPoints);
mydone = LSquare.IsDone();
if (mydone) {
LSquare.Error(Fv, TheTol3d, TheTol2d);

View File

@@ -269,14 +269,6 @@ static Standard_Boolean Check(const TColStd_Array1OfReal& FlatKnots,
Standard_Real firstborne= 3.*pc3d(1) - 2.*pc3d(nbp);
Standard_Real lastborne = 3.*pc3d(nbp) - 2.*pc3d(1);
// Modified by skv - Wed Jun 2 11:50:03 2004 OCC5898 End
//jgv
Standard_Real FirstPar = cons.FirstParameter();
Standard_Real LastPar = cons.LastParameter();
if (firstborne < FirstPar)
firstborne = FirstPar;
if (lastborne > LastPar)
lastborne = LastPar;
/////
for(i = 0; i <= nn; i++){
Standard_Real t = unsurnn*i;
Standard_Real tc3d = pc3d(1)*(1.-t) + pc3d(nbp)*t;

View File

@@ -13,6 +13,32 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Package: Aspect
-- Updated: Vendredi 2 Octobre 1992
-- Mercredi 31 mars 1993
-- Lundi 16 janvier 1995
-- Reason : Traitement des Markers (G400)
-- Purpose: Specifications definitives
-- Modified: 15/01/98 ; FMN : Ajout Hidden Line
-- Modified: 24/08/98 ; CAL : S3892. Ajout grilles 3d.
-- Modified: 16-09-98 by BGN (S3989)
--- Adding TypeOfTriedronEcho, TypeOfTriedronPosition.
-- Modified: 30-11-98 ; FMN : S4069. Textes always visible.
-- Modified: 17-NOV-99 : GG GER61351
-- Add TypeOfFacingModel enum
-- Modified: 20-JAN-00 : GG
-- Add GDM_None in enum GridDrawMode.
-- Modified: 25-JAN-00 : VKH
-- Add class PixMap
-- Modified: 23-FEB-00 : GG
-- Returns format name in ValuesOfFOSP() internal method.
-- Modified: 27-03-02 RIC120302 GG Add imported class
-- Display, Drawable, RenderingContext, GraphicCallbackProc
-- Modified: 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
-- Modified: 21-06-04 STV Added Aspect_ColorScale class
------------------------------------------------------------------------
package Aspect
---Version:
@@ -80,6 +106,9 @@ is
exception BadAccess inherits DomainError;
---Category: Exceptions
exception EdgeDefinitionError inherits OutOfRange;
---Category: Exceptions
exception IdentDefinitionError inherits OutOfRange;
---Category: Exceptions
@@ -121,6 +150,9 @@ is
class GradientBackground;
---Category: Classes
class Edge;
---Category: Classes
class GenId;
---Category: Classes
@@ -260,6 +292,29 @@ is
-- WOL_USERDEFINED defined by Users
---Category: Enumerations
enumeration TypeOfFont is TOF_DEFAULT,
TOF_COURIER,
TOF_HELVETICA,
TOF_TIMES,
TOF_USERDEFINED
end TypeOfFont;
---Purpose: Definition of line types
--
-- TOF_DEFAULT Default system font
-- TOF_COURIER
-- TOF_HELVETICA
-- TOF_USERDEFINED defined by Users
---Category: Enumerations
enumeration TypeOfText is TOT_SOLID,
TOT_OUTLINE
end TypeOfText;
---Purpose: Definition of Text types
--
-- TOF_SOLID Default text
-- TOF_OUTLINE
---Category: Enumerations
enumeration TypeOfStyleText is TOST_NORMAL,
TOST_ANNOTATION
end TypeOfStyleText;
@@ -352,6 +407,54 @@ is
---Purpose: Defines the type of Resize Window method applied
-- by the user.
enumeration CardinalPoints is CP_North,
CP_NorthEast,
CP_East,
CP_SouthEast,
CP_South,
CP_SouthWest,
CP_West,
CP_NorthWest,
CP_Center
end CardinalPoints;
enumeration TypeOfRenderingMode is TORM_IMMEDIAT,
TORM_RETAIN,
TORM_CLEAR_AND_RETAIN
end TypeOfRenderingMode;
---Purpose: Definition of the rendering modes
enumeration TypeOfColorSpace is TOCS_BlackAndWhite,
TOCS_GreyScale,
TOCS_RGB
end TypeOfColorSpace;
---Purpose:
enumeration FormatOfSheetPaper is
FOSP_A0, -- 0.841 x 1.189 (M)
FOSP_A1, -- 0.594 x 0.841 (M)
FOSP_A2, -- 0.420 x 0.594 (M)
FOSP_A3, -- 0.297 x 0.420 (M)
FOSP_A4, -- 0.210 x 0.297 (M)
FOSP_A5, -- 0.1485 x 0.210 (M)
FOSP_K_LONG, -- 1.016 x 3.6322 (M)
FOSP_K_SHORT, -- 1.016 x 1.397 (M)
FOSP_J_LONG, -- 0.8636 x 4.4704 (M)
FOSP_J_SHORT, -- 0.8636 x 1.397 (M)
FOSP_H_LONG, -- 0.7112 x 3.6322 (M)
FOSP_H_SHORT, -- 0.7112 x 1.1176 (M)
FOSP_G_LONG, -- 0.2794 x 2.286 (M)
FOSP_G_SHORT, -- 0.2794 x 0.5715 (M)
FOSP_F, -- 0.7112 x 1.016 (M)
FOSP_E, -- 0.8636 x 1.1176 (M)
FOSP_D, -- 0.5588 x 0.8636 (M)
FOSP_C, -- 0.4318 x 0.5588 (M)
FOSP_B, -- 0.2794 x 0.4318 (M)
FOSP_A, -- 0.2159 x 0.2794 (M)
FOSP_UNKNOWN -- User defined
end FormatOfSheetPaper;
---Purpose:
enumeration TypeOfPrimitive is
TOP_UNKNOWN,
TOP_POLYLINE,
@@ -526,7 +629,37 @@ is
-- Category: Instantiated classes
---------------------------------
class Array1OfEdge instantiates
Array1 from TCollection (Edge from Aspect);
---Category: Instantiated classes
class SequenceOfColor instantiates
Sequence from TCollection(Color from Quantity);
----------------------------
-- Category: Package methods
----------------------------
ValuesOfFOSP (aFOSP : FormatOfSheetPaper from Aspect;
aWidth, aHeight : out Length from Quantity)
returns CString from Standard;
---Level: Internal
---Purpose: Returns the format size according to the default
-- LENGTH unit of the required format <aFOSP>.
-- Returns more the normalized format name.
---Category: Package methods
ToCString (aString: ExtendedString from TCollection)
returns CString from Standard;
---Level: Internal
---Purpose: Translates an ExtendedString to a CString
-- depending of the local format.
---Category: Package methods
Inverse ( aMat : Array2OfReal from TColStd;
Inv : out Array2OfReal from TColStd )
returns Boolean from Standard;
---Level: Internal
---Purpose: Inverses <aMat> a 4x4 matrix.
end Aspect;

288
src/Aspect/Aspect.cxx Normal file
View File

@@ -0,0 +1,288 @@
// Created by: CAL
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#define XTRACE
#define UNICOD //GG_041196
// Conformite UNICODE
// Modified 22/12/97 : FMN ; Remplacement getenv par OSD_Environment
// 27/12/98 : FMN ; PERF: OPTIMISATION LOADER (LOPTIM)
// JR 02.01.100 : Implicit conversions
//-Design Implementation des methodes de package
#include <Aspect.hxx>
#include <Aspect_Units.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#ifdef UNICOD
#include <Resource_Unicode.hxx>
#include <stdlib.h>
#endif
#include <TColStd_Array2OfReal.hxx>
#include <OSD_Environment.hxx>
# include <stdio.h>
// Valeurs en cms !
static Quantity_Length Widths[20] = {
84.1, 59.4, 42.0, 29.7, 21.0,
14.85, 101.6, 101.6, 86.36, 86.36,
71.12, 71.12, 27.94, 27.94, 71.12,
86.36, 55.88, 43.18, 27.94, 21.59
};
static Quantity_Length Heights[20] = {
118.9, 84.1, 59.4, 42.0, 29.7,
21.0, 363.22, 139.7, 447.04, 139.7,
363.22, 111.76, 228.6, 57.15, 101.6,
111.76, 86.36, 55.88, 43.18, 27.94
};
static Standard_CString Fnames[] = {
"A0","A1","A2","A3","A4","A5","KL","KS","JL","JS","HL","HS","GL","GS","F","E","D","C","B","A"
};
#define LOPTIM
#ifndef LOPTIM
static TCollection_AsciiString astring;
static TCollection_ExtendedString estring;
#else
static TCollection_AsciiString& _astring() {
static TCollection_AsciiString astring;
return astring;
}
#define astring _astring()
static TCollection_ExtendedString& _estring() {
static TCollection_ExtendedString estring;
return estring;
}
#define estring _estring()
#endif // LOPTIM
// Returns size in meters
Standard_CString Aspect::ValuesOfFOSP (
const Aspect_FormatOfSheetPaper aFOSP,
Quantity_Length& Width,
Quantity_Length& Height) {
Standard_Integer Index = Standard_Integer (aFOSP);
Width = Quantity_Length (Widths[Index]) CENTIMETER;
Height = Quantity_Length (Heights[Index]) CENTIMETER;
return Fnames[Index];
}
//=========================================================================
Standard_CString Aspect::ToCString(const TCollection_ExtendedString &aString) {
Standard_PCharacter pstring;
#ifdef UNICOD
Standard_Integer max_string = 2*aString.Length() + 2;
astring = TCollection_AsciiString(max_string,' ');
pstring = (Standard_PCharacter)astring.ToCString();
estring = aString;
Resource_FormatType aType = Resource_Unicode::GetFormat();
if( (aType == Resource_EUC) || (aType == Resource_SJIS) ) {
Standard_Integer i;
Standard_ExtCharacter c;
for( i=1 ; i<=aString.Length() ; i++ ) {
c = estring.Value(i);
if( (c >= 0) && (c <= Standard_ExtCharacter(0x0020)) ) {
c = Standard_ExtCharacter(0x3000);
estring.SetValue(i,c);
} else if( (c > Standard_ExtCharacter(0x0020)) &&
(c <= Standard_ExtCharacter(0x007F)) ) {
c += Standard_ExtCharacter((unsigned short)0xFEE0);
estring.SetValue(i,c);
}
}
}
// char *jf = getenv("CSF_JIS_Font");
// if (((aType == Resource_EUC) || (aType == Resource_SJIS)) && (jf!=((char *)0))) {
OSD_Environment aVariable("CSF_JIS_Font");
TCollection_AsciiString jf(aVariable.Value());
if (((aType == Resource_EUC) || (aType == Resource_SJIS)) && (jf.Length() != 0)) {
Standard_PCharacter p;
Resource_Unicode::ConvertUnicodeToEUC(estring,
pstring,
max_string);
p=(Standard_PCharacter)pstring;
while ((*p)!='\0') {
*p &= 0x7F ;
p++;
}
}
else if( !Resource_Unicode::ConvertUnicodeToFormat(estring,
pstring,
max_string) )
printf(" Aspect::ToCString.BAD string length %d\n",max_string);
#else
if( aString.IsAscii() ) {
astring = aString; pstring = astring.ToCString();
} else {
pstring = (Standard_CString) aString.ToExtString();
}
#endif
return pstring;
}
Standard_Boolean Aspect::Inverse (const TColStd_Array2OfReal& aMat, TColStd_Array2OfReal& Result) {
Standard_Integer lr, ur, lc, uc;
Standard_Integer i, j, k, l;
Standard_Boolean BResult = Standard_False;
lr = aMat.LowerRow ();
ur = aMat.UpperRow ();
lc = aMat.LowerCol ();
uc = aMat.UpperCol ();
if ( (ur - lr + 1 != 4) || (uc - lc + 1 != 4) ) {
#ifdef TRACE
cout << "Inverse () : aMat not a 4x4 matrix" << endl << flush;
cout << "Inverse returns False => Error\n" << flush;
#endif
return BResult;
}
lr = Result.LowerRow ();
ur = Result.UpperRow ();
lc = Result.LowerCol ();
uc = Result.UpperCol ();
if ( (ur - lr + 1 != 4) || (uc - lc + 1 != 4) ) {
#ifdef TRACE
cout << "Inverse () : Result not a 4x4 matrix" << endl << flush;
cout << "Inverse returns False => Error\n" << flush;
#endif
return BResult;
}
Standard_Integer ip1;
float a [5][9];
float amax, p;
int tperm [5][3];
int perm = 0;
for (i=1; i<=4; i++)
for (j=1; j<=4; j++) {
// a [i][j] = aMat (lr + i - 1, lc + j - 1);
a [i][j] = (float ) aMat (lr + i - 1, lc + j - 1);
if (i == j) Result (lr + i - 1, lc + j - 1) = 1.;
else Result (lr + i - 1, lc + j - 1) = 0.;
}
for (i=1; i<=4; i++)
for (j=5; j<=8; j++)
if (i == j-4) a [i][j] = 1.;
else a [i][j] = 0.;
#ifdef TRACE
cout << "Matrice :\n";
for (i=1; i<=4; i++) {
for (j=1; j<=4; j++)
cout << a [i][j] << " ";
cout << endl;
}
cout << flush;
#endif
for (i=1; i<=4; i++) {
ip1 = i + 1;
if (ip1 <= 4) {
/* Recherche pivot maximal */
l = i;
// amax = fabs (a [i][i]);
amax = (float ) fabs (a [i][i]);
for (k=ip1; k<=4; k++) {
if (amax < fabs (a [k][i])) {
l = k;
// amax = fabs (a [k][i]);
amax = (float ) fabs (a [k][i]);
} /* if (amax < abs (a [k][i])) */
}
/* Permutation eventuelle */
if (l != i) {
#ifdef TRACE
cout << "permutation des lignes "
<< l << " et " << i << "\n" << flush;
#endif
perm ++;
tperm [perm][1] = l;
tperm [perm][2] = i;
for (j=1; j<=4; j++) {
p = a [i][j];
a [i][j] = a [l][j];
a [l][j] = p;
}
} /* if (l != i) */
} /* if (ip1 <= 4) */
p = a [i][i];
if (p == 0.) {
#ifdef TRACE
cout << "p == 0.\n" << flush;
cout << "Inverse returns False => Error\n" << flush;
#endif
return BResult;
}
/* Substitution */
for (j=1; j<=4; j++)
a [i][j] = a [i][j]/p;
for (k=1; k<=4; k++)
if (k != i)
for (j=1; j<=4; j++)
if (j != i) a [k][j] = a [k][j] - a [k][i]*a [i][j];
for (k=1; k<=4; k++)
a [k][i] = - a [k][i]/p;
a [i][i] = - a [i][i];
} /* for (i=1; i<=4; i++) */
/* Remise en ordre */
for (k=perm; k>0; k--) {
#ifdef TRACE
cout << "permutation des colonnes "
<< tperm[k][1] << " et " << tperm[k][2] << "\n" << flush;
#endif
for (i=1; i<=4; i++) {
p = a [i][tperm[k][1]];
a [i][tperm[k][1]] = a [i][tperm[k][2]];
a [i][tperm[k][2]] = p;
}
}
for (i=1; i<=4; i++)
for (j=1; j<=4; j++)
Result (lr + i - 1, lc + j - 1) = a [i][j];
#ifdef TRACE
cout << "Inverse :\n";
for (i=lr; i<=ur; i++) {
for (j=lc; j<=uc; j++)
cout << Result (i, j) << " ";
cout << endl;
}
cout << "Inverse returns True => Ok\n" << flush;
#endif
return Standard_True;
}

116
src/Aspect/Aspect_Edge.cdl Normal file
View File

@@ -0,0 +1,116 @@
-- Created on: 1991-11-04
-- Created by: NW,JPB,CAL
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Edge from Aspect
---Version:
---Purpose: This class allows the definition of an edge.
---Keywords: Edge, Visible, Invisible, Border, Line, Face
---Warning:
---References:
uses
TypeOfEdge from Aspect
raises
EdgeDefinitionError from Aspect
is
Create
returns Edge from Aspect;
---Level: Public
---Purpose: Creates an edge.
Create ( AIndex1, AIndex2 : Integer from Standard;
AType : TypeOfEdge from Aspect )
returns Edge from Aspect
---Level: Public
---Purpose: Creates an edge from an index of vertices
-- in a table of vertices.
-- <AType> indicates if this edge is seen or not.
-- Warning: Raises EdgeDefinitionError if AIndex1 == AIndex2.
raises EdgeDefinitionError from Aspect;
---------------------------------------------------
-- Category: Methods to modify the class definition
---------------------------------------------------
SetValues ( me : in out;
AIndex1, AIndex2 : Integer from Standard;
AType : TypeOfEdge from Aspect )
---Level: Public
---Purpose: Updates the values of an edge <me>.
-- Warning: Raises EdgeDefinitionError if AIndex1 == AIndex2.
raises EdgeDefinitionError from Aspect;
----------------------------
-- Category: Inquire methods
----------------------------
Values ( me;
AIndex1, AIndex2 : out Integer from Standard;
AType : out TypeOfEdge from Aspect );
---Level: Public
---Purpose: Returns the index of the vertices and the
-- type of edge <me>.
---Category: Inquire methods
FirstIndex ( me )
returns Integer from Standard;
---Level: Public
---Purpose: Returns the index of the begin of the edge <me>.
---Category: Inquire methods
LastIndex ( me )
returns Integer from Standard;
---Level: Public
---Purpose: Returns the index of the end of the edge <me>.
---Category: Inquire methods
Type ( me)
returns TypeOfEdge from Aspect;
---Level: Public
---Purpose: Returns the type of the edge <me>.
---Category: Inquire methods
--
fields
--
-- Class : Aspect_Edge
--
-- Purpose : Declaration of variables specific to edges
--
-- Reminder : An edge is defined by :
-- - two vertices referenced by indices
-- - its visibility
--
-- indices of the vertices
MyBegin : Integer from Standard;
MyEnd : Integer from Standard;
-- the visibility
MyVisibility : TypeOfEdge from Aspect;
end Edge;

104
src/Aspect/Aspect_Edge.cxx Normal file
View File

@@ -0,0 +1,104 @@
// Created by: NW,JPB,CAL
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//-Version
//-Design Declaration des variables specifiques aux aretes
//-Warning Une arete est definie par :
// - les 2 sommets references par des indices
// - la visibilite
//-References
//-Language C++ 2.0
//-Declarations
// for the class
#include <Aspect_Edge.ixx>
//-Aliases
//-Global data definitions
// -- les indices des sommets extremite
// MyBegin : Standard_Integer;
// MyEnd : Standard_Integer;
// -- la visibilite
// MyVisibility : TypeOfEdge;
//-Constructors
//-Destructors
//-Methods, in order
Aspect_Edge::Aspect_Edge () {
MyBegin = 0;
MyEnd = 0;
MyVisibility = Aspect_TOE_INVISIBLE;
}
Aspect_Edge::Aspect_Edge (const Standard_Integer AIndex1, const Standard_Integer AIndex2, const Aspect_TypeOfEdge AType) {
if (AIndex1 == AIndex2)
Aspect_EdgeDefinitionError::Raise ("Bad index for the edge");
MyBegin = AIndex1;
MyEnd = AIndex2;
MyVisibility = AType;
}
void Aspect_Edge::SetValues (const Standard_Integer AIndex1, const Standard_Integer AIndex2, const Aspect_TypeOfEdge AType) {
if (AIndex1 == AIndex2)
Aspect_EdgeDefinitionError::Raise ("Bad index for the edge");
MyBegin = AIndex1;
MyEnd = AIndex2;
MyVisibility = AType;
}
void Aspect_Edge::Values (Standard_Integer& AIndex1, Standard_Integer& AIndex2, Aspect_TypeOfEdge& AType) const {
AIndex1 = MyBegin;
AIndex2 = MyEnd;
AType = MyVisibility;
}
Standard_Integer Aspect_Edge::FirstIndex () const {
return (MyBegin);
}
Standard_Integer Aspect_Edge::LastIndex () const {
return (MyEnd);
}
Aspect_TypeOfEdge Aspect_Edge::Type () const {
return (MyVisibility);
}

View File

@@ -14,7 +14,6 @@
-- commercial license or contractual agreement.
class ArgumentAnalyzer from BOPAlgo
inherits Algo from BOPAlgo
---Purpose: check the validity of argument(s) for Boolean Operations
uses
@@ -22,13 +21,11 @@ uses
Operation from BOPAlgo,
CheckStatus from BOPAlgo,
ShapeEnum from TopAbs,
ListOfCheckResult from BOPAlgo,
DataMapOfShapeReal from BOPCol
ListOfCheckResult from BOPAlgo
is
Create
returns ArgumentAnalyzer;
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_ArgumentAnalyzer();"
---Purpose: empty constructor
SetShape1(me: in out; TheShape: Shape from TopoDS);
@@ -170,25 +167,8 @@ is
is protected;
-- TestMergeFace(me: out)
-- is protected;
-- is protected;
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---C++: inline
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---C++: inline
---Purpose: Returns the additional tolerance
UpdateTolerances(me:out)
is protected;
---Purpose: Updates the shapes tolerance values.
SetDefaultTolerances(me:out)
is protected;
---Purpose: Reverts the tolerance values for all entities to default values.
fields
@@ -206,8 +186,6 @@ fields
myContinuityMode : Boolean from Standard;
myCurveOnSurfaceMode : Boolean from Standard;
myEmpty1, myEmpty2 : Boolean from Standard;
myResult : ListOfCheckResult from BOPAlgo;
myFuzzyValue : Real from Standard;
myToleranceMap : DataMapOfShapeReal from BOPCol;
myResult : ListOfCheckResult from BOPAlgo;
end ArgumentAnalyzer;

View File

@@ -31,9 +31,6 @@
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
@@ -52,7 +49,6 @@
#include <IntTools_Context.hxx>
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BOPTools_AlgoTools.hxx>
@@ -68,7 +64,6 @@
// purpose:
// ================================================================================
BOPAlgo_ArgumentAnalyzer::BOPAlgo_ArgumentAnalyzer() :
BOPAlgo_Algo(),
myStopOnFirst(Standard_False),
myOperation(BOPAlgo_UNKNOWN),
myArgumentTypeMode(Standard_False),
@@ -81,19 +76,9 @@ myMergeEdgeMode(Standard_False),
myContinuityMode(Standard_False),
myCurveOnSurfaceMode(Standard_False),
myEmpty1(Standard_False),
myEmpty2(Standard_False),
myFuzzyValue(0.)
myEmpty2(Standard_False)
{
}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
BOPAlgo_ArgumentAnalyzer::~BOPAlgo_ArgumentAnalyzer()
{
myResult.Clear();
myToleranceMap.Clear();
}
// ================================================================================
// function: SetShape1
@@ -172,82 +157,47 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
try {
OCC_CATCH_SIGNALS
myResult.Clear();
//
UserBreak();
//
// 1. Prepare
Prepare();
//
UserBreak();
//
// 2. Update Tolerances according to myFuzzyValue
UpdateTolerances();
//
UserBreak();
//
// 3. Test types
if(myArgumentTypeMode) {
TestTypes();
}
//
UserBreak();
//
// 4. Test self-interference
if(mySelfInterMode) {
TestSelfInterferences();
}
//
UserBreak();
//
// 5. Test small edges
if(mySmallEdgeMode) {
if(!(!myResult.IsEmpty() && myStopOnFirst))
TestSmallEdge();
}
//
UserBreak();
//
// 6. Test possibility to rebuild faces
if(myRebuildFaceMode) {
if(!(!myResult.IsEmpty() && myStopOnFirst))
TestRebuildFace();
}
//
UserBreak();
//
// 7. Test tangent
if(myTangentMode) {
if(!(!myResult.IsEmpty() && myStopOnFirst))
TestTangent();
}
//
UserBreak();
//
// 8. Test merge vertices
if(myMergeVertexMode) {
if(!(!myResult.IsEmpty() && myStopOnFirst))
TestMergeVertex();
}
//
UserBreak();
//
// 9. Test merge edges
if(myMergeEdgeMode) {
if(!(!myResult.IsEmpty() && myStopOnFirst))
TestMergeEdge();
}
//
UserBreak();
//
// 10. Test shapes continuity
if(myContinuityMode) {
if(!(!myResult.IsEmpty() && myStopOnFirst))
TestContinuity();
}
//
UserBreak();
//
// 11. Test validity of the curves on the surfaces
if(myCurveOnSurfaceMode) {
if(!(!myResult.IsEmpty() && myStopOnFirst))
TestCurveOnSurface();
@@ -258,8 +208,6 @@ void BOPAlgo_ArgumentAnalyzer::Perform()
aResult.SetCheckStatus(BOPAlgo_CheckUnknown);
myResult.Append(aResult);
}
//
SetDefaultTolerances();
}
// ================================================================================
@@ -381,8 +329,6 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
anArgs.Append(aS);
aChecker.SetArguments(anArgs);
aChecker.SetNonDestructive(Standard_True);
aChecker.SetRunParallel(myRunParallel);
aChecker.SetProgressIndicator(myProgressIndicator);
//
aChecker.Perform();
iErr=aChecker.ErrorStatus();
@@ -928,121 +874,3 @@ void BOPAlgo_ArgumentAnalyzer::TestCurveOnSurface()
}
}
// ================================================================================
// function: UpdateTolerances
// purpose:
// ================================================================================
void BOPAlgo_ArgumentAnalyzer::UpdateTolerances()
{
if (myFuzzyValue == 0.) {
return;
}
//
BOPCol_MapOfShape aMapShapes;
//
if (!myShape1.IsNull()) {
BOPTools::MapShapes(myShape1, aMapShapes);
}
if (!myShape2.IsNull()) {
BOPTools::MapShapes(myShape2, aMapShapes);
}
//
if (aMapShapes.IsEmpty()) {
return;
}
//
Standard_Real aTol, aFuzz;
TopAbs_ShapeEnum aType;
BOPCol_MapIteratorOfMapOfShape aIt;
//
aFuzz = myFuzzyValue / 2.;
aIt.Initialize(aMapShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aType = aS.ShapeType();
//
switch (aType) {
case TopAbs_VERTEX: {
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aS;
const Handle(BRep_TVertex)& TV =
*((Handle(BRep_TVertex)*)&aV.TShape());
aTol = TV->Tolerance();
myToleranceMap.Bind(aS, aTol);
TV->Tolerance(aTol + aFuzz);
break;
}
case TopAbs_EDGE: {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aS;
const Handle(BRep_TEdge)& TE =
*((Handle(BRep_TEdge)*)&aE.TShape());
aTol = TE->Tolerance();
myToleranceMap.Bind(aS, aTol);
TE->Tolerance(aTol + aFuzz);
break;
}
case TopAbs_FACE: {
const TopoDS_Face& aF = *(TopoDS_Face*)&aS;
const Handle(BRep_TFace)& TF =
*((Handle(BRep_TFace)*)&aF.TShape());
aTol = TF->Tolerance();
myToleranceMap.Bind(aS, aTol);
TF->Tolerance(aTol + aFuzz);
break;
}
default:
break;
} // switch (aType) {
} // for (; aIt.More(); aIt.Next()) {
}
// ================================================================================
// function: SetDefaultTolerances
// purpose:
// ================================================================================
void BOPAlgo_ArgumentAnalyzer::SetDefaultTolerances()
{
if (myFuzzyValue == 0.) {
return;
}
//
if (myToleranceMap.IsEmpty()) {
return;
}
//
Standard_Real aTol;
TopAbs_ShapeEnum aType;
BOPCol_DataMapIteratorOfDataMapOfShapeReal aIt;
//
aIt.Initialize(myToleranceMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Key();
aTol = aIt.Value();
aType = aS.ShapeType();
//
switch (aType) {
case TopAbs_VERTEX: {
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aS;
const Handle(BRep_TVertex)& TV =
*((Handle(BRep_TVertex)*)&aV.TShape());
TV->Tolerance(aTol);
break;
}
case TopAbs_EDGE: {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aS;
const Handle(BRep_TEdge)& TE =
*((Handle(BRep_TEdge)*)&aE.TShape());
TE->Tolerance(aTol);
break;
}
case TopAbs_FACE: {
const TopoDS_Face& aF = *(TopoDS_Face*)&aS;
const Handle(BRep_TFace)& TF =
*((Handle(BRep_TFace)*)&aF.TShape());
TF->Tolerance(aTol);
break;
}
default:
break;
} // switch (aType) {
} // for (; aIt.More(); aIt.Next()) {
}

View File

@@ -61,24 +61,6 @@ inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::CurveOnSurfaceMode()
{
return myCurveOnSurfaceMode;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
inline void BOPAlgo_ArgumentAnalyzer::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
inline Standard_Real BOPAlgo_ArgumentAnalyzer::FuzzyValue() const
{
return myFuzzyValue;
}
// inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::MergeFaceMode()
// {
// return myMergeFaceMode;

View File

@@ -350,9 +350,6 @@ void BOPAlgo_BOP::Perform()
//
pPF=new BOPAlgo_PaveFiller(aAllocator);
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
//
pPF->Perform();
//

View File

@@ -219,15 +219,7 @@ is
Splits (me)
returns DataMapOfShapeListOfShape from BOPCol;
---C++: return const &
---Purpose: Returns mySplits.
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---Purpose: Returns the additional tolerance
---Purpose: Returns mySplits.
fields
myArguments : ListOfShape from BOPCol is protected;
@@ -241,8 +233,7 @@ fields
myShapesSD : DataMapOfShapeShape from BOPCol is protected;
--
mySplits : DataMapOfShapeListOfShape from BOPCol is protected;
myOrigins : DataMapOfShapeShape from BOPCol is protected;
myFuzzyValue : Real from Standard is protected;
myOrigins : DataMapOfShapeShape from BOPCol is protected;
end Builder;

View File

@@ -42,8 +42,7 @@ BOPAlgo_Builder::BOPAlgo_Builder()
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myFuzzyValue(0.)
myOrigins(100, myAllocator)
{
}
//=======================================================================
@@ -62,8 +61,7 @@ BOPAlgo_Builder::BOPAlgo_Builder
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myFuzzyValue(0.)
myOrigins(100, myAllocator)
{
}
//=======================================================================
@@ -174,24 +172,6 @@ BOPDS_PDS BOPAlgo_Builder::PDS()
return myDS;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BOPAlgo_Builder::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
@@ -256,8 +236,6 @@ void BOPAlgo_Builder::Perform()
//
pPF->SetArguments(myArguments);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
//
pPF->Perform();
//

View File

@@ -45,10 +45,6 @@
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
//
#include <Bnd_Box.hxx>
//
#include <BRepBndLib.hxx>
//
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
@@ -455,7 +451,7 @@ void BOPAlgo_BuilderFace::PerformLoops()
void BOPAlgo_BuilderFace::PerformAreas()
{
Standard_Boolean bIsGrowth, bIsHole;
Standard_Integer k, aNbS, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;
Standard_Integer k, aNbHoles, aNbDMISB, m, aNbMSH, aNbInOutMap;;
Standard_Real aTol;
TopLoc_Location aLoc;
Handle(Geom_Surface) aS;
@@ -473,7 +469,6 @@ void BOPAlgo_BuilderFace::PerformAreas()
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
//
myErrorStatus=0;
aNbHoles=0;
//
aTol=BRep_Tool::Tolerance(myFace);
aS=BRep_Tool::Surface(myFace, aLoc);
@@ -503,8 +498,8 @@ void BOPAlgo_BuilderFace::PerformAreas()
bIsHole=aClsf.IsHole();
if (bIsHole) {
BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE);
//
bIsHole=Standard_True;
//
bIsHole=Standard_True;
}
else {
bIsHole=Standard_False;
@@ -530,7 +525,6 @@ void BOPAlgo_BuilderFace::PerformAreas()
if (bIsHole) {
const Bnd_Box2d& aBox2D=aSB2D.Box2D();
aTreeFiller.Add(k, aBox2D);
++aNbHoles;
}
}
//
@@ -552,10 +546,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
aSelector.Clear();
aSelector.SetBox(aBox2DF);
//
aNbS = aBBTree.Select(aSelector);
if (!aNbS) {
continue;
}
aNbHoles=aBBTree.Select(aSelector);
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
//
@@ -581,7 +572,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
}
}// for (m=1; m<=aNbDMISB; ++m)
//
// 5.1 Map [Face/Holes] -> aMSH
// 5. Map [Face/Holes] -> aMSH
aNbInOutMap=aInOutMap.Extent();
for (m=1; m<=aNbInOutMap; ++m) {
const TopoDS_Shape& aHole=aInOutMap.FindKey(m);
@@ -598,41 +589,6 @@ void BOPAlgo_BuilderFace::PerformAreas()
}
}
//
// 5.2. Add unused holes to the original face
if (aNbHoles != aNbInOutMap) {
Bnd_Box aBoxF;
BRepBndLib::Add(myFace, aBoxF);
if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax()) {
//
BOPCol_ListOfShape anUnUsedHoles;
for (m = 1; m <= aNbDMISB; ++m) {
const BOPAlgo_ShapeBox2D& aSB2D=aDMISB.FindFromIndex(m);
if (aSB2D.IsHole()) {
const TopoDS_Shape& aHole = aSB2D.Shape();
if (!aInOutMap.Contains(aHole)) {
anUnUsedHoles.Append(aHole);
}
}
}
//
if (anUnUsedHoles.Extent()) {
TopoDS_Face aFace;
aBB.MakeFace(aFace, aS, aLoc, aTol);
aMSH.Add(aFace, anUnUsedHoles);
//
BOPAlgo_ShapeBox2D aSB2D;
//
aSB2D.SetShape(aFace);
aSB2D.SetIsHole(Standard_False);
//
aDMISB.Add(aNbDMISB, aSB2D);
++aNbDMISB;
}
}
}
//
// 6. Add aHoles to Faces
aNbMSH=aMSH.Extent();
for (m=1; m<=aNbMSH; ++m) {

View File

@@ -104,7 +104,6 @@ void BOPAlgo_CheckerSI::Init()
// 1. myDS
myDS=new BOPDS_DS(myAllocator);
myDS->SetArguments(myArguments);
myDS->SetFuzzyValue(myFuzzyValue);
myDS->Init();
//
// 2.myIterator

View File

@@ -43,29 +43,6 @@ static
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS);
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void BOPAlgo_MakerVolume::CheckData()
{
if (myArguments.IsEmpty()) {
myErrorStatus = 100; // no arguments to process
return;
}
// myPaveFiller
if (!myPaveFiller) {
myErrorStatus = 101;
return;
}
//
myErrorStatus = myPaveFiller->ErrorStatus();
if (myErrorStatus) {
myErrorStatus = 102; // PaveFiller is failed
return;
}
}
//=======================================================================
//function : Perform
//purpose :
@@ -107,8 +84,6 @@ void BOPAlgo_MakerVolume::Perform()
}
//
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->Perform();
//
myEntryPoint = 1;

View File

@@ -92,3 +92,26 @@ inline const BOPCol_ListOfShape& BOPAlgo_MakerVolume::Faces()const
{
return myFaces;
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
inline void BOPAlgo_MakerVolume::CheckData()
{
if (myArguments.IsEmpty()) {
myErrorStatus = 100; // no arguments to process
return;
}
// myPaveFiller
if (!myPaveFiller) {
myErrorStatus = 101;
return;
}
//
myErrorStatus = myPaveFiller->ErrorStatus();
if (myErrorStatus) {
myErrorStatus = 102; // PaveFiller is failed
return;
}
}

View File

@@ -463,20 +463,12 @@ is
---Purpose:
-- Updates pave blocks which have the paves with indices contained
-- in the map <theDMI>.
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---Purpose: Returns the additional tolerance
fields
myArguments : ListOfShape from BOPCol is protected;
myDS : PDS from BOPDS is protected;
myIterator : PIterator from BOPDS is protected;
myContext : Context from IntTools is protected;
mySectionAttribute : SectionAttribute from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
end PaveFiller;

View File

@@ -33,8 +33,7 @@
//=======================================================================
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
:
BOPAlgo_Algo(),
myFuzzyValue(0.)
BOPAlgo_Algo()
{
myDS=NULL;
myIterator=NULL;
@@ -46,8 +45,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator),
myFuzzyValue(0.)
BOPAlgo_Algo(theAllocator)
{
myDS=NULL;
myIterator=NULL;
@@ -125,24 +123,6 @@ const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
return myArguments;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BOPAlgo_PaveFiller::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
// function: Init
// purpose:
//=======================================================================
@@ -161,7 +141,6 @@ void BOPAlgo_PaveFiller::Init()
// 1.myDS
myDS=new BOPDS_DS(myAllocator);
myDS->SetArguments(myArguments);
myDS->SetFuzzyValue(myFuzzyValue);
myDS->Init();
//
// 2.myIterator
@@ -191,8 +170,6 @@ void BOPAlgo_PaveFiller::Perform()
catch (Standard_Failure) {
myErrorStatus=11;
}
//
myDS->SetDefaultTolerances();
}
//=======================================================================
// function: PerformInternal
@@ -267,6 +244,7 @@ void BOPAlgo_PaveFiller::PerformInternal()
return;
}
//
//modified by NIZNHY-PKV Fri Sep 12 07:06:50 2014f
// 03
PerformVZ();
if (myErrorStatus) {
@@ -287,4 +265,5 @@ void BOPAlgo_PaveFiller::PerformInternal()
if (myErrorStatus) {
return;
}
//modified by NIZNHY-PKV Fri Sep 12 07:06:52 2014t
}

View File

@@ -24,7 +24,6 @@ uses
is
imported BaseAllocator from BOPCol;
imported DataMapOfShapeInteger from BOPCol;
imported DataMapOfShapeReal from BOPCol;
imported MapOfInteger from BOPCol;
imported ListOfInteger from BOPCol;
imported PInteger from BOPCol;

View File

@@ -1,6 +1,5 @@
BOPCol_Array1.hxx
BOPCol_DataMapOfShapeInteger.hxx
BOPCol_DataMapOfShapeReal.hxx
BOPCol_MapOfInteger.hxx
BOPCol_ListOfInteger.hxx
BOPCol_PInteger.hxx

View File

@@ -38,8 +38,7 @@ uses
Shape from TopoDS,
--
ListOfShape from BOPCol,
DataMapOfIntegerInteger from BOPCol,
DataMapOfIntegerReal from BOPCol,
DataMapOfIntegerInteger from BOPCol,
DataMapOfShapeInteger from BOPCol,
ListOfInteger from BOPCol,
MapOfInteger from BOPCol,
@@ -304,7 +303,7 @@ is
IsCommonBlockOnEdge(me;
thePB:PaveBlock from BOPDS)
returns Boolean from Standard;
returns Boolean from Standard;
---Purpose:
--- Query
--- Returns true if common block contains more then one pave block
@@ -501,7 +500,7 @@ is
---C++: inline
---Purpose:
--- Selector/Modifier
--- Returns the collection of interferences Edge/Solid
--- Returns the collection of interferences Edge/Solid
InterfFZ(me:out)
returns VectorOfInterfFZ from BOPDS;
@@ -509,7 +508,7 @@ is
---C++: inline
---Purpose:
--- Selector/Modifier
--- Returns the collection of interferences Face/Solid
--- Returns the collection of interferences Face/Solid
InterfZZ(me:out)
returns VectorOfInterfZZ from BOPDS;
@@ -517,12 +516,12 @@ is
---C++: inline
---Purpose:
--- Selector/Modifier
--- Returns the collection of interferences Solid/Solid
--- Returns the collection of interferences Solid/Solid
NbInterfTypes(myclass)
returns Integer from Standard;
---C++: inline
---Purpose:
returns Integer from Standard;
---C++: inline
---Purpose:
-- Returns the number of types of the interferences
--
@@ -557,14 +556,14 @@ is
HasInterfShapeSubShapes(me;
theI1:Integer from Standard;
theI2:Integer from Standard;
theFlag: Boolean from Standard=Standard_True)
theFlag: Boolean from Standard=Standard_True)
returns Boolean from Standard;
---Purpose:
--- Query
--- Returns true if the shape with index theI1 is interfered
--- with
-- any sub-shape of the shape with index theI2 (theFlag=true)
-- all sub-shapes of the shape with index theI2 (theFlag=false)
-- any sub-shape of the shape with index theI2 (theFlag=true)
-- all sub-shapes of the shape with index theI2 (theFlag=false)
HasInterfSubShapes(me;
theI1:Integer from Standard;
@@ -629,26 +628,15 @@ is
---
BuildBndBoxSolid (me:out;
theIndex:Integer from Standard;
theBox:out Box from Bnd)
is protected;
---Purpose:
theIndex:Integer from Standard;
theBox:out Box from Bnd)
is protected;
---Purpose:
--- Computes bouding box <theBox> for the solid with DS-index <theIndex>
---
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---C++: inline
---Purpose: Sets the extended tolerance
FuzzyValue(me)
returns Real from Standard;
---C++: inline
---Purpose: Returns the extended tolerance
SetDefaultTolerances(me:out);
---Purpose: Reverts the tolerance values of unchanged entities to default values.
fields
myAllocator : BaseAllocator from BOPCol is protected;
myArguments : ListOfShape from BOPCol is protected;
@@ -677,10 +665,5 @@ fields
myInterfVZ : VectorOfInterfVZ from BOPDS is protected;
myInterfEZ : VectorOfInterfEZ from BOPDS is protected;
myInterfFZ : VectorOfInterfFZ from BOPDS is protected;
myInterfZZ : VectorOfInterfZZ from BOPDS is protected;
--
-- extended tolerance for intersection
myFuzzyValue : Real from Standard is protected;
myToleranceMap : DataMapOfIntegerReal from BOPCol is protected;
myInterfZZ : VectorOfInterfZZ from BOPDS is protected;
end DS;

View File

@@ -27,10 +27,6 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
//
#include <BRep_TVertex.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
#include <BRep_Tool.hxx>
//
#include <BRepBndLib.hxx>
@@ -38,7 +34,6 @@
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_DataMapOfShapeInteger.hxx>
#include <BOPCol_DataMapOfIntegerMapOfInteger.hxx>
//
#include <BOPDS_IndexRange.hxx>
#include <BOPDS_ShapeInfo.hxx>
@@ -73,16 +68,6 @@ static
Standard_Real ComputeParameter(const TopoDS_Vertex& aV,
const TopoDS_Edge& aE);
static
void AddShapeAndSubShapes(const Standard_Integer nS,
const BOPDS_ShapeInfo& theSI,
BOPCol_MapOfInteger& theMI);
static
void CollectEdges(const BOPDS_DS& theDS,
const Standard_Integer nF,
BOPCol_MapOfInteger& theMI);
//=======================================================================
//function :
//purpose :
@@ -108,9 +93,7 @@ BOPDS_DS::BOPDS_DS()
myInterfVZ(myAllocator),
myInterfEZ(myAllocator),
myInterfFZ(myAllocator),
myInterfZZ(myAllocator),
myFuzzyValue(0.),
myToleranceMap(100, myAllocator)
myInterfZZ(myAllocator)
{
myNbShapes=0;
myNbSourceShapes=0;
@@ -140,9 +123,7 @@ BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator)
myInterfVZ(myAllocator),
myInterfEZ(myAllocator),
myInterfFZ(myAllocator),
myInterfZZ(myAllocator),
myFuzzyValue(0.),
myToleranceMap(100, myAllocator)
myInterfZZ(myAllocator)
{
myNbShapes=0;
myNbSourceShapes=0;
@@ -163,7 +144,6 @@ void BOPDS_DS::Clear()
{
myNbShapes=0;
myNbSourceShapes=0;
myFuzzyValue=0.;
//
myArguments.Clear();
myRanges.Clear();
@@ -184,7 +164,6 @@ void BOPDS_DS::Clear()
myInterfEZ.Clear();
myInterfFZ.Clear();
myInterfZZ.Clear();
myToleranceMap.Clear();
}
//=======================================================================
//function : SetArguments
@@ -346,7 +325,7 @@ void BOPDS_DS::Init()
{
Standard_Integer i1, i2, j, aI, aNb, aNbS, aNbE, aNbSx;
Standard_Integer n1, n2, n3, nV, nW, nE, aNbF;
Standard_Real aTol, aFuzz;
Standard_Real aTol;
TopAbs_ShapeEnum aTS;
TopoDS_Iterator aItS;
BOPCol_ListIteratorOfListOfInteger aIt1, aIt2, aIt3;
@@ -407,7 +386,6 @@ void BOPDS_DS::Init()
i1=i2+1;
}
//
aFuzz = myFuzzyValue / 2.;
myNbSourceShapes=NbShapes();
//
// 2 Bounding Boxes
@@ -425,15 +403,7 @@ void BOPDS_DS::Init()
Bnd_Box& aBox=aSI.ChangeBox();
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aS);
const gp_Pnt& aP=BRep_Tool::Pnt(aV);
//
const Handle(BRep_TVertex)& TV =
*((Handle(BRep_TVertex)*)&aV.TShape());
aTol = TV->Tolerance();
//
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TV->Tolerance(aTol);
//
aTol=BRep_Tool::Tolerance(aV);
aBox.SetGap(aTol);
aBox.Add(aP);
}
@@ -447,14 +417,7 @@ void BOPDS_DS::Init()
if (aTS==TopAbs_EDGE) {
const TopoDS_Shape& aS=aSI.Shape();
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aS);
//
const Handle(BRep_TEdge)& TE =
*((Handle(BRep_TEdge)*)&aE.TShape());
aTol = TE->Tolerance();
//
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TE->Tolerance(aTol);
aTol=BRep_Tool::Tolerance(aE);
//
if (!BRep_Tool::Degenerated(aE)) {
Standard_Boolean bInf1, bInf2;
@@ -531,14 +494,7 @@ void BOPDS_DS::Init()
if (aTS==TopAbs_FACE) {
const TopoDS_Shape& aS=aSI.Shape();
const TopoDS_Face& aF=*((TopoDS_Face*)&aS);
//
const Handle(BRep_TFace)& TF =
*((Handle(BRep_TFace)*)&aF.TShape());
aTol = TF->Tolerance();
//
myToleranceMap.Bind(j, aTol);
aTol += aFuzz;
TF->Tolerance(aTol);
aTol=BRep_Tool::Tolerance(aF);
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::Add(aS, aBox);
@@ -753,12 +709,12 @@ Standard_Boolean BOPDS_DS::HasInterfShapeSubShapes
bRet=HasInterf(theI1, n2);
if (theFlag) {
if(bRet) {
break;
break;
}
}
else {
if(!bRet) {
break;
break;
}
}
}
@@ -2061,236 +2017,3 @@ void BOPDS_DS::BuildBndBoxSolid(const Standard_Integer theIndex,
}
}
}
//=======================================================================
//function : DefaultTolerances
//purpose :
//=======================================================================
void BOPDS_DS::SetDefaultTolerances()
{
if (myFuzzyValue == 0.) {
return;
}
//
Standard_Boolean bAdd;
Standard_Integer i, j, n1, n2, nS, nSOp, nSs;
Standard_Integer anIntType, aNbFF, aNbFIn;
Standard_Real aTolDef;
TopAbs_ShapeEnum aTS1, aTS2;
BOPCol_MapOfInteger aMICh;
BOPCol_DataMapOfIntegerMapOfInteger aDMI;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPDS_MapIteratorMapOfPassKey aItPK;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
BOPCol_MapIteratorOfMapOfInteger aItMI;
BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItDMIR;
//
// 1. Collect interfered shapes
// 1.1. Interferences V/V, V/E, V/F, E/E and E/F
aItPK.Initialize(myInterfTB);
for (; aItPK.More(); aItPK.Next()) {
const BOPDS_PassKey& aPK = aItPK.Value();
aPK.Ids(n1, n2);
//
const BOPDS_ShapeInfo& aSI1 = ShapeInfo(n1);
const BOPDS_ShapeInfo& aSI2 = ShapeInfo(n2);
//
aTS1 = aSI1.ShapeType();
aTS2 = aSI2.ShapeType();
//
anIntType = BOPDS_Tools::TypeToInteger(aTS1, aTS2);
if (anIntType < 5) {
AddShapeAndSubShapes(n1, aSI1, aMICh);
AddShapeAndSubShapes(n2, aSI2, aMICh);
} // if (anIntType < 5) {
} // for (; aIt.More(); aIt.Next()) {
//
// 1.2 FaceInfo information
aNbFF = myFaceInfoPool.Extent();
for (i = 0; i < aNbFF; ++i) {
const BOPDS_FaceInfo& aFI = myFaceInfoPool(i);
nS = aFI.Index();
if (aMICh.Contains(nS)) {
continue;
}
//
aNbFIn = (aFI.PaveBlocksIn().Extent() +
aFI.VerticesIn().Extent() +
aFI.PaveBlocksSc().Extent() +
aFI.VerticesSc().Extent());
if (aNbFIn > 0) {
AddShapeAndSubShapes(nS, ShapeInfo(nS), aMICh);
} // if (aNbFIn > 0) {
} // for (i = 0; i < aNbFF; ++i) {
//
// 1.3. Empty F/F interferences
aNbFF = myInterfFF.Extent();
for (i = 0; i < aNbFF; ++i) {
BOPDS_InterfFF& aFF = myInterfFF(i);
if ((aFF.Curves().Extent() == 0) &&
(aFF.Points().Extent() == 0)) {
aFF.Indices(n1, n2);
for (j = 0; j < 2; ++j) {
nS = !j ? n1 : n2;
if (aMICh.Contains(nS)) {
continue;
}
nSOp = !j ? n2 : n1;
//
BOPCol_MapOfInteger aME, aMEOp;
//
if (aDMI.IsBound(nS)) {
aME = aDMI.Find(nS);
} else {
CollectEdges(*this, nS, aME);
aDMI.Bind(nS, aME);
}
//
if (aDMI.IsBound(nSOp)) {
aMEOp = aDMI.Find(nSOp);
} else {
CollectEdges(*this, nSOp, aMEOp);
aDMI.Bind(nSOp, aMEOp);
}
//
bAdd = Standard_True;
aItMI.Initialize(aME);
for (; aItMI.More(); aItMI.Next()) {
nSs = aItMI.Value();
if (!aMEOp.Contains(nSs)) {
bAdd = Standard_False;
break;
}
}
//
if (bAdd) {
AddShapeAndSubShapes(nS, ShapeInfo(nS), aMICh);
if (j == 0) {
AddShapeAndSubShapes(nSOp, ShapeInfo(nSOp), aMICh);
}
} // if (bAdd) {
} // for (j = 0; j < 2; ++j) {
} //if ((aFF.Curves().Extent() == 0) &&
} // for (i = 0; i < aNbFF; ++i) {
//
// 2. Back to default tolerance values
aItDMIR.Initialize(myToleranceMap);
for (; aItDMIR.More(); aItDMIR.Next()) {
i = aItDMIR.Key();
//
if (aMICh.Contains(i)) {
continue;
}
//
const BOPDS_ShapeInfo& aSI = ShapeInfo(i);
aTolDef = aItDMIR.Value();
aTS1 = aSI.ShapeType();
switch (aTS1) {
case TopAbs_VERTEX: {
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aSI.Shape();
const Handle(BRep_TVertex)& aTV =
*((Handle(BRep_TVertex)*)&aV.TShape());
aTV->Tolerance(aTolDef);
break;
}
case TopAbs_EDGE: {
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSI.Shape();
const Handle(BRep_TEdge)& aTE =
*((Handle(BRep_TEdge)*)&aE.TShape());
aTE->Tolerance(aTolDef);
//
const BOPDS_ListOfPaveBlock& aLPB = PaveBlocks(i);
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
nS = aPB->Edge();
const TopoDS_Edge& aEIm = *(TopoDS_Edge*)&Shape(nS);
const Handle(BRep_TEdge)& aTEIm =
*((Handle(BRep_TEdge)*)&aEIm.TShape());
aTEIm->Tolerance(aTolDef);
}
break;
}
case TopAbs_FACE: {
const TopoDS_Face& aF = *(TopoDS_Face*)&aSI.Shape();
const Handle(BRep_TFace)& aTF =
*((Handle(BRep_TFace)*)&aF.TShape());
aTF->Tolerance(aTolDef);
break;
}
default:
break;
} // switch (aTS1) {
} // for (; aItDMIR.More(); aItDMIR.Next()) {
}
//=======================================================================
//function : AddShapeAndSubShapes
//purpose :
//=======================================================================
void AddShapeAndSubShapes(const Standard_Integer nS,
const BOPDS_ShapeInfo& theSI,
BOPCol_MapOfInteger& theMI)
{
Standard_Integer nSs;
if (theMI.Add(nS)) {
const BOPCol_ListOfInteger& aLI = theSI.SubShapes();
BOPCol_ListIteratorOfListOfInteger aItLI(aLI);
for (; aItLI.More(); aItLI.Next()) {
nSs = aItLI.Value();
theMI.Add(nSs);
}
}
}
//=======================================================================
//function : CollectEdges
//purpose :
//=======================================================================
void CollectEdges(const BOPDS_DS& theDS,
const Standard_Integer nF,
BOPCol_MapOfInteger& theMI)
{
Standard_Integer i, j, aNbPB, nE, nEIm;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
//
// ON edges
const BOPDS_ShapeInfo& aSI = theDS.ShapeInfo(nF);
const BOPCol_ListOfInteger& aLI = aSI.SubShapes();
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
nE = aItLI.Value();
const BOPDS_ShapeInfo& aSIE = theDS.ShapeInfo(nE);
if (aSIE.ShapeType() != TopAbs_EDGE) {
continue;
}
//
if (!aSIE.HasReference()) {
theMI.Add(nE);
continue;
}
//
const BOPDS_ListOfPaveBlock& aLPB = theDS.PaveBlocks(nE);
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
nEIm = aPB->Edge();
theMI.Add(nEIm);
}
}
// IN and SC edges
const BOPDS_FaceInfo& aFI = theDS.FaceInfo(nF);
const BOPDS_IndexedMapOfPaveBlock& aMPBIn = aFI.PaveBlocksIn();
const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
//
for (i = 0; i < 2; ++i) {
const BOPDS_IndexedMapOfPaveBlock& aMPB = !i ? aMPBIn : aMPBSc;
aNbPB = aMPB.Extent();
for (j = 1; j <= aNbPB; ++j) {
const Handle(BOPDS_PaveBlock)& aPB = aMPB(j);
nE = aPB->Edge();
theMI.Add(nE);
}
}
}

View File

@@ -105,7 +105,7 @@ inline Standard_Integer BOPDS_DS::NbInterfTypes()
//purpose :
//=======================================================================
inline void BOPDS_DS::AddInterf(const Standard_Integer theI1,
const Standard_Integer theI2)
const Standard_Integer theI2)
{
BOPDS_PassKey aPK;
//
@@ -133,21 +133,3 @@ inline const BOPDS_MapOfPassKey& BOPDS_DS::Interferences()const
{
return myInterfTB;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
inline void BOPDS_DS::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
inline Standard_Real BOPDS_DS::FuzzyValue() const
{
return myFuzzyValue;
}

View File

@@ -24,8 +24,6 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
//
#include <BRep_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
@@ -97,26 +95,24 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
const char* g = "BOP commands";
// Commands
theCommands.Add("bop" , "use bop s1 s2 [tol]" , __FILE__, bop, g);
theCommands.Add("bopcommon" , "use bopcommon r" , __FILE__, bopcommon, g);
theCommands.Add("bopfuse" , "use bopfuse r" , __FILE__,bopfuse, g);
theCommands.Add("bopcut" , "use bopcut r" , __FILE__,bopcut, g);
theCommands.Add("boptuc" , "use boptuc r" , __FILE__,boptuc, g);
theCommands.Add("bopsection", "use bopsection r" , __FILE__,bopsection, g);
theCommands.Add("bop" , "use bop s1 s2" , __FILE__, bop, g);
theCommands.Add("bopcommon" , "use bopcommon r" , __FILE__, bopcommon, g);
theCommands.Add("bopfuse" , "use bopfuse r" , __FILE__,bopfuse, g);
theCommands.Add("bopcut" , "use bopcut" , __FILE__,bopcut, g);
theCommands.Add("boptuc" , "use boptuc" , __FILE__,boptuc, g);
theCommands.Add("bopsection", "use bopsection" , __FILE__,bopsection, g);
//
theCommands.Add("bcommon" , "use bcommon r s1 s2 [tol]" , __FILE__,bcommon, g);
theCommands.Add("bfuse" , "use bfuse r s1 s2 [tol]" , __FILE__,bfuse, g);
theCommands.Add("bcut" , "use bcut r s1 s2 [tol]" , __FILE__,bcut, g);
theCommands.Add("btuc" , "use btuc r s1 s2 [tol]" , __FILE__,btuc, g);
theCommands.Add("bsection", "Use >bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]",
theCommands.Add("bcommon" , "use bcommon r s1 s2" , __FILE__,bcommon, g);
theCommands.Add("bfuse" , "use bfuse r s1 s2" , __FILE__,bfuse, g);
theCommands.Add("bcut" , "use bcut r s1 s2" , __FILE__,bcut, g);
theCommands.Add("btuc" , "use btuc r s1 s2" , __FILE__,btuc, g);
theCommands.Add("bsection", "Use >bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na]",
__FILE__, bsection, g);
//
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d]", __FILE__, bopcurves, g);
theCommands.Add("bopnews", "use bopnews -v[e,f]" , __FILE__, bopnews, g);
theCommands.Add("bparallelmode", "bparallelmode [1/0] : show / set parallel mode for boolean operations",
__FILE__, bparallelmode, g);
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]",
__FILE__, mkvolume , g);
theCommands.Add("bparallelmode", "bparallelmode [1/0] : show / set parallel mode for boolean operations", __FILE__, bparallelmode, g);
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-ni (do not intersect)] [-s (run in non parallel mode)]", __FILE__, mkvolume , g);
}
//=======================================================================
@@ -127,12 +123,11 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
char buf[32];
Standard_Integer iErr;
Standard_Real aTol;
TopoDS_Shape aS1, aS2;
BOPCol_ListOfShape aLC;
//
if (n < 3 || n > 4) {
di << " use bop Shape1 Shape2 [tol]\n";
if (n!=3) {
di << " use bop Shape1 Shape2\n";
return 1;
}
//
@@ -144,11 +139,6 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
return 1;
}
//
aTol = 0.;
if (n == 4) {
aTol = Draw::Atof(a[3]);
}
//
aLC.Append(aS1);
aLC.Append(aS2);
//
@@ -160,7 +150,6 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
pPF=new BOPAlgo_PaveFiller(aAL);
//
pPF->SetArguments(aLC);
pPF->SetFuzzyValue(aTol);
//
pPF->Perform();
iErr=pPF->ErrorStatus();
@@ -214,7 +203,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
const BOPAlgo_Operation aOp)
{
if (n<2) {
di << " use bopsmt r\n [tol]";
di << " use bopsmt r\n";
return 0;
}
//
@@ -360,74 +349,104 @@ Standard_Integer bsection(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na]\n";
if (n < 4) {
di << usage;
return 1;
}
//
TopoDS_Shape aS1 = DBRep::Get(a[2]);
TopoDS_Shape aS2 = DBRep::Get(a[3]);
//
if (aS1.IsNull() || aS2.IsNull()) {
di << " Null shapes are not allowed \n";
return 1;
}
//
Standard_Boolean bApp, bPC1, bPC2;
Standard_Integer i;
Standard_Real aTol;
//
bApp = Standard_True;
bPC1 = Standard_True;
bPC2 = Standard_True;
aTol = 0.;
//
for (i = 4; i < n; ++i) {
if (!strcmp(a[i], "-n2d")) {
bPC1 = Standard_False;
bPC2 = Standard_False;
}
else if (!strcmp(a[i], "-n2d1")) {
bPC1 = Standard_False;
}
else if (!strcmp(a[i], "-n2d2")) {
bPC2 = Standard_False;
}
else if (!strcmp(a[i], "-na")) {
bApp = Standard_False;
Standard_Boolean isbadparameter = Standard_False;
if(n > 4) {
const char* key1 = a[4];
const char* key2 = (n > 5) ? a[5] : NULL;
const char* pcurveconf = NULL;
if (key1 &&
(!strcasecmp(key1,"-n2d") ||
!strcasecmp(key1,"-n2d1") ||
!strcasecmp(key1,"-n2d2"))) {
pcurveconf = key1;
}
else {
aTol = Draw::Atof(a[i]);
if (!strcasecmp(key1,"-na")) {
bApp = Standard_False;
}
else {
isbadparameter = Standard_True;
}
}
if (key2) {
if(!strcasecmp(key2,"-na")) {
bApp = Standard_False;
}
else {
isbadparameter = Standard_True;
}
}
if(!isbadparameter && pcurveconf) {
if (!strcasecmp(pcurveconf, "-n2d1")) {
bPC1 = Standard_False;
}
else {
if (!strcasecmp(pcurveconf, "-n2d2")) {
bPC2 = Standard_False;
}
else {
if (!strcasecmp(pcurveconf, "-n2d")) {
bPC1 = Standard_False;
bPC2 = Standard_False;
}
}
}
}
}
//
Standard_Integer iErr;
char buf[80];
//
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
aSec.Approximation(bApp);
aSec.ComputePCurveOn1(bPC1);
aSec.ComputePCurveOn2(bPC2);
aSec.SetFuzzyValue(aTol);
//
aSec.Build();
iErr=aSec.ErrorStatus();
if (!aSec.IsDone()) {
Sprintf(buf, " ErrorStatus : %d\n", iErr);
di << buf;
if(!isbadparameter) {
Standard_Integer iErr;
char buf[80];
//
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
aSec.Approximation(bApp);
aSec.ComputePCurveOn1(bPC1);
aSec.ComputePCurveOn2(bPC2);
//
aSec.Build();
iErr=aSec.ErrorStatus();
if (!aSec.IsDone()) {
Sprintf(buf, " ErrorStatus : %d\n", iErr);
di << buf;
return 0;
}
//
const TopoDS_Shape& aR=aSec.Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
DBRep::Set(a[1], aR);
return 0;
}
//
const TopoDS_Shape& aR=aSec.Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
else {
di << usage;
return 1;
}
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bsmt
//purpose :
@@ -441,10 +460,9 @@ Standard_Integer bsmt (Draw_Interpretor& di,
Standard_Integer iErr;
TopoDS_Shape aS1, aS2;
BOPCol_ListOfShape aLC;
Standard_Real aTol;
//
if (n < 4 || n > 5) {
di << " use bx r s1 s2 [tol]\n";
if (n!=4) {
di << " use bx r s1 s2\n";
return 1;
}
//
@@ -455,12 +473,6 @@ Standard_Integer bsmt (Draw_Interpretor& di,
di << " null shapes are not allowed \n";
return 1;
}
//
aTol = 0.;
if (n == 5) {
aTol = Draw::Atof(a[4]);
}
//
aLC.Append(aS1);
aLC.Append(aS2);
//
@@ -468,7 +480,6 @@ Standard_Integer bsmt (Draw_Interpretor& di,
BOPAlgo_PaveFiller aPF(aAL);
//
aPF.SetArguments(aLC);
aPF.SetFuzzyValue(aTol);
//
aPF.Perform();
iErr=aPF.ErrorStatus();
@@ -770,81 +781,63 @@ Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const c
//=======================================================================
Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
const char* usage = "Usage: mkvolume r b1 b2 ... [-ni (do not intersect)] [-s (run in non parallel mode)]\n";
if (n < 3) {
di << "Usage: mkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]\n";
di << "Options:\n";
di << " -c - use this option if the arguments are compounds\n";
di << " containing shapes that should be interfered;\n";
di << " -ni - use this option if the arguments should not be interfered;\n";
di << " -s - use this option to run the operation in non parallel mode;\n";
di << " tol - additional tolerance value (real).\n";
return 1;
}
//
const char* usage = "Type mkvolume without arguments for the usage of the command.\n";
//
Standard_Boolean bToIntersect, bRunParallel, bCompounds;
Standard_Integer i;
Standard_Real aTol;
TopoDS_Shape aS;
BOPCol_ListOfShape aLS;
//
aTol = 0.;
bToIntersect = Standard_True;
bRunParallel = Standard_True;
bCompounds = Standard_False;
//
for (i = 2; i < n; ++i) {
aS = DBRep::Get(a[i]);
if (!aS.IsNull()) {
aLS.Append(aS);
}
else {
if (!strcmp(a[i], "-c")) {
bCompounds = Standard_True;
}
else if (!strcmp(a[i], "-ni")) {
bToIntersect = Standard_False;
}
else if (!strcmp(a[i], "-s")) {
bRunParallel = Standard_False;
}
else {
aTol = Draw::Atof(a[i]);
}
}
}
//
if (aLS.IsEmpty()) {
di << "No shapes to process.\n";
di << usage;
return 1;
}
//
// treat list of arguments for the case of compounds
if (bToIntersect && bCompounds) {
BOPCol_ListOfShape aLSx;
BOPCol_ListIteratorOfListOfShape aItLS;
//
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSx = aItLS.Value();
TopoDS_Iterator aItS(aSx);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSxS = aItS.Value();
aLSx.Append(aSxS);
}
Standard_Boolean bToIntersect, bRunParallel;
Standard_Integer i, aNb;
//
aNb = n;
bToIntersect = Standard_True;
bRunParallel = Standard_True;
//
if (!strcmp(a[n-1], "-ni")) {
bToIntersect = Standard_False;
aNb = n-1;
}
else if (!strcmp(a[n-1], "-s")) {
bRunParallel = Standard_False;
aNb = n-1;
}
if (n > 3) {
if (!strcmp(a[n-2], "-ni")) {
bToIntersect = Standard_False;
aNb = n-2;
}
else if (!strcmp(a[n-2], "-s")) {
bRunParallel = Standard_False;
aNb = n-2;
}
//
aLS.Clear();
aLS.Assign(aLSx);
}
//
if (aNb < 3) {
di << "no shapes to process.\n";
di << usage;
return 1;
}
//
BOPCol_ListOfShape aLS;
TopoDS_Shape aS;
for (i = 2; i < aNb; ++i) {
aS = DBRep::Get(a[i]);
if (!aS.IsNull()) {
aLS.Append(aS);
}
}
//
if (aLS.IsEmpty()) {
di << "no shapes to process.\n";
di << usage;
return 1;
}
//
BOPAlgo_MakerVolume aMV;
aMV.SetArguments(aLS);
aMV.SetIntersect(bToIntersect);
aMV.SetRunParallel(bRunParallel);
aMV.SetFuzzyValue(aTol);
//
aMV.Perform();
if (aMV.ErrorStatus()) {
@@ -858,3 +851,4 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
//
return 0;
}

View File

@@ -152,7 +152,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
const char** a )
{
if (n<2) {
di << " Use > bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol]" << "\n";
di << " Use > bopcheck Shape [level of check: 0 - 9] [-t -s]" << "\n";
di << " The level of check defines ";
di << " which interferences will be checked:\n";
di << " 0 - V/V only\n";
@@ -177,16 +177,13 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
//
Standard_Boolean bRunParallel, bShowTime;
Standard_Integer i, aLevel, aNbInterfTypes;
Standard_Real aTolerance;
//
aNbInterfTypes=BOPDS_DS::NbInterfTypes();
//
aLevel=aNbInterfTypes-1;
//
if (n>2) {
if (a[2][0] != '-') {
aLevel=Draw::Atoi(a[2]);
}
aLevel=Draw::Atoi(a[2]);
}
//
if (aLevel < 0 || aLevel > aNbInterfTypes-1) {
@@ -194,22 +191,15 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
return 1;
}
//
aTolerance = 0;
bShowTime=Standard_False;
bRunParallel=Standard_True;
for (i=2; i<n; ++i) {
for (i=3; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
}
else if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
else if (!strcmp(a[i], "-tol")) {
if (i+1 < n) {
++i;
aTolerance = Draw::Atof(a[i]);
}
}
}
//
//aLevel = (n==3) ? Draw::Atoi(a[2]) : aNbInterfTypes-1;
@@ -243,7 +233,6 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
aChecker.SetArguments(aLS);
aChecker.SetLevelOfCheck(aLevel);
aChecker.SetRunParallel(bRunParallel);
aChecker.SetFuzzyValue(aTolerance);
//
aChrono.Start();
//
@@ -342,7 +331,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (n<2) {
di << "\n";
di << " Use >bopargcheck Shape1 [[Shape2] ";
di << "[-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] [-tol tol]" << "\n" << "\n";
di << "[-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF]" << "\n" << "\n";
di << " -<Boolean Operation>" << "\n";
di << " F (fuse)" << "\n";
di << " O (common)" << "\n";
@@ -396,19 +385,11 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
Standard_Integer indxAD = 0;
Standard_Boolean isS2 = Standard_False;
Standard_Integer indxS2 = 0;
Standard_Real aTolerance = 0;
if(n >= 3) {
Standard_Integer iIndex = 0;
for(iIndex = 2; iIndex < n; iIndex++) {
if(!strcmp(a[iIndex], "-tol"))
{
if ((iIndex+1) < n) {
++iIndex;
aTolerance = Draw::Atof(a[iIndex]);
}
}
else if(a[iIndex][0] == '-')
if(a[iIndex][0] == '-')
{
isBO = Standard_True;
indxBO = iIndex;
@@ -430,7 +411,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
}
}
}
// set & test second shape
TopoDS_Shape aS22, aS2;
if(isS2) {
@@ -448,10 +429,9 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
}
}
}
// init checker
BOPAlgo_ArgumentAnalyzer aChecker;
aChecker.SetFuzzyValue(aTolerance);
aChecker.SetShape1(aS1);
// set default options (always tested!) for single and couple shapes
@@ -749,13 +729,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S1_BadType != 0)
CString1="YES";
else
CString1=aChecker.ArgumentTypeMode() ? "NO" : "DISABLED";
CString1="NO";
di << "Shapes are not suppotrted by BOP: " << CString1 << "\n";
Standard_CString CString2;
if (S1_SelfInt != 0)
CString2="YES";
else
CString2=aChecker.SelfInterMode() ? "NO" : "DISABLED";
CString2="NO";
di << "Self-Intersections : " << CString2;
if(S1_SelfInt != 0)
di << " Cases(" << S1_SelfInt << ") Total shapes(" << S1_SelfIntAll << ")" << "\n";
@@ -765,13 +745,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S1_OpAb != 0)
CString13="YES";
else
CString13=aChecker.SelfInterMode() ? "NO" : "DISABLED";
CString13="NO";
di << "Check for SI has been aborted : " << CString13 << "\n";
Standard_CString CString3;
if (S1_SmalE != 0)
CString3="YES";
else
CString3=aChecker.SmallEdgeMode() ? "NO" : "DISABLED";
CString3="NO";
di << "Too small edges : " << CString3;
if(S1_SmalE != 0)
di << " Cases(" << S1_SmalE << ") Total shapes(" << S1_SmalEAll << ")" << "\n";
@@ -781,7 +761,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S1_BadF != 0)
CString4="YES";
else
CString4=aChecker.RebuildFaceMode() ? "NO" : "DISABLED";
CString4="NO";
di << "Bad faces : " << CString4;
if(S1_BadF != 0)
di << " Cases(" << S1_BadF << ") Total shapes(" << S1_BadFAll << ")" << "\n";
@@ -791,7 +771,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S1_BadV != 0)
CString5="YES";
else
CString5=aChecker.MergeVertexMode() ? "NO" : "DISABLED";
CString5="NO";
di << "Too close vertices : " << CString5;
if(S1_BadV != 0)
di << " Cases(" << S1_BadV << ") Total shapes(" << S1_BadVAll << ")" << "\n";
@@ -801,7 +781,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S1_BadE != 0)
CString6="YES";
else
CString6=aChecker.MergeEdgeMode() ? "NO" : "DISABLED";
CString6="NO";
di << "Too close edges : " << CString6;
if(S1_BadE != 0)
di << " Cases(" << S1_BadE << ") Total shapes(" << S1_BadEAll << ")" << "\n";
@@ -811,7 +791,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S1_C0 != 0)
CString15="YES";
else
CString15=aChecker.ContinuityMode() ? "NO" : "DISABLED";
CString15="NO";
di << "Shapes with Continuity C0 : " << CString15;
if(S1_C0 != 0)
di << " Cases(" << S1_C0 << ") Total shapes(" << S1_C0All << ")" << "\n";
@@ -822,7 +802,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S1_COnS != 0)
CString17="YES";
else
CString17=aChecker.CurveOnSurfaceMode() ? "NO" : "DISABLED";
CString17="NO";
di << "Invalid Curve on Surface : " << CString17;
if(S1_COnS != 0)
di << " Cases(" << S1_COnS << ") Total shapes(" << S1_COnSAll << ")" << "\n";
@@ -839,13 +819,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S2_BadType != 0)
CString7="YES";
else
CString7=aChecker.ArgumentTypeMode() ? "NO" : "DISABLED";
CString7="NO";
di << "Shapes are not suppotrted by BOP: " << CString7 << "\n";
Standard_CString CString8;
if (S2_SelfInt != 0)
CString8="YES";
else
CString8=aChecker.SelfInterMode() ? "NO" : "DISABLED";
CString8="NO";
di << "Self-Intersections : " << CString8;
if(S2_SelfInt != 0)
di << " Cases(" << S2_SelfInt << ") Total shapes(" << S2_SelfIntAll << ")" << "\n";
@@ -856,13 +836,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S2_OpAb != 0)
CString14="YES";
else
CString14=aChecker.SelfInterMode() ? "NO" : "DISABLED";
CString14="NO";
di << "Check for SI has been aborted : " << CString14 << "\n";
Standard_CString CString9;
if (S2_SmalE != 0)
CString9="YES";
else
CString9=aChecker.SmallEdgeMode() ? "NO" : "DISABLED";
CString9="NO";
di << "Too small edges : " << CString9;
if(S2_SmalE != 0)
di << " Cases(" << S2_SmalE << ") Total shapes(" << S2_SmalEAll << ")" << "\n";
@@ -872,7 +852,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S2_BadF != 0)
CString10="YES";
else
CString10=aChecker.RebuildFaceMode() ? "NO" : "DISABLED";
CString10="NO";
di << "Bad faces : " << CString10;
if(S2_BadF != 0)
di << " Cases(" << S2_BadF << ") Total shapes(" << S2_BadFAll << ")" << "\n";
@@ -882,7 +862,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S2_BadV != 0)
CString11="YES";
else
CString11=aChecker.MergeVertexMode() ? "NO" : "DISABLED";
CString11="NO";
di << "Too close vertices : " << CString11;
if(S2_BadV != 0)
di << " Cases(" << S2_BadV << ") Total shapes(" << S2_BadVAll << ")" << "\n";
@@ -892,7 +872,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S2_BadE != 0)
CString12="YES";
else
CString12=aChecker.MergeEdgeMode() ? "NO" : "DISABLED";
CString12="NO";
di << "Too close edges : " << CString12;
if(S2_BadE != 0)
di << " Cases(" << S2_BadE << ") Total shapes(" << S2_BadEAll << ")" << "\n";
@@ -902,7 +882,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S2_C0 != 0)
CString16="YES";
else
CString16=aChecker.ContinuityMode() ? "NO" : "DISABLED";
CString16="NO";
di << "Shapes with Continuity C0 : " << CString16;
if(S2_C0 != 0)
di << " Cases(" << S2_C0 << ") Total shapes(" << S2_C0All << ")" << "\n";
@@ -913,7 +893,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
if (S2_COnS != 0)
CString18="YES";
else
CString18=aChecker.CurveOnSurfaceMode() ? "NO" : "DISABLED";
CString18="NO";
di << "Invalid Curve on Surface : " << CString18;
if(S2_COnS != 0)
di << " Cases(" << S2_COnS << ") Total shapes(" << S2_COnSAll << ")" << "\n";
@@ -995,7 +975,7 @@ Standard_Integer checkcurveonsurf(Draw_Interpretor& di,
}
//
Standard_Integer nE, nF, anECounter, aFCounter;
Standard_Real aT, aTolE, aDMax;
Standard_Real aT, aTolE, aD, aDMax;
TopExp_Explorer aExpF, aExpE;
char buf[200], aFName[10], anEName[10];
NCollection_DataMap<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher> aDMETol;
@@ -1022,9 +1002,10 @@ Standard_Integer checkcurveonsurf(Draw_Interpretor& di,
}
//
if (aDMETol.IsBound(aE)) {
Standard_Real& aD = aDMETol.ChangeFind(aE);
aD = aDMETol.Find(aE);
if (aDMax > aD) {
aD = aDMax;
aDMETol.UnBind(aE);
aDMETol.Bind(aE, aDMax);
}
}
else {

View File

@@ -54,10 +54,10 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
// Chapter's name
const char* g = "Partition commands";
// Commands
theCommands.Add("bfillds", "use bfillds [-s -t] [tol]" , __FILE__, bfillds, g);
theCommands.Add("bbuild" , "use bbuild r [-s -t]" , __FILE__, bbuild, g);
theCommands.Add("bbop" , "use bbop r op [-s -t]" , __FILE__, bbop, g);
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
theCommands.Add("bfillds", "use bfillds [-s -t]" , __FILE__, bfillds, g);
theCommands.Add("bbuild" , "use bbuild r [-s -t]" , __FILE__, bbuild, g);
theCommands.Add("bbop" , "use bbop r op [-s -t]", __FILE__, bbop, g);
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
}
//=======================================================================
@@ -84,15 +84,14 @@ Standard_Integer bfillds(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n > 4) {
di << " use bfillds [-s -t] [tol]\n";
if (n>3) {
di << " use bfillds [-s -t]\n";
return 0;
}
//
char buf[32];
Standard_Boolean bRunParallel, bShowTime;
Standard_Integer i, aNbS, iErr;
Standard_Real aTol;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_ListOfShape aLC;
BOPTime_Chronometer aChrono;
@@ -104,9 +103,8 @@ Standard_Integer bfillds(Draw_Interpretor& di,
return 0;
}
//
bShowTime = Standard_False;
bRunParallel = Standard_True;
aTol = 0.;
bShowTime=Standard_False;
bRunParallel=Standard_True;
for (i=1; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
@@ -114,9 +112,6 @@ Standard_Integer bfillds(Draw_Interpretor& di,
else if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
else {
aTol = Draw::Atof(a[i]);
}
}
//
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
@@ -137,7 +132,6 @@ Standard_Integer bfillds(Draw_Interpretor& di,
//
aPF.SetArguments(aLC);
aPF.SetRunParallel(bRunParallel);
aPF.SetFuzzyValue(aTol);
//
aChrono.Start();
//
@@ -324,14 +318,6 @@ Standard_Integer bbop(Draw_Interpretor& di,
//
pBOP->SetOperation(aOp);
}
else {
BOPCol_ListOfShape& aLSTools=BOPTest_Objects::Tools();
aIt.Initialize(aLSTools);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pBuilder->AddArgument(aS);
}
}
//
pBuilder->SetRunParallel(bRunParallel);
//

View File

@@ -1207,12 +1207,12 @@ static Standard_Boolean MinComputing( BOPTools_CheckCurveOnSurface& theFunction,
// Function : ComputeTolerance
// purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools::ComputeTolerance
(const Handle(Geom_Curve)& theCurve3D,
const Handle(Geom2d_Curve)& theCurve2D,
const Handle(Geom_Surface)& theSurf,
Standard_Real& theMaxDist,
Standard_Real& theMaxPar)
Standard_Boolean BOPTools_AlgoTools::
ComputeTolerance( const Handle(Geom_Curve)& theCurve3D,
const Handle(Geom2d_Curve)& theCurve2D,
const Handle(Geom_Surface)& theSurf,
Standard_Real& theMaxDist,
Standard_Real& theMaxPar)
{
if (theCurve3D.IsNull() ||
theCurve2D.IsNull() ||

View File

@@ -14,33 +14,103 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- modified by Peter KURNEV Tue Mar 5 14:01:51 2002
package BRepAlgoAPI
---Purpose: The BRepAlgoAPI package provides a full range of
-- services to perform Boolean Operations on arguments (shapes
-- that are defined in the BRep data structures). The
-- implemented new algorithm is intended to replace the Old
-- Boolean Operations algorithm in the BRepAlgoAPI package.
-- The New algorithm is free of a large number of weak spots
-- and limitations characteristics of the Old algorithm.
-- It is more powerful and flexible.
-- It can process arguments the Old algorithm was not adapted for.
-- The new algorithm is based on a new approach to operations
-- with interfered shapes. The advantages of the new algorithm
-- include an ability to treat arguments that have shared
-- entities. It can properly process two solids with shared
-- faces (in terms of TopoDS_Shape::IsSame()), two
-- faces that have shared edges and so on. Now the New Boolean
-- Operation algorithm can treat a wide range of shapes while the
-- Old one fails on them.
-- A generalization of treatment of same-domain faces
-- was included into the New algorithm. Two faces that share
-- the same domain are processed according to the common rule
-- even if the underlying surfaces are of different types. This
-- allows to execute Boolean Operations properly for the same
-- domain faces. It also concerns solids and shells that have the
-- same domain faces. It is quite frequent when two faces share
-- the same domain. And the New algorithm successfully copes
-- with it in contrast to the Old one.
-- Generalization oftreatment of degenerated edges
-- gives a possibility to process them properly. Although there
-- are still some difficulties with processing faces in areas close
-- to degenerated edges.
-- Now the processing of arguments having internal sub-shapes gives
-- a correct result. Internal sub-shape means a sub-shape of a
-- shape with the orientation TopAbs_INTERNAL and is located
-- inside the shape boundaries. The New algorithm processes faces
-- with internal edges properly. The new API of the Boolean
-- Operations (in addition to the old API) allows to reuse the
-- already computed interference between arguments in different
-- types of Boolean Operations. It is possible to use once computed
-- interference in FUSE, CUT and COMMON operations on given
-- arguments. So there is no need to re-compute the interference
-- between the arguments. It allows to reduce time for more than one
-- operation on given arguments.
-- The shape type of a Boolean Operation result and types of the arguments:
-- - For arguments with the same shape type (e.g. SOLID /
-- SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of this type;
-- - For arguments with different shape types (e.g.
-- SHELL / SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of the type that is the same as
-- that of the low type of the argument. Example: For
-- SHELL/SOLID the result is a COMPOUND of SHELLs.
-- - For arguments with different shape types some of
-- Boolean Operations can not be done using the default
-- implementation, because of a non-manifold type of the
-- result. Example: the FUSE operation for SHELL and SOLID
-- can not be done, but the CUT operation can be done, where
-- SHELL is the object and SOLID is the tool.
-- It is possible to perform Boolean Operations on arguments
-- of the COMPOUND shape type. In this case each compound must not
-- be heterogeneous, i.e. it must contain equidimensional shapes
-- (EDGEs or/and WIREs, FACEs or/and SHELLs, SOLIDs). SOLIDs
-- inside the COMPOUND must not contact (intersect or touch)
-- each other. The same condition is true for SHELLs or FACEs,
-- WIREs or EDGEs.
-- It does not support Boolean Operations for COMPSOLID type of shape.
uses
TopTools,
TopoDS,
TopTools,
TopoDS,
gp,
Geom,
Geom2d,
Message,
BOPCol,
BOPAlgo,
Geom2d,
BOPAlgo,
BOPDS,
BRepBuilderAPI
BRepBuilderAPI
is
deferred class BooleanOperation;
class Fuse;
class Common;
class Cut;
class Section;
deferred class BooleanOperation;
class Fuse;
class Common;
class Cut;
class Section;
class Check;
---Purpose: Check shapes on validity for boolean
--- operation.
deferred class Algo;
deferred class BuilderAlgo;
---Purpose: Check shapes on validity for boolean
--- operation.
DumpOper( theFilePath : CString from Standard;
theShape1 : Shape from TopoDS;
theShape2 : Shape from TopoDS;
@@ -52,70 +122,3 @@ is
end BRepAlgoAPI;
---Purpose: The BRepAlgoAPI package provides a full range of
-- services to perform Boolean Operations on arguments (shapes
-- that are defined in the BRep data structures). The
-- implemented new algorithm is intended to replace the Old
-- Boolean Operations algorithm in the BRepAlgoAPI package.
-- The New algorithm is free of a large number of weak spots
-- and limitations characteristics of the Old algorithm.
-- It is more powerful and flexible.
-- It can process arguments the Old algorithm was not adapted for.
-- The new algorithm is based on a new approach to operations
-- with interfered shapes. The advantages of the new algorithm
-- include an ability to treat arguments that have shared
-- entities. It can properly process two solids with shared
-- faces (in terms of TopoDS_Shape::IsSame()), two
-- faces that have shared edges and so on. Now the New Boolean
-- Operation algorithm can treat a wide range of shapes while the
-- Old one fails on them.
-- A generalization of treatment of same-domain faces
-- was included into the New algorithm. Two faces that share
-- the same domain are processed according to the common rule
-- even if the underlying surfaces are of different types. This
-- allows to execute Boolean Operations properly for the same
-- domain faces. It also concerns solids and shells that have the
-- same domain faces. It is quite frequent when two faces share
-- the same domain. And the New algorithm successfully copes
-- with it in contrast to the Old one.
-- Generalization oftreatment of degenerated edges
-- gives a possibility to process them properly. Although there
-- are still some difficulties with processing faces in areas close
-- to degenerated edges.
-- Now the processing of arguments having internal sub-shapes gives
-- a correct result. Internal sub-shape means a sub-shape of a
-- shape with the orientation TopAbs_INTERNAL and is located
-- inside the shape boundaries. The New algorithm processes faces
-- with internal edges properly. The new API of the Boolean
-- Operations (in addition to the old API) allows to reuse the
-- already computed interference between arguments in different
-- types of Boolean Operations. It is possible to use once computed
-- interference in FUSE, CUT and COMMON operations on given
-- arguments. So there is no need to re-compute the interference
-- between the arguments. It allows to reduce time for more than one
-- operation on given arguments.
-- The shape type of a Boolean Operation result and types of the arguments:
-- - For arguments with the same shape type (e.g. SOLID /
-- SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of this type;
-- - For arguments with different shape types (e.g.
-- SHELL / SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of the type that is the same as
-- that of the low type of the argument. Example: For
-- SHELL/SOLID the result is a COMPOUND of SHELLs.
-- - For arguments with different shape types some of
-- Boolean Operations can not be done using the default
-- implementation, because of a non-manifold type of the
-- result. Example: the FUSE operation for SHELL and SOLID
-- can not be done, but the CUT operation can be done, where
-- SHELL is the object and SOLID is the tool.
-- It is possible to perform Boolean Operations on arguments
-- of the COMPOUND shape type. In this case each compound must not
-- be heterogeneous, i.e. it must contain equidimensional shapes
-- (EDGEs or/and WIREs, FACEs or/and SHELLs, SOLIDs). SOLIDs
-- inside the COMPOUND must not contact (intersect or touch)
-- each other. The same condition is true for SHELLs or FACEs,
-- WIREs or EDGEs.
-- It does not support Boolean Operations for COMPSOLID type of shape.

View File

@@ -1,75 +0,0 @@
-- Created by: Peter KURNEV
-- 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.
deferred class Algo from BRepAlgoAPI
inherits MakeShape from BRepBuilderAPI
---Purpose: provides the root interface for algorithms
uses
BaseAllocator from BOPCol,
ProgressIndicator from Message,
Shape from TopoDS
--raises
is
Initialize
returns Algo from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Algo();"
Initialize (theAllocator: BaseAllocator from BOPCol)
returns Algo from BRepAlgoAPI;
ErrorStatus (me)
returns Integer from Standard;
WarningStatus (me)
returns Integer from Standard;
Allocator(me)
returns BaseAllocator from BOPCol;
---C++: return const &
SetRunParallel(me:out;
theFlag:Boolean from Standard);
---Purpose: Set the flag of parallel processing
-- if <theFlag> is true the parallel processing is switched on
-- if <theFlag> is false the parallel processing is switched off
--
RunParallel(me)
returns Boolean from Standard;
---Purpose: Returns the flag of parallel processing
SetProgressIndicator(me:out;
theObj: ProgressIndicator from Message);
---Purpose: Set the Progress Indicator object.
UserBreak(me)
is protected;
---Purpose: Breaks the execution if the break signal
-- is indicated by myProgressIndicator.
Shape(me)
returns Shape from TopoDS
is redefined;
---C++: return const &
fields
myAllocator : BaseAllocator from BOPCol is protected;
myErrorStatus : Integer from Standard is protected;
myWarningStatus : Integer from Standard is protected;
myRunParallel : Boolean from Standard is protected;
myProgressIndicator : ProgressIndicator from Message is protected;
end Algo;

View File

@@ -14,8 +14,12 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- modified by Peter KURNEV Tue Mar 5 14:01:51 2002
-- modified by Eugeny MALTCHIKOV Wed Jul 04 11:13:01 2012
deferred class BooleanOperation from BRepAlgoAPI
inherits BuilderAlgo from BRepAlgoAPI
inherits MakeShape from BRepBuilderAPI
---Purpose: The abstract class BooleanOperation is the root
-- class of Boolean Operations (see Overview).
@@ -29,49 +33,30 @@ deferred class BooleanOperation from BRepAlgoAPI
uses
Shape from TopoDS,
DataMapOfShapeShape from TopTools,
Shape from TopoDS,
ListOfShape from TopTools,
Operation from BOPAlgo,
PaveFiller from BOPAlgo
Operation from BOPAlgo,
Builder from BOPAlgo,
PBuilder from BOPAlgo,
PaveFiller from BOPAlgo,
PPaveFiller from BOPAlgo,
DataMapOfIntegerListOfShape from TopTools,
DataMapOfIntegerShape from TopTools,
DataMapOfShapeShape from TopTools
is
Initialize
returns BooleanOperation from BRepAlgoAPI;
is
Initialize (S1 :Shape from TopoDS;
S2 :Shape from TopoDS;
anOperation:Operation from BOPAlgo);
S2 :Shape from TopoDS;
anOperation:Operation from BOPAlgo);
---Purpose: Prepares the operations for S1 and S2.
Initialize (S1 :Shape from TopoDS;
S2 :Shape from TopoDS;
aPF :PaveFiller from BOPAlgo;
anOperation:Operation from BOPAlgo);
S2 :Shape from TopoDS;
aDSF :PaveFiller from BOPAlgo;
anOperation:Operation from BOPAlgo);
---Purpose: Prepares the operations for S1 and S2.
SetShape1(me:out;
S:Shape from TopoDS);
SetShape2(me:out;
S:Shape from TopoDS);
Shape1(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the first shape involved in this Boolean operation.
---C++: return const &
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();"
Shape2(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the second shape involved in this Boolean operation.
---C++: return const &
SetOperation (me:out;
anOp: Operation from BOPAlgo);
---Purpose: Sets the type of Boolean operation to perform
@@ -80,35 +65,59 @@ is
--- BOPAlgo_FUSE
--- BOPAlgo_CUT
--- BOPAlgo_CUT21
---
Operation (me)
returns Operation from BOPAlgo;
---Purpose: Returns the type of Boolean Operation that has been performed.
---
Build (me:out)
is redefined virtual;
---Purpose: Provides the algorithm of Boolean Operations
-- - Filling interference Data Structure (if it is necessary)
-- - Building the result of the operation.
-- - Building the result of the operation.
Shape1(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the first shape involved in this Boolean operation.
---C++: return const &
Shape2(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the second shape involved in this Boolean operation.
---C++: return const &
BuilderCanWork(me)
returns Boolean from Standard;
Operation (me)
returns Operation from BOPAlgo;
---Purpose: Returns the type of Boolean Operation that has been performed.
FuseEdges(me)
returns Boolean from Standard;
---Purpose: Returns the flag of edge refining
returns Boolean from Standard;
---Purpose: Returns the flag of edge refining
RefineEdges(me:out);
---Purpose: Fuse C1 edges
SectionEdges (me: in out)
returns ListOfShape from TopTools;
--- Purpose: Returns a list of section edges.
-- The edges represent the result of intersection between arguments of
-- Boolean Operation. They are computed during operation execution.
---C++: return const &
PrepareFiller(me:out)
returns Boolean from Standard
is protected;
---Category: Querying
BuilderCanWork(me)
returns Boolean from Standard;
ErrorStatus(me)
returns Integer from Standard;
---Purpose: Returns the error status of operation.
--- 0 - Ok
--- 1 - The Object is created but Nothing is Done
--- 2 - Null source shapes is not allowed
--- 3 - Check types of the arguments
--- 4 - Can not allocate memory for the DSFiller
--- 5 - The Builder can not work with such types of arguments
--- 6 - Unknown operation is not allowed
--- 7 - Can not allocate memory for the Builder
-- > 100 - See the Builder's ErrorStatus
Modified (me: in out;
aS : Shape from TopoDS)
returns ListOfShape from TopTools
@@ -148,34 +157,39 @@ is
is virtual;
---Purpose: Returns true if there is at least one deleted shape.
--- For use in BRepNaming.
--
-- protected
--
PrepareFiller(me:out)
returns Boolean from Standard
is protected;
Destroy (me: in out);
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation(){Destroy();}"
SectionEdges (me: in out)
returns ListOfShape from TopTools;
--- Purpose: Returns a list of section edges.
-- The edges represent the result of intersection between arguments of
-- Boolean Operation. They are computed during operation execution.
---C++: return const &
RefinedList (me: in out;
theL : ListOfShape from TopTools)
returns ListOfShape from TopTools
is protected;
is private;
---Purpose: Returns the list of shapes generated from the shape <S>.
--- For use in BRepNaming.
---C++: return const &
fields
myS1 : Shape from TopoDS is protected;
myS2 : Shape from TopoDS is protected;
myOperation: Operation from BOPAlgo is protected;
--
myEntryType: Integer from Standard is protected;
myBuilderCanWork : Boolean from Standard is protected;
myS1 : Shape from TopoDS is protected;
myS2 : Shape from TopoDS is protected;
myBuilderCanWork : Boolean from Standard is protected;
myOperation : Operation from BOPAlgo is protected;
myErrorStatus : Integer from Standard is protected;
myDSFiller : PPaveFiller from BOPAlgo is protected;
myBuilder : PBuilder from BOPAlgo is protected;
myEntryType : Integer from Standard;
-- for edge refiner
myFuseEdges : Boolean from Standard ;
myModifFaces : DataMapOfShapeShape from TopTools;
myEdgeMap : DataMapOfShapeShape from TopTools;
myFuseEdges : Boolean from Standard ;
myModifFaces : DataMapOfShapeShape from TopTools;
myEdgeMap : DataMapOfShapeShape from TopTools;
end BooleanOperation;

View File

@@ -16,42 +16,21 @@
#include <BRepAlgoAPI_BooleanOperation.ixx>
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
#include <TopTools_DataMapOfIntegerShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepAlgoAPI_Check.hxx>
#include <BRepAlgoAPI.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <BRepAlgoAPI_Check.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <TopExp.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BOPDS_PDS.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_Section.hxx>
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation()
:
BRepAlgoAPI_BuilderAlgo(),
myOperation(BOPAlgo_UNKNOWN),
myEntryType(1),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
@@ -61,12 +40,14 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
const TopoDS_Shape& aS2,
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(),
myS1(aS1),
myS2(aS2),
myOperation(anOp),
myEntryType(1),
myBuilderCanWork(Standard_False),
myOperation(anOp),
myErrorStatus(1),
myDSFiller(NULL),
myBuilder(NULL),
myEntryType(1),
myFuseEdges(Standard_False)
{
}
@@ -74,36 +55,40 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aPF,
const BOPAlgo_Operation anOp)
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aDSFiller,
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(),
myS1(aS1),
myS2(aS2),
myBuilderCanWork(Standard_False),
myOperation(anOp),
myErrorStatus(1),
myDSFiller(NULL),
myBuilder(NULL),
myEntryType(0),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
myDSFiller=(BOPAlgo_PaveFiller*)&aPF;
if ((Standard_Address) &aDSFiller!=NULL) {
myDSFiller=(BOPAlgo_PaveFiller*)&aDSFiller;
}
}
//=======================================================================
//function : ~
//function : Destroy
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::~BRepAlgoAPI_BooleanOperation()
void BRepAlgoAPI_BooleanOperation::Destroy()
{
if (myBuilder) {
if (myBuilder!=NULL) {
delete myBuilder;
myBuilder=NULL;
}
if (myDSFiller && myEntryType) {
if (myDSFiller!=NULL && myEntryType) {
delete myDSFiller;
myDSFiller=NULL;
}
//
myModifFaces.Clear();
myEdgeMap.Clear();
@@ -112,8 +97,7 @@ BRepAlgoAPI_BooleanOperation::~BRepAlgoAPI_BooleanOperation()
//function : SetOperation
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetOperation
(const BOPAlgo_Operation anOp)
void BRepAlgoAPI_BooleanOperation::SetOperation (const BOPAlgo_Operation anOp)
{
myOperation=anOp;
}
@@ -121,42 +105,38 @@ void BRepAlgoAPI_BooleanOperation::SetOperation
//function : Operation
//purpose :
//=======================================================================
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
{
return myOperation;
}
//=======================================================================
//function : SetShape1
//function : FuseEdges
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetShape1(const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
{
myS1=aS;
}
//=======================================================================
//function : SetShape2
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetShape2(const TopoDS_Shape& aS)
{
myS2=aS;
}
return myFuseEdges;
}
//=======================================================================
//function : Shape1
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
{
return myS1;
}
//=======================================================================
//function : Shape2
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
{
return myS2;
}
//=======================================================================
//function : BuilderCanWork
//purpose :
@@ -166,18 +146,54 @@ const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
return myBuilderCanWork;
}
//=======================================================================
//function : FuseEdges
//function : ErrorStatus
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
Standard_Integer BRepAlgoAPI_BooleanOperation::ErrorStatus()const
{
return myFuseEdges;
return myErrorStatus;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_Shape& aS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
else {
myGenerated = myBuilder->Modified(aS);
if(myFuseEdges) {
TopTools_ListOfShape theLS;
theLS.Assign(myGenerated);
//
RefinedList(theLS);
}
return myGenerated;
}
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::IsDeleted(const TopoDS_Shape& aS)
{
Standard_Boolean bDeleted = Standard_True;
if (myBuilder != NULL) {
bDeleted=myBuilder->IsDeleted(aS);
}
return bDeleted;
}
//=======================================================================
//function : PrepareFiller
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
{
Standard_Boolean bIsNewFiller=Standard_False;
myErrorStatus=1;
@@ -207,9 +223,6 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
aLS.Append(myS2);
//
myDSFiller->SetArguments(aLS);
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
}
return bIsNewFiller;
@@ -218,7 +231,7 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
//function : Build
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::Build()
void BRepAlgoAPI_BooleanOperation::Build()
{
Standard_Boolean bIsNewFiller;
Standard_Integer iErr;
@@ -275,8 +288,6 @@ void BRepAlgoAPI_BooleanOperation::Build()
pBOP->SetOperation(myOperation);
}
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->PerformWithFiller(*myDSFiller);
iErr = myBuilder->ErrorStatus();
if (!iErr) {
@@ -305,99 +316,12 @@ void BRepAlgoAPI_BooleanOperation::Build()
}
}
//=======================================================================
//function : RefineEdges
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
{
if(myFuseEdges) return; //Edges have been refined yet
BRepLib_FuseEdges FE(myShape);
FE.SetConcatBSpl(Standard_True);
// avoid fusing old edges
TopTools_IndexedMapOfShape mapOldEdges;
TopExp::MapShapes (myS1, TopAbs_EDGE, mapOldEdges);
TopExp::MapShapes (myS2, TopAbs_EDGE, mapOldEdges);
FE.AvoidEdges (mapOldEdges);
// Get List of edges that have been fused
myFuseEdges = Standard_False;
myModifFaces.Clear();
myEdgeMap.Clear();
TopTools_DataMapOfIntegerListOfShape aFusedEdges;
FE.Edges(aFusedEdges);
Standard_Integer nle = aFusedEdges.Extent();
if (nle != 0) {
FE.Perform();
myShape = FE.Shape();
TopTools_DataMapOfIntegerShape aResultEdges;
FE.ResultEdges(aResultEdges);
FE.Faces(myModifFaces);
myFuseEdges = Standard_True;
Standard_Integer i;
for(i = 1; i <= nle; ++i) {
const TopoDS_Shape& aNewE = aResultEdges(i);
const TopTools_ListOfShape& aListOfOldEdges = aFusedEdges(i);
TopTools_ListIteratorOfListOfShape anIter(aListOfOldEdges);
for(; anIter.More(); anIter.Next()) {
myEdgeMap.Bind(anIter.Value(), aNewE);
}
}
}
}
//=======================================================================
//function : RefinedList
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::RefinedList
(const TopTools_ListOfShape& theL)
{
myGenerated.Clear();
TopTools_MapOfShape aMap;
TopTools_ListIteratorOfListOfShape anIter(theL);
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& anS = anIter.Value();
if(anS.ShapeType() == TopAbs_EDGE) {
if(myEdgeMap.IsBound(anS)) {
const TopoDS_Shape& aNewEdge = myEdgeMap.Find(anS);
if(aMap.Add(aNewEdge)) {
myGenerated.Append(aNewEdge);
}
}
else {
myGenerated.Append(anS);
}
}
else if (anS.ShapeType() == TopAbs_FACE) {
if(myModifFaces.IsBound(anS)) {
myGenerated.Append(myModifFaces.Find(anS));
}
else {
myGenerated.Append(anS);
}
}
else {
myGenerated.Append(anS);
}
}
return myGenerated;
}
//
//=======================================================================
//function : SectionEdges
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
{
if (myBuilder==NULL) {
myGenerated.Clear();
@@ -440,12 +364,12 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
//
return myGenerated;
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated
(const TopoDS_Shape& S)
// ================================================================================================
// function: Generated
// purpose:
// ================================================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated(const TopoDS_Shape& S)
{
if (myBuilder==NULL) {
myGenerated.Clear();
@@ -460,46 +384,10 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated
return myBuilder->Generated(S);
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified
(const TopoDS_Shape& aS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
else {
myGenerated = myBuilder->Modified(aS);
if(myFuseEdges) {
TopTools_ListOfShape theLS;
theLS.Assign(myGenerated);
//
RefinedList(theLS);
}
return myGenerated;
}
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::IsDeleted
(const TopoDS_Shape& aS)
{
Standard_Boolean bDeleted = Standard_True;
if (myBuilder != NULL) {
bDeleted=myBuilder->IsDeleted(aS);
}
return bDeleted;
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
// ================================================================================================
// function: HasModified
// purpose:
// ================================================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasModified() const
{
if (myBuilder==NULL) {
@@ -507,10 +395,11 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasModified() const
}
return myBuilder->HasModified();
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
// ================================================================================================
// function: HasGenerated
// purpose:
// ================================================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasGenerated() const
{
if (myBuilder==NULL) {
@@ -518,10 +407,11 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasGenerated() const
}
return myBuilder->HasGenerated();
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
// ================================================================================================
// function: HasDeleted
// purpose:
// ================================================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
{
if (myBuilder==NULL) {
@@ -529,3 +419,93 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
}
return myBuilder->HasDeleted();
}
//=======================================================================
//function : RefineEdges
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
{
if(myFuseEdges) return; //Edges have been refined yet
BRepLib_FuseEdges FE(myShape);
FE.SetConcatBSpl(Standard_True);
// avoid fusing old edges
TopTools_IndexedMapOfShape mapOldEdges;
TopExp::MapShapes (myS1, TopAbs_EDGE, mapOldEdges);
TopExp::MapShapes (myS2, TopAbs_EDGE, mapOldEdges);
FE.AvoidEdges (mapOldEdges);
// Get List of edges that have been fused
myFuseEdges = Standard_False;
myModifFaces.Clear();
myEdgeMap.Clear();
TopTools_DataMapOfIntegerListOfShape aFusedEdges;
FE.Edges(aFusedEdges);
Standard_Integer nle = aFusedEdges.Extent();
if (nle != 0) {
FE.Perform();
myShape = FE.Shape();
TopTools_DataMapOfIntegerShape aResultEdges;
FE.ResultEdges(aResultEdges);
FE.Faces(myModifFaces);
myFuseEdges = Standard_True;
Standard_Integer i;
for(i = 1; i <= nle; ++i) {
const TopoDS_Shape& aNewE = aResultEdges(i);
const TopTools_ListOfShape& aListOfOldEdges = aFusedEdges(i);
TopTools_ListIteratorOfListOfShape anIter(aListOfOldEdges);
for(; anIter.More(); anIter.Next()) {
myEdgeMap.Bind(anIter.Value(), aNewE);
}
}
}
}
//=======================================================================
//function : RefinedList
//purpose :
//=======================================================================
const TopTools_ListOfShape&
BRepAlgoAPI_BooleanOperation::RefinedList(const TopTools_ListOfShape& theL)
{
myGenerated.Clear();
TopTools_MapOfShape aMap;
TopTools_ListIteratorOfListOfShape anIter(theL);
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& anS = anIter.Value();
if(anS.ShapeType() == TopAbs_EDGE) {
if(myEdgeMap.IsBound(anS)) {
const TopoDS_Shape& aNewEdge = myEdgeMap.Find(anS);
if(aMap.Add(aNewEdge)) {
myGenerated.Append(aNewEdge);
}
}
else {
myGenerated.Append(anS);
}
}
else if (anS.ShapeType() == TopAbs_FACE) {
if(myModifFaces.IsBound(anS)) {
myGenerated.Append(myModifFaces.Find(anS));
}
else {
myGenerated.Append(anS);
}
}
else {
myGenerated.Append(anS);
}
}
return myGenerated;
}

View File

@@ -1,47 +0,0 @@
-- Created by: Peter KURNEV
-- 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.
deferred class BuilderAlgo from BRepAlgoAPI
inherits Algo from BRepAlgoAPI
---Purpose: provides the root interface for algorithms
uses
BaseAllocator from BOPCol,
PPaveFiller from BOPAlgo,
PBuilder from BOPAlgo
--raises
is
Initialize
returns BuilderAlgo from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();"
Initialize (theAllocator: BaseAllocator from BOPCol)
returns BuilderAlgo from BRepAlgoAPI;
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---Purpose: Returns the additional tolerance
fields
myDSFiller : PPaveFiller from BOPAlgo is protected;
myBuilder : PBuilder from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
end BuilderAlgo;

View File

@@ -1,67 +0,0 @@
// Created by: Peter KURNEV
// 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 <BRepAlgoAPI_BuilderAlgo.ixx>
#include <NCollection_BaseAllocator.hxx>
//=======================================================================
// function:
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
:
BRepAlgoAPI_Algo(),
myDSFiller(NULL),
myBuilder(NULL),
myFuzzyValue(0.)
{}
//=======================================================================
// function:
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BRepAlgoAPI_Algo(theAllocator),
myDSFiller(NULL),
myBuilder(NULL),
myFuzzyValue(0.)
{}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo()
{
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BRepAlgoAPI_BuilderAlgo::FuzzyValue() const
{
return myFuzzyValue;
}

View File

@@ -13,8 +13,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Check from BRepAlgoAPI
inherits Algo from BRepAlgoAPI
class Check from BRepAlgoAPI
---Purpose:
-- The class Check provides a diagnostic tool for checking
-- single shape or couple of shapes.
@@ -116,20 +115,11 @@ is
returns ListOfCheckResult from BOPAlgo;
---C++: return const&
---Purpose: Returns faulty shapes.
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---Purpose: Returns the additional tolerance
fields
myS1, myS2 : Shape from TopoDS is protected;
myAnalyzer : PArgumentAnalyzer from BOPAlgo is protected;
myResult : ListOfCheckResult from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
myS1, myS2 : Shape from TopoDS is protected;
myAnalyzer : PArgumentAnalyzer from BOPAlgo is protected;
myResult : ListOfCheckResult from BOPAlgo is protected;
end BooleanOperation;

View File

@@ -21,11 +21,8 @@
//function : BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::BRepAlgoAPI_Check()
:
BRepAlgoAPI_Algo(),
myAnalyzer(NULL),
myFuzzyValue(0.)
BRepAlgoAPI_Check::BRepAlgoAPI_Check()
: myAnalyzer(NULL)
{
}
@@ -33,11 +30,9 @@ BRepAlgoAPI_Check::BRepAlgoAPI_Check()
//function : BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
: BRepAlgoAPI_Algo(),
myFuzzyValue(0.)
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI);
//
@@ -48,13 +43,11 @@ BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS,
//function : BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
: BRepAlgoAPI_Algo(),
myFuzzyValue(0.)
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
Init(theS1, theS2, theOp, bTestSE, bTestSI);
//
@@ -65,7 +58,7 @@ BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1,
//function : ~BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::~BRepAlgoAPI_Check()
BRepAlgoAPI_Check::~BRepAlgoAPI_Check()
{
if(myAnalyzer){
delete myAnalyzer;
@@ -74,32 +67,13 @@ BRepAlgoAPI_Check::~BRepAlgoAPI_Check()
myResult.Clear();
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BRepAlgoAPI_Check::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
//function : SetData
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI);
}
@@ -108,23 +82,25 @@ void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS,
//function : SetData
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
Init(theS1, theS2, theOp, bTestSE, bTestSI);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::Init(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
void BRepAlgoAPI_Check::Init(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
myResult.Clear();
myS1 = theS1;
@@ -138,17 +114,13 @@ void BRepAlgoAPI_Check::Init(const TopoDS_Shape& theS1,
myAnalyzer->ArgumentTypeMode() = Standard_True;
myAnalyzer->SmallEdgeMode() = bTestSE;
myAnalyzer->SelfInterMode() = bTestSI;
//
myAnalyzer->SetRunParallel(myRunParallel);
myAnalyzer->SetProgressIndicator(myProgressIndicator);
myAnalyzer->SetFuzzyValue(myFuzzyValue);
}
//=======================================================================
//function : Result
//purpose :
//=======================================================================
const BOPAlgo_ListOfCheckResult& BRepAlgoAPI_Check::Result()
const BOPAlgo_ListOfCheckResult& BRepAlgoAPI_Check::Result()
{
return myResult;
}
@@ -157,7 +129,7 @@ const BOPAlgo_ListOfCheckResult& BRepAlgoAPI_Check::Result()
//function : IsValid
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Check::IsValid()
Standard_Boolean BRepAlgoAPI_Check::IsValid()
{
return myResult.IsEmpty();
}
@@ -166,7 +138,7 @@ Standard_Boolean BRepAlgoAPI_Check::IsValid()
//function : Perform
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::Perform()
void BRepAlgoAPI_Check::Perform()
{
Standard_Boolean isS1, isS2;
//incompatibility of shape types, small edges and self-interference
@@ -203,3 +175,5 @@ void BRepAlgoAPI_Check::Perform()
myResult.Append(aRes);
}
}

View File

@@ -14,34 +14,26 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Common from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
class Common from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Common provides a
-- Boolean common operation on a pair of arguments (Boolean Intersection).
-- The class Common provides a framework for:
-- - Defining the construction of a common shape;
-- - Implementing the building algorithm
-- - Consulting the result.
---Purpose: The class Common provides a
-- Boolean common operation on a pair of arguments (Boolean Intersection).
-- The class Common provides a framework for:
-- - Defining the construction of a common shape;
-- - Implementing the building algorithm
-- - Consulting the result.
uses
Shape from TopoDS,
PaveFiller from BOPAlgo
is
Create
returns Common from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Common();"
--- Purpose: Empty constructor
is
Create (S1,S2 : Shape from TopoDS)
returns Common from BRepAlgoAPI;
---Purpose: Constructs a common part for shapes aS1 and aS2 .
returns Common from BRepAlgoAPI;
---Purpose: Constructs a common part for shapes aS1 and aS2 .
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo)
returns Common from BRepAlgoAPI;
--- Purpose: Constructs a common part for shapes aS1 and aS2 using aDSFiller
aDSF:PaveFiller from BOPAlgo)
returns Common from BRepAlgoAPI;
end Common;
--- Purpose: Constructs a common part for shapes aS1 and aS2 using aDSFiller

View File

@@ -18,23 +18,6 @@
#include <BRepAlgoAPI_BooleanOperation.hxx>
//=======================================================================
//function : BRepAlgoAPI_Common
//purpose :
//=======================================================================
BRepAlgoAPI_Common::BRepAlgoAPI_Common()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_COMMON;
}
//=======================================================================
//function : ~BRepAlgoAPI_Common
//purpose :
//=======================================================================
BRepAlgoAPI_Common::~BRepAlgoAPI_Common()
{
}
//=======================================================================
//function : BRepAlgoAPI_Common
//purpose :

View File

@@ -14,39 +14,31 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Cut from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Cut provides a Boolean
-- cut operation on a pair of arguments (Boolean Subtraction).
-- The class Cut provides a framework for:
-- - Defining the construction of a cut shape
-- - Implementing the building algorithm
-- - Consulting the result
class Cut from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Cut provides a Boolean
-- cut operation on a pair of arguments (Boolean Subtraction).
-- The class Cut provides a framework for:
-- - Defining the construction of a cut shape
-- - Implementing the building algorithm
-- - Consulting the result
uses
Shape from TopoDS,
PaveFiller from BOPAlgo
is
Create
returns Cut from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Cut();"
--- Purpose: Empty constructor
is
Create (S1,S2 : Shape from TopoDS)
returns Cut from BRepAlgoAPI;
---Purpose: Shape aS2 cuts shape aS1. The
-- resulting shape is a new shape produced by the cut operation.
returns Cut from BRepAlgoAPI;
---Purpose: Shape aS2 cuts shape aS1. The
-- resulting shape is a new shape produced by the cut operation.
Create (S1,S2 : Shape from TopoDS;
aDSF : PaveFiller from BOPAlgo;
bFWD : Boolean from Standard=Standard_True)
returns Cut from BRepAlgoAPI;
--- Purpose: Constructs a new shape cut from
-- shape aS1 by shape aS2 using aDSFiller (see
-- BRepAlgoAPI_BooleanOperation Constructor).
aDSF : PaveFiller from BOPAlgo;
bFWD : Boolean from Standard=Standard_True)
returns Cut from BRepAlgoAPI;
--- Purpose: Constructs a new shape cut from
-- shape aS1 by shape aS2 using aDSFiller (see
-- BRepAlgoAPI_BooleanOperation Constructor).
end Cut;

View File

@@ -22,28 +22,9 @@
//function : BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_CUT;
}
//=======================================================================
//function : ~BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::~BRepAlgoAPI_Cut()
{
}
//=======================================================================
//function : BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
:
BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_CUT)
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_CUT)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;
@@ -53,12 +34,11 @@ BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
//function : BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean bFWD)
:
BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean bFWD)
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;

View File

@@ -16,31 +16,26 @@
class Fuse from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Fuse provides a
-- Boolean fusion operation on a pair of arguments (Boolean Union).
-- The class Fuse provides a framework for:
-- - Defining the construction of a fused shape;
-- - Implementing the building algorithm
-- - Consulting the result.
---Purpose: The class Fuse provides a
-- Boolean fusion operation on a pair of arguments (Boolean Union).
-- The class Fuse provides a framework for:
-- - Defining the construction of a fused shape;
-- - Implementing the building algorithm
-- - Consulting the result.
uses
Shape from TopoDS,
PaveFiller from BOPAlgo
is
Create
returns Fuse from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Fuse();"
--- Purpose: Empty constructor
is
Create (S1,S2 : Shape from TopoDS)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a fuse of shapes aS1 and aS2.
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a fuse of shapes aS1 and aS2.
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller.
aDSF:PaveFiller from BOPAlgo)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller.
end Fuse;

View File

@@ -22,28 +22,9 @@
//function : BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_FUSE;
}
//=======================================================================
//function : ~BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::~BRepAlgoAPI_Fuse()
{
}
//=======================================================================
//function : BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
:
BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_FUSE)
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_FUSE)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;
@@ -54,11 +35,10 @@ BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
//function : BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF)
:
BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_FUSE)
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF)
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_FUSE)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;

View File

@@ -16,32 +16,31 @@
-- modified by Michael KLOKOV Wed Mar 6 15:01:25 2002
class Section from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
class Section from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
---Purpose: Computes the intersection of two shapes or geometries.
-- Geometries can be surfaces of planes.
-- Geometries are converted to faces
-- When a geometry has been converted to
-- topology the created shape can be found using
-- the methods Shape1 and Shape2 inherited from the class BooleanOperation.
-- The result (Shape() method) is a compound containing
-- edges built on intersection curves.
-- By default, the section is performed immediatly in
-- class constructors, with default values :
-- - geometries built are NOT approximated.
-- - PCurves are NOT computed on both parts.
-- Example : giving two shapes S1,S2 accessing faces,
-- let compute the section edges R on S1,S2,
-- performing approximation on new curves,
-- performing PCurve on part 1 but not on part 2 :
-- Standard_Boolean PerformNow = Standard_False;
-- BRepBoolAPI_Section S(S1,S2,PerformNow);
-- S.ComputePCurveOn1(Standard_True);
-- S.Approximation(Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
-- On Null Shapes of geometries, NotDone() is called.
---Purpose: Computes the intersection of two shapes or geometries.
-- Geometries can be surfaces of planes.
-- Geometries are converted to faces
-- When a geometry has been converted to
-- topology the created shape can be found using
-- the methods Shape1 and Shape2 inherited from the class BooleanOperation.
-- The result (Shape() method) is a compound containing
-- edges built on intersection curves.
-- By default, the section is performed immediatly in
-- class constructors, with default values :
-- - geometries built are NOT approximated.
-- - PCurves are NOT computed on both parts.
-- Example : giving two shapes S1,S2 accessing faces,
-- let compute the section edges R on S1,S2,
-- performing approximation on new curves,
-- performing PCurve on part 1 but not on part 2 :
-- Standard_Boolean PerformNow = Standard_False;
-- BRepBoolAPI_Section S(S1,S2,PerformNow);
-- S.ComputePCurveOn1(Standard_True);
-- S.Approximation(Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
-- On Null Shapes of geometries, NotDone() is called.
uses
Pln from gp,
@@ -52,289 +51,262 @@ uses
ListOfShape from TopTools
is
Create
returns Section from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Section();"
--- Purpose: Empty constructor
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Section(){}"
Create(Sh1,Sh2 : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
Create(Sh : Shape from TopoDS;
Pl : Pln from gp;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Create(Sh : Shape from TopoDS; Pl : Pln from gp;
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
Create(Sh : Shape from TopoDS;
Sf : Surface from Geom;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Create(Sh : Shape from TopoDS; Sf : Surface from Geom;
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
Create(Sf : Surface from Geom;
Sh : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Create(Sf1 : Surface from Geom;
Sf2 : Surface from Geom;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: This and the above classes construct a framework for
-- computing the section lines of:
-- - two shapes Sh1 and Sh2, or
-- - shape Sh and plane Pl, or
-- - shape Sh and surface Sf, or
-- - surface Sf and shape Sh, or
-- - two surfaces Sf1 and Sf2,
-- and builds a result if PerformNow equals true, its
-- default value. If PerformNow equals false, the intersection
-- will be computed later by the function Build.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not
-- chained or grouped in wires. If no intersection edge exists, the
-- result is an empty compound object.
-- Note that other objects than TopoDS_Shape shapes involved in
-- these syntaxes are converted into faces or shells before
-- performing the computation of the intersection. A shape
-- resulting from this conversion can be retrieved with the
-- function Shape1 or Shape2.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for each elementary
-- edge of the result. To attach such parametric curves to the
-- constructed edges you may use a constructor with the PerformNow
-- flag equal to false; then you use:
-- - the function ComputePCurveOn1 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the first shape,
-- - the function ComputePCurveOn2 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the second shape, in the end,
-- - the function Build to construct the result.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge
-- of the result is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve
-- defined in the Geom package; for example, the intersection
-- of a cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If you prefer to have an attached 3D geometry which is a
-- BSpline approximation of the computed set of points on
-- computed elementary intersection edges whose underlying geometry
-- is not analytic, you may use a constructor with the PerformNow
-- flag equal to false. Then you use:
-- - the function Approximation to ask for this
-- computation option, and
-- - the function Build to construct the result.
-- - Note that as a result, approximations will only be
-- computed on edges built on new intersection lines.
-- - Example
-- You may also combine these computation options. In the following example:
-- - each elementary edge of the computed intersection,
-- built on a new intersection line, which does not
-- correspond to an analytic Geom curve, will be approximated by
-- a BSpline curve whose degree is not greater than 8.
-- - each elementary edge built on a new intersection line, will have:
-- - a pcurve in the parametric space of the intersected face of shape S1,
-- - no pcurve in the parametric space of the intersected face of shape S2.
-- // TopoDS_Shape S1 = ... , S2 = ... ;
-- Standard_Boolean PerformNow = Standard_False;
-- BRepAlgoAPI_Section S ( S1, S2, PerformNow );
-- S.ComputePCurveOn1 (Standard_True);
-- S.Approximation (Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
Create(Sf : Surface from Geom; Sh : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
Init1(me : out;
S1 : Shape from TopoDS);
---Purpose: initialize first part
---Level: Public
Init1(me : out;
Pl : Pln from gp);
---Purpose: initialize first part
---Level: Public
Init1(me : out;
Sf : Surface from Geom);
---Purpose: initialize first part
---Level: Public
Init2(me : out;
S2 : Shape from TopoDS);
---Purpose: initialize second part
---Level: Public
Init2(me : out;
Pl : Pln from gp);
---Purpose: initialize second part
---Level: Public
Init2(me : out;
Sf : Surface from Geom);
---Purpose: Reinitializes the first and the
-- second parts on which this algorithm is going to perform
-- the intersection computation. This is done with either: the
-- surface Sf, the plane Pl or the shape Sh.
-- You use the function Build to construct the result.
Approximation(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose: Defines an option for computation
-- of further intersections. This computation will be performed by
-- the function Build in this framework.
-- By default, the underlying 3D geometry attached to each
-- elementary edge of the result of a computed intersection is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1. If Approx equals
-- true, when further computations are performed in this framework
-- with the function Build, these edges will have an attached 3D
-- geometry which is a BSpline approximation of the computed
-- set of points.
-- Note that as a result, approximations will be computed
-- on edges built only on new intersection lines.
ComputePCurveOn1(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose:
-- Indicates if the Pcurve must be (or not) performed on first part.
Create(Sf1 : Surface from Geom; Sf2 : Surface from Geom;
PerformNow : Boolean = Standard_True)
---Purpose: This and the above classes construct a framework for
-- computing the section lines of:
-- - two shapes Sh1 and Sh2, or
-- - shape Sh and plane Pl, or
-- - shape Sh and surface Sf, or
-- - surface Sf and shape Sh, or
-- - two surfaces Sf1 and Sf2,
-- and builds a result if PerformNow equals true, its
-- default value. If PerformNow equals false, the intersection
-- will be computed later by the function Build.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not
-- chained or grouped in wires. If no intersection edge exists, the
-- result is an empty compound object.
-- Note that other objects than TopoDS_Shape shapes involved in
-- these syntaxes are converted into faces or shells before
-- performing the computation of the intersection. A shape
-- resulting from this conversion can be retrieved with the
-- function Shape1 or Shape2.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for each elementary
-- edge of the result. To attach such parametric curves to the
-- constructed edges you may use a constructor with the PerformNow
-- flag equal to false; then you use:
-- - the function ComputePCurveOn1 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the first shape,
-- - the function ComputePCurveOn2 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the second shape, in the end,
-- - the function Build to construct the result.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge
-- of the result is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve
-- defined in the Geom package; for example, the intersection
-- of a cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If you prefer to have an attached 3D geometry which is a
-- BSpline approximation of the computed set of points on
-- computed elementary intersection edges whose underlying geometry
-- is not analytic, you may use a constructor with the PerformNow
-- flag equal to false. Then you use:
-- - the function Approximation to ask for this
-- computation option, and
-- - the function Build to construct the result.
-- - Note that as a result, approximations will only be
-- computed on edges built on new intersection lines.
-- - Example
-- You may also combine these computation options. In the following example:
-- - each elementary edge of the computed intersection,
-- built on a new intersection line, which does not
-- correspond to an analytic Geom curve, will be approximated by
-- a BSpline curve whose degree is not greater than 8.
-- - each elementary edge built on a new intersection line, will have:
-- - a pcurve in the parametric space of the intersected face of shape S1,
-- - no pcurve in the parametric space of the intersected face of shape S2.
-- // TopoDS_Shape S1 = ... , S2 = ... ;
-- Standard_Boolean PerformNow = Standard_False;
-- BRepAlgoAPI_Section S ( S1, S2, PerformNow );
-- S.ComputePCurveOn1 (Standard_True);
-- S.Approximation (Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
returns Section from BRepAlgoAPI;
ComputePCurveOn2(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose: Define options for the computation of further
-- intersections, which will be performed by the function Build
-- in this framework.
-- By default, no parametric 2D curve (pcurve) is defined for the
-- elementary edges of the result. If ComputePCurve1 equals true,
-- further computations performed in this framework with the function
-- Build will attach an additional pcurve in the parametric space of
-- the first shape to the constructed edges.
-- If ComputePCurve2 equals true, the additional pcurve will be
-- attached to the constructed edges in the parametric space of the
-- second shape.
-- These two functions may be used together.
Init1(me : out;S1 : Shape from TopoDS);
---Purpose: initialize first part
---Level: Public
Build(me : in out)
is redefined;
---Purpose: Performs the computation of
-- section lines between two parts defined at the time of
-- construction of this framework or reinitialized with the Init1 and
-- Init2 functions.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not chained
-- or grouped into wires.
-- If no intersection edge exists, the result is an empty compound object.
-- The shapes involved in the construction of section lines can
-- be retrieved with the function Shape1 or Shape2. Note that other
-- objects than TopoDS_Shape shapes given as arguments at the
-- construction time of this framework, or to the Init1 or
-- Init2 function, are converted into faces or shells before
-- performing the computation of the intersection.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for the elementary
-- edges of the result. To attach parametric curves like this to
-- the constructed edges you have to use:
-- - the function
-- ComputePCurveOn1 to ask for the additional computation of a
-- pcurve in the parametric space of the first shape,
-- - the function
-- ComputePCurveOn2 to ask for the additional computation of a
-- pcurve in the parametric space of the second shape.
-- This must be done before calling this function.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge of the result is:
-- - analytic (where possible) provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example, the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle; or
-- - elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If, on computed elementary intersection edges whose
-- underlying geometry is not analytic, you prefer to have an
-- attached 3D geometry which is a Bspline approximation of the
-- computed set of points, you have to use the function Approximation
-- to ask for this computation option before calling this function.
-- You may also have combined these computation options: look at the
-- example given above to illustrate the use of the constructors.
Init1(me : out;Pl : Pln from gp);
---Purpose: initialize first part
---Level: Public
Init1(me : out;Sf : Surface from Geom);
---Purpose: initialize first part
---Level: Public
Init2(me : out;S2 : Shape from TopoDS);
---Purpose: initialize second part
---Level: Public
Init2(me : out;Pl : Pln from gp);
---Purpose: initialize second part
---Level: Public
Init2(me : out;Sf : Surface from Geom);
---Purpose: Reinitializes the first and the
-- second parts on which this algorithm is going to perform
-- the intersection computation. This is done with either: the
-- surface Sf, the plane Pl or the shape Sh.
-- You use the function Build to construct the result.
Approximation(me : out;B : Boolean);
---Level: Public
---Purpose: Defines an option for computation
-- of further intersections. This computation will be performed by
-- the function Build in this framework.
-- By default, the underlying 3D geometry attached to each
-- elementary edge of the result of a computed intersection is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1. If Approx equals
-- true, when further computations are performed in this framework
-- with the function Build, these edges will have an attached 3D
-- geometry which is a BSpline approximation of the computed
-- set of points.
-- Note that as a result, approximations will be computed
-- on edges built only on new intersection lines.
ComputePCurveOn1(me : out;B : Boolean);
---Level: Public
---Purpose:
-- Indicates if the Pcurve must be (or not) performed on first part.
HasAncestorFaceOn1(me;
E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean from Standard;
---Level: Public
---Purpose:
-- get the face of the first part giving section edge <E>.
-- Returns True on the 3 following conditions :
-- 1/ <E> is an edge returned by the Shape() method.
-- 2/ First part of section performed is a shape.
-- 3/ <E> is built on a intersection curve (i.e <E>
-- is not the result of common edges)
-- When False, F remains untouched.
ComputePCurveOn2(me : out;B : Boolean);
---Level: Public
---Purpose: Define options for the computation of further
-- intersections, which will be performed by the function Build
-- in this framework.
-- By default, no parametric 2D curve (pcurve) is defined for the
-- elementary edges of the result. If ComputePCurve1 equals true,
-- further computations performed in this framework with the function
-- Build will attach an additional pcurve in the parametric space of
-- the first shape to the constructed edges.
-- If ComputePCurve2 equals true, the additional pcurve will be
-- attached to the constructed edges in the parametric space of the
-- second shape.
-- These two functions may be used together.
Build(me : in out)
---Purpose: Performs the computation of
-- section lines between two parts defined at the time of
-- construction of this framework or reinitialized with the Init1 and
-- Init2 functions.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not chained
-- or grouped into wires.
-- If no intersection edge exists, the result is an empty compound object.
-- The shapes involved in the construction of section lines can
-- be retrieved with the function Shape1 or Shape2. Note that other
-- objects than TopoDS_Shape shapes given as arguments at the
-- construction time of this framework, or to the Init1 or
-- Init2 function, are converted into faces or shells before
-- performing the computation of the intersection.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for the elementary
-- edges of the result. To attach parametric curves like this to
-- the constructed edges you have to use:
-- - the function
-- ComputePCurveOn1 to ask for the additional computation of a
-- pcurve in the parametric space of the first shape,
-- - the function
-- ComputePCurveOn2 to ask for the additional computation of a
-- pcurve in the parametric space of the second shape.
-- This must be done before calling this function.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge of the result is:
-- - analytic (where possible) provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example, the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle; or
-- - elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If, on computed elementary intersection edges whose
-- underlying geometry is not analytic, you prefer to have an
-- attached 3D geometry which is a Bspline approximation of the
-- computed set of points, you have to use the function Approximation
-- to ask for this computation option before calling this function.
-- You may also have combined these computation options: look at the
-- example given above to illustrate the use of the constructors.
is redefined static;
HasAncestorFaceOn2(me;
E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean from Standard;
---Purpose: Identifies the ancestor faces of
-- the intersection edge E resulting from the last
-- computation performed in this framework, that is, the faces of
-- the two original shapes on which the edge E lies:
-- - HasAncestorFaceOn1 gives the ancestor face in the first shape, and
-- - HasAncestorFaceOn2 gives the ancestor face in the second shape.
-- These functions return true if an ancestor face F is found, or false if not.
-- An ancestor face is identifiable for the edge E if the following
-- conditions are satisfied:
-- - the first part on which this algorithm performed its
-- last computation is a shape, that is, it was not given as
-- a surface or a plane at the time of construction of this
-- algorithm or at a later time by the Init1 function,
-- - E is one of the elementary edges built by the
-- last computation of this section algorithm.
-- To use these functions properly, you have to test the returned
-- Boolean value before using the ancestor face: F is significant
-- only if the returned Boolean value equals true.
HasAncestorFaceOn1(me; E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean;
---Level: Public
---Purpose:
-- get the face of the first part giving section edge <E>.
-- Returns True on the 3 following conditions :
-- 1/ <E> is an edge returned by the Shape() method.
-- 2/ First part of section performed is a shape.
-- 3/ <E> is built on a intersection curve (i.e <E>
-- is not the result of common edges)
-- When False, F remains untouched.
InitParameters(me: out)
is private;
---Level: Private
HasAncestorFaceOn2(me; E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean;
---Purpose: Identifies the ancestor faces of
-- the intersection edge E resulting from the last
-- computation performed in this framework, that is, the faces of
-- the two original shapes on which the edge E lies:
-- - HasAncestorFaceOn1 gives the ancestor face in the first shape, and
-- - HasAncestorFaceOn2 gives the ancestor face in the second shape.
-- These functions return true if an ancestor face F is found, or false if not.
-- An ancestor face is identifiable for the edge E if the following
-- conditions are satisfied:
-- - the first part on which this algorithm performed its
-- last computation is a shape, that is, it was not given as
-- a surface or a plane at the time of construction of this
-- algorithm or at a later time by the Init1 function,
-- - E is one of the elementary edges built by the
-- last computation of this section algorithm.
-- To use these functions properly, you have to test the returned
-- Boolean value before using the ancestor face: F is significant
-- only if the returned Boolean value equals true.
InitParameters(me: out)
---Level: Private
is private;
fields
myshapeisnull : Boolean from Standard;

View File

@@ -36,46 +36,18 @@
#include <BOPAlgo_BOP.hxx>
#include <BOPDS_DS.hxx>
//
static
TopoDS_Shape MakeShape(const Handle(Geom_Surface)& );
static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
{
GeomAbs_Shape c = S->Continuity();
if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S, Precision::Confusion());
else return BRepBuilderAPI_MakeShell(S);
}
static
Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller&,
const TopoDS_Shape&,
TopoDS_Shape&,
TopoDS_Shape&);
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2);
//=======================================================================
//function : BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_SECTION;
InitParameters();
}
//=======================================================================
//function : ~BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
{
}
//=======================================================================
//function : InitParameters
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::InitParameters()
{
myparameterschanged = Standard_False;
myshapeisnull = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
}
//=======================================================================
//function : Constructor
//purpose :
@@ -83,35 +55,31 @@ void BRepAlgoAPI_Section::InitParameters()
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
const TopoDS_Shape& Sh2,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
: BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
//=======================================================================
//function : BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
@@ -119,87 +87,85 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const TopoDS_Shape& Sh,
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)),
BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)), BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const TopoDS_Shape& Sh,
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const Handle(Geom_Surface)& Sf,
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || Sh.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const Handle(Geom_Surface)& Sf1,
const Handle(Geom_Surface)& Sf2,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(MakeShape(Sf1),
MakeShape(Sf2),
BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,
const Handle(Geom_Surface)& Sf2,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf1), MakeShape(Sf2), BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
@@ -207,6 +173,7 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
Build();
}
}
//=======================================================================
//function : Init1
//purpose :
@@ -234,6 +201,7 @@ void BRepAlgoAPI_Section::Init1(const TopoDS_Shape& S1)
if(myparameterschanged)
NotDone();
}
//=======================================================================
//function : Init1
//purpose :
@@ -242,6 +210,7 @@ void BRepAlgoAPI_Section::Init1(const gp_Pln& Pl)
{
Init1(MakeShape(new Geom_Plane(Pl)));
}
//=======================================================================
//function : Init1
//purpose :
@@ -250,6 +219,7 @@ void BRepAlgoAPI_Section::Init1(const Handle(Geom_Surface)& Sf)
{
Init1(MakeShape(Sf));
}
//=======================================================================
//function : Init2
//purpose :
@@ -278,6 +248,7 @@ void BRepAlgoAPI_Section::Init2(const TopoDS_Shape& S2)
NotDone();
}
}
//=======================================================================
//function : Init2
//purpose :
@@ -286,6 +257,7 @@ void BRepAlgoAPI_Section::Init2(const gp_Pln& Pl)
{
Init2(MakeShape(new Geom_Plane(Pl)));
}
//=======================================================================
//function : Init2
//purpose :
@@ -294,6 +266,7 @@ void BRepAlgoAPI_Section::Init2(const Handle(Geom_Surface)& Sf)
{
Init2(MakeShape(Sf));
}
//=======================================================================
//function : Approximation
//purpose :
@@ -305,6 +278,7 @@ void BRepAlgoAPI_Section::Approximation(const Standard_Boolean B)
myparameterschanged = Standard_True;
}
}
//=======================================================================
//function : ComputePCurveOn1
//purpose :
@@ -316,6 +290,7 @@ void BRepAlgoAPI_Section::ComputePCurveOn1(const Standard_Boolean B)
myparameterschanged = Standard_True;
}
}
//=======================================================================
//function : ComputePCurveOn2
//purpose :
@@ -327,6 +302,7 @@ void BRepAlgoAPI_Section::ComputePCurveOn2(const Standard_Boolean B)
myparameterschanged = Standard_True;
}
}
//=======================================================================
//function : Build
//purpose :
@@ -349,9 +325,7 @@ void BRepAlgoAPI_Section::Build()
}
//
if (bIsNewFiller) {
BOPAlgo_SectionAttribute theSecAttr(myApprox,
myComputePCurve1,
myComputePCurve2);
BOPAlgo_SectionAttribute theSecAttr(myApprox, myComputePCurve1, myComputePCurve2);
myDSFiller->SetSectionAttribute(theSecAttr);
myDSFiller->Perform();
}
@@ -361,13 +335,12 @@ void BRepAlgoAPI_Section::Build()
myparameterschanged = Standard_False;
}
}
//=======================================================================
//function : HasAncestorFaceOn1
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1(const TopoDS_Shape& E, TopoDS_Shape& F) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
@@ -386,13 +359,12 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1
F = F1;
return aResult;
}
//=======================================================================
//function : HasAncestorFaceOn2
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2(const TopoDS_Shape& E,TopoDS_Shape& F) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
@@ -413,15 +385,27 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2
}
//=======================================================================
//function : HasAncestorFaces
//function : InitParameters
//purpose :
//=======================================================================
Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape&F2)
void BRepAlgoAPI_Section::InitParameters()
{
myparameterschanged = Standard_False;
myshapeisnull = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
}
// ------------------------------------------------------------------------
// static function : HasAncestorFaces
// purpose :
// ------------------------------------------------------------------------
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2) {
Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;
//
const BOPDS_PDS& pDS = theDSFiller->PDS();
@@ -458,15 +442,3 @@ Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
}
return Standard_False;
}
//=======================================================================
//function : MakeShape
//purpose :
//=======================================================================
TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
{
GeomAbs_Shape c = S->Continuity();
if (c >= GeomAbs_C2) {
return BRepBuilderAPI_MakeFace(S, Precision::Confusion());
}
return BRepBuilderAPI_MakeShell(S);
}

View File

@@ -16,11 +16,11 @@
deferred class MakeShape from BRepBuilderAPI inherits Command from BRepBuilderAPI
---Purpose: This is the root class for all shape
-- constructions. It stores the result.
--
-- It provides deferred methods to trace the history
-- of sub-shapes.
---Purpose: This is the root class for all shape
-- constructions. It stores the result.
--
-- It provides deferred methods to trace the history
-- of sub-shapes.
uses
Shape from TopoDS,
@@ -34,28 +34,27 @@ uses
raises
NotDone from StdFail
is
is
Delete(me:out) is redefined;
---C++: alias "Standard_EXPORT virtual ~BRepBuilderAPI_MakeShape(){Delete() ; }"
Initialize;
Build(me : in out)
---Purpose: This is called by Shape(). It does nothing but
-- may be redefined.
---Level: Public
---Purpose: This is called by Shape(). It does nothing but
-- may be redefined.
---Level: Public
is virtual;
Shape(me) returns Shape from TopoDS
---Purpose: Returns a shape built by the shape construction algorithm.
-- Raises exception StdFail_NotDone if the shape was not built.
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Shape() const;"
---Level: Public
raises
NotDone from StdFail
is virtual;
--is static;
---Purpose: Returns a shape built by the shape construction algorithm.
-- Raises exception StdFail_NotDone if the shape was not built.
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Shape() const;"
---Level: Public
raises
NotDone from StdFail
is static;
------------------------------------------------------------------
@@ -65,19 +64,19 @@ is
------------------------------------------------------------------
Generated (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes generated from the
-- shape <S>.
---C++: return const &
---Level: Public
---Purpose: Returns the list of shapes generated from the
-- shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is virtual;
Modified (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes modified from the shape
-- <S>.
---C++: return const &
---Level: Public
---Purpose: Returns the list of shapes modified from the shape
-- <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is virtual;
@@ -85,7 +84,7 @@ is
IsDeleted (me: in out; S : Shape from TopoDS)
returns Boolean
is virtual;
---Purpose: Returns true if the shape S has been deleted.
---Purpose: Returns true if the shape S has been deleted.
fields

View File

@@ -16,8 +16,8 @@
package BRepCheck
---Purpose: This package provides tools to check the validity
-- of the BRep.
---Purpose: This package provides tools to check the validity
-- of the BRep.
uses MMgt,
StdFail,
@@ -41,9 +41,9 @@ is
class Face; -- inherits Shape
class Shell; -- inherits Shape
class Solid;
-- class Solid; -- inherits Shape
class Analyzer;
@@ -87,8 +87,6 @@ is
EmptyShell,
RedundantFace,
-- for solids
InvalidImbricationOfShells,
-- for shapes
UnorientableShape,
@@ -102,14 +100,11 @@ is
InvalidPolygonOnTriangulation,
InvalidToleranceValue,
EnclosedRegion,
InvalidToleranceValue,
-- for exception
CheckFail
end Status;
@@ -118,16 +113,16 @@ is
class DataMapOfShapeListOfStatus instantiates DataMap from TCollection
(Shape from TopoDS,
ListOfStatus from BRepCheck,
ListOfStatus from BRepCheck,
ShapeMapHasher from TopTools);
class DataMapOfShapeResult instantiates DataMap from TCollection
(Shape from TopoDS,
Result from BRepCheck,
(Shape from TopoDS,
Result from BRepCheck,
OrientedShapeMapHasher from TopTools);
-- Package method
Add(List: in out ListOfStatus from BRepCheck;
@@ -139,7 +134,7 @@ is
OS: in out OStream from Standard);
SelfIntersection(W : Wire from TopoDS;
F : Face from TopoDS;
F : Face from TopoDS;
E1 : out Edge from TopoDS;
E2 : out Edge from TopoDS)
returns Boolean from Standard;

View File

@@ -29,6 +29,7 @@
//function : Add
//purpose :
//=======================================================================
void BRepCheck::Add(BRepCheck_ListOfStatus& lst, const BRepCheck_Status stat)
{
BRepCheck_ListIteratorOfListOfStatus it(lst);
@@ -38,32 +39,40 @@ void BRepCheck::Add(BRepCheck_ListOfStatus& lst, const BRepCheck_Status stat)
}
else {
if (it.Value() == stat) {
return;
return;
}
it.Next();
}
}
lst.Append(stat);
}
//=======================================================================
//function : SelfIntersection
//purpose :
//=======================================================================
Standard_Boolean BRepCheck::SelfIntersection(const TopoDS_Wire& W,
const TopoDS_Face& myFace,
TopoDS_Edge& RetE1,
TopoDS_Edge& RetE2)
const TopoDS_Face& myFace,
TopoDS_Edge& RetE1,
TopoDS_Edge& RetE2)
{
Handle(BRepCheck_Wire) chkw = new BRepCheck_Wire(W);
BRepCheck_Status stat = chkw->SelfIntersect(myFace,RetE1,RetE2);
return (stat == BRepCheck_SelfIntersectingWire);
}
//=======================================================================
//function : Print
//purpose :
//=======================================================================
void BRepCheck::Print(const BRepCheck_Status stat,
Standard_OStream& OS)
Standard_OStream& OS)
{
switch (stat) {
@@ -172,12 +181,7 @@ void BRepCheck::Print(const BRepCheck_Status stat,
case BRepCheck_InvalidToleranceValue:
OS << "BRepCheck_InvalidToleranceValue\n";
break;
case BRepCheck_InvalidImbricationOfShells:
OS << "BRepCheck_InvalidImbricationOfShells\n";
break;
case BRepCheck_EnclosedRegion:
OS << "BRepCheck_EnclosedRegion\n";
break;
default:
break;
}

View File

@@ -21,7 +21,6 @@
#include <BRepCheck_Wire.hxx>
#include <BRepCheck_Face.hxx>
#include <BRepCheck_Shell.hxx>
#include <BRepCheck_Solid.hxx>
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
#include <TopoDS_Iterator.hxx>
@@ -34,15 +33,13 @@
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Init(const TopoDS_Shape& S,
const Standard_Boolean B)
const Standard_Boolean B)
{
if (S.IsNull()) {
Standard_NullObject::Raise();
@@ -52,12 +49,16 @@ void BRepCheck_Analyzer::Init(const TopoDS_Shape& S,
Put(S,B);
Perform(S);
}
//=======================================================================
//function : Put
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Put(const TopoDS_Shape& S,
const Standard_Boolean B)
const Standard_Boolean B)
{
if (!myMap.IsBound(S)) {
Handle(BRepCheck_Result) HR;
@@ -81,8 +82,6 @@ void BRepCheck_Analyzer::Put(const TopoDS_Shape& S,
HR = new BRepCheck_Shell(TopoDS::Shell(S));
break;
case TopAbs_SOLID:
HR = new BRepCheck_Solid(TopoDS::Solid(S));
break;
case TopAbs_COMPSOLID:
case TopAbs_COMPOUND:
break;
@@ -95,10 +94,13 @@ void BRepCheck_Analyzer::Put(const TopoDS_Shape& S,
}
}
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
{
for(TopoDS_Iterator theIterator(S);theIterator.More();theIterator.Next())
@@ -116,7 +118,7 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
// modified by NIZHNY-MKK Wed May 19 16:56:16 2004.BEGIN
// There is no need to check anything.
// if (myShape.IsSame(S)) {
// myMap(S)->Blind();
// myMap(S)->Blind();
// }
// modified by NIZHNY-MKK Wed May 19 16:56:23 2004.END
@@ -391,41 +393,43 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
break;
case TopAbs_SHELL:
//modified by NIZNHY-PKV Mon Oct 13 14:23:53 2008f
//modified by NIZNHY-PKV Mon Oct 13 14:24:04 2008t
break;
case TopAbs_SOLID:
{
exp.Init(S,TopAbs_SHELL);
exp.Init(S,TopAbs_SHELL);
for (; exp.More(); exp.Next())
{
const TopoDS_Shape& aShell=exp.Current();
try
{
OCC_CATCH_SIGNALS
myMap(aShell)->InContext(S);
}
catch(Standard_Failure)
{
const TopoDS_Shape& aShell=exp.Current();
try
{
OCC_CATCH_SIGNALS
myMap(aShell)->InContext(S);
}
catch(Standard_Failure)
{
#ifdef OCCT_DEBUG
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() )
{
myMap(S)->SetFailStatus(S);
}
//
Handle(BRepCheck_Result) aRes = myMap(aShell);
if (!aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}//catch(Standard_Failure)
}//for (; exp.More(); exp.Next())
}
if ( ! myMap(S).IsNull() )
{
myMap(S)->SetFailStatus(S);
}
//
Handle(BRepCheck_Result) aRes = myMap(aShell);
if (!aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}//catch(Standard_Failure)
}//for (; exp.More(); exp.Next())
}
break;//case TopAbs_SOLID
default:
break;
@@ -499,10 +503,10 @@ Standard_Boolean BRepCheck_Analyzer::ValidSub
// for (TopExp_Explorer exp(S,SubType);exp.More(); exp.Next()) {
const Handle(BRepCheck_Result)& RV = myMap(exp.Current());
for (RV->InitContextIterator();
RV->MoreShapeInContext();
RV->NextShapeInContext()) {
RV->MoreShapeInContext();
RV->NextShapeInContext()) {
if (RV->ContextualShape().IsSame(S)) {
break;
break;
}
}
@@ -510,7 +514,7 @@ Standard_Boolean BRepCheck_Analyzer::ValidSub
for (itl.Initialize(RV->StatusOnShape()); itl.More(); itl.Next()) {
if (itl.Value() != BRepCheck_NoError) {
return Standard_False;
return Standard_False;
}
}
}

View File

@@ -1,70 +0,0 @@
-- Created by: Peter KURNEV
-- 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.
class Solid from BRepCheck
inherits Result from BRepCheck
---Purpose: The class is to check a solid.
uses
Shape from TopoDS,
Solid from TopoDS
is
Create(theS: Solid from TopoDS)
returns Solid from BRepCheck;
---Purpose:
-- Constructor
-- <theS> is the solid to check
InContext(me: mutable;
theContextShape: Shape from TopoDS)
is redefined;
---Purpose:
-- Checks the solid in context of
-- the shape <theContextShape>
Minimum(me: mutable)
is redefined;
---Purpose:
-- Checks the solid per se.
--
-- The scan area is:
-- 1. Shells that overlaps each other
-- Status: BRepCheck_InvalidImbricationOfShells
--
-- 2. Detached parts of the solid (vertices, edges)
-- that have non-internal orientation
-- Status: BRepCheck_BadOrientationOfSubshape
--
--
-- 3. For closed, non-internal shells:
-- 3.1 Shells containing entities of the solid that
-- are outside towards the shells
-- Status: BRepCheck_SubshapeNotInShape
--
-- 3.2 Shells that encloses other Shells
-- (for non-holes)
-- Status: BRepCheck_EnclosedRegion
--
Blind(me: mutable)
is redefined;
---Purpose:
-- see the parent class for more details
--fields
end Solid;

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