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

Compare commits

..

23 Commits

Author SHA1 Message Date
aml
38b8654f74 0025861: Wrong result obtained by projection algorithm.
Handling of trimmed analytical surfaces added in extrema PS.

New draw-command and test case for issue CR25861

Correction of test case for issue CR25861
2015-03-10 15:22:20 +03:00
nbv
de6d39c92a 0025782: The result of intersection between two cylinders is incorrect
1. Cylinders are tangent to each other indeed. Fix processes this case.
2. Algorithm of intersection line computing (in case of cylinders with two parallel axes) has been changed.

Test cases for issue CR25782
2015-03-10 15:08:46 +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
577 changed files with 11176 additions and 19732 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,85 +0,0 @@
# Generate set of boxes resembling OCC logo and arranged in the shape of
# Penrose triangle on perspective view.
# The sample shows how the viewer can be manipulated to produce required
# visual effect
#Category: Visualization
#Title: Penrose triangle on perspective view
pload MODELING VISUALIZATION
# procedure to define box dimensions
set scale 1.
set ratio 0.94
proc defbox {} {
global scale ratio
set scale [expr $scale * $ratio]
return [list 1.8*$scale 1.8*$scale 1.3*$scale]
}
# make set of boxes
eval box b1 0 0 0 [defbox]
eval box b2 2 0 0 [defbox]
eval box b3 4 0 0 [defbox]
eval box b4 6 0 0 [defbox]
eval box b5 6 -1.5 0 [defbox]
eval box b6 6 -3 0 [defbox]
eval box b7 6 -4.5 0 [defbox]
eval box b8 6 -6 0 [defbox]
eval box b9 6 -6 1 [defbox]
eval box b10 6 -6 2 [defbox]
# cut last box by prisms created from the first two to make impression
# that it is overlapped by these on selected view (see vviewparams below)
explode b1 f
explode b2 f
prism p0 b1_5 12.3 -14 6.8
bcut bx b10 p0
prism p1 b2_3 12 -14 6.8
bcut bxx bx p1
tcopy bxx b10
# make some boxes hollow
for {set i 1} {$i <= 1} {incr i} {
set dim [boundingstr b$i]
set dx [expr [lindex $dim 3] - [lindex $dim 0]]
set x1 [expr [lindex $dim 0] + 0.1 * $dx]
set x2 [expr [lindex $dim 1] + 0.1 * $dx]
set x3 [expr [lindex $dim 2] + 0.1 * $dx]
box bc $x1 $x2 $x3 0.8*$dx 0.8*$dx $dx
bcut bb b$i bc
tcopy bb b$i
}
# prepare a view
vinit Penrose w=1024 h=512
vsetcolorbg 255 255 255
vrenderparams -rayTrace -fsaa on -reflections off -shadows off
# set camera position and adjust lights
vcamera -persp -fovy 25
vviewparams -eye 14 -14 6.8 -up 0 0 1 -at 4 -4 0 -scale 70
vsetdispmode 1
vlight def
vlight add directional direction 1 -2 -10 head 1 color white
vlight add directional direction 0 -10 0 head 1 color white
# display boxes
vdisplay b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
# set colors like in boxes of on OCC logo
vsetcolor b1 0.8671875 0 0.16015625
vsetcolor b2 0.96484375 0.8671875 0
vsetcolor b3 0.609375 0.97734375 0.09375
vsetcolor b4 0.90234375 0 0.48046875
vsetcolor b5 0 0.48046875 0.73828125
vsetcolor b6 0.578125 0 0.48046875
vsetcolor b7 0.93359375 0.609375 0
vsetcolor b8 0 0.70703125 0.9296875
vsetcolor b9 0 0.64453125 0.48046875
vsetcolor b10 0 0.48046875 0.73828125
# set material to plastic for better look
for {set i 1} {$i <= 10} {incr i} {vsetmaterial b$i plastic}
vdrawtext "Which\nbox\nis\ncloser\nto\nyou?" 0 -6 -2 0 0 0 left top 0 0 40 Bold

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

@@ -1,64 +0,0 @@
# Sample demonstrating assignment of colors to faces in XDE
#Category: Data Exchange
#Title: Assignment of colors to faces
pload MODELING VISUALIZATION OCAF XDE
box b 0 -20 -10 100 40 20
compound b b b a
explode a
trotate a_1 0 0 0 1 0 0 60
trotate a_2 0 0 0 1 0 0 -60
bcommon b a a_1
bcommon b b a_2
pcylinder c 4 100
trotate c 0 0 0 0 1 0 90
psphere s 1.4
ttranslate s 99.2 0 0
bfuse cx c s
pcone e 60 0.5 101
trotate e 0 0 0 0 1 0 90
bcommon body b e
bcut body body c
bcommon core cx e
text2brep text "CAD Assistant" Times 10
ttranslate text 10 -4 10
prism tr text 0 0 -1
bfuse body body tr
donly body core
#vdisplay body core
#vsetcolor body yellow
#vsetcolor core red
explode body so
explode body_1 f
explode core so
NewDocument D
XAddShape D body_1
XAddShape D core_1
#XSetColor D body_1 0. 0. 1.
for {set i 1} {$i <= 26} {incr i} {XSetColor D body_1_$i 0. 0. 1.}
XSetColor D body_1_1 0.9 0.5 0.4
XSetColor D body_1_9 0.9 0.5 0.4
for {set i 10} {$i <= 22} {incr i} {XSetColor D body_1_$i 0.6 0.7 0.0}
XSetColor D core_1 0.1 0.1 1.
foreach ff [explode core_1 f] { XSetColor D $ff 0.1 0.1 1. ; puts "set color $ff" }
XShow D
vfit
vsetdispmode 1
vsetcolorbg 255 255 255
#param write.iges.brep.mode 1
#WriteIges D d:/pencil3.igs

View File

@@ -1,130 +0,0 @@
# Creation of 2d drawing
#Category: Modeling
#Title: Snowflake - creation of 2d geometry
pload MODELING AISV
# make circular elements
circle c11 5 5 0 5
circle c12 5 5 0 3
circle c21 18 7 0 7
circle c22 18 7 0 5
circle c31 28.5 5 0 5
circle c32 28.5 5 0 3
trim c21 c21 pi/4 -pi/4
trim c22 c22 pi/4 -pi/4
trim c31 c31 pi/4 -pi/4
trim c32 c32 pi/4 -pi/4
line l21 18 7 0 1 1 0
line l22 18 7 0 1 -1 0
line l31 28.5 5 0 1 1 0
line l32 28.5 5 0 1 -1 0
trim l21 l21 5 7
trim l22 l22 5 7
trim l31 l31 3 5
trim l32 l32 3 5
line l1 -6 0 0 0.86602540378443864 0.5 0
line l2 -6 1 0 1 0 0
trim l1 l1 0 30
trim l2 l2 0 45
mkedge c11 c11
mkedge c12 c12
mkedge c21 c21
mkedge c22 c22
mkedge c31 c31
mkedge c32 c32
mkedge l21 l21
mkedge l22 l22
mkedge l31 l31
mkedge l32 l32
mkedge l1 l1
mkedge l2 l2
wire b11 c11
wire b12 c12
orientation b12 R
# build one ray
plane p -6 0 0 0 0 1
mkface f1 p b11
add b12 f1
wire b2 c21 l21 c22 l22
mkface f2 p b2
wire b3 c31 l31 c32 l32
mkface f3 p b3
prism f5 l1 -5 8.6602540378443864 0
prism f4 l2 0 -1 0
compound f1 f2 f3 bc
bfuse r bc f4
explode r Sh
renamevar r_1 r
bcut r r f5
explode r Sh
renamevar r_1 r
explode r e
wire w r_4 r_1 r_7 r_8 r_9 r_10 r_11 r_12 r_13 r_14 r_22 r_23 r_24 r_25 r_19 r_20 r_21 r_26 r_35 r_31 r_32 r_33 r_34 r_36 r_37
tcopy w w1
tmirror w1 -6 0 0 0 1 0
wire w w w1
mkface w p w
donly w
# construct complete snowflake
tcopy w w1
tcopy w w2
tcopy w w3
tcopy w w4
tcopy w w5
trotate w1 -6 0 0 0 0 1 60
trotate w2 -6 0 0 0 0 1 120
trotate w3 -6 0 0 0 0 1 180
trotate w4 -6 0 0 0 0 1 240
trotate w5 -6 0 0 0 0 1 300
bfuse w w w1
bfuse w w w2
bfuse w w w3
bfuse w w w4
bfuse w w w5
unifysamedom r w
# keep only wires in compound
eval compound [explode r w] snowflake
tscale snowflake -6 0 0 1.5
# draw frame loosely following GOST 2.104-68
polyline frame -100 -100 0 172 -100 0 172 100 0 -100 100 0 -100 -100 0
polyline t1 52 -100 0 52 -45 0 172 -45 0
polyline t2 52 -60 0 172 -60 0
polyline t3 52 -85 0 172 -85 0
polyline t4 122 -100 0 122 -60 0
polyline t5 122 -80 0 172 -80 0
polyline t6 122 -65 0 172 -65 0
polyline t7 142 -80 0 142 -85 0
polyline t8 137 -80 0 137 -60 0
polyline t9 154 -80 0 154 -60 0
compound frame t1 t2 t3 t4 t5 t6 t7 t8 t9 lines
# add text
text2brep sample "SAMPLE" Arial 10 x=90 y=-55 bolditalic
text2brep occ "Open CASCADE" Times 6 x=125 y=-95
text2brep name "Snowflake" Courier 7 x=65 y=-75 italic
text2brep material "Ice" Courier 7 x=75 y=-95 italic
text2brep sheets "Sheets 1" Courier 3.5 x=145 y=-83 italic
text2brep scale "Scale\n\n1:100" Courier 3.5 x=157 y=-63 italic
text2brep mass "Mass\n\n1 mg" Courier 3.5 x=140 y=-63 italic
eval compound [explode sample w] sample
eval compound [explode occ w] occ
eval compound [explode name w] name
eval compound [explode material w] material
eval compound [explode sheets w] sheets
eval compound [explode scale w] scale
eval compound [explode mass w] mass
compound sample occ name material sheets scale mass text
compound snowflake frame text drawing
# display in 3d view
vinit Driver1/Viewer1/View1 w=1024 h=768
vdisplay snowflake lines text
vtop
vfit

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

@@ -268,15 +268,6 @@ is
-- inWhichLocal gives the local context in which anIObj
-- is displayed. By default, the index -1 refers to the last
-- Local Context opened.
Clear(me : mutable;
aniobj : InteractiveObject from AIS;
updateviewer : Boolean from Standard = Standard_True);
---Purpose: Removes the interactive object aniobj from all viewers.
-- 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.
ClearPrs( me :mutable;
aniobj : InteractiveObject from AIS;
@@ -2046,6 +2037,16 @@ is
PurgeViewer(me:mutable;Vwr:Viewer from V3d)
returns Integer from Standard is static private;
redisplayPrsModes (me : mutable;
theIObj : InteractiveObject from AIS;
theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
---Purpose: UNKNOWN
redisplayPrsRecModes (me : mutable;
theIObj : InteractiveObject from AIS;
theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
---Purpose: UNKNOWN
fields
myObjects : DataMapOfIOStatus from AIS;

3531
src/AIS/AIS_InteractiveContext.cxx Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -1046,7 +1046,9 @@ Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
#endif
return Standard_False;
}
return myLocalContexts(myCurLocalIndex)->HasSelectedShape();
return myLocalContexts(myCurLocalIndex)->HasShape();
}
//=======================================================================
@@ -1062,9 +1064,7 @@ TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (SelectedInteractive());
if (!aShape.IsNull())
{
TopLoc_Location aLocTrsf = SelectedInteractive()->Transformation().Form() == gp_Identity ?
TopLoc_Location() : TopLoc_Location (SelectedInteractive()->Transformation());
aResShape = aShape->Shape().Located (aLocTrsf * aShape->Shape().Location());
aResShape = aShape->Shape().Located (TopLoc_Location (SelectedInteractive()->Transformation()) * aShape->Shape().Location());
}
return aResShape;
@@ -1088,8 +1088,6 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::Interactive() const
Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() const
{
if(!HasOpenedContext()){
if (AIS_Selection::Selection(myCurrentName.ToCString())->Extent() == 0)
return NULL;
Handle(Standard_Transient) TR =AIS_Selection::Selection(myCurrentName.ToCString())->Value();
Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&TR);
return IO;}

View File

@@ -388,11 +388,6 @@ is
HasShape(me) returns Boolean from Standard;
---Purpose: returns TRUE if the detected entity is a shape
-- coming from a Decomposition of an element.
HasSelectedShape(me) returns Boolean from Standard;
---Purpose: returns true if current selection is not empty
-- and the owner of selected object contains a shape.
-- This method does not take into account decomposition
-- status of detected shape.
SelectedShape(me) returns Shape from TopoDS;
SelectedOwner(me) returns EntityOwner from SelectMgr;

View File

@@ -153,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)
{
@@ -376,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())
{
@@ -545,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))
{
@@ -772,28 +773,6 @@ HasShape() const
return (hasshape&&comes);
}
//================================================================
// Function : HasSelectedShape
// Purpose : Checks if there is a selected shape regardless of its decomposition status
//================================================================
Standard_Boolean AIS_LocalContext::HasSelectedShape() const
{
if (AIS_Selection::CurrentSelection()->Extent() == 0)
return Standard_False;
Handle(Standard_Transient) aCurSelection = AIS_Selection::CurrentSelection()->Value();
if (aCurSelection.IsNull())
return Standard_False;
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aCurSelection);
Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
if (aBrepOwner.IsNull())
{
return Standard_False;
}
return aBrepOwner->HasShape();
}
//==================================================
// Function:
// Purpose :
@@ -807,7 +786,6 @@ TopoDS_Shape AIS_LocalContext::SelectedShape() const
{
return TopoDS_Shape();
}
return aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
}
@@ -1067,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)
{
@@ -1220,6 +1202,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
{
if (thePickOwner.IsNull())
{
myMainPM->ClearImmediateDraw();
if (theToRedrawImmediate)
{
theView->RedrawImmediate();
@@ -1271,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())
{
@@ -1293,7 +1277,7 @@ void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& theP
mylastindex = aNewIndex;
}
if (mylastindex)
if (mylastindex != 0)
{
mylastgood = mylastindex;
}
@@ -1478,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,4 +1,4 @@
// Created by: Peter KURNEV
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
@@ -12,15 +12,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BOPCol_DataMapOfShapeReal_HeaderFile
#define BOPCol_DataMapOfShapeReal_HeaderFile
#include <AppCont_Function.ixx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher> BOPCol_DataMapOfShapeReal;
typedef BOPCol_DataMapOfShapeReal::Iterator BOPCol_DataMapIteratorOfDataMapOfShapeReal;
#endif
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

@@ -0,0 +1,18 @@
// 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_Function2d.ixx>
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

@@ -936,6 +936,7 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
ApproxInt_TheImpPrmSvSurfaces myImpPrmSvSurfaces(ISurf,PSurf);
Standard_Integer nbpntbez = indicemax-indicemin;
Standard_Address ptrsvsurf = NULL;
Standard_Boolean cut = Standard_True;
if(nbpntbez < LimRajout)
myApproxBez = Standard_False;
@@ -946,7 +947,7 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
cut = Standard_False;
//-- cout<<" ApproxInt : Nb de points = "<<nbpntbez<<" Pas de rajout "<<endl;
}
Standard_Address ptrsvsurf = &myImpPrmSvSurfaces;
ptrsvsurf = &myImpPrmSvSurfaces;
if(nbpntbez < LimRajout) myApproxBez = Standard_False;
@@ -1056,11 +1057,6 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
imax);
if(myApproxBez) {
myComputeLineBezier.Perform(myMultiLine);
#ifdef OCCT_DEBUG
//myMultiLine.Dump();
#endif
if (myComputeLineBezier.NbMultiCurves() == 0)
return;
myTolReached&=myComputeLineBezier.IsToleranceReached();

View File

@@ -116,9 +116,6 @@ is
MakeMLBetween(me; Low,High,NbPointsToInsert: Integer from Standard)
returns MultiLine from ApproxInt is static;
Dump(me);
---Purpose: Dump of the current multi-line.
--------------------------------------------------------------------------------

View File

@@ -613,16 +613,3 @@ const {
}
//======================================================================
void ApproxInt_MultiLine::Dump() const
{
TColgp_Array1OfPnt anArr1(1, 1);
TColgp_Array1OfPnt2d anArr2(1, 2);
for(Standard_Integer ind = FirstPoint(); ind <= LastPoint(); ind++)
{
Value(ind, anArr1, anArr2);
printf("%4d [%+10.20f %+10.20f %+10.20f] [%+10.20f %+10.20f] [%+10.20f %+10.20f]\n",
ind, anArr1(1).X(), anArr1(1).Y(), anArr1(1).Z(), anArr2(1).X(),anArr2(1).Y(),anArr2(2).X(),anArr2(2).Y());
}
}

View File

@@ -127,8 +127,5 @@ is
---C++:inline
returns Status from Approx;
Dump(myclass; ML: TheMultiLine);
---Purpose: Dump of the current multi-line.
end MultiLineTool;

View File

@@ -115,9 +115,4 @@ inline TheMultiLine ApproxInt_MultiLineTool::MakeMLBetween(const TheMultiLine& M
return(ML.MakeMLBetween(I1,I2,NbPMin));
}
inline void ApproxInt_MultiLineTool::Dump(const TheMultiLine& ML)
{
ML.Dump();
}
//================================================================================

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

@@ -49,16 +49,8 @@ is
AddTool (me:out;
theShape: Shape from TopoDS)
---Purpose: Adds Tool argument of the operation
is virtual;
SetTools (me:out;
theShapes: ListOfShape from TopTools)
is virtual;
SetTools (me:out;
theShapes: ListOfShape from BOPCol)
is virtual;
SetOperation(me:out;
theOperation: Operation from BOPAlgo);

View File

@@ -43,7 +43,6 @@
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#include <NCollection_DataMap.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
typedef NCollection_DataMap
<BOPTools_Set,
@@ -130,36 +129,6 @@ void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theShapes)
{
TopTools_ListIteratorOfListOfShape aIt;
//
myTools.Clear();
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddTool(aS);
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
myTools.Clear();
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddTool(aS);
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
@@ -381,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

@@ -59,18 +59,15 @@ is
returns PDS from BOPDS;
AddArgument (me:out;
theShape: Shape from TopoDS)
is virtual;
theShape: Shape from TopoDS)
is virtual;
SetArguments(me:out;
theLS:ListOfShape from TopTools);
SetArguments (me:out;
theLS: ListOfShape from BOPCol)
is virtual;
theShapes: ListOfShape from BOPCol)
is virtual;
Arguments(me)
returns ListOfShape from BOPCol;
returns ListOfShape from BOPCol;
---C++: return const &
@@ -222,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;
@@ -244,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

@@ -26,7 +26,6 @@
#include <BRep_Builder.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
//function :
@@ -43,8 +42,7 @@ BOPAlgo_Builder::BOPAlgo_Builder()
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myFuzzyValue(0.)
myOrigins(100, myAllocator)
{
}
//=======================================================================
@@ -63,8 +61,7 @@ BOPAlgo_Builder::BOPAlgo_Builder
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
myOrigins(100, myAllocator),
myFuzzyValue(0.)
myOrigins(100, myAllocator)
{
}
//=======================================================================
@@ -107,28 +104,10 @@ void BOPAlgo_Builder::AddArgument(const TopoDS_Shape& theShape)
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetArguments(const TopTools_ListOfShape& theShapes)
{
TopTools_ListIteratorOfListOfShape aIt;
//
myArguments.Clear();
//
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddArgument(aS);
}
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetArguments(const BOPCol_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
myArguments.Clear();
//
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
@@ -193,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:
//=======================================================================
@@ -275,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

@@ -24,9 +24,7 @@ uses
ShapeEnum from TopAbs,
Vertex from TopoDS,
Face from TopoDS,
Edge from TopoDS,
ListOfShape from TopTools,
Edge from TopoDS,
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
@@ -83,15 +81,10 @@ is
returns PIterator from BOPDS;
---C++:return const &
SetArguments(me:out;
theLS:ListOfShape from BOPCol);
SetArguments(me:out;
theLS:ListOfShape from TopTools);
Arguments(me)
returns ListOfShape from BOPCol;
---C++: return const &
---C++: alias "Standard_EXPORT void SetArguments(const BOPCol_ListOfShape& theLS);"
Context(me:out)
returns Context from IntTools;
@@ -134,6 +127,7 @@ is
PerformFF(me:out)
is virtual protected;
--modified by NIZNHY-PKV Fri Sep 12 07:05:37 2014f
PerformVZ(me:out)
is virtual protected;
--Purpose: Computes Vertex/Solid interferences
@@ -148,6 +142,7 @@ is
PerformZZ(me:out)
is virtual protected;
--Purpose: Computes Solid/Solid interferences
--modified by NIZNHY-PKV Fri Sep 12 07:05:45 2014t
TreatVerticesEE(me:out)
is protected;
@@ -468,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

@@ -25,7 +25,6 @@
#include <IntTools_Context.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
@@ -34,8 +33,7 @@
//=======================================================================
BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
:
BOPAlgo_Algo(),
myFuzzyValue(0.)
BOPAlgo_Algo()
{
myDS=NULL;
myIterator=NULL;
@@ -47,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;
@@ -113,21 +110,6 @@ void BOPAlgo_PaveFiller::SetSectionAttribute
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
{
TopTools_ListIteratorOfListOfShape aItLS;
//
myArguments.Clear();
aItLS.Initialize(theLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
myArguments.Append(aS);
}
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
{
myArguments=theLS;
@@ -141,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:
//=======================================================================
@@ -177,7 +141,6 @@ void BOPAlgo_PaveFiller::Init()
// 1.myDS
myDS=new BOPDS_DS(myAllocator);
myDS->SetArguments(myArguments);
myDS->SetFuzzyValue(myFuzzyValue);
myDS->Init();
//
// 2.myIterator
@@ -207,8 +170,6 @@ void BOPAlgo_PaveFiller::Perform()
catch (Standard_Failure) {
myErrorStatus=11;
}
//
myDS->SetDefaultTolerances();
}
//=======================================================================
// function: PerformInternal
@@ -283,6 +244,7 @@ void BOPAlgo_PaveFiller::PerformInternal()
return;
}
//
//modified by NIZNHY-PKV Fri Sep 12 07:06:50 2014f
// 03
PerformVZ();
if (myErrorStatus) {
@@ -303,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

@@ -12,7 +12,7 @@
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
package BOPTest
---Purpose:
@@ -39,8 +39,6 @@ is
LowCommands (aDI:out Interpretor from Draw);
ObjCommands (aDI:out Interpretor from Draw);
PartitionCommands (aDI:out Interpretor from Draw);
APICommands (aDI:out Interpretor from Draw);
OptionCommands (aDI:out Interpretor from Draw);
Factory (aDI:out Interpretor from Draw);
end BOPTest;

View File

@@ -20,7 +20,9 @@
#include <GeometryTest.hxx>
#include <BRepTest.hxx>
#include <MeshTest.hxx>
//#include <CorrectTest.hxx>
#include <HLRTest.hxx>
//#include <stdio.h>
//=======================================================================
//function : AllCommands
@@ -38,8 +40,6 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands)
BOPTest::TolerCommands (theCommands);
BOPTest::ObjCommands (theCommands);
BOPTest::PartitionCommands (theCommands);
BOPTest::APICommands (theCommands);
BOPTest::OptionCommands (theCommands);
}
//=======================================================================
//function : Factory
@@ -57,6 +57,10 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands)
GeometryTest::AllCommands(theCommands);
BRepTest::AllCommands(theCommands);
MeshTest::Commands(theCommands);
//CorrectTest::CorrectCommands(theCommands);
HLRTest::Commands(theCommands);
BOPTest::AllCommands(theCommands);
//printf(" BOP Plugin is loaded\n");
}
//#include <Draw_PluginMacro.hxx>
//DPLUGIN(BOPTest)

View File

@@ -1,217 +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 <BOPTest.ixx>
#include <stdio.h>
#include <string.h>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPTest_Objects.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BRepAlgoAPI_BooleanOperation.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Section.hxx>
static
void ConvertList(const BOPCol_ListOfShape& aLSB,
TopTools_ListOfShape& aLS);
static Standard_Integer bapibuild(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bapibop (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : APICommands
//purpose :
//=======================================================================
void BOPTest::APICommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* g = "Partition commands";
// Commands
theCommands.Add("bapibuild", "use bapibuild r" , __FILE__, bapibuild, g);
theCommands.Add("bapibop", "use bapibop r type" , __FILE__, bapibop, g);
}
//=======================================================================
//function : bapibop
//purpose :
//=======================================================================
Standard_Integer bapibop(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n<3) {
di << " use bapibop r type\n";
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel;
Standard_Integer iErr, iOp;
Standard_Real aFuzzyValue;
BRepAlgoAPI_Common aCommon;
BRepAlgoAPI_Fuse aFuse;
BRepAlgoAPI_Cut aCut;
BRepAlgoAPI_Section aSection;
BRepAlgoAPI_BooleanOperation *pBuilder;
BOPAlgo_Operation aOp;
//
pBuilder=NULL;
iOp=atoi(a[2]);
if (iOp<0 || iOp>4) {
printf(" invalid operation type\n");
return 0;
}
aOp=(BOPAlgo_Operation)iOp;
//
switch (aOp) {
case BOPAlgo_COMMON:
pBuilder=&aCommon;
break;
//
case BOPAlgo_FUSE:
pBuilder=&aFuse;
break;
//
case BOPAlgo_CUT:
case BOPAlgo_CUT21:
pBuilder=&aCut;
break;
//
case BOPAlgo_SECTION:
pBuilder=&aSection;
break;
//
default:
break;
}
//
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
//
TopTools_ListOfShape aLS, aLT;
ConvertList(aLSB, aLS);
ConvertList(aLTB, aLT);
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
//
if (aOp!=BOPAlgo_CUT21) {
pBuilder->SetArguments(aLS);
pBuilder->SetTools(aLT);
}
else {
pBuilder->SetArguments(aLT);
pBuilder->SetTools(aLS);
}
//
pBuilder->SetRunParallel(bRunParallel);
pBuilder->SetFuzzyValue(aFuzzyValue);
//
pBuilder->Build();
iErr=pBuilder->ErrorStatus();
if (iErr) {
Sprintf(buf, " error: %d\n", iErr);
di << buf;
return 0;
}
//
const TopoDS_Shape& aR=pBuilder->Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
//
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bapibuild
//purpose :
//=======================================================================
Standard_Integer bapibuild(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n<2) {
di << " use bapibuild r\n";
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_BuilderAlgo aBuilder;
//
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
//
TopTools_ListOfShape aLS, aLT;
ConvertList(aLSB, aLS);
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
//
aBuilder.SetArguments(aLS);
aBuilder.SetRunParallel(bRunParallel);
aBuilder.SetFuzzyValue(aFuzzyValue);
//
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
if (iErr) {
Sprintf(buf, " error: %d\n", iErr);
di << buf;
return 0;
}
//
const TopoDS_Shape& aR=aBuilder.Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
//
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : ConvertLists
//purpose :
//=======================================================================
void ConvertList(const BOPCol_ListOfShape& aLSB,
TopTools_ListOfShape& aLS)
{
BOPCol_ListIteratorOfListOfShape aItB;
//
aLS.Clear();
aItB.Initialize(aLSB);
for (; aItB.More(); aItB.Next()) {
const TopoDS_Shape& aS=aItB.Value();
aLS.Append(aS);
}
}

View File

@@ -17,43 +17,35 @@
#include <stdio.h>
#include <TCollection_AsciiString.hxx>
#include <DBRep.hxx>
#include <DrawTrSurf.hxx>
#include <Draw_Color.hxx>
#include <Draw.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <NCollection_IncAllocator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
//
#include <BRep_Builder.hxx>
#include <IntTools_FaceFace.hxx>
#include <IntTools_Curve.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Operation.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_MakerVolume.hxx>
#include <BOPAlgo_Section.hxx>
#include <BOPDS_DS.hxx>
#include <BOPTest_DrawableShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <TCollection_AsciiString.hxx>
#include <IntTools_FaceFace.hxx>
#include <IntTools_Curve.hxx>
#include <DrawTrSurf.hxx>
#include <Draw_Color.hxx>
#include <Draw.hxx>
#include <BRepAlgoAPI_BooleanOperation.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Section.hxx>
#include <BOPTest_DrawableShape.hxx>
#include <BOPTest_Objects.hxx>
#include <BOPAlgo_Section.hxx>
//
static BOPAlgo_PaveFiller* pPF=NULL;
@@ -103,44 +95,40 @@ 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);
}
//=======================================================================
//function : bop
//purpose :
//=======================================================================
Standard_Integer bop(Draw_Interpretor& di, Standard_Integer n, const char** a)
Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
char buf[32];
Standard_Boolean bRunParallel;
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";
return 0;
if (n!=3) {
di << " use bop Shape1 Shape2\n";
return 1;
}
//
aS1=DBRep::Get(a[1]);
@@ -148,16 +136,9 @@ Standard_Integer bop(Draw_Interpretor& di, Standard_Integer n, const char** a)
//
if (aS1.IsNull() || aS2.IsNull()) {
di << " null shapes are not allowed \n";
return 0;
return 1;
}
//
aTol=BOPTest_Objects::FuzzyValue();
if (n == 4) {
aTol = Draw::Atof(a[3]);
}
//
bRunParallel=BOPTest_Objects::RunParallel();
//
aLC.Append(aS1);
aLC.Append(aS2);
//
@@ -169,8 +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->SetRunParallel(bRunParallel);
//
pPF->Perform();
iErr=pPF->ErrorStatus();
@@ -224,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;
}
//
@@ -239,7 +218,6 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_BOP aBOP;
//
@@ -250,8 +228,6 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
di << buf;
return 0;
}
//
bRunParallel=BOPTest_Objects::RunParallel();
//
const TopoDS_Shape& aS1=aLC.First();
const TopoDS_Shape& aS2=aLC.Last();
@@ -259,7 +235,6 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
aBOP.AddArgument(aS1);
aBOP.AddTool(aS2);
aBOP.SetOperation(aOp);
aBOP.SetRunParallel (bRunParallel);
//
aBOP.PerformWithFiller(*pPF);
iErr=aBOP.ErrorStatus();
@@ -300,7 +275,6 @@ Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_Section aBOP;
//
@@ -312,14 +286,11 @@ Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char
return 0;
}
//
bRunParallel=BOPTest_Objects::RunParallel();
//
const TopoDS_Shape& aS1=aLC.First();
const TopoDS_Shape& aS2=aLC.Last();
//
aBOP.AddArgument(aS1);
aBOP.AddArgument(aS2);
aBOP.SetRunParallel (bRunParallel);
//
aBOP.PerformWithFiller(*pPF);
iErr=aBOP.ErrorStatus();
@@ -378,73 +349,103 @@ 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 0;
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 0;
return 1;
}
//
char buf[80];
Standard_Boolean bRunParallel, bApp, bPC1, bPC2;
Standard_Integer i, iErr;
Standard_Real aTol;
Standard_Boolean bApp, bPC1, bPC2;
//
bApp = Standard_True;
bPC1 = Standard_True;
bPC2 = Standard_True;
aTol = BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
//
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;
}
}
}
}
}
//
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
//
aSec.Approximation(bApp);
aSec.ComputePCurveOn1(bPC1);
aSec.ComputePCurveOn2(bPC2);
aSec.SetFuzzyValue(aTol);
aSec.SetRunParallel(bRunParallel);
//
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
@@ -456,15 +457,13 @@ Standard_Integer bsmt (Draw_Interpretor& di,
const BOPAlgo_Operation aOp)
{
char buf[32];
Standard_Boolean bRunParallel;
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";
return 0;
if (n!=4) {
di << " use bx r s1 s2\n";
return 1;
}
//
aS1=DBRep::Get(a[2]);
@@ -472,26 +471,15 @@ Standard_Integer bsmt (Draw_Interpretor& di,
//
if (aS1.IsNull() || aS2.IsNull()) {
di << " null shapes are not allowed \n";
return 0;
return 1;
}
aLC.Append(aS1);
aLC.Append(aS2);
//
aTol=BOPTest_Objects::FuzzyValue();
if (n == 5) {
aTol = Draw::Atof(a[4]);
}
//
bRunParallel = BOPTest_Objects::RunParallel();
//
Handle(NCollection_BaseAllocator)aAL=new NCollection_IncAllocator;
//
//---------------------------------------------------------------
BOPAlgo_PaveFiller aPF(aAL);
//
aPF.SetArguments(aLC);
aPF.SetFuzzyValue(aTol);
aPF.SetRunParallel(bRunParallel);
//
aPF.Perform();
iErr=aPF.ErrorStatus();
@@ -501,31 +489,36 @@ Standard_Integer bsmt (Draw_Interpretor& di,
return 0;
}
//
//---------------------------------------------------------------
BOPAlgo_BOP aBOP(aAL);
//
aBOP.AddArgument(aS1);
aBOP.AddTool(aS2);
aBOP.SetOperation(aOp);
aBOP.SetRunParallel(bRunParallel);
BRepAlgoAPI_BooleanOperation* pBuilder=NULL;
//
aBOP.PerformWithFiller(aPF);
if (aOp==BOPAlgo_COMMON) {
pBuilder=new BRepAlgoAPI_Common(aS1, aS2, aPF);
}
else if (aOp==BOPAlgo_FUSE) {
pBuilder=new BRepAlgoAPI_Fuse(aS1, aS2, aPF);
}
else if (aOp==BOPAlgo_CUT) {
pBuilder=new BRepAlgoAPI_Cut (aS1, aS2, aPF);
}
else if (aOp==BOPAlgo_CUT21) {
pBuilder=new BRepAlgoAPI_Cut(aS1, aS2, aPF, Standard_False);
}
//
iErr=aBOP.ErrorStatus();
if (iErr) {
iErr = pBuilder->ErrorStatus();
if (!pBuilder->IsDone()) {
Sprintf(buf, " ErrorStatus : %d\n", iErr);
di << buf;
return 0;
}
const TopoDS_Shape& aR=aBOP.Shape();
const TopoDS_Shape& aR=pBuilder->Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
//
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bopnews
//purpose :
@@ -597,6 +590,7 @@ Standard_Integer bopnews (Draw_Interpretor& di,
//
return 0;
}
//=======================================================================
//function : bopcurves
//purpose :
@@ -634,8 +628,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
const TopoDS_Face& aF1=*(TopoDS_Face*)(&S1);
const TopoDS_Face& aF2=*(TopoDS_Face*)(&S2);
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1,
aToApproxC2dOnS2, anIsDone, bMake2dCurves;
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone, bMake2dCurves;
Standard_Integer i, aNbCurves;
Standard_Real anAppTol, aTolR;
TCollection_AsciiString aNm("c_");
@@ -684,7 +677,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
di << " has no 3d curve\n";
return 1;
}
else {
else
{
di << aNbCurves << " curve(s) found.\n";
}
@@ -724,8 +718,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
di << "(" << nameC2d2 << ") ";
di << " \n Null first 2d curve of the curve #" << i << "\n";
continue;
}
else {
} else {
TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
pc1Nx = pc1N + anIndx;
Standard_CString nameC2d1 = pc1Nx.ToCString();
@@ -737,8 +730,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
if (aPC2.IsNull()) {
di << ") \n Null second 2d curve of the curve #" << i << "\n";
continue;
}
else {
} else {
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
pc2Nx = pc2N + anIndx;
Standard_CString nameC2d2 = pc2Nx.ToCString();
@@ -753,100 +745,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
return 0;
}
//=======================================================================
//function : mkvolume
//purpose :
//=======================================================================
Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
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 = BOPTest_Objects::FuzzyValue();
bToIntersect = Standard_True;
bRunParallel = BOPTest_Objects::RunParallel();
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);
}
}
//
aLS.Clear();
aLS.Assign(aLSx);
}
//
BOPAlgo_MakerVolume aMV;
aMV.SetArguments(aLS);
aMV.SetIntersect(bToIntersect);
aMV.SetRunParallel(bRunParallel);
aMV.SetFuzzyValue(aTol);
//
aMV.Perform();
if (aMV.ErrorStatus()) {
di << "Error status: " << aMV.ErrorStatus();
return 1;
}
//
const TopoDS_Shape& aR = aMV.Shape();
//
DBRep::Set(a[1], aR);
//
return 0;
}
//=======================================================================
//function : bparallelmode
//purpose :
@@ -875,3 +774,81 @@ Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const c
return 0;
}
//=======================================================================
//function : mkvolume
//purpose :
//=======================================================================
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;
return 1;
}
//
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;
}
}
//
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.Perform();
if (aMV.ErrorStatus()) {
di << "Error status: " << aMV.ErrorStatus();
return 1;
}
//
const TopoDS_Shape& aR = aMV.Shape();
//
DBRep::Set(a[1], aR);
//
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

@@ -64,18 +64,6 @@ is
SetBuilderDefault(myclass);
SetRunParallel(myclass;
theFlag: Boolean from Standard);
RunParallel(myclass)
returns Boolean from Standard;
SetFuzzyValue(myclass;
theValue: Real from Standard);
FuzzyValue(myclass)
returns Real from Standard;
--fields
end Objects;

View File

@@ -45,8 +45,6 @@ class BOPTest_Session {
myBuilderDefault=new BOPAlgo_Builder(pA2);
//
myBuilder=myBuilderDefault;
myRunParallel=Standard_False;
myFuzzyValue=0.;
};
//
// Clear
@@ -86,40 +84,11 @@ class BOPTest_Session {
myBuilder=myBuilderDefault;
};
//
BOPCol_ListOfShape& Shapes() {
return myShapes;
}
//
BOPCol_ListOfShape& Tools() {
return myTools;
}
//
void SetRunParallel(const Standard_Boolean bFlag) {
myRunParallel=bFlag;
};
//
Standard_Boolean RunParallel()const {
return myRunParallel;
};
//
void SetFuzzyValue(const Standard_Real aValue) {
myFuzzyValue=aValue;
};
//
Standard_Real FuzzyValue()const {
return myFuzzyValue;
};
//
protected:
//
BOPAlgo_PaveFiller* myPaveFiller;
BOPAlgo_Builder* myBuilder;
BOPAlgo_Builder* myBuilderDefault;
//
BOPCol_ListOfShape myShapes;
BOPCol_ListOfShape myTools;
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
};
//
//=======================================================================
@@ -151,6 +120,8 @@ void BOPTest_Objects::Init()
void BOPTest_Objects::Clear()
{
GetSession().Clear();
//
//clear objects and tools
Shapes().Clear();
Tools().Clear();
}
@@ -221,7 +192,8 @@ BOPAlgo_Section& BOPTest_Objects::Section()
//=======================================================================
BOPCol_ListOfShape& BOPTest_Objects::Shapes()
{
return GetSession().Shapes();
static BOPCol_ListOfShape s_Shapes;
return s_Shapes;
}
//=======================================================================
//function : Tools
@@ -229,39 +201,8 @@ BOPCol_ListOfShape& BOPTest_Objects::Shapes()
//=======================================================================
BOPCol_ListOfShape& BOPTest_Objects::Tools()
{
return GetSession().Tools();
}
//=======================================================================
//function : SetRunParallel
//purpose :
//=======================================================================
void BOPTest_Objects::SetRunParallel(const Standard_Boolean bFlag)
{
GetSession().SetRunParallel(bFlag);
}
//=======================================================================
//function : RunParallel
//purpose :
//=======================================================================
Standard_Boolean BOPTest_Objects::RunParallel()
{
return GetSession().RunParallel();
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BOPTest_Objects::SetFuzzyValue(const Standard_Real aValue)
{
GetSession().SetFuzzyValue(aValue);
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BOPTest_Objects::FuzzyValue()
{
return GetSession().FuzzyValue();
static BOPCol_ListOfShape s_Tools;
return s_Tools;
}
//=======================================================================
//function : Allocator1

View File

@@ -1,123 +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 <BOPTest.ixx>
#include <stdio.h>
#include <string.h>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <BOPTest_Objects.hxx>
static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : OptionCommands
//purpose :
//=======================================================================
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* g = "Partition commands";
// Commands
theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
}
//=======================================================================
//function : boptions
//purpose :
//=======================================================================
Standard_Integer boptions(Draw_Interpretor& di,
Standard_Integer n,
const char** )
{
if (n!=1) {
di << " use boptions\n";
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel;
Standard_Real aFuzzyValue;
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
di << buf;
Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
di << buf;
//
return 0;
}
//=======================================================================
//function : bfuzzyvalue
//purpose :
//=======================================================================
Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use bfuzzyvalue value\n";
return 0;
}
//
Standard_Real aFuzzyValue;
//
aFuzzyValue=Draw::Atof(a[1]);
if (aFuzzyValue<0.) {
di << " Wrong value.\n";
return 0;
}
//
BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
//
return 0;
}
//=======================================================================
//function : brunparallel
//purpose :
//=======================================================================
Standard_Integer brunparallel(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use brunparallel [0/1]\n";
return 0;
}
//
Standard_Integer iX;
Standard_Boolean bRunParallel;
//
iX=Draw::Atoi(a[1]);
if (iX<0 || iX>1) {
di << " Wrong value.\n";
return 0;
}
//
bRunParallel=(Standard_Boolean)(iX);
BOPTest_Objects::SetRunParallel(bRunParallel);
//
return 0;
}

View File

@@ -54,11 +54,12 @@ 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);
}
//=======================================================================
//function : bclear
//purpose :
@@ -83,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;
@@ -103,11 +103,8 @@ Standard_Integer bfillds(Draw_Interpretor& di,
return 0;
}
//
bShowTime = Standard_False;
//
bRunParallel=BOPTest_Objects::RunParallel();
aTol=BOPTest_Objects::FuzzyValue();
//
bShowTime=Standard_False;
bRunParallel=Standard_True;
for (i=1; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
@@ -115,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();
@@ -138,7 +132,6 @@ Standard_Integer bfillds(Draw_Interpretor& di,
//
aPF.SetArguments(aLC);
aPF.SetRunParallel(bRunParallel);
aPF.SetFuzzyValue(aTol);
//
aChrono.Start();
//
@@ -208,7 +201,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
}
//
bShowTime=Standard_False;
bRunParallel=BOPTest_Objects::RunParallel();
bRunParallel=Standard_True;
for (i=2; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
@@ -283,7 +276,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
aOp=(BOPAlgo_Operation)iOp;
//
bShowTime=Standard_False;
bRunParallel=BOPTest_Objects::RunParallel();
bRunParallel=Standard_True;
for (i=3; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
@@ -325,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

@@ -4,5 +4,4 @@ BOPTest_LowCommands.cxx
BOPTest_CheckCommands.cxx
BOPTest_TolerCommands.cxx
BOPTest_ObjCommands.cxx
BOPTest_APICommands.cxx
BOPTest_OptionCommands.cxx
BOPTest_Chronometer.hxx

View File

@@ -1860,7 +1860,7 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
const Standard_Real aTolE)
{
Standard_Integer aNbItMax;
Standard_Real aDist, aDTol, aPM, anEps;
Standard_Real aDist, aDTol, aPM;
Standard_Boolean bRet;
gp_Pnt aP1, aPS;
//
@@ -1871,7 +1871,6 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
}
bRet = Standard_False;
aNbItMax = 15;
anEps = Precision::SquareConfusion();
//
GeomAPI_ProjectPointOnSurf& aProj=theContext->ProjPS(aF);
//
@@ -1885,7 +1884,7 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
aPS=aProjPL.NearestPoint();
//
aPS.SetXYZ(aPS.XYZ()+2.*aTolE*aDB.XYZ());
aProj.Perform(aPS);
aProj.Perform(aPS);
if (!aProj.IsDone()) {
return bRet;
}
@@ -1893,6 +1892,7 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
aProjPL.Perform(aPS);
aPS=aProjPL.NearestPoint();
//
//
do {
aP1.SetXYZ(aPS.XYZ()+aDt*aDB.XYZ());
//
@@ -1907,9 +1907,6 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
aPOut = aProjPL.NearestPoint();
//
gp_Vec aV(aPS, aPOut);
if (aV.SquareMagnitude() < anEps) {
return bRet;
}
aDB.SetXYZ(aV.XYZ());
} while (aDist > aDTol && --aNbItMax);
//
@@ -1951,33 +1948,26 @@ Standard_Real MinStep3D(const TopoDS_Edge& theE1,
aR = 0.;
aBAS.Initialize(aF, Standard_False);
GeomAbs_SurfaceType aSType = aBAS.GetType();
switch (aSType) {
case GeomAbs_Cylinder: {
if (aSType == GeomAbs_Cylinder) {
aR = aBAS.Cylinder().Radius();
break;
}
case GeomAbs_Cone: {
else if (aSType == GeomAbs_Cone) {
gp_Lin aL(aBAS.Cone().Axis());
aR = aL.Distance(aP);
break;
}
case GeomAbs_Sphere: {
aDtMin = Max(aDtMin, 5.e-4);
else if (aSType == GeomAbs_Sphere) {
aR = aBAS.Sphere().Radius();
break;
}
case GeomAbs_Torus: {
else if (aSType == GeomAbs_Torus) {
aR = aBAS.Torus().MajorRadius();
break;
}
default:
aDtMin = Max(aDtMin, 5.e-4);
break;
else if (aSType == GeomAbs_SurfaceOfRevolution) {
aDtMin = 5.e-4;
}
//
if (aR > 100.) {
Standard_Real d = 10*Precision::PConfusion();
aDtMin = Max(aDtMin, sqrt(d*d + 2*d*aR));
Standard_Real d = Precision::PConfusion();
aDtMin = sqrt(d*d + 2*d*aR);
}
//
if (aDt > aDtMax) {

View File

@@ -540,7 +540,7 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
}
//
aToler = BRep_Tool::Tolerance(aE);
aToler=.5*BRep_Tool::Tolerance(aE);
BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler);
//
aFirst = f3d;

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

@@ -350,7 +350,7 @@ Handle(Geom2d_Curve) BRep_Tool::CurveOnSurface(const TopoDS_Edge& E,
GAS.Load(Plane);
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l,Standard_True,Standard_False),
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l),
Plane,
Plane->Position().Direction(),
Standard_True);

View File

@@ -14,101 +14,111 @@
-- 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.
---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.
---Purpose: Check shapes on validity for boolean
--- operation.
DumpOper( theFilePath : CString from Standard;
theShape1 : Shape from TopoDS;
theShape2 : Shape from TopoDS;
theResult : Shape from TopoDS;
theOperation : Operation from BOPAlgo;
isNonValidArgs : Boolean from Standard );
---Purpose: Dump arguments and result of boolean operation in the file specified by path.
---Level: Public
deferred class Algo;
class BuilderAlgo;
end BRepAlgoAPI;

View File

@@ -0,0 +1,105 @@
// Created on: 2012-12-25
// Created by: KULIKOVA Galina
// Copyright (c) 2012-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.ixx>
#include <stdio.h>
#include <TCollection_AsciiString.hxx>
#include <BRepTools.hxx>
#include <OSD_File.hxx>
//=======================================================================
//function : dumpOper
//purpose :
//=======================================================================
void BRepAlgoAPI::DumpOper(const Standard_CString theFilePath,
const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
const TopoDS_Shape& theResult,
BOPAlgo_Operation theOperation,
Standard_Boolean isNonValidArgs)
{
TCollection_AsciiString aPath(theFilePath);
aPath += "/";
Standard_Integer aNumOper = 1;
Standard_Boolean isExist = Standard_True;
TCollection_AsciiString aFileName;
while(isExist)
{
aFileName = aPath + "BO_" + TCollection_AsciiString(aNumOper) +".tcl";
OSD_File aScript(aFileName);
isExist = aScript.Exists();
if(isExist)
aNumOper++;
}
FILE* afile = fopen(aFileName.ToCString(), "w+");
if(!afile)
return;
if(isNonValidArgs)
fprintf(afile,"%s\n","# Arguments are invalid");
TCollection_AsciiString aName1;
TCollection_AsciiString aName2;
TCollection_AsciiString aNameRes;
if(!theShape1.IsNull())
{
aName1 = aPath +
"Arg1_" + TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theShape1, aName1.ToCString());
}
else
fprintf(afile,"%s\n","# First argument is Null ");
if(!theShape2.IsNull())
{
aName2 = aPath +
"Arg2_"+ TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theShape2, aName2.ToCString());
}
else
fprintf(afile,"%s\n","# Second argument is Null ");
if(!theResult.IsNull())
{
aNameRes = aPath +
"Result_"+ TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theResult, aNameRes.ToCString());
}
else
fprintf(afile,"%s\n","# Result is Null ");
fprintf(afile, "%s %s %s\n","restore", aName1.ToCString(), "arg1");
fprintf(afile, "%s %s %s\n","restore", aName2.ToCString(), "arg2");;
TCollection_AsciiString aBopString;
switch (theOperation)
{
case BOPAlgo_COMMON : aBopString += "bcommon Res "; break;
case BOPAlgo_FUSE : aBopString += "bfuse Res "; break;
case BOPAlgo_CUT :
case BOPAlgo_CUT21 : aBopString += "bcut Res "; break;
case BOPAlgo_SECTION : aBopString += "bsection Res "; break;
default : break;
};
aBopString += ("arg1 arg2");
if(theOperation == BOPAlgo_CUT21)
aBopString += " 1";
fprintf(afile, "%s\n",aBopString.ToCString());
fclose(afile);
}

View File

@@ -1,86 +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();"
---Purpose: Empty constructor
Initialize (theAllocator: BaseAllocator from BOPCol)
returns Algo from BRepAlgoAPI;
---Purpose: Empty constructor
ErrorStatus (me)
returns Integer from Standard;
---Purpose: Returns error status of the algorithm
-- ==0 - no errors occured
-- !=0 - is in the event of various error conditions
WarningStatus (me)
returns Integer from Standard;
---Purpose: Returns warning status of the algorithm
-- ==0 - no warning occured
-- !=0 - is in the event of various warning conditions
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 &
Clear(me:out)
is virtual protected;
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;

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