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

Compare commits

..

24 Commits

Author SHA1 Message Date
nbv
e07a610c22 Resolution computing as the length of isoline segment 2015-01-16 10:50:45 +03:00
nbv
a8f7adb4d4 Algorithm of check, if wire is closed in 2D-space, was changed. 2014-12-29 12:42:19 +03:00
nbv
1621454f40 Variables names were changed according to their meaning. 2014-12-29 12:42:18 +03:00
nbv
1dc7891a20 0025583: Wrong solid is considered as valid by checkshape
Limitation tolerance value for checking if wire is closed in 2D-space of its face.

Some test cases were updated according to their new behavior.
2014-12-29 12:42:17 +03:00
mkv
4cf9a9f0ea Cosmetic update testing cases. 2014-12-26 13:03:40 +03:00
abv
92ac0eb708 0025570: New Tcl sample scripts created for CAD Assistant
Three new sample scripts created during development of CAD Assistant for Android added in samples/tcl:

- Penrose.tcl: creation of Penrose triangle made of boxes resembling ones from OCC logo
- pencil.tcl: creation of colored pencil model
- snowflake.tcl: creation of 2d drawing of snowflake
2014-12-26 12:26:10 +03:00
msv
ee6bb37b7f 0025545: TopLoc_Location::Transformation() provokes data races
Get rid of postponed calculation of transformation.
Remove unused methods.
Add command OCC25545 to reproduce the bug with data races.

- Get rid of C++11 lambda construction
- make code compilable with no HAVE_TBB defined
- add test case bugs/fclasses/bug25545
2014-12-25 18:32:22 +03:00
dbp
312a4043c2 0025351: Visualization - provide pseudo random number generator in OCCT ray-tracing core 2014-12-25 18:24:26 +03:00
vpa
51023771f9 0025627: SelectedShape() and HasSelectedShape() of AIS_InteractiveContext class do not work as expected.
Location calculation in SelectedShape() was corrected;
Method HasSelectedShape() that does not take into account shape decomposition was added.

Test case for issue 25627
2014-12-25 18:22:21 +03:00
ibs
bbe97eddea 0025651: GL_LUMINANCE8 should be defined for android case
GL_LUMINANCE8 defined
2014-12-25 18:20:32 +03:00
oan
f43eff9ffe 0025612: Introduce possibility to disable adaptive reconfigutation of triangles in BRepMesh
Remarks from PDN: flag has been renamed to ControlSurfaceDeflection

Test-case for issue #25612
2014-12-25 18:19:02 +03:00
aml
fe79003598 0025489: GCPnts_TangentialDeflection gives incorrect distribution of points
Fixed last point handling: now we try to check interval with last point instead of adding it to output set of points.

Test case for issue CR25489

Correction of test case for issue CR25489
2014-12-25 18:12:23 +03:00
emv
b9f6147d75 0025600: Wrong result of Boolean FUSE operation
class BOPTools_AlgoTools
1. method 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)
Use different method of finding a point in the face if the start and projected points are close to each other.

2. method Standard_Real MinStep3D(const TopoDS_Edge& theE1,
                        const TopoDS_Face& theF1,
                        const BOPTools_ListOfCoupleOfShape& theLCS,
                        const gp_Pnt& aP)
The min 3D step has been increased for the spherical faces.

Test case for issue CR25600

Correction of test case for issue CR25600
2014-12-25 18:09:43 +03:00
nbv
7c32c7c41f 0025531: Difference in intersection result on Windows and Linux platform is very significant
1. Dump of WLine is shown with more precise.
2. Equation solving with more precise.
3. Dump of Multy-line.
4. Code optimization.

Some test cases were updated in accordance with their new behaviour.

Correction of test cases for issue CR25531
2014-12-25 18:06:15 +03:00
emv
ee5ee7db3b 0025625: Boolean COMMON cannot be built
class BOPTools_AlgoTools2D
method void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
                                   const TopoDS_Face& aF,
                                   Handle(Geom2d_Curve)& aC2D,
                                   Standard_Real& aFirst,
                                   Standard_Real& aLast,
                                   Standard_Real& aToler)

Perform projection with the tolerance of the edge.

Test case for issue CR25625
2014-12-25 18:01:31 +03:00
azv
8ac0cf5265 0024411: SplitShape produces shape with incorrectly parameterized periodic 3D curve
Implemented additional flag into Geom_TrimmedCurve to adjust or not the periodic curve inside the first period.

API of Geom2d_TrimmedCurve is changed according to Geom_TrimmedCurve.

Test-case for issue #24411
2014-12-25 17:58:45 +03:00
pkv
49b0c452e2 0025614: Provide API access to the new fuctionalities of Boolean Components
I. New features:
1.1. class BOPAlgo_PaveFiller
method:
void BOPAlgo_PaveFiller::SetArguments(const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts  through
TopTools_ListOfShape

1.2. class BOPAlgo_Builder
method:
void BOPAlgo_Builder::SetArguments(const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts  through
TopTools_ListOfShape

1.3. class BOPAlgo_BOP
method:
void BOPAlgo_BOP::SetTools(const TopTools_ListOfShape& theLS)
has been added to provide the setting tools through
TopTools_ListOfShape

1.4. class BRepAlgoAPI_BuilderAlgo
construcror:
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
  (const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

method:
void BRepAlgoAPI_BuilderAlgo::SetArguments
 (const TopTools_ListOfShape& theLS)
has been added to provide the setting argumemts

method:
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
has been added to provide access to the argumemts

1.5. class BRepAlgoAPI_BooleanOperation
method:
void BRepAlgoAPI_BooleanOperation::SetTools
  (const TopTools_ListOfShape& theLS)
has been added to provide the setting tools

method:
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
has been added to provide access to the tools

1.6. class BRepAlgoAPI_Common
construcror:
BRepAlgoAPI_Common::BRepAlgoAPI_Common
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.7. class BRepAlgoAPI_Cut
construcror:
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.8. class BRepAlgoAPI_Fuse
construcror:
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.9. class BRepAlgoAPI_Section
construcror:
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const BOPAlgo_PaveFiller& aPF)
has been added to provide the construction
of the object using BOPAlgo_PaveFiller object

1.10. class BOPTest
method:
void BOPTest::APICommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to launch the algorithms
implemented in BRepAlgoAPI package using DRAWEXE application.

Commands:
 >bapibuild r
   performs General Fuse algorithm.
     r -the result of the operation

 >bapibop r type
   performs Boolean Operation agorithm
      r -the result of the operation
      type -type of the operation:
        0-common
        1-fuse
        2-cut
        3-cut21
        4-section

method:
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to set/get the options that is
necessary for the algorithms implemented in BRepAlgoAPI package.

Commands:
 >boptions
   dump the state of current options

  >brunparallel [0/1]
   1 -sets the parallel mode of the computations
   0 -sets the sequential mode of the computations

  >bfuzzyvalue value
    sets the fuzzy value

-------------------------------------------------------------------------------------------------------------
II. Changes:
II.1. class BRepAlgoAPI_BuilderAlgo
methods:
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
  (const TopoDS_Shape& aS)
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
  (const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
  (const TopoDS_Shape& aS)
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
has been redefined to provide access to the history

II.1. class BOPTest
method:
void BOPTest::APICommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to launch the algorithms
implemented in BRepAlgoAPI package using DRAWEXE application.

method:
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
has been added to provide tcl commands to set/get the options that is
necessary for the algorithms implemented in BRepAlgoAPI package.

II.2. class BRepAlgoAPI
method:
void BRepAlgoAPI::DumpOper(const Standard_CString theFilePath,
                           const TopoDS_Shape& theShape1,
                           const TopoDS_Shape& theShape2,
                           const TopoDS_Shape& theResult,
                           BOPAlgo_Operation theOperation,
                           Standard_Boolean isNonValidArgs)
has been removed. The contents has been shifted into the file:
BRepAlgoAPI_BooleanOperation.cxx

II.3. classes QANewModTopOpe_Glue, QANewModTopOpe_Intersection
the modifications have been done to provide the consistency with the
modifications in BRepAlgoAPI package [I].
-------------------------------------------------------------------------------------------------------------
III. Modified entities:
packages:
BOPAlgo
BRepAlgoAPI
BOPTest
QANewModTopOpe

Test cases for issue CR25614
2014-12-25 17:55:50 +03:00
azv
6219c44ce7 0025584: Wrong result obtained by PerformInfinitePoint Test
Implemented additional verification of periodicity of B-spline surfaces when calculating UV-bounds

Test case for issue CR25584
2014-12-25 17:53:21 +03:00
jgv
73d0a668b3 0025592: Bad result of Fillet operation
Comments have been added.

Test case for issue CR25592
2014-12-25 16:48:05 +03:00
azv
b7d2387022 0025591: Command mkshell produces wrong shell
The functionality to decide, whether the edge is degenerated, was shared via BRepLib_MakeFace. The verification of producing degenerated edges was added to BRepLib_MakeShell.

Test case for issue CR25591
2014-12-25 16:44:20 +03:00
kgv
656ec77a10 0025608: TKernel, NCollection_UtfIterator - fix iteration of surrogate pairs in UTF-16 2014-12-25 16:39:05 +03:00
nbv
2283570591 0025275: Diferent result of reading operation from *.igs and *.stp file for WINDOWS and LINUX platform
Symbol SUB (ASCII-code 0x1A) should be considered as End-Of-File both on WINDOWS and LINUX (and on other) system.
2014-12-25 16:36:41 +03:00
kgv
032c140ff1 0025580: Visualization, TKOpenGl - create GLushort index buffer in OpenGl_Quadric::createArrays() when sufficient 2014-12-25 16:29:46 +03:00
eap
7c8996f49f 0025604: To provide info on what has been done by DropSmallSolids operator 2014-12-25 16:27:27 +03:00
191 changed files with 6505 additions and 4914 deletions

85
samples/tcl/Penrose.tcl Normal file
View File

@@ -0,0 +1,85 @@
# 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

64
samples/tcl/pencil.tcl Normal file
View File

@@ -0,0 +1,64 @@
# 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

130
samples/tcl/snowflake.tcl Normal file
View File

@@ -0,0 +1,130 @@
# 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

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

View File

@@ -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
@@ -269,6 +268,15 @@ is
-- inWhichLocal gives the local context in which anIObj
-- is displayed. By default, the index -1 refers to the last
-- Local Context opened.
Clear(me : mutable;
aniobj : InteractiveObject from AIS;
updateviewer : Boolean from Standard = Standard_True);
---Purpose: Removes the interactive object aniobj from all viewers.
-- If a local context is open and if updateviewer equals
-- Standard_False, the presentation of the Interactive
-- Object activates the selection mode; the object is
-- displayed but no viewer will be updated.
ClearPrs( me :mutable;
aniobj : InteractiveObject from AIS;
@@ -2031,19 +2039,6 @@ is
---Purpose: returns if possible,
-- the first local context where the object is seen
SetViewAffinity (me : mutable;
theIObj : InteractiveObject from AIS;
theView : View from V3d;
theIsVisible : Boolean from Standard) is static;
---Purpose: setup object visibility in specified view,
-- has no effect if object is not disaplyed in this context.
ObjectsForView (me;
theListOfIO : in out ListOfInteractive from AIS;
theView : View from V3d;
theIsVisibleInView : Boolean from Standard;
theStatus : DisplayStatus from AIS = AIS_DS_None) is static;
---Purpose: Query objects visible or hidden in specified view due to affinity mask.
InitAttributes(me:mutable) is static private;
@@ -2051,16 +2046,6 @@ is
PurgeViewer(me:mutable;Vwr:Viewer from V3d)
returns Integer from Standard is static private;
redisplayPrsModes (me : mutable;
theIObj : InteractiveObject from AIS;
theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
---Purpose: UNKNOWN
redisplayPrsRecModes (me : mutable;
theIObj : InteractiveObject from AIS;
theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
---Purpose: UNKNOWN
fields
myObjects : DataMapOfIOStatus from AIS;

File diff suppressed because it is too large Load Diff

View File

@@ -43,7 +43,6 @@
#include <V3d_SpotLight.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_AmbientLight.hxx>
#include <Visual3d_View.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <SelectMgr_Selection.hxx>
@@ -85,7 +84,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
Standard_Boolean toUpdateViewer = Standard_False;
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
// allonzy
myMainSel->Pick (theXPix, theYPix, theView);
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
@@ -1047,9 +1046,7 @@ Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
#endif
return Standard_False;
}
return myLocalContexts(myCurLocalIndex)->HasShape();
return myLocalContexts(myCurLocalIndex)->HasSelectedShape();
}
//=======================================================================
@@ -1065,7 +1062,9 @@ TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (SelectedInteractive());
if (!aShape.IsNull())
{
aResShape = aShape->Shape().Located (TopLoc_Location (SelectedInteractive()->Transformation()) * aShape->Shape().Location());
TopLoc_Location aLocTrsf = SelectedInteractive()->Transformation().Form() == gp_Identity ?
TopLoc_Location() : TopLoc_Location (SelectedInteractive()->Transformation());
aResShape = aShape->Shape().Located (aLocTrsf * aShape->Shape().Location());
}
return aResShape;
@@ -1089,6 +1088,8 @@ 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,6 +388,11 @@ is
HasShape(me) returns Boolean from Standard;
---Purpose: returns TRUE if the detected entity is a shape
-- coming from a Decomposition of an element.
HasSelectedShape(me) returns Boolean from Standard;
---Purpose: returns true if current selection is not empty
-- and the owner of selected object contains a shape.
-- This method does not take into account decomposition
-- status of detected shape.
SelectedShape(me) returns Shape from TopoDS;
SelectedOwner(me) returns EntityOwner from SelectMgr;

View File

@@ -87,7 +87,6 @@
#include <SelectBasics_SensitiveEntity.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Map.hxx>
#include <Visual3d_View.hxx>
#ifdef OCC9026
#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
@@ -129,7 +128,6 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
myCurDetected = 0;
myDetectedSeq.Clear();
myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
myMainVS->Pick (theXpix, theYpix, theView);
const Standard_Integer aDetectedNb = myMainVS->NbPicked();
@@ -774,6 +772,28 @@ 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 :
@@ -787,6 +807,7 @@ TopoDS_Shape AIS_LocalContext::SelectedShape() const
{
return TopoDS_Shape();
}
return aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
}

View File

@@ -936,7 +936,6 @@ 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;
@@ -947,7 +946,7 @@ void ApproxInt_Approx::Perform(const TheISurface& ISurf,
cut = Standard_False;
//-- cout<<" ApproxInt : Nb de points = "<<nbpntbez<<" Pas de rajout "<<endl;
}
ptrsvsurf = &myImpPrmSvSurfaces;
Standard_Address ptrsvsurf = &myImpPrmSvSurfaces;
if(nbpntbez < LimRajout) myApproxBez = Standard_False;
@@ -1057,6 +1056,11 @@ 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,6 +116,9 @@ 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,3 +613,16 @@ 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,5 +127,8 @@ is
---C++:inline
returns Status from Approx;
Dump(myclass; ML: TheMultiLine);
---Purpose: Dump of the current multi-line.
end MultiLineTool;

View File

@@ -115,4 +115,9 @@ 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

@@ -49,8 +49,16 @@ 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,6 +43,7 @@
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#include <NCollection_DataMap.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
typedef NCollection_DataMap
<BOPTools_Set,
@@ -129,6 +130,36 @@ 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 :
//=======================================================================

View File

@@ -59,15 +59,18 @@ 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;
theShapes: ListOfShape from BOPCol)
is virtual;
theLS: ListOfShape from BOPCol)
is virtual;
Arguments(me)
returns ListOfShape from BOPCol;
returns ListOfShape from BOPCol;
---C++: return const &

View File

@@ -26,6 +26,7 @@
#include <BRep_Builder.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
//function :
@@ -106,10 +107,28 @@ 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();

View File

@@ -24,7 +24,9 @@ uses
ShapeEnum from TopAbs,
Vertex from TopoDS,
Face from TopoDS,
Edge from TopoDS,
Edge from TopoDS,
ListOfShape from TopTools,
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
@@ -81,10 +83,15 @@ 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;
@@ -127,7 +134,6 @@ 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
@@ -142,7 +148,6 @@ 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;

View File

@@ -25,6 +25,7 @@
#include <IntTools_Context.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=======================================================================
@@ -112,6 +113,21 @@ 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;

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,6 +39,8 @@ 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,9 +20,7 @@
#include <GeometryTest.hxx>
#include <BRepTest.hxx>
#include <MeshTest.hxx>
//#include <CorrectTest.hxx>
#include <HLRTest.hxx>
//#include <stdio.h>
//=======================================================================
//function : AllCommands
@@ -40,6 +38,8 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands)
BOPTest::TolerCommands (theCommands);
BOPTest::ObjCommands (theCommands);
BOPTest::PartitionCommands (theCommands);
BOPTest::APICommands (theCommands);
BOPTest::OptionCommands (theCommands);
}
//=======================================================================
//function : Factory
@@ -57,10 +57,6 @@ 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

@@ -0,0 +1,217 @@
// Created by: Peter KURNEV
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPTest.ixx>
#include <stdio.h>
#include <string.h>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPTest_Objects.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BRepAlgoAPI_BooleanOperation.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Section.hxx>
static
void ConvertList(const BOPCol_ListOfShape& aLSB,
TopTools_ListOfShape& aLS);
static Standard_Integer bapibuild(Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bapibop (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : APICommands
//purpose :
//=======================================================================
void BOPTest::APICommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* g = "Partition commands";
// Commands
theCommands.Add("bapibuild", "use bapibuild r" , __FILE__, bapibuild, g);
theCommands.Add("bapibop", "use bapibop r type" , __FILE__, bapibop, g);
}
//=======================================================================
//function : bapibop
//purpose :
//=======================================================================
Standard_Integer bapibop(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n<3) {
di << " use bapibop r type\n";
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel;
Standard_Integer iErr, iOp;
Standard_Real aFuzzyValue;
BRepAlgoAPI_Common aCommon;
BRepAlgoAPI_Fuse aFuse;
BRepAlgoAPI_Cut aCut;
BRepAlgoAPI_Section aSection;
BRepAlgoAPI_BooleanOperation *pBuilder;
BOPAlgo_Operation aOp;
//
pBuilder=NULL;
iOp=atoi(a[2]);
if (iOp<0 || iOp>4) {
printf(" invalid operation type\n");
return 0;
}
aOp=(BOPAlgo_Operation)iOp;
//
switch (aOp) {
case BOPAlgo_COMMON:
pBuilder=&aCommon;
break;
//
case BOPAlgo_FUSE:
pBuilder=&aFuse;
break;
//
case BOPAlgo_CUT:
case BOPAlgo_CUT21:
pBuilder=&aCut;
break;
//
case BOPAlgo_SECTION:
pBuilder=&aSection;
break;
//
default:
break;
}
//
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
//
TopTools_ListOfShape aLS, aLT;
ConvertList(aLSB, aLS);
ConvertList(aLTB, aLT);
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
//
if (aOp!=BOPAlgo_CUT21) {
pBuilder->SetArguments(aLS);
pBuilder->SetTools(aLT);
}
else {
pBuilder->SetArguments(aLT);
pBuilder->SetTools(aLS);
}
//
pBuilder->SetRunParallel(bRunParallel);
pBuilder->SetFuzzyValue(aFuzzyValue);
//
pBuilder->Build();
iErr=pBuilder->ErrorStatus();
if (iErr) {
Sprintf(buf, " error: %d\n", iErr);
di << buf;
return 0;
}
//
const TopoDS_Shape& aR=pBuilder->Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
//
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bapibuild
//purpose :
//=======================================================================
Standard_Integer bapibuild(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n<2) {
di << " use bapibuild r\n";
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_BuilderAlgo aBuilder;
//
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
//
TopTools_ListOfShape aLS, aLT;
ConvertList(aLSB, aLS);
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
//
aBuilder.SetArguments(aLS);
aBuilder.SetRunParallel(bRunParallel);
aBuilder.SetFuzzyValue(aFuzzyValue);
//
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
if (iErr) {
Sprintf(buf, " error: %d\n", iErr);
di << buf;
return 0;
}
//
const TopoDS_Shape& aR=aBuilder.Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
//
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : ConvertLists
//purpose :
//=======================================================================
void ConvertList(const BOPCol_ListOfShape& aLSB,
TopTools_ListOfShape& aLS)
{
BOPCol_ListIteratorOfListOfShape aItB;
//
aLS.Clear();
aItB.Initialize(aLSB);
for (; aItB.More(); aItB.Next()) {
const TopoDS_Shape& aS=aItB.Value();
aLS.Append(aS);
}
}

View File

@@ -17,7 +17,12 @@
#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>
@@ -28,26 +33,27 @@
//
#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 <BOPDS_DS.hxx>
#include <BOPTest_DrawableShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPAlgo_Section.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 <BOPAlgo_Section.hxx>
#include <BOPTest_DrawableShape.hxx>
#include <BOPTest_Objects.hxx>
//
static BOPAlgo_PaveFiller* pPF=NULL;
@@ -123,9 +129,10 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
//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;
@@ -133,7 +140,7 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
//
if (n < 3 || n > 4) {
di << " use bop Shape1 Shape2 [tol]\n";
return 1;
return 0;
}
//
aS1=DBRep::Get(a[1]);
@@ -141,14 +148,16 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
//
if (aS1.IsNull() || aS2.IsNull()) {
di << " null shapes are not allowed \n";
return 1;
return 0;
}
//
aTol = 0.;
aTol=BOPTest_Objects::FuzzyValue();
if (n == 4) {
aTol = Draw::Atof(a[3]);
}
//
bRunParallel=BOPTest_Objects::RunParallel();
//
aLC.Append(aS1);
aLC.Append(aS2);
//
@@ -161,6 +170,7 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
//
pPF->SetArguments(aLC);
pPF->SetFuzzyValue(aTol);
pPF->SetRunParallel(bRunParallel);
//
pPF->Perform();
iErr=pPF->ErrorStatus();
@@ -229,6 +239,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_BOP aBOP;
//
@@ -239,6 +250,8 @@ 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();
@@ -246,6 +259,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
aBOP.AddArgument(aS1);
aBOP.AddTool(aS2);
aBOP.SetOperation(aOp);
aBOP.SetRunParallel (bRunParallel);
//
aBOP.PerformWithFiller(*pPF);
iErr=aBOP.ErrorStatus();
@@ -286,6 +300,7 @@ Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char
}
//
char buf[64];
Standard_Boolean bRunParallel;
Standard_Integer aNb, iErr;
BOPAlgo_Section aBOP;
//
@@ -297,11 +312,14 @@ Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char
return 0;
}
//
bRunParallel=BOPTest_Objects::RunParallel();
//
const TopoDS_Shape& aS1=aLC.First();
const TopoDS_Shape& aS2=aLC.Last();
//
aBOP.AddArgument(aS1);
aBOP.AddArgument(aS2);
aBOP.SetRunParallel (bRunParallel);
//
aBOP.PerformWithFiller(*pPF);
iErr=aBOP.ErrorStatus();
@@ -363,7 +381,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
if (n < 4) {
di << usage;
return 1;
return 0;
}
//
TopoDS_Shape aS1 = DBRep::Get(a[2]);
@@ -371,17 +389,19 @@ Standard_Integer bsection(Draw_Interpretor& di,
//
if (aS1.IsNull() || aS2.IsNull()) {
di << " Null shapes are not allowed \n";
return 1;
return 0;
}
//
Standard_Boolean bApp, bPC1, bPC2;
Standard_Integer i;
//
char buf[80];
Standard_Boolean bRunParallel, bApp, bPC1, bPC2;
Standard_Integer i, iErr;
Standard_Real aTol;
//
bApp = Standard_True;
bPC1 = Standard_True;
bPC2 = Standard_True;
aTol = 0.;
aTol = BOPTest_Objects::FuzzyValue();
bRunParallel = BOPTest_Objects::RunParallel();
//
for (i = 4; i < n; ++i) {
if (!strcmp(a[i], "-n2d")) {
@@ -402,14 +422,13 @@ Standard_Integer bsection(Draw_Interpretor& di,
}
}
//
Standard_Integer iErr;
char buf[80];
//
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
//
aSec.Approximation(bApp);
aSec.ComputePCurveOn1(bPC1);
aSec.ComputePCurveOn2(bPC2);
aSec.SetFuzzyValue(aTol);
aSec.SetRunParallel(bRunParallel);
//
aSec.Build();
iErr=aSec.ErrorStatus();
@@ -427,7 +446,6 @@ Standard_Integer bsection(Draw_Interpretor& di,
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bsmt
//purpose :
@@ -438,6 +456,7 @@ 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;
@@ -445,7 +464,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
//
if (n < 4 || n > 5) {
di << " use bx r s1 s2 [tol]\n";
return 1;
return 0;
}
//
aS1=DBRep::Get(a[2]);
@@ -453,22 +472,26 @@ Standard_Integer bsmt (Draw_Interpretor& di,
//
if (aS1.IsNull() || aS2.IsNull()) {
di << " null shapes are not allowed \n";
return 1;
return 0;
}
//
aTol = 0.;
aLC.Append(aS1);
aLC.Append(aS2);
//
aTol=BOPTest_Objects::FuzzyValue();
if (n == 5) {
aTol = Draw::Atof(a[4]);
}
//
aLC.Append(aS1);
aLC.Append(aS2);
bRunParallel = BOPTest_Objects::RunParallel();
//
Handle(NCollection_BaseAllocator)aAL=new NCollection_IncAllocator;
//
//---------------------------------------------------------------
BOPAlgo_PaveFiller aPF(aAL);
//
aPF.SetArguments(aLC);
aPF.SetFuzzyValue(aTol);
aPF.SetFuzzyValue(aTol);
aPF.SetRunParallel(bRunParallel);
//
aPF.Perform();
iErr=aPF.ErrorStatus();
@@ -478,36 +501,31 @@ Standard_Integer bsmt (Draw_Interpretor& di,
return 0;
}
//
BRepAlgoAPI_BooleanOperation* pBuilder=NULL;
//
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);
}
//---------------------------------------------------------------
BOPAlgo_BOP aBOP(aAL);
//
iErr = pBuilder->ErrorStatus();
if (!pBuilder->IsDone()) {
aBOP.AddArgument(aS1);
aBOP.AddTool(aS2);
aBOP.SetOperation(aOp);
aBOP.SetRunParallel(bRunParallel);
//
aBOP.PerformWithFiller(aPF);
//
iErr=aBOP.ErrorStatus();
if (iErr) {
Sprintf(buf, " ErrorStatus : %d\n", iErr);
di << buf;
return 0;
}
const TopoDS_Shape& aR=pBuilder->Shape();
const TopoDS_Shape& aR=aBOP.Shape();
if (aR.IsNull()) {
di << " null shape\n";
return 0;
}
//
DBRep::Set(a[1], aR);
return 0;
}
//=======================================================================
//function : bopnews
//purpose :
@@ -579,7 +597,6 @@ Standard_Integer bopnews (Draw_Interpretor& di,
//
return 0;
}
//=======================================================================
//function : bopcurves
//purpose :
@@ -617,7 +634,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
const TopoDS_Face& aF1=*(TopoDS_Face*)(&S1);
const TopoDS_Face& aF2=*(TopoDS_Face*)(&S2);
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone, bMake2dCurves;
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1,
aToApproxC2dOnS2, anIsDone, bMake2dCurves;
Standard_Integer i, aNbCurves;
Standard_Real anAppTol, aTolR;
TCollection_AsciiString aNm("c_");
@@ -666,8 +684,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
di << " has no 3d curve\n";
return 1;
}
else
{
else {
di << aNbCurves << " curve(s) found.\n";
}
@@ -707,7 +724,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
di << "(" << nameC2d2 << ") ";
di << " \n Null first 2d curve of the curve #" << i << "\n";
continue;
} else {
}
else {
TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
pc1Nx = pc1N + anIndx;
Standard_CString nameC2d1 = pc1Nx.ToCString();
@@ -719,7 +737,8 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
if (aPC2.IsNull()) {
di << ") \n Null second 2d curve of the curve #" << i << "\n";
continue;
} else {
}
else {
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
pc2Nx = pc2N + anIndx;
Standard_CString nameC2d2 = pc2Nx.ToCString();
@@ -734,36 +753,6 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
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 :
@@ -789,9 +778,9 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
TopoDS_Shape aS;
BOPCol_ListOfShape aLS;
//
aTol = 0.;
aTol = BOPTest_Objects::FuzzyValue();
bToIntersect = Standard_True;
bRunParallel = Standard_True;
bRunParallel = BOPTest_Objects::RunParallel();
bCompounds = Standard_False;
//
for (i = 2; i < n; ++i) {
@@ -858,3 +847,31 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
//
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;
}

View File

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

View File

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

View File

@@ -0,0 +1,123 @@
// Created by: Peter KURNEV
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPTest.ixx>
#include <stdio.h>
#include <string.h>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <BOPTest_Objects.hxx>
static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : OptionCommands
//purpose :
//=======================================================================
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* g = "Partition commands";
// Commands
theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
}
//=======================================================================
//function : boptions
//purpose :
//=======================================================================
Standard_Integer boptions(Draw_Interpretor& di,
Standard_Integer n,
const char** )
{
if (n!=1) {
di << " use boptions\n";
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel;
Standard_Real aFuzzyValue;
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
di << buf;
Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
di << buf;
//
return 0;
}
//=======================================================================
//function : bfuzzyvalue
//purpose :
//=======================================================================
Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use bfuzzyvalue value\n";
return 0;
}
//
Standard_Real aFuzzyValue;
//
aFuzzyValue=Draw::Atof(a[1]);
if (aFuzzyValue<0.) {
di << " Wrong value.\n";
return 0;
}
//
BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
//
return 0;
}
//=======================================================================
//function : brunparallel
//purpose :
//=======================================================================
Standard_Integer brunparallel(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use brunparallel [0/1]\n";
return 0;
}
//
Standard_Integer iX;
Standard_Boolean bRunParallel;
//
iX=Draw::Atoi(a[1]);
if (iX<0 || iX>1) {
di << " Wrong value.\n";
return 0;
}
//
bRunParallel=(Standard_Boolean)(iX);
BOPTest_Objects::SetRunParallel(bRunParallel);
//
return 0;
}

View File

@@ -59,7 +59,6 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
theCommands.Add("bbop" , "use bbop r op [-s -t]" , __FILE__, bbop, g);
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
}
//=======================================================================
//function : bclear
//purpose :
@@ -105,8 +104,10 @@ Standard_Integer bfillds(Draw_Interpretor& di,
}
//
bShowTime = Standard_False;
bRunParallel = Standard_True;
aTol = 0.;
//
bRunParallel=BOPTest_Objects::RunParallel();
aTol=BOPTest_Objects::FuzzyValue();
//
for (i=1; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
@@ -207,7 +208,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
}
//
bShowTime=Standard_False;
bRunParallel=Standard_True;
bRunParallel=BOPTest_Objects::RunParallel();
for (i=2; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
@@ -282,7 +283,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
aOp=(BOPAlgo_Operation)iOp;
//
bShowTime=Standard_False;
bRunParallel=Standard_True;
bRunParallel=BOPTest_Objects::RunParallel();
for (i=3; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;

View File

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

View File

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

View File

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

View File

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

View File

@@ -15,46 +15,8 @@
-- commercial license or contractual agreement.
package BRepAlgoAPI
uses
TopTools,
TopoDS,
gp,
Geom,
Geom2d,
Message,
BOPCol,
BOPAlgo,
BOPDS,
BRepBuilderAPI
is
deferred class BooleanOperation;
class Fuse;
class Common;
class Cut;
class Section;
class Check;
---Purpose: Check shapes on validity for boolean
--- operation.
deferred class Algo;
deferred class BuilderAlgo;
DumpOper( theFilePath : CString from Standard;
theShape1 : Shape from TopoDS;
theShape2 : Shape from TopoDS;
theResult : Shape from TopoDS;
theOperation : Operation from BOPAlgo;
isNonValidArgs : Boolean from Standard );
---Purpose: Dump arguments and result of boolean operation in the file specified by path.
---Level: Public
end BRepAlgoAPI;
---Purpose: The BRepAlgoAPI package provides a full range of
---Purpose: The BRepAlgoAPI package provides a full range of
-- services to perform Boolean Operations on arguments (shapes
-- that are defined in the BRep data structures). The
-- implemented new algorithm is intended to replace the Old
@@ -119,3 +81,34 @@ end BRepAlgoAPI;
-- each other. The same condition is true for SHELLs or FACEs,
-- WIREs or EDGEs.
-- It does not support Boolean Operations for COMPSOLID type of shape.
uses
TopTools,
TopoDS,
gp,
Geom,
Geom2d,
Message,
BOPCol,
BOPAlgo,
BOPDS,
BRepBuilderAPI
is
deferred class BooleanOperation;
class Fuse;
class Common;
class Cut;
class Section;
class Check;
---Purpose: Check shapes on validity for boolean
--- operation.
deferred class Algo;
class BuilderAlgo;
end BRepAlgoAPI;

View File

@@ -1,105 +0,0 @@
// Created on: 2012-12-25
// Created by: KULIKOVA Galina
// Copyright (c) 2012-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepAlgoAPI.ixx>
#include <stdio.h>
#include <TCollection_AsciiString.hxx>
#include <BRepTools.hxx>
#include <OSD_File.hxx>
//=======================================================================
//function : dumpOper
//purpose :
//=======================================================================
void BRepAlgoAPI::DumpOper(const Standard_CString theFilePath,
const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
const TopoDS_Shape& theResult,
BOPAlgo_Operation theOperation,
Standard_Boolean isNonValidArgs)
{
TCollection_AsciiString aPath(theFilePath);
aPath += "/";
Standard_Integer aNumOper = 1;
Standard_Boolean isExist = Standard_True;
TCollection_AsciiString aFileName;
while(isExist)
{
aFileName = aPath + "BO_" + TCollection_AsciiString(aNumOper) +".tcl";
OSD_File aScript(aFileName);
isExist = aScript.Exists();
if(isExist)
aNumOper++;
}
FILE* afile = fopen(aFileName.ToCString(), "w+");
if(!afile)
return;
if(isNonValidArgs)
fprintf(afile,"%s\n","# Arguments are invalid");
TCollection_AsciiString aName1;
TCollection_AsciiString aName2;
TCollection_AsciiString aNameRes;
if(!theShape1.IsNull())
{
aName1 = aPath +
"Arg1_" + TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theShape1, aName1.ToCString());
}
else
fprintf(afile,"%s\n","# First argument is Null ");
if(!theShape2.IsNull())
{
aName2 = aPath +
"Arg2_"+ TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theShape2, aName2.ToCString());
}
else
fprintf(afile,"%s\n","# Second argument is Null ");
if(!theResult.IsNull())
{
aNameRes = aPath +
"Result_"+ TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theResult, aNameRes.ToCString());
}
else
fprintf(afile,"%s\n","# Result is Null ");
fprintf(afile, "%s %s %s\n","restore", aName1.ToCString(), "arg1");
fprintf(afile, "%s %s %s\n","restore", aName2.ToCString(), "arg2");;
TCollection_AsciiString aBopString;
switch (theOperation)
{
case BOPAlgo_COMMON : aBopString += "bcommon Res "; break;
case BOPAlgo_FUSE : aBopString += "bfuse Res "; break;
case BOPAlgo_CUT :
case BOPAlgo_CUT21 : aBopString += "bcut Res "; break;
case BOPAlgo_SECTION : aBopString += "bsection Res "; break;
default : break;
};
aBopString += ("arg1 arg2");
if(theOperation == BOPAlgo_CUT21)
aBopString += " 1";
fprintf(afile, "%s\n",aBopString.ToCString());
fclose(afile);
}

View File

@@ -27,16 +27,24 @@ is
Initialize
returns Algo from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Algo();"
---Purpose: Empty constructor
Initialize (theAllocator: BaseAllocator from BOPCol)
returns Algo from BRepAlgoAPI;
---Purpose: Empty constructor
ErrorStatus (me)
returns Integer from Standard;
---Purpose: Returns error status of the algorithm
-- ==0 - no errors occured
-- !=0 - is in the event of various error conditions
WarningStatus (me)
returns Integer from Standard;
---Purpose: Returns warning status of the algorithm
-- ==0 - no warning occured
-- !=0 - is in the event of various warning conditions
Allocator(me)
returns BaseAllocator from BOPCol;
---C++: return const &
@@ -63,8 +71,11 @@ is
Shape(me)
returns Shape from TopoDS
is redefined;
---C++: return const &
---C++: return const &
Clear(me:out)
is virtual protected;
fields
myAllocator : BaseAllocator from BOPCol is protected;
myErrorStatus : Integer from Standard is protected;

View File

@@ -120,7 +120,13 @@ const TopoDS_Shape& BRepAlgoAPI_Algo::Shape() const
{
return myShape;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BRepAlgoAPI_Algo::Clear()
{
}
// myErrorStatus
//
// 1 - object is just initialized

View File

@@ -16,85 +16,97 @@
deferred class BooleanOperation from BRepAlgoAPI
inherits BuilderAlgo from BRepAlgoAPI
---Purpose: The abstract class BooleanOperation is the root
-- class of Boolean Operations (see Overview).
-- Boolean Operations algorithm is divided onto two parts.
-- - The first one is computing interference between arguments.
-- - The second one is building the result of operation.
-- The BooleanOperation class provides execution of both parts
-- of the Boolean Operations algorithm. The second part
-- (building the result) depends on given type of the Boolean
-- Operation (see Constructor).
---Purpose:
-- The abstract class BooleanOperation is the root
-- class of Boolean Operations (see Overview).
-- Boolean Operations algorithm is divided onto two parts.
-- - The first one is computing interference between arguments.
-- - The second one is building the result of operation.
-- The class BooleanOperation provides API level of both parts
uses
Shape from TopoDS,
DataMapOfShapeShape from TopTools,
ListOfShape from TopTools,
ListOfShape from TopTools,
--
Operation from BOPAlgo,
PaveFiller from BOPAlgo
PaveFiller from BOPAlgo
is
Initialize
returns BooleanOperation from BRepAlgoAPI;
---Purpose: Empty constructor
Initialize (PF :PaveFiller from BOPAlgo)
returns BooleanOperation from BRepAlgoAPI;
---Purpose: Empty constructor
-- <PF> - PaveFiller object that is carried out
Initialize (S1 :Shape from TopoDS;
S2 :Shape from TopoDS;
anOperation:Operation from BOPAlgo);
---Purpose: Prepares the operations for S1 and S2.
---Purpose: Constructor with two arguments
-- <S1>, <S2> -arguments
-- <anOperation> - the type of the operation
-- Obsolete
Initialize (S1 :Shape from TopoDS;
S2 :Shape from TopoDS;
aPF :PaveFiller from BOPAlgo;
Initialize (S1 :Shape from TopoDS;
S2 :Shape from TopoDS;
PF :PaveFiller from BOPAlgo;
anOperation:Operation from BOPAlgo);
---Purpose: Prepares the operations for S1 and S2.
---Purpose: Constructor with two arguments
-- <S1>, <S2> -arguments
-- <anOperation> - the type of the operation
-- <PF> - PaveFiller object that is carried out
-- Obsolete
SetShape1(me:out;
S:Shape from TopoDS);
SetShape2(me:out;
S:Shape from TopoDS);
Shape1(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the first shape involved in this Boolean operation.
---Purpose: Returns the first argument involved in this Boolean operation.
-- Obsolete
---C++: return const &
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();"
Shape2(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the second shape involved in this Boolean operation.
---Purpose: Returns the second argument involved in this Boolean operation.
-- Obsolete
---C++: return const &
SetTools(me:out;
theLS: ListOfShape from TopTools);
---Purpose: Sets the tools
Tools(me)
returns ListOfShape from TopTools;
---C++: return const &
---Purpose: Gets the tools
SetOperation (me:out;
anOp: Operation from BOPAlgo);
---Purpose: Sets the type of Boolean operation to perform
--- It can be BOPAlgo_SECTION
--- BOPAlgo_COMMON
--- BOPAlgo_FUSE
--- BOPAlgo_CUT
--- BOPAlgo_CUT21
---
anOp: Operation from BOPAlgo);
---Purpose: Sets the type of Boolean operation
Operation (me)
returns Operation from BOPAlgo;
---Purpose: Returns the type of Boolean Operation that has been performed.
---Purpose: Returns the type of Boolean Operation
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();"
Build (me:out)
is redefined virtual;
---Purpose: Provides the algorithm of Boolean Operations
-- - Filling interference Data Structure (if it is necessary)
-- - Building the result of the operation.
is redefined ;
---Purpose: Performs the algorithm
-- Filling interference Data Structure (if it is necessary)
-- Building the result of the operation.
BuilderCanWork(me)
returns Boolean from Standard;
---Purpose: Returns True if there was no errors occured
-- obsolete
FuseEdges(me)
returns Boolean from Standard;
---Purpose: Returns the flag of edge refining
@@ -102,7 +114,7 @@ is
RefineEdges(me:out);
---Purpose: Fuse C1 edges
SectionEdges (me: in out)
SectionEdges (me: in out)
returns ListOfShape from TopTools;
--- Purpose: Returns a list of section edges.
-- The edges represent the result of intersection between arguments of
@@ -112,70 +124,70 @@ is
Modified (me: in out;
aS : Shape from TopoDS)
returns ListOfShape from TopTools
is redefined virtual;
is redefined;
---Purpose: Returns the list of shapes modified from the shape <S>.
---C++: return const &
IsDeleted (me: in out;
aS : Shape from TopoDS)
returns Boolean
is redefined virtual;
is redefined;
---Purpose: Returns true if the shape S has been deleted. The
-- result shape of the operation does not contain the shape S.
Generated (me: in out;
S : Shape from TopoDS)
returns ListOfShape from TopTools
is redefined virtual;
is redefined;
---Purpose: Returns the list of shapes generated from the shape <S>.
--- For use in BRepNaming.
---C++: return const &
HasModified (me)
returns Boolean from Standard
is virtual;
is redefined;
---Purpose: Returns true if there is at least one modified shape.
--- For use in BRepNaming.
HasGenerated (me)
returns Boolean from Standard
is virtual;
is redefined;
---Purpose: Returns true if there is at least one generated shape.
--- For use in BRepNaming.
HasDeleted (me)
returns Boolean from Standard
is virtual;
is redefined;
---Purpose: Returns true if there is at least one deleted shape.
--- For use in BRepNaming.
--
-- protected
--
PrepareFiller(me:out)
returns Boolean from Standard
is protected;
-- protected methods
--
Clear(me:out)
is redefined protected;
SetAttributes (me:out)
is virtual protected;
RefinedList (me: in out;
theL : ListOfShape from TopTools)
returns ListOfShape from TopTools
is protected;
---Purpose: Returns the list of shapes generated from the shape <S>.
--- For use in BRepNaming.
---C++: return const &
fields
myS1 : Shape from TopoDS is protected;
myS2 : Shape from TopoDS is protected;
myOperation: Operation from BOPAlgo is protected;
--
myEntryType: Integer from Standard is protected;
myBuilderCanWork : Boolean from Standard is protected;
---C++: return const &
fields
myTools : ListOfShape from TopTools is protected;
myOperation: Operation from BOPAlgo is protected;
--
myBuilderCanWork : Boolean from Standard is protected;
-- for edge refiner
myFuseEdges : Boolean from Standard ;
myModifFaces : DataMapOfShapeShape from TopTools;
myEdgeMap : DataMapOfShapeShape from TopTools;
end BooleanOperation;

View File

@@ -16,16 +16,24 @@
#include <BRepAlgoAPI_BooleanOperation.ixx>
///XXXXXXXXXX
#include <stdio.h>
#include <TCollection_AsciiString.hxx>
#include <BRepTools.hxx>
#include <OSD_File.hxx>
//XXXXXXXXXX
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
#include <TopTools_DataMapOfIntegerShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepAlgoAPI_Check.hxx>
#include <BRepAlgoAPI.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <BOPDS_PDS.hxx>
@@ -39,18 +47,84 @@
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_Section.hxx>
//XXXX
//=======================================================================
//class : BRepAlgoAPI_DumpOper
//purpose :
//=======================================================================
class BRepAlgoAPI_DumpOper {
public:
BRepAlgoAPI_DumpOper() :
myIsDump(Standard_False),
myIsDumpArgs(Standard_False),
myIsDumpRes(Standard_False) {
char *pathdump = getenv("CSF_DEBUG_BOP");
myIsDump=(pathdump!=NULL);
myPath=pathdump;
};
//
virtual ~BRepAlgoAPI_DumpOper() {
};
//
Standard_Boolean IsDump()const {
return myIsDump;
};
//
void SetIsDumpArgs(const Standard_Boolean bFlag) {
myIsDumpArgs=bFlag;
}
//
Standard_Boolean IsDumpArgs()const {
return myIsDumpArgs;
};
//
void SetIsDumpRes(const Standard_Boolean bFlag) {
myIsDumpRes=bFlag;
};
//
Standard_Boolean IsDumpRes()const {
return myIsDumpRes;
};
//
void Dump(
const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
const TopoDS_Shape& theResult,
BOPAlgo_Operation theOperation);
//
protected:
Standard_Boolean myIsDump;
Standard_Boolean myIsDumpArgs;
Standard_Boolean myIsDumpRes;
Standard_CString myPath;
};
//XXXX
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation()
:
BRepAlgoAPI_BuilderAlgo(),
BRepAlgoAPI_BuilderAlgo(),
myOperation(BOPAlgo_UNKNOWN),
myEntryType(1),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
{
myEntryType=1;
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_BuilderAlgo(aPF),
myOperation(BOPAlgo_UNKNOWN),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
myEntryType=0;
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
@@ -62,13 +136,14 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(),
myS1(aS1),
myS2(aS2),
myOperation(anOp),
myEntryType(1),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
myEntryType=1;
//
myArguments.Append(aS1);
myTools.Append(aS2);
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
@@ -80,14 +155,16 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
const BOPAlgo_PaveFiller& aPF,
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(),
myS1(aS1),
myS2(aS2),
BRepAlgoAPI_BuilderAlgo(aPF),
myOperation(anOp),
myEntryType(0),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
{
myEntryType=0;
//
myArguments.Append(aS1);
myTools.Append(aS2);
//
myDSFiller=(BOPAlgo_PaveFiller*)&aPF;
}
//=======================================================================
@@ -96,19 +173,37 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
//=======================================================================
BRepAlgoAPI_BooleanOperation::~BRepAlgoAPI_BooleanOperation()
{
if (myBuilder) {
delete myBuilder;
myBuilder=NULL;
}
if (myDSFiller && myEntryType) {
delete myDSFiller;
myDSFiller=NULL;
}
//
Clear();
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::Clear()
{
BRepAlgoAPI_BuilderAlgo::Clear();
myModifFaces.Clear();
myEdgeMap.Clear();
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetTools
(const TopTools_ListOfShape& theLS)
{
myTools=theLS;
}
//=======================================================================
//function : Tools
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Tools()const
{
return myTools;
}
//=======================================================================
//function : SetOperation
//purpose :
//=======================================================================
@@ -121,33 +216,17 @@ void BRepAlgoAPI_BooleanOperation::SetOperation
//function : Operation
//purpose :
//=======================================================================
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation()const
{
return myOperation;
}
//=======================================================================
//function : SetShape1
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetShape1(const TopoDS_Shape& aS)
{
myS1=aS;
}
//=======================================================================
//function : SetShape2
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetShape2(const TopoDS_Shape& aS)
{
myS2=aS;
}
//=======================================================================
//function : Shape1
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
{
return myS1;
return myArguments.First();
}
//=======================================================================
//function : Shape2
@@ -155,13 +234,13 @@ const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
{
return myS2;
return myTools.First();
}
//=======================================================================
//function : BuilderCanWork
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::BuilderCanWork() const
Standard_Boolean BRepAlgoAPI_BooleanOperation::BuilderCanWork() const
{
return myBuilderCanWork;
}
@@ -174,154 +253,159 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
return myFuseEdges;
}
//=======================================================================
//function : PrepareFiller
//function : SetAttributes
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
void BRepAlgoAPI_BooleanOperation::SetAttributes()
{
Standard_Boolean bIsNewFiller=Standard_False;
myErrorStatus=1;
//
if (myS1.IsNull() || myS2.IsNull()) {
myErrorStatus=2;
return bIsNewFiller;
}
//
if (myOperation==BOPAlgo_UNKNOWN) {
myErrorStatus=6;
return bIsNewFiller;
}
//
if (myDSFiller==NULL) {
bIsNewFiller=!bIsNewFiller;
myDSFiller=new BOPAlgo_PaveFiller;
//
if (myDSFiller==NULL) {
myErrorStatus=4;
return bIsNewFiller;
}
//
BOPCol_ListOfShape aLS;
aLS.Append(myS1);
aLS.Append(myS2);
//
myDSFiller->SetArguments(aLS);
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
}
return bIsNewFiller;
}
//=======================================================================
//function : Build
//function : Build2
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::Build()
{
Standard_Boolean bIsNewFiller;
Standard_Integer iErr;
//
//dump arguments and result of boolean operation in tcl script
char *pathdump = getenv("CSF_DEBUG_BOP");
Standard_Boolean isDump = (pathdump != NULL),
isDumpArgs = Standard_False,
isDumpRes = Standard_False;
Standard_CString aPath = pathdump;
Standard_Integer iErr, aNbArgs, aNbTools;
BRepAlgoAPI_DumpOper aDumpOper;
//
myBuilderCanWork=Standard_False;
myErrorStatus=0;
NotDone();
//
bIsNewFiller=PrepareFiller();
//
if (myErrorStatus!=1) {
// there was errors during the preparation
aNbArgs=myArguments.Extent();
aNbTools=myTools.Extent();
if (aNbArgs<1 && aNbTools<1) {
myErrorStatus=2;
return;
}
if (myOperation==BOPAlgo_UNKNOWN) {
myErrorStatus=6;
return;
}
//
if (bIsNewFiller) {
//Prepare the DS
myDSFiller->Perform();
//-----------------------------------------------
TopTools_ListOfShape aLS;
TopTools_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
//
if (myBuilder!=NULL) {
delete myBuilder;
myBuilder=NULL;
aIt.Initialize(myTools);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
//-----------------------------------------------
//
const TopoDS_Shape& aS1 = myS1;
const TopoDS_Shape& aS2 = myS2;
//
if (isDump) {
BRepAlgoAPI_Check aChekArgs(aS1, aS2, myOperation);
isDumpArgs = !aChekArgs.IsValid();
}
//
myShape.Nullify();
//
if (myOperation==BOPAlgo_SECTION) {
myBuilder=new BOPAlgo_Section;
myBuilder->AddArgument(aS1);
myBuilder->AddArgument(aS2);
}
else {
BOPAlgo_BOP *pBOP;
if (myEntryType) {
if (myDSFiller) {
delete myDSFiller;
}
myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
//
pBOP=new BOPAlgo_BOP;
myBuilder=pBOP;
pBOP->AddArgument(aS1);
pBOP->AddTool(aS2);
myDSFiller->SetArguments(aLS);
//
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
//
SetAttributes();
//
myDSFiller->Perform();
iErr=myDSFiller->ErrorStatus();
if (iErr) {
myErrorStatus=100+iErr;
return;
}
}// if (myEntryType) {
//
//XXXX
const TopoDS_Shape& aS1 = myArguments.First();
const TopoDS_Shape& aS2 = myTools.First();
if (aDumpOper.IsDump()) {
BRepAlgoAPI_Check aChekArgs(aS1, aS2, myOperation);
aDumpOper.SetIsDumpArgs(!aChekArgs.IsValid());
}
//XXXX
//
if (myBuilder) {
delete myBuilder;
}
//
BOPAlgo_BOP *pBOP;
//
if(myOperation==BOPAlgo_SECTION) {
myBuilder=new BOPAlgo_Section(myAllocator);
myBuilder->SetArguments(aLS);
}
else{
pBOP=new BOPAlgo_BOP(myAllocator);
pBOP->SetArguments(myArguments);
pBOP->SetTools(myTools);
pBOP->SetOperation(myOperation);
myBuilder=pBOP;
}
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
//
myBuilder->PerformWithFiller(*myDSFiller);
iErr = myBuilder->ErrorStatus();
if (!iErr) {
myErrorStatus=0;
myBuilderCanWork=Standard_True;
myShape=myBuilder->Shape();
//
if (isDump) {
BRepAlgoAPI_Check aCheckRes(myShape);
isDumpRes = !aCheckRes.IsValid();
if (isDumpArgs || isDumpRes) {
BRepAlgoAPI::DumpOper(aPath,
aS1,
aS2,
myShape,
myOperation,
isDumpArgs);
}
}
//
Done();
}
else {
myErrorStatus=100+iErr;
NotDone();
if (iErr) {
myErrorStatus=200+iErr;
return;
}
//
myShape=myBuilder->Shape();
//
myBuilderCanWork=Standard_True;
Done();
//
//XXXX
if (aDumpOper.IsDump()) {
BRepAlgoAPI_Check aCheckRes(myShape);
aDumpOper.SetIsDumpRes(!aCheckRes.IsValid());
aDumpOper.Dump(aS1, aS2, myShape,myOperation);
}
//XXXX
}
//=======================================================================
//function : RefineEdges
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
{
if(myFuseEdges) return; //Edges have been refined yet
if(myFuseEdges) {
return; //Edges have been refined
}
//
TopTools_IndexedMapOfShape mapOldEdges;
TopTools_ListOfShape aLS;
TopTools_ListIteratorOfListOfShape aIt;
//
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
aIt.Initialize(myTools);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
aLS.Append(aS);
}
//
aIt.Initialize(aLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
TopExp::MapShapes (aS, TopAbs_EDGE, mapOldEdges);
}
//----------------------------------------------
BRepLib_FuseEdges FE(myShape);
FE.SetConcatBSpl(Standard_True);
// avoid fusing old edges
TopTools_IndexedMapOfShape mapOldEdges;
TopExp::MapShapes (myS1, TopAbs_EDGE, mapOldEdges);
TopExp::MapShapes (myS2, TopAbs_EDGE, mapOldEdges);
FE.AvoidEdges (mapOldEdges);
//
// Get List of edges that have been fused
myFuseEdges = Standard_False;
myModifFaces.Clear();
@@ -529,3 +613,90 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
}
return myBuilder->HasDeleted();
}
//XXXX
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void BRepAlgoAPI_DumpOper::Dump (const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2,
const TopoDS_Shape& theResult,
BOPAlgo_Operation theOperation)
{
if (!(myIsDumpArgs && myIsDumpRes)) {
return;
}
//
TCollection_AsciiString aPath(myPath);
aPath += "/";
Standard_Integer aNumOper = 1;
Standard_Boolean isExist = Standard_True;
TCollection_AsciiString aFileName;
while(isExist)
{
aFileName = aPath + "BO_" + TCollection_AsciiString(aNumOper) +".tcl";
OSD_File aScript(aFileName);
isExist = aScript.Exists();
if(isExist)
aNumOper++;
}
FILE* afile = fopen(aFileName.ToCString(), "w+");
if(!afile)
return;
if(myIsDumpArgs)
fprintf(afile,"%s\n","# Arguments are invalid");
TCollection_AsciiString aName1;
TCollection_AsciiString aName2;
TCollection_AsciiString aNameRes;
if(!theShape1.IsNull())
{
aName1 = aPath +
"Arg1_" + TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theShape1, aName1.ToCString());
}
else
fprintf(afile,"%s\n","# First argument is Null ");
if(!theShape2.IsNull())
{
aName2 = aPath +
"Arg2_"+ TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theShape2, aName2.ToCString());
}
else
fprintf(afile,"%s\n","# Second argument is Null ");
if(!theResult.IsNull())
{
aNameRes = aPath +
"Result_"+ TCollection_AsciiString(aNumOper) + ".brep";
BRepTools::Write(theResult, aNameRes.ToCString());
}
else
fprintf(afile,"%s\n","# Result is Null ");
fprintf(afile, "%s %s %s\n","restore", aName1.ToCString(), "arg1");
fprintf(afile, "%s %s %s\n","restore", aName2.ToCString(), "arg2");;
TCollection_AsciiString aBopString;
switch (theOperation)
{
case BOPAlgo_COMMON : aBopString += "bcommon Res "; break;
case BOPAlgo_FUSE : aBopString += "bfuse Res "; break;
case BOPAlgo_CUT :
case BOPAlgo_CUT21 : aBopString += "bcut Res "; break;
case BOPAlgo_SECTION : aBopString += "bsection Res "; break;
default : break;
};
aBopString += ("arg1 arg2");
if(theOperation == BOPAlgo_CUT21)
aBopString += " 1";
fprintf(afile, "%s\n",aBopString.ToCString());
fclose(afile);
}
//XXXX

View File

@@ -12,36 +12,104 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
deferred class BuilderAlgo from BRepAlgoAPI
inherits Algo from BRepAlgoAPI
---Purpose: provides the root interface for algorithms
class BuilderAlgo from BRepAlgoAPI
inherits Algo from BRepAlgoAPI
---Purpose:
-- The clsss contains API level of General Fuse algorithm
uses
BaseAllocator from BOPCol,
PPaveFiller from BOPAlgo,
Shape from TopoDS,
ListOfShape from TopTools,
--
PPaveFiller from BOPAlgo,
PaveFiller from BOPAlgo,
PBuilder from BOPAlgo
--raises
is
Initialize
returns BuilderAlgo from BRepAlgoAPI;
Create
returns BuilderAlgo from BRepAlgoAPI;
---Purpose: Empty constructor
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();"
Initialize (theAllocator: BaseAllocator from BOPCol)
returns BuilderAlgo from BRepAlgoAPI;
Create(thePF :PaveFiller from BOPAlgo)
returns BuilderAlgo from BRepAlgoAPI;
---Purpose: Empty constructor
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---Purpose: Returns the additional tolerance
returns Real from Standard;
---Purpose: Returns the additional tolerance
SetArguments(me:out;
theLS: ListOfShape from TopTools);
---Purpose: Sets the arguments
Arguments(me)
returns ListOfShape from TopTools;
---C++: return const &
---Purpose: Gets the arguments
Build (me:out)
is redefined virtual;
---Purpose: Performs the algorithm
--
-- H I S T O R Y
--
Modified (me: in out;
aS : Shape from TopoDS)
returns ListOfShape from TopTools
is redefined virtual;
---Purpose: Returns the list of shapes modified from the shape <S>.
---C++: return const &
IsDeleted (me: in out;
aS : Shape from TopoDS)
returns Boolean
is redefined virtual;
---Purpose: Returns true if the shape S has been deleted. The
-- result shape of the operation does not contain the shape S.
Generated (me: in out;
S : Shape from TopoDS)
returns ListOfShape from TopTools
is redefined virtual;
---Purpose: Returns the list of shapes generated from the shape <S>.
--- For use in BRepNaming.
---C++: return const &
HasModified (me)
returns Boolean from Standard
is virtual;
---Purpose: Returns true if there is at least one modified shape.
--- For use in BRepNaming.
HasGenerated (me)
returns Boolean from Standard
is virtual;
---Purpose: Returns true if there is at least one generated shape.
--- For use in BRepNaming.
HasDeleted (me)
returns Boolean from Standard
is virtual;
---Purpose: Returns true if there is at least one deleted shape.
--- For use in BRepNaming.
--
-- protected methods
--
Clear(me:out)
is redefined protected;
fields
myEntryType : Integer from Standard is protected;
myDSFiller : PPaveFiller from BOPAlgo is protected;
myBuilder : PBuilder from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
myFuzzyValue : Real from Standard is protected;
myArguments : ListOfShape from TopTools is protected;
end BuilderAlgo;

View File

@@ -14,7 +14,8 @@
#include <BRepAlgoAPI_BuilderAlgo.ixx>
#include <NCollection_BaseAllocator.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Builder.hxx>
//=======================================================================
// function:
@@ -23,6 +24,7 @@
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
:
BRepAlgoAPI_Algo(),
myEntryType(1),
myDSFiller(NULL),
myBuilder(NULL),
myFuzzyValue(0.)
@@ -32,20 +34,23 @@ BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
(const Handle(NCollection_BaseAllocator)& theAllocator)
(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_Algo(theAllocator),
myDSFiller(NULL),
BRepAlgoAPI_Algo(),
myEntryType(0),
myBuilder(NULL),
myFuzzyValue(0.)
{}
{
BOPAlgo_PaveFiller* pPF=(BOPAlgo_PaveFiller*)&aPF;
myDSFiller=pPF;
}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo()
{
Clear();
}
//=======================================================================
//function : SetFuzzyValue
@@ -65,3 +70,160 @@ Standard_Real BRepAlgoAPI_BuilderAlgo::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::Clear()
{
if (myDSFiller && myEntryType) {
delete myDSFiller;
myDSFiller=NULL;
}
if (myBuilder) {
delete myBuilder;
myBuilder=NULL;
}
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::SetArguments
(const TopTools_ListOfShape& theLS)
{
myArguments=theLS;
}
//=======================================================================
//function : Arguments
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Arguments()const
{
return myArguments;
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::Build()
{
Standard_Integer iErr;
//
NotDone();
myErrorStatus=0;
//
Clear();
//
if (myEntryType) {
if (myDSFiller) {
delete myDSFiller;
}
myDSFiller=new BOPAlgo_PaveFiller(myAllocator);
//
myDSFiller->SetArguments(myArguments);
//
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
//
myDSFiller->Perform();
iErr=myDSFiller->ErrorStatus();
if (iErr) {
myErrorStatus=100+iErr;
}
}// if (myEntryType) {
//
if (myBuilder) {
delete myBuilder;
}
myBuilder=new BOPAlgo_Builder(myAllocator);
//
myBuilder->SetArguments(myArguments);
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
//
myBuilder->PerformWithFiller(*myDSFiller);
iErr=myBuilder->ErrorStatus();
if (iErr) {
myErrorStatus=200+iErr;
}
//
Done();
myShape=myBuilder->Shape();
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Generated
(const TopoDS_Shape& aS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
myGenerated = myBuilder->Generated(aS);
return myGenerated;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BuilderAlgo::Modified
(const TopoDS_Shape& aS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
myGenerated = myBuilder->Modified(aS);
return myGenerated;
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::IsDeleted
(const TopoDS_Shape& aS)
{
Standard_Boolean bDeleted = Standard_True;
if (myBuilder != NULL) {
bDeleted=myBuilder->IsDeleted(aS);
}
return bDeleted;
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasModified() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasModified();
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasGenerated() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasGenerated();
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BuilderAlgo::HasDeleted() const
{
if (myBuilder==NULL) {
return Standard_False;
}
return myBuilder->HasDeleted();
}

View File

@@ -17,31 +17,43 @@
class Common from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Common provides a
-- Boolean common operation on a pair of arguments (Boolean Intersection).
-- The class Common provides a framework for:
-- - Defining the construction of a common shape;
-- - Implementing the building algorithm
-- - Consulting the result.
---Purpose:
-- The class provides Boolean common operation
-- between arguments and tools (Boolean Intersection).
uses
Shape from TopoDS,
PaveFiller from BOPAlgo
is
Create
returns Common from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Common();"
--- Purpose: Empty constructor
Create (S1,S2 : Shape from TopoDS)
returns Common from BRepAlgoAPI;
---Purpose: Constructs a common part for shapes aS1 and aS2 .
--- Purpose: Empty constructor
Create (PF: PaveFiller from BOPAlgo)
returns Common from BRepAlgoAPI;
--- Purpose: Empty constructor
-- <PF> - PaveFiller object that is carried out
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo)
returns Common from BRepAlgoAPI;
--- Purpose: Constructs a common part for shapes aS1 and aS2 using aDSFiller
Create (S1,S2 : Shape from TopoDS)
returns Common from BRepAlgoAPI;
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <anOperation> - the type of the operation
-- Obsolete
Create (S1: Shape from TopoDS;
S2: Shape from TopoDS;
PF: PaveFiller from BOPAlgo)
returns Common from BRepAlgoAPI;
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <anOperation> - the type of the operation
-- <PF> - PaveFiller object that is carried out
-- Obsolete
end Common;

View File

@@ -29,6 +29,16 @@ BRepAlgoAPI_Common::BRepAlgoAPI_Common()
myOperation=BOPAlgo_COMMON;
}
//=======================================================================
//function : BRepAlgoAPI_Common
//purpose :
//=======================================================================
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_BooleanOperation(aPF)
{
myOperation=BOPAlgo_COMMON;
}
//=======================================================================
//function : ~BRepAlgoAPI_Common
//purpose :
//=======================================================================
@@ -39,8 +49,8 @@ BRepAlgoAPI_Common::~BRepAlgoAPI_Common()
//function : BRepAlgoAPI_Common
//purpose :
//=======================================================================
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_COMMON)
{
BRepAlgoAPI_BooleanOperation* pBO=
@@ -51,9 +61,9 @@ BRepAlgoAPI_Common::~BRepAlgoAPI_Common()
//function : BRepAlgoAPI_Common
//purpose :
//=======================================================================
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF)
BRepAlgoAPI_Common::BRepAlgoAPI_Common(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF)
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_COMMON)
{
BRepAlgoAPI_BooleanOperation* pBO=

View File

@@ -15,13 +15,11 @@
-- commercial license or contractual agreement.
class Cut from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Cut provides a Boolean
-- cut operation on a pair of arguments (Boolean Subtraction).
-- The class Cut provides a framework for:
-- - Defining the construction of a cut shape
-- - Implementing the building algorithm
-- - Consulting the result
inherits BooleanOperation from BRepAlgoAPI
---Purpose:
-- The class Cut provides Boolean cut operation
-- between arguments and tools (Boolean Subtraction).
uses
Shape from TopoDS,
@@ -33,20 +31,29 @@ is
returns Cut from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Cut();"
--- Purpose: Empty constructor
Create (PF: PaveFiller from BOPAlgo)
returns Cut from BRepAlgoAPI;
--- Purpose: Empty constructor
-- <PF> - PaveFiller object that is carried out
Create (S1,S2 : Shape from TopoDS)
returns Cut from BRepAlgoAPI;
---Purpose: Shape aS2 cuts shape aS1. The
-- resulting shape is a new shape produced by the cut operation.
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <anOperation> - the type of the operation
-- Obsolete
Create (S1,S2 : Shape from TopoDS;
aDSF : PaveFiller from BOPAlgo;
bFWD : Boolean from Standard=Standard_True)
returns Cut from BRepAlgoAPI;
--- Purpose: Constructs a new shape cut from
-- shape aS1 by shape aS2 using aDSFiller (see
-- BRepAlgoAPI_BooleanOperation Constructor).
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <anOperation> - the type of the operation
-- <PF> - PaveFiller object that is carried out
-- Obsolete
end Cut;

View File

@@ -29,13 +29,22 @@ BRepAlgoAPI_Cut::BRepAlgoAPI_Cut()
myOperation=BOPAlgo_CUT;
}
//=======================================================================
//function : BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_BooleanOperation(aPF)
{
myOperation=BOPAlgo_CUT;
}
//=======================================================================
//function : ~BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::~BRepAlgoAPI_Cut()
{
}
//=======================================================================
//function : BRepAlgoAPI_Cut
//purpose :
@@ -58,7 +67,8 @@ BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean bFWD)
:
BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
BRepAlgoAPI_BooleanOperation(S1, S2, aDSF,
(bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;

View File

@@ -14,14 +14,12 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Fuse from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Fuse provides a
-- Boolean fusion operation on a pair of arguments (Boolean Union).
-- The class Fuse provides a framework for:
-- - Defining the construction of a fused shape;
-- - Implementing the building algorithm
-- - Consulting the result.
class Fuse from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose:
-- The class provides Boolean fusion operation
-- between arguments and tools (Boolean Union).
uses
Shape from TopoDS,
@@ -33,14 +31,28 @@ is
returns Fuse from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Fuse();"
--- Purpose: Empty constructor
Create (PF: PaveFiller from BOPAlgo)
returns Fuse from BRepAlgoAPI;
--- Purpose: Empty constructor
-- <PF> - PaveFiller object that is carried out
Create (S1,S2 : Shape from TopoDS)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a fuse of shapes aS1 and aS2.
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <anOperation> - the type of the operation
-- Obsolete
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller.
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <anOperation> - the type of the operation
-- <PF> - PaveFiller object that is carried out
-- Obsolete
end Fuse;

View File

@@ -29,13 +29,22 @@ BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse()
myOperation=BOPAlgo_FUSE;
}
//=======================================================================
//function : BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_BooleanOperation(aPF)
{
myOperation=BOPAlgo_FUSE;
}
//=======================================================================
//function : ~BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::~BRepAlgoAPI_Fuse()
{
}
//=======================================================================
//function : BRepAlgoAPI_Fuse
//purpose :
@@ -49,7 +58,6 @@ BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
(BRepAlgoAPI_BooleanOperation*) (void*) this;
pBO->Build();
}
//=======================================================================
//function : BRepAlgoAPI_Fuse
//purpose :

View File

@@ -18,296 +18,238 @@
class Section from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose:
-- The algorithm is to build a Secton operation between arguments and tools.
-- The result of Section operation consists of vertices and edges.
-- The result of Section operation contains:
-- 1. new vertices that are subjects of V/V, E/E, E/F, F/F interferences
-- 2. vertices that are subjects of V/E, V/F interferences
-- 3. new edges that are subjects of F/F interferences
-- 4. edges that are Common Blocks
---Purpose: Computes the intersection of two shapes or geometries.
-- Geometries can be surfaces of planes.
-- Geometries are converted to faces
-- When a geometry has been converted to
-- topology the created shape can be found using
-- the methods Shape1 and Shape2 inherited from the class BooleanOperation.
-- The result (Shape() method) is a compound containing
-- edges built on intersection curves.
-- By default, the section is performed immediatly in
-- class constructors, with default values :
-- - geometries built are NOT approximated.
-- - PCurves are NOT computed on both parts.
-- Example : giving two shapes S1,S2 accessing faces,
-- let compute the section edges R on S1,S2,
-- performing approximation on new curves,
-- performing PCurve on part 1 but not on part 2 :
-- Standard_Boolean PerformNow = Standard_False;
-- BRepBoolAPI_Section S(S1,S2,PerformNow);
-- S.ComputePCurveOn1(Standard_True);
-- S.Approximation(Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
-- On Null Shapes of geometries, NotDone() is called.
-- The vertex is included in Section only when it is not shared
-- between the edges above
-- --
-- Default values:
-- - geometries built are NOT approximated.
-- - PCurves are NOT computed on both parts.
-- Example of use:
-- Standard_Boolean bRunParallel;
-- Standard_Integer iErr;
-- BRepAlgoAPI_Section aSection;
-- //
-- bRunParallel=...; // turn parallelism on/off
-- const TopTools_ListOfShape& aLS=...; // Arguments
-- const TopTools_ListOfShape& aLT=...; // Tools
-- //
-- aSection.SetRunParallel();
-- aSection.SetArguments(aLS);
-- aSection.SetTools(aLT);
-- aSection.Approximation(Standard_True);
-- //
-- aSection.Build(); // perform the algorithm
-- iErr=pBuilder->ErrorStatus();
-- if (iErr) {
-- // errors occured
-- return 0;
-- }
-- //
-- const TopoDS_Shape& aR=aSection.Shape();// the result
-- //...
uses
Pln from gp,
Shape from TopoDS,
Surface from Geom,
Curve from Geom2d,
PaveFiller from BOPAlgo,
ListOfShape from TopTools
PaveFiller from BOPAlgo,
Operation from BOPAlgo,
ListOfShape from TopTools,
BaseAllocator from BOPCol
is
Create
returns Section from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Section();"
--- Purpose: Empty constructor
Create (S1,S2 : Shape from TopoDS;
Create (PF: PaveFiller from BOPAlgo)
returns Section from BRepAlgoAPI;
--- Purpose: Empty constructor
-- <PF> - PaveFiller object that is carried out
Create(S1 : Shape from TopoDS;
S2 : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <PerformNow> - the flag:
-- if <PerformNow>=True - the algorithm is performed immediatly
-- Obsolete
Create (S1 : Shape from TopoDS;
S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: Constructor with two shapes
-- <S1> -argument
-- <S2> -tool
-- <PF> - PaveFiller object that is carried out
-- <PerformNow> - the flag:
-- if <PerformNow>=True - the algorithm is performed immediatly
-- Obsolete
Create(Sh1,Sh2 : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
Create(S1 : Shape from TopoDS;
Pl : Pln from gp;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
---Purpose: Constructor with two shapes
-- <S1> - argument
-- <Pl> - tool
-- <PerformNow> - the flag:
-- if <PerformNow>=True - the algorithm is performed immediatly
-- Obsolete
Create(Sh : Shape from TopoDS;
Pl : Pln from gp;
PerformNow : Boolean = Standard_True)
Create(S1 : Shape from TopoDS;
Sf : Surface from Geom;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Create(Sh : Shape from TopoDS;
Sf : Surface from Geom;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
---Purpose: Constructor with two shapes
-- <S1> - argument
-- <Sf> - tool
-- <PerformNow> - the flag:
-- if <PerformNow>=True - the algorithm is performed immediatly
-- Obsolete
Create(Sf : Surface from Geom;
Sh : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
S2 : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
---Purpose: Constructor with two shapes
-- <Sf> - argument
-- <S2> - tool
-- <PerformNow> - the flag:
-- if <PerformNow>=True - the algorithm is performed immediatly
-- Obsolete
Create(Sf1 : Surface from Geom;
Sf2 : Surface from Geom;
PerformNow : Boolean = Standard_True)
Sf2 : Surface from Geom;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: This and the above classes construct a framework for
-- computing the section lines of:
-- - two shapes Sh1 and Sh2, or
-- - shape Sh and plane Pl, or
-- - shape Sh and surface Sf, or
-- - surface Sf and shape Sh, or
-- - two surfaces Sf1 and Sf2,
-- and builds a result if PerformNow equals true, its
-- default value. If PerformNow equals false, the intersection
-- will be computed later by the function Build.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not
-- chained or grouped in wires. If no intersection edge exists, the
-- result is an empty compound object.
-- Note that other objects than TopoDS_Shape shapes involved in
-- these syntaxes are converted into faces or shells before
-- performing the computation of the intersection. A shape
-- resulting from this conversion can be retrieved with the
-- function Shape1 or Shape2.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for each elementary
-- edge of the result. To attach such parametric curves to the
-- constructed edges you may use a constructor with the PerformNow
-- flag equal to false; then you use:
-- - the function ComputePCurveOn1 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the first shape,
-- - the function ComputePCurveOn2 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the second shape, in the end,
-- - the function Build to construct the result.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge
-- of the result is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve
-- defined in the Geom package; for example, the intersection
-- of a cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If you prefer to have an attached 3D geometry which is a
-- BSpline approximation of the computed set of points on
-- computed elementary intersection edges whose underlying geometry
-- is not analytic, you may use a constructor with the PerformNow
-- flag equal to false. Then you use:
-- - the function Approximation to ask for this
-- computation option, and
-- - the function Build to construct the result.
-- - Note that as a result, approximations will only be
-- computed on edges built on new intersection lines.
-- - Example
-- You may also combine these computation options. In the following example:
-- - each elementary edge of the computed intersection,
-- built on a new intersection line, which does not
-- correspond to an analytic Geom curve, will be approximated by
-- a BSpline curve whose degree is not greater than 8.
-- - each elementary edge built on a new intersection line, will have:
-- - a pcurve in the parametric space of the intersected face of shape S1,
-- - no pcurve in the parametric space of the intersected face of shape S2.
-- // TopoDS_Shape S1 = ... , S2 = ... ;
-- Standard_Boolean PerformNow = Standard_False;
-- BRepAlgoAPI_Section S ( S1, S2, PerformNow );
-- S.ComputePCurveOn1 (Standard_True);
-- S.Approximation (Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
---Purpose:
---Purpose: Constructor with two shapes
-- <Sf1> - argument
-- <Sf2> - tool
-- <PerformNow> - the flag:
-- if <PerformNow>=True - the algorithm is performed immediatly
-- Obsolete
Init1(me : out;
S1 : Shape from TopoDS);
---Purpose: initialize first part
---Level: Public
---Purpose: initialize the argument
-- <S1> - argument
-- Obsolete
Init1(me : out;
Pl : Pln from gp);
---Purpose: initialize first part
---Level: Public
Pl : Pln from gp);
---Purpose: initialize the argument
-- <Pl> - argument
-- Obsolete
Init1(me : out;
Sf : Surface from Geom);
---Purpose: initialize first part
---Level: Public
---Purpose: initialize the argument
-- <Sf> - argument
-- Obsolete
Init2(me : out;
S2 : Shape from TopoDS);
---Purpose: initialize second part
---Level: Public
---Purpose: initialize the tool
-- <S2> - tool
-- Obsolete
Init2(me : out;
Pl : Pln from gp);
---Purpose: initialize second part
---Level: Public
---Purpose: initialize the tool
-- <Pl> - tool
-- Obsolete
Init2(me : out;
Sf : Surface from Geom);
---Purpose: Reinitializes the first and the
-- second parts on which this algorithm is going to perform
-- the intersection computation. This is done with either: the
-- surface Sf, the plane Pl or the shape Sh.
-- You use the function Build to construct the result.
---Purpose: initialize the tool
-- <Sf> - tool
-- Obsolete
Approximation(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose: Defines an option for computation
-- of further intersections. This computation will be performed by
-- the function Build in this framework.
-- By default, the underlying 3D geometry attached to each
-- elementary edge of the result of a computed intersection is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1. If Approx equals
-- true, when further computations are performed in this framework
-- with the function Build, these edges will have an attached 3D
-- geometry which is a BSpline approximation of the computed
-- set of points.
-- Note that as a result, approximations will be computed
-- on edges built only on new intersection lines.
---Purpose:
--Defines an option for computation
-- of further intersections.
-- By default, the underlying 3D geometry attached to each
-- elementary edge of the result is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If Approx equals true, these edges will have an attached 3D
-- geometry which is a BSpline approximation of the computed
-- set of points.
-- Note that as a result, approximations will be computed
-- on edges built only on new intersection curves.
ComputePCurveOn1(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose:
-- Indicates if the Pcurve must be (or not) performed on first part.
---Purpose:
-- Indicates whether the P-Curve should be (or not)
-- performed on the argument.
-- By default, no parametric 2D curve (pcurve) is defined for the
-- edges of the result.
-- If ComputePCurve1 equals true, further computations performed
-- to attach an P-Curve in the parametric space of the argument
-- to the constructed edges.
-- Obsolete
ComputePCurveOn2(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose: Define options for the computation of further
-- intersections, which will be performed by the function Build
-- in this framework.
-- By default, no parametric 2D curve (pcurve) is defined for the
-- elementary edges of the result. If ComputePCurve1 equals true,
-- further computations performed in this framework with the function
-- Build will attach an additional pcurve in the parametric space of
-- the first shape to the constructed edges.
-- If ComputePCurve2 equals true, the additional pcurve will be
-- attached to the constructed edges in the parametric space of the
-- second shape.
-- These two functions may be used together.
Build(me : in out)
is redefined;
---Purpose: Performs the computation of
-- section lines between two parts defined at the time of
-- construction of this framework or reinitialized with the Init1 and
-- Init2 functions.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not chained
-- or grouped into wires.
-- If no intersection edge exists, the result is an empty compound object.
-- The shapes involved in the construction of section lines can
-- be retrieved with the function Shape1 or Shape2. Note that other
-- objects than TopoDS_Shape shapes given as arguments at the
-- construction time of this framework, or to the Init1 or
-- Init2 function, are converted into faces or shells before
-- performing the computation of the intersection.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for the elementary
-- edges of the result. To attach parametric curves like this to
-- the constructed edges you have to use:
-- - the function
-- ComputePCurveOn1 to ask for the additional computation of a
-- pcurve in the parametric space of the first shape,
-- - the function
-- ComputePCurveOn2 to ask for the additional computation of a
-- pcurve in the parametric space of the second shape.
-- This must be done before calling this function.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge of the result is:
-- - analytic (where possible) provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example, the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle; or
-- - elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If, on computed elementary intersection edges whose
-- underlying geometry is not analytic, you prefer to have an
-- attached 3D geometry which is a Bspline approximation of the
-- computed set of points, you have to use the function Approximation
-- to ask for this computation option before calling this function.
-- You may also have combined these computation options: look at the
-- example given above to illustrate the use of the constructors.
---Purpose:
-- Indicates whether the P-Curve should be (or not)
-- performed on the tool.
-- By default, no parametric 2D curve (pcurve) is defined for the
-- edges of the result.
-- If ComputePCurve1 equals true, further computations performed
-- to attach an P-Curve in the parametric space of the tool
-- to the constructed edges.
-- Obsolete
Build(me : in out)
is redefined;
---Purpose: Performs the algorithm
-- Filling interference Data Structure (if it is necessary)
-- Building the result of the operation.
HasAncestorFaceOn1(me;
E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean from Standard;
---Level: Public
---Purpose:
-- get the face of the first part giving section edge <E>.
-- Returns True on the 3 following conditions :
-- 1/ <E> is an edge returned by the Shape() method.
-- 1/ <E> is an edge returned by the Shape() metwod.
-- 2/ First part of section performed is a shape.
-- 3/ <E> is built on a intersection curve (i.e <E>
-- is not the result of common edges)
-- When False, F remains untouched.
-- Obsolete
HasAncestorFaceOn2(me;
E : Shape from TopoDS;
F : out Shape from TopoDS)
@@ -330,15 +272,20 @@ is
-- To use these functions properly, you have to test the returned
-- Boolean value before using the ancestor face: F is significant
-- only if the returned Boolean value equals true.
InitParameters(me: out)
is private;
---Level: Private
-- Obsolete
--
-- protected methods
--
Init(me: out;
PerformNow : Boolean)
is protected;
SetAttributes (me:out)
is redefined protected;
fields
myshapeisnull : Boolean from Standard;
myparameterschanged : Boolean from Standard;
myParametersChanged : Boolean from Standard;
myApprox : Boolean from Standard;
myComputePCurve1 : Boolean from Standard;
myComputePCurve2 : Boolean from Standard;

View File

@@ -32,9 +32,10 @@
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_Section.hxx>
//
static
@@ -45,7 +46,12 @@ static
const TopoDS_Shape&,
TopoDS_Shape&,
TopoDS_Shape&);
static
Standard_Boolean HasAncestorFace (const BOPAlgo_PPaveFiller& ,
Standard_Integer ,
const TopoDS_Shape& ,
TopoDS_Shape& );
//
//=======================================================================
//function : BRepAlgoAPI_Section
//purpose :
@@ -54,27 +60,17 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_SECTION;
InitParameters();
Init(Standard_False);
}
//=======================================================================
//function : ~BRepAlgoAPI_Section
//function : BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const BOPAlgo_PaveFiller& aPF)
:
BRepAlgoAPI_BooleanOperation(aPF)
{
}
//=======================================================================
//function : InitParameters
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::InitParameters()
{
myparameterschanged = Standard_False;
myshapeisnull = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
Init(Standard_False);
}
//=======================================================================
//function : Constructor
@@ -84,17 +80,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
const TopoDS_Shape& Sh2,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(Sh1,
Sh2,
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : BRepAlgoAPI_Section
@@ -106,18 +96,12 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(aS1,
aS2,
aDSF,
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -128,18 +112,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)),
BRepAlgoAPI_BooleanOperation(Sh,
MakeShape(new Geom_Plane(Pl)),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -150,17 +127,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(Sh,
MakeShape(Sf),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -171,17 +142,11 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
BRepAlgoAPI_BooleanOperation(MakeShape(Sf),
Sh,
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || Sh.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
Init(PerformNow);
}
//=======================================================================
//function : Constructor
@@ -196,14 +161,29 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
MakeShape(Sf2),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
myshapeisnull = Standard_True;
}
if (PerformNow) {
Init(PerformNow);
}
//=======================================================================
//function : ~BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
{
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::Init(const Standard_Boolean bFlag)
{
myOperation=BOPAlgo_SECTION;
myParametersChanged = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
myParametersChanged = Standard_True;
//
if (bFlag) {
Build();
}
}
@@ -213,26 +193,9 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section
//=======================================================================
void BRepAlgoAPI_Section::Init1(const TopoDS_Shape& S1)
{
if(!S1.IsNull()) {
if (!S1.IsEqual(myS1)) {
myS1 = S1;
if(!myS2.IsNull()) {
myshapeisnull = Standard_False;
}
myparameterschanged = Standard_True;
}
}
else {
if(!myS1.IsNull()) {
myS1 = S1;
myshapeisnull = Standard_True;
myparameterschanged = Standard_True;
}
}
if(myparameterschanged)
NotDone();
myArguments.Clear();
myArguments.Append(S1);
myParametersChanged = Standard_True;
}
//=======================================================================
//function : Init1
@@ -256,27 +219,9 @@ void BRepAlgoAPI_Section::Init1(const Handle(Geom_Surface)& Sf)
//=======================================================================
void BRepAlgoAPI_Section::Init2(const TopoDS_Shape& S2)
{
if(!S2.IsNull()) {
if (!S2.IsEqual(myS2)) {
myS2 = S2;
if(!myS1.IsNull()) {
myshapeisnull = Standard_False;
}
myparameterschanged = Standard_True;
}
}
else {
if(!myS2.IsNull()) {
myS2 = S2;
myshapeisnull = Standard_True;
myparameterschanged = Standard_True;
}
}
if(myparameterschanged) {
NotDone();
}
myTools.Clear();
myTools.Append(S2);
myParametersChanged = Standard_True;
}
//=======================================================================
//function : Init2
@@ -302,7 +247,7 @@ void BRepAlgoAPI_Section::Approximation(const Standard_Boolean B)
{
if(myApprox != B) {
myApprox = B;
myparameterschanged = Standard_True;
myParametersChanged = Standard_True;
}
}
//=======================================================================
@@ -313,7 +258,7 @@ void BRepAlgoAPI_Section::ComputePCurveOn1(const Standard_Boolean B)
{
if(myComputePCurve1 != B) {
myComputePCurve1 = B;
myparameterschanged = Standard_True;
myParametersChanged = Standard_True;
}
}
//=======================================================================
@@ -324,133 +269,125 @@ void BRepAlgoAPI_Section::ComputePCurveOn2(const Standard_Boolean B)
{
if(myComputePCurve2 != B) {
myComputePCurve2 = B;
myparameterschanged = Standard_True;
myParametersChanged = Standard_True;
}
}
//=======================================================================
//function : SetAttributes
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::SetAttributes()
{
BOPAlgo_SectionAttribute theSecAttr(myApprox,
myComputePCurve1,
myComputePCurve2);
myDSFiller->SetSectionAttribute(theSecAttr);
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::Build()
{
if(myshapeisnull) {
myErrorStatus = 2;
NotDone();
return;
}
if(myparameterschanged) {
Standard_Boolean bIsNewFiller = PrepareFiller();
//
if (myErrorStatus!=1) {
NotDone();
// there were errors during the preparation
return;
}
//
if (bIsNewFiller) {
BOPAlgo_SectionAttribute theSecAttr(myApprox,
myComputePCurve1,
myComputePCurve2);
myDSFiller->SetSectionAttribute(theSecAttr);
myDSFiller->Perform();
}
//
BRepAlgoAPI_BooleanOperation::Build();
//
myparameterschanged = Standard_False;
}
BRepAlgoAPI_BooleanOperation::Build();
}
//=======================================================================
//function : HasAncestorFaceOn1
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
(const TopoDS_Shape& aE,
TopoDS_Shape& aF) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
return aResult;
}
if(E.ShapeType() != TopAbs_EDGE) {
return aResult;
}
TopoDS_Shape F1, F2;
aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
if(F1.IsNull()) {
return Standard_False;
}
F = F1;
return aResult;
Standard_Boolean bRes;
//
bRes = HasAncestorFace(myDSFiller,1 , aE, aF);
return bRes;
}
//=======================================================================
//function : HasAncestorFaceOn2
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
(const TopoDS_Shape& aE,
TopoDS_Shape& aF) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
return aResult;
Standard_Boolean bRes;
//
bRes = HasAncestorFace(myDSFiller, 2, aE, aF);
return bRes;
}
//=======================================================================
//function : HasAncestorFace
//purpose :
//=======================================================================
Standard_Boolean HasAncestorFace (const BOPAlgo_PPaveFiller& pPF,
Standard_Integer aIndex,
const TopoDS_Shape& aE,
TopoDS_Shape& aF)
{
Standard_Boolean bRes;
//
bRes = Standard_False;
if(aE.IsNull()) {
return bRes;
}
if(E.ShapeType() != TopAbs_EDGE) {
return aResult;
if(aE.ShapeType() != TopAbs_EDGE) {
return bRes;
}
TopoDS_Shape F1, F2;
aResult = HasAncestorFaces(myDSFiller, E, F1, F2);
if(F2.IsNull()) {
return Standard_False;
//
TopoDS_Shape aF1, aF2;
//
bRes=HasAncestorFaces(pPF, aE, aF1, aF2);
if (!bRes) {
return bRes;
}
F = F2;
return aResult;
//
aF=(aIndex==1) ? aF1 : aF2;
return bRes;
}
//=======================================================================
//function : HasAncestorFaces
//purpose :
//=======================================================================
Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape&F2)
Standard_Boolean HasAncestorFaces (const BOPAlgo_PPaveFiller& pPF,
const TopoDS_Shape& aEx,
TopoDS_Shape& aF1,
TopoDS_Shape& aF2)
{
Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;
Standard_Integer aNbFF, i, j, nE, nF1, nF2, aNbVC;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
//
const BOPDS_PDS& pDS = theDSFiller->PDS();
const BOPDS_PDS& pDS = pPF->PDS();
BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
//
aNb=aFFs.Extent();
//section edges
for (i = 0; i < aNb; i++) {
aNbFF=aFFs.Extent();
for (i = 0; i<aNbFF; ++i) {
BOPDS_InterfFF& aFFi=aFFs(i);
aFFi.Indices(nF1, nF2);
//
const BOPDS_VectorOfCurve& aSeqOfCurve=aFFi.Curves();
aNbCurves=aSeqOfCurve.Extent();
for (j=0; j<aNbCurves; j++) {
const BOPDS_Curve& aCurve=aSeqOfCurve(j);
const BOPDS_ListOfPaveBlock& aSectEdges = aCurve.PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock anIt;
anIt.Initialize(aSectEdges);
for(; anIt.More(); anIt.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = anIt.Value();
const BOPDS_VectorOfCurve& aVC=aFFi.Curves();
aNbVC=aVC.Extent();
for (j=0; j<aNbVC; j++) {
const BOPDS_Curve& aBC=aVC(j);
//
const BOPDS_ListOfPaveBlock& aLPB = aBC.PaveBlocks();
//
aItLPB.Initialize(aLPB);
for(; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = aItLPB.Value();
nE = aPB->Edge();
if(nE < 0) continue;
if(nE < 0) {
continue;
}
//
if(E.IsSame(pDS->Shape(nE))) {
F1 = pDS->Shape(nF1);
F2 = pDS->Shape(nF2);
const TopoDS_Shape aE=pDS->Shape(nE);
if(aEx.IsSame(aE)) {
aF1 = pDS->Shape(nF1);
aF2 = pDS->Shape(nF2);
return Standard_True;
}
}

View File

@@ -76,6 +76,8 @@
#include <TopTools_IndexedMapOfOrientedShape.hxx>
#include <ElCLib.hxx>
#include <GCPnts_AbscissaPoint.hxx>
static void Propagate(const TopTools_IndexedDataMapOfShapeListOfShape&,
const TopoDS_Shape&, // edge
@@ -374,114 +376,177 @@ BRepCheck_Status BRepCheck_Wire::Closed(const Standard_Boolean Update)
Standard_Boolean IsDistanceIn3DTolerance (const gp_Pnt& thePnt_f,
const gp_Pnt& thePnt_l,
const Standard_Real aTol3d)
{
Standard_Real Dist = thePnt_f.Distance(thePnt_l);
{
Standard_Real Dist = thePnt_f.Distance(thePnt_l);
if (Dist < aTol3d)
return Standard_True;
#ifdef OCCT_DEBUG
cout << endl;
cout << "--------Function IsDistanceIn3DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Closed3d -> Error" << endl;
cout << "--- Dist (" << Dist << ") > Tol3d (" << aTol3d << ")" << endl;
cout << "Pnt1(" << thePnt_f.X() << "; " << thePnt_f.Y() << "; " << thePnt_f.Z() << ")" << endl;
cout << "Pnt2(" << thePnt_l.X() << "; " << thePnt_l.Y() << "; " << thePnt_l.Z() << ")" << endl;
cout << "------------------------------------------------------" << endl;
cout << "--------Function IsDistanceIn3DTolerance(...)----------"
<< endl;
cout << "--- BRepCheck Wire: Closed3d -> Error"
<< endl;
cout << "--- Dist (" << Dist << ") > Tol3d (" << aTol3d << ")"
<< endl;
cout << "Pnt1(" << thePnt_f.X() << "; " << thePnt_f.Y() << "; " << thePnt_f.Z() << ")"
<< endl;
cout << "Pnt2(" << thePnt_l.X() << "; " << thePnt_l.Y() << "; " << thePnt_l.Z() << ")"
<< endl;
cout << "------------------------------------------------------"
<< endl;
#endif
return Standard_False;
}
}
//=======================================================================
//function : IsDistanceIn3DTolerance
//function : IsDistanceIn2DTolerance
//purpose :
//=======================================================================
static
Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurface,
const gp_Pnt2d& thePnt,
const gp_Pnt2d& thePntRef,
const Standard_Real aTol3d,
#ifdef OCCT_DEBUG
const Standard_Boolean PrintWarnings = Standard_True)
#else
const Standard_Boolean = Standard_True)
#endif
const Standard_Real aTol3d)
{
Standard_Real dumax = 0.01 * (aFaceSurface.LastUParameter() - aFaceSurface.FirstUParameter());
Standard_Real dvmax = 0.01 * (aFaceSurface.LastVParameter() - aFaceSurface.FirstVParameter());
Standard_Real dumin = Abs(thePnt.X() - thePntRef.X());
Standard_Real dvmin = Abs(thePnt.Y() - thePntRef.Y());
const Standard_Real aLengthTol = Precision::Confusion();
const Standard_Real aFactor = 0.01;
const Standard_Real aDeltaUPar = (aFaceSurface.LastUParameter() -
aFaceSurface.FirstUParameter());
const Standard_Real aDeltaVPar = (aFaceSurface.LastVParameter() -
aFaceSurface.FirstVParameter());
const Standard_Real aDist2dU = Abs(thePnt.X() - thePntRef.X());
const Standard_Real aDist2dV = Abs(thePnt.Y() - thePntRef.Y());
if((dumin < dumax) && (dvmin < dvmax))
if((aDist2dU < (aFactor*aDeltaUPar)) && (aDist2dV < (aFactor*aDeltaVPar)))
return Standard_True;
#ifdef OCCT_DEBUG
if(PrintWarnings)
{
cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Not closed in 2D" << endl;
cout << "*****************************************************" << endl;
cout << "*dumin = " << dumin << "; dumax = " << dumax << endl;
cout << "* dvmin = " << dvmin << "; dvmax = " << dvmax << endl;
cout << "* (dumin > dumax) or (dvmin > dvmax)." << endl;
cout << "*****************************************************" << endl;
cout << endl;
cout << "UFirst = " << aFaceSurface.FirstUParameter();
cout << "; ULast = " << aFaceSurface.LastUParameter() << endl;
cout << "VFirst = " << aFaceSurface.FirstVParameter();
cout << "; VLast = " << aFaceSurface.LastVParameter() << endl;
}
cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Not closed in 2D" << endl;
cout << "*****************************************************" << endl;
cout << "* aDist2dU = " << aDist2dU << "; aDeltaUPar = " << aFactor*aDeltaUPar<< endl;
cout << "* aDist2dV = " << aDist2dV << "; aDeltaVPar = " << aFactor*aDeltaVPar<< endl;
cout << "* (aDist2dU > aDeltaUPar) or (aDist2dV > aDeltaVPar)." << endl;
cout << "*****************************************************" << endl;
cout << endl;
cout << "UFirst = " << aFaceSurface.FirstUParameter();
cout << "; ULast = " << aFaceSurface.LastUParameter() << endl;
cout << "VFirst = " << aFaceSurface.FirstVParameter();
cout << "; VLast = " << aFaceSurface.LastVParameter() << endl;
dumax = aFaceSurface.UResolution(aTol3d);
dvmax = aFaceSurface.VResolution(aTol3d);
if(PrintWarnings)
{
cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl;
cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl;
cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl;
}
#else
dumax = aFaceSurface.UResolution(aTol3d);
dvmax = aFaceSurface.VResolution(aTol3d);
cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl;
cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl;
#endif
Standard_Real aTol2d = 2*Max( dumax, dvmax);
const Standard_Real aU0 = thePntRef.X(), aV0 = thePntRef.Y();
Adaptor3d_Curve* aCu = new GeomAdaptor_Curve(aFaceSurface.Surface().Surface()->UIso(aU0));
Adaptor3d_Curve* aCv = new GeomAdaptor_Curve(aFaceSurface.Surface().Surface()->VIso(aV0));
#ifdef OCCT_DEBUG
if((aTol2d <= 0.0) && (PrintWarnings))
//For line and circle the resolution is independent of the point on curve
const Standard_Boolean isUAnalitic = ((aCu->GetType() == GeomAbs_Line) ||
(aCu->GetType() == GeomAbs_Circle));
const Standard_Boolean isVAnalitic = ((aCv->GetType() == GeomAbs_Line) ||
(aCv->GetType() == GeomAbs_Circle));
Standard_Real aUTol = 0.0;
Standard_Real aVTol = 0.0;
if(!isUAnalitic)
{
Standard_Real aLR = aTol3d;
if(2.0*aU0 > (aFaceSurface.LastUParameter() +
aFaceSurface.FirstUParameter()))
{
cout<<"BRepCheck_Wire : UResolution and VResolution = 0.0 (Face too small ?)"<<endl;
cout.flush();
aLR = -aLR;
}
#endif
//Standard_Real Dist = thePntRef.Distance(thePnt);
Standard_Real Dist = Max(dumin, dvmin);
if (Dist < aTol2d)
return Standard_True;
#ifdef OCCT_DEBUG
if(PrintWarnings)
GCPnts_AbscissaPoint aGAu(aLengthTol, *aCu, aLR, aU0);
if(aGAu.IsDone())
{
cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Not closed in 2d" << endl;
cout << "*****************************************************" << endl;
cout << "* Dist = " << Dist << " > Tol2d = " << aTol2d << endl;
cout << "*****************************************************" << endl;
cout << "aTol3d = " << aTol3d <<"; URes = " << dumax << "; VRes = " << dvmax << endl;
cout << "thePnt(" << thePnt.X() << "; " << thePnt.Y() << ")" << endl;
cout << "thePntRef(" << thePntRef.X() << "; " << thePntRef.Y() << ")" << endl;
aUTol = Abs(aGAu.Parameter() - aU0);
}
else
{
aUTol = aFaceSurface.UResolution(aTol3d);
}
#endif
return Standard_False;
}
else
{
aUTol = aFaceSurface.UResolution(aTol3d);
}
if(!isVAnalitic)
{
Standard_Real aLR = aTol3d;
if(2.0*aV0 > (aFaceSurface.LastVParameter() +
aFaceSurface.FirstVParameter()))
{
aLR = -aLR;
}
GCPnts_AbscissaPoint aGAv(aLengthTol, *aCv, aLR, aV0);
if(aGAv.IsDone())
{
aVTol = Abs(aGAv.Parameter() - aV0);
}
else
{
aVTol = aFaceSurface.VResolution(aTol3d);
}
}
else
{
aVTol = aFaceSurface.VResolution(aTol3d);
}
if(aUTol - aDeltaUPar >= aLengthTol)
{//Singular case
aUTol = 0.0;
}
if(aVTol - aDeltaVPar >= aLengthTol)
{//Singular case
aVTol = 0.0;
}
#ifdef OCCT_DEBUG
if(IsEqual(aUTol, 0.0) || IsEqual(aVTol, 0.0))
{
cout << "BRepCheck_Wire: UResolution and VResolution = 0.0."
" Is face too small?" << endl;
}
cout << "*****************************************************" << endl;
cout << "aTol3d = " << aTol3d <<"; URes = " << aUTol << "; VRes = " << aVTol << endl;
cout << "*****************************************************" << endl;
#endif
if(aDist2dU > aUTol)
{
#ifdef OCCT_DEBUG
cout << "(aDist2dU > URes)" << endl;
#endif
return Standard_False;
}
if(aDist2dV > aVTol)
{
#ifdef OCCT_DEBUG
cout << "(aDist2dV > VRes)" << endl;
#endif
return Standard_False;
}
return Standard_True;
}
//=======================================================================
//function : Closed2d
@@ -489,16 +554,16 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
//=======================================================================
BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
const Standard_Boolean Update)
{
{
// 3d closure checked too
BRepCheck_Status aClosedStat = Closed();
if (aClosedStat != BRepCheck_NoError)
{
{
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
// 20/03/02 akm vvv : (OCC234) Hence this method will be used to check
// both periodic and non-periodic faces
@@ -516,18 +581,18 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
Standard_Integer aNbOrirntedEdges = 0;
TopExp_Explorer anEdgeExp(myShape,TopAbs_EDGE);
for (;anEdgeExp.More(); anEdgeExp.Next())
{
{
if (IsOriented(anEdgeExp.Current()))
aNbOrirntedEdges++;
}
}
if (aNbOrirntedEdges==0)
{
{
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
// all those edges must form a closed 2d contour and be found by WireExplorer
@@ -538,19 +603,19 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
TopoDS_Edge aLastEdge;
for (;aWireExp.More(); aWireExp.Next())
{
{
aNbFoundEdges++;
aLastEdge = aWireExp.Current();
}
}
if (aNbFoundEdges != aNbOrirntedEdges)
{
{
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
// Check distance between 2d ends of first and last edges
// Modified by Sergey KHROMOV - Mon May 13 12:42:10 2002 Begin
@@ -564,32 +629,36 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
anOri = aFirstEdge.Orientation();
BRep_Tool::Range(aFirstEdge, aF, aL);
if ((anOri == TopAbs_FORWARD && Precision::IsNegativeInfinite( aF )) ||
(anOri == TopAbs_REVERSED && Precision::IsPositiveInfinite( aL )))
(anOri == TopAbs_REVERSED && Precision::IsPositiveInfinite( aL )))
{
isFirstInfinite = Standard_True;
}
anOri = aLastEdge.Orientation();
BRep_Tool::Range(aLastEdge, aF, aL);
if ((anOri == TopAbs_FORWARD && Precision::IsPositiveInfinite( aL )) ||
(anOri == TopAbs_REVERSED && Precision::IsNegativeInfinite( aF )))
(anOri == TopAbs_REVERSED && Precision::IsNegativeInfinite( aF )))
{
isLastInfinite = Standard_True;
}
if (isFirstInfinite && isLastInfinite)
{
{
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
else if (aFirstVertex.IsNull())
{
{
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
// Modified by Sergey KHROMOV - Mon May 13 12:42:10 2002 End
gp_Pnt2d aP_first, aP_last, aP_temp; // ends of prev edge, next edge, bidon
@@ -606,6 +675,8 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
// aUResol = 2*aFaceSurface.UResolution(aTol);
// aVResol = 2*aFaceSurface.VResolution(aTol);
Standard_Real aTol3d = Max(BRep_Tool::Tolerance(aFirstVertex),BRep_Tool::Tolerance(aWireExp.CurrentVertex()));
// get first point
if (aFirstEdge.Orientation() == TopAbs_REVERSED)
BRep_Tool::UVPoints(aFirstEdge, theFace, aP_temp, aP_first);
@@ -615,13 +686,13 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
// Modified by Sergey KHROMOV - Thu Jun 20 10:55:42 2002 OCC325 Begin
// Check 2d distance for periodic faces with seam edge
if (!IsClosed2dForPeriodicFace(theFace, aP_first, aP_last, aFirstVertex))
{
{
aClosedStat = BRepCheck_NotClosed;
if (Update)
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
// Modified by Sergey KHROMOV - Thu Jun 20 10:58:05 2002 End
// check distance
@@ -630,8 +701,6 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
// if (dfUDist > aUResol || dfVDist > aVResol)
// {
Standard_Real aTol3d = Max(BRep_Tool::Tolerance(aFirstVertex),BRep_Tool::Tolerance(aWireExp.CurrentVertex()));
gp_Pnt aPntRef = BRep_Tool::Pnt(aFirstVertex);
gp_Pnt aPnt = BRep_Tool::Pnt(aWireExp.CurrentVertex());
@@ -645,7 +714,8 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
BRepCheck::Add(myMap(myShape),aClosedStat);
return aClosedStat;
}
}
//=======================================================================
//function : Orientation
//purpose :
@@ -1653,7 +1723,7 @@ void ChoixUV(const TopoDS_Vertex& theVertex,
aParam =(aVOrientation != anE.Orientation()) ? aFirstParam : aLastParam;
aPnt = C2d->Value(aParam);
if(!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d, Standard_False))
if(!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d))
continue;
CurveDirForParameter(C2d, aParam, aPnt, aDer);

View File

@@ -48,6 +48,7 @@ uses
Cone from gp,
Sphere from gp,
Torus from gp,
Curve from Geom,
Surface from Geom,
Face from TopoDS,
Wire from TopoDS,
@@ -258,6 +259,18 @@ is
NotDone from StdFail
is static;
IsDegenerated (myclass;
theCurve : Curve from Geom;
theMaxTol : Real from Standard;
theActTol : in out Real from Standard)
returns Boolean;
--- Purpose: Checks the specified curve is degenerated
-- according to specified tolerance.
-- Returns <theActTol> less than <theMaxTol>, which shows
-- actual tolerance to decide the curve is degenerated.
-- Warning: For internal use of BRepLib_MakeFace and BRepLib_MakeShell.
fields
myError : FaceError from BRepLib;
end MakeFace;

View File

@@ -427,9 +427,10 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& S,
// passed tolerance value
//=======================================================================
static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& theCurve,
const Standard_Real theMaxTol,
Standard_Real& theActTol)
Standard_Boolean BRepLib_MakeFace::IsDegenerated(
const Handle(Geom_Curve)& theCurve,
const Standard_Real theMaxTol,
Standard_Real& theActTol)
{
GeomAdaptor_Curve AC(theCurve);
Standard_Real aConfusion = Precision::Confusion();

View File

@@ -17,6 +17,7 @@
#include <BRepLib_MakeShell.ixx>
#include <BRepLib.hxx>
#include <BRepLib_MakeFace.hxx>
#include <Precision.hxx>
#include <TColStd_Array1OfReal.hxx>
@@ -35,6 +36,8 @@
#include <TopTools_Array1OfShape.hxx>
#include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
//=======================================================================
//function : BRepLib_MakeShell
@@ -354,6 +357,20 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
BRepLib::BuildCurves3d(myShape,tol);
BRepLib::EncodeRegularity(myShape);
myShape.Closed (BRep_Tool::IsClosed (myShape));
// Additional checking for degenerated edges
Standard_Boolean isDegenerated;
Standard_Real aFirst, aLast;
Standard_Real aTol = Precision::Confusion();
Standard_Real anActTol;
TopExp_Explorer anExp(myShape, TopAbs_EDGE);
for ( ; anExp.More(); anExp.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
isDegenerated = BRepLib_MakeFace::IsDegenerated(aCurve, aTol, anActTol);
B.Degenerated(anEdge, isDegenerated);
}
myError = BRepLib_ShellDone;
Done();

View File

@@ -86,16 +86,17 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_FastDiscret, Standard_Transient)
//purpose :
//=======================================================================
BRepMesh_FastDiscret::BRepMesh_FastDiscret(
const Standard_Real theDefle,
const Standard_Real theAngl,
const Bnd_Box& theBox,
const Standard_Boolean theWithShare,
const Standard_Boolean theInshape,
const Standard_Boolean theRelative,
const Standard_Boolean theShapetrigu,
const Standard_Boolean isInParallel,
const Standard_Real theMinSize,
const Standard_Boolean isInternalVerticesMode)
const Standard_Real theDefle,
const Standard_Real theAngl,
const Bnd_Box& theBox,
const Standard_Boolean theWithShare,
const Standard_Boolean theInshape,
const Standard_Boolean theRelative,
const Standard_Boolean theShapetrigu,
const Standard_Boolean isInParallel,
const Standard_Real theMinSize,
const Standard_Boolean isInternalVerticesMode,
const Standard_Boolean isControlSurfaceDeflection)
: myAngle (theAngl),
myDeflection (theDefle),
myWithShare (theWithShare),
@@ -106,7 +107,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
myMinSize(theMinSize),
myInternalVerticesMode(isInternalVerticesMode)
myInternalVerticesMode(isInternalVerticesMode),
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
{
if ( myRelative )
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
@@ -127,7 +129,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
const Standard_Boolean theShapetrigu,
const Standard_Boolean isInParallel,
const Standard_Real theMinSize,
const Standard_Boolean isInternalVerticesMode)
const Standard_Boolean isInternalVerticesMode,
const Standard_Boolean isControlSurfaceDeflection)
: myAngle (theAngl),
myDeflection (theDefle),
myWithShare (theWithShare),
@@ -138,7 +141,8 @@ BRepMesh_FastDiscret::BRepMesh_FastDiscret(
myBoundaryVertices(new BRepMesh::DMapOfVertexInteger),
myBoundaryPoints(new BRepMesh::DMapOfIntegerPnt),
myMinSize(theMinSize),
myInternalVerticesMode(isInternalVerticesMode)
myInternalVerticesMode(isInternalVerticesMode),
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
{
if ( myRelative )
BRepMesh_ShapeTool::BoxMaxDimension(theBox, myDtotale);
@@ -202,7 +206,8 @@ void BRepMesh_FastDiscret::Process(const TopoDS_Face& theFace) const
{
OCC_CATCH_SIGNALS
BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize, myInternalVerticesMode);
BRepMesh_FastDiscretFace aTool(GetAngle(), myMinSize,
myInternalVerticesMode, myIsControlSurfaceDeflection);
aTool.Perform(anAttribute);
}
catch (Standard_Failure)

View File

@@ -58,16 +58,18 @@ class BRepMesh_FastDiscret : public Standard_Transient
{
public:
Standard_EXPORT BRepMesh_FastDiscret(const Standard_Real defle,
const Standard_Real angle,
const Bnd_Box& B,
const Standard_Boolean withShare = Standard_True,
const Standard_Boolean inshape = Standard_False,
const Standard_Boolean relative = Standard_False,
const Standard_Boolean shapetrigu = Standard_False,
const Standard_Boolean isInParallel = Standard_False,
const Standard_Real theMinSize = Precision::Confusion(),
const Standard_Boolean isInternalVerticesMode = Standard_True);
Standard_EXPORT BRepMesh_FastDiscret(
const Standard_Real defle,
const Standard_Real angle,
const Bnd_Box& B,
const Standard_Boolean withShare = Standard_True,
const Standard_Boolean inshape = Standard_False,
const Standard_Boolean relative = Standard_False,
const Standard_Boolean shapetrigu = Standard_False,
const Standard_Boolean isInParallel = Standard_False,
const Standard_Real theMinSize = Precision::Confusion(),
const Standard_Boolean isInternalVerticesMode = Standard_True,
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
//! if the boolean <relative> is True, the <br>
//! deflection used for the polygonalisation of <br>
@@ -81,17 +83,19 @@ public:
//! <br>
//! if <inshape> is True, the calculated <br>
//! triangulation will be stored in the shape. <br>
Standard_EXPORT BRepMesh_FastDiscret(const TopoDS_Shape& shape,
const Standard_Real defle,
const Standard_Real angle,
const Bnd_Box& B,
const Standard_Boolean withShare = Standard_True,
const Standard_Boolean inshape = Standard_False,
const Standard_Boolean relative = Standard_False,
const Standard_Boolean shapetrigu = Standard_False,
const Standard_Boolean isInParallel = Standard_False,
const Standard_Real theMinSize = Precision::Confusion(),
const Standard_Boolean isInternalVerticesMode = Standard_True);
Standard_EXPORT BRepMesh_FastDiscret(
const TopoDS_Shape& shape,
const Standard_Real defle,
const Standard_Real angle,
const Bnd_Box& B,
const Standard_Boolean withShare = Standard_True,
const Standard_Boolean inshape = Standard_False,
const Standard_Boolean relative = Standard_False,
const Standard_Boolean shapetrigu = Standard_False,
const Standard_Boolean isInParallel = Standard_False,
const Standard_Real theMinSize = Precision::Confusion(),
const Standard_Boolean isInternalVerticesMode = Standard_True,
const Standard_Boolean isControlSurfaceDeflection = Standard_True);
//! Build triangulation on the whole shape.
Standard_EXPORT void Perform(const TopoDS_Shape& shape);
@@ -369,6 +373,7 @@ private:
Standard_Real myMinSize;
Standard_Boolean myInternalVerticesMode;
Standard_Boolean myIsControlSurfaceDeflection;
};
DEFINE_STANDARD_HANDLE(BRepMesh_FastDiscret, Standard_Transient)

View File

@@ -145,10 +145,12 @@ namespace
BRepMesh_FastDiscretFace::BRepMesh_FastDiscretFace(
const Standard_Real theAngle,
const Standard_Real theMinSize,
const Standard_Boolean isInternalVerticesMode)
const Standard_Boolean isInternalVerticesMode,
const Standard_Boolean isControlSurfaceDeflection)
: myAngle(theAngle),
myInternalVerticesMode(isInternalVerticesMode),
myMinSize(theMinSize)
myMinSize(theMinSize),
myIsControlSurfaceDeflection(isControlSurfaceDeflection)
{
}
@@ -387,7 +389,8 @@ void BRepMesh_FastDiscretFace::add(const Handle(BRepMesh_FaceAttribute)& theAttr
insertInternalVertices(aNewVertices, trigu);
//control internal points
aDef = control(aNewVertices, trigu, Standard_False);
if (myIsControlSurfaceDeflection)
aDef = control(aNewVertices, trigu, Standard_False);
}
}

View File

@@ -54,10 +54,13 @@ public:
//! @param theAngle deviation angle to be used for surface tessellation.
//! @param isInternalVerticesMode flag enabling/disabling internal
//! vertices mode.
//! @param isControlSurfaceDeflection enables/disables adaptive
//! reconfiguration of mesh.
Standard_EXPORT BRepMesh_FastDiscretFace(
const Standard_Real theAngle,
const Standard_Real theMinSize,
const Standard_Boolean isInternalVerticesMode);
const Standard_Boolean isInternalVerticesMode,
const Standard_Boolean isControlSurfaceDeflection);
Standard_EXPORT void Perform(const Handle(BRepMesh_FaceAttribute)& theAttribute);
@@ -191,6 +194,7 @@ private:
Handle(BRepMesh_DataStructureOfDelaun) myStructure;
Standard_Real myMinSize;
Standard_Boolean myIsControlSurfaceDeflection;
};
DEFINE_STANDARD_HANDLE (BRepMesh_FastDiscretFace, Standard_Transient)

View File

@@ -75,7 +75,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh()
: myRelative (Standard_False),
myInParallel(Standard_False),
myMinSize (Precision::Confusion()),
myInternalVerticesMode(Standard_True)
myInternalVerticesMode(Standard_True),
myIsControlSurfaceDeflection(Standard_True)
{
}
@@ -92,7 +93,8 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
: myRelative (isRelative),
myInParallel(isInParallel),
myMinSize (Precision::Confusion()),
myInternalVerticesMode(Standard_True)
myInternalVerticesMode(Standard_True),
myIsControlSurfaceDeflection(Standard_True)
{
myDeflection = theLinDeflection;
myAngle = theAngDeflection;
@@ -149,7 +151,7 @@ void BRepMesh_IncrementalMesh::init()
myMesh = new BRepMesh_FastDiscret(myDeflection,
myAngle, aBox, Standard_True, Standard_True,
myRelative, Standard_True, myInParallel, myMinSize,
myInternalVerticesMode);
myInternalVerticesMode, myIsControlSurfaceDeflection);
myMesh->InitSharedFaces(myShape);
}

View File

@@ -115,7 +115,7 @@ public: //! @name accessing to parameters.
return myMinSize;
}
//! Enables/disables internal vertices mode.
//! Enables/disables internal vertices mode (enabled by default).
inline void SetInternalVerticesMode(const Standard_Boolean isEnabled)
{
myInternalVerticesMode = isEnabled;
@@ -127,6 +127,20 @@ public: //! @name accessing to parameters.
return myInternalVerticesMode;
}
//! Enables/disables control of deflection of mesh from real surface
//! (enabled by default).
inline void SetControlSurfaceDeflection(const Standard_Boolean isEnabled)
{
myIsControlSurfaceDeflection = isEnabled;
}
//! Returns flag indicating is adaptive reconfiguration
//! of mesh enabled/disabled.
inline Standard_Boolean IsControlSurfaceDeflection() const
{
return myIsControlSurfaceDeflection;
}
public: //! @name plugin API
//! Plugin interface for the Mesh Factories.
@@ -219,6 +233,7 @@ protected:
NCollection_Vector<TopoDS_Face> myFaces;
Standard_Real myMinSize;
Standard_Boolean myInternalVerticesMode;
Standard_Boolean myIsControlSurfaceDeflection;
};
DEFINE_STANDARD_HANDLE(BRepMesh_IncrementalMesh,BRepMesh_DiscretRoot)

View File

@@ -50,6 +50,7 @@
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <OSD_OpenFile.hxx>
#include <errno.h>
@@ -150,8 +151,8 @@ void BRepTools::AddUVBounds(const TopoDS_Face& F,
//purpose :
//=======================================================================
void BRepTools::AddUVBounds(const TopoDS_Face& aF,
const TopoDS_Edge& aE,
Bnd_Box2d& aB)
const TopoDS_Edge& aE,
Bnd_Box2d& aB)
{
Standard_Real aT1, aT2, aXmin, aYmin, aXmax, aYmax;
Standard_Real aUmin, aUmax, aVmin, aVmax;
@@ -179,26 +180,163 @@ void BRepTools::AddUVBounds(const TopoDS_Face& aF,
//
if(!aS->IsUPeriodic())
{
if((aXmin<aUmin) && (aUmin < aXmax))
Standard_Boolean isUPeriodic = Standard_False;
// Additional verification for U-periodicity for B-spline surfaces
// 1. Verify that the surface is U-closed (if such flag is false). Verification uses 2 points
// 2. Verify periodicity of surface inside UV-bounds of the edge. Verification uses 3 or 6 points.
if (aS->DynamicType() == STANDARD_TYPE(Geom_BSplineSurface) &&
(aXmin < aUmin || aXmax > aUmax))
{
aXmin=aUmin;
Standard_Real aTol2 = 100 * Precision::Confusion() * Precision::Confusion();
isUPeriodic = Standard_True;
gp_Pnt P1, P2;
// 1. Verify that the surface is U-closed
if (!aS->IsUClosed())
{
Standard_Real aVStep = aVmax - aVmin;
for (Standard_Real aV = aVmin; aV <= aVmax; aV += aVStep)
{
P1 = aS->Value(aUmin, aV);
P2 = aS->Value(aUmax, aV);
if (P1.SquareDistance(P2) > aTol2)
{
isUPeriodic = Standard_False;
break;
}
}
}
// 2. Verify periodicity of surface inside UV-bounds of the edge
if (isUPeriodic) // the flag still not changed
{
Standard_Real aV = (aVmin + aVmax) * 0.5;
Standard_Real aU[6]; // values of U lying out of surface boundaries
Standard_Real aUpp[6]; // corresponding U-values plus/minus period
Standard_Integer aNbPnt = 0;
if (aXmin < aUmin)
{
aU[0] = aXmin;
aU[1] = (aXmin + aUmin) * 0.5;
aU[2] = aUmin;
aUpp[0] = aU[0] + aUmax - aUmin;
aUpp[1] = aU[1] + aUmax - aUmin;
aUpp[2] = aU[2] + aUmax - aUmin;
aNbPnt += 3;
}
if (aXmax > aUmax)
{
aU[aNbPnt] = aUmax;
aU[aNbPnt + 1] = (aXmax + aUmax) * 0.5;
aU[aNbPnt + 2] = aXmax;
aUpp[aNbPnt] = aU[aNbPnt] - aUmax + aUmin;
aUpp[aNbPnt + 1] = aU[aNbPnt + 1] - aUmax + aUmin;
aUpp[aNbPnt + 2] = aU[aNbPnt + 2] - aUmax + aUmin;
aNbPnt += 3;
}
for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++)
{
P1 = aS->Value(aU[anInd], aV);
P2 = aS->Value(aUpp[anInd], aV);
if (P1.SquareDistance(P2) > aTol2)
{
isUPeriodic = Standard_False;
break;
}
}
}
}
if((aXmin < aUmax) && (aUmax < aXmax))
if (!isUPeriodic)
{
aXmax=aUmax;
if((aXmin<aUmin) && (aUmin < aXmax))
{
aXmin=aUmin;
}
if((aXmin < aUmax) && (aUmax < aXmax))
{
aXmax=aUmax;
}
}
}
if(!aS->IsVPeriodic())
{
if((aYmin<aVmin) && (aVmin < aYmax))
Standard_Boolean isVPeriodic = Standard_False;
// Additional verification for V-periodicity for B-spline surfaces
// 1. Verify that the surface is V-closed (if such flag is false). Verification uses 2 points
// 2. Verify periodicity of surface inside UV-bounds of the edge. Verification uses 3 or 6 points.
if (aS->DynamicType() == STANDARD_TYPE(Geom_BSplineSurface) &&
(aYmin < aVmin || aYmax > aVmax))
{
aYmin=aVmin;
Standard_Real aTol2 = 100 * Precision::Confusion() * Precision::Confusion();
isVPeriodic = Standard_True;
gp_Pnt P1, P2;
// 1. Verify that the surface is V-closed
if (!aS->IsVClosed())
{
Standard_Real aUStep = aUmax - aUmin;
for (Standard_Real aU = aUmin; aU <= aUmax; aU += aUStep)
{
P1 = aS->Value(aU, aVmin);
P2 = aS->Value(aU, aVmax);
if (P1.SquareDistance(P2) > aTol2)
{
isVPeriodic = Standard_False;
break;
}
}
}
// 2. Verify periodicity of surface inside UV-bounds of the edge
if (isVPeriodic) // the flag still not changed
{
Standard_Real aU = (aUmin + aUmax) * 0.5;
Standard_Real aV[6]; // values of V lying out of surface boundaries
Standard_Real aVpp[6]; // corresponding V-values plus/minus period
Standard_Integer aNbPnt = 0;
if (aYmin < aVmin)
{
aV[0] = aYmin;
aV[1] = (aYmin + aVmin) * 0.5;
aV[2] = aVmin;
aVpp[0] = aV[0] + aVmax - aVmin;
aVpp[1] = aV[1] + aVmax - aVmin;
aVpp[2] = aV[2] + aVmax - aVmin;
aNbPnt += 3;
}
if (aYmax > aVmax)
{
aV[aNbPnt] = aVmax;
aV[aNbPnt + 1] = (aYmax + aVmax) * 0.5;
aV[aNbPnt + 2] = aYmax;
aVpp[aNbPnt] = aV[aNbPnt] - aVmax + aVmin;
aVpp[aNbPnt + 1] = aV[aNbPnt + 1] - aVmax + aVmin;
aVpp[aNbPnt + 2] = aV[aNbPnt + 2] - aVmax + aVmin;
aNbPnt += 3;
}
for (Standard_Integer anInd = 0; anInd < aNbPnt; anInd++)
{
P1 = aS->Value(aU, aV[anInd]);
P2 = aS->Value(aU, aVpp[anInd]);
if (P1.SquareDistance(P2) > aTol2)
{
isVPeriodic = Standard_False;
break;
}
}
}
}
if((aYmin < aVmax) && (aVmax < aYmax))
if (!isVPeriodic)
{
aYmax=aVmax;
if((aYmin<aVmin) && (aVmin < aYmax))
{
aYmin=aVmin;
}
if((aYmin < aVmax) && (aVmax < aYmax))
{
aYmax=aVmax;
}
}
}

View File

@@ -45,6 +45,7 @@ uses Point from Blend,
Transition from IntSurf,
Function from Blend,
FuncInv from Blend,
HElSpine from ChFiDS,
State from TopAbs
@@ -66,6 +67,7 @@ is
Perform(me: in out; F : in out Function from Blend;
FInv : in out FuncInv from Blend;
HGuide : HElSpine from ChFiDS;
Pdep : Real from Standard;
Pmax : Real from Standard;
MaxStep : Real from Standard;
@@ -164,6 +166,7 @@ is
InternalPerform (me: in out;F : in out Function from Blend;
FInv : in out FuncInv from Blend;
HGuide : HElSpine from ChFiDS;
Bound : Real from Standard)
is static private;

View File

@@ -56,6 +56,7 @@ void Blend_Walking::AddSingularPoint(const Blend_Point& P)
void Blend_Walking::Perform(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Handle(ChFiDS_HElSpine)& HGuide,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
@@ -154,7 +155,7 @@ void Blend_Walking::Perform(Blend_Function& Func,
}
}
InternalPerform(Func,FuncInv,Pmax);
InternalPerform(Func,FuncInv,HGuide,Pmax);
done = Standard_True;
}
@@ -461,7 +462,8 @@ Standard_Boolean Blend_Walking::Continu(Blend_Function& Func,
previousP.ParametersOnS1(sol(1),sol(2));
previousP.ParametersOnS2(sol(3),sol(4));
InternalPerform(Func,FuncInv,P);
Handle(ChFiDS_HElSpine) anHGuide;
InternalPerform(Func,FuncInv,anHGuide,P);
return Standard_True;
}
@@ -502,7 +504,8 @@ Standard_Boolean Blend_Walking::Continu(Blend_Function& Func,
if(OnS1) clasonS1 = Standard_False;
else clasonS2 = Standard_False;
InternalPerform(Func,FuncInv,P);
Handle(ChFiDS_HElSpine) anHGuide;
InternalPerform(Func,FuncInv,anHGuide,P);
clasonS1 = Standard_True;
clasonS2 = Standard_True;
@@ -548,7 +551,8 @@ Standard_Boolean Blend_Walking::Complete(Blend_Function& Func,
previousP.ParametersOnS1(sol(1),sol(2));
previousP.ParametersOnS2(sol(3),sol(4));
InternalPerform(Func,FuncInv,Pmin);
Handle(ChFiDS_HElSpine) anHGuide;
InternalPerform(Func,FuncInv,anHGuide,Pmin);
iscomplete = Standard_True;
return Standard_True;

View File

@@ -12,6 +12,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gce_MakePln.hxx>
static void evalpinit(math_Vector& parinit,
const Blend_Point& previousP,
const Standard_Real parprec,
@@ -65,6 +67,7 @@ static void evalpinit(math_Vector& parinit,
void Blend_Walking::InternalPerform(Blend_Function& Func,
Blend_FuncInv& FuncInv,
const Handle(ChFiDS_HElSpine)& HGuide,
const Standard_Real Bound)
{
@@ -251,12 +254,64 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
// avec les surfaces periodiques.
State = Blend_OnRst12;
param = (w1+w2)/2;
gp_Pnt Pnt1, Pnt2;
p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
sol(1) = p2d.X();
sol(2) = p2d.Y();
Pnt1 = TheSurfaceTool::Value(surf1,sol(1),sol(2));
p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
sol(3) = p2d.X();
sol(4) = p2d.Y();
Pnt2 = TheSurfaceTool::Value(surf2,sol(3),sol(4));
if (!HGuide.IsNull())
{
const Standard_Real TolProd = 1.e-5;
Standard_Real SavedParams [2];
Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
ChFiDS_ElSpine& theElSpine = HGuide->ChangeCurve();
SavedParams[0] = theElSpine.GetSavedFirstParameter();
SavedParams[1] = theElSpine.GetSavedLastParameter();
for (Standard_Integer ind = 0; ind < 2; ind++)
{
if (!Precision::IsInfinite(SavedParams[ind]))
{
//Check the original first and last parameters of guide curve
//for equality to found parameter <param>:
//check equality of tangent to guide curve and
//normal to plane built on 3 points:
//point on guide curve and points on restrictions of adjacent
//surfaces.
gp_Pnt Pnt0;
gp_Vec Dir0;
HGuide->D1(SavedParams[ind], Pnt0, Dir0);
Standard_Real Length = Dir0.Magnitude();
if (Length <= gp::Resolution())
continue;
Dir0 /= Length;
gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
if (!PlaneBuilder.IsDone())
continue;
gp_Pln thePlane = PlaneBuilder.Value();
gp_Dir DirPlane = thePlane.Axis().Direction();
gp_Vec theProd = Dir0 ^ DirPlane;
Standard_Real ProdMod = theProd.Magnitude();
if (ProdMod <= TolProd)
SameDirs[ind] = Standard_True;
}
}
Standard_Real theParam = Precision::Infinite();
//Choose the closest parameter
if (SameDirs[0] && SameDirs[1])
theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
SavedParams[0] : SavedParams[1];
else if (SameDirs[0])
theParam = SavedParams[0];
else if (SameDirs[1])
theParam = SavedParams[1];
if (!Precision::IsInfinite(theParam))
param = theParam;
}
}
else if (recad1) {
// sol sur 1

View File

@@ -1862,10 +1862,13 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
Standard_Real wl = Guide.LastParameter();
Standard_Real locfleche = (wl - wf) * fleche;
Standard_Real wfsav = wf, wlsav = wl;
//Now the ElSpine is artificially extended to help rsnld.
Standard_Real prab = 0.01;
Guide.FirstParameter(wf-prab*(wl-wf));
Guide.LastParameter (wl+prab*(wl-wf));
if (!Guide.IsPeriodic())
{
//Now the ElSpine is artificially extended to help rsnld.
Standard_Real prab = 0.01;
Guide.FirstParameter(wf-prab*(wl-wf));
Guide.LastParameter (wl+prab*(wl-wf));
}
Handle(ChFiDS_Spine)& Spine = Stripe->ChangeSpine();
Standard_Integer ii, nbed = Spine->NbEdges();
Standard_Real lastedlastp = Spine->LastParameter(nbed);
@@ -1920,7 +1923,9 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
Last = wf;
if(Guide.IsPeriodic()) {
Last = First - Guide.Period();
Guide.SaveFirstParameter();
Guide.FirstParameter(Last);
Guide.SaveLastParameter();
Guide.LastParameter (First * 1.1);//Extension to help rsnld.
}
}

View File

@@ -1573,7 +1573,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
if (5*TolGuide > MS) TolGuide = MS/5;
if (5*TolEsp > MS) TolEsp = MS/5;
}
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
ParSol,TolEsp,Fleche,Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG
@@ -2113,7 +2113,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
if (5*TolEsp > MS) TolEsp = MS/5;
}
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
ParSol,TolEsp,Fleche,Appro);
if (!TheWalk.IsDone()) {

View File

@@ -50,6 +50,10 @@ is
LastParameter(me) returns Real from Standard
is redefined;
GetSavedFirstParameter(me) returns Real from Standard;
GetSavedLastParameter(me) returns Real from Standard;
Continuity(me) returns Shape from GeomAbs
is redefined static;
@@ -102,6 +106,10 @@ is
LastParameter(me : in out; P : Real from Standard);
SaveFirstParameter(me : in out);
SaveLastParameter(me : in out);
SetOrigin(me : in out; O : Real from Standard);
FirstPointAndTgt(me; P : out Pnt from gp; T : out Vec from gp);
@@ -188,5 +196,7 @@ plast : Real from Standard;
period : Real from Standard;
periodic : Boolean from Standard;
pfirstsav : Real from Standard;
plastsav : Real from Standard;
end ElSpine;

View File

@@ -27,6 +27,8 @@
ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
{
pfirstsav = Precision::Infinite();
plastsav = Precision::Infinite();
}
@@ -51,6 +53,26 @@ Standard_Real ChFiDS_ElSpine::LastParameter() const
return plast;
}
//=======================================================================
//function : GetSavedFirstParameter
//purpose :
//=======================================================================
Standard_Real ChFiDS_ElSpine::GetSavedFirstParameter() const
{
return pfirstsav;
}
//=======================================================================
//function : GetSavedLastParameter
//purpose :
//=======================================================================
Standard_Real ChFiDS_ElSpine::GetSavedLastParameter() const
{
return plastsav;
}
//=======================================================================
//function : Continuity
//purpose :
@@ -229,6 +251,26 @@ void ChFiDS_ElSpine::LastParameter(const Standard_Real P)
plast = P;
}
//=======================================================================
//function : SaveFirstParameter
//purpose :
//=======================================================================
void ChFiDS_ElSpine::SaveFirstParameter()
{
pfirstsav = pfirst;
}
//=======================================================================
//function : SaveLastParameter
//purpose :
//=======================================================================
void ChFiDS_ElSpine::SaveLastParameter()
{
plastsav = plast;
}
//=======================================================================
//function : SetOrigin

View File

@@ -438,14 +438,9 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
Du += Min((U2-U1)*(1.-Coef), Du*Us3);
U2 = U1 + Du;
//if (U2 >= lastu) U2 = UUU2;
if (U2 >= lastu) {
parameters.Append (lastu);
points .Append (LastPoint);
MorePoints = Standard_False;
Correction = Standard_False;
}
else D0 (C, U2, CurrentPoint);
if (U2 > lastu)
U2 = lastu;
D0 (C, U2, CurrentPoint);
}
}
}

View File

@@ -46,7 +46,8 @@ raises ConstructionError from Standard,
is
Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True)
Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True;
theAdjustPeriodic : Boolean = Standard_True)
returns TrimmedCurve
---Purpose : Constructs a trimmed curve from the basis curve C
-- which is limited between parameter values U1 and U2.
@@ -70,12 +71,14 @@ is
-- Warning: The trimmed curve is built from a copy of curve C.
-- Therefore, when C is modified, the trimmed curve
-- is not modified.
-- - If the basis curve is periodic, the bounds of the
-- trimmed curve may be different from U1 and U2
-- - If the basis curve is periodic and theAdjustPeriodic is True,
-- the bounds of the trimmed curve may be different from U1 and U2
-- if the parametric origin of the basis curve is within
-- the arc of the trimmed curve. In this case, the
-- modified parameter will be equal to U1 or U2
-- plus or minus the period.
-- When theAdjustPeriodic is False, parameters U1 and U2 will be
-- the same, without adjustment into the first period.
-- Exceptions
-- Standard_ConstructionError if:
-- - C is not periodic and U1 or U2 is outside the
@@ -109,18 +112,21 @@ is
-- the point of parameter U on this trimmed curve.
SetTrim (me : mutable; U1, U2 : Real; Sense : Boolean = Standard_True)
SetTrim (me : mutable; U1, U2 : Real; Sense : Boolean = Standard_True;
theAdjustPeriodic : Boolean = Standard_True)
---Purpose : Changes this trimmed curve, by redefining the
-- parameter values U1 and U2 which limit its basis curve.
-- Note: If the basis curve is periodic, the trimmed curve
-- has the same orientation as the basis curve if Sense
-- is true (default value) or the opposite orientation if Sense is false.
-- Warning
-- If the basis curve is periodic, the bounds of the
-- trimmed curve may be different from U1 and U2 if the
-- If the basis curve is periodic and theAdjustPeriodic is True,
-- the bounds of the trimmed curve may be different from U1 and U2 if the
-- parametric origin of the basis curve is within the arc of
-- the trimmed curve. In this case, the modified
-- parameter will be equal to U1 or U2 plus or minus the period.
-- When theAdjustPeriodic is False, parameters U1 and U2 will be
-- the same, without adjustment into the first period.
-- Exceptions
-- Standard_ConstructionError if:
-- - the basis curve is not periodic, and either U1 or U2

View File

@@ -60,9 +60,10 @@ Handle(Geom_Geometry) Geom_TrimmedCurve::Copy () const {
//=======================================================================
Geom_TrimmedCurve::Geom_TrimmedCurve (const Handle(Geom_Curve)& C,
const Standard_Real U1,
const Standard_Real U2,
const Standard_Boolean Sense) :
const Standard_Real U1,
const Standard_Real U2,
const Standard_Boolean Sense,
const Standard_Boolean theAdjustPeriodic) :
uTrim1 (U1),
uTrim2 (U2)
{
@@ -73,7 +74,7 @@ Geom_TrimmedCurve::Geom_TrimmedCurve (const Handle(Geom_Curve)& C,
else
basisCurve = Handle(Curve)::DownCast(C->Copy());
SetTrim(U1,U2,Sense);
SetTrim(U1, U2, Sense, theAdjustPeriodic);
}
//=======================================================================
@@ -86,7 +87,7 @@ void Geom_TrimmedCurve::Reverse ()
Standard_Real U1 = basisCurve->ReversedParameter(uTrim2);
Standard_Real U2 = basisCurve->ReversedParameter(uTrim1);
basisCurve->Reverse();
SetTrim(U1,U2);
SetTrim(U1, U2, Standard_True, Standard_False);
}
@@ -108,8 +109,9 @@ Standard_Real Geom_TrimmedCurve::ReversedParameter
//=======================================================================
void Geom_TrimmedCurve::SetTrim (const Standard_Real U1,
const Standard_Real U2,
const Standard_Boolean Sense)
const Standard_Real U2,
const Standard_Boolean Sense,
const Standard_Boolean theAdjustPeriodic)
{
Standard_Boolean sameSense = Standard_True;
if (U1 == U2)
@@ -125,9 +127,10 @@ void Geom_TrimmedCurve::SetTrim (const Standard_Real U1,
// set uTrim2 in the range uTrim1 , uTrim1 + Period()
uTrim1 = U1;
uTrim2 = U2;
ElCLib::AdjustPeriodic(Udeb, Ufin,
Min(Abs(uTrim2-uTrim1)/2,Precision::PConfusion()),
uTrim1, uTrim2);
if (theAdjustPeriodic)
ElCLib::AdjustPeriodic(Udeb, Ufin,
Min(Abs(uTrim2-uTrim1)/2,Precision::PConfusion()),
uTrim1, uTrim2);
}
else {
@@ -334,7 +337,7 @@ void Geom_TrimmedCurve::Transform (const Trsf& T)
basisCurve->Transform (T);
Standard_Real U1 = basisCurve->TransformedParameter(uTrim1,T);
Standard_Real U2 = basisCurve->TransformedParameter(uTrim2,T);
SetTrim(U1,U2);
SetTrim(U1, U2, Standard_True, Standard_False);
}

View File

@@ -43,7 +43,8 @@ raises ConstructionError from Standard,
is
Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True)
Create (C : Curve; U1, U2 : Real; Sense : Boolean = Standard_True;
theAdjustPeriodic : Boolean = Standard_True)
returns TrimmedCurve
--- Purpose :
-- Creates a trimmed curve from the basis curve C limited between
@@ -70,9 +71,9 @@ is
-- built with a copy of the curve C. So when C is modified the
-- TrimmedCurve is not modified
-- Warnings :
-- If <C> is periodic, parametrics bounds of the TrimmedCurve,
-- can be different to [<U1>;<U2>}, if <U1> or <U2> are not in the
-- principal period.
-- If <C> is periodic and <theAdjustPeriodic> is True, parametrics
-- bounds of the TrimmedCurve, can be different to [<U1>;<U2>},
-- if <U1> or <U2> are not in the principal period.
-- Include :
-- For more explanation see the scheme given with this class.
-- Raises ConstructionError the C is not periodic and U1 or U2 are out of
@@ -105,18 +106,20 @@ is
-- returns UFirst + ULast - U
SetTrim (me : mutable; U1, U2 : Real; Sense : Boolean = Standard_True)
SetTrim (me : mutable; U1, U2 : Real; Sense : Boolean = Standard_True;
theAdjustPeriodic : Boolean = Standard_True)
--- Purpose : Changes this trimmed curve, by redefining the
-- parameter values U1 and U2, which limit its basis curve.
-- Note: If the basis curve is periodic, the trimmed curve
-- has the same orientation as the basis curve if Sense
-- is true (default value) or the opposite orientation if Sense is false.
-- Warning
-- If the basis curve is periodic, the bounds of the
-- trimmed curve may be different from U1 and U2 if the
-- If the basis curve is periodic and theAdjustPeriodic is True,
-- the bounds of the trimmed curve may be different from U1 and U2 if the
-- parametric origin of the basis curve is within the arc
-- of the trimmed curve. In this case, the modified
-- parameter will be equal to U1 or U2 plus or minus the period.
-- If theAdjustPeriodic is False, parameters U1 and U2 will stay unchanged.
-- Exceptions
-- Standard_ConstructionError if:
-- - the basis curve is not periodic, and either U1 or U2

View File

@@ -62,9 +62,10 @@ Handle(Geom2d_Geometry) Geom2d_TrimmedCurve::Copy () const
//=======================================================================
Geom2d_TrimmedCurve::Geom2d_TrimmedCurve (const Handle(Geom2d_Curve)& C,
const Standard_Real U1,
const Standard_Real U2,
const Standard_Boolean Sense) :
const Standard_Real U1,
const Standard_Real U2,
const Standard_Boolean Sense,
const Standard_Boolean theAdjustPeriodic) :
uTrim1 (U1),
uTrim2 (U2)
{
@@ -76,7 +77,7 @@ Geom2d_TrimmedCurve::Geom2d_TrimmedCurve (const Handle(Geom2d_Curve)& C,
else
basisCurve = Handle(Curve)::DownCast(C->Copy());
SetTrim(U1,U2,Sense);
SetTrim(U1, U2, Sense, theAdjustPeriodic);
}
//=======================================================================
@@ -89,7 +90,7 @@ void Geom2d_TrimmedCurve::Reverse ()
Standard_Real U1 = basisCurve->ReversedParameter(uTrim2);
Standard_Real U2 = basisCurve->ReversedParameter(uTrim1);
basisCurve->Reverse();
SetTrim(U1,U2);
SetTrim(U1, U2, Standard_True, Standard_False);
}
//=======================================================================
@@ -107,9 +108,10 @@ Standard_Real Geom2d_TrimmedCurve::ReversedParameter( const Standard_Real U) con
//purpose :
//=======================================================================
void Geom2d_TrimmedCurve::SetTrim (const Standard_Real U1,
const Standard_Real U2,
const Standard_Boolean Sense)
void Geom2d_TrimmedCurve::SetTrim (const Standard_Real U1,
const Standard_Real U2,
const Standard_Boolean Sense,
const Standard_Boolean theAdjustPeriodic)
{
Standard_Boolean sameSense = Standard_True;
if (U1 == U2)
@@ -124,10 +126,11 @@ void Geom2d_TrimmedCurve::SetTrim (const Standard_Real U1,
// set uTrim1 in the range Udeb , Ufin
// set uTrim2 in the range uTrim1 , uTrim1 + Period()
uTrim1 = U1;
uTrim2 = U2;
ElCLib::AdjustPeriodic(Udeb, Ufin,
Min(Abs(uTrim2-uTrim1)/2,Precision::PConfusion()),
uTrim1, uTrim2);
uTrim2 = U2;
if (theAdjustPeriodic)
ElCLib::AdjustPeriodic(Udeb, Ufin,
Min(Abs(uTrim2-uTrim1)/2,Precision::PConfusion()),
uTrim1, uTrim2);
}
else {
if (U1 < U2) {
@@ -316,7 +319,7 @@ void Geom2d_TrimmedCurve::Transform (const Trsf2d& T)
basisCurve->Transform (T);
Standard_Real U1 = basisCurve->TransformedParameter(uTrim1,T);
Standard_Real U2 = basisCurve->TransformedParameter(uTrim2,T);
SetTrim(U1,U2);
SetTrim(U1, U2, Standard_True, Standard_False);
}
//=======================================================================

View File

@@ -23,9 +23,6 @@ Graphic3d_CPick.hxx
Graphic3d_CUserDraw.hxx
Graphic3d_CView.hxx
Graphic3d_CGraduatedTrihedron.hxx
Graphic3d_ViewAffinity.hxx
Graphic3d_ViewAffinity.cxx
Graphic3d_MapOfObject.hxx
Graphic3d_Structure.lxx
Graphic3d_Structure.pxx
Graphic3d_ShaderObject.hxx
@@ -38,8 +35,6 @@ Graphic3d_ShaderVariable.lxx
Graphic3d_ShaderObject_Handle.hxx
Graphic3d_ShaderProgram_Handle.hxx
Graphic3d_ShaderVariable_Handle.hxx
Graphic3d_MapOfStructure.hxx
Graphic3d_MapIteratorOfMapOfStructure.hxx
Graphic3d_TypeOfShaderObject.hxx
Graphic3d_DataStructure.pxx
Graphic3d_StructureManager.pxx
@@ -74,4 +69,3 @@ Graphic3d_Camera.cxx
Graphic3d_Camera.hxx
Graphic3d_Camera_Handle.hxx
Graphic3d_RenderingParams.hxx
Graphic3d_NMapOfTransient.hxx

View File

@@ -493,18 +493,20 @@ is
imported Vertex;
---Category: Classes
imported transient class ViewAffinity;
imported MapOfStructure;
imported SequenceOfDisplayedStructures;
imported MapOfObject;
imported transient class NMapOfTransient;
---------------------------------
-- Category: Instantiated classes
---------------------------------
imported SequenceOfGroup;
---Category: Instantiated classes
class MapOfStructure instantiates
Map from TCollection (Structure from Graphic3d,MapTransientHasher from TColStd);
---Category: Instantiated classes
class SequenceOfStructure instantiates
Sequence from TCollection
(Structure from Graphic3d);

View File

@@ -22,7 +22,6 @@
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_TypeOfComposition.hxx>
#include <Graphic3d_Vec3.hxx>
#include <Graphic3d_ViewAffinity.hxx>
#include <Standard_Transient.hxx>
#include <Handle_Graphic3d_GraphicDriver.hxx>
@@ -123,8 +122,6 @@ public:
int ContainsFacet;
Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
unsigned IsInfinite : 1;
unsigned stick : 1;
unsigned highlight : 1;

View File

@@ -123,16 +123,16 @@ is
-- Category: Structure management methods
-----------------------------------------
DisplayStructure ( me : mutable;
theCView : CView from Graphic3d;
theStructure : Structure from Graphic3d;
thePriority : Integer from Standard )
DisplayStructure ( me : mutable;
theCView : CView from Graphic3d;
theCStructure : in out CStructure from Graphic3d;
thePriority : Integer from Standard )
is deferred;
---Purpose: call_togl_displaystructure
EraseStructure ( me : mutable;
theCView : CView from Graphic3d;
theStructure : Structure from Graphic3d )
EraseStructure ( me : mutable;
theCView : CView from Graphic3d;
theCStructure : in out CStructure from Graphic3d )
is deferred;
---Purpose: call_togl_erasestructure
@@ -369,9 +369,9 @@ is
-- But it works in any case and is especially useful for view dump because the dump image is read from the back buffer.
-- @return previous mode.
DisplayImmediateStructure ( me : mutable;
theCView : CView from Graphic3d;
theStructure : Structure from Graphic3d )
DisplayImmediateStructure ( me : mutable;
theCView : CView from Graphic3d;
theCStructure : CStructure from Graphic3d )
is deferred;
---Purpose: Display structure in immediate mode on top of general presentation

View File

@@ -1,23 +0,0 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_MapIteratorOfMapOfStructure
#define _Graphic3d_MapIteratorOfMapOfStructure
#include <Graphic3d_MapOfStructure.hxx>
typedef Graphic3d_MapOfStructure::Iterator Graphic3d_MapIteratorOfMapOfStructure;
#endif // _Graphic3d_MapIteratorOfMapOfStructure

View File

@@ -1,24 +0,0 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_MapOfObject
#define _Graphic3d_MapOfObject
#include <Graphic3d_ViewAffinity.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<const Standard_Transient* , Handle(Graphic3d_ViewAffinity)> Graphic3d_MapOfObject;
#endif // _Graphic3d_MapOfObject

View File

@@ -1,24 +0,0 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_MapOfStructure
#define _Graphic3d_MapOfStructure
#include <Handle_Graphic3d_Structure.hxx>
#include <NCollection_Map.hxx>
typedef NCollection_Map<Handle(Graphic3d_Structure)> Graphic3d_MapOfStructure;
#endif // _Graphic3d_MapOfStructure

View File

@@ -1,25 +0,0 @@
// Created on: 2014-12-08
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_NMapOfTransient_HeaderFile
#define _Graphic3d_NMapOfTransient_HeaderFile
#include <Standard_Transient.hxx>
#include <NCollection_Map.hxx>
#include <NCollection_Handle.hxx>
typedef NCollection_Map<const Standard_Transient* > Graphic3d_NMapOfTransient;
typedef NCollection_Handle<Graphic3d_NMapOfTransient> Handle(Graphic3d_NMapOfTransient);
#endif // _Graphic3d_NMapOfTransient_HeaderFile

View File

@@ -190,15 +190,20 @@ is
-- of the visualiser.
---Category: Methods to modify the class definition
Highlight ( me : mutable;
theMethod : TypeOfHighlightMethod from Aspect;
theColor : Color from Quantity;
theToUpdateMgr : Boolean from Standard = Standard_True)
Highlight ( me : mutable;
Method : TypeOfHighlightMethod from Aspect )
is static;
---Level: Public
---Purpose: Highlights the structure <me> in all the views of the visualiser, using the following methods:
-- TOHM_COLOR = drawn in the highlight color
-- TOHM_BOUNDBOX = enclosed by the boundary box
---Purpose: Highlights the structure <me> in all the
-- views of the visualiser, using the following methods:
--
-- TOHM_COLOR = drawn in the highlight color
-- (default white)
-- TOHM_BLINK = blinking
-- TOHM_BOUNDBOX = enclosed by the boundary box
-- (default white)
--
---Category: Methods to modify the class definition
Remove ( me : mutable )
is static;
@@ -214,6 +219,14 @@ is
---Purpose: Computes axis-aligned bounding box of a structure.
-- Category: Methods to modify the class definition
SetHighlightColor ( me : mutable;
AColor : Color from Quantity )
is static;
---Level: Public
---Purpose: Modifies the highlight color for the Highlight method
-- with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
---Category: Methods to modify the class definition
SetInfiniteState (me : mutable; theToSet : Boolean from Standard) is static;
---Level: Internal
---Purpose: If <theToSet> is Standard_True then <me> is infinite and

View File

@@ -28,8 +28,6 @@
#include <Aspect_PolygonOffsetMode.hxx>
#include <Precision.hxx>
#include <stdio.h>
//=============================================================================
@@ -124,25 +122,6 @@ void Graphic3d_Structure::CalculateBoundBox()
{
Graphic3d_BndBox4d aBox;
addTransformed (aBox, Standard_True);
// Workaround for zero size components, to avoid clipping issues
Graphic3d_BndBox4d::BVH_VecNt aSizeVec = aBox.Size();
if (aSizeVec.x() < Precision::Confusion())
{
aBox.CornerMin().x() -= Precision::Confusion();
aBox.CornerMax().x() += Precision::Confusion();
}
if (aSizeVec.y() < Precision::Confusion())
{
aBox.CornerMin().y() -= Precision::Confusion();
aBox.CornerMax().y() += Precision::Confusion();
}
if (aSizeVec.z() < Precision::Confusion())
{
aBox.CornerMin().z() -= Precision::Confusion();
aBox.CornerMax().z() += Precision::Confusion();
}
if (aBox.IsValid() && myCStructure->TransformPersistence.Flag == 0)
{
Graphic3d_Vec4 aMinPt (RealToShortReal (aBox.CornerMin().x()),
@@ -225,7 +204,6 @@ void Graphic3d_Structure::Display()
}
myCStructure->visible = 1;
//myCStructure->UpdateNamedStatus();
}
//=============================================================================
@@ -334,17 +312,13 @@ void Graphic3d_Structure::Erase()
//function : Highlight
//purpose :
//=============================================================================
void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
const Quantity_Color& theColor,
const Standard_Boolean theToUpdateMgr)
void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod)
{
if (IsDeleted())
{
return;
}
myHighlightColor = theColor;
// Highlight on already Highlighted structure.
if (myCStructure->highlight)
{
@@ -366,12 +340,6 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
SetDisplayPriority (Structure_MAX_PRIORITY - 1);
GraphicHighlight (theMethod);
if (!theToUpdateMgr)
{
return;
}
if (myCStructure->stick)
{
myStructureManager->Highlight (this, theMethod);
@@ -380,6 +348,41 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
Update();
}
//=============================================================================
//function : SetHighlightColor
//purpose :
//=============================================================================
void Graphic3d_Structure::SetHighlightColor (const Quantity_Color& theColor)
{
if (IsDeleted())
{
return;
}
if (!myCStructure->highlight)
{
myHighlightColor = theColor;
return;
}
// Change highlight color on already Highlighted structure.
Aspect_TypeOfUpdate anUpdateMode = myStructureManager->UpdateMode();
if (anUpdateMode == Aspect_TOU_WAIT)
{
UnHighlight();
}
else
{
// To avoid call of method : Update()
// Not useful and can be costly.
myStructureManager->SetUpdateMode (Aspect_TOU_WAIT);
UnHighlight();
myStructureManager->SetUpdateMode (anUpdateMode);
}
myHighlightColor = theColor;
Highlight (myHighlightMethod);
}
//=============================================================================
//function : SetVisible
//purpose :

View File

@@ -49,8 +49,6 @@ uses
AspectText3d from Graphic3d,
Structure from Graphic3d,
MapOfStructure from Graphic3d,
MapOfObject from Graphic3d,
ViewAffinity from Graphic3d,
SequenceOfStructure from Graphic3d,
GraphicDriver from Graphic3d
@@ -471,19 +469,6 @@ is
theStructures : MapOfStructure from Graphic3d);
---Purpose: Recomputes all structures from theStructures.
RegisterObject (me : mutable;
theObject : Transient from Standard)
returns ViewAffinity from Graphic3d
is static;
UnregisterObject (me : mutable;
theObject : Transient from Standard) is static;
ObjectAffinity (me;
theObject : Transient from Standard)
returns ViewAffinity from Graphic3d
is static;
--
fields
@@ -515,8 +500,6 @@ fields
MyDisplayedStructure : MapOfStructure from Graphic3d
is protected;
myRegisteredObjects : MapOfObject from Graphic3d is protected;
-- the highlighted structures
MyHighlightedStructure : MapOfStructure from Graphic3d
is protected;

View File

@@ -358,28 +358,3 @@ void Graphic3d_StructureManager::RecomputeStructures (const Graphic3d_MapOfStruc
aStruct->Compute();
}
}
Handle(Graphic3d_ViewAffinity) Graphic3d_StructureManager::RegisterObject (const Handle(Standard_Transient)& theObject)
{
Handle(Graphic3d_ViewAffinity) aResult;
if (myRegisteredObjects.Find (theObject.operator->(), aResult))
{
return aResult;
}
aResult = new Graphic3d_ViewAffinity();
myRegisteredObjects.Bind (theObject.operator->(), aResult);
return aResult;
}
void Graphic3d_StructureManager::UnregisterObject (const Handle(Standard_Transient)& theObject)
{
myRegisteredObjects.UnBind (theObject.operator->());
}
Handle(Graphic3d_ViewAffinity) Graphic3d_StructureManager::ObjectAffinity (const Handle(Standard_Transient)& theObject) const
{
Handle(Graphic3d_ViewAffinity) aResult;
myRegisteredObjects.Find (theObject.operator->(), aResult);
return aResult;
}

View File

@@ -1,19 +0,0 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// 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 <Graphic3d_ViewAffinity.hxx>
IMPLEMENT_STANDARD_HANDLE (Graphic3d_ViewAffinity, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ViewAffinity, Standard_Transient)

View File

@@ -1,66 +0,0 @@
// Created on: 2014-12-18
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_ViewAffinity_HeaderFile
#define _Graphic3d_ViewAffinity_HeaderFile
#include <Graphic3d_Structure.hxx>
//! Structure display state.
class Graphic3d_ViewAffinity : public Standard_Transient
{
public:
//! Empty constructor.
Graphic3d_ViewAffinity()
{
::memset (&myMask, 0xFF, sizeof(myMask));
}
//! Return visibility flag.
bool IsVisible (const Standard_Integer theViewId) const
{
const unsigned int aBit = 1 << theViewId;
return (myMask & aBit) != 0;
}
//! Setup visibility flag.
void SetVisible (const Standard_Integer theViewId,
const bool theIsVisible)
{
const unsigned int aBit = 1 << theViewId;
if (theIsVisible)
{
myMask |= aBit;
}
else
{
myMask &= ~aBit;
}
}
private:
unsigned int myMask; //!< affinity mask
public:
DEFINE_STANDARD_RTTI(Graphic3d_ViewAffinity)
};
DEFINE_STANDARD_HANDLE(Graphic3d_ViewAffinity, Standard_Transient)
#endif // _Graphic3d_ViewAffinity_HeaderFile

View File

@@ -37,43 +37,67 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
{
int i,result; char typesec;
/* int length;*/
if (iges_fautrelire == 0) {
if (*numsec == 0) ligne[72] = ligne[79] = ' ';
if (iges_fautrelire == 0)
{
if (*numsec == 0)
ligne[72] = ligne[79] = ' ';
ligne[0] = '\0';
if(modefnes)
fgets(ligne,99,lefic); /*for kept compatibility with fnes*/
else {
if(modefnes)
fgets(ligne,99,lefic); /*for kept compatibility with fnes*/
else
{
/* PTV: 21.03.2002 it is neccessary for files that have only `\r` but no `\n`
examle file is 919-001-T02-04-CP-VL.iges */
while ( fgets ( ligne, 2, lefic ) && ( ligne[0] == '\r' || ligne[0] == '\n' ) )
{
}
fgets(&ligne[1],80,lefic);
/* fgets(ligne,81,lefic); */
}
if (*numsec == 0 && ligne[72] != 'S' && ligne[79] == ' ') {
/* ON A DU FNES : Sauter la 1re ligne */
ligne[0] = '\0';
if(modefnes)
fgets(ligne,99,lefic);/*for kept compatibility with fnes*/
else {
while ( fgets ( ligne, 2, lefic ) && ( ligne[0] == '\r' || ligne[0] == '\n' ) )
{
}
{
}
fgets(&ligne[1],80,lefic);
}
if (*numsec == 0 && ligne[72] != 'S' && ligne[79] == ' ')
{/* ON A DU FNES : Sauter la 1re ligne */
ligne[0] = '\0';
if(modefnes)
fgets(ligne,99,lefic);/*for kept compatibility with fnes*/
else
{
while ( fgets ( ligne, 2, lefic ) && ( ligne[0] == '\r' || ligne[0] == '\n' ) )
{
}
fgets(&ligne[1],80,lefic);
/* fgets(ligne,81,lefic); */
}
}
if ((ligne[0] & 128)&&modefnes) {
if ((ligne[0] & 128) && modefnes)
{
for (i = 0; i < 80; i ++)
ligne[i] = (char)(ligne[i] ^ (150 + (i & 3)));
}
}
if (feof(lefic)) return 0;
if (feof(lefic))
return 0;
{//0x1A is END_OF_FILE for OS DOS and WINDOWS. For other OS we set this rule forcefully.
char *fc = strchr(ligne, 0x1A);
if(fc != 0)
{
fc[0] = '\0';
return 0;
}
}
iges_fautrelire = 0;
if (ligne[0] == '\0' || ligne[0] == '\n' || ligne[0] == '\r')
return iges_lire(lefic,numsec,ligne,modefnes); /* 0 */
if (sscanf(&ligne[73],"%d",&result) == 0) return -1;
if (sscanf(&ligne[73],"%d",&result) == 0)
return -1;
/* { printf("Erreur, ligne n0.%d :\n%s\n",*numl,ligne); return (*numsec > 0 ? -1 : -2); } */
*numsec = result;
typesec = ligne[72];

View File

@@ -750,31 +750,45 @@ stCoeffsValue::stCoeffsValue( const gp_Cylinder& theCyl1,
}aFoundCouple = COENONE;
Standard_Real aDetV1V2 = mVecC1.X()*mVecC2.Y()-mVecC1.Y()*mVecC2.X();
Standard_Real aDetV1V2 = 0.0;
const Standard_Real aDelta1 = mVecC1.X()*mVecC2.Y()-mVecC1.Y()*mVecC2.X(); //1-2
const Standard_Real aDelta2 = mVecC1.Y()*mVecC2.Z()-mVecC1.Z()*mVecC2.Y(); //2-3
const Standard_Real aDelta3 = mVecC1.X()*mVecC2.Z()-mVecC1.Z()*mVecC2.X(); //1-3
const Standard_Real anAbsD1 = Abs(aDelta1); //1-2
const Standard_Real anAbsD2 = Abs(aDelta2); //2-3
const Standard_Real anAbsD3 = Abs(aDelta3); //1-3
if(Abs(aDetV1V2) < aNulValue)
if(anAbsD1 >= anAbsD2)
{
aDetV1V2 = mVecC1.Y()*mVecC2.Z()-mVecC1.Z()*mVecC2.Y();
if(Abs(aDetV1V2) < aNulValue)
if(anAbsD3 > anAbsD1)
{
aDetV1V2 = mVecC1.X()*mVecC2.Z()-mVecC1.Z()*mVecC2.X();
if(Abs(aDetV1V2) < aNulValue)
{
Standard_Failure::Raise("Error. Exception in divide by zerro (IntCyCyTrim)!!!!");
}
else
{
aFoundCouple = COE13;
}
aFoundCouple = COE13;
aDetV1V2 = aDelta3;
}
else
{
aFoundCouple = COE23;
aFoundCouple = COE12;
aDetV1V2 = aDelta1;
}
}
else
{
aFoundCouple = COE12;
if(anAbsD3 > anAbsD2)
{
aFoundCouple = COE13;
aDetV1V2 = aDelta3;
}
else
{
aFoundCouple = COE23;
aDetV1V2 = aDelta2;
}
}
if(Abs(aDetV1V2) < aNulValue)
{
Standard_Failure::Raise("Error. Exception in divide by zerro (IntCyCyTrim)!!!!");
}
switch(aFoundCouple)
@@ -1504,6 +1518,10 @@ static void SeekAdditionalPoints( const IntSurf_Quadric& theQuad1,
gp_Pnt aPInt(0.5*(aP1.XYZ() + aP2.XYZ()));
#ifdef OCCT_DEBUG
//cout << "|P1Pi| = " << aP1.SquareDistance(aPInt) << "; |P2Pi| = " << aP2.SquareDistance(aPInt) << endl;
#endif
IntSurf_PntOn2S anIP;
if(isTheReverse)
{
@@ -1632,11 +1650,15 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
theSlin.Clear();
theSPnt.Clear();
const Standard_Integer aNbPoints = Min(Max(200, RealToInt(20.0*aCyl1.Radius())), 2000);
const Standard_Integer aNbMaxPoints = 2000;
const Standard_Integer aNbMinPoints = 200;
const Standard_Integer aNbPoints = Min(Max(aNbMinPoints,
RealToInt(20.0*aCyl1.Radius())), aNbMaxPoints);
const Standard_Real aPeriod = 2.0*M_PI;
const Standard_Real aStepMin = theTol2D,
aStepMax = (aUSurf1l-aUSurf1f)/IntToReal(aNbPoints);
const Standard_Integer aNbWLines = 2;
const stCoeffsValue anEquationCoeffs(aCyl1, aCyl2);
//Boundaries
@@ -1843,7 +1865,9 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
if(Precision::IsInfinite(aU1f[aCurInterval]) && Precision::IsInfinite(aU1l[aCurInterval]))
continue;
Standard_Boolean isAddedIntoWL1 = Standard_False, isAddedIntoWL2 = Standard_False;
Standard_Boolean isAddedIntoWL[aNbWLines];
for(Standard_Integer i = 0; i < aNbWLines; i++)
isAddedIntoWL[i] = Standard_False;
Standard_Real anUf = aU1f[aCurInterval], anUl = aU1l[aCurInterval];
const Standard_Boolean isDeltaPeriod = IsEqual(anUl-anUf, aPeriod);
@@ -1853,26 +1877,30 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
while(anUf < anUl)
{
Handle(IntSurf_LineOn2S) aL2S1 = new IntSurf_LineOn2S();
Handle(IntSurf_LineOn2S) aL2S2 = new IntSurf_LineOn2S();
Handle(IntPatch_WLine) aWLine1 = new IntPatch_WLine(aL2S1, Standard_False);
Handle(IntPatch_WLine) aWLine2 = new IntPatch_WLine(aL2S2, Standard_False);
Standard_Integer aWL1FindStatus = 0, aWL2FindStatus = 0;
Standard_Boolean isAddingWL1Enabled = Standard_True,
isAddingWL2Enabled = Standard_True;
Standard_Real aU2[aNbWLines], aV1[aNbWLines], aV2[aNbWLines];
Standard_Integer aWLFindStatus[aNbWLines];
Standard_Real aV1Prev[aNbWLines], aV2Prev[aNbWLines];
Standard_Real anArccosFactor[aNbWLines] = {1.0, -1.0};
Standard_Boolean isAddingWLEnabled[aNbWLines];
Handle(IntSurf_LineOn2S) aL2S[aNbWLines];
Handle(IntPatch_WLine) aWLine[aNbWLines];
for(Standard_Integer i = 0; i < aNbWLines; i++)
{
aL2S[i] = new IntSurf_LineOn2S();
aWLine[i] = new IntPatch_WLine(aL2S[i], Standard_False);
aWLFindStatus[i] = 0;
isAddingWLEnabled[i] = Standard_True;
aU2[i] = aV1[i] = aV2[i] = 0.0;
aV1Prev[i] = aV2Prev[i] = 0.0;
}
Standard_Real anU1 = anUf;
Standard_Real aCriticalDelta[aNbCritPointsMax];
for(Standard_Integer i = 0; i < aNbCritPointsMax; i++)
aCriticalDelta[i] = anU1 - anU1crit[i];
Standard_Real aV11Prev = 0.0,
aV12Prev = 0.0,
aV21Prev = 0.0,
aV22Prev = 0.0;
Standard_Boolean isFirst = Standard_True;
while(anU1 <= anUl)
@@ -1889,8 +1917,8 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
//already existing WLine. Consequently, it is necessary
//to forbid building new line in this case.
isAddingWL1Enabled = !isAddedIntoWL1;
isAddingWL2Enabled = !isAddedIntoWL2;
for(Standard_Integer i = 0; i < aNbWLines; i++)
isAddingWLEnabled[i] = !isAddedIntoWL[i];
}
}
@@ -1899,8 +1927,10 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
if((anU1 - anU1crit[i])*aCriticalDelta[i] < 0.0)
{
anU1 = anU1crit[i];
aWL1FindStatus = 2;
aWL2FindStatus = 2;
for(Standard_Integer i = 0; i < aNbWLines; i++)
aWLFindStatus[i] = 2;
break;
}
}
@@ -1913,147 +1943,108 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
if(anArg + 1.0 < aNulValue)
anArg = -1.0;
Standard_Real aU21 = anEquationCoeffs.mFI2 + acos(anArg);
InscribePoint(aUSurf2f, aUSurf2l, aU21, theTol2D, aPeriod, Standard_False);
const Standard_Integer aNbPntsWL1 = aWLine1.IsNull() ? 0 :
aWLine1->Curve()->NbPoints();
if(aNbPntsWL1 == 0)
{//the line have not contained any points yet
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
((Abs(aU21-aUSurf2f) < theTol2D) || (Abs(aU21-aUSurf2l) < theTol2D)))
{
const Standard_Real anU1Temp = anU1 + aStepMin;
Standard_Real anArgTemp = anEquationCoeffs.mB *
cos(anU1Temp - anEquationCoeffs.mFI1) + anEquationCoeffs.mC;
if(aNulValue > 1.0 - anArg)
anArg = 1.0;
if(anArg + 1.0 < aNulValue)
anArg = -1.0;
Standard_Real aU2Temp = anEquationCoeffs.mFI2 + acos(anArgTemp);
InscribePoint(aUSurf2f, aUSurf2l, aU2Temp, theTol2D, aPeriod, Standard_False);
if(2.0*Abs(aU2Temp - aU21) > aPeriod)
{
if(aU2Temp > aU21)
aU21 += aPeriod;
else
aU21 -= aPeriod;
}
}
}
if(aNbPntsWL1 > 0)
{//end of the line
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
((Abs(aU21-aUSurf2f) < theTol2D) || (Abs(aU21-aUSurf2l) < theTol2D)))
{
Standard_Real aU2prev = 0.0, aV2prev = 0.0;
if(isTheReverse)
aWLine1->Curve()->Value(aNbPntsWL1).ParametersOnS1(aU2prev, aV2prev);
else
aWLine1->Curve()->Value(aNbPntsWL1).ParametersOnS2(aU2prev, aV2prev);
if(2.0*Abs(aU2prev - aU21) > aPeriod)
{
if(aU2prev > aU21)
aU21 += aPeriod;
else
aU21 -= aPeriod;
}
}
}
Standard_Real aU22 = anEquationCoeffs.mFI2 - acos(anArg);
InscribePoint(aUSurf2f, aUSurf2l, aU22, theTol2D, aPeriod, Standard_False);
const Standard_Integer aNbPntsWL2 = aWLine2.IsNull() ? 0 :
aWLine2->Curve()->NbPoints();
if(aNbPntsWL2 == 0)
{//the line have not contained any points yet
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
((Abs(aU22-aUSurf2f) < theTol2D) || (Abs(aU22-aUSurf2l) < theTol2D)))
{
const Standard_Real anU1Temp = anU1 + aStepMin;
Standard_Real anArgTemp = anEquationCoeffs.mB *
cos(anU1Temp - anEquationCoeffs.mFI1) + anEquationCoeffs.mC;
if(aNulValue > 1.0 - anArg)
anArg = 1.0;
if(anArg + 1.0 < aNulValue)
anArg = -1.0;
Standard_Real aU2Temp = anEquationCoeffs.mFI2 - acos(anArgTemp);
InscribePoint(aUSurf2f, aUSurf2l, aU2Temp, theTol2D, aPeriod, Standard_False);
if(2.0*Abs(aU2Temp - aU22) > aPeriod)
{
if(aU2Temp > aU21)
aU22 += aPeriod;
else
aU22 -= aPeriod;
}
}
}
if(aNbPntsWL2 > 0)
{//end of the line
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
((Abs(aU22-aUSurf2f) < theTol2D) || (Abs(aU22-aUSurf2l) < theTol2D)))
{
Standard_Real aU2prev = 0.0, aV2prev = 0.0;
if(isTheReverse)
aWLine2->Curve()->Value(aNbPntsWL2).ParametersOnS1(aU2prev, aV2prev);
else
aWLine2->Curve()->Value(aNbPntsWL2).ParametersOnS2(aU2prev, aV2prev);
if(2.0*Abs(aU2prev - aU22) > aPeriod)
{
if(aU2prev > aU22)
aU22 += aPeriod;
else
aU22 -= aPeriod;
}
}
}
const Standard_Real aV11 = anEquationCoeffs.mK21 * sin(aU21) +
anEquationCoeffs.mK11 * sin(anU1) +
anEquationCoeffs.mL21 * cos(aU21) +
anEquationCoeffs.mL11 * cos(anU1) + anEquationCoeffs.mM1;
const Standard_Real aV12 = anEquationCoeffs.mK21 * sin(aU22) +
anEquationCoeffs.mK11 * sin(anU1) +
anEquationCoeffs.mL21 * cos(aU22) +
anEquationCoeffs.mL11 * cos(anU1) + anEquationCoeffs.mM1;
const Standard_Real aV21 = anEquationCoeffs.mK22 * sin(aU21) +
anEquationCoeffs.mK12 * sin(anU1) +
anEquationCoeffs.mL22 * cos(aU21) +
anEquationCoeffs.mL12 * cos(anU1) + anEquationCoeffs.mM2;
const Standard_Real aV22 = anEquationCoeffs.mK22 * sin(aU22) +
anEquationCoeffs.mK12 * sin(anU1) +
anEquationCoeffs.mL22 * cos(aU22) +
anEquationCoeffs.mL12 * cos(anU1) + anEquationCoeffs.mM2;
if(isFirst)
for(Standard_Integer i = 0; i < aNbWLines; i++)
{
aV11Prev = aV11;
aV12Prev = aV12;
aV21Prev = aV21;
aV22Prev = aV22;
isFirst = Standard_False;
}
const Standard_Integer aNbPntsWL = aWLine[i].IsNull() ? 0 :
aWLine[i]->Curve()->NbPoints();
aU2[i] = anEquationCoeffs.mFI2 + anArccosFactor[i]*acos(anArg);
if(isAddingWL1Enabled)
InscribePoint(aUSurf2f, aUSurf2l, aU2[i], theTol2D, aPeriod, Standard_False);
if(aNbPntsWL == 0)
{//the line has not contained any points yet
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
((Abs(aU2[i] - aUSurf2f) < theTol2D) ||
(Abs(aU2[i]-aUSurf2l) < theTol2D)))
{
const Standard_Real anU1Temp = anU1 + aStepMin;
Standard_Real anArgTemp = anEquationCoeffs.mB *
cos(anU1Temp - anEquationCoeffs.mFI1) +
anEquationCoeffs.mC;
if(aNulValue > 1.0 - anArgTemp)
anArgTemp = 1.0;
if(anArgTemp + 1.0 < aNulValue)
anArgTemp = -1.0;
Standard_Real aU2Temp = anEquationCoeffs.mFI2 +
anArccosFactor[i]*acos(anArgTemp);
InscribePoint(aUSurf2f, aUSurf2l, aU2Temp, theTol2D, aPeriod, Standard_False);
if(2.0*Abs(aU2Temp - aU2[i]) > aPeriod)
{
if(aU2Temp > aU2[i])
aU2[i] += aPeriod;
else
aU2[i] -= aPeriod;
}
}
}
if(aNbPntsWL > 0)
{
if(((aUSurf2l - aUSurf2f) >= aPeriod) &&
((Abs(aU2[i] - aUSurf2f) < theTol2D) ||
(Abs(aU2[i]-aUSurf2l) < theTol2D)))
{//end of the line
Standard_Real aU2prev = 0.0, aV2prev = 0.0;
if(isTheReverse)
aWLine[i]->Curve()->Value(aNbPntsWL).ParametersOnS1(aU2prev, aV2prev);
else
aWLine[i]->Curve()->Value(aNbPntsWL).ParametersOnS2(aU2prev, aV2prev);
if(2.0*Abs(aU2prev - aU2[i]) > aPeriod)
{
if(aU2prev > aU2[i])
aU2[i] += aPeriod;
else
aU2[i] -= aPeriod;
}
}
}
aV1[i] = anEquationCoeffs.mK21 * sin(aU2[i]) +
anEquationCoeffs.mK11 * sin(anU1) +
anEquationCoeffs.mL21 * cos(aU2[i]) +
anEquationCoeffs.mL11 * cos(anU1) + anEquationCoeffs.mM1;
aV2[i] = anEquationCoeffs.mK22 * sin(aU2[i]) +
anEquationCoeffs.mK12 * sin(anU1) +
anEquationCoeffs.mL22 * cos(aU2[i]) +
anEquationCoeffs.mL12 * cos(anU1) + anEquationCoeffs.mM2;
if(isFirst)
{
aV1Prev[i] = aV1[i];
aV2Prev[i] = aV2[i];
}
}//for(Standard_Integer i = 0; i < aNbWLines; i++)
isFirst = Standard_False;
//Looking for points into WLine
Standard_Boolean isBroken = Standard_False;
for(Standard_Integer i = 0; i < aNbWLines; i++)
{
if( ((aUSurf2f-aU21) <= theTol2D) &&
((aU21-aUSurf2l) <= theTol2D) &&
((aVSurf1f - aV11) <= theTol2D) &&
((aV11 - aVSurf1l) <= theTol2D) &&
((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
if(!isAddingWLEnabled[i])
{
aV1Prev[i] = aV1[i];
aV2Prev[i] = aV2[i];
if(aWLFindStatus[i] == 2)
isBroken = Standard_True;
continue;
}
if( ((aUSurf2f-aU2[i]) <= theTol2D) && ((aU2[i]-aUSurf2l) <= theTol2D) &&
((aVSurf1f - aV1[i]) <= theTol2D) && ((aV1[i] - aVSurf1l) <= theTol2D) &&
((aVSurf2f - aV2[i]) <= theTol2D) && ((aV2[i] - aVSurf2l) <= theTol2D))
{
Standard_Boolean isForce = Standard_False;
if(!aWL1FindStatus)
if(!aWLFindStatus[i])
{
Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
@@ -2062,306 +2053,178 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
isForce = Standard_True;
}
AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
AddBoundaryPoint( theQuad1, theQuad2, aWLine[i], anEquationCoeffs,
theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
aNulValue, anU1, aU21, aV11, aV11Prev,
aV21, aV21Prev, isTheReverse,
1.0, isForce, isFound1, isFound2);
aNulValue, anU1, aU2[i], aV1[i], aV1Prev[i],
aV2[i], aV2Prev[i], isTheReverse,
anArccosFactor[i], isForce, isFound1, isFound2);
if(isFound1 || isFound2)
{
aWL1FindStatus = 1;
aWLFindStatus[i] = 1;
}
}
if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
if(( aWLFindStatus[i] != 2) || (aWLine[i]->NbPnts() >= 1))
{
if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
aUSurf1f, aUSurf1l, aPeriod,
aWLine1->Curve(), theTol3D, theTol2D, isForce))
gp_Pnt2d(anU1, aV1[i]), gp_Pnt2d(aU2[i], aV2[i]),
aUSurf1f, aUSurf1l, aPeriod,
aWLine[i]->Curve(), theTol3D, theTol2D, isForce))
{
if(!aWL1FindStatus)
if(!aWLFindStatus[i])
{
aWL1FindStatus = 1;
aWLFindStatus[i] = 1;
}
}
}
}
else
{
if(aWL1FindStatus == 1)
if(aWLFindStatus[i] == 1)
{
Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
AddBoundaryPoint( theQuad1, theQuad2, aWLine[i], anEquationCoeffs,
theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
aNulValue, anU1, aU21, aV11, aV11Prev,
aV21, aV21Prev, isTheReverse,
1.0, Standard_False, isFound1, isFound2);
aNulValue, anU1, aU2[i], aV1[i], aV1Prev[i],
aV2[i], aV2Prev[i], isTheReverse,
anArccosFactor[i], Standard_False, isFound1, isFound2);
if(isFound1 || isFound2)
aWL1FindStatus = 2; //start a new line
aWLFindStatus[i] = 2; //start a new line
}
}
}
if(isAddingWL2Enabled)
{
if( ((aUSurf2f-aU22) <= theTol2D) &&
((aU22-aUSurf2l) <= theTol2D) &&
((aVSurf1f - aV12) <= theTol2D) &&
((aV12 - aVSurf1l) <= theTol2D) &&
((aVSurf2f - aV22) <= theTol2D) &&
((aV22 - aVSurf2l) <= theTol2D))
{
Standard_Boolean isForce = Standard_False;
if(!aWL2FindStatus)
{
Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
aV1Prev[i] = aV1[i];
aV2Prev[i] = aV2[i];
if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
{
isForce = Standard_True;
}
if(aWLFindStatus[i] == 2)
isBroken = Standard_True;
}//for(Standard_Integer i = 0; i < aNbWLines; i++)
AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
aNulValue, anU1, aU22, aV12, aV12Prev,
aV22, aV22Prev, isTheReverse,
-1.0, isForce, isFound1, isFound2);
if(isFound1 || isFound2)
{
aWL2FindStatus = 1;
}
}
if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
{
if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
aUSurf1f, aUSurf1l, aPeriod,
aWLine2->Curve(), theTol3D, theTol2D, isForce))
{
if(!aWL2FindStatus)
{
aWL2FindStatus = 1;
}
}
}
}
else
{
if(aWL2FindStatus == 1)
{
Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
aNulValue, anU1, aU22, aV12, aV12Prev,
aV22, aV22Prev, isTheReverse,
-1.0, Standard_False, isFound1, isFound2);
if(isFound1 || isFound2)
aWL2FindStatus = 2; //start a new line
}
}
}
aV11Prev = aV11;
aV12Prev = aV12;
aV21Prev = aV21;
aV22Prev = aV22;
if((aWL1FindStatus == 2) || (aWL2FindStatus == 2))
if(isBroken)
{//current lines are filled. Go to the next lines
anUf = anU1;
break;
}
Standard_Real aFact1 = !IsEqual(sin(aU21 - anEquationCoeffs.mFI2), 0.0) ?
//Step computing
Standard_Real aStepU1 = aStepMax;
for(Standard_Integer i = 0; i < aNbWLines; i++)
{
Standard_Real aDeltaU1V1 = aStepU1, aDeltaU1V2 = aStepU1;
Standard_Real aFact1 = !IsEqual(sin(aU2[i] - anEquationCoeffs.mFI2), 0.0) ?
anEquationCoeffs.mK1 * sin(anU1 - anEquationCoeffs.mFIV1) +
anEquationCoeffs.mL1 * anEquationCoeffs.mB * sin(aU21 - anEquationCoeffs.mPSIV1) *
sin(anU1 - anEquationCoeffs.mFI1)/sin(aU21-anEquationCoeffs.mFI2) : 0.0,
aFact2 = !IsEqual(sin(aU22-anEquationCoeffs.mFI2), 0.0) ?
anEquationCoeffs.mK1 * sin(anU1 - anEquationCoeffs.mFIV1) +
anEquationCoeffs.mL1 * anEquationCoeffs.mB * sin(aU22 - anEquationCoeffs.mPSIV1) *
sin(anU1 - anEquationCoeffs.mFI1)/sin(aU22-anEquationCoeffs.mFI2) : 0.0;
Standard_Real aDeltaV1 = (aVSurf1l - aVSurf1f)/IntToReal(aNbPoints);
if((aV11 < aVSurf1f) && (aFact1 < 0.0))
{//Make close to aVSurf1f by increasing anU1 (for the 1st line)
aDeltaV1 = Min(aDeltaV1, Abs(aV11-aVSurf1f));
}
if((aV12 < aVSurf1f) && (aFact2 < 0.0))
{//Make close to aVSurf1f by increasing anU1 (for the 2nd line)
aDeltaV1 = Min(aDeltaV1, Abs(aV12-aVSurf1f));
}
if((aV11 > aVSurf1l) && (aFact1 > 0.0))
{//Make close to aVSurf1l by increasing anU1 (for the 1st line)
aDeltaV1 = Min(aDeltaV1, Abs(aV11-aVSurf1l));
}
if((aV12 > aVSurf1l) && (aFact2 > 0.0))
{//Make close to aVSurf1l by increasing anU1 (for the 1st line)
aDeltaV1 = Min(aDeltaV1, Abs(aV12-aVSurf1l));
}
Standard_Real aDeltaU1L1 = !IsEqual(aFact1,0.0)? Abs(aDeltaV1/aFact1) : aStepMax,
aDeltaU1L2 = !IsEqual(aFact2,0.0)? Abs(aDeltaV1/aFact2) : aStepMax;
const Standard_Real aDeltaU1V1 = Min(aDeltaU1L1, aDeltaU1L2);
///////////////////////////
aFact1 = !IsEqual(sin(aU21-anEquationCoeffs.mFI2), 0.0) ?
anEquationCoeffs.mL1 * anEquationCoeffs.mB * sin(aU2[i] - anEquationCoeffs.mPSIV1) *
sin(anU1 - anEquationCoeffs.mFI1)/sin(aU2[i]-anEquationCoeffs.mFI2) : 0.0,
aFact2 = !IsEqual(sin(aU2[i]-anEquationCoeffs.mFI2), 0.0) ?
anEquationCoeffs.mK2 * sin(anU1 - anEquationCoeffs.mFIV2) +
anEquationCoeffs.mL2 * anEquationCoeffs.mB * sin(aU21 - anEquationCoeffs.mPSIV2) *
sin(anU1 - anEquationCoeffs.mFI1)/sin(aU21 - anEquationCoeffs.mFI2) : 0.0;
aFact2 = !IsEqual(sin(aU22-anEquationCoeffs.mFI2), 0.0) ?
anEquationCoeffs.mK2 * sin(anU1 - anEquationCoeffs.mFIV2) +
anEquationCoeffs.mL2 * anEquationCoeffs.mB * sin(aU22 - anEquationCoeffs.mPSIV2) *
sin(anU1 - anEquationCoeffs.mFI1)/sin(aU22 - anEquationCoeffs.mFI2) : 0.0;
anEquationCoeffs.mL2 * anEquationCoeffs.mB * sin(aU2[i] - anEquationCoeffs.mPSIV2) *
sin(anU1 - anEquationCoeffs.mFI1)/sin(aU2[i] - anEquationCoeffs.mFI2) : 0.0;
Standard_Real aDeltaV1 = (aVSurf1l - aVSurf1f)/IntToReal(aNbPoints),
aDeltaV2 = (aVSurf2l - aVSurf2f)/IntToReal(aNbPoints);
if((aV1[i] < aVSurf1f) && (aFact1 < 0.0))
{//Make close to aVSurf1f by increasing anU1
aDeltaV1 = Min(aDeltaV1, Abs(aV1[i]-aVSurf1f));
}
if((aV1[i] > aVSurf1l) && (aFact1 > 0.0))
{//Make close to aVSurf1l by increasing anU1
aDeltaV1 = Min(aDeltaV1, Abs(aV1[i]-aVSurf1l));
}
if((aV2[i] < aVSurf2f) && (aFact2 < 0.0))
{//Make close to aVSurf2f by increasing anU1
aDeltaV2 = Min(aDeltaV2, Abs(aV2[i]-aVSurf2f));
}
if((aV2[i] > aVSurf2l) && (aFact2 > 0.0))
{//Make close to aVSurf2l by increasing anU1
aDeltaV2 = Min(aDeltaV2, Abs(aV2[i]-aVSurf1l));
}
aDeltaU1V1 = !IsEqual(aFact1,0.0)? Abs(aDeltaV1/aFact1) : aStepMax;
aDeltaU1V2 = !IsEqual(aFact2,0.0)? Abs(aDeltaV2/aFact2) : aStepMax;
if(aDeltaU1V1 < aStepU1)
aStepU1 = aDeltaU1V1;
if(aDeltaU1V2 < aStepU1)
aStepU1 = aDeltaU1V2;
}
if(aStepU1 < aStepMin)
aStepU1 = aStepMin;
Standard_Real aDeltaV2 = (aVSurf2l - aVSurf2f)/IntToReal(aNbPoints);
if(aStepU1 > aStepMax)
aStepU1 = aStepMax;
if((aV21 < aVSurf2f) && (aFact1 < 0.0))
{//Make close to aVSurf2f by increasing anU1 (for the 1st line)
aDeltaV2 = Min(aDeltaV2, Abs(aV21-aVSurf2f));
}
if((aV22 < aVSurf2f) && (aFact2 < 0.0))
{//Make close to aVSurf1f by increasing anU1 (for the 2nd line)
aDeltaV2 = Min(aDeltaV2, Abs(aV22-aVSurf2f));
}
if((aV21 > aVSurf2l) && (aFact1 > 0.0))
{//Make close to aVSurf1l by increasing anU1 (for the 1st line)
aDeltaV2 = Min(aDeltaV2, Abs(aV21-aVSurf2l));
}
if((aV22 > aVSurf2l) && (aFact2 > 0.0))
{//Make close to aVSurf1l by increasing anU1 (for the 1st line)
aDeltaV2 = Min(aDeltaV2, Abs(aV22-aVSurf1l));
}
aDeltaU1L1 = !IsEqual(aFact1,0.0)? Abs(aDeltaV2/aFact1) : aStepMax;
aDeltaU1L2 = !IsEqual(aFact2,0.0)? Abs(aDeltaV2/aFact2) : aStepMax;
const Standard_Real aDeltaU1V2 = Min(aDeltaU1L1, aDeltaU1L2);
Standard_Real aDeltaU1 = Min(aDeltaU1V1, aDeltaU1V2);
if(aDeltaU1 < aStepMin)
aDeltaU1 = aStepMin;
if(aDeltaU1 > aStepMax)
aDeltaU1 = aStepMax;
anU1 += aDeltaU1;
anU1 += aStepU1;
const Standard_Real aDiff = anU1 - anUl;
if((0.0 < aDiff) && (aDiff < aDeltaU1-Precision::PConfusion()))
if((0.0 < aDiff) && (aDiff < aStepU1-Precision::PConfusion()))
anU1 = anUl;
anUf = anU1;
if(aWLine1->NbPnts() != 1)
isAddedIntoWL1 = Standard_False;
if(aWLine2->NbPnts() != 1)
isAddedIntoWL2 = Standard_False;
}
if((aWLine1->NbPnts() == 1) && (!isAddedIntoWL1))
{
isTheEmpty = Standard_False;
Standard_Real u1, v1, u2, v2;
aWLine1->Point(1).Parameters(u1, v1, u2, v2);
IntPatch_Point aP;
aP.SetParameter(u1);
aP.SetParameters(u1, v1, u2, v2);
aP.SetTolerance(theTol3D);
aP.SetValue(aWLine1->Point(1).Value());
theSPnt.Append(aP);
}
else if(aWLine1->NbPnts() > 1)
{
Standard_Boolean isGood = Standard_True;
if(aWLine1->NbPnts() == 2)
for(Standard_Integer i = 0; i < aNbWLines; i++)
{
const IntSurf_PntOn2S& aPf = aWLine1->Point(1);
const IntSurf_PntOn2S& aPl = aWLine1->Point(2);
if(aPf.IsSame(aPl, Precision::Confusion()))
isGood = Standard_False;
if(aWLine[i]->NbPnts() != 1)
isAddedIntoWL[i] = Standard_False;
}
}
if(isGood)
for(Standard_Integer i = 0; i < aNbWLines; i++)
{
if((aWLine[i]->NbPnts() == 1) && (!isAddedIntoWL[i]))
{
isTheEmpty = Standard_False;
isAddedIntoWL1 = Standard_True;
SeekAdditionalPoints( theQuad1, theQuad2, aWLine1->Curve(),
anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
theTol2D, aPeriod, 1.0, isTheReverse);
Standard_Real u1, v1, u2, v2;
aWLine[i]->Point(1).Parameters(u1, v1, u2, v2);
IntPatch_Point aP;
aP.SetParameter(u1);
aP.SetParameters(u1, v1, u2, v2);
aP.SetTolerance(theTol3D);
aP.SetValue(aWLine[i]->Point(1).Value());
aWLine1->ComputeVertexParameters(theTol3D);
theSlin.Append(aWLine1);
theSPnt.Append(aP);
}
}
else
{
isAddedIntoWL1 = Standard_False;
}
if((aWLine2->NbPnts() == 1) && (!isAddedIntoWL2))
{
isTheEmpty = Standard_False;
Standard_Real u1, v1, u2, v2;
aWLine2->Point(1).Parameters(u1, v1, u2, v2);
IntPatch_Point aP;
aP.SetParameter(u1);
aP.SetParameters(u1, v1, u2, v2);
aP.SetTolerance(theTol3D);
aP.SetValue(aWLine2->Point(1).Value());
theSPnt.Append(aP);
}
else if(aWLine2->NbPnts() > 1)
{
Standard_Boolean isGood = Standard_True;
if(aWLine2->NbPnts() == 2)
else if(aWLine[i]->NbPnts() > 1)
{
const IntSurf_PntOn2S& aPf = aWLine2->Point(1);
const IntSurf_PntOn2S& aPl = aWLine2->Point(2);
Standard_Boolean isGood = Standard_True;
if(aPf.IsSame(aPl, Precision::Confusion()))
isGood = Standard_False;
if(aWLine[i]->NbPnts() == 2)
{
const IntSurf_PntOn2S& aPf = aWLine[i]->Point(1);
const IntSurf_PntOn2S& aPl = aWLine[i]->Point(2);
if(aPf.IsSame(aPl, Precision::Confusion()))
isGood = Standard_False;
}
if(isGood)
{
isTheEmpty = Standard_False;
isAddedIntoWL[i] = Standard_True;
SeekAdditionalPoints( theQuad1, theQuad2, aWLine[i]->Curve(),
anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
theTol2D, aPeriod, anArccosFactor[i], isTheReverse);
aWLine[i]->ComputeVertexParameters(theTol3D);
theSlin.Append(aWLine[i]);
}
}
if(isGood)
else
{
isTheEmpty = Standard_False;
isAddedIntoWL2 = Standard_True;
SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
theTol2D, aPeriod, -1.0, isTheReverse);
aWLine2->ComputeVertexParameters(theTol3D);
theSlin.Append(aWLine2);
isAddedIntoWL[i] = Standard_False;
}
}
else
{
isAddedIntoWL2 = Standard_False;
}
}
}
@@ -2556,8 +2419,6 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
if(hasBeenRemoved)
aNumOfLine1--;
//aWLine1->ComputeVertexParameters(theTol3D);
}
}//if(theSlin.Length() > 0)

View File

@@ -1071,7 +1071,7 @@ void IntPatch_WLine::Dump() const {
for(i=1;i<=nbp;i++) {
Standard_Real u1,v1,u2,v2;
Point(i).Parameters(u1,v1,u2,v2);
printf("%4d [%+5.8e %+5.8e %+5.8e] [%+5.8e %+5.8e] [%+5.8e %+5.8e]\n",
printf("%4d [%+10.20f %+10.20f %+10.20f] [%+10.20f %+10.20f] [%+10.20f %+10.20f]\n",
i,
Point(i).Value().X(),
Point(i).Value().Y(),

View File

@@ -136,6 +136,8 @@ options:\n\
(switched off by default)\n\n\
-int_vert_off disables insertion of internal vertices into mesh\n\
(enabled by default)\n\
-surf_def_off disables control of deflection of mesh from real\n\
surface (enabled by default)\n\
-parallel enables parallel execution (switched off by default)\n";
return 0;
}
@@ -147,12 +149,13 @@ options:\n\
return 0;
}
Standard_Real aLinDeflection = Max(Draw::Atof(argv[2]), Precision::Confusion());
Standard_Real aAngDeflection = 0.5;
Standard_Real aMinSize = Precision::Confusion();
Standard_Boolean isRelative = Standard_False;
Standard_Boolean isInParallel = Standard_False;
Standard_Boolean isIntVertices = Standard_True;
Standard_Real aLinDeflection = Max(Draw::Atof(argv[2]), Precision::Confusion());
Standard_Real aAngDeflection = 0.5;
Standard_Real aMinSize = Precision::Confusion();
Standard_Boolean isRelative = Standard_False;
Standard_Boolean isInParallel = Standard_False;
Standard_Boolean isIntVertices = Standard_True;
Standard_Boolean isControlSurDef = Standard_True;
if (nbarg > 3)
{
@@ -170,6 +173,8 @@ options:\n\
isInParallel = Standard_True;
else if (aOpt == "-int_vert_off")
isIntVertices = Standard_False;
else if (aOpt == "-surf_def_off")
isControlSurDef = Standard_False;
else if (i < nbarg)
{
Standard_Real aVal = Draw::Atof(argv[i++]);
@@ -194,6 +199,7 @@ options:\n\
aMesher.SetParallel (isInParallel);
aMesher.SetMinSize (aMinSize);
aMesher.SetInternalVerticesMode(isIntVertices);
aMesher.SetControlSurfaceDeflection(isControlSurDef);
aMesher.Perform();
di << "Meshing statuses: ";

View File

@@ -114,7 +114,7 @@ void NCollection_UtfIterator<Type>::readUTF16()
if (aChar >= UTF16_SURROGATE_HIGH_START
&& aChar <= UTF16_SURROGATE_HIGH_END)
{
Standard_Utf32Char aChar2 = *myPosition;
const Standard_Utf32Char aChar2 = *myPosNext;
// complete the surrogate pair
if (aChar2 >= UTF16_SURROGATE_LOW_START
&& aChar2 <= UTF16_SURROGATE_LOW_END)

View File

@@ -141,7 +141,6 @@ OpenGl_ShaderManager.hxx
OpenGl_ShaderManager.cxx
OpenGl_ShaderStates.hxx
OpenGl_ShaderStates.cxx
OpenGl_SequenceOfStructure.hxx
Handle_OpenGl_ShaderObject.hxx
Handle_OpenGl_ShaderProgram.hxx
Handle_OpenGl_ShaderManager.hxx

View File

@@ -81,9 +81,11 @@ void OpenGl_BVHClipPrimitiveSet::Assign (const OpenGl_ArrayOfStructure& theStruc
myStructs.Clear();
const Standard_Integer aNbPriorities = theStructs.Length();
OpenGl_SequenceOfStructure::Iterator aStructIter;
for (Standard_Integer aPriorityIdx = 0; aPriorityIdx < aNbPriorities; ++aPriorityIdx)
{
for (OpenGl_SequenceOfStructure::Iterator aStructIter (theStructs (aPriorityIdx)); aStructIter.More(); aStructIter.Next())
const OpenGl_SequenceOfStructure& aSeq = theStructs (aPriorityIdx);
for (aStructIter.Init (aSeq); aStructIter.More(); aStructIter.Next())
{
const OpenGl_Structure* aStruct = aStructIter.Value();
if (!aStruct->IsAlwaysRendered())

View File

@@ -17,12 +17,14 @@
#define _OpenGl_BVHClipPrimitiveSet_HeaderFile
#include <BVH_PrimitiveSet.hxx>
#include <NCollection_Array1.hxx>
#include <NCollection_Sequence.hxx>
#include <OpenGl_Vec.hxx>
#include <OpenGl_Structure.hxx>
#include <OpenGl_SequenceOfStructure.hxx>
typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
//! Set of OpenGl_Structures for building BVH tree.

View File

@@ -176,24 +176,6 @@ void OpenGl_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theGlCtx)
theGlCtx->arbFBO->glBindFramebuffer (GL_FRAMEBUFFER, myGlFBufferId);
}
// =======================================================================
// function : BindDrawBuffer
// purpose :
// =======================================================================
void OpenGl_FrameBuffer::BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx)
{
theGlCtx->arbFBO->glBindFramebuffer (GL_DRAW_FRAMEBUFFER, myGlFBufferId);
}
// =======================================================================
// function : BindReadBuffer
// purpose :
// =======================================================================
void OpenGl_FrameBuffer::BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx)
{
theGlCtx->arbFBO->glBindFramebuffer (GL_READ_FRAMEBUFFER, myGlFBufferId);
}
// =======================================================================
// function : UnbindBuffer
// purpose :

View File

@@ -92,15 +92,9 @@ public:
Standard_EXPORT void ChangeViewport (const GLsizei theVPSizeX,
const GLsizei theVPSizeY);
//! Bind frame buffer for drawing and reading (to render into the texture).
//! Bind frame buffer (to render into the texture).
Standard_EXPORT virtual void BindBuffer (const Handle(OpenGl_Context)& theGlCtx);
//! Bind frame buffer for drawing GL_DRAW_FRAMEBUFFER (to render into the texture).
Standard_EXPORT virtual void BindDrawBuffer (const Handle(OpenGl_Context)& theGlCtx);
//! Bind frame buffer for reading GL_READ_FRAMEBUFFER
Standard_EXPORT virtual void BindReadBuffer (const Handle(OpenGl_Context)& theGlCtx);
//! Unbind frame buffer.
Standard_EXPORT virtual void UnbindBuffer (const Handle(OpenGl_Context)& theGlCtx);

View File

@@ -59,6 +59,7 @@
// in core since OpenGL ES 3.0, extension GL_OES_rgb8_rgba8
#define GL_RGB8 0x8051
#define GL_RGBA8 0x8058
#define GL_LUMINANCE8 0x8040
// GL_EXT_texture_format_BGRA8888
#define GL_BGRA_EXT 0x80E1 // same as GL_BGRA on desktop

View File

@@ -419,16 +419,17 @@ Standard_Boolean OpenGl_GraphicDriver::SetImmediateModeDrawToFront (const Graphi
// function : DisplayImmediateStructure
// purpose :
// =======================================================================
void OpenGl_GraphicDriver::DisplayImmediateStructure (const Graphic3d_CView& theCView,
const Handle(Graphic3d_Structure)& theStructure)
void OpenGl_GraphicDriver::DisplayImmediateStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure)
{
OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aCView == NULL)
{
return;
}
aCView->View->DisplayImmediateStructure (theStructure);
aCView->View->DisplayImmediateStructure (aStructure);
}
// =======================================================================

View File

@@ -122,18 +122,18 @@ public:
public: // Methods for graphical structures
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer thePriority);
Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
const Handle(Graphic3d_Structure)& theStructure);
Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority);
Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure);
Standard_EXPORT void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure);
Standard_EXPORT Handle(Graphic3d_CStructure) Structure (const Handle(Graphic3d_StructureManager)& theManager);
Standard_EXPORT Standard_Boolean SetImmediateModeDrawToFront (const Graphic3d_CView& theCView,
const Standard_Boolean theDrawToFrontBuffer);
Standard_EXPORT void DisplayImmediateStructure (const Graphic3d_CView& theCView,
const Handle(Graphic3d_Structure)& theStructure);
Standard_EXPORT void DisplayImmediateStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure);
Standard_EXPORT void EraseImmediateStructure (const Graphic3d_CView& theCView,
const Graphic3d_CStructure& theCStructure);

View File

@@ -19,25 +19,27 @@
#include <OpenGl_Structure.hxx>
#include <OpenGl_CView.hxx>
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
const Handle(Graphic3d_Structure)& theStructure,
const Standard_Integer thePriority)
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure,
const Standard_Integer thePriority)
{
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aCView == NULL)
return;
aCView->View->DisplayStructure (theStructure, thePriority);
aCView->View->DisplayStructure (aStructure, thePriority);
}
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
const Handle(Graphic3d_Structure)& theStructure)
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
Graphic3d_CStructure& theCStructure)
{
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
if (aCView == NULL)
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
if (aCView == NULL || aStructure == NULL)
return;
aCView->View->EraseStructure (theStructure);
aCView->View->EraseStructure (aStructure);
}
void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)

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