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
774 changed files with 13521 additions and 23480 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

@@ -96,6 +96,8 @@ void AIS_ConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& the
{
myTypeOfPresentation3d = myReference->TypeOfPresentation3d();
}
theAnotherObj->AddChild (this);
}
//=======================================================================

View File

@@ -98,18 +98,16 @@ namespace
//purpose :
//=======================================================================
AIS_Dimension::AIS_Dimension (const AIS_KindOfDimension theType)
: AIS_InteractiveObject (),
mySelToleranceForText2d(0.0),
myCustomValue (0.0),
myIsValueCustom (Standard_False),
myIsTextPositionFixed (Standard_False),
mySpecialSymbol (' '),
: AIS_InteractiveObject(),
myCustomValue (0.0),
myIsValueCustom (Standard_False),
mySpecialSymbol (' '),
myDisplaySpecialSymbol (AIS_DSS_No),
myGeometryType (GeometryType_UndefShapes),
myIsPlaneCustom (Standard_False),
myFlyout (0.0),
myIsGeometryValid (Standard_False),
myKindOfDimension (theType)
myGeometryType (GeometryType_UndefShapes),
myIsPlaneCustom (Standard_False),
myFlyout (0.0),
myIsGeometryValid (Standard_False),
myKindOfDimension (theType)
{
}

View File

@@ -172,31 +172,30 @@ is
-- local context without selection, use the syntax below,
-- setting aSelectionMode to -1.
Display (me : mutable;
theIObj : InteractiveObject from AIS;
theDispMode : Integer from Standard;
theSelectionMode : Integer from Standard;
theToUpdateViewer : Boolean from Standard = Standard_True;
theToAllowDecomposition : Boolean from Standard = Standard_True;
theDispStatus : DisplayStatus from AIS = AIS_DS_None);
Display(me : mutable;
anIobj : InteractiveObject from AIS;
amode : Integer from Standard ;
aSelectionMode : Integer from Standard ;
updateviewer : Boolean from Standard = Standard_True;
allowdecomposition : Boolean from Standard = Standard_True);
---Purpose: Controls the choice between the using the display
-- and selection modes of open local context which you
-- have defined and activating those available by default.
-- If no Local Context is opened. and the Interactive
-- Object theIObj has no display mode of its own, the
-- default display mode, 0, is used. Likewise, if theIObj
-- Object aniobj has no display mode of its own, the
-- default display mode, 0, is used. Likewise, if aniobj
-- has no selection mode of its own, the default one, 0, is used.
-- If a local context is open and if theToUpdateViewer equals
-- If a local context is open and if updateviewer equals
-- Standard_False, the presentation of the Interactive
-- Object activates the selection mode; the object is
-- displayed but no viewer will be updated.
-- If theSelectionMode equals -1, theIObj will not be
-- If aSelectionMode equals -1, anIobj will not be
-- activated: it will be displayed but will not be selectable.
-- Use this if you want to view the object in open local
-- context without selection. Note: This option is only
-- available in Local Context.
-- If theToAllowDecomposition equals true, theIObj can have
-- subshapes detected by selection mechanisms. theIObj
-- If allowDecomposition equals true, anIObj can have
-- subshapes detected by selection mechanisms. anIObj
-- must be able to give a shape selection modes which
-- fit the AIS_Shape selection modes:
-- - vertices: 1
@@ -346,14 +345,22 @@ is
SetZLayer( me : mutable;
theIObj : InteractiveObject from AIS;
theLayerId : Integer from Standard );
---Purpose: Set Z layer id for interactive object.
-- The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
-- The ids for Z layers are generated by V3d_Viewer.
---Purpose: Set Z layer id for interactive object. The layer can be
-- specified for displayed object only. The Z layers can be used to display
-- temporarily presentations of some object in front of the other objects
-- in the scene. The ids for Z layers are generated by V3d_Viewer.
-- Note that Z layers differ from under-/overlayer in V3d_View:
-- under-/overlayer are intended for specific 2D drawings that appear
-- behind/in front of all 3D presentations, while SetZLayer() method
-- applies to regular 3D presentations and does not imply any specific
-- drawing methods.
GetZLayer( me;
theIObj : InteractiveObject from AIS )
returns Integer from Standard;
---Purpose: Get Z layer id set for displayed interactive object.
-- If the object doesn't exists in context or has no computed presentations,
-- the method returns -1.
Redisplay(me : mutable;
aniobj : InteractiveObject from AIS;

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

@@ -33,7 +33,6 @@
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <Visual3d_ViewManager.hxx>
#include <Visual3d_View.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <AIS_Shape.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
@@ -79,10 +78,7 @@ mgrSelector(new SelectMgr_SelectionManager()),
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())),
myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
myWasLastMain(Standard_False),
myCurrentTouched(Standard_False),
mySelectedTouched(Standard_False),
myToHilightSelected(Standard_True),
myToHilightSelected( Standard_True ),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
myDefaultColor(Quantity_NOC_GOLDENROD),
@@ -92,7 +88,6 @@ myPreselectionColor(Quantity_NOC_GREEN),
mySubIntensity(Quantity_NOC_GRAY40),
myDisplayMode(0),
myCurLocalIndex(0),
myAISCurDetected(0),
myZDetectionFlag(0),
myIsAutoActivateSelMode( Standard_True )
{
@@ -271,12 +266,8 @@ void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_KindOfInteractive
{
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (theStatus != AIS_DS_None
&& anObjIter.Value()->GraphicStatus() != theStatus)
{
continue;
}
else if (anObjIter.Key()->Type() != theKind)
if (anObjIter.Value()->GraphicStatus() != theStatus
|| anObjIter.Key()->Type() != theKind)
{
continue;
}
@@ -349,43 +340,26 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theToAllowDecomposition,
const AIS_DisplayStatus theDispStatus)
const Standard_Boolean theToAllowDecomposition)
{
if (theIObj.IsNull())
{
return;
}
if (theDispStatus == AIS_DS_Erased)
{
Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition);
return;
}
if (!theIObj->HasInteractiveContext())
{
theIObj->SetContext (this);
}
if (theDispStatus == AIS_DS_Temporary
&& !HasOpenedContext())
if (HasOpenedContext())
{
return;
}
else if (HasOpenedContext())
{
if (theDispStatus == AIS_DS_None
|| theDispStatus == AIS_DS_Temporary)
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
}
return;
myMainVwr->Update();
}
return;
}
if (!myObjects.IsBound (theIObj))
@@ -405,7 +379,8 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
else
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Temporary)
if (aStatus->GraphicStatus() != AIS_DS_Displayed
&& aStatus->GraphicStatus() != AIS_DS_Erased)
{
return;
}
@@ -439,7 +414,10 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
}
myMainPM->Display (theIObj, theDispMode);
aStatus->SetGraphicStatus (AIS_DS_Displayed);
if (aStatus->GraphicStatus() == AIS_DS_Erased)
{
aStatus->SetGraphicStatus (AIS_DS_Displayed);
}
if (aStatus->IsHilighted())
{
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
@@ -489,21 +467,13 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
}
if (theSelMode == -1
&& !theToAllowDecomposition)
&& !theToAllowDecomposition
&& !myObjects.IsBound (theIObj))
{
if (!myObjects.IsBound (theIObj))
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
myObjects.Bind (theIObj, aStatus);
}
// Register theIObj in the selection manager to prepare further activation of selection
if (!mgrSelector->Contains (theIObj))
{
mgrSelector->Load (theIObj);
}
Standard_Integer aDispMode, aHiMod, aSelModeDef;
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
myObjects.Bind (theIObj, aStatus);
}
}
@@ -892,14 +862,14 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_True);
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
STATUS->SetHilightStatus (Standard_True);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
if (STATUS->GraphicStatus() == AIS_DS_Displayed)
{
const Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Color (anIObj, aCol, aHilightMode);
aStatus->SetHilightColor (aCol);
STATUS->SetHilightColor (aCol);
}
}
else
@@ -922,11 +892,11 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightColor(Quantity_NOC_WHITE);
const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
STATUS->SetHilightStatus (Standard_False);
STATUS->SetHilightColor(Quantity_NOC_WHITE);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
if (STATUS->GraphicStatus() == AIS_DS_Displayed)
{
Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
myMainPM->Unhighlight (anIObj, aHilightMode);
@@ -1462,12 +1432,12 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode theMode,
aStatus->AddDisplayMode (theMode);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
myMainPM->Display (anObj, theMode);
if (aStatus->IsSubIntensityOn())
{
myMainPM->Color (anObj, mySubIntensity, theMode);
}
myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
}
}
@@ -1491,6 +1461,11 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
theIObj->SetContext(this);
}
if (HasOpenedContext())
{
return;
}
if (!myObjects.IsBound (theIObj))
{
theIObj->SetDisplayMode (theMode);
@@ -2259,39 +2234,35 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Temporary
|| aStatus->GraphicStatus() == AIS_DS_Erased)
Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
return;
}
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
{
if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
{
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
{
myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
}
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
}
myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
}
if (IsCurrent (theIObj)
&& !aStatus->IsDModeIn (aDispMode))
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
}
if (IsCurrent (theIObj)
&& !aStatus->IsDModeIn (aDispMode))
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
}
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
}
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
if (theToUpdateviewer)
{
myMainVwr->Update();
}
}
aStatus->SetGraphicStatus (AIS_DS_Erased);
if (theToUpdateviewer)
{
myMainVwr->Update();
}
}
//=======================================================================
@@ -2758,7 +2729,17 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the
if (theIObj.IsNull())
return;
theIObj->SetZLayer (theLayerId);
if (myObjects.IsBound (theIObj))
{
if (myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed || myObjects (theIObj)->GraphicStatus() == AIS_DS_Erased)
{
theIObj->SetZLayer (myMainPM, theLayerId);
}
}
else if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetZLayer (theIObj, theLayerId);
}
}
//=======================================================================
@@ -2767,7 +2748,17 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the
//=======================================================================
Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
{
return !theIObj.IsNull()
? theIObj->ZLayer()
: Graphic3d_ZLayerId_UNKNOWN;
if (theIObj.IsNull())
return -1;
if (myObjects.IsBound (theIObj))
{
return theIObj->GetZLayer (myMainPM);
}
else if (HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
}
return -1;
}

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

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

View File

@@ -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;
@@ -416,6 +411,26 @@ is
anObject: InteractiveObject from AIS;
Prior : Integer from Standard);
SetZLayer( me : mutable;
theIObj : InteractiveObject from AIS;
theLayerId : Integer from Standard );
---Purpose: Set Z layer id for interactive object. The layer can be
-- specified for displayed object only. The Z layers can be used to display
-- temporarily presentations of some object in front of the other objects
-- in the scene. The ids for Z layers are generated by V3d_Viewer.
-- Note that Z layers differ from under-/overlayer in V3d_View:
-- under-/overlayer are intended for specific 2D drawings that appear
-- behind/in front of all 3D presentations, while SetZLayer() method
-- applies to regular 3D presentations and does not imply any specific
-- drawing methods.
GetZLayer( me;
theIObj : InteractiveObject from AIS )
returns Integer from Standard;
---Purpose: Get Z layer id set for displayed interactive object.
-- If the object doesn't exists in context or has no computed presentations,
-- the method returns -1.
DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
returns Integer from Standard;

View File

@@ -1219,3 +1219,34 @@ Standard_Integer AIS_LocalContext::PixelTolerance() const {
return myMainVS->PixelTolerance();
}
//=======================================================================
//function : SetZLayer
//purpose :
//=======================================================================
void AIS_LocalContext::SetZLayer (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theLayerId)
{
if (!myActiveObjects.IsBound (theIObj))
return;
const Handle(AIS_LocalStatus)& aStatus = myActiveObjects (theIObj);
if (aStatus->DisplayMode () == -1)
return;
theIObj->SetZLayer (myMainPM, theLayerId);
}
//=======================================================================
//function : GetZLayer
//purpose :
//=======================================================================
Standard_Integer AIS_LocalContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
{
if (!myActiveObjects.IsBound (theIObj))
return -1;
return theIObj->GetZLayer (myMainPM);
}

View File

@@ -773,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 :
@@ -808,7 +786,6 @@ TopoDS_Shape AIS_LocalContext::SelectedShape() const
{
return TopoDS_Shape();
}
return aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
}
@@ -1485,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

@@ -25,7 +25,6 @@
//=======================================================================
Adaptor2d_Line2d::Adaptor2d_Line2d()
: myUfirst(0.0), myUlast (0.0)
{
}
@@ -34,11 +33,10 @@ Adaptor2d_Line2d::Adaptor2d_Line2d()
//purpose :
//=======================================================================
Adaptor2d_Line2d::Adaptor2d_Line2d(const gp_Pnt2d& P,
const gp_Dir2d& D,
const Standard_Real UFirst,
const Standard_Real ULast)
: myUfirst(UFirst), myUlast(ULast), myAx2d(P,D)
Adaptor2d_Line2d::Adaptor2d_Line2d(const gp_Pnt2d& P, const gp_Dir2d& D,
const Standard_Real UFirst,
const Standard_Real ULast):
myUfirst(UFirst),myUlast(ULast),myAx2d(P,D)
{
}

View File

@@ -35,26 +35,24 @@
//purpose :
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve()
: myIso (GeomAbs_NoneIso),
myFirst (0.0),
myLast (0.0),
myParameter(0.0)
{
}
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve() :
myIso(GeomAbs_NoneIso),
myFirst ( 0. ),
myLast ( 0. ),
myParameter ( 0. )
{}
//=======================================================================
//function : Adaptor3d_IsoCurve
//purpose :
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S)
: mySurface (S),
myIso (GeomAbs_NoneIso),
myFirst (0.0),
myLast (0.0),
myParameter(0.0)
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S) :
myFirst ( 0. ),
myLast ( 0. ),
myParameter ( 0. )
{
Load(S);
}
//=======================================================================
@@ -63,15 +61,11 @@ Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S)
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
const GeomAbs_IsoType theIso,
const Standard_Real theParam)
: mySurface (S),
myIso (GeomAbs_NoneIso),
myFirst (0.0),
myLast (0.0),
myParameter(0.0)
const GeomAbs_IsoType Iso,
const Standard_Real Param)
{
Load(theIso, theParam);
Load(S);
Load(Iso,Param);
}
//=======================================================================
@@ -79,18 +73,14 @@ Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
//purpose :
//=======================================================================
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& theS,
const GeomAbs_IsoType theIso,
const Standard_Real theParam,
const Standard_Real theWFirst,
const Standard_Real theWLast)
: mySurface (theS),
myIso (theIso),
myFirst (theWFirst),
myLast (theWLast),
myParameter(theParam)
Adaptor3d_IsoCurve::Adaptor3d_IsoCurve(const Handle(Adaptor3d_HSurface)& S,
const GeomAbs_IsoType Iso,
const Standard_Real Param,
const Standard_Real WFirst,
const Standard_Real WLast)
{
Load(theIso, theParam, theWFirst, theWLast);
Load(S);
Load(Iso,Param,WFirst,WLast);
}
//=======================================================================

View File

@@ -28,11 +28,22 @@
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve()
: myOffset(0.0),
myFirst (0.0),
myLast (0.0)
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve() :
myOffset( 0.),
myFirst ( 0.),
myLast ( 0.)
{}
//=======================================================================
//function : Adaptor3d_OffsetCurve
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C) :
myFirst ( 0.),
myLast ( 0.)
{
Load(C);
}
//=======================================================================
@@ -40,12 +51,13 @@ Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve()
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& theCurve)
: myCurve (theCurve),
myOffset(0.0),
myFirst (0.0),
myLast (0.0)
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real Offset) :
myFirst ( 0.),
myLast ( 0.)
{
Load(C);
Load(Offset);
}
//=======================================================================
@@ -53,30 +65,13 @@ Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& t
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve
(const Handle(Adaptor2d_HCurve2d)& theCurve, const Standard_Real theOffset)
: myCurve (theCurve),
myOffset(theOffset),
myFirst (theCurve->FirstParameter()),
myLast (theCurve->LastParameter())
{
}
//=======================================================================
//function : Adaptor3d_OffsetCurve
//purpose :
//=======================================================================
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(
const Handle(Adaptor2d_HCurve2d)& theCurve,
const Standard_Real theOffset,
const Standard_Real theWFirst,
const Standard_Real theWLast )
: myCurve (theCurve),
myOffset(theOffset),
myFirst (theWFirst),
myLast (theWLast)
Adaptor3d_OffsetCurve::Adaptor3d_OffsetCurve(const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real Offset,
const Standard_Real WFirst,
const Standard_Real WLast)
{
Load(C);
Load(Offset,WFirst,WLast);
}
//=======================================================================
@@ -109,8 +104,8 @@ void Adaptor3d_OffsetCurve::Load( const Standard_Real Offset)
//=======================================================================
void Adaptor3d_OffsetCurve::Load(const Standard_Real Offset,
const Standard_Real WFirst,
const Standard_Real WLast)
const Standard_Real WFirst,
const Standard_Real WLast)
{
myOffset = Offset;
myFirst = WFirst;

View File

@@ -48,57 +48,54 @@
//purpose :
//=======================================================================
AdvApp2Var_ApproxAFunc2Var::AdvApp2Var_ApproxAFunc2Var(
const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice)
: my1DTolerances (OneDTol),
my2DTolerances (TwoDTol),
my3DTolerances (ThreeDTol),
my1DTolOnFront (OneDTolFr),
my2DTolOnFront (TwoDTolFr),
my3DTolOnFront (ThreeDTolFr),
myFirstParInU (FirstInU),
myLastParInU (LastInU),
myFirstParInV (FirstInV),
myLastParInV (LastInV),
myFavoriteIso (FavorIso),
myContInU (ContInU),
myContInV (ContInV),
myPrecisionCode (PrecisCode),
myMaxDegInU (MaxDegInU),
myMaxDegInV (MaxDegInV),
myMaxPatches (MaxPatch),
myDone (Standard_False),
myHasResult (Standard_False),
myDegreeInU (0),
myDegreeInV (0),
myCriterionError(0.0)
AdvApp2Var_ApproxAFunc2Var::
AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice) :
my1DTolerances(OneDTol),
my2DTolerances(TwoDTol),
my3DTolerances(ThreeDTol),
my1DTolOnFront(OneDTolFr),
my2DTolOnFront(TwoDTolFr),
my3DTolOnFront(ThreeDTolFr),
myFirstParInU(FirstInU),
myLastParInU(LastInU),
myFirstParInV(FirstInV),
myLastParInV(LastInV),
myFavoriteIso(FavorIso),
myContInU(ContInU),
myContInV(ContInV),
myPrecisionCode(PrecisCode),
myMaxDegInU(MaxDegInU),
myMaxDegInV(MaxDegInV),
myMaxPatches(MaxPatch),
myDone(Standard_False),
myHasResult(Standard_False),
myCriterionError(0.)
{
myNumSubSpaces[0] = Num1DSS;
myNumSubSpaces[1] = Num2DSS;
myNumSubSpaces[2] = Num3DSS;
Init();
Perform(UChoice, VChoice, Func);
ConvertBS();
@@ -109,58 +106,54 @@ AdvApp2Var_ApproxAFunc2Var::AdvApp2Var_ApproxAFunc2Var(
//purpose :
//=======================================================================
AdvApp2Var_ApproxAFunc2Var::AdvApp2Var_ApproxAFunc2Var(
const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
const AdvApp2Var_Criterion& Crit,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice)
: my1DTolerances (OneDTol),
my2DTolerances (TwoDTol),
my3DTolerances (ThreeDTol),
my1DTolOnFront (OneDTolFr),
my2DTolOnFront (TwoDTolFr),
my3DTolOnFront (ThreeDTolFr),
myFirstParInU (FirstInU),
myLastParInU (LastInU),
myFirstParInV (FirstInV),
myLastParInV (LastInV),
myFavoriteIso (FavorIso),
myContInU (ContInU),
myContInV (ContInV),
myPrecisionCode (PrecisCode),
myMaxDegInU (MaxDegInU),
myMaxDegInV (MaxDegInV),
myMaxPatches (MaxPatch),
myDone (Standard_False),
myHasResult (Standard_False),
myDegreeInU (0),
myDegreeInV (0),
myCriterionError(0.0)
AdvApp2Var_ApproxAFunc2Var::
AdvApp2Var_ApproxAFunc2Var(const Standard_Integer Num1DSS,
const Standard_Integer Num2DSS,
const Standard_Integer Num3DSS,
const Handle(TColStd_HArray1OfReal)& OneDTol,
const Handle(TColStd_HArray1OfReal)& TwoDTol,
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
const Handle(TColStd_HArray2OfReal)& OneDTolFr,
const Handle(TColStd_HArray2OfReal)& TwoDTolFr,
const Handle(TColStd_HArray2OfReal)& ThreeDTolFr,
const Standard_Real FirstInU,
const Standard_Real LastInU,
const Standard_Real FirstInV,
const Standard_Real LastInV,
const GeomAbs_IsoType FavorIso,
const GeomAbs_Shape ContInU,
const GeomAbs_Shape ContInV,
const Standard_Integer PrecisCode,
const Standard_Integer MaxDegInU,
const Standard_Integer MaxDegInV,
const Standard_Integer MaxPatch,
const AdvApp2Var_EvaluatorFunc2Var& Func,
const AdvApp2Var_Criterion& Crit,
AdvApprox_Cutting& UChoice,
AdvApprox_Cutting& VChoice) :
my1DTolerances(OneDTol),
my2DTolerances(TwoDTol),
my3DTolerances(ThreeDTol),
my1DTolOnFront(OneDTolFr),
my2DTolOnFront(TwoDTolFr),
my3DTolOnFront(ThreeDTolFr),
myFirstParInU(FirstInU),
myLastParInU(LastInU),
myFirstParInV(FirstInV),
myLastParInV(LastInV),
myFavoriteIso(FavorIso),
myContInU(ContInU),
myContInV(ContInV),
myPrecisionCode(PrecisCode),
myMaxDegInU(MaxDegInU),
myMaxDegInV(MaxDegInV),
myMaxPatches(MaxPatch),
myDone(Standard_False),
myHasResult(Standard_False)
{
myNumSubSpaces[0] = Num1DSS;
myNumSubSpaces[1] = Num2DSS;
myNumSubSpaces[2] = Num3DSS;
Init();
Perform(UChoice, VChoice, Func, Crit);
ConvertBS();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,5 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -13,12 +12,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_MapOfStructure
#define _Graphic3d_MapOfStructure
#include <AppCont_Function2d.ixx>
#include <Handle_Graphic3d_Structure.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<Handle(Graphic3d_Structure)> Graphic3d_MapOfStructure;
#endif // _Graphic3d_MapOfStructure
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,22 +61,6 @@ inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::CurveOnSurfaceMode()
{
return myCurveOnSurfaceMode;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
inline void BOPAlgo_ArgumentAnalyzer::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = (theFuzz < 0.) ? 0. : 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,22 +172,6 @@ BOPDS_PDS BOPAlgo_Builder::PDS()
return myDS;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BOPAlgo_Builder::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BOPAlgo_Builder::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
@@ -273,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;
@@ -418,8 +413,7 @@ is
-- state information
UpdateFaceInfo(me:out;
theDME:out DataMapOfPaveBlockListOfPaveBlock from BOPDS;
theDMV: DataMapOfIntegerInteger from BOPCol)
theDME:out DataMapOfPaveBlockListOfPaveBlock from BOPDS)
is protected;
---Purpose:
-- Updates the information about faces
@@ -469,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,22 +123,6 @@ const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
return myArguments;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz;
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BOPAlgo_PaveFiller::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
// function: Init
// purpose:
//=======================================================================
@@ -175,7 +141,6 @@ void BOPAlgo_PaveFiller::Init()
// 1.myDS
myDS=new BOPDS_DS(myAllocator);
myDS->SetArguments(myArguments);
myDS->SetFuzzyValue(myFuzzyValue);
myDS->Init();
//
// 2.myIterator
@@ -205,8 +170,6 @@ void BOPAlgo_PaveFiller::Perform()
catch (Standard_Failure) {
myErrorStatus=11;
}
//
myDS->SetDefaultTolerances();
}
//=======================================================================
// function: PerformInternal
@@ -281,6 +244,7 @@ void BOPAlgo_PaveFiller::PerformInternal()
return;
}
//
//modified by NIZNHY-PKV Fri Sep 12 07:06:50 2014f
// 03
PerformVZ();
if (myErrorStatus) {
@@ -301,4 +265,5 @@ void BOPAlgo_PaveFiller::PerformInternal()
if (myErrorStatus) {
return;
}
//modified by NIZNHY-PKV Fri Sep 12 07:06:52 2014t
}

View File

@@ -32,14 +32,11 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBndLib.hxx>
#include <BRepTools.hxx>
@@ -51,10 +48,7 @@
#include <IntTools_SequenceOfPntOn2Faces.hxx>
#include <IntTools_Curve.hxx>
#include <IntTools_PntOn2Faces.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_EdgeFace.hxx>
#include <IntSurf_ListOfPntOn2S.hxx>
#include <IntSurf_PntOn2S.hxx>
@@ -71,6 +65,9 @@
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_Curve.hxx>
@@ -88,9 +85,12 @@
#include <BOPDS_CoupleOfPaveBlocks.hxx>
#include <BOPDS_FaceInfo.hxx>
#include <BOPDS_CommonBlock.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopExp.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
static void ToleranceFF(const BRepAdaptor_Surface& aBAS1,
const BRepAdaptor_Surface& aBAS2,
@@ -597,7 +597,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
}
//
// update face info
UpdateFaceInfo(aDMExEdges, aDMI);
UpdateFaceInfo(aDMExEdges);
//Update all pave blocks
UpdatePaveBlocks(aDMI);
//-----------------------------------------------------scope t
@@ -754,8 +754,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
if (!bHasPaveBlocks) {
if (bOld) {
aDMExEdges.ChangeFind(aPB1).Append(aPB1);
}
else {
} else {
aSI.SetShapeType(aType);
aSI.SetShape(aSx);
iE=myDS->Append(aSI);
@@ -895,13 +894,12 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::UpdateFaceInfo
(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME,
const BOPCol_DataMapOfIntegerInteger& theDMV)
(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
{
Standard_Integer i, j, nV1, nF1, nF2,
aNbFF, aNbC, aNbP;
aNbFF, aNbC, aNbP, aNbS, aNbPBIn;
BOPDS_IndexedMapOfPaveBlock aMPBCopy;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPCol_MapOfInteger aMF;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNbFF=aFFs.Extent();
@@ -914,7 +912,6 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
//
// 1.1. Section edges
BOPDS_VectorOfCurve& aVNC=aFF.ChangeCurves();
aNbC=aVNC.Extent();
for (j=0; j<aNbC; ++j) {
@@ -922,24 +919,21 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
aItLPB.Initialize(aLPBC);
//
// Treat existing pave blocks
if (aItLPB.More() && theDME.IsBound(aLPBC.First())) {
const Handle(BOPDS_PaveBlock)& aPB=aLPBC.First();
BOPDS_ListOfPaveBlock& aLPB=theDME.ChangeFind(aPB);
BOPDS_ListOfPaveBlock& aLPB = theDME.ChangeFind(aPB);
UpdateExistingPaveBlocks(aPB, aLPB, nF1, nF2);
aLPBC.Clear();
continue;
}
//
// Add section edges to face info
for (; aItLPB.More(); aItLPB.Next()) {
for(; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value();
aFI1.ChangePaveBlocksSc().Add(aPB);
aFI2.ChangePaveBlocksSc().Add(aPB);
}
}
//
// 1.2. Section vertices
// VerticesSc
const BOPDS_VectorOfPoint& aVNP=aFF.Points();
aNbP=aVNP.Extent();
for (j=0; j<aNbP; ++j) {
@@ -951,81 +945,43 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
aFI1.ChangeVerticesSc().Add(nV1);
aFI2.ChangeVerticesSc().Add(nV1);
}
//
aMF.Add(nF1);
aMF.Add(nF2);
}
//
Standard_Boolean bVerts, bEdges;
//
bVerts = theDMV.Extent() > 0;
bEdges = theDME.Extent() > 0;
//
if (!bVerts && !bEdges) {
//2. PaveBlocksIn
if (theDME.IsEmpty()) {
return;
}
//
// 2. Update Face Info information with new vertices and new
// pave blocks created in PostTreatFF from existing ones
Standard_Integer nV2, aNbPB;
BOPCol_MapIteratorOfMapOfInteger aItMF;
BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItMV;
//
aItMF.Initialize(aMF);
for (; aItMF.More(); aItMF.Next()) {
nF1 = aItMF.Value();
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
if (aSI.ShapeType()!=TopAbs_FACE) {
continue;
}
if(!myDS->HasFaceInfo(i)) {
continue;
}
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(i);
//
BOPDS_FaceInfo& aFI = myDS->ChangeFaceInfo(nF1);
BOPDS_IndexedMapOfPaveBlock& aMPBIn=aFI.ChangePaveBlocksIn();
aMPBCopy.Assign(aMPBIn);
aMPBIn.Clear();
//
// 2.1. Update information about vertices
if (bVerts) {
BOPCol_MapOfInteger& aMVOn = aFI.ChangeVerticesOn();
BOPCol_MapOfInteger& aMVIn = aFI.ChangeVerticesIn();
//
aItMV.Initialize(theDMV);
for (; aItMV.More(); aItMV.Next()) {
nV1 = aItMV.Key();
nV2 = aItMV.Value();
//
if (aMVOn.Remove(nV1)) {
aMVOn.Add(nV2);
aNbPBIn=aMPBCopy.Extent();
for (j=1; j<=aNbPBIn; ++j) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(j);
if (theDME.IsBound(aPB)) {
const BOPDS_ListOfPaveBlock& aLPB = theDME.Find(aPB);
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB.Value();
aMPBIn.Add(aPB1);
}
//
if (aMVIn.Remove(nV1)) {
aMVIn.Add(nV2);
}
} // for (; aItMV.More(); aItMV.Next()) {
} // if (bVerts) {
//
// 2.2. Update information about pave blocks
if (bEdges) {
BOPDS_IndexedMapOfPaveBlock& aMPBOn = aFI.ChangePaveBlocksOn();
BOPDS_IndexedMapOfPaveBlock& aMPBIn = aFI.ChangePaveBlocksIn();
//
BOPDS_IndexedMapOfPaveBlock aMPBCopy;
for (i = 0; i < 2; ++i) {
BOPDS_IndexedMapOfPaveBlock& aMPBOnIn = !i ? aMPBOn : aMPBIn;
aMPBCopy = aMPBOnIn;
aMPBOnIn.Clear();
//
aNbPB = aMPBCopy.Extent();
for (j = 1; j <= aNbPB; ++j) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBCopy(j);
if (theDME.IsBound(aPB)) {
const BOPDS_ListOfPaveBlock& aLPB = theDME.Find(aPB);
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB1 = aItLPB.Value();
aMPBOnIn.Add(aPB1);
}
}
else {
aMPBOnIn.Add(aPB);
}
} // for (j = 1; j <= aNbPB; ++j) {
} // for (i = 0; i < 2; ++i) {
} // if (bEdges) {
}
} else {
aMPBIn.Add(aPB);
}
}//for (j=1; j<=aNbPBIn; ++j) {
}//for (i=0; i<aNbS; ++i) {
}
//=======================================================================
//function : IsExistingVertex
@@ -1851,8 +1807,9 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
Handle(BOPDS_PaveBlock) aPB, aPB1, aPB2, aPB2n;
Handle(BOPDS_CommonBlock) aCB;
BOPDS_ListIteratorOfListOfPaveBlock aIt, aIt1, aIt2;
BOPDS_IndexedMapOfPaveBlock aMPB;
//
// 1. Remove micro edges from aLPB
//remove micro edges from aLPB
aIt.Initialize(aLPB);
for (; aIt.More();) {
aPB = aIt.Value();
@@ -1867,6 +1824,10 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
if (!aLPB.Extent()) {
return;
}
//update face info
myDS->UpdateFaceInfoOn(nF1);
//
myDS->UpdateFaceInfoOn(nF2);
//
BOPDS_FaceInfo& aFI1 = myDS->ChangeFaceInfo(nF1);
BOPDS_FaceInfo& aFI2 = myDS->ChangeFaceInfo(nF2);
@@ -1876,7 +1837,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
BOPDS_IndexedMapOfPaveBlock& aMPBOn2 = aFI2.ChangePaveBlocksOn();
BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.ChangePaveBlocksIn();
//
// 2. Remove old pave blocks
// remove old pave blocks
const Handle(BOPDS_CommonBlock)& aCB1 = myDS->CommonBlock(aPBf);
bCB = !aCB1.IsNull();
BOPDS_ListOfPaveBlock aLPB1;
@@ -1902,9 +1863,8 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
}
}
//
// 3. Update pave blocks
if (bCB) {
//create new common blocks
//create new pave blocks
const BOPCol_ListOfInteger& aFaces = aCB1->Faces();
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
@@ -1931,66 +1891,55 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
aPB=aCB->PaveBlocks().First();
}
}
else {
nE = aPBf->OriginalEdge();
BOPDS_ListOfPaveBlock& aLPBE = myDS->ChangePaveBlocks(nE);
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
aPB = aIt.Value();
aLPBE.Append(aPB);
//
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB = aIt.ChangeValue();
nE = aPB->OriginalEdge();
//
Standard_Integer nF = (aMPBOn1.Contains(aPBf) ||
aMPBIn1.Contains(aPBf)) ? nF2 : nF1;
const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
IntTools_Range aShrR(aPB->Pave1().Parameter(),
aPB->Pave2().Parameter());
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
//
Standard_Boolean bCom =
BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
if (bCom) {
if (bCB) {
aCB = myDS->CommonBlock(aPB);
aCB->AddFace(nF);
} else {
aCB = new BOPDS_CommonBlock;
aCB->AddPaveBlock(aPB);
aCB->AddFace(nF1);
aCB->AddFace(nF2);
//
myDS->SetCommonBlock(aPB, aCB);
}
aMPB.Add(aPB);
}
if (!bCB) {
myDS->ChangePaveBlocks(nE).Append(aPB);
}
}
//
Standard_Integer i, aNbPB;
Standard_Boolean bIn1, bIn2;
//
bIn1 = aMPBOn1.Contains(aPBf) || aMPBIn1.Contains(aPBf);
bIn2 = aMPBOn2.Contains(aPBf) || aMPBIn2.Contains(aPBf);
//
if (bIn1 && bIn2) {
return;
}
//
// 4. Check new pave blocks for coincidence
// with the opposite face.
// In case of coincidence create common blocks
Standard_Integer nF;
Standard_Real aTolE, aTolF;
//
nF = bIn1 ? nF2 : nF1;
const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
BOPDS_IndexedMapOfPaveBlock& aMPBIn = bIn1 ? aMPBIn2 : aMPBIn1;
aTolF = BRep_Tool::Tolerance(aF);
//
aIt.Initialize(aLPB);
for (; aIt.More(); aIt.Next()) {
Handle(BOPDS_PaveBlock)& aPB = aIt.ChangeValue();
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
aTolE = BRep_Tool::Tolerance(aE);
aNbPB=aMPB.Extent();
for (i=1; i<=aNbPB; ++i) {
aPB = aMPB(i);
if (!bIn1) {
aMPBIn1.Add(aPB);
}
//
IntTools_EdgeFace anEF;
anEF.SetEdge(aE);
anEF.SetFace(aF);
anEF.SetTolE(aTolE);
anEF.SetTolF(aTolF);
anEF.SetRange(aPB->Pave1().Parameter(), aPB->Pave2().Parameter());
anEF.SetContext(myContext);
anEF.Perform();
//
const IntTools_SequenceOfCommonPrts& aCPrts=anEF.CommonParts();
if (aCPrts.Length() == 1) {
Standard_Boolean bCoinc = (aCPrts(1).Type() == TopAbs_EDGE);
if (bCoinc) {
if (bCB) {
aCB = myDS->CommonBlock(aPB);
} else {
aCB = new BOPDS_CommonBlock;
aCB->AddPaveBlock(aPB);
myDS->SetCommonBlock(aPB, aCB);
}
aCB->AddFace(nF);
//
aMPBIn.Add(aPB);
}
if (!bIn2) {
aMPBIn2.Add(aPB);
}
}
}

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,19 +133,3 @@ inline const BOPDS_MapOfPassKey& BOPDS_DS::Interferences()const
{
return myInterfTB;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
inline void BOPDS_DS::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = (theFuzz < 0.) ? 0. : 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,218 +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 = "BOPTest 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();
BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
//
TopTools_ListOfShape aLS;
ConvertList(aLSB, aLS);
ConvertList(aLTB, 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;
//
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;
@@ -64,7 +56,6 @@ static
Standard_Integer n,
const char** a,
const BOPAlgo_Operation aOp);
//
static
Standard_Integer bsmt (Draw_Interpretor& di,
Standard_Integer n,
@@ -86,6 +77,9 @@ static Standard_Integer bcommon (Draw_Interpretor&, Standard_Integer, const ch
//
static Standard_Integer bopcurves (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bopnews (Draw_Interpretor&, Standard_Integer, const char**);
//
static Standard_Integer bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
//
static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
@@ -98,48 +92,43 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
if (done) return;
done = Standard_True;
// Chapter's name
const char* g = "BOPTest commands";
const char* g = "BOP commands";
// Commands
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 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" , __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]",
theCommands.Add("bsection", "Use >bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na]",
__FILE__, bsection, g);
//
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d/-2d1/-2d2]",
__FILE__, bopcurves, g);
theCommands.Add("bopnews" , "use bopnews -v[e,f]" , __FILE__, bopnews, g);
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni]",
__FILE__, mkvolume , 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 ... [-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) {
di << " use bop s1 s2 \n";
return 0;
if (n!=3) {
di << " use bop Shape1 Shape2\n";
return 1;
}
//
aS1=DBRep::Get(a[1]);
@@ -147,12 +136,9 @@ Standard_Integer bop(Draw_Interpretor& di,
//
if (aS1.IsNull() || aS2.IsNull()) {
di << " null shapes are not allowed \n";
return 0;
return 1;
}
//
aTol=BOPTest_Objects::FuzzyValue();
bRunParallel=BOPTest_Objects::RunParallel();
//
aLC.Append(aS1);
aLC.Append(aS2);
//
@@ -164,8 +150,6 @@ Standard_Integer bop(Draw_Interpretor& di,
pPF=new BOPAlgo_PaveFiller(aAL);
//
pPF->SetArguments(aLC);
pPF->SetFuzzyValue(aTol);
pPF->SetRunParallel(bRunParallel);
//
pPF->Perform();
iErr=pPF->ErrorStatus();
@@ -181,9 +165,7 @@ Standard_Integer bop(Draw_Interpretor& di,
//function : bopcommon
//purpose :
//=======================================================================
Standard_Integer bopcommon (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer bopcommon (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bopsmt(di, n, a, BOPAlgo_COMMON);
}
@@ -191,9 +173,7 @@ Standard_Integer bopcommon (Draw_Interpretor& di,
//function : bopfuse
//purpose :
//=======================================================================
Standard_Integer bopfuse(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer bopfuse(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bopsmt(di, n, a, BOPAlgo_FUSE);
}
@@ -201,9 +181,7 @@ Standard_Integer bopfuse(Draw_Interpretor& di,
//function : bopcut
//purpose :
//=======================================================================
Standard_Integer bopcut(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer bopcut(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bopsmt(di, n, a, BOPAlgo_CUT);
}
@@ -211,9 +189,7 @@ Standard_Integer bopcut(Draw_Interpretor& di,
//function : boptuc
//purpose :
//=======================================================================
Standard_Integer boptuc(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer boptuc(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bopsmt(di, n, a, BOPAlgo_CUT21);
}
@@ -242,7 +218,6 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_BOP aBOP;
//
@@ -253,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();
@@ -262,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();
@@ -285,12 +257,10 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
//function : bopsection
//purpose :
//=======================================================================
Standard_Integer bopsection(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n<2) {
di << " use bopsection r\n";
di << " use bopsmt r\n";
return 0;
}
//
@@ -305,7 +275,6 @@ Standard_Integer bopsection(Draw_Interpretor& di,
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_Section aBOP;
//
@@ -317,14 +286,11 @@ Standard_Integer bopsection(Draw_Interpretor& di,
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();
@@ -347,9 +313,7 @@ Standard_Integer bopsection(Draw_Interpretor& di,
//function : bcommon
//purpose :
//=======================================================================
Standard_Integer bcommon (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer bcommon (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bsmt(di, n, a, BOPAlgo_COMMON);
}
@@ -357,9 +321,7 @@ Standard_Integer bcommon (Draw_Interpretor& di,
//function : bfuse
//purpose :
//=======================================================================
Standard_Integer bfuse (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer bfuse (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bsmt(di, n, a, BOPAlgo_FUSE);
}
@@ -367,9 +329,7 @@ Standard_Integer bfuse (Draw_Interpretor& di,
//function : bcut
//purpose :
//=======================================================================
Standard_Integer bcut (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer bcut (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bsmt(di, n, a, BOPAlgo_CUT);
}
@@ -377,9 +337,7 @@ Standard_Integer bcut (Draw_Interpretor& di,
//function : btuc
//purpose :
//=======================================================================
Standard_Integer btuc (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer btuc (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
return bsmt(di, n, a, BOPAlgo_CUT21);
}
@@ -391,71 +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]\n";
if (n < 4) {
di << "use bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
return 0;
di << usage;
return 1;
}
//
TopoDS_Shape aS1, aS2;
//
aS1=DBRep::Get(a[2]);
aS2=DBRep::Get(a[3]);
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;
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 if (!strcmp(a[i], "-n2d1")) {
bPC1 = Standard_False;
else {
if (!strcasecmp(key1,"-na")) {
bApp = Standard_False;
}
else {
isbadparameter = Standard_True;
}
}
else if (!strcmp(a[i], "-n2d2")) {
bPC2 = Standard_False;
if (key2) {
if(!strcasecmp(key2,"-na")) {
bApp = Standard_False;
}
else {
isbadparameter = Standard_True;
}
}
else if (!strcmp(a[i], "-na")) {
bApp = Standard_False;
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
@@ -467,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) {
if (n!=4) {
di << " use bx r s1 s2\n";
return 0;
return 1;
}
//
aS1=DBRep::Get(a[2]);
@@ -483,22 +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();
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();
@@ -508,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 :
@@ -604,6 +590,7 @@ Standard_Integer bopnews (Draw_Interpretor& di,
//
return 0;
}
//=======================================================================
//function : bopcurves
//purpose :
@@ -613,19 +600,19 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
const char** a)
{
if (n<3) {
di << " use bopcurves F1 F2 [-2d/-2d1/-2d2]\n";
di << " use bopcurves F1 F2 [-2d]\n";
return 1;
}
//
TopoDS_Shape S1 = DBRep::Get(a[1]);
TopoDS_Shape S2 = DBRep::Get(a[2]);
TopAbs_ShapeEnum aType;
//
if (S1.IsNull() || S2.IsNull()) {
di << " Null shapes is not allowed \n";
return 1;
}
//
aType=S1.ShapeType();
if (aType != TopAbs_FACE) {
di << " Type mismatch F1\n";
@@ -636,52 +623,48 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
di << " Type mismatch F2\n";
return 1;
}
//
const TopoDS_Face& aF1=*(TopoDS_Face*)(&S1);
const TopoDS_Face& aF2=*(TopoDS_Face*)(&S2);
//
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone;
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone, bMake2dCurves;
Standard_Integer i, aNbCurves;
Standard_Real anAppTol, aTolR;
TCollection_AsciiString aNm("c_");
//
anAppTol = 0.0000001;
aToApproxC3d = Standard_True;
aToApproxC2dOnS1 = Standard_False;
aToApproxC2dOnS2 = Standard_False;
//
bMake2dCurves = Standard_False;
if (n > 3) {
if (!strcasecmp(a[3],"-2d")) {
aToApproxC2dOnS1 = Standard_True;
aToApproxC2dOnS2 = Standard_True;
}
else if (!strcasecmp(a[3],"-2d1")) {
aToApproxC2dOnS1 = Standard_True;
}
else if (!strcasecmp(a[3],"-2d2")) {
aToApproxC2dOnS2 = Standard_True;
}
else {
di << "Wrong key. To build 2d curves use: bopcurves F1 F2 -2d/-2d1/-2d2 \n";
bMake2dCurves = Standard_True;
} else {
di << "Wrong key. To build 2d curves use: bopcurves F1 F2 -2d \n";
return 1;
}
}
//
aToApproxC3d = Standard_True;
aToApproxC2dOnS1 = bMake2dCurves;
aToApproxC2dOnS2 = bMake2dCurves;
anAppTol=0.0000001;
IntTools_FaceFace aFF;
//
aFF.SetParameters (aToApproxC3d,
aToApproxC2dOnS1,
aToApproxC2dOnS2,
anAppTol);
//
aFF.Perform (aF1, aF2);
//
anIsDone=aFF.IsDone();
if (!anIsDone) {
di << " anIsDone=" << (Standard_Integer) anIsDone << "\n";
return 1;
}
//
aFF.PrepareLines3D(Standard_False);
const IntTools_SequenceOfCurves& aSCs=aFF.Lines();
@@ -717,114 +700,144 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
DrawTrSurf::Set(nameC, aC3D);
di << nameC << " ";
//
Handle(Geom2d_Curve) aPC1 = anIC.FirstCurve2d();
Handle(Geom2d_Curve) aPC2 = anIC.SecondCurve2d();
//
if (!aPC1.IsNull() || !aPC2.IsNull()) {
di << "(";
if (bMake2dCurves) {
Handle(Geom2d_Curve) aPC1 = anIC.FirstCurve2d();
Handle(Geom2d_Curve) aPC2 = anIC.SecondCurve2d();
//
if (!aPC1.IsNull()) {
TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
pc1Nx = pc1N + anIndx;
Standard_CString nameC2d1 = pc1Nx.ToCString();
//
DrawTrSurf::Set(nameC2d1, aPC1);
di << nameC2d1;
if (aPC1.IsNull() && aPC2.IsNull()) {
di << " \n has Null 2d curves# " << i << "\n";
continue;
}
//
if (!aPC2.IsNull()) {
if (aPC1.IsNull()) {
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
pc2Nx = pc2N + anIndx;
Standard_CString nameC2d2 = pc2Nx.ToCString();
//
DrawTrSurf::Set(nameC2d2, aPC2);
di << "(" << nameC2d2 << ") ";
di << " \n Null first 2d curve of the curve #" << i << "\n";
continue;
} else {
TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
pc1Nx = pc1N + anIndx;
Standard_CString nameC2d1 = pc1Nx.ToCString();
//
if (!aPC1.IsNull()) {
di << ", ";
}
di << nameC2d2;
DrawTrSurf::Set(nameC2d1, aPC1);
di << "(" << nameC2d1;
}
//
if (aPC2.IsNull()) {
di << ") \n Null second 2d curve of the curve #" << i << "\n";
continue;
} else {
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
pc2Nx = pc2N + anIndx;
Standard_CString nameC2d2 = pc2Nx.ToCString();
//
DrawTrSurf::Set(nameC2d2, aPC2);
di << ", " << nameC2d2 << ") ";
}
di << ") ";
}
}
//
di << "\n";
return 0;
}
//=======================================================================
//function : bparallelmode
//purpose :
//=======================================================================
Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n == 2)
{
Standard_Boolean isParallelOn = Draw::Atoi (a[1]) == 1;
if (isParallelOn == 1)
{
BOPAlgo_Algo::SetParallelMode(Standard_True);
di << "Parallel mode for boolean operations has been enabled";
}
else
{
BOPAlgo_Algo::SetParallelMode(Standard_False);
di << "Parallel mode for boolean operations has been disabled";
}
}
else
{
di << "Parallel mode state for boolean operations: "
<< (BOPAlgo_Algo::GetParallelMode()? "enabled" : "disabled");
}
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: mkvolume r b1 b2 ... [-c] [-ni]\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";
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();
bRunParallel = BOPTest_Objects::RunParallel();
//
bToIntersect = Standard_True;
bCompounds = Standard_False;
//
for (i = 2; i < n; ++i) {
aS = DBRep::Get(a[i]);
if (!aS.IsNull()) {
aLS.Append(aS);
}
else {
if (!strcmp(a[i], "-c")) {
bCompounds = Standard_True;
}
else if (!strcmp(a[i], "-ni")) {
bToIntersect = Standard_False;
}
}
}
//
if (aLS.IsEmpty()) {
di << "No shapes to process.\n";
di << usage;
return 1;
}
//
// treat list of arguments for the case of compounds
if (bToIntersect && bCompounds) {
BOPCol_ListOfShape aLSx;
BOPCol_ListIteratorOfListOfShape aItLS;
//
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSx = aItLS.Value();
TopoDS_Iterator aItS(aSx);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSxS = aItS.Value();
aLSx.Append(aSxS);
}
Standard_Boolean bToIntersect, bRunParallel;
Standard_Integer i, aNb;
//
aNb = n;
bToIntersect = Standard_True;
bRunParallel = Standard_True;
//
if (!strcmp(a[n-1], "-ni")) {
bToIntersect = Standard_False;
aNb = n-1;
}
else if (!strcmp(a[n-1], "-s")) {
bRunParallel = Standard_False;
aNb = n-1;
}
if (n > 3) {
if (!strcmp(a[n-2], "-ni")) {
bToIntersect = Standard_False;
aNb = n-2;
}
else if (!strcmp(a[n-2], "-s")) {
bRunParallel = Standard_False;
aNb = n-2;
}
//
aLS.Clear();
aLS.Assign(aLSx);
}
//
if (aNb < 3) {
di << "no shapes to process.\n";
di << usage;
return 1;
}
//
BOPCol_ListOfShape aLS;
TopoDS_Shape aS;
for (i = 2; i < aNb; ++i) {
aS = DBRep::Get(a[i]);
if (!aS.IsNull()) {
aLS.Append(aS);
}
}
//
if (aLS.IsEmpty()) {
di << "no shapes to process.\n";
di << usage;
return 1;
}
//
BOPAlgo_MakerVolume aMV;
aMV.SetArguments(aLS);
aMV.SetIntersect(bToIntersect);
aMV.SetRunParallel(bRunParallel);
aMV.SetFuzzyValue(aTol);
//
aMV.Perform();
if (aMV.ErrorStatus()) {
@@ -838,3 +851,4 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
//
return 0;
}

View File

@@ -45,8 +45,6 @@
#include <BOPTools_AlgoTools.hxx>
#include <BOPTest_Chronometer.hxx>
#include <BOPTest_Objects.hxx>
//
static
void MakeShapeForFullOutput (const TCollection_AsciiString&,
@@ -75,19 +73,19 @@ void BOPTest::CheckCommands(Draw_Interpretor& theCommands)
done = Standard_True;
// Chapter's name
const char* g = "BOPTest commands";
const char* g = "CCR commands";
//
theCommands.Add("bopcheck",
"use bopcheck Shape [level of check: 0 - 9] [-t]",
"Use >bopcheck Shape [level of check: 0(V/V) - 5(all)]",
__FILE__, bopcheck, g);
theCommands.Add("bopargcheck" ,
"use bopargcheck without parameters to get ",
"Use bopargcheck without parameters to get ",
__FILE__, bopargcheck, g);
theCommands.Add ("xdistef" ,
"use xdistef edge face",
"Use xdistef edge face",
__FILE__, xdistef, g);
theCommands.Add("checkcurveonsurf",
"use checkcurveonsurf shape",
"checkcurveonsurf shape",
__FILE__, checkcurveonsurf, g);
}
//=======================================================================
@@ -154,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]\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";
@@ -179,16 +177,13 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
//
Standard_Boolean bRunParallel, bShowTime;
Standard_Integer i, aLevel, aNbInterfTypes;
Standard_Real aTol;
//
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) {
@@ -197,11 +192,12 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
}
//
bShowTime=Standard_False;
aTol=BOPTest_Objects::FuzzyValue();
bRunParallel=BOPTest_Objects::RunParallel();
//
for (i=2; i<n; ++i) {
if (!strcmp(a[i], "-t")) {
bRunParallel=Standard_True;
for (i=3; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
}
else if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
}
@@ -218,7 +214,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
BOPAlgo_CheckerSI aChecker;
BOPCol_ListOfShape aLS;
BOPDS_MapIteratorMapOfPassKey aItMPK;
BOPTest_Chronometer aChrono;
BOPTime_Chronometer aChrono;
//
if (aLevel < (aNbInterfTypes-1)) {
di << "Info:\nThe level of check is set to "
@@ -237,7 +233,6 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
aChecker.SetArguments(aLS);
aChecker.SetLevelOfCheck(aLevel);
aChecker.SetRunParallel(bRunParallel);
aChecker.SetFuzzyValue(aTol);
//
aChrono.Start();
//
@@ -336,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]\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";
@@ -390,22 +385,23 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
Standard_Integer indxAD = 0;
Standard_Boolean isS2 = Standard_False;
Standard_Integer indxS2 = 0;
Standard_Real aTolerance = 0;
aTolerance=BOPTest_Objects::FuzzyValue();
if(n >= 3) {
Standard_Integer iIndex = 0;
for(iIndex = 2; iIndex < n; iIndex++) {
if(a[iIndex][0] == '-') {
if(a[iIndex][0] == '-')
{
isBO = Standard_True;
indxBO = iIndex;
}
else if(a[iIndex][0] == '/') {
//else if(a[iIndex][0] == '+')
else if(a[iIndex][0] == '/')
{
isOP = Standard_True;
indxOP = iIndex;
}
else if(a[iIndex][0] == '#') {
else if(a[iIndex][0] == '#')
{
isAD = Standard_True;
indxAD = iIndex;
}
@@ -415,7 +411,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
}
}
}
// set & test second shape
TopoDS_Shape aS22, aS2;
if(isS2) {
@@ -433,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
@@ -734,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";
@@ -750,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";
@@ -766,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";
@@ -776,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";
@@ -786,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";
@@ -796,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";
@@ -807,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";
@@ -824,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";
@@ -841,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";
@@ -857,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";
@@ -867,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";
@@ -877,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";
@@ -887,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";
@@ -898,17 +893,17 @@ 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";
else
di << "\n";
}
// warning
if(hasUnknown) {
// warning
di << "\n";
di << "WARNING: The unexpected test break occurs!" << "\n";
if(hasUnknown)
di << "WARNING: The unexpected test break occurs!" << "\n";
}
} // full output
} // has faulties
@@ -924,8 +919,8 @@ Standard_Integer xdistef(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if(n < 3) {
di << "use xdistef edge face\n";
if(n < 3) {
di << "Use efmaxdist edge face\n";
return 1;
}
//
@@ -980,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;
@@ -1007,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

@@ -15,17 +15,49 @@
#ifndef BOPTest_Chronometer_HeaderFile
#define BOPTest_Chronometer_HeaderFile
//
#include <OSD_Chronometer.hxx>
#ifdef HAVE_TBB
#include <BOPCol_TBB.hxx>
//=======================================================================
//class : BOPTest_Chronometer
//class : BOPTime_Chronometer
//purpose :
//=======================================================================
class BOPTest_Chronometer {
class BOPTime_Chronometer {
public:
BOPTest_Chronometer() {
BOPTime_Chronometer() {
}
//
~BOPTest_Chronometer() {
~BOPTime_Chronometer() {
}
//
void Start() {
myT0 = tick_count::now();
}
//
void Stop() {
myTime=(tick_count::now() - myT0).seconds();
}
//
double Time() const{
return myTime;
};
//
protected:
tick_count myT0;
double myTime;
};
////////////////////////////////////////////////////////////////////////
#else
#include <OSD_Chronometer.hxx>
//=======================================================================
//class : BOPTime_Chronometer
//purpose :
//=======================================================================
class BOPTime_Chronometer {
public:
BOPTime_Chronometer() {
}
//
~BOPTime_Chronometer() {
}
//
void Start() {
@@ -46,5 +78,6 @@ class BOPTest_Chronometer {
OSD_Chronometer myChronometer;
double myTime;
};
#endif
//
#endif

View File

@@ -13,8 +13,7 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class DrawableShape from BOPTest
inherits DrawableShape from DBRep
class DrawableShape from BOPTest inherits DrawableShape from DBRep
---Purpose:
@@ -29,31 +28,33 @@ uses
Pnt from gp
is
Create (S : Shape from TopoDS;
FreeCol : Color from Draw; -- color for free edges
ConnCol : Color from Draw; -- color for shared edges
EdgeCol : Color from Draw; -- color for other edges
IsosCol : Color from Draw; -- color for Isos
size : Real; -- size for infinite isos
nbisos : Integer; -- # of isos on each face
discret : Integer; -- # of points on curves
Text : CString from Standard;
TextColor : Color from Draw)
returns DrawableShape from BOPTest;
Create (S : Shape from TopoDS;
Text : CString from Standard;
TextColor : Color from Draw)
returns DrawableShape from BOPTest;
Pnt(me)
returns Pnt from gp
is private;
FreeCol : Color from Draw; -- color for free edges
ConnCol : Color from Draw; -- color for shared edges
EdgeCol : Color from Draw; -- color for other edges
IsosCol : Color from Draw; -- color for Isos
size : Real; -- size for infinite isos
nbisos : Integer; -- # of isos on each face
discret : Integer; -- # of points on curves
Text : CString from Standard;
TextColor : Color from Draw
)
returns DrawableShape from BOPTest;
Create (S : Shape from TopoDS;
Text : CString from Standard;
TextColor : Color from Draw
)
returns DrawableShape from BOPTest;
Pnt(me) returns Pnt from gp is private;
DrawOn(me; dis : in out Display from Draw)
is redefined;
is redefined;
fields
myText : Text3D from Draw;
myTextColor : Color from Draw;

View File

@@ -56,40 +56,40 @@
//function :
//purpose :
//=======================================================================
BOPTest_DrawableShape::BOPTest_DrawableShape
(const TopoDS_Shape& aShape,
const Draw_Color& FreeCol,
const Draw_Color& ConnCol,
const Draw_Color& EdgeCol,
const Draw_Color& IsosCol,
const Standard_Real size,
const Standard_Integer nbisos,
const Standard_Integer discret,
const Standard_CString Text,
const Draw_Color& TextColor)
BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
const Draw_Color& FreeCol,
const Draw_Color& ConnCol,
const Draw_Color& EdgeCol,
const Draw_Color& IsosCol,
const Standard_Real size,
const Standard_Integer nbisos,
const Standard_Integer discret,
const Standard_CString Text,
const Draw_Color& TextColor)
:
DBRep_DrawableShape(aShape,FreeCol,ConnCol,
EdgeCol,IsosCol,size,nbisos,discret)
DBRep_DrawableShape(aShape,FreeCol,ConnCol,EdgeCol,IsosCol,size,nbisos,discret)
{
myText = new Draw_Text3D(Pnt(),Text,TextColor);
myTextColor = TextColor;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPTest_DrawableShape::BOPTest_DrawableShape
(const TopoDS_Shape& aShape,
const Standard_CString Text,
const Draw_Color& TextColor)
: DBRep_DrawableShape(aShape,
Draw_vert,
Draw_jaune,
Draw_rouge,
Draw_bleu,
100., //size
2, //nbIsos
30) //discret
BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
const Standard_CString Text,
const Draw_Color& TextColor)
: DBRep_DrawableShape(
aShape,
Draw_vert,
Draw_jaune,
Draw_rouge,
Draw_bleu,
100., //size
2, //nbIsos
30 //discret
)
{
myText = new Draw_Text3D(Pnt(),Text,TextColor);
myTextColor = TextColor;
@@ -99,16 +99,16 @@ BOPTest_DrawableShape::BOPTest_DrawableShape
//function : Pnt
//purpose :
//=======================================================================
gp_Pnt BOPTest_DrawableShape::Pnt() const
gp_Pnt BOPTest_DrawableShape::Pnt() const
{
gp_Pnt P(0,0,0);
Standard_Real u, v, u1, u2, v1, v2, p;
TopExp_Explorer ex;
TopoDS_Shape S = Shape();
TopAbs_ShapeEnum T = S.ShapeType();
Standard_Real facpar = 0.;
while ( T == TopAbs_COMPOUND ) {
TopoDS_Iterator ti(S);
if ( ti.More() ) {
@@ -121,70 +121,77 @@ gp_Pnt BOPTest_DrawableShape::Pnt() const
}
// si S final = compound --> P = 0 0 0
switch (T) {
case TopAbs_VERTEX :
P = BRep_Tool::Pnt(TopoDS::Vertex(S));
break;
case TopAbs_EDGE : {
BRepAdaptor_Curve CU(TopoDS::Edge(S));
u1 = CU.FirstParameter();
u2 = CU.LastParameter();
if (facpar == 0.) facpar = 0.20;
p = u1 + (u2-u1)*facpar;
P = CU.Value(p);
}
break;
case TopAbs_WIRE : {
TopTools_IndexedMapOfShape aME;
TopExp::MapShapes(S, TopAbs_EDGE, aME);
const TopoDS_Edge& anEdge=TopoDS::Edge(aME(1));
BRepAdaptor_Curve CU(anEdge);
u1 = CU.FirstParameter();
u2 = CU.LastParameter();
if (facpar == 0.) facpar = 0.40;
p = u1 + (u2-u1)*facpar;
P = CU.Value(p);
}
break;
case TopAbs_FACE : {
BRepAdaptor_Surface SU(TopoDS::Face(S));
BRepTools::UVBounds(TopoDS::Face(S),u1,u2,v1,v2);
//
facpar = .2;
u = u1 + (u2-u1)*facpar;
v = v1 + (v2-v1)*facpar;
P = SU.Value(u,v);
}
break;
case TopAbs_SHELL :
case TopAbs_SOLID : {
TopTools_IndexedMapOfShape aMF;
TopExp::MapShapes(S, TopAbs_FACE, aMF);
const TopoDS_Face& aF=TopoDS::Face(aMF(1));
BRepAdaptor_Surface SU(TopoDS::Face(aF));
BRepTools::UVBounds(aF,u1,u2,v1,v2);
facpar = .4;
u = u1 + (u2-u1)*facpar;
v = v1 + (v2-v1)*facpar;
P = SU.Value(u,v);
}
break;
default:
break;
}
switch (T)
{
case TopAbs_VERTEX :
P = BRep_Tool::Pnt(TopoDS::Vertex(S));
break;
case TopAbs_EDGE :
{
BRepAdaptor_Curve CU(TopoDS::Edge(S));
u1 = CU.FirstParameter();
u2 = CU.LastParameter();
if (facpar == 0.) facpar = 0.20;
p = u1 + (u2-u1)*facpar;
P = CU.Value(p);
}
break;
case TopAbs_WIRE :
{
TopTools_IndexedMapOfShape aME;
TopExp::MapShapes(S, TopAbs_EDGE, aME);
const TopoDS_Edge& anEdge=TopoDS::Edge(aME(1));
BRepAdaptor_Curve CU(anEdge);
u1 = CU.FirstParameter();
u2 = CU.LastParameter();
if (facpar == 0.) facpar = 0.40;
p = u1 + (u2-u1)*facpar;
P = CU.Value(p);
}
break;
case TopAbs_FACE :
{
BRepAdaptor_Surface SU(TopoDS::Face(S));
BRepTools::UVBounds(TopoDS::Face(S),u1,u2,v1,v2);
//
facpar = .2;
u = u1 + (u2-u1)*facpar;
v = v1 + (v2-v1)*facpar;
P = SU.Value(u,v);
}
break;
case TopAbs_SHELL :
case TopAbs_SOLID :
{
TopTools_IndexedMapOfShape aMF;
TopExp::MapShapes(S, TopAbs_FACE, aMF);
const TopoDS_Face& aF=TopoDS::Face(aMF(1));
BRepAdaptor_Surface SU(TopoDS::Face(aF));
BRepTools::UVBounds(aF,u1,u2,v1,v2);
facpar = .4;
u = u1 + (u2-u1)*facpar;
v = v1 + (v2-v1)*facpar;
P = SU.Value(u,v);
}
break;
default:
break;
}
return P;
}
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
void BOPTest_DrawableShape::DrawOn(Draw_Display& dis) const
void BOPTest_DrawableShape::DrawOn(Draw_Display& dis) const
{
DBRep_DrawableShape::DrawOn(dis);
myText->SetPnt(Pnt());

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