1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

37 Commits

Author SHA1 Message Date
abv
6d61efef1e 0029024: DRAW - use common approach for reporting error message on wrong command arguments
Method Draw_Interpretor::ErrorOnWrongArgs() is added, providing user message for DRAW command called with incorrect arguments.
2017-08-21 16:48:23 +03:00
apv
cba287d62a Update of tests database
Test for 0025930: thickness of spherical cap is invalid
Test for 0025939: SIGSEGV in MakeThickSolid
Test for 0025940: MakeThickSolid creates C0 continuous edges
Test for 0026604: GeomFill_Pipe doesn't fit given bounds
Test for 0026655: ChFi3d_Builder algorithm fails to build fillets if some input edges connect with seam edges
Test for 0026697: BRepFeat_MakePrism returns empty compound
Test for 0026716: Mesher cannot create a mesh of brep model due to ShapeFix_Wire::FixShifted()
Test for 0026735: Adjacent perpendicular edges are detected as overlapped by DRAW command checkoverlap.
Test for 0026793: General Fuse algorithm produces incorrect result
Test for 0026795: Unable to perform General Fuse operation on the attached faces
Test for 0026842: bopsection result does not contain any edges.
Test for 0026882: Edge/Edge intersection algorithm produces incorrect result
Test for 0026883: Wrong result of Boolean Operation
Test for 0026889: Very poor mesh result from shape
Test for 0026928: Edges are meshed too coarsly
Test for 0026933: Section works unstably due to incorrect work of the method IsExistingPaveBlock
Test for 0026943: Wrong projection of helix on cylinder by ShapeConstruct_ProjectCurveOnSurface
Test for 0026957: Unify same domain operation is slow for multiple shells
Test for 0026978: Interactive selection is insensitive to swept shell
Test for 0027004: ShapeUpgrade_UnifySameDomain produces invalid result
Test for 0026280: Mechanism 'ShapeFix' is unable to heal a shape
Test for 0026282: Mechanism 'ShapeFix' has errors revealed by wire tool 'FixTails'
Test for 0026291: BRepMesh produces mesh with gap on the attached shape
Test for 0026382: BRepMesh produces internal nodes outside the face interior
Test for 0027453: Wrongly meshed surface
Test for 0027524: The command checkshape does not find the maximal deviation between curves representations
Test for 0026225: Wrong result of chamfer in case of coinciding bound of chamfer's surface with bound of a face
Test for 0026295: Sweep fails with BRepFill_ContactOnBorder
Test for 0026374: GeomFill_Profiler fails to unify BSplines if one has knot distance less than PConf
Test for 0026558: Failing to build isoline for offset surface
Test for 0026563: Boolean cut operation in new API multi-tool mode performs fuse instead of cut
Test for 0026568: Exception when creating pipe
Test for 0027419: Incorrect result of Edge/Face intersection
Test for 0027469: Regression vs 6.9.1: Wrong result of Edge/Face intersection
Test for 0027471: Wrong result of pipe
Test for 0027472: Wrong result of cut
Test for 0027614: Sewing returns result with too high tolerance
Test for 0026154: Visualization - v3d viewer grid disappears due to automatic z-fit
Test for 0026174: Loss of color after the second write of file (iges).
2017-08-18 12:13:40 +03:00
apn
fe6c26dc50 0029010: Launch custom.bat in samples before calling general environment
Replace calling custom.bat and general env.bat in samples.
2017-08-18 12:13:27 +03:00
nds
9294c8f774 0028631: Modeling Algorithms - Crash while building a 2D circle tangent to another circle and passing through its center
Code correction includes also:
- extending GccEnt to have GccEnt_Position conversion to string value and backward;
- new GeometryTest_DrawableQualifiedCurve2d DRAW object to wrap GccEnt_QualifiedCirc/GccEnt_QualifiedLin.
  It is a DrawTrSurf_Curve2d with GccEnt_Position visualized in orange color.
- qcircle/qline DRAW command to create instance of GeometryTest_DrawableQualifiedCurve2d
- circ2d3Tan DRAW command to wrap GccAna_Circ2d3Tan taking qcircle/qline/point arguments.
2017-08-17 22:21:32 +03:00
kgv
905b0e3175 0028527: Visualization, AIS_InteractiveContext - custom selection presentation is never removed from View 2017-08-17 22:21:31 +03:00
emv
a743814be9 0029000: Update documentation of Boolean operations according to the new Error/Warning reporting system
The documentation of Boolean Component has been updated - calls to ErrorStatus() method have been replaced with calls to HasErrors() method.
2017-08-17 22:21:30 +03:00
abv
efe9d99730 0029009: Configuration - provide a way to get visual dif of SVG images
New helper script svgdiff.bat is added in adm folder.
It can be used for enabling visual diff for SVG images in TortouseGit; see Git guide for details.
2017-08-17 22:21:29 +03:00
abv
471a2ca0bf 0028959: Configuration, genproj - provide warning on update of scripts in root folder (msvc.bat etc.)
When updating files msvc.bat and draw.bat/sh in the root folder by copying template from adm/templates, procedure genproj will give a warning (unless the files are already the same); if the target file is newer, its copy is saved with additional extension .bak.
2017-08-17 22:21:16 +03:00
vro
f97095fada 0028972: A not useful message is printed on copying of data in OCAF 2017-08-17 15:49:17 +03:00
abv
22e7073865 0027561: Since OCCT 7.0.0, exporting a curve to STL creates a file that results in an endless loop when read
Add check for empty triangulation when writing STL file to report error instead of creation of empty file.

STL reader has been improved to properly handle case of empty or small files, and Ascii files without EOL at the end.
2017-08-17 15:49:11 +03:00
kgv
d21ddc4f17 0029007: Visualization, AIS_InteractiveContext - the method for accessing Detected owners iterator is missing
Added new method AIS_InteractiveContext::DetectedCurrentOwner().
AIS_InteractiveContext header has been restructured (methods moved into groups)
and description has been cleaned up.
2017-08-17 15:48:44 +03:00
kgv
51004f1cf9 0027381: Visualization - update description of method AIS_InteractiveContext::SetPixelTolerance() 2017-08-17 15:48:36 +03:00
abv
0ef598d064 0028249: Upgrade Guide - mention need to use option -std=c++0x when using GCC 2017-08-17 15:48:29 +03:00
mkv
fbd0023f75 0028967: Boolean cut fails the first time, works the second time 2017-08-17 15:48:22 +03:00
emv
2783b13ce6 0028893: BOP cut produces result with artifacts consisting of tools parts 2017-08-17 15:48:15 +03:00
kgv
cee2b5567d 0028323: Documentation - explain highlighting logic of AIS_InteractiveObject in the upgrade guide 2017-08-17 15:48:04 +03:00
abv
d7a28edad2 0028225: MFC sample on OCAF uses old-style definition of a Handle-class
Obsolete approach to definition of OCCT RTTI in sample classes generated by WOK from CDL is replaced by usage of standard macros
2017-08-17 15:47:58 +03:00
emv
7337535943 0028892: BOPAlgo_PaveFiller returns status "error: 11" in draw or raises exception in app on the given shapes set
Boolean Operations algorithm - Added processing of the untouched edges (without edge set) in the UpdatePaveBlocks method.

IntCurvesFace_Intersector algorithm - Avoid calculation of the number of sample points on the surfaces with too small UV ranges.
2017-08-17 15:47:50 +03:00
razmyslovich
359cdde7ed 0027358: ShapeAnalysis_Curve::GetSamplePoints iteration logic isn't robust
The iterating logic in ShapeAnalysis_Curve::GetSamplePoints() is made more robust: instead of iterative incrementing parameter by adding step, parameter at each point is calculated independently from index.
This avoids possible accumulation of numeric errors, and ensures that generated points are equally spaced and their quantity is respected in all cases.
2017-08-17 15:47:39 +03:00
skl
2bc6f71528 0028715: Invalid shape produced by reading of attached STEP file. Regression from OCCT-6.9.1 to OCCT-7.0.0.
Corrections: to use fixed shape as result in the non-manifold mode was made.

Regression was due to using modified initial shape as result in the previous version OCCT. At present initial shape is not modified during ShapeProcessing. Therefore modification to use fixed result was made.

Additionally using of nonManifold flag is added to ShapeProcessing.
2017-08-17 15:47:32 +03:00
apv
a2456ed88a 0026516: Creating revolved shapes fails in some cases 2017-08-17 15:47:25 +03:00
mkv
98f5d739e3 0026776: Bad result of section algorithm 2017-08-17 15:47:08 +03:00
apv
dfdfa61fb5 Update of tests database
Test for 0023838: Standard_OutOfRange in Geom_OffsetSurface::LocalDN (called by BRepFill_PipeShell)
Test for 0023866: GccAna_Circ2d3Tan does not find a circle
Test for 0023925: BRepFeat_SplitShape produces invalid shape
Test for 0023942: Pipe algorithms unrobust to number rounding
Test for 0025385: steep increase in tolerance by intersection
Test for 0025395: SIGSEGV in BRepOffsetAPI_MakeThickSolid
Test for 0025458: can a sweep be used to create 1-fold tori (using a closed wire as path)
Test for 0025478: Fillets can not touch
Test for 0025481: Edge must not contain obsolete curve representations
Test for 0025515: Boolean operation become worse for unknown reason.
Test for 0025521: Fillet creates shell with bad orientation of SubShape
Test for 0025551: BRepMesh can produce internal nodes outside the face interior based on distorted BSpline surface
Test for 0025586: Poor mesh quality, or failure of meshing for closed extruded surfaces with holes
Test for 0025626: Loft of ellipses shows wrinkle near seam edge
Test for 0025628: BRepMesh fails to mesh face with open wire, considered as correct by checkshape
Test for 0025693: Wire of BSplines fails bopcheck
Test for 0025730: result of MakeThickSolid aborts the BOPCheck in Geom_OffsetSurface::SetD0
Test for 0025738: BRepMesh fails to produce correct mesh for the face
Test for 0025776: HLR returns intersecting edges in OutLineV of helical sweep
Test for 0025798: BRepFeat_SplitShape returns invalid result
Test for 0025817: crescent face is not meshed
Test for 0025827: BRepMesh does not synchronize parameters of glued vertices on small edges
Test for 0025837: Bad triangulation when IGES loaded in meters
Test for 0025852: Text to BRep algorithm produces bad faces for circled symbols
Test for 0025856: BRepOffsetAPI_ThruSections returns an invalid shape if one wire contains degenerated edges
Test for 0025879: result of blend fails the bopcheck
Test for 0025967: Shape Healing fails to correct a face with missing poles and pcurves
Test for 0026052: Missing pcurves are computed incorrectly on two connected faces laying on the same surface
Test for 0025061: BRepMesh should skip internal wires with self intersections to produce mesh for the shape anyway
Test for 0024490: Computed surface properties differ substantially depending on NaturalRestriction flag
Test for 0024568: Split shape produces an invalid result
Test for 0024692: fuseedge corruption of spherical edge
Test for 0024772: Intersection of cylinder and cone produces incorrect results
Test for 0024954: BRepBuilderAPI_MakeFace adds wire with aribitary orientation
Test for 0025104: Prism from BSpline curve can not be chamfered
Test for 0025206: Fillet creates edge with C0 continuity
Test for 0025979: fillet creates faces with non-closed wires
Test for 0025983: Fusion of sweep and its mirror invalid
Test for 0025994: Boolean fuse result in invalid result.
Test for 0026034: Result of revolution aborts the bopcheck if translated
Test for 0026077: nurbsconvert of psphere fails the bopargcheck
Test for 0025989: toridial surface gets damaged in STEP export
2017-08-10 13:56:12 +03:00
Thomas Krijnen
d37ac0c26e 0028983: Configuration - HAVE_NO_DLL causes compilation to fail on MSVC 2017-08-10 13:56:10 +03:00
emv
a318d719e7 0028982: 2D offset creates faulty result from wire
Protection of the Edge/Edge intersection algorithm (IntTools_EdgeEdge) from incomplete type conversion due to presence of the Trimmed curves by using Adaptors for getting typed curves instead of direct casting.

Test case for the issue.
2017-08-09 18:11:03 +03:00
emv
9d8e074451 0027876: Draw mkoffset does not work
Updating the documentation for the Draw command *mkoffset*.
2017-08-08 18:17:41 +03:00
kgv
cd1918d6b7 0028980: Coding rules - suppress GCC compiler warnings -Warray-bounds within AdvApp2Var 2017-08-08 18:15:13 +03:00
kgv
7379f4424d 0028979: Coding rules - eliminate GCC compiler warnings -Wstrict-aliasing within Graphic3d_ArrayOfPrimitives.lxx 2017-08-08 18:13:51 +03:00
kgv
fdb8a039b4 0028978: Coding rules - suppress GCC compiler warnings -Warray-bounds within NCollection_Array1 2017-08-08 18:11:47 +03:00
aml
1428d37a1a 0028974: Test cases for STL reader/writer
Add new test grid for STL read/write.
2017-08-08 18:10:17 +03:00
kgv
e40d1acc28 0028975: Draw Harness - DBRep_DrawableShape::display() throws exception while displaying shape without free edges in Debug mode 2017-08-08 18:07:37 +03:00
vro
095e90a2c5 0028973: Undo/Redo changes the order of some attributes 2017-08-08 18:04:37 +03:00
kgv
e2c4ce4869 0028971: Configuration - fix compatibility with glibc 2.26+ due to xlocale.h removal 2017-08-08 17:45:40 +03:00
apv
b101eb1ff0 0025023: Check fails after cut operation 2017-08-08 17:44:01 +03:00
nbv
fc935b4f6b 0028944: Cannot find section between two faces
Test case has been created because the problem is not reproduced on the current version of OCCT.
2017-08-08 17:40:57 +03:00
abv
f7b6063134 0028112: Exception during offset computation
Methods D0, D1, D2, D3, DN of the class GeomEvaluator_OffsetSurface are extended by additional tweak to compensate failure of normal calculation in degenerated points on triangular surfaces.
If the point where normal has failed to calculate is located on parametric boundary of the base surface, one more attempt is made with the point shifted towards interior by Precision::PConfusion().
2017-08-03 17:52:51 +03:00
szy
e16302cee1 0028946: Exception on Undo.
//Added additional command ForgetAtt and test case E1 to test issue 28946.
2017-08-02 18:12:09 +03:00
327 changed files with 7594 additions and 5523 deletions

View File

@@ -26,7 +26,7 @@ set path [file normalize .]
set THE_CASROOT ""
set fBranch ""
if { [info exists ::env(CASROOT)] } {
set THE_CASROOT "$::env(CASROOT)"
set THE_CASROOT [file normalize "$::env(CASROOT)"]
}
proc _get_options { platform type branch } {
@@ -344,6 +344,22 @@ proc genproj {theFormat args} {
genAllResources
}
# copy file providing warning if the target file exists and has
# different date or size; if it is newer than source, save it as .bak
proc copy_with_warning {from to} {
if { [file exists "$to"] &&
([file size "$to"] != [file size "$from"] ||
[file mtime "$to"] != [file mtime "$from"]) } {
puts "Warning: file $to is updated (copied from $from)!"
if { [file mtime $to] > [file mtime $from] } {
puts "Info: old content of file $to is saved in ${to}.bak"
file copy -force -- "$to" "${to}.bak"
}
}
file copy -force -- "$from" "$to"
}
proc genprojbat {theFormat thePlatform} {
set aTargetPlatformExt sh
if { $thePlatform == "wnt" || $thePlatform == "uwp" } {
@@ -369,11 +385,11 @@ proc genprojbat {theFormat thePlatform} {
close $anEnvFile
}
file copy -force -- "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
copy_with_warning "$::THE_CASROOT/adm/templates/draw.${aTargetPlatformExt}" "$::path/draw.${aTargetPlatformExt}"
}
if { [regexp {^vc} $theFormat] } {
file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
copy_with_warning "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
} else {
switch -exact -- "$theFormat" {
"cbp" {

31
adm/svgdiff.bat Normal file
View File

@@ -0,0 +1,31 @@
@echo off
rem Script to diff SVG images visually (as PNG) in TortoiseGit client
rem
rem It assumes that Inkscape and TortoiseGitIDiff executables are either
rem installed in default locations in Program Files, or are accessible by PATH
rem
rem To use this script for diffing SVG images, open TortoiseGit settings
rem (Start -> Programs -> TortoiseGit -> Settings), select "Diff Viewer",
rem click button "Advanced..." on the right tab and then add new record:
rem - Extension: .svg
rem - External program: <path to OCCT>\adm\svgdiff.bat %base %mine %bname %yname
rem Remove double quotes around arguments
set "f1=%1"
set "f2=%2"
set "f1=%f1:~1,-1%.png"
set "f2=%f2:~1,-1%.png"
rem Check if Inkscape and TortoiseGit are installed in default locations in
rem ProgramFiles; if not, assume they still may be accessible by PATH
set "inkscape=%ProgramFiles%\Inkscape\inkscape.exe"
if not exist "%inkscape%" set inkscape=inkscape.exe
set "tgitidiff=%ProgramFiles%\TortoiseGit\bin\TortoiseGitIDiff.exe"
if not exist "%tgitidiff%" set tgitidiff=TortoiseGitIDiff.exe
rem Convert SVG to PNG using Inkscape
"%inkscape%" -e "%f1%" %1
"%inkscape%" -e "%f2%" %2
rem Call Tortoise differ
"%tgitidiff%" /left:"%f1%" /right:"%f2%" /lefttitle:%3 /righttitle:%4

View File

@@ -56,6 +56,6 @@ To build all toolkits, click **Build->Build workspace** in the menu bar.
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
~~~~~
./draw_cbp.sh cbp [d]
./draw.sh cbp [d]
~~~~~
Option *d* is used if OCCT has been built in **Debug** mode.

View File

@@ -82,7 +82,7 @@ The official repository contains:
@subsection occt_gitguide_1_5 Version of Git
The repository is tested to work with Git 1.7.6 to 1.7.9.
The repository is tested to work with Git 1.7.6 and above.
Please do not use versions below 1.7.1 as they are known to cause troubles.
@section occt_gitguide_2 Installing Tools for Work with Git
@@ -139,6 +139,13 @@ The official repository contains:
@figure{OCCT_GitGuide_V2_image006.png,"",320}
Optionally, you can set up TortoiseGit to use visual diff utility for SVG images used in OCCT documentation.
For that, click on item "Diff Viewer" in the Settings dialog, then click button "Advanced..." on the right tab add new record with the following parameters:
- Extension: <code>.svg</code>
- External program: <code>&lt;path_to_OCCT&gt;\\adm\\svgdiff.bat %%base %%mine %%bname %%yname</code>
@figure{OCCT_GitGuide_V2_svgdiff.png,"",709}
@subsection occt_gitguide_2_2 Linux platform
We assume that Linux users have Git already installed and available in the *PATH*.

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@@ -324,6 +324,15 @@ The methods *V3d_View::Convert* and *V3d_View::ConvertWithProj()* have ceased to
Porting of user applications from an earlier OCCT version to version 7.0.0 requires taking into account the following major changes.
Building OCCT now requires compiler supporting some C++11 features.
The supported compilers are:
- MSVC: version 10 (Visual Studio 2010) or later
- GCC: version 4.3 or later
- CLang: version 3.6 or later
- ICC: version XE 2013 SP 1 or later
When compiling code that uses OCCT with GCC and CLang compilers, it is necessary to use compiler option -std=c++0x (or its siblings) to enable C++11 features.
@subsection upgrade_700_persist Removal of legacy persistence
Legacy persistence for shapes and OCAF data based on *Storage_Schema* (toolkits *TKPShape*, *TKPLCAF*, *TKPCAF*, *TKShapeShcema, TLStdLSchema, TKStdSchema*, and *TKXCAFSchema*) has been removed in OCCT 7.0.0.
@@ -1195,6 +1204,9 @@ Management of highlight attributes has been revised and might require modificati
it is now possible to customize default highlight attributes like *Display Mode* and *ZLayer*, which previously could be defined only on Object level.
* Properties *Prs3d_Drawer::HighlightStyle()* and *Prs3d_Drawer::SelectionStyle()* have been removed.
Instead, *AIS_InteractiveObject* now defines *DynamicHilightAttributes()* for dynamic highlighting in addition to *HilightAttributes()* used for highlighting in selected state.
Note that *AIS_InteractiveObject::HilightAttributes()* and *AIS_InteractiveObject::DynamicHilightAttributes()* override highlighting properties for both - entire object and for part coming from decomposition.
This includes Z-layer settings, which will be the same when overriding properties through AIS_InteractiveObject, while *AIS_InteractiveContext::HighlightStyle()* allows customizing properties for local and global selection independently
(with Graphic3d_ZLayerId_Top used for dynamic highlighting of entire object and Graphic3d_ZLayerId_Topmost for dynamic highlighting of object part by default).
* The following protected fields have been removed from class *AIS_InteractiveObject*:
- *myOwnColor*, replaced by *myDrawer->Color()*
- *myTransparency*, replaced by *myDrawer->Transparency()*
@@ -1410,3 +1422,10 @@ The history of the changing of the initial shape was corrected:
@subsection upgrade_720_Change_In_RWStl Changes in STL Reader / Writer
Class RWStl now uses class Poly_Triangulation for storing triangular mesh instead of StlMesh data classes; the latter have been removed.
@subsection upgrade_720_New_Error_Warning_system_in_BOA Refactoring of the Error/Warning reporting system in Boolean Component
The Error/Warning reporting system of the algorithms in Boolean Component (in all BOPAlgo_* and BRepAlgoAPI_* algorithms) has been refactored.
The methods returning the status of errors and warnings of the algorithms (ErrorStatus() and WarningStatus()) have been removed.
Instead use methods HasErrors() and HasWarnings() to check for presence of errors and warnings, respectively.
The full list of errors and warnings, with associated data such as problematic sub-shapes, can be obtained by method GetReport().

View File

@@ -540,6 +540,23 @@ The structure *BOPDS_FaceInfo* has the following contents.
The objects of type *BOPDS_FaceInfo* are stored in one container of array type. The array allows getting the access to the information by index. This index (if exists) is stored in the field *myReference*.
@section occt_algorithms_root_classes Root Classes
@subsection occt_algorithms_root_classes_1 Class BOPAlgo_Options
The class *BOPAlgo_Options* provides the following options for the algorithms:
* Set the appropriate memory allocator;
* Check the presence of the Errors and Warnings;
* Turn on/off the parallel processing;
* Set the additional tolerance for the operation;
* Break the operations by user request.
@subsection occt_algorithms_root_classes_2 Class BOPAlgo_Algo
The class *BOPAlgo_Algo* provides the base interface for all algorithms:
* Perform the operation;
* Check the input data;
* Check the result.
@section occt_algorithms_5 Intersection Part
Intersection Part (IP) is used to
@@ -553,17 +570,7 @@ Intersection Part (IP) is used to
IP is implemented in the class *BOPAlgo_PaveFiller*.
@figure{/user_guides/boolean_operations/images/operations_image064.svg,"Diagram for Class BOPAlgo_PaveFiller",230}
@subsection occt_algorithms_5_1a Class BOPAlgo_Algo
The class *BOPAlgo_Algo* provides the base interface for all algorithms to provide the possibility to:
* Get Error status;
* Get Warning status;
* Turn on/off the parallel processing
* Break the operations by user request
* Check data;
* Check the result;
* Set the appropriate memory allocator.
@figure{/user_guides/boolean_operations/images/operations_image064.png,"Diagram for Class BOPAlgo_PaveFiller",230}
The description provided in the next paragraphs is coherent with the implementation of the method *BOPAlgo_PaveFiller::Perform()*.
@@ -745,8 +752,11 @@ BP is implemented in the following classes:
* *BOPAlgo_Builder* -- for the General Fuse operator (GFA).
* *BOPAlgo_BOP* -- for the Boolean Operation operator (BOA).
* *BOPAlgo_Section* -- for the Section operator (SA).
* *BOPAlgo_MakerVolume* -- for the Volume Maker operator.
* *BOPAlgo_Splitter* -- for the Splitter operator.
* *BOPAlgo_CellsBuilder* -- for the Cells Builder operator.
@figure{/user_guides/boolean_operations/images/operations_image020.svg,"Diagram for BP classes",300}
@figure{/user_guides/boolean_operations/images/operations_image020.png,"Diagram for BP classes",300}
The class *BOPAlgo_BuilderShape* provides the interface for algorithms that have:
* A Shape as the result;
@@ -1088,7 +1098,7 @@ aSplitter.SetNonDestructive(bSafeMode);
aSplitter.SetGlue(aGlue);
//
aSplitter.Perform(); //perform the operation
if (aSplitter.ErrorStatus()) { //check error status
if (aSplitter.HasErrors()) { //check error status
return;
}
//
@@ -2061,7 +2071,7 @@ aMV.SetGlue(aGlue);
aMV.SetAvoidInternalShapes(bAvoidInternalShapes);
//
aMV.Perform(); //perform the operation
if (aMV.ErrorStatus()) { //check error status
if (aMV.HasErrors()) { //check error status
return;
}
//
@@ -2151,7 +2161,7 @@ aCBuilder.SetNonDestructive(bSafeMode);
aCBuilder.SetGlue(aGlue);
//
aCBuilder.Perform(); // build splits of all arguments (GF)
if (aCBuilder.ErrorStatus()) { // check error status
if (aCBuilder.HasErrors()) { // check error status
return;
}
//
@@ -2804,7 +2814,6 @@ The following example illustrates how to use General Fuse operator:
#include <BRepAlgoAPI_BuilderAlgo.hxx>
{…
Standard_Boolean bRunParallel;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_BuilderAlgo aBuilder;
//
@@ -2841,8 +2850,7 @@ The following example illustrates how to use General Fuse operator:
//
// run the algorithm
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
if (iErr) {
if (aBuilder.HasErrors()) {
// an error treatment
return;
}
@@ -2945,7 +2953,7 @@ aSplitter.SetGlue(aGlueOpt);
// run the algorithm
aSplitter.Build();
// check error status
if (aSplitter.ErrorStatus()) {
if (aSplitter.HasErrors()) {
return;
}
//
@@ -3012,7 +3020,6 @@ The following example illustrates how to use Common operation:
#include < BRepAlgoAPI_Common.hxx>
{…
Standard_Boolean bRunParallel;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_Common aBuilder;
@@ -3052,8 +3059,7 @@ The following example illustrates how to use Common operation:
//
// run the algorithm
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
if (iErr) {
if (aBuilder.HasErrors()) {
// an error treatment
return;
}
@@ -3119,7 +3125,6 @@ The following example illustrates how to use Fuse operation:
#include < BRepAlgoAPI_Fuse.hxx>
{…
Standard_Boolean bRunParallel;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_Fuse aBuilder;
@@ -3159,8 +3164,7 @@ The following example illustrates how to use Fuse operation:
//
// run the algorithm
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
if (iErr) {
if (aBuilder.HasErrors()) {
// an error treatment
return;
}
@@ -3226,7 +3230,6 @@ The following example illustrates how to use Cut operation:
#include < BRepAlgoAPI_Cut.hxx>
{…
Standard_Boolean bRunParallel;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_Cut aBuilder;
@@ -3266,8 +3269,7 @@ The following example illustrates how to use Cut operation:
//
// run the algorithm
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
if (iErr) {
if (aBuilder.HasErrors()) {
// an error treatment
return;
}
@@ -3334,7 +3336,6 @@ The following example illustrates how to use Section operation:
#include < BRepAlgoAPI_Section.hxx>
{…
Standard_Boolean bRunParallel;
Standard_Integer iErr;
Standard_Real aFuzzyValue;
BRepAlgoAPI_Section aBuilder;
@@ -3374,8 +3375,7 @@ The following example illustrates how to use Section operation:
//
// run the algorithm
aBuilder.Build();
iErr=aBuilder.ErrorStatus();
if (iErr) {
if (aBuilder.HasErrors()) {
// an error treatment
return;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,296 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="488.59842"
height="239.24245"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="operations_image020.svg">
<defs
id="defs4">
<marker
inkscape:stockid="Arrow2Lstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Lstart"
style="overflow:visible">
<path
id="path7116"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(1.1) translate(1,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mend"
style="overflow:visible;">
<path
id="path7125"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) rotate(180) translate(0,0)" />
</marker>
<clipPath
id="clipEmfPath1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect2990"
height="19.040462"
width="177.28004"
y="73.463196"
x="191.21669" />
</clipPath>
<clipPath
id="clipEmfPath2"
clipPathUnits="userSpaceOnUse">
<rect
id="rect2993"
height="19.040462"
width="176.83047"
y="12.743616"
x="192.41554" />
</clipPath>
<clipPath
id="clipEmfPath3"
clipPathUnits="userSpaceOnUse">
<rect
id="rect2996"
height="18.890537"
width="177.28004"
y="133.13332"
x="191.21669" />
</clipPath>
<clipPath
id="clipEmfPath4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect2999"
height="18.890537"
width="149.10706"
y="204.34763"
x="130.52487" />
</clipPath>
<clipPath
id="clipEmfPath5"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3002"
height="18.890537"
width="148.9572"
y="204.34763"
x="292.81927" />
</clipPath>
<marker
inkscape:stockid="Arrow2Lstart"
orient="auto"
refY="0"
refX="0"
id="Arrow2Lstart-3"
style="overflow:visible">
<path
inkscape:connector-curvature="0"
id="path7116-4"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(1.1,0,0,1.1,1.1,0)" />
</marker>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.1979709"
inkscape:cx="318.63273"
inkscape:cy="137.81983"
inkscape:document-units="px"
inkscape:current-layer="g3004"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1670"
inkscape:window-height="723"
inkscape:window-x="42"
inkscape:window-y="158"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-153.88697,-412.74096)">
<g
id="g3004"
transform="translate(153.4374,405.50687)">
<text
id="text3006"
style="font-size:13.78678322px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Calibri"
y="246.47653"
x="0.44956902"
xml:space="preserve"> </text>
<path
id="path3008"
d="m 279.61319,66.547912 -0.0468,-23.360172 c -0.009,-0.346702 0.27162,-0.627811 0.61816,-0.627811 0.34654,0 0.62752,0.281109 0.62752,0.61844 l 0.0468,23.369543 c 0,0.337331 -0.28098,0.61844 -0.61815,0.61844 -0.34655,0.0094 -0.62753,-0.271738 -0.62753,-0.61844 z m -3.17508,-22.104551 3.73704,-7.505615 3.75578,7.486874 z"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.14985634px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
id="path3010"
d="m 281.04619,126.53661 -0.59005,-22.61992 c 0,-0.3467 0.27161,-0.62781 0.60879,-0.63718 0.34654,-0.009 0.63689,0.26237 0.64625,0.60907 l 0.5807,22.61055 c 0.009,0.3467 -0.26225,0.62781 -0.59943,0.63718 -0.34654,0.009 -0.63689,-0.26237 -0.64626,-0.5997 z m -3.67148,-21.28933 3.54973,-7.589952 3.93373,7.393172 z"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.14985634px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
id="path3016"
d="m 190.63599,68.421973 0,28.916764 178.32904,0 0,-28.916764 -178.32904,0 z"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
id="path3018"
d="m 190.647,68.432978 0,28.894754 186.95136,0 0,-28.894754 z"
style="fill:none;stroke:#000000;stroke-width:0.95861244px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3020"
style="font-size:13.68622589px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="84.089729"
x="203.04033"
xml:space="preserve"
transform="scale(0.99270628,1.0073473)">BOPAlgo_BuilderShape</text>
<text
id="text3024"
style="font-size:13.78678322px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="102.69855"
x="283.97775"
xml:space="preserve"> </text>
<path
id="path3026"
d="m 191.75992,7.7023914 0,28.9167636 177.9544,0 0,-28.9167636 -177.9544,0 z"
clip-path="url(#clipEmfPath1)"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
id="path3028"
d="m 191.7698,7.7122711 0,28.8970039 185.66905,0 0,-28.8970039 z"
style="fill:none;stroke:#000000;stroke-width:0.95636153px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3030"
style="font-size:13.78678322px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="23.987984"
x="231.37817"
xml:space="preserve">BOPAlgo_Algo</text>
<text
id="text3032"
style="font-size:13.78678322px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="23.987984"
x="330.28336"
xml:space="preserve"> </text>
<path
id="path3034"
d="m 190.63599,128.01712 0,28.91676 178.32904,0 0,-28.91676 -178.32904,0 z"
clip-path="url(#clipEmfPath2)"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
id="path3036"
d="m 190.64871,128.02984 0,28.89132 188.31283,0 0,-28.89132 z"
style="fill:none;stroke:#000000;stroke-width:0.96203959px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3038"
style="font-size:13.78678322px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="144.37767"
x="218.04097"
xml:space="preserve">BOPAlgo_Builder</text>
<text
id="text3040"
style="font-size:13.78678322px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="144.37767"
x="341.67245"
xml:space="preserve"> </text>
<path
id="path3042"
d="m 129.94418,199.23144 0,28.91677 150.04365,0 0,-28.91677 -150.04365,0 z"
clip-path="url(#clipEmfPath3)"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<text
id="text3050"
style="font-size:13.78678322px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="233.43306"
x="213.24557"
xml:space="preserve"> </text>
<path
id="path3052"
d="m 292.16366,199.23144 0,28.91677 150.04366,0 0,-28.91677 -150.04366,0 z"
clip-path="url(#clipEmfPath4)"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
id="path3054"
d="m 67.466014,185.63759 0,28.80655 188.150506,0 0,-28.80655 z"
style="fill:none;stroke:#000000;stroke-width:1.04681468px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3056"
style="font-size:13.78678322px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="204.21788"
x="124.58641"
xml:space="preserve">BOPAlgo_BOP</text>
<text
id="text3058"
style="font-size:13.78678322px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="215.592"
x="412.70435"
xml:space="preserve"> </text>
<path
id="path3054-8"
d="m 300.37408,185.70141 0,28.80655 188.1505,0 0,-28.80655 z"
style="fill:none;stroke:#000000;stroke-width:1.04681468px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3056-9"
style="font-size:13.78678322px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="203.31017"
x="336.76245"
xml:space="preserve">BOPAlgo_Section</text>
<path
style="fill:none;stroke:#000000;stroke-width:0.95747238px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:none"
d="m 267.10914,158.63892 -77.87032,26.89356"
id="path13459"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.88220716px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:none"
d="m 316.41379,158.50756 65.91804,26.97147"
id="path13459-4"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -1,238 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="500.70731"
height="102.98"
id="svg3731"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="operations_image064.svg">
<defs
id="defs3733">
<marker
inkscape:stockid="Arrow2Mstart"
orient="auto"
refY="0"
refX="0"
id="Arrow2Mstart"
style="overflow:visible">
<path
id="path4673"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(0.6,0.6)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow1Lstart"
orient="auto"
refY="0"
refX="0"
id="Arrow1Lstart"
style="overflow:visible">
<path
id="path4649"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(0.8,0,0,0.8,10,0)"
inkscape:connector-curvature="0" />
</marker>
<clipPath
id="clipEmfPath1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3744"
height="157.5"
width="566.85828"
y="0"
x="0" />
</clipPath>
<clipPath
id="clipEmfPath2"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3747"
height="15"
width="134.10196"
y="14.7"
x="215.55315" />
</clipPath>
<clipPath
id="clipEmfPath3"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3750"
height="13.95"
width="158.85233"
y="118.5"
x="53.850784" />
</clipPath>
<clipPath
id="clipEmfPath4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3753"
height="15"
width="189.90277"
y="68.849998"
x="185.10271" />
</clipPath>
<clipPath
id="clipEmfPath5"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3756"
height="13.95"
width="180.15263"
y="118.2"
x="315.3046" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.7435336"
inkscape:cx="250.35365"
inkscape:cy="74.48907"
inkscape:document-units="px"
inkscape:current-layer="g3758"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1037"
inkscape:window-height="615"
inkscape:window-x="38"
inkscape:window-y="209"
inkscape:window-maximized="0" />
<metadata
id="metadata3736">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(204.63937,-395.29983)">
<g
id="g3758"
transform="translate(-262.09021,339.42982)">
<text
id="text3760"
style="font-size:12.45018196px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
y="142.64999"
x="558.15814"
xml:space="preserve"> </text>
<path
id="path3762"
d="m 214.87814,10.5 0,23.4375 135.43322,0 0,-23.4375 z"
clip-path="url(#clipEmfPath1)"
style="fill:none;stroke:#000000;stroke-width:1.25626838px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0"
transform="translate(-1.4412873,56.78124)" />
<text
id="text3764"
style="font-size:12.45018196px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="80.110596"
x="236.44154"
xml:space="preserve">BOPAlgo_Algo</text>
<text
id="text3766"
style="font-size:12.45018196px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="25.049999"
x="327.60477"
xml:space="preserve"> </text>
<path
id="path3768"
d="m 53.175776,114.3 0,22.37812 160.127334,0 0,-22.37812 z"
clip-path="url(#clipEmfPath2)"
style="fill:none;stroke:#000000;stroke-width:1.24689317px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3772"
style="font-size:12.45018196px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="128.85001"
x="204.603"
xml:space="preserve"> </text>
<text
id="text3774"
style="font-size:12.45018196px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
y="158.85001"
x="57.45084"
xml:space="preserve"> </text>
<path
id="path3776"
d="m 280.56035,62.94375 -0.59064,-22.621875 c -0.009,-0.346875 0.26251,-0.6375 0.60939,-0.646875 0.34688,-0.0094 0.62813,0.2625 0.63751,0.609375 l 0.59063,22.63125 c 0.009,0.346875 -0.2625,0.628125 -0.60938,0.6375 -0.34688,0.0094 -0.62814,-0.2625 -0.63751,-0.609375 z m -3.68443,-21.290625 3.55317,-7.603125 3.94694,7.40625 z"
clip-path="url(#clipEmfPath3)"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.1500022px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
id="path3778"
d="m 185.00124,121.96729 0,23.4375 191.2528,0 0,-23.4375 z"
style="fill:none;stroke:#000000;stroke-width:1.25626838px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3780"
style="font-size:12.45018196px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="135.98123"
x="213.3766"
xml:space="preserve">BOPAlgo_PaveFiller</text>
<text
id="text3782"
style="font-size:12.45018196px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="79.199997"
x="351.30511"
xml:space="preserve"> </text>
<text
id="text3784"
style="font-size:12.45018196px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="108.3"
x="188.70276"
xml:space="preserve"> </text>
<path
id="path3786"
d="m 198.98728,113.10938 20.70968,-20.700005 c 0.24375,-0.24375 0.63751,-0.24375 0.88126,0 0.24375,0.24375 0.24375,0.6375 0,0.88125 L 199.87792,114 c -0.24376,0.24375 -0.64689,0.24375 -0.89064,0 -0.24375,-0.24375 -0.24375,-0.64688 0,-0.89062 z m 17.61588,-22.031255 7.95012,-2.653125 -2.64379,7.959375 z"
clip-path="url(#clipEmfPath4)"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.1500022px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3794"
style="font-size:12.45018196px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Courier New"
y="128.55"
x="480.30701"
xml:space="preserve"> </text>
<text
id="text3796"
style="font-size:12.45018196px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
y="158.39999"
x="318.75464"
xml:space="preserve"> </text>
<path
style="fill:#916f6f;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Mstart)"
d="m 281.70806,91.744904 0,30.398036"
id="path3875"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -6271,41 +6271,51 @@ bsplineprof res
@subsubsection occt_draw_7_2_6 mkoffset
**mkoffset** creates a parallel wire in the same plane using a face or an existing continuous set of wires as a reference. The number of occurrences is not limited.
The offset distance defines the spacing and the positioning of the occurrences.
Syntax:
~~~~~
mkoffset result face/compound of wires nboffset stepoffset
mkoffset result shape nboffset stepoffset [jointype(a/i) [alt]]
~~~~~
where:
* *result* - the base name for the resulting wires. The index of the occurrence (starting with 1) will be added to this name, so the resulting wires will have the names - *result_1*, *result_2* ...;
* *shape* - input shape (face or compound of wires);
* *nboffset* - the number of the parallel occurrences;
* *stepoffset* - offset distance between occurrences;
* *jointype(a/i)* - join type (a for *arc* (default) and i for *intersection*);
* *alt* - altitude from the plane of the input face in relation to the normal to the face.
**mkoffset** creates a parallel wire in the same plane using a face or an existing continuous set of wires as a reference. The number of occurences is not limited.
The offset distance defines the spacing and the positioning of the occurences.
**Example:**
~~~~~
#Create a box and select a face
# Create a box and select a face
box b 1 2 3
explode b f
#Create three exterior parallel contours with an offset
value of 2
# Create three exterior parallel contours with an offset value of 2
mkoffset r b_1 3 2
Create one interior parallel contour with an offset
value of
0.4
# wires r_1, r_2 and r_3 are created
# Create three exterior parallel contours with an offset value of 2 without round corners
mkoffset r b_1 3 2 i
# wires r_1, r_2 and r_3 are created
# Create one interior parallel contour with an offset value of 0.4
mkoffset r b_1 1 -0.4
~~~~~
**Note** that *mkoffset* command must be used with prudence, as angular contours produce offset contours with fillets. Interior parallel contours can produce more than one wire, normally these are refused. In the following example, any increase in the offset value is refused.
**Note** that on a concave input contour for an interior step *mkoffset* command may produce several wires which will be contained in a single compound.
**Example:**
~~~~~
# to create the example contour
profile p F 0 0 x 2 y 4 tt 1 1 tt 0 4 w
# to create an incoherent interior offset
mkoffset r p 1 -0.50
==p is not a FACE but a WIRE
BRepFill_TrimEdgeTool: incoherent intersection
# to create two incoherent wires
# creates an incoherent interior offset
mkoffset r p 1 -0.50
# creates two incoherent wires
mkoffset r p 1 -0.55
# r_1 is a compound of two wires
~~~~~
@subsubsection occt_draw_7_2_7 mkplane, mkface

View File

@@ -15,7 +15,7 @@
#ifndef _GeoAlgo_Sol_HeaderFile
#define _GeoAlgo_Sol_HeaderFile
#ifndef _Handle_Geom_BSplineSurface_HeaderFile
#ifndef _Geom_BSplineSurface_HeaderFile
#include <Geom_BSplineSurface.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile

View File

@@ -462,10 +462,10 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\Handle_TOcaf_Application.hxx" />
<ClInclude Include="..\..\..\src\Handle_TOcafFunction_BoxDriver.hxx" />
<ClInclude Include="..\..\..\src\Handle_TOcafFunction_CutDriver.hxx" />
<ClInclude Include="..\..\..\src\Handle_TOcafFunction_CylDriver.hxx" />
<ClInclude Include="..\..\..\src\TOcaf_Application.hxx" />
<ClInclude Include="..\..\..\src\TOcafFunction_BoxDriver.hxx" />
<ClInclude Include="..\..\..\src\TOcafFunction_CutDriver.hxx" />
<ClInclude Include="..\..\..\src\TOcafFunction_CylDriver.hxx" />
<ClInclude Include="..\..\..\src\NewBoxDlg.h" />
<ClInclude Include="..\..\..\src\NewCylDlg.h" />
<ClInclude Include="..\..\..\src\OcafApp.h" />

View File

@@ -58,16 +58,16 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\Handle_TOcaf_Application.hxx">
<ClInclude Include="..\..\..\src\TOcaf_Application.hxx">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Handle_TOcafFunction_BoxDriver.hxx">
<ClInclude Include="..\..\..\src\TOcafFunction_BoxDriver.hxx">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Handle_TOcafFunction_CutDriver.hxx">
<ClInclude Include="..\..\..\src\TOcafFunction_CutDriver.hxx">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Handle_TOcafFunction_CylDriver.hxx">
<ClInclude Include="..\..\..\src\TOcafFunction_CylDriver.hxx">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\NewBoxDlg.h">

View File

@@ -34,6 +34,9 @@
#define OPERATION_NOT_DONE 8
#define NULL_OPERATION 9
// OCCT RTTI
IMPLEMENT_STANDARD_RTTIEXT (OCAFSample_CommonDriver, OCAFSample_Driver)
//=======================================================================
//function : Constructor
//purpose :

View File

@@ -16,84 +16,22 @@
#ifndef _OCAFSample_CommonDriver_HeaderFile
#define _OCAFSample_CommonDriver_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_OCAFSample_CommonDriver_HeaderFile
#endif
#ifndef _OCAFSample_Driver_HeaderFile
#include <Standard_Type.hxx>
#include <OCAFSample_Driver.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
class TFunction_Logbook;
class OCAFSample_CommonDriver : public OCAFSample_Driver {
class OCAFSample_CommonDriver : public OCAFSample_Driver
{
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT OCAFSample_CommonDriver();
Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& theLogbook) const;
Standard_EXPORT ~OCAFSample_CommonDriver();
// Type management
//
Standard_EXPORT friend Handle(Standard_Type)& OCAFSample_CommonDriver_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_EXPORT OCAFSample_CommonDriver ();
Standard_EXPORT virtual Standard_Integer Execute (Handle (TFunction_Logbook)& theLogbook) const;
Standard_EXPORT ~OCAFSample_CommonDriver ();
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT (OCAFSample_CommonDriver, OCAFSample_Driver)
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -16,92 +16,29 @@
#ifndef _OCAFSample_Driver_HeaderFile
#define _OCAFSample_Driver_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_OCAFSample_Driver_HeaderFile
#endif
#ifndef _TFunction_Driver_HeaderFile
#include <TFunction_Driver.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
class TFunction_Logbook;
#include <TDF_LabelMap.hxx>
class TFunction_Logbook;
class OCAFSample_Driver : public TFunction_Driver {
class OCAFSample_Driver : public TFunction_Driver
{
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT void Validate(TFunction_Logbook& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean Arguments(TDF_LabelMap& theArgs) const;
Standard_EXPORT virtual Standard_Boolean Results(TDF_LabelMap& theRes) const;
Standard_EXPORT ~OCAFSample_Driver();
Standard_EXPORT void Validate (TFunction_Logbook& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute (Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean Arguments (TDF_LabelMap& theArgs) const;
Standard_EXPORT virtual Standard_Boolean Results (TDF_LabelMap& theRes) const;
Standard_EXPORT ~OCAFSample_Driver ();
// Type management
//
Standard_EXPORT friend Handle(Standard_Type)& OCAFSample_Driver_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(OCAFSample_Driver,TFunction_Driver)
protected:
// Methods PROTECTED
//
Standard_EXPORT OCAFSample_Driver();
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_EXPORT OCAFSample_Driver ();
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -1,68 +0,0 @@
// File generated by CPPExt (Transient)
// Copyright (C) 1991,1995 by
//
// MATRA DATAVISION, FRANCE
//
// This software is furnished in accordance with the terms and conditions
// of the contract and with the inclusion of the above copyright notice.
// This software or any other copy thereof may not be provided or otherwise
// be made available to any other person. No title to an ownership of the
// software is hereby transferred.
//
// At the termination of the contract, the software and all copies of this
// software must be deleted.
//
#include <OCAFSample_Driver.jxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
OCAFSample_Driver::~OCAFSample_Driver() {}
Standard_EXPORT Handle_Standard_Type& OCAFSample_Driver_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("OCAFSample_Driver",
sizeof(OCAFSample_Driver),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
// DownCast method
// allow safe downcasting
//
const Handle(OCAFSample_Driver) Handle(OCAFSample_Driver)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(OCAFSample_Driver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(OCAFSample_Driver))) {
_anOtherObject = Handle(OCAFSample_Driver)((Handle(OCAFSample_Driver)&)AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& OCAFSample_Driver::DynamicType() const
{
return STANDARD_TYPE(OCAFSample_Driver) ;
}
Standard_Boolean OCAFSample_Driver::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(OCAFSample_Driver) == AType || TFunction_Driver::IsKind(AType));
}
Handle_OCAFSample_Driver::~Handle_OCAFSample_Driver() {}

View File

@@ -1,9 +0,0 @@
#ifndef _TFunction_Logbook_HeaderFile
#include <TFunction_Logbook.hxx>
#endif
#ifndef _TDF_LabelMap_HeaderFile
#include <TDF_LabelMap.hxx>
#endif
#ifndef _OCAFSample_Driver_HeaderFile
#include <OCAFSample_Driver.hxx>
#endif

View File

@@ -10,7 +10,6 @@
#include <OCC_App.h>
#include "OcafDoc.h"
#include "TOCAF_Application.hxx"
#include <TOcaf_Application.hxx>

View File

@@ -12,6 +12,8 @@
#include "BRepPrimAPI_MakeBox.hxx"
#include "TNaming_Builder.hxx"
IMPLEMENT_STANDARD_RTTIEXT (TOcafFunction_BoxDriver, TFunction_Driver)
//=======================================================================
//function : GetID
//purpose :
@@ -118,32 +120,3 @@ Standard_Integer TOcafFunction_BoxDriver::Execute(Handle(TFunction_Logbook)& /*l
// If there are no any mistakes we return 0:
return 0;
}
TOcafFunction_BoxDriver::~TOcafFunction_BoxDriver() {}
// DownCast method
// allow safe downcasting
//
const Handle(TOcafFunction_BoxDriver) TOcafFunction_BoxDriver::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(TOcafFunction_BoxDriver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(TOcafFunction_BoxDriver))) {
_anOtherObject = Handle(TOcafFunction_BoxDriver)::DownCast (AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& TOcafFunction_BoxDriver::DynamicType() const
{
return STANDARD_TYPE(TOcafFunction_BoxDriver) ;
}
Standard_Boolean TOcafFunction_BoxDriver::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(TOcafFunction_BoxDriver) == AType || TFunction_Driver::IsKind(AType));
}

View File

@@ -31,74 +31,19 @@
#endif
class TFunction_Logbook;
class TOcafFunction_BoxDriver : public TFunction_Driver {
class TOcafFunction_BoxDriver : public TFunction_Driver
{
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_BoxDriver();
Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_BoxDriver();
// Type management
//
//Standard_EXPORT friend Handle(Standard_Type)& TOcafFunction_BoxDriver_Type_();
Standard_EXPORT const Handle(TOcafFunction_BoxDriver) DownCast(const Handle(Standard_Transient)& AnObject);
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_EXPORT static const Standard_GUID& GetID ();
Standard_EXPORT TOcafFunction_BoxDriver ();
Standard_EXPORT virtual void Validate (Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute (Handle (TFunction_Logbook)& log) const;
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(TOcafFunction_BoxDriver,TFunction_Driver)
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -17,6 +17,8 @@
#include "TFunction_Logbook.hxx"
#include "TDF_Reference.hxx"
IMPLEMENT_STANDARD_RTTIEXT (TOcafFunction_CutDriver, TFunction_Driver)
//=======================================================================
//function : GetID
//purpose :
@@ -139,32 +141,3 @@ Standard_Integer TOcafFunction_CutDriver::Execute(Handle(TFunction_Logbook)& /*l
// If there are no any mistakes we return 0:
return 0;
}
TOcafFunction_CutDriver::~TOcafFunction_CutDriver() {}
// DownCast method
// allow safe downcasting
//
const Handle(TOcafFunction_CutDriver) TOcafFunction_CutDriver::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(TOcafFunction_CutDriver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(TOcafFunction_CutDriver))) {
_anOtherObject = Handle(TOcafFunction_CutDriver)::DownCast (AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& TOcafFunction_CutDriver::DynamicType() const
{
return STANDARD_TYPE(TOcafFunction_CutDriver) ;
}
Standard_Boolean TOcafFunction_CutDriver::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(TOcafFunction_CutDriver) == AType || TFunction_Driver::IsKind(AType));
}

View File

@@ -32,73 +32,18 @@
class TFunction_Logbook;
class TOcafFunction_CutDriver : public TFunction_Driver {
class TOcafFunction_CutDriver : public TFunction_Driver
{
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_CutDriver();
Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_CutDriver();
// Type management
//
//Standard_EXPORT friend Handle(Standard_Type)& TOcafFunction_CutDriver_Type_();
Standard_EXPORT const Handle(TOcafFunction_CutDriver) DownCast(const Handle(Standard_Transient)& AnObject);
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_CutDriver ();
Standard_EXPORT virtual void Validate (Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute (Handle (TFunction_Logbook)& log) const;
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(TOcafFunction_CutDriver,TFunction_Driver)
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -13,6 +13,7 @@
#include "TDataStd_Real.hxx"
#include "TNaming_Builder.hxx"
IMPLEMENT_STANDARD_RTTIEXT (TOcafFunction_CylDriver, TFunction_Driver)
//=======================================================================
//function : GetID
@@ -113,32 +114,3 @@ Standard_Integer TOcafFunction_CylDriver::Execute(Handle(TFunction_Logbook)& /*l
// If there are no any mistakes we return 0:
return 0;
}
TOcafFunction_CylDriver::~TOcafFunction_CylDriver() {}
// DownCast method
// allow safe downcasting
//
const Handle(TOcafFunction_CylDriver) TOcafFunction_CylDriver::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(TOcafFunction_CylDriver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(TOcafFunction_CylDriver))) {
_anOtherObject = Handle(TOcafFunction_CylDriver)::DownCast (AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& TOcafFunction_CylDriver::DynamicType() const
{
return STANDARD_TYPE(TOcafFunction_CylDriver) ;
}
Standard_Boolean TOcafFunction_CylDriver::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(TOcafFunction_CylDriver) == AType || TFunction_Driver::IsKind(AType));
}

View File

@@ -32,73 +32,18 @@
class TFunction_Logbook;
class TOcafFunction_CylDriver : public TFunction_Driver {
class TOcafFunction_CylDriver : public TFunction_Driver
{
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// inline void operator delete(void *anAddress, size_t size)
// {
// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
// }
// Methods PUBLIC
//
Standard_EXPORT static const Standard_GUID& GetID() ;
Standard_EXPORT TOcafFunction_CylDriver();
Standard_EXPORT virtual void Validate(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute(const Handle(TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute(Handle(TFunction_Logbook)& log) const;
Standard_EXPORT ~TOcafFunction_CylDriver();
// Type management
//
//Standard_EXPORT friend Handle(Standard_Type)& TOcafFunction_CylDriver_Type_();
Standard_EXPORT const Handle(TOcafFunction_CylDriver) DownCast(const Handle(Standard_Transient)& AnObject);
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_EXPORT static const Standard_GUID& GetID ();
Standard_EXPORT TOcafFunction_CylDriver ();
Standard_EXPORT virtual void Validate (Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Boolean MustExecute (const Handle (TFunction_Logbook)& log) const;
Standard_EXPORT virtual Standard_Integer Execute (Handle (TFunction_Logbook)& log) const;
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(TOcafFunction_CylDriver,TFunction_Driver)
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -5,7 +5,7 @@
//Modified by Sergey RUIN (An instanciation of the drivers)
#include <stdafx.h>
#include <TOcaf_Application.ixx>
#include <TOcaf_Application.hxx>
#include <TDF_Label.hxx>
#include <TPrsStd_AISPresentation.hxx>
#include <TPrsStd_AISViewer.hxx>
@@ -15,6 +15,8 @@
#include "TOcafFunction_CylDriver.hxx"
#include "TOcafFunction_CutDriver.hxx"
IMPLEMENT_STANDARD_RTTIEXT (TOcaf_Application, TDocStd_Application)
//=======================================================================
//function : TOcaf_Application
//purpose :

View File

@@ -26,49 +26,13 @@
class TDocStd_Document;
class TOcaf_Application : public TDocStd_Application {
class TOcaf_Application : public TDocStd_Application
{
public:
Standard_EXPORT TOcaf_Application ();
// Methods PUBLIC
//
Standard_EXPORT TOcaf_Application();
// Type management
//
//Standard_EXPORT friend Handle(Standard_Type)& TOcaf_Application_Type_();
Standard_EXPORT const Handle(TOcaf_Application) DownCast(const Handle(Standard_Transient)& AnObject);
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT (TOcaf_Application, TDocStd_Application)
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -1,45 +0,0 @@
// File generated by CPPExt (Transient)
// Copyright (C) 1991,1995 by
//
// MATRA DATAVISION, FRANCE
//
// This software is furnished in accordance with the terms and conditions
// of the contract and with the inclusion of the above copyright notice.
// This software or any other copy thereof may not be provided or otherwise
// be made available to any other person. No title to an ownership of the
// software is hereby transferred.
//
// At the termination of the contract, the software and all copies of this
// software must be deleted.
//
#include <TOcaf_Application.jxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
// DownCast method
// allow safe downcasting
//
const Handle(TOcaf_Application) TOcaf_Application::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(TOcaf_Application) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(TOcaf_Application))) {
_anOtherObject = Handle(TOcaf_Application)((Handle(TOcaf_Application)&)AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& TOcaf_Application::DynamicType() const
{
return STANDARD_TYPE(TOcaf_Application) ;
}
Standard_Boolean TOcaf_Application::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(TOcaf_Application) == AType || TDocStd_Application::IsKind(AType));
}

View File

@@ -1,9 +0,0 @@
#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
#include <TColStd_SequenceOfExtendedString.hxx>
#endif
#ifndef _TDocStd_Document_HeaderFile
#include <TDocStd_Document.hxx>
#endif
#ifndef _TOcaf_Application_HeaderFile
#include <TOcaf_Application.hxx>
#endif

View File

@@ -1,8 +1,8 @@
@echo off
call "custom.bat" %1 %2 %3
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "custom.bat" %1 %2 %3
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"

View File

@@ -1,9 +1,9 @@
@echo off
call "custom.bat" %1 %2 %3
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "custom.bat" %1 %2 %3
set "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
set "CSF_ResourcesDefaults=%RES_DIR%"
set "CSF_IEResourcesDefaults=%RES_DIR%"

View File

@@ -1,9 +1,9 @@
@echo off
call "custom.bat" %1 %2 %3
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "custom.bat" %1 %2 %3
set "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
set "CSF_ResourcesDefaults=%RES_DIR%"
set "CSF_TutorialResourcesDefaults=%RES_DIR%"

View File

@@ -2336,6 +2336,9 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
clearDynamicHighlight();
}
// make sure highlighting presentations are properly erased
theIObj->ErasePresentations (false);
if (IsSelected (theIObj)
&& aStatus->DisplayMode() != aDispMode)
{
@@ -2396,6 +2399,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
unhighlightOwners (theIObj);
myMainPM->Erase (theIObj, -1);
theIObj->ErasePresentations (true); // make sure highlighting presentations are properly erased
// Object removes from Detected sequence
Standard_DISABLE_DEPRECATION_WARNINGS
@@ -2611,11 +2615,9 @@ Standard_Boolean AIS_InteractiveContext::IsoOnTriangulation() const
return myDefaultDrawer->IsoOnTriangulation();
}
//=======================================================================
//function : SetPixelTolerance
//purpose : Disables the mechanism of adaptive tolerance calculation in
// SelectMgr_ViewerSelector and sets the given tolerance for ALL
// sensitive entities activated. For more information, see
// SelectMgr_ViewerSelector.hxx
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
{
@@ -2781,24 +2783,6 @@ Standard_Boolean AIS_InteractiveContext::PlaneSize (Standard_Real& theX,
return (Abs (theX - theY) <= Precision::Confusion());
}
//=======================================================================
//function : SetAutoActivateSelection
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetAutoActivateSelection (const Standard_Boolean theIsAuto)
{
myIsAutoActivateSelMode = theIsAuto;
}
//=======================================================================
//function : GetAutoActivateSelection
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::GetAutoActivateSelection() const
{
return myIsAutoActivateSelMode;
}
//=======================================================================
//function : SetZLayer
//purpose :

File diff suppressed because it is too large Load Diff

View File

@@ -1661,6 +1661,22 @@ void AIS_InteractiveContext::NextDetected()
myCurDetected++;
}
//=======================================================================
//function : DetectedCurrentOwner
//purpose :
//=======================================================================
Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::DetectedCurrentOwner() const
{
if (HasOpenedContext())
{
return myLocalContexts (myCurLocalIndex)->DetectedCurrentOwner();
}
return MoreDetected()
? myMainSel->Picked (myDetectedSeq (myCurDetected))
: Handle(SelectMgr_EntityOwner)();
}
//=======================================================================
//function : DetectedCurrentShape
//purpose :

View File

@@ -237,12 +237,13 @@ public:
//! Gets next current object during iteration through mouse-detected
//! interactive objects.
Standard_EXPORT void NextDetected();
//! @return current mouse-detected Owner or null object if there is no current detected.
Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedCurrentOwner() const;
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
//! @return current mouse-detected interactive object or null object if there is no current detected.
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
@@ -424,7 +425,6 @@ private:
Standard_Integer myCurrentOwner;
TColStd_SequenceOfInteger myDetectedSeq;
Standard_Integer myCurDetected;
AIS_SequenceOfInteractive myAISDetectedSeq;
Standard_Integer myAISCurDetected;
Handle(Prs3d_Drawer) mySubintStyle;

View File

@@ -73,7 +73,6 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
}
myAISCurDetected = 0;
myAISDetectedSeq.Clear();
myCurDetected = 0;
myDetectedSeq.Clear();
@@ -84,17 +83,10 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
for (Standard_Integer aDetIter = 1; aDetIter <= aDetectedNb; ++aDetIter)
{
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (aDetIter);
if (anOwner.IsNull()
|| !myFilters->IsOk (anOwner))
if (!anOwner.IsNull()
&& myFilters->IsOk (anOwner))
{
continue;
}
myDetectedSeq.Append (aDetIter); // normally they are already arranged in correct order...
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (!anObj.IsNull())
{
myAISDetectedSeq.Append (anObj);
myDetectedSeq.Append (aDetIter); // normally they are already arranged in correct order...
}
}
@@ -868,15 +860,17 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
}
myDetectedSeq.Remove (anIdx--);
if (anIdx < myCurDetected)
if (myCurDetected > anIdx)
{
myCurDetected--;
--myCurDetected;
}
if (myAISCurDetected > anIdx)
{
--myAISCurDetected;
}
}
myCurDetected = Max (myCurDetected, 1);
Standard_Boolean isAISRemainsDetected = Standard_False;
myCurDetected = Max (myCurDetected, 1);
myAISCurDetected = Max (myAISCurDetected, 1);
// 3. AIS_Selection : remove entity owners from AIS_Selection
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
@@ -889,11 +883,7 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
continue;
}
if (aValidOwners.Contains (anOwner))
{
isAISRemainsDetected = Standard_True;
}
else
if (!aValidOwners.Contains (anOwner))
{
aRemoveEntites.Append (anOwner);
anOwner->SetSelected (Standard_False);
@@ -968,28 +958,6 @@ void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObjec
Standard_False);
}
}
// Renew iterator of ::DetectedCurrentObject()
if (!isAISRemainsDetected)
{
// Remove the interactive object from detected sequences
for (Standard_Integer anIdx = 1; anIdx <= myAISDetectedSeq.Length(); ++anIdx)
{
Handle(AIS_InteractiveObject) aDetectedIO = myAISDetectedSeq.Value (anIdx);
if (aDetectedIO.IsNull() || aDetectedIO != theIO)
{
continue;
}
myAISDetectedSeq.Remove (anIdx--);
if (anIdx < myAISCurDetected)
{
myAISCurDetected--;
}
}
myAISCurDetected = Max (myAISCurDetected, 1);
}
}
//=======================================================================
@@ -1454,7 +1422,7 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromShape(const
//=======================================================================
void AIS_LocalContext::InitDetected()
{
myAISCurDetected = myAISDetectedSeq.Length()? 1 : 0;
myAISCurDetected = !myDetectedSeq.IsEmpty() ? myDetectedSeq.Lower() : 0;
}
//=======================================================================
@@ -1463,7 +1431,8 @@ void AIS_LocalContext::InitDetected()
//=======================================================================
Standard_Boolean AIS_LocalContext::MoreDetected() const
{
return (myAISCurDetected > 0 && myAISCurDetected <= myAISDetectedSeq.Length());
return myAISCurDetected >= myDetectedSeq.Lower()
&& myAISCurDetected <= myDetectedSeq.Upper();
}
//=======================================================================
@@ -1490,13 +1459,29 @@ const TopoDS_Shape& AIS_LocalContext::DetectedCurrentShape() const
return aCurrentShape->Shape();
}
//=======================================================================
//function : DetectedCurrentOwner
//purpose :
//=======================================================================
Handle(SelectMgr_EntityOwner) AIS_LocalContext::DetectedCurrentOwner() const
{
return MoreDetected()
? myMainVS->Picked (myDetectedSeq (myAISCurDetected))
: Handle(SelectMgr_EntityOwner)();
}
//=======================================================================
//function : DetectedCurrentObject
//purpose :
//=======================================================================
Handle(AIS_InteractiveObject) AIS_LocalContext::DetectedCurrentObject() const
{
return MoreDetected() ? myAISDetectedSeq(myAISCurDetected) : NULL;
if (!MoreDetected())
{
return Handle(AIS_InteractiveObject)();
}
return Handle(AIS_InteractiveObject)::DownCast (myMainVS->Picked (myDetectedSeq (myAISCurDetected))->Selectable());
}
//=======================================================================

View File

@@ -292,7 +292,7 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
OCC_CATCH_SIGNALS
switch (TypeOfHLR()) {
case Prs3d_TOH_Algo:
StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
break;
case Prs3d_TOH_PolyAlgo:
default:

View File

@@ -128,7 +128,7 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aP
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
switch (aMode)
switch (aMode)
{
case 0:
const TColgp_Array1OfPnt& nodes = myTriangulation->Nodes(); //Nodes
@@ -203,7 +203,7 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aP
//=======================================================================
//function : ComputeSelection
//purpose :
//purpose :
//=======================================================================
void AIS_Triangulation::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/)
@@ -238,7 +238,7 @@ Handle(TColStd_HArray1OfInteger) AIS_Triangulation::GetColors() const
//=======================================================================
//function : SetTriangulation
//purpose :
//purpose :
//=======================================================================
void AIS_Triangulation::SetTriangulation(const Handle(Poly_Triangulation)& aTriangulation)
{
@@ -247,7 +247,7 @@ void AIS_Triangulation::SetTriangulation(const Handle(Poly_Triangulation)& aTria
//=======================================================================
//function : GetTriangulation
//purpose :
//purpose :
//=======================================================================
Handle(Poly_Triangulation) AIS_Triangulation::GetTriangulation() const{
return myTriangulation;
@@ -255,25 +255,19 @@ Handle(Poly_Triangulation) AIS_Triangulation::GetTriangulation() const{
//=======================================================================
//function : AttenuateColor
//purpose : Attenuates 32-bit color by a given attenuation factor (0...1):
// aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red
// All color components are multiplied by aComponent, the result is then packed again as 32-bit integer.
// Color attenuation is applied to the vertex colors in order to have correct visual result
// after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and flat.
//purpose :
//=======================================================================
Graphic3d_Vec4ub AIS_Triangulation::attenuateColor (const Standard_Integer theColor,
const Standard_Real theComposition)
{
const Standard_Byte* anRgbx = reinterpret_cast<const Standard_Byte*> (&theColor);
const Graphic3d_Vec4ub& aColor = *reinterpret_cast<const Graphic3d_Vec4ub*> (&theColor);
// If IsTranparent() is false alpha value will be ignored anyway.
Standard_Byte anAlpha = IsTransparent() ? static_cast<Standard_Byte> (255.0 - myDrawer->ShadingAspect()->Aspect()->FrontMaterial().Transparency() * 255.0)
: 255;
return Graphic3d_Vec4ub ((Standard_Byte)(theComposition * aColor.r()),
(Standard_Byte)(theComposition * aColor.g()),
(Standard_Byte)(theComposition * aColor.b()),
return Graphic3d_Vec4ub ((Standard_Byte)(theComposition * anRgbx[0]),
(Standard_Byte)(theComposition * anRgbx[1]),
(Standard_Byte)(theComposition * anRgbx[2]),
anAlpha);
}

View File

@@ -17,6 +17,7 @@
#include <AdvApp2Var_Data_f2c.hxx>
#include <AdvApp2Var_MathBase.hxx>
#include <AdvApp2Var_Data.hxx>
#include <NCollection_Array1.hxx>
// statics
static
@@ -120,11 +121,11 @@ int mmdrvcb_(integer *ideriv,
static
int mmexthi_(integer *ndegre,
doublereal *hwgaus);
NCollection_Array1<doublereal>& hwgaus);
static
int mmextrl_(integer *ndegre,
doublereal *rootlg);
NCollection_Array1<doublereal>& rootlg);
@@ -152,7 +153,7 @@ int mmpojac_(doublereal *tparam,
integer *iordre,
integer *ncoeff,
integer *nderiv,
doublereal *valjac,
NCollection_Array1<doublereal>& valjac,
integer *iercod);
static
@@ -3764,7 +3765,7 @@ int AdvApp2Var_MathBase::mmeps1_(doublereal *epsilo)
//purpose :
//=======================================================================
int mmexthi_(integer *ndegre,
doublereal *hwgaus)
NCollection_Array1<doublereal>& hwgaus)
{
/* System generated locals */
@@ -3855,8 +3856,6 @@ int mmexthi_(integer *ndegre,
/************************************************************************
*****/
/* Parameter adjustments */
--hwgaus;
/* Function Body */
ibb = AdvApp2Var_SysBase::mnfndeb_();
@@ -3882,7 +3881,7 @@ int mmexthi_(integer *ndegre,
i__1 = *ndegre;
for (ii = ideb; ii <= i__1; ++ii) {
kpt = iadd + ii - ideb;
hwgaus[ii] = mlgdrtl_.hiltab[kpt + nmod2 * 465 - 1];
hwgaus(ii) = mlgdrtl_.hiltab[kpt + nmod2 * 465 - 1];
/* L100: */
}
@@ -3891,7 +3890,7 @@ int mmexthi_(integer *ndegre,
i__1 = ndeg2;
for (ii = 1; ii <= i__1; ++ii) {
hwgaus[ii] = hwgaus[*ndegre + 1 - ii];
hwgaus(ii) = hwgaus(*ndegre + 1 - ii);
/* L200: */
}
@@ -3899,7 +3898,7 @@ int mmexthi_(integer *ndegre,
/* associated Gauss weights are loaded. */
if (nmod2 == 1) {
hwgaus[ndeg2 + 1] = mlgdrtl_.hi0tab[ndeg2];
hwgaus(ndeg2 + 1) = mlgdrtl_.hi0tab[ndeg2];
}
/* --------------------------- The end ----------------------------------
@@ -3916,7 +3915,7 @@ int mmexthi_(integer *ndegre,
//purpose :
//=======================================================================
int mmextrl_(integer *ndegre,
doublereal *rootlg)
NCollection_Array1<doublereal>& rootlg)
{
/* System generated locals */
integer i__1;
@@ -4002,8 +4001,6 @@ int mmextrl_(integer *ndegre,
/************************************************************************
*****/
/* Parameter adjustments */
--rootlg;
/* Function Body */
ibb = AdvApp2Var_SysBase::mnfndeb_();
@@ -4029,7 +4026,7 @@ int mmextrl_(integer *ndegre,
i__1 = *ndegre;
for (ii = ideb; ii <= i__1; ++ii) {
kpt = iadd + ii - ideb;
rootlg[ii] = mlgdrtl_.rootab[kpt + nmod2 * 465 - 1];
rootlg(ii) = mlgdrtl_.rootab[kpt + nmod2 * 465 - 1];
/* L100: */
}
@@ -4040,14 +4037,14 @@ int mmextrl_(integer *ndegre,
i__1 = ndeg2;
for (ii = 1; ii <= i__1; ++ii) {
rootlg[ii] = -rootlg[*ndegre + 1 - ii];
rootlg(ii) = -rootlg(*ndegre + 1 - ii);
/* L200: */
}
/* Case NDEGRE uneven, 0 is root of Legendre polynom. */
if (nmod2 == 1) {
rootlg[ndeg2 + 1] = 0.;
rootlg(ndeg2 + 1) = 0.;
}
/* -------------------------------- THE END -----------------------------
@@ -6590,7 +6587,8 @@ L9900:
integer valbas_dim1, i__1;
/* Local variables */
doublereal vjac[80], herm[24];
doublereal vjacc[80], herm[24];
NCollection_Array1<doublereal> vjac (vjacc[0], 1, 80);
integer iord[2];
doublereal wval[4];
integer nwcof, iunit;
@@ -6785,7 +6783,7 @@ L9900:
i__1 = kk1;
for (ii = 1; ii <= i__1; ++ii) {
valbas[ii + iorjac] = wval[0] * vjac[ii - 1];
valbas[ii + iorjac] = wval[0] * vjac(ii);
}
/* (3) Evaluation of order 1 */
@@ -6801,8 +6799,8 @@ L9900:
i__1 = kk1;
for (ii = 1; ii <= i__1; ++ii) {
valbas[ii + iorjac + valbas_dim1] = wval[0] * vjac[ii + kk1 - 1]
+ wval[1] * vjac[ii - 1];
valbas[ii + iorjac + valbas_dim1] = wval[0] * vjac(ii + kk1)
+ wval[1] * vjac(ii);
}
}
@@ -6818,9 +6816,9 @@ L9900:
i__1 = kk1;
for (ii = 1; ii <= i__1; ++ii) {
valbas[ii + iorjac + (valbas_dim1 << 1)] = wval[0] * vjac[ii +
kk2 - 1] + wval[1] * 2 * vjac[ii + kk1 - 1] + wval[2] *
vjac[ii - 1];
valbas[ii + iorjac + (valbas_dim1 << 1)] = wval[0] * vjac(ii +
kk2) + wval[1] * 2 * vjac(ii + kk1) + wval[2] *
vjac(ii);
}
}
@@ -6836,9 +6834,9 @@ L9900:
i__1 = kk1;
for (ii = 1; ii <= i__1; ++ii) {
valbas[ii + iorjac + valbas_dim1 * 3] = wval[0] * vjac[ii + kk3 -
1] + wval[1] * 3 * vjac[ii + kk2 - 1] + wval[2] * 3 *
vjac[ii + kk1 - 1] + wval[3] * vjac[ii - 1];
valbas[ii + iorjac + valbas_dim1 * 3] = wval[0] * vjac(ii + kk3)
+ wval[1] * 3 * vjac(ii + kk2) + wval[2] * 3 *
vjac(ii + kk1) + wval[3] * vjac(ii);
}
}
@@ -7092,7 +7090,7 @@ int mmpojac_(doublereal *tparam,
integer *iordre,
integer *ncoeff,
integer *nderiv,
doublereal *valjac,
NCollection_Array1<doublereal>& valjac,
integer *iercod)
{
@@ -7167,7 +7165,6 @@ int mmpojac_(doublereal *tparam,
/* Parameter adjustments */
valjac_dim1 = *ncoeff;
--valjac;
/* Function Body */
@@ -7213,21 +7210,21 @@ int mmpojac_(doublereal *tparam,
/* --- Trivial Positions ----- */
valjac[1] = 1.;
valjac(1) = 1.;
aux1 = (doublereal) (*iordre + 1);
valjac[2] = aux1 * *tparam;
valjac(2) = aux1 * *tparam;
if (*nderiv >= 1) {
valjac[valjac_dim1 + 1] = 0.;
valjac[valjac_dim1 + 2] = aux1;
valjac(valjac_dim1 + 1) = 0.;
valjac(valjac_dim1 + 2) = aux1;
if (*nderiv >= 2) {
valjac[(valjac_dim1 << 1) + 1] = 0.;
valjac[(valjac_dim1 << 1) + 2] = 0.;
valjac((valjac_dim1 << 1) + 1) = 0.;
valjac((valjac_dim1 << 1) + 2) = 0.;
if (*nderiv >= 3) {
valjac[valjac_dim1 * 3 + 1] = 0.;
valjac[valjac_dim1 * 3 + 2] = 0.;
valjac(valjac_dim1 * 3 + 1) = 0.;
valjac(valjac_dim1 * 3 + 2) = 0.;
}
}
}
@@ -7247,26 +7244,26 @@ int mmpojac_(doublereal *tparam,
denom = 1. / denom;
/* --> Pi(t) */
valjac[ii] = (cofa * *tparam * valjac[kk1] + cofb * valjac[kk2]) *
valjac(ii) = (cofa * *tparam * valjac(kk1) + cofb * valjac(kk2)) *
denom;
/* --> P'i(t) */
if (*nderiv >= 1) {
valjac[ii + valjac_dim1] = (cofa * *tparam * valjac[kk1 +
valjac_dim1] + cofa * valjac[kk1] + cofb * valjac[kk2 +
valjac_dim1]) * denom;
valjac(ii + valjac_dim1) = (cofa * *tparam * valjac(kk1 +
valjac_dim1) + cofa * valjac(kk1) + cofb * valjac(kk2 +
valjac_dim1)) * denom;
/* --> P''i(t) */
if (*nderiv >= 2) {
valjac[ii + (valjac_dim1 << 1)] = (cofa * *tparam * valjac[
kk1 + (valjac_dim1 << 1)] + cofa * 2 * valjac[kk1 +
valjac_dim1] + cofb * valjac[kk2 + (valjac_dim1 << 1)]
valjac(ii + (valjac_dim1 << 1)) = (cofa * *tparam * valjac(
kk1 + (valjac_dim1 << 1)) + cofa * 2 * valjac(kk1 +
valjac_dim1) + cofb * valjac(kk2 + (valjac_dim1 << 1))
) * denom;
}
/* --> P'i(t) */
if (*nderiv >= 3) {
valjac[ii + valjac_dim1 * 3] = (cofa * *tparam * valjac[kk1 +
valjac_dim1 * 3] + cofa * 3 * valjac[kk1 + (
valjac_dim1 << 1)] + cofb * valjac[kk2 + valjac_dim1 *
3]) * denom;
valjac(ii + valjac_dim1 * 3) = (cofa * *tparam * valjac(kk1 +
valjac_dim1 * 3) + cofa * 3 * valjac(kk1 + (
valjac_dim1 << 1)) + cofb * valjac(kk2 + valjac_dim1 *
3)) * denom;
}
}
}
@@ -7277,8 +7274,8 @@ int mmpojac_(doublereal *tparam,
for (ii = 1; ii <= i__1; ++ii) {
i__2 = *nderiv;
for (jj = 0; jj <= i__2; ++jj) {
valjac[ii + jj * valjac_dim1] = tnorm[ii - 1] * valjac[ii + jj *
valjac_dim1];
valjac(ii + jj * valjac_dim1) = tnorm[ii - 1] * valjac(ii + jj *
valjac_dim1);
}
}
@@ -10658,7 +10655,8 @@ int mvgaus0_(integer *kindic,
integer i__1;
/* Local variables */
doublereal tamp[40];
doublereal tampc[40];
NCollection_Array1<doublereal> tamp (tampc[0], 1, 40);
integer ndegl, kg, ii;
/* **********************************************************************
@@ -10751,7 +10749,7 @@ int mvgaus0_(integer *kindic,
mmextrl_(&ndegl, tamp);
i__1 = *nbrval;
for (ii = 1; ii <= i__1; ++ii) {
urootl[ii] = -tamp[ii - 1];
urootl[ii] = -tamp(ii);
/* L100: */
}
@@ -10762,7 +10760,7 @@ int mvgaus0_(integer *kindic,
mmexthi_(&ndegl, tamp);
i__1 = *nbrval;
for (ii = 1; ii <= i__1; ++ii) {
hiltab[ii] = tamp[ii - 1];
hiltab[ii] = tamp(ii);
/* L200: */
}

View File

@@ -102,8 +102,8 @@ class BOPAlgo_PaveFiller;
//! aMV.SetIntersect(bIntersect); //intersect or not the shapes from <aLS>
//! //
//! aMV.Perform(); //perform the operation
//! if (aMV.ErrorStatus()) { //check error status
//! return;
//! if (aMV.HasErrors()) { //check error status
//! return;
//! }
//! //
//! const TopoDS_Shape& aResult = aMV.Shape(); //result of the operation

View File

@@ -2602,21 +2602,27 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
}
//
if (bRebuild) {
Standard_Boolean isDegEdge = myDS->ShapeInfo(aPB->Edge()).HasFlag();
Standard_Integer nE = aPB->Edge();
// Check if the Pave Block has the edge set
if (nE < 0) {
// untouched edge
nE = aPB->OriginalEdge();
}
Standard_Boolean isDegEdge = myDS->ShapeInfo(nE).HasFlag();
if (wasRegularEdge && !isDegEdge && nV[0] == nV[1]) {
// now edge has the same vertex on both ends;
// check if it is not a regular closed curve.
const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(aPB->Edge()));
const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE));
const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV[0]));
Standard_Real aLength = IntTools::Length(aE);
Standard_Real aTolV = BRep_Tool::Tolerance(aV);
if (aLength <= aTolV * 2.) {
// micro edge, so mark it for removal
aMicroEdges.Add(aPB->Edge());
aMicroEdges.Add(nE);
continue;
}
}
nSp = SplitEdge(aPB->Edge(), nV[0], aT[0], nV[1], aT[1]);
nSp = SplitEdge(nE, nV[0], aT[0], nV[1], aT[1]);
if (bCB)
aCB->SetEdge(nSp);
else

View File

@@ -67,7 +67,7 @@ void BRepTopAdaptor_Tool::Init(const Handle(Adaptor3d_HSurface)& surface,
myloaded=Standard_True;
}
Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() const{
Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() {
if(myloaded) {
return(myTopolTool);
}
@@ -79,7 +79,7 @@ Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() const{
}
}
Handle(Adaptor3d_HSurface) BRepTopAdaptor_Tool::GetSurface() const{
Handle(Adaptor3d_HSurface) BRepTopAdaptor_Tool::GetSurface() {
if(myloaded) {
return(myHSurface);
}

View File

@@ -46,11 +46,11 @@ public:
Standard_EXPORT void Init (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Real Tol2d);
Standard_EXPORT Handle(BRepTopAdaptor_TopolTool) GetTopolTool() const;
Standard_EXPORT Handle(BRepTopAdaptor_TopolTool) GetTopolTool();
Standard_EXPORT void SetTopolTool (const Handle(BRepTopAdaptor_TopolTool)& TT);
Standard_EXPORT Handle(Adaptor3d_HSurface) GetSurface() const;
Standard_EXPORT Handle(Adaptor3d_HSurface) GetSurface();
Standard_EXPORT void Destroy();
~BRepTopAdaptor_Tool()

View File

@@ -300,23 +300,3 @@ void Bnd_Box2d::Dump () const
cout << "\n Gap : " << Gap;
cout << "\n";
}
Standard_Real Bnd_Box2d::SquareDistance (const gp_Pnt2d& thePnt2d) const
{
Standard_Real Xmin, Xmax, Ymin, Ymax;
Standard_Real X = thePnt2d.X(), Y = thePnt2d.Y();
Standard_Real dd = 0;
Get(Xmin, Ymin, Xmax, Ymax);
if (X < Xmin)
dd += (Xmin - X)*(Xmin - X);
else if (X > Xmax)
dd += (Xmax - X)*(Xmax - X);
if (Y < Ymin)
dd += (Ymin - Y)*(Ymin - Y);
else if (Y > Ymax)
dd += (Ymax - Y)*(Ymax - Y);
return dd;
}

View File

@@ -182,10 +182,6 @@ public:
//! Returns True if the 2d pnt <P> is out <me>.
Standard_EXPORT Standard_Boolean IsOut (const gp_Pnt2d& P) const;
//! Returns distance from point <thePnt2d> to <me>
//! distance will be 0 if point is inside of <me>
Standard_EXPORT Standard_Real SquareDistance (const gp_Pnt2d& thePnt2d) const;
//! Returns True if <Box2d> is out <me>.
Standard_EXPORT Standard_Boolean IsOut (const Bnd_Box2d& Other) const;

View File

@@ -36,15 +36,14 @@ void Contap_ArcFunction::Set(const Handle(Adaptor3d_HSurface)& S)
{
mySurf = S;
Standard_Integer i;
Standard_Real uinf, vinf, usup, vsup;
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S, uinf, vinf, usup, vsup);
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Real U,V;
// gp_Vec d1u,d1v;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
Contap_HContTool::SamplePoint(S,i,U,V, uinf, vinf, usup, vsup);
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);

View File

@@ -1237,16 +1237,9 @@ void ComputeInternalPoints
// Essayer de converger
// cout << "Changement de signe detecte" << endl;
solution = Standard_False;
math_Vector dir1(1,2), dir2(1,2);
math_Vector prevX(1,2), prevPrevX (1,2);
int count = 0;
int revCount = 0;
double dot = 0;
double t = 0.5;
while (!solution)
{
X(1) =/* (XInf(1) + XSup(1)) /2.;*/ XInf(1) + t * (XSup(1) - XInf(1));
X(2) = /*(XInf(2) + XSup(2)) /2.;*/XInf(2) + t * (XSup(2) - XInf(2));
while (!solution) {
X(1) = (XInf(1) + XSup(1)) /2.;
X(2) = (XInf(2) + XSup(2)) /2.;
rsnld.Perform(SFunc,X,infb,supb);
if (!rsnld.IsDone()) {
@@ -1271,27 +1264,6 @@ void ComputeInternalPoints
else {
vtestb = gp_Vec(0.,0.,0.);
}
count++;
if (count > 10)
{
if (count > 12)
{
dir1 = prevX - prevPrevX;
dir2 = X - prevX;
double d1n = dir1.Norm();
double d2n = dir2.Norm();
if (d1n > gp::Resolution() && d2n > gp::Resolution())
{
dir1 /= d1n;
dir2 /= d2n;
dot = dir1(1) * dir2(1) + dir1(2) * dir2(2);
if (Abs(dot + 1) < 1e-10)
revCount++;
}
}
prevPrevX = prevX;
prevX = X;
}
if ((vtestb.Magnitude() <= gp::Resolution())||
(Abs(X(1)-XInf(1)) <= toler(1)
&& Abs(X(2)-XInf(2)) <= toler(2)) ||
@@ -1306,11 +1278,6 @@ void ComputeInternalPoints
}
else {
XInf = X;
if (revCount > 10000)
{
//XInf = (X + prevPrevX)/2;
t = 0.75;
}
}
}
else { // on n est pas sur une solution

View File

@@ -24,6 +24,8 @@
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
static Standard_Real uinf,vinf,usup,vsup;
Standard_Integer Contap_HContTool::NbSamplesV
(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real ,
@@ -123,7 +125,7 @@ Standard_Integer Contap_HContTool::NbSamplesU
}
Standard_Integer Contap_HContTool::NbSamplePoints
(const Handle(Adaptor3d_HSurface)& S, Standard_Real& uinf, Standard_Real& vinf, Standard_Real& usup, Standard_Real& vsup)
(const Handle(Adaptor3d_HSurface)& S)
{
uinf = S->FirstUParameter();
usup = S->LastUParameter();
@@ -173,11 +175,7 @@ Standard_Integer Contap_HContTool::NbSamplePoints
void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
const Standard_Integer Index,
Standard_Real& U,
Standard_Real& V,
const Standard_Real& uinf,
const Standard_Real& vinf,
const Standard_Real& usup,
const Standard_Real& vsup)
Standard_Real& V )
{
if(S->GetType() == GeomAbs_BSplineSurface) {
Standard_Integer nbIntU = NbSamplesU(S,uinf,usup)/3;

View File

@@ -44,10 +44,9 @@ public:
Standard_EXPORT static Standard_Integer NbSamplesV (const Handle(Adaptor3d_HSurface)& S, const Standard_Real v1, const Standard_Real v2);
Standard_EXPORT static Standard_Integer NbSamplePoints (const Handle(Adaptor3d_HSurface)& S, Standard_Real& uinf, Standard_Real& vinf, Standard_Real& usup, Standard_Real& vsup);
Standard_EXPORT static Standard_Integer NbSamplePoints (const Handle(Adaptor3d_HSurface)& S);
Standard_EXPORT static void SamplePoint (const Handle(Adaptor3d_HSurface)& S, const Standard_Integer Index, Standard_Real& U, Standard_Real& V,
const Standard_Real& uinf, const Standard_Real& vinf, const Standard_Real& usup, const Standard_Real& vsup);
Standard_EXPORT static void SamplePoint (const Handle(Adaptor3d_HSurface)& S, const Standard_Integer Index, Standard_Real& U, Standard_Real& V);
//! Returns True if all the intersection point and edges
//! are known on the Arc.

View File

@@ -42,14 +42,13 @@ void Contap_SurfFunction::Set(const Handle(Adaptor3d_HSurface)& S)
{
mySurf = S;
Standard_Integer i;
Standard_Real uinf,vinf,usup,vsup;
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S,uinf,vinf,usup,vsup);
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Real U,V;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
Contap_HContTool::SamplePoint(S,i,U,V,uinf,vinf,usup,vsup);
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);

View File

@@ -1074,7 +1074,7 @@ void DBRep_DrawableShape::display(const Handle(Poly_Triangulation)& T,
}
// allocate the arrays
TColStd_Array1OfInteger Free(1,2*nFree);
TColStd_Array1OfInteger Free (1, Max (1, 2 * nFree));
// array is replaced on map because it is impossible
// to calculate number of internal edges in advance

View File

@@ -13,11 +13,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// ---------------------
// ---------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Feb 10 1997 Creation
// Version: 0.0
// Version Date Purpose
// 0.0 Feb 10 1997 Creation
#include <DDF.hxx>
@@ -64,11 +64,11 @@
//=======================================================================
static Standard_Integer DDF_Children (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n < 2) return 1;
Handle(TDF_Data) DF;
TCollection_AsciiString entry;
@@ -97,11 +97,11 @@ static Standard_Integer DDF_Children (Draw_Interpretor& di,
//=======================================================================
static Standard_Integer DDF_Attributes (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n != 3) return 1;
Handle(TDF_Data) DF;
if (!DDF::GetDF (a[1], DF)) return 1;
@@ -124,11 +124,11 @@ static Standard_Integer DDF_Attributes (Draw_Interpretor& di,
//=======================================================================
static Standard_Integer DDF_ForgetAll(Draw_Interpretor& /*di*/,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n != 3) return 1;
Handle(TDF_Data) DF;
if (!DDF::GetDF (a[1], DF)) return 1;
@@ -137,11 +137,35 @@ static Standard_Integer DDF_ForgetAll(Draw_Interpretor& /*di*/,
TDF_Tool::Label(DF,a[2],label);
if (label.IsNull()) return 1;
label.ForgetAllAttributes();
//POP pour NT
//POP pour NT
return 0;
}
//=======================================================================
//function : ForgetAttribute
//purpose : "ForgetAtt dfname Label guid"
//=======================================================================
static Standard_Integer DDF_ForgetAttribute(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n != 4) return 1;
Handle(TDF_Data) DF;
if (!DDF::GetDF (a[1], DF)) return 1;
TDF_Label aLabel;
TDF_Tool::Label(DF,a[2],aLabel);
if (aLabel.IsNull()) return 1;
if (!Standard_GUID::CheckGUIDFormat(a[3]))
{
di<<"DDF: The format of GUID is invalid\n";
return 1;
}
Standard_GUID guid(a[3]);
aLabel.ForgetAttribute(guid);
return 0;
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// save/restore & Store/Retrieve commands
@@ -209,8 +233,8 @@ void ErrorMessage (const Storage_Error n)
//=======================================================================
static Standard_Integer DDF_SetTagger (Draw_Interpretor& di,
Standard_Integer nb,
const char** arg)
Standard_Integer nb,
const char** arg)
{
if (nb == 3) {
Handle(TDF_Data) DF;
@@ -232,8 +256,8 @@ static Standard_Integer DDF_SetTagger (Draw_Interpretor& di,
//=======================================================================
static Standard_Integer DDF_NewTag (Draw_Interpretor& di,
Standard_Integer nb,
const char** arg)
Standard_Integer nb,
const char** arg)
{
if (nb == 3) {
Handle(TDF_Data) DF;
@@ -254,8 +278,8 @@ static Standard_Integer DDF_NewTag (Draw_Interpretor& di,
//=======================================================================
static Standard_Integer DDF_NewChild (Draw_Interpretor& di,
Standard_Integer nb,
const char** arg)
Standard_Integer nb,
const char** arg)
{
Handle(TDF_Data) DF;
if (nb>=2){
@@ -314,35 +338,38 @@ void DDF::BasicCommands (Draw_Interpretor& theCommands)
const char* g = "DF basic commands";
// Label :
// Label :
theCommands.Add ("SetTagger",
"SetTagger (DF, entry)",
__FILE__, DDF_SetTagger, g);
__FILE__, DDF_SetTagger, g);
theCommands.Add ("NewTag",
"NewTag (DF, tagger)",
__FILE__, DDF_NewTag, g);
__FILE__, DDF_NewTag, g);
theCommands.Add ("NewChild",
"NewChild (DF, [tagger])",
__FILE__, DDF_NewChild, g);
__FILE__, DDF_NewChild, g);
theCommands.Add ("Children",
" Returns the list of label children: Children DF label",
__FILE__, DDF_Children, g);
" Returns the list of label children: Children DF label",
__FILE__, DDF_Children, g);
theCommands.Add ("Attributes",
" Returns the list of label attributes: Attributes DF label",
__FILE__, DDF_Attributes, g);
" Returns the list of label attributes: Attributes DF label",
__FILE__, DDF_Attributes, g);
theCommands.Add ("ForgetAll",
"Forgets all attributes from the label: ForgetAll DF Label",
__FILE__, DDF_ForgetAll, g);
"Forgets all attributes from the label: ForgetAll DF Label",
__FILE__, DDF_ForgetAll, g);
theCommands.Add ("ForgetAtt",
"Forgets the specified by guid attribute from the label: ForgetAtt DF Label guid",
__FILE__, DDF_ForgetAttribute, g);
theCommands.Add ("Label",
"Label DF entry",
__FILE__, DDF_Label, g);
"Label DF entry",
__FILE__, DDF_Label, g);
}

View File

@@ -331,6 +331,34 @@ Standard_Boolean Draw_Interpretor::Remove(Standard_CString const n)
return result == 0;
}
//=======================================================================
//function : GetHelp
//purpose :
//=======================================================================
Standard_CString Draw_Interpretor::GetHelp (Standard_CString theCommandName) const
{
return Tcl_GetVar2 (myInterp, "Draw_Helps", theCommandName, TCL_GLOBAL_ONLY);
}
//=======================================================================
//function : ErrorOnWrongArgs
//purpose :
//=======================================================================
Standard_Integer Draw_Interpretor::ErrorOnWrongArgs (Standard_CString theCommandName) const
{
std::cerr << "Error: wrong number of arguments" << std::endl;
Standard_CString aHelp = GetHelp (theCommandName);
if (aHelp)
{
std::cerr << "Use: " << theCommandName << " " << aHelp << std::endl;
}
return 1;
}
//=======================================================================
//function : Result
//purpose :

View File

@@ -164,6 +164,16 @@ public:
//! Removes <theCommandName>, returns true if success (the command existed).
Standard_EXPORT Standard_Boolean Remove (const Standard_CString theCommandName);
//! Returns text of the help recorded for command theCommandName
//! (previously added by method Add() or by command "help" in Tcl interpretor).
//! Returns Null if no help string is defined for theCommandName.
Standard_EXPORT Standard_CString GetHelp (Standard_CString theCommandName) const;
//! Prints (to std::cerr) standard error message for theCommandName called with
//! wrong number of arguments. The message includes help for this command.
//! Returns 1 indicating error status for Tcl command.
Standard_EXPORT Standard_Integer ErrorOnWrongArgs (Standard_CString theCommandName) const;
public:
Standard_EXPORT Standard_CString Result() const;

View File

@@ -294,6 +294,8 @@ GccAna_Circ2d3Tan::
else {
TheSame1(NbrSol) = 0;
gp_Dir2d dc(center1.XY()-Center.XY());
if (qualifier1(NbrSol) == GccEnt_enclosed)
dc.Reverse(); // if tangent circle is inside the source circle, moving to edge of source circle
pnttg1sol(NbrSol)=gp_Pnt2d(Center.XY()+Radius(k1)*dc.XY());
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
pnttg1sol(NbrSol));

View File

@@ -185,9 +185,10 @@ GccAna_Circ2d3Tan::
else {
TheSame1(NbrSol) = 0;
gp_Dir2d dc(center1.XY()-Center.XY());
if (qualifier1(NbrSol) == GccEnt_enclosed)
dc.Reverse(); // if tangent circle is inside the source circle, moving to edge of source circle
pnttg1sol(NbrSol)=gp_Pnt2d(Center.XY()+Radius(nbsol3)*dc.XY());
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol),
pnttg1sol(NbrSol));
par1sol(NbrSol)=ElCLib::Parameter(cirsol(NbrSol), pnttg1sol(NbrSol));
pararg1(NbrSol)=ElCLib::Parameter(C1,pnttg1sol(NbrSol));
}

View File

@@ -22,6 +22,45 @@
#include <GccEnt_QualifiedLin.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Lin2d.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString GccEnt_Table_PrintPosition[5] =
{
"UNQUALIFIED", "ENCLOSING", "ENCLOSED", "OUTSIDE", "NOQUALIFIER"
};
}
//=======================================================================
//function : PositionToString
//purpose :
//=======================================================================
Standard_CString GccEnt::PositionToString (GccEnt_Position thePosition)
{
return GccEnt_Table_PrintPosition[thePosition];
}
//=======================================================================
//function : PositionFromString
//purpose :
//=======================================================================
Standard_Boolean GccEnt::PositionFromString (Standard_CString thePositionString,
GccEnt_Position& thePosition)
{
TCollection_AsciiString aName (thePositionString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= GccEnt_noqualifier; ++aTypeIter)
{
Standard_CString aTypeName = GccEnt_Table_PrintPosition[aTypeIter];
if (aName == aTypeName)
{
thePosition = GccEnt_Position(aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
GccEnt_QualifiedLin
GccEnt::Unqualified(const gp_Lin2d& Line) {

View File

@@ -17,6 +17,7 @@
#ifndef _GccEnt_HeaderFile
#define _GccEnt_HeaderFile
#include <GccEnt_Position.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
@@ -53,6 +54,34 @@ public:
DEFINE_STANDARD_ALLOC
//! Prints the name of Position type as a String on the Stream.
static Standard_OStream& Print (const GccEnt_Position thePosition, Standard_OStream& theStream)
{
return (theStream << PositionToString (thePosition));
}
//! Returns the string name for a given position.
//! @param thePosition position type
//! @return string identifier from the list UNQUALIFIED ENCLOSING ENCLOSED OUTSIDE NOQUALIFIER
Standard_EXPORT static Standard_CString PositionToString (GccEnt_Position thePosition);
//! Returns the position from the given string identifier (using case-insensitive comparison).
//! @param thePositionString string identifier
//! @return position or GccEnt_unqualified if string identifier is invalid
static GccEnt_Position PositionFromString (Standard_CString thePositionString)
{
GccEnt_Position aPosition = GccEnt_unqualified;
PositionFromString (thePositionString, aPosition);
return aPosition;
}
//! Determines the position from the given string identifier (using case-insensitive comparison).
//! @param thePositionString string identifier
//! @param thePosition detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean PositionFromString (Standard_CString thePositionString,
GccEnt_Position& thePosition);
//! Constructs a qualified line,
//! so that the relative position to the circle or line of the

View File

@@ -72,12 +72,90 @@ GeomEvaluator_OffsetSurface::GeomEvaluator_OffsetSurface(
{
}
// If point is on parametric boundary, and calculation of normal fails,
// try shifting it towards the inside in the hope that derivatives
// are better defined there.
//
// NB: temporarily this is made as static function and not class method,
// hence code duplications
static Standard_Boolean shiftPoint (Standard_Real& theU, Standard_Real& theV,
const Handle(Geom_Surface)& theSurf,
const Handle(GeomAdaptor_HSurface)& theAdaptor)
{
// Get parametric bounds and closure status
Standard_Real aUMin, aUMax, aVMin, aVMax;
Standard_Boolean isUPeriodic, isVPeriodic;
if (! theSurf.IsNull())
{
theSurf->Bounds (aUMin, aUMax, aVMin, aVMax);
isUPeriodic = theSurf->IsUPeriodic();
isVPeriodic = theSurf->IsVPeriodic();
}
else
{
aUMin = theAdaptor->FirstUParameter();
aUMax = theAdaptor->LastUParameter();
aVMin = theAdaptor->FirstVParameter();
aVMax = theAdaptor->LastVParameter();
isUPeriodic = theAdaptor->IsUPeriodic();
isVPeriodic = theAdaptor->IsVPeriodic();
}
Standard_Boolean isShifted = Standard_False;
// shift by U
if (! isUPeriodic && aUMax - aUMin > 2 * Precision::PConfusion())
{
if (Abs (theU - aUMin) < Precision::PConfusion())
{
theU += Precision::PConfusion();
isShifted = Standard_True;
}
else if (Abs (theU - aUMax) < Precision::PConfusion())
{
theU -= Precision::PConfusion();
isShifted = Standard_True;
}
}
// shift by V
if (! isVPeriodic && aVMax - aVMin > 2 * Precision::PConfusion())
{
if (Abs (theV - aVMin) < Precision::PConfusion())
{
theV += Precision::PConfusion();
isShifted = Standard_True;
}
else if (Abs (theV - aVMax) < Precision::PConfusion())
{
theV -= Precision::PConfusion();
isShifted = Standard_True;
}
}
return isShifted;
}
void GeomEvaluator_OffsetSurface::D0(
const Standard_Real theU, const Standard_Real theV, gp_Pnt& theValue) const
{
gp_Vec aD1U, aD1V;
BaseD1(theU, theV, theValue, aD1U, aD1V);
CalculateD0(theU, theV, theValue, aD1U, aD1V);
try
{
CalculateD0(theU, theV, theValue, aD1U, aD1V);
}
catch (Geom_UndefinedValue&)
{
// if failed at parametric boundary, try taking derivative at shifted point
Standard_Real aU = theU, aV = theV;
if (! shiftPoint (aU, aV, myBaseSurf, myBaseAdaptor))
{
throw;
}
BaseD1(aU, aV, theValue, aD1U, aD1V);
CalculateD0(theU, theV, theValue, aD1U, aD1V);
}
}
void GeomEvaluator_OffsetSurface::D1(
@@ -86,7 +164,21 @@ void GeomEvaluator_OffsetSurface::D1(
{
gp_Vec aD2U, aD2V, aD2UV;
BaseD2(theU, theV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
CalculateD1(theU, theV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
try
{
CalculateD1(theU, theV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
}
catch (Geom_UndefinedValue&)
{
// if failed at parametric boundary, try taking derivative at shifted point
Standard_Real aU = theU, aV = theV;
if (! shiftPoint (aU, aV, myBaseSurf, myBaseAdaptor))
{
throw;
}
BaseD2 (aU, aV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
CalculateD1(theU, theV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
}
}
void GeomEvaluator_OffsetSurface::D2(
@@ -97,8 +189,24 @@ void GeomEvaluator_OffsetSurface::D2(
gp_Vec aD3U, aD3V, aD3UUV, aD3UVV;
BaseD3(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
CalculateD2(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
try
{
CalculateD2(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
}
catch (Geom_UndefinedValue&)
{
// if failed at parametric boundary, try taking derivative at shifted point
Standard_Real aU = theU, aV = theV;
if (! shiftPoint (aU, aV, myBaseSurf, myBaseAdaptor))
{
throw;
}
BaseD3(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
CalculateD2(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
}
}
void GeomEvaluator_OffsetSurface::D3(
@@ -109,8 +217,24 @@ void GeomEvaluator_OffsetSurface::D3(
{
BaseD3(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
CalculateD3(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
try
{
CalculateD3(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
}
catch (Geom_UndefinedValue&)
{
// if failed at parametric boundary, try taking derivative at shifted point
Standard_Real aU = theU, aV = theV;
if (! shiftPoint (aU, aV, myBaseSurf, myBaseAdaptor))
{
throw;
}
BaseD3(aU, aV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
CalculateD3(theU, theV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
}
}
gp_Vec GeomEvaluator_OffsetSurface::DN(
@@ -125,7 +249,21 @@ gp_Vec GeomEvaluator_OffsetSurface::DN(
gp_Pnt aP;
gp_Vec aD1U, aD1V;
BaseD1(theU, theV, aP, aD1U, aD1V);
return CalculateDN(theU, theV, theDerU, theDerV, aD1U, aD1V);
try
{
return CalculateDN(theU, theV, theDerU, theDerV, aD1U, aD1V);
}
catch (Geom_UndefinedValue&)
{
// if failed at parametric boundary, try taking derivative at shifted point
Standard_Real aU = theU, aV = theV;
if (! shiftPoint (aU, aV, myBaseSurf, myBaseAdaptor))
{
throw;
}
BaseD1 (aU, aV, aP, aD1U, aD1V);
return CalculateDN (theU, theV, theDerU, theDerV, aD1U, aD1V);
}
}

View File

@@ -5,6 +5,9 @@ GeometryTest_APICommands.cxx
GeometryTest_ConstraintCommands.cxx
GeometryTest_ContinuityCommands.cxx
GeometryTest_CurveCommands.cxx
GeometryTest_CurveTanCommands.cxx
GeometryTest_DrawableQualifiedCurve2d.cxx
GeometryTest_DrawableQualifiedCurve2d.hxx
GeometryTest_FairCurveCommands.cxx
GeometryTest_PolyCommands.cxx
GeometryTest_SurfaceCommands.cxx

View File

@@ -30,6 +30,7 @@ void GeometryTest::AllCommands(Draw_Interpretor& theCommands)
GeomliteTest::AllCommands(theCommands);
GeometryTest::CurveCommands(theCommands);
GeometryTest::CurveTanCommands(theCommands);
GeometryTest::FairCurveCommands(theCommands);
GeometryTest::SurfaceCommands(theCommands);
GeometryTest::ConstraintCommands(theCommands);

View File

@@ -39,6 +39,9 @@ public:
//! defines curve commands.
Standard_EXPORT static void CurveCommands (Draw_Interpretor& I);
//! defines tangent curve commands.
Standard_EXPORT static void CurveTanCommands (Draw_Interpretor& I);
//! defines fair curve commands.
Standard_EXPORT static void FairCurveCommands (Draw_Interpretor& I);

View File

@@ -0,0 +1,340 @@
// Created on: 2017-06-16
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2017 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 <Draw.hxx>
#include <DrawTrSurf.hxx>
#include <Draw_Interpretor.hxx>
#include <GccAna_Circ2d3Tan.hxx>
#include <GccEnt.hxx>
#include <GccEnt_QualifiedLin.hxx>
#include <GccEnt_QualifiedCirc.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <GeometryTest.hxx>
#include <GeometryTest_DrawableQualifiedCurve2d.hxx>
#include <Precision.hxx>
#include <TCollection_AsciiString.hxx>
#include <stdio.h>
//=======================================================================
//function : qcircle
//purpose : Parses command: "qcircle name x y radius [-unqualified|-enclosing|-enclosed|-outside|-noqualifier]"
//=======================================================================
static Standard_Integer qcurve (Draw_Interpretor&, Standard_Integer theArgsNb, const char** theArgVec)
{
if (theArgsNb < 5)
{
cout << "Error: wrong number of arguments.\n";
return 1;
}
Handle(Geom2d_Curve) aResult2d;
TCollection_AsciiString aPositionType;
if (!strcmp (theArgVec[0], "qcircle"))
{
if (theArgsNb == 5 || theArgsNb == 6)
aResult2d = new Geom2d_Circle (gp_Ax22d (gp_Pnt2d (Draw::Atof (theArgVec[2]), Draw::Atof (theArgVec[3])),
gp_Dir2d (1,0)), Draw::Atof (theArgVec[4]));
else if (theArgsNb == 7 || theArgsNb == 8)
aResult2d = new Geom2d_Circle (gp_Ax22d (gp_Pnt2d (Draw::Atof (theArgVec[2]), Draw::Atof (theArgVec[3])),
gp_Dir2d (Draw::Atof (theArgVec[4]), Draw::Atof (theArgVec[5]))), Draw::Atof (theArgVec[6]));
if (theArgsNb == 6)
aPositionType = theArgVec[5];
else if (theArgsNb == 8)
aPositionType = theArgVec[7];
}
else if(!strcmp (theArgVec[0], "qline"))
{
if (theArgsNb < 6)
{
cout << "Error: wrong number of arguments.\n";
return 1;
}
aResult2d = new Geom2d_Line (gp_Pnt2d (Draw::Atof (theArgVec[2]), Draw::Atof (theArgVec[3])),
gp_Dir2d (Draw::Atof (theArgVec[4]), Draw::Atof (theArgVec[5])));
if (theArgsNb == 7)
aPositionType = theArgVec[6];
}
else
{
cout << "Error: wrong command name.\n";
return 1;
}
GccEnt_Position aKindOfPosition = GccEnt_unqualified;
if (!aPositionType.IsEmpty())
{
GccEnt_Position aParameterPosition;
if (GccEnt::PositionFromString (aPositionType.ToCString(), aParameterPosition))
aKindOfPosition = aParameterPosition;
}
Draw::Set (theArgVec[1], new GeometryTest_DrawableQualifiedCurve2d (aResult2d, aKindOfPosition));
return 0;
}
//=======================================================================
//function : solutions
//purpose :
//=======================================================================
static Standard_Integer solutions (Draw_Interpretor& theDI, GccAna_Circ2d3Tan& theCirTan3, const char* theName)
{
if (!theCirTan3.IsDone())
{
cout << "GccAna_Circ2d3Tan is not done";
return 1;
}
TCollection_AsciiString aName = TCollection_AsciiString (theName) + "_";
GccEnt_Position aQualifier1, aQualifier2, aQualifier3;
Standard_Real aParSol, aParArg;
gp_Pnt2d aPntSol;
for (Standard_Integer aSolId = 1; aSolId <= theCirTan3.NbSolutions(); aSolId++)
{
Handle(Geom2d_Circle) aCircle = new Geom2d_Circle (theCirTan3.ThisSolution (aSolId));
TCollection_AsciiString aSolIdName = aName;
aSolIdName += TCollection_AsciiString (aSolId);
DrawTrSurf::Set (aSolIdName.ToCString(), aCircle);
theCirTan3.WhichQualifier (aSolId, aQualifier1, aQualifier2, aQualifier3);
theDI << "circle: " << aSolIdName.ToCString() << ", " << "qualifiers: " << GccEnt::PositionToString (aQualifier1)
<< ", " << GccEnt::PositionToString (aQualifier2) << ", " << GccEnt::PositionToString (aQualifier3) << "\n";
theDI << " tangent points: point (parameter on solution, parameter on argument)\n";
// the first tangent point
if (theCirTan3.IsTheSame1 (aSolId))
theDI << " " << "= the solution number " << aSolId << " is equal to the first argument\n";
else
{
theCirTan3.Tangency1 (aSolId, aParSol, aParArg, aPntSol);
TCollection_AsciiString aTanPntIdName = aSolIdName + "_tp_1";
DrawTrSurf::Set (aTanPntIdName.ToCString(), aPntSol);
theDI << " " << aTanPntIdName.ToCString() << " (" << aParSol << ", " << aParArg << ")\n";
}
// the second tangent point
if (theCirTan3.IsTheSame2 (aSolId))
theDI << " " << "= the solution number " << aSolId << " is equal to the second argument\n";
else
{
theCirTan3.Tangency2 (aSolId, aParSol, aParArg, aPntSol);
TCollection_AsciiString aTanPntIdName = aSolIdName + "_tp_2";
DrawTrSurf::Set (aTanPntIdName.ToCString(), aPntSol);
theDI << " " << aTanPntIdName.ToCString() << " (" << aParSol << ", " << aParArg << ")\n";
}
// the third tangent point
if (theCirTan3.IsTheSame3 (aSolId))
theDI << " " << "= the solution number " << aSolId << " is equal to the third argument\n";
else
{
theCirTan3.Tangency3 (aSolId, aParSol, aParArg, aPntSol);
TCollection_AsciiString aTanPntIdName = aSolIdName + "_tp_3";
DrawTrSurf::Set (aTanPntIdName.ToCString(), aPntSol);
theDI << " " << aTanPntIdName.ToCString() << " (" << aParSol << ", " << aParArg << ")";
}
if (aSolId != theCirTan3.NbSolutions())
theDI << "\n";
}
return 0;
}
//=======================================================================
//function : circ2d3Tan
//purpose : Parses command: [circ2d3Tan cname qcicrle1/qlin1/point1 qcicrle2/qlin2/point2 qcicrle3/qlin3/point3
// tolerance]
//=======================================================================
static Standard_Integer circ2d3Tan (Draw_Interpretor& theDI, Standard_Integer theArgsNb, const char** theArgVec)
{
if (theArgsNb < 5)
{
cout << "Error: wrong number of arguments.\n";
return 1;
}
Handle(GeometryTest_DrawableQualifiedCurve2d) aQCurve1 =
Handle(GeometryTest_DrawableQualifiedCurve2d)::DownCast (Draw::Get (theArgVec[2]));
Handle(GeometryTest_DrawableQualifiedCurve2d) aQCurve2 =
Handle(GeometryTest_DrawableQualifiedCurve2d)::DownCast (Draw::Get (theArgVec[3]));
Handle(GeometryTest_DrawableQualifiedCurve2d) aQCurve3 =
Handle(GeometryTest_DrawableQualifiedCurve2d)::DownCast (Draw::Get (theArgVec[4]));
gp_Pnt2d aPoint1, aPoint2, aPoint3;
Standard_Boolean anIsPoint1 = DrawTrSurf::GetPoint2d (theArgVec[2], aPoint1);
Standard_Boolean anIsPoint2 = DrawTrSurf::GetPoint2d (theArgVec[3], aPoint2);
Standard_Boolean anIsPoint3 = DrawTrSurf::GetPoint2d (theArgVec[4], aPoint3);
Standard_Real aTolerance = Precision::Confusion();
if (theArgsNb > 5)
aTolerance = Draw::Atof (theArgVec[5]);
if (aQCurve1.IsNull()) // <point, point, point>
{
if (!anIsPoint1 || !anIsPoint2 || !anIsPoint3)
{
cout << "Error: wrong points definition.\n";
return 1;
}
GccAna_Circ2d3Tan aCircBuilder (aPoint1, aPoint2, aPoint3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
// the first curve is not NULL
if (aQCurve2.IsNull()) // <qcircle, point, point> or <qlin, point, point>
{
if (!anIsPoint2 || !anIsPoint3)
{
cout << "Error: wrong points definition.\n";
return 1;
}
Geom2dAdaptor_Curve anAdaptorCurve1 (aQCurve1->GetCurve());
if (anAdaptorCurve1.GetType() == GeomAbs_Circle)
{
GccEnt_QualifiedCirc aQualifiedCircle1 (anAdaptorCurve1.Circle(), aQCurve1->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedCircle1, aPoint2, aPoint3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
else if (anAdaptorCurve1.GetType() == GeomAbs_Line)
{
GccEnt_QualifiedLin aQualifiedLin1 (anAdaptorCurve1.Line(), aQCurve1->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedLin1, aPoint2, aPoint3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
cout << "Error: wrong curve type.\n";
return 1;
}
// the first and the second curves are not NULL
if (aQCurve3.IsNull()) // <qcircle, qcircle, point> or <qcircle, qlin, point> or <qlin, qlin, point>
{
if (!anIsPoint3)
{
cout << "Error: wrong point definition.\n";
return 1;
}
Geom2dAdaptor_Curve anAdaptorCurve1 (aQCurve1->GetCurve());
Geom2dAdaptor_Curve anAdaptorCurve2 (aQCurve2->GetCurve());
if (anAdaptorCurve1.GetType() == GeomAbs_Circle && anAdaptorCurve2.GetType() == GeomAbs_Circle)
{
GccEnt_QualifiedCirc aQualifiedCircle1 (anAdaptorCurve1.Circle(), aQCurve1->GetPosition());
GccEnt_QualifiedCirc aQualifiedCircle2 (anAdaptorCurve2.Circle(), aQCurve2->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedCircle1, aQualifiedCircle2, aPoint3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
else if (anAdaptorCurve1.GetType() == GeomAbs_Circle && anAdaptorCurve2.GetType() == GeomAbs_Line)
{
GccEnt_QualifiedCirc aQualifiedCircle1 (anAdaptorCurve1.Circle(), aQCurve1->GetPosition());
GccEnt_QualifiedLin aQualifiedLin2 (anAdaptorCurve2.Line(), aQCurve2->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedCircle1, aQualifiedLin2, aPoint3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
else if (anAdaptorCurve1.GetType() == GeomAbs_Line && anAdaptorCurve2.GetType() == GeomAbs_Line)
{
GccEnt_QualifiedLin aQualifiedLin1 (anAdaptorCurve1.Line(), aQCurve1->GetPosition());
GccEnt_QualifiedLin aQualifiedLin2 (anAdaptorCurve2.Line(), aQCurve2->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedLin1, aQualifiedLin2, aPoint3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
cout << "Error: wrong curve type.\n";
return 1;
}
// the first, the second and the third curves are not NULL
// <qcircle, qcircle, qcircle> or <qcircle, qcircle, qlin>, <qcircle, qlin, qlin>, <qlin, qlin, qlin>
Geom2dAdaptor_Curve anAdaptorCurve1 (aQCurve1->GetCurve());
Geom2dAdaptor_Curve anAdaptorCurve2 (aQCurve2->GetCurve());
Geom2dAdaptor_Curve anAdaptorCurve3 (aQCurve3->GetCurve());
if (anAdaptorCurve1.GetType() == GeomAbs_Circle && anAdaptorCurve2.GetType() == GeomAbs_Circle &&
anAdaptorCurve3.GetType() == GeomAbs_Circle)
{
GccEnt_QualifiedCirc aQualifiedCircle1 (anAdaptorCurve1.Circle(), aQCurve1->GetPosition());
GccEnt_QualifiedCirc aQualifiedCircle2 (anAdaptorCurve2.Circle(), aQCurve2->GetPosition());
GccEnt_QualifiedCirc aQualifiedCircle3 (anAdaptorCurve3.Circle(), aQCurve3->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedCircle1, aQualifiedCircle2, aQualifiedCircle3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
if (anAdaptorCurve1.GetType() == GeomAbs_Circle && anAdaptorCurve2.GetType() == GeomAbs_Circle &&
anAdaptorCurve3.GetType() == GeomAbs_Line)
{
GccEnt_QualifiedCirc aQualifiedCircle1 (anAdaptorCurve1.Circle(), aQCurve1->GetPosition());
GccEnt_QualifiedCirc aQualifiedCircle2 (anAdaptorCurve2.Circle(), aQCurve2->GetPosition());
GccEnt_QualifiedLin aQualifiedLin3 (anAdaptorCurve3.Line(), aQCurve3->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedCircle1, aQualifiedCircle2, aQualifiedLin3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
if (anAdaptorCurve1.GetType() == GeomAbs_Circle && anAdaptorCurve2.GetType() == GeomAbs_Line &&
anAdaptorCurve3.GetType() == GeomAbs_Line)
{
GccEnt_QualifiedCirc aQualifiedCircle1 (anAdaptorCurve1.Circle(), aQCurve1->GetPosition());
GccEnt_QualifiedLin aQualifiedLin2 (anAdaptorCurve2.Line(), aQCurve2->GetPosition());
GccEnt_QualifiedLin aQualifiedLin3 (anAdaptorCurve3.Line(), aQCurve3->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedCircle1, aQualifiedLin2, aQualifiedLin3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
if (anAdaptorCurve1.GetType() == GeomAbs_Line && anAdaptorCurve2.GetType() == GeomAbs_Line &&
anAdaptorCurve3.GetType() == GeomAbs_Line)
{
GccEnt_QualifiedLin aQualifiedLin1 (anAdaptorCurve1.Line(), aQCurve1->GetPosition());
GccEnt_QualifiedLin aQualifiedLin2 (anAdaptorCurve2.Line(), aQCurve2->GetPosition());
GccEnt_QualifiedLin aQualifiedLin3 (anAdaptorCurve3.Line(), aQCurve3->GetPosition());
GccAna_Circ2d3Tan aCircBuilder (aQualifiedLin1, aQualifiedLin2, aQualifiedLin3, aTolerance);
return solutions (theDI, aCircBuilder, theArgVec[1]);
}
cout << "Error: wrong curve type.\n";
return 1;
}
//=======================================================================
//function : CurveTanCommands
//purpose :
//=======================================================================
void GeometryTest::CurveTanCommands (Draw_Interpretor& theCommands)
{
static Standard_Boolean aLoaded = Standard_False;
if (aLoaded) return;
aLoaded = Standard_True;
DrawTrSurf::BasicCommands (theCommands);
const char* aGroup;
aGroup = "GEOMETRY tangent curves creation";
theCommands.Add ("qcircle",
"qcircle name {x y [ux uy] radius} [-unqualified|-enclosing|-enclosed|-outside|-noqualifier]"
"\n\t\t: Creates qualified circle.",
__FILE__, qcurve, aGroup);
theCommands.Add ("qline",
"qline name x y dx dy [-unqualified|-enclosing|-enclosed|-outside|-noqualifier]"
"\n\t\t: Creates qualified line.",
__FILE__, qcurve, aGroup);
theCommands.Add ("circ2d3Tan",
"circ2d3Tan cname {qcicrle1|qlin1|point1} {qcicrle2|qlin2|point2} {qcicrle3|qlin3|point3} [tolerance]"
"\n\t\t: Creates 2d circles tangent to 3 arguments. The arguments are points, lines or circles."
"\n\t\t: Possible arguments combinations:"
"\n\t\t: <qcircle, qcircle, qcircle>,"
"\n\t\t: <qcircle, qcircle, qlin>,"
"\n\t\t: <qcircle, qcircle, point>,"
"\n\t\t: <qcircle, qlin, qlin>,"
"\n\t\t: <qcircle, qlin, point>,"
"\n\t\t: <qcircle, qlin, qlin>,"
"\n\t\t: <qcircle, point, point>,"
"\n\t\t: <qlin, qlin, qlin>,"
"\n\t\t: <qlin, qlin, point>,"
"\n\t\t: <qlin, point, point>,"
"\n\t\t: <point, point, point>.",
__FILE__, circ2d3Tan, aGroup);
}

View File

@@ -0,0 +1,96 @@
// Created on: 2017-06-16
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2017 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 <GeometryTest_DrawableQualifiedCurve2d.hxx>
#include <GccEnt.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
IMPLEMENT_STANDARD_RTTIEXT(GeometryTest_DrawableQualifiedCurve2d, DrawTrSurf_Curve2d)
//=======================================================================
//function : GeometryTest_DrawableQualifiedCurve2d
//purpose :
//=======================================================================
GeometryTest_DrawableQualifiedCurve2d::GeometryTest_DrawableQualifiedCurve2d (const Handle(Geom2d_Curve)& theCurve,
const GccEnt_Position thePosition,
const Standard_Boolean theDispOrigin)
: DrawTrSurf_Curve2d (theCurve, theDispOrigin), myPosition (thePosition)
{
look = Draw_orange;
}
//=======================================================================
//function : GeometryTest_DrawableQualifiedCurve2d
//purpose :
//=======================================================================
GeometryTest_DrawableQualifiedCurve2d::GeometryTest_DrawableQualifiedCurve2d (const Handle(Geom2d_Curve)& theCurve,
const Draw_Color& theColor,
const Standard_Integer theDiscret,
const GccEnt_Position thePosition,
const Standard_Boolean theDispOrigin,
const Standard_Boolean theDispCurvRadius,
const Standard_Real theRadiusMax,
const Standard_Real theRatioOfRadius)
: DrawTrSurf_Curve2d (theCurve, theColor, theDiscret, theDispOrigin, theDispCurvRadius, theRadiusMax, theRatioOfRadius),
myPosition (thePosition)
{
look = Draw_orange;
}
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
void GeometryTest_DrawableQualifiedCurve2d::DrawOn (Draw_Display& theDisplay) const
{
DrawTrSurf_Curve2d::DrawOn (theDisplay);
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void GeometryTest_DrawableQualifiedCurve2d::Dump (Standard_OStream& theStream) const
{
theStream << "Qualified curve 2D: \n";
theStream << "Position :" << GccEnt::PositionToString (myPosition) << "\n";
DrawTrSurf_Curve2d::Dump (theStream);
}
//=======================================================================
//function : Whatis
//purpose :
//=======================================================================
void GeometryTest_DrawableQualifiedCurve2d::Whatis (Draw_Interpretor& theDI)const
{
Handle(Standard_Type) aType = GetCurve()->DynamicType();
if (aType == STANDARD_TYPE (Geom2d_Circle))
{
theDI << "qualified 2d Circle";
}
else if (aType == STANDARD_TYPE (Geom2d_Line))
{
theDI << "qualified 2d Line";
}
}

View File

@@ -0,0 +1,88 @@
// Created on: 2017-06-16
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2017 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 _GeometryTest_DrawableQualifiedCirc_HeaderFile
#define _GeometryTest_DrawableQualifiedCirc_HeaderFile
#include <Standard.hxx>
#include <DrawTrSurf_Curve2d.hxx>
#include <GccEnt_Position.hxx>
class Geom2d_Curve;
class GeometryTest_DrawableQualifiedCurve2d;
DEFINE_STANDARD_HANDLE(GeometryTest_DrawableQualifiedCurve2d, DrawTrSurf_Curve)
//! Create geom curve drawable presentation with the position of a solution of a construction algorithm.
class GeometryTest_DrawableQualifiedCurve2d : public DrawTrSurf_Curve2d
{
public:
//! Creates a drawable curve from a curve of package Geom.
Standard_EXPORT GeometryTest_DrawableQualifiedCurve2d (const Handle(Geom2d_Curve)& theCurve,
const GccEnt_Position thePosition,
const Standard_Boolean theDispOrigin = Standard_True);
//! Creates a drawable curve from a curve of package Geom.
Standard_EXPORT GeometryTest_DrawableQualifiedCurve2d (const Handle(Geom2d_Curve)& theCurve,
const Draw_Color& theColor,
const Standard_Integer theDiscret,
const GccEnt_Position thePosition,
const Standard_Boolean theDispOrigin = Standard_True,
const Standard_Boolean theDispCurvRadius = Standard_False,
const Standard_Real theRadiusMax = 1.0e3,
const Standard_Real theRatioOfRadius = 0.1);
//! \returns position of a solution
Standard_EXPORT GccEnt_Position GetPosition() const { return myPosition; }
//! Sets position of a solution
//! \param thePosition the value
void SetPosition (const GccEnt_Position thePosition) { myPosition = thePosition; }
//! Paints the drawable presentation in given display
//! \param theDisplay
Standard_EXPORT void DrawOn (Draw_Display& theDisplay) const Standard_OVERRIDE;
//! For variable dump.
Standard_EXPORT virtual void Dump (Standard_OStream& S) const Standard_OVERRIDE;
//! For variable whatis command. Set as a result the
//! type of the variable.
Standard_EXPORT virtual void Whatis (Draw_Interpretor& I) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(GeometryTest_DrawableQualifiedCurve2d, DrawTrSurf_Curve2d)
protected:
private:
GccEnt_Position myPosition;
};
#endif // _GeometryTest_DrawableQualifiedCirc_HeaderFile

View File

@@ -6,7 +6,6 @@ Graphic3d_ArrayOfPolylines.cxx
Graphic3d_ArrayOfPolylines.hxx
Graphic3d_ArrayOfPrimitives.cxx
Graphic3d_ArrayOfPrimitives.hxx
Graphic3d_ArrayOfPrimitives.lxx
Graphic3d_ArrayOfQuadrangles.cxx
Graphic3d_ArrayOfQuadrangles.hxx
Graphic3d_ArrayOfQuadrangleStrips.cxx

View File

@@ -14,22 +14,18 @@
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <Graphic3d_Group.hxx>
#include <NCollection_AlignedAllocator.hxx>
#include <OSD_Environment.hxx>
#include <Quantity_Color.hxx>
#include <Standard.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <stdio.h>
#include <stdlib.h>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPrimitives,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ArrayOfPrimitives, Standard_Transient)
// =======================================================================
// function : Graphic3d_ArrayOfPrimitives
// purpose :
// =======================================================================
Graphic3d_ArrayOfPrimitives::Graphic3d_ArrayOfPrimitives (const Graphic3d_TypeOfPrimitiveArray theType,
const Standard_Integer theMaxVertexs,
const Standard_Integer theMaxBounds,
@@ -152,7 +148,11 @@ Graphic3d_ArrayOfPrimitives::Graphic3d_ArrayOfPrimitives (const Graphic3d_TypeOf
myMaxEdges = theMaxEdges;
}
void Graphic3d_ArrayOfPrimitives::Destroy()
// =======================================================================
// function : ~Graphic3d_ArrayOfPrimitives
// purpose :
// =======================================================================
Graphic3d_ArrayOfPrimitives::~Graphic3d_ArrayOfPrimitives()
{
myVNor = 0;
myVTex = 0;
@@ -162,98 +162,10 @@ void Graphic3d_ArrayOfPrimitives::Destroy()
myBounds .Nullify();
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_ShortReal theX,
const Standard_ShortReal theY,
const Standard_ShortReal theZ)
{
if (myAttribs.IsNull())
{
return 0;
}
const Standard_Integer anIndex = myAttribs->NbElements + 1;
SetVertice (anIndex, theX, theY, theZ);
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const Quantity_Color& theColor)
{
const Standard_Integer anIndex = AddVertex (theVertex);
SetVertexColor (anIndex, theColor.Red(), theColor.Green(), theColor.Blue());
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const Standard_Integer theColor32)
{
const Standard_Integer anIndex = AddVertex (theVertex);
SetVertexColor (anIndex, theColor32);
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ,
const Standard_ShortReal theNX, const Standard_ShortReal theNY, const Standard_ShortReal theNZ)
{
if (myAttribs.IsNull())
{
return 0;
}
const Standard_Integer anIndex = myAttribs->NbElements + 1;
SetVertice (anIndex, theX, theY, theZ);
SetVertexNormal (anIndex, theNX, theNY, theNZ);
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const gp_Dir& theNormal,
const Quantity_Color& theColor)
{
const Standard_Integer anIndex = AddVertex (theVertex, theNormal);
SetVertexColor (anIndex, theColor.Red(), theColor.Green(), theColor.Blue());
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const gp_Dir& theNormal,
const Standard_Integer theColor32)
{
const Standard_Integer anIndex = AddVertex (theVertex, theNormal);
SetVertexColor (anIndex, theColor32);
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ,
const Standard_ShortReal theTX, const Standard_ShortReal theTY)
{
if (myAttribs.IsNull())
{
return 0;
}
const Standard_Integer anIndex = myAttribs->NbElements + 1;
SetVertice (anIndex, theX, theY, theZ);
SetVertexTexel (anIndex, theTX, theTY);
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ,
const Standard_ShortReal theNX, const Standard_ShortReal theNY, const Standard_ShortReal theNZ,
const Standard_ShortReal theTX, const Standard_ShortReal theTY)
{
if (myAttribs.IsNull())
{
return 0;
}
const Standard_Integer anIndex = myAttribs->NbElements + 1;
SetVertice (anIndex, theX, theY, theZ);
SetVertexNormal (anIndex, theNX, theNY, theNZ);
SetVertexTexel (anIndex, theTX, theTY);
return anIndex;
}
// =======================================================================
// function : AddBound
// purpose :
// =======================================================================
Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound (const Standard_Integer theEdgeNumber)
{
if (myBounds.IsNull())
@@ -271,12 +183,10 @@ Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound (const Standard_Integer t
return anIndex;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound (const Standard_Integer theEdgeNumber,
const Quantity_Color& theColor)
{
return AddBound (theEdgeNumber, theColor.Red(), theColor.Green(), theColor.Blue());
}
// =======================================================================
// function : AddBound
// purpose :
// =======================================================================
Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound (const Standard_Integer theEdgeNumber,
const Standard_Real theR,
const Standard_Real theG,
@@ -298,6 +208,10 @@ Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound (const Standard_Integer t
return anIndex;
}
// =======================================================================
// function : AddEdge
// purpose :
// =======================================================================
Standard_Integer Graphic3d_ArrayOfPrimitives::AddEdge (const Standard_Integer theVertexIndex)
{
if (myIndices.IsNull())
@@ -323,59 +237,10 @@ Standard_Integer Graphic3d_ArrayOfPrimitives::AddEdge (const Standard_Integer th
return anIndex;
}
void Graphic3d_ArrayOfPrimitives::SetVertice (const Standard_Integer theIndex,
const gp_Pnt& theVertex)
{
SetVertice (theIndex,
Standard_ShortReal (theVertex.X()),
Standard_ShortReal (theVertex.Y()),
Standard_ShortReal (theVertex.Z()));
}
void Graphic3d_ArrayOfPrimitives::SetVertexColor (const Standard_Integer theIndex,
const Quantity_Color& theColor)
{
SetVertexColor (theIndex, theColor.Red(), theColor.Green(), theColor.Blue());
}
void Graphic3d_ArrayOfPrimitives::SetVertexColor (const Standard_Integer theIndex,
const Standard_Integer theColor)
{
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myMaxVertexs)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
if (myVCol != 0)
{
*reinterpret_cast<Standard_Integer* >(myAttribs->changeValue (theIndex - 1) + size_t(myVCol)) = theColor;
}
}
void Graphic3d_ArrayOfPrimitives::SetVertexNormal (const Standard_Integer theIndex,
const gp_Dir& theNormal)
{
SetVertexNormal (theIndex, theNormal.X(), theNormal.Y(), theNormal.Z());
}
void Graphic3d_ArrayOfPrimitives::SetVertexTexel (const Standard_Integer theIndex,
const gp_Pnt2d& theTexel)
{
SetVertexTexel (theIndex, theTexel.X(), theTexel.Y());
}
void Graphic3d_ArrayOfPrimitives::SetBoundColor (const Standard_Integer theIndex,
const Quantity_Color& theColor)
{
SetBoundColor (theIndex, theColor.Red(), theColor.Green(), theColor.Blue());
}
// =======================================================================
// function : StringType
// purpose :
// =======================================================================
Standard_CString Graphic3d_ArrayOfPrimitives::StringType() const
{
switch (myType)
@@ -394,41 +259,10 @@ Standard_CString Graphic3d_ArrayOfPrimitives::StringType() const
return "UndefinedArray";
}
gp_Pnt Graphic3d_ArrayOfPrimitives::Vertice (const Standard_Integer theRank) const
{
Standard_Real anXYZ[3];
Vertice (theRank, anXYZ[0], anXYZ[1], anXYZ[2]);
return gp_Pnt (anXYZ[0], anXYZ[1], anXYZ[2]);
}
Quantity_Color Graphic3d_ArrayOfPrimitives::VertexColor (const Standard_Integer theRank) const
{
Standard_Real anRGB[3];
VertexColor (theRank, anRGB[0], anRGB[1], anRGB[2]);
return Quantity_Color (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
}
gp_Dir Graphic3d_ArrayOfPrimitives::VertexNormal (const Standard_Integer theRank) const
{
Standard_Real anXYZ[3];
VertexNormal (theRank, anXYZ[0], anXYZ[1], anXYZ[2]);
return gp_Dir (anXYZ[0], anXYZ[1], anXYZ[2]);
}
gp_Pnt2d Graphic3d_ArrayOfPrimitives::VertexTexel (const Standard_Integer theRank) const
{
Standard_Real anXY[2];
VertexTexel (theRank, anXY[0], anXY[1]);
return gp_Pnt2d (anXY[0], anXY[1]);
}
Quantity_Color Graphic3d_ArrayOfPrimitives::BoundColor (const Standard_Integer theRank) const
{
Standard_Real anRGB[3] = {0.0, 0.0, 0.0};
BoundColor (theRank, anRGB[0], anRGB[1], anRGB[2]);
return Quantity_Color (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
}
// =======================================================================
// function : ItemNumber
// purpose :
// =======================================================================
Standard_Integer Graphic3d_ArrayOfPrimitives::ItemNumber() const
{
if (myAttribs.IsNull())
@@ -464,66 +298,10 @@ Standard_Integer Graphic3d_ArrayOfPrimitives::ItemNumber() const
return -1;
}
void Graphic3d_ArrayOfPrimitives::ComputeVNormals (const Standard_Integer theFrom,
const Standard_Integer theTo)
{
Standard_Integer aNext = theFrom + 1;
Standard_Integer aLast = theTo + 1;
gp_Pnt aTri[3];
if (myMaxEdges > 0)
{
aTri[0] = Vertice (Edge (aNext++));
aTri[1] = Vertice (Edge (aNext++));
}
else
{
aTri[0] = Vertice (aNext++);
aTri[1] = Vertice (aNext++);
}
gp_Vec vn;
while (aNext <= aLast)
{
if (myMaxEdges > 0)
{
aTri[2] = Vertice (Edge (aNext));
}
else
{
aTri[2] = Vertice (aNext);
}
gp_Vec v21 (aTri[1], aTri[0]);
gp_Vec v31 (aTri[2], aTri[0]);
vn = v21 ^ v31;
if (vn.SquareMagnitude() > 0.0)
{
break;
}
aNext++;
}
if (aNext > aLast)
{
return;
}
vn.Normalize();
if (myMaxEdges > 0)
{
for (int i = theFrom + 1; i <= theTo + 1; i++)
{
SetVertexNormal (Edge (i), vn);
}
}
else
{
for (int i = theFrom + 1; i <= theTo + 1; i++)
{
SetVertexNormal (i, vn);
}
}
}
// =======================================================================
// function : IsValid
// purpose :
// =======================================================================
Standard_Boolean Graphic3d_ArrayOfPrimitives::IsValid()
{
if (myAttribs.IsNull())

File diff suppressed because it is too large Load Diff

View File

@@ -1,427 +0,0 @@
// Created on: 2000-06-16
// Copyright (c) 2000-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_ArrayOfPrimitives.hxx>
#include <Standard_OutOfRange.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
inline const Handle(Graphic3d_IndexBuffer)& Graphic3d_ArrayOfPrimitives::Indices() const
{
return myIndices;
}
inline const Handle(Graphic3d_Buffer)& Graphic3d_ArrayOfPrimitives::Attributes() const
{
return myAttribs;
}
inline const Handle(Graphic3d_BoundBuffer)& Graphic3d_ArrayOfPrimitives::Bounds() const
{
return myBounds;
}
inline Graphic3d_TypeOfPrimitiveArray Graphic3d_ArrayOfPrimitives::Type() const
{
return myType;
}
inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexNormals() const
{
return myVNor != 0;
}
inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexColors() const
{
return myVCol != 0;
}
inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexTexels() const
{
return myVTex != 0;
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::VertexNumber() const
{
return !myAttribs.IsNull() ? myAttribs->NbElements : -1;
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex)
{
return AddVertex (theVertex.X(), theVertex.Y(), theVertex.Z());
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Graphic3d_Vec3& theVertex)
{
return AddVertex (theVertex.x(), theVertex.y(), theVertex.z());
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const Graphic3d_Vec4ub& theColor)
{
const Standard_Integer anIndex = AddVertex (theVertex);
SetVertexColor (anIndex, theColor);
return anIndex;
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_Real theX,
const Standard_Real theY,
const Standard_Real theZ)
{
return AddVertex (RealToShortReal (theX),
RealToShortReal (theY),
RealToShortReal (theZ));
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const gp_Dir& theNormal)
{
return AddVertex (theVertex.X(), theVertex.Y(), theVertex.Z(),
theNormal.X(), theNormal.Y(), theNormal.Z());
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
const Standard_Real theNX, const Standard_Real theNY, const Standard_Real theNZ)
{
return AddVertex (RealToShortReal (theX), RealToShortReal (theY), RealToShortReal (theZ),
Standard_ShortReal (theNX), Standard_ShortReal (theNY), Standard_ShortReal (theNZ));
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const gp_Pnt2d& theTexel)
{
return AddVertex (theVertex.X(), theVertex.Y(), theVertex.Z(),
theTexel.X(), theTexel.Y());
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
const Standard_Real theTX, const Standard_Real theTY)
{
return AddVertex (RealToShortReal (theX), RealToShortReal (theY), RealToShortReal (theZ),
Standard_ShortReal (theTX), Standard_ShortReal (theTY));
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
const gp_Dir& theNormal,
const gp_Pnt2d& theTexel)
{
return AddVertex (theVertex.X(), theVertex.Y(), theVertex.Z(),
theNormal.X(), theNormal.Y(), theNormal.Z(),
theTexel.X(), theTexel.Y());
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
const Standard_Real theNX, const Standard_Real theNY, const Standard_Real theNZ,
const Standard_Real theTX, const Standard_Real theTY)
{
return AddVertex (RealToShortReal (theX), RealToShortReal (theY), RealToShortReal (theZ),
Standard_ShortReal (theNX), Standard_ShortReal (theNY), Standard_ShortReal (theNZ),
Standard_ShortReal (theTX), Standard_ShortReal (theTY));
}
inline void Graphic3d_ArrayOfPrimitives::SetVertice (const Standard_Integer theIndex,
const Standard_ShortReal theX,
const Standard_ShortReal theY,
const Standard_ShortReal theZ)
{
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myMaxVertexs)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
Graphic3d_Vec3& aVec = myAttribs->ChangeValue<Graphic3d_Vec3> (theIndex - 1);
aVec.x() = theX;
aVec.y() = theY;
aVec.z() = theZ;
if (myAttribs->NbElements < theIndex)
{
myAttribs->NbElements = theIndex;
}
}
inline void Graphic3d_ArrayOfPrimitives::SetVertexColor (const Standard_Integer theIndex,
const Standard_Real theR,
const Standard_Real theG,
const Standard_Real theB)
{
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myMaxVertexs)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
if (myVCol != 0)
{
Graphic3d_Vec4ub aColor (Standard_Byte(theR * 255.0),
Standard_Byte(theG * 255.0),
Standard_Byte(theB * 255.0), 255);
SetVertexColor (theIndex, *reinterpret_cast<Standard_Integer*>(&aColor));
}
myAttribs->NbElements = Max (theIndex, myAttribs->NbElements);
}
inline void Graphic3d_ArrayOfPrimitives::SetVertexColor (const Standard_Integer theIndex,
const Graphic3d_Vec4ub& theColor)
{
SetVertexColor (theIndex, *reinterpret_cast<const Standard_Integer*> (&theColor));
}
inline void Graphic3d_ArrayOfPrimitives::SetVertexNormal (const Standard_Integer theIndex,
const Standard_Real theNX,
const Standard_Real theNY,
const Standard_Real theNZ)
{
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myMaxVertexs)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
if (myVNor != 0)
{
Graphic3d_Vec3& aVec = *reinterpret_cast<Graphic3d_Vec3* >(myAttribs->changeValue (theIndex - 1) + size_t(myVNor));
aVec.x() = Standard_ShortReal (theNX);
aVec.y() = Standard_ShortReal (theNY);
aVec.z() = Standard_ShortReal (theNZ);
}
myAttribs->NbElements = Max (theIndex, myAttribs->NbElements);
}
inline void Graphic3d_ArrayOfPrimitives::SetVertexTexel (const Standard_Integer theIndex,
const Standard_Real theTX,
const Standard_Real theTY)
{
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myMaxVertexs)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
if (myVTex != 0)
{
Graphic3d_Vec2& aVec = *reinterpret_cast<Graphic3d_Vec2* >(myAttribs->changeValue (theIndex - 1) + size_t(myVTex));
aVec.x() = Standard_ShortReal (theTX);
aVec.y() = Standard_ShortReal (theTY);
}
myAttribs->NbElements = Max (theIndex, myAttribs->NbElements);
}
inline void Graphic3d_ArrayOfPrimitives::SetBoundColor (const Standard_Integer theIndex,
const Standard_Real theR,
const Standard_Real theG,
const Standard_Real theB)
{
if (myBounds.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myMaxBounds)
{
throw Standard_OutOfRange("BAD BOUND index");
}
Graphic3d_Vec4& aVec = myBounds->Colors[theIndex - 1];
aVec.r() = Standard_ShortReal (theR);
aVec.g() = Standard_ShortReal (theG);
aVec.b() = Standard_ShortReal (theB);
aVec.a() = 1.0f;
myBounds->NbBounds = Max (theIndex, myBounds->NbBounds);
}
inline void Graphic3d_ArrayOfPrimitives::Vertice (const Standard_Integer theIndex,
Standard_Real& theX,
Standard_Real& theY,
Standard_Real& theZ) const
{
theX = theY = theZ = 0.0;
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myAttribs->NbElements)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
const Graphic3d_Vec3& aVec = myAttribs->Value<Graphic3d_Vec3> (theIndex - 1);
theX = Standard_Real(aVec.x());
theY = Standard_Real(aVec.y());
theZ = Standard_Real(aVec.z());
}
inline void Graphic3d_ArrayOfPrimitives::VertexColor (const Standard_Integer theIndex,
Standard_Real& theR,
Standard_Real& theG,
Standard_Real& theB) const
{
theR = theG = theB = 0.0;
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myAttribs->NbElements)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
Standard_Integer aColorInt = 0;
VertexColor (theIndex, aColorInt);
const Graphic3d_Vec4ub& aColor = *reinterpret_cast<const Graphic3d_Vec4ub* >(&aColorInt);
theR = Standard_Real(aColor.r()) / 255.0;
theG = Standard_Real(aColor.g()) / 255.0;
theB = Standard_Real(aColor.b()) / 255.0;
}
inline void Graphic3d_ArrayOfPrimitives::VertexColor (const Standard_Integer theIndex,
Standard_Integer& theColor) const
{
if (myVCol != 0)
{
theColor = *reinterpret_cast<const Standard_Integer* >(myAttribs->value (theIndex - 1) + size_t(myVCol));
}
}
inline void Graphic3d_ArrayOfPrimitives::VertexNormal (const Standard_Integer theIndex,
Standard_Real& theNX,
Standard_Real& theNY,
Standard_Real& theNZ) const
{
theNX = theNY = theNZ = 0.0;
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myAttribs->NbElements)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
if (myVNor != 0)
{
const Graphic3d_Vec3& aVec = *reinterpret_cast<const Graphic3d_Vec3* >(myAttribs->value (theIndex - 1) + size_t(myVNor));
theNX = Standard_Real(aVec.x());
theNY = Standard_Real(aVec.y());
theNZ = Standard_Real(aVec.z());
}
}
inline void Graphic3d_ArrayOfPrimitives::VertexTexel (const Standard_Integer theIndex,
Standard_Real& theTX,
Standard_Real& theTY) const
{
theTX = theTY = 0.0;
if (myAttribs.IsNull())
{
return;
}
if (theIndex < 1
|| theIndex > myAttribs->NbElements)
{
throw Standard_OutOfRange("BAD VERTEX index");
}
if (myVTex != 0)
{
const Graphic3d_Vec2& aVec = *reinterpret_cast<const Graphic3d_Vec2* >(myAttribs->value (theIndex - 1) + size_t(myVTex));
theTX = Standard_Real(aVec.x());
theTY = Standard_Real(aVec.y());
}
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::EdgeNumber() const
{
return !myIndices.IsNull() ? myIndices->NbElements : -1;
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::Edge (const Standard_Integer theIndex) const
{
if (myIndices.IsNull()
|| theIndex <= 0
|| theIndex > myIndices->NbElements)
{
throw Standard_OutOfRange("BAD EDGE index");
}
return Standard_Integer(myIndices->Index (theIndex - 1) + 1);
}
inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasBoundColors() const
{
return !myBounds.IsNull() && myBounds->Colors != NULL;
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::BoundNumber() const
{
return !myBounds.IsNull() ? myBounds->NbBounds : -1;
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::Bound (const Standard_Integer theIndex) const
{
if (myBounds.IsNull()
|| theIndex <= 0
|| theIndex > myBounds->NbBounds)
{
throw Standard_OutOfRange("BAD BOUND index");
}
return myBounds->Bounds[theIndex - 1];
}
inline void Graphic3d_ArrayOfPrimitives::BoundColor (const Standard_Integer theIndex,
Standard_Real& theR,
Standard_Real& theG,
Standard_Real& theB) const
{
if (myBounds.IsNull()
|| myBounds->Colors == NULL
|| theIndex <= 0
|| theIndex > myBounds->NbBounds)
{
throw Standard_OutOfRange(" BAD BOUND index");
}
const Graphic3d_Vec4& aVec = myBounds->Colors[theIndex - 1];
theR = Standard_Real(aVec.r());
theG = Standard_Real(aVec.g());
theB = Standard_Real(aVec.b());
}

View File

@@ -112,13 +112,3 @@ TopoDS_Shape HLRAppli_ReflectLines::GetResult() const
{
return GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True, Standard_True);
}
//=======================================================================
//function : GetCompoundOfFaces
//purpose :
//=======================================================================
TopoDS_Shape HLRAppli_ReflectLines::GetCompoundOfFaces(bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace ) const
{
HLRBRep_HLRToShape aHLRToShape( myHLRAlgo );
return aHLRToShape.CompoundOfFaces(theMode, OrigFaceToProjFace);
}

View File

@@ -26,7 +26,6 @@
#include <HLRBRep_TypeOfResultingEdge.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
class TopoDS_Shape;
@@ -61,9 +60,6 @@ public:
const Standard_Boolean visible,
const Standard_Boolean In3d) const;
Standard_EXPORT TopoDS_Shape GetCompoundOfFaces(bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace) const;
protected:
@@ -74,6 +70,8 @@ protected:
private:
HLRAlgo_Projector myProjector;
Handle(HLRBRep_Algo) myHLRAlgo;
TopoDS_Shape myShape;

View File

@@ -899,6 +899,7 @@ void HLRBRep_Data::InitEdge (const Standard_Integer FI,
Standard_Boolean HLRBRep_Data::MoreEdge ()
{
if (iFaceTest) {
if (myFaceItr2.MoreEdge()) { // all edges must be tested if
myLE = myFaceItr2.Edge (); // the face is not a simple
@@ -926,25 +927,61 @@ Standard_Boolean HLRBRep_Data::MoreEdge ()
return myCurSortEd <= myNbrSortEd;
}
//=======================================================================
//function : GetNextEdge
//function : NextEdge
//purpose :
//=======================================================================
void HLRBRep_Data::GetNextEdge()
void HLRBRep_Data::NextEdge (const Standard_Boolean skip)
{
if (myCurSortEd > myNbrSortEd)
if (skip) {
if (iFaceTest) myFaceItr2.NextEdge();
else myCurSortEd++;
}
if (!MoreEdge()) return;
if (iFaceTest) {
myLE = myFaceItr2.Edge ();
myLEOutLine = myFaceItr2.OutLine ();
myLEInternal = myFaceItr2.Internal();
myLEDouble = myFaceItr2.Double ();
myLEIsoLine = myFaceItr2.IsoLine ();
myLEData = &myEData(myLE);
myLEGeom = &myLEData->ChangeGeometry();
myLEMinMax = &myLEData->MinMax();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
if (((HLRBRep_EdgeData*)myLEData)->Vertical() ||
(myLEDouble &&
((HLRBRep_EdgeData*)myLEData)->HideCount() == myHideCount-1))
NextEdge();
((HLRBRep_EdgeData*)myLEData)->HideCount(myHideCount-1);
return;
for (;myCurSortEd <= myNbrSortEd;myCurSortEd++)
{
myLE = myEdgeIndices(myCurSortEd);
if (myEData(myLE).Vertical() || myEData(myLE).Status().AllHidden())
continue;
myLEData = &myEData(myLE);
if (myLEData->HideCount() > myHideCount-2)
continue;
myLEMinMax = &myLEData->MinMax();
if (((iFaceMinMax->Max[0] - myLEMinMax->Min[0]) & 0x80008000) != 0 ||
}
else {
myLE = Edge();
myLEOutLine = Standard_False;
myLEInternal = Standard_False;
myLEDouble = Standard_False;
myLEIsoLine = Standard_False;
myLEData = &myEData(myLE);
myLEGeom = &myLEData->ChangeGeometry();
myLEMinMax = &myLEData->MinMax();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
}
if (((HLRBRep_EdgeData*)myLEData)->Vertical()) {
NextEdge();
return;
}
if (((HLRBRep_EdgeData*)myLEData)->HideCount() > myHideCount-2) {
NextEdge();
return;
}
if (((HLRBRep_EdgeData*)myLEData)->Status().AllHidden()) {
NextEdge();
return;
}
if (((iFaceMinMax->Max[0] - myLEMinMax->Min[0]) & 0x80008000) != 0 ||
((myLEMinMax->Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
((iFaceMinMax->Max[1] - myLEMinMax->Min[1]) & 0x80008000) != 0 ||
((myLEMinMax->Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
@@ -958,59 +995,15 @@ void HLRBRep_Data::GetNextEdge()
((myLEMinMax->Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
((iFaceMinMax->Max[6] - myLEMinMax->Min[6]) & 0x80008000) != 0 ||
((myLEMinMax->Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
((iFaceMinMax->Max[7] - myLEMinMax->Min[7]) & 0x80008000) != 0)
continue;
myLEGeom = &myLEData->ChangeGeometry();
myLETol = myLEData->Tolerance();
if (((HLRBRep_Surface*)iFaceGeom)->IsAbove
(iFaceBack,myLEGeom,(Standard_Real)myLETol))
continue;
break;
}
myLEOutLine = Standard_False;
myLEInternal = Standard_False;
myLEDouble = Standard_False;
myLEIsoLine = Standard_False;
myLEGeom = &myLEData->ChangeGeometry();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
}
void HLRBRep_Data::NextEdge (const Standard_Boolean skip)
{
if (skip)
{
if (iFaceTest)
myFaceItr2.NextEdge();
else
myCurSortEd++;
}
if (iFaceTest && !MoreEdge())
return;
if (!iFaceTest)
{
GetNextEdge();
return;
}
myLE = myFaceItr2.Edge ();
myLEOutLine = myFaceItr2.OutLine ();
myLEInternal = myFaceItr2.Internal();
myLEDouble = myFaceItr2.Double ();
myLEIsoLine = myFaceItr2.IsoLine ();
myLEData = &myEData(myLE);
myLEGeom = &myLEData->ChangeGeometry();
myLEMinMax = &myLEData->MinMax();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
if (((HLRBRep_EdgeData*)myLEData)->Vertical() ||
(myLEDouble &&
((HLRBRep_EdgeData*)myLEData)->HideCount() == myHideCount-1))
((iFaceMinMax->Max[7] - myLEMinMax->Min[7]) & 0x80008000) != 0) { //-- rejection en z
NextEdge();
((HLRBRep_EdgeData*)myLEData)->HideCount(myHideCount-1);
return;
}
if (((HLRBRep_Surface*)iFaceGeom)->IsAbove
(iFaceBack,myLEGeom,(Standard_Real)myLETol)) {
NextEdge();
return;
}
return; // edge is OK
}

View File

@@ -109,8 +109,6 @@ public:
Standard_EXPORT Standard_Boolean MoreEdge();
Standard_EXPORT void NextEdge (const Standard_Boolean skip = Standard_True);
Standard_EXPORT void GetNextEdge();
//! Returns the current Edge
Standard_EXPORT Standard_Integer Edge() const;
@@ -238,9 +236,7 @@ private:
Standard_Boolean iFaceBack;
Standard_Boolean iFaceSimp;
Standard_Boolean iFaceSmpl;
public:
Standard_Boolean iFaceTest;
private:
Standard_Integer myHideCount;
Standard_Real myDeca[16];
Standard_Real mySurD[16];

View File

@@ -38,12 +38,10 @@ myFlags(0),mySize(0)
void HLRBRep_FaceData::Set (const TopoDS_Face& FG,
const TopAbs_Orientation Or,
const Standard_Boolean Cl,
const Standard_Integer NW,
const Standard_Boolean isInitSurf) //TODO isInitSurf can be deleted
const Standard_Integer NW)
{
Closed(Cl);
if (isInitSurf)
Geometry().Surface(FG);
Geometry().Surface(FG);
myTolerance = (Standard_ShortReal)(BRep_Tool::Tolerance(FG));
Orientation(Or);
Wires() = new HLRAlgo_WiresBlock(NW);

View File

@@ -46,7 +46,7 @@ public:
//! if the face belongs to a closed volume. <NW> is
//! the number of wires ( or block of edges ) of the
//! face.
Standard_EXPORT void Set (const TopoDS_Face& FG, const TopAbs_Orientation Or, const Standard_Boolean Cl, const Standard_Integer NW, const Standard_Boolean isInitSurf);
Standard_EXPORT void Set (const TopoDS_Face& FG, const TopAbs_Orientation Or, const Standard_Boolean Cl, const Standard_Integer NW);
//! Set <NE> the number of edges of the wire number
//! <WI>.

View File

@@ -28,34 +28,6 @@
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepLib.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <TopExp.hxx>
#include <IntTools_FClass2d.hxx>
#include <BRepTools_ReShape.hxx>
#include <Poly_MakeLoops.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <Bnd_Box2d.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <NCollection_Handle.hxx>
#include <BRepBndLib.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <IntTools_Context.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#include <NCollection_UBTree.hxx>
#include <Extrema_POnCurv2d.hxx>
#include <IntCurvesFace_ShapeIntersector.hxx>
#include <Extrema_ExtPC2d.hxx>
#include <HLRTopoBRep_OutLiner.hxx>
#include <Geom_Plane.hxx>
#include <BRepBndLib.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
#include <algorithm>
//=======================================================================
//function : HLRBRep_HLRToShape
//purpose :
@@ -278,932 +250,3 @@ HLRBRep_HLRToShape::DrawEdge (const Standard_Boolean visible,
}
}
}
//UBTree edge-point
typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HLRVV_BndBoxTree;
class HLRVV_BndBoxTreeSelector : public HLRVV_BndBoxTree::Selector
{
public:
HLRVV_BndBoxTreeSelector( const TopTools_IndexedMapOfShape& theInpShapes,
double theMinDDist)
: myInpShapes(theInpShapes),
myMinDDist(theMinDDist),
myResId (-1),
myCId (-1)
{}
Standard_Boolean Reject (const Bnd_Box2d& theBox) const
{
double aCurDDist = theBox.SquareDistance(myCPnt);
if (aCurDDist > myMinDDist)
return true;
else
return false;
}
Standard_Boolean Accept (const Standard_Integer& theObj)
{
//extrema pnt <-> vertex
const TopoDS_Shape& aSh = myInpShapes(theObj);
if (theObj == myCId)
return Standard_False;
gp_Pnt aCVP = BRep_Tool::Pnt(TopoDS::Vertex(aSh));
gp_Pnt2d aCVP2d(aCVP.X(), aCVP.Y());
double aDD = aCVP2d.SquareDistance(myCPnt);
if (aDD < myMinDDist)
{
myMinDDist = aDD;
myResId = theObj;
}
return Standard_True;
}
void Reset(double theMinDDist)
{
myMinDDist = theMinDDist;
myResId = -1;
myCId = -1;
}
void SetCurrentPoint( int id )
{
gp_Pnt CP = BRep_Tool::Pnt(TopoDS::Vertex(myInpShapes(id)));
myCPnt.SetX(CP.X());
myCPnt.SetY(CP.Y());
myCId = id;
}
double GetMinDDist() const
{
return myMinDDist;
}
int GetResVId() const
{
return myResId;
}
private:
HLRVV_BndBoxTreeSelector(const HLRVV_BndBoxTreeSelector& );
HLRVV_BndBoxTreeSelector& operator=(const HLRVV_BndBoxTreeSelector& );
private:
const TopTools_IndexedMapOfShape& myInpShapes;
gp_Pnt2d myCPnt;
double myMinDDist;
int myResId;
int myCId;
};
///
//UBTree edge-point
typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HLRVE_BndBoxTree;
class HLRVE_BndBoxTreeSelector : public HLRVE_BndBoxTree::Selector
{
public:
HLRVE_BndBoxTreeSelector(
const NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& theEdgeAdapt,
double theMinDDist)
: myEdgeAdapt (theEdgeAdapt),
myMinDDist(theMinDDist)
{}
Standard_Boolean Reject (const Bnd_Box2d& theBox) const
{
double aCurDDist = theBox.SquareDistance(myCPnt);
if (aCurDDist > myMinDDist)
return true;
else
return false;
}
Standard_Boolean Accept (const Standard_Integer& theObj)
{
const BRepAdaptor_Curve2d& adapt = myEdgeAdapt(theObj);
Extrema_ExtPC2d aExtPC(myCPnt, adapt, adapt.FirstParameter(), adapt.LastParameter());
if (aExtPC.IsDone() && aExtPC.NbExt() > 0 )
{
NCollection_Handle<Extrema_POnCurv2d> aPSol;// = aExtPC.Point(1);
double aMinDD = Precision::Infinite();
double aFp = adapt.FirstParameter();
double aLp = adapt.LastParameter();
for ( Standard_Integer i = 1; i <= aExtPC.NbExt(); i++)
{
double aCDD = aExtPC.SquareDistance(i);
Extrema_POnCurv2d aCurSol = aExtPC.Point(i);
if (Abs(aCurSol.Parameter() - aFp) < Precision::Confusion() ||
Abs(aCurSol.Parameter() - aLp) < Precision::Confusion()) //TODO it's better to use tolerance of vertex here
continue;
if ( aCDD < aMinDD)
{
aMinDD = aCDD;
aPSol = new Extrema_POnCurv2d(aExtPC.Point(i));
}
}
if (aMinDD < myMinDDist)
{
myMinDDist = aMinDD;
myEARes = adapt;
if (!myPSolRes)
myPSolRes = new Extrema_POnCurv2d( *aPSol );
else
myPSolRes->SetValues(aPSol->Parameter(), aPSol->Value());
}
}
return Standard_True;
}
void Reset(double theMinDDist)
{
myMinDDist = theMinDDist;
myPSolRes.Nullify();
}
void SetCurrentPoint( const gp_Pnt& thePnt )
{
myCPnt.SetX(thePnt.X());
myCPnt.SetY(thePnt.Y());
}
bool GetPResult(Extrema_POnCurv2d& thePSolRes, BRepAdaptor_Curve2d& theERes) const
{
if (!myPSolRes.IsNull())
{
thePSolRes = *myPSolRes;
theERes = myEARes;
return true;
}
else
return false;
}
private:
HLRVE_BndBoxTreeSelector(const HLRVE_BndBoxTreeSelector& );
HLRVE_BndBoxTreeSelector& operator=(const HLRVE_BndBoxTreeSelector& );
private:
const NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& myEdgeAdapt;
gp_Pnt2d myCPnt;
double myMinDDist;
NCollection_Handle<Extrema_POnCurv2d> myPSolRes;
BRepAdaptor_Curve2d myEARes;
};
//! deriatives of the edges on both ends
struct BRepFill_TangentLinkInfo
{
gp_Dir2d myD1L;
gp_Dir2d myD1F;
};
class BRepFill_PolyHelper : public Poly_MakeLoops2D::Helper
{
public:
BRepFill_PolyHelper( const NCollection_DataMap<Poly_MakeLoops2D::Link, BRepFill_TangentLinkInfo>& mL2TI,
const NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>& themNode2ListOfLinks) :
myL2TI (mL2TI),
mymNode2ListOfLinks (themNode2ListOfLinks)
{
};
virtual const Poly_MakeLoops2D::ListOfLink& GetAdjacentLinks (Standard_Integer theNode) const
{
return mymNode2ListOfLinks(theNode);
}
virtual Standard_Boolean GetFirstTangent(const Poly_MakeLoops2D::Link& theLink, gp_Dir2d& theDir) const
{
if (theLink.flags & Poly_MakeLoops2D::LF_Reversed)
theDir = -myL2TI(theLink).myD1L;
else
theDir = myL2TI(theLink).myD1F;
return Standard_True;
}
virtual Standard_Boolean GetLastTangent(const Poly_MakeLoops2D::Link& theLink, gp_Dir2d& theDir) const
{
if (theLink.flags & Poly_MakeLoops2D::LF_Reversed)
theDir = -myL2TI(theLink).myD1F;
else
theDir = myL2TI(theLink).myD1L;
return Standard_True;
}
private:
BRepFill_PolyHelper& operator= (const BRepFill_PolyHelper &theOther);
private:
const NCollection_DataMap<Poly_MakeLoops2D::Link, BRepFill_TangentLinkInfo>& myL2TI;
const NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>& mymNode2ListOfLinks;
};
typedef NCollection_UBTree <Standard_Integer, Bnd_Box> HLRFL_BndBoxTree;
class HLRFL_BndBoxTreeSelector : public HLRFL_BndBoxTree::Selector
{
public:
struct FaceParam
{
TopoDS_Face myF;
double LPar;
};
HLRFL_BndBoxTreeSelector(const TopTools_IndexedMapOfShape& theFMap, bool theMode)
: HLRFL_BndBoxTreeSelector::Selector(),
myFMap (theFMap),
myIntersectors(1, theFMap.Size()),
myMode (theMode)
{
for (int i =1; i <= myIntersectors.Size(); i++)
myIntersectors(i) = NULL;
}
~HLRFL_BndBoxTreeSelector()
{
for (int i =1; i <= myIntersectors.Size(); i++)
{
IntCurvesFace_ShapeIntersector* an_inter = myIntersectors(i);
if (an_inter)
delete an_inter;
}
}
Standard_Boolean Reject (const Bnd_Box& theBox) const
{
return theBox.IsOut (myLine);
}
Standard_Boolean Accept (const Standard_Integer& theObj)
{
if (theObj > myFMap.Extent())
return Standard_False;
const TopoDS_Face& F = TopoDS::Face(myFMap(theObj));
IntCurvesFace_ShapeIntersector* an_inter = myIntersectors(theObj);
if (!an_inter)
{
an_inter = new IntCurvesFace_ShapeIntersector();
an_inter->Load(F, Precision::Confusion());
}
an_inter->Perform(myLine, -Precision::Infinite(), Precision::Infinite()); //TODO trim the line according to bnd box of face
if (an_inter->IsDone() && an_inter->NbPnt())
{
for (int i=1; i <= an_inter->NbPnt(); i++)
{
FaceParam fp;
fp.LPar = an_inter->WParameter(i);
fp.myF = an_inter->Face(i);
myRParams.push_back(fp);
}
if (!myMode)
myStop = 1;
}
return Standard_True;
//int nbpnt = an_inter->.NbPnt();
}
void SetLine (const gp_Lin& theLine)
{
myLine = theLine;
}
const std::vector<FaceParam>& GetRParams () const
{
return myRParams;
}
void ResetResult()
{
myRParams.clear();
}
private:
HLRFL_BndBoxTreeSelector(const HLRFL_BndBoxTreeSelector& );
HLRFL_BndBoxTreeSelector& operator=(const HLRFL_BndBoxTreeSelector& );
private:
const TopTools_IndexedMapOfShape& myFMap;
gp_Lin myLine;
NCollection_Array1<IntCurvesFace_ShapeIntersector*> myIntersectors;
std::vector<FaceParam> myRParams;
bool myMode; //if true => find all line-face intersections; otherwise - find any and stop the search
};
static bool FuseVE(TopoDS_Shape& theRes)
{
TopTools_IndexedMapOfShape allE;
TopExp::MapShapes(theRes, TopAbs_EDGE, allE);
TopTools_ListOfShape aLSE;
for (int i = 1; i <= allE.Extent(); i++ )
aLSE.Append(allE(i));
Standard_Real aFV = 0;
BRepAlgoAPI_BuilderAlgo aBlr;
aBlr.SetArguments(aLSE);
aBlr.SetRunParallel(Standard_True);
aBlr.SetFuzzyValue(aFV);
aBlr.Build();
if (aBlr.HasErrors())
{
aBlr.DumpErrors(cout);
return false;
}
theRes = aBlr.Shape();
return true;
}
static void ProcessHVertices(TopoDS_Shape& theRes,
NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& theEdAd,
NCollection_DataMap<TopoDS_Edge, Bnd_Box2d, TopTools_ShapeMapHasher>& theEdBnd2d )
{
BRepTools_ReShape reshaper;
///hanging vertices => find closely located point on some edge or vertex
TopoDS_Face aDraftPrFace;
BRep_Builder().MakeFace(aDraftPrFace, BRepLib::Plane(), Precision::Confusion());
TopTools_IndexedDataMapOfShapeListOfShape M;
TopExp::MapShapesAndAncestors(theRes, TopAbs_VERTEX, TopAbs_EDGE, M);
TopTools_IndexedMapOfShape HV;
for (int i = 1; i <= M.Extent(); i++)
if (M(i).Extent() == 1)
HV.Add(M.FindKey(i));
//
TopTools_IndexedMapOfShape VV, EE;
TopExp::MapShapes(theRes, TopAbs_VERTEX, VV);
TopExp::MapShapes(theRes, TopAbs_EDGE, EE);
//
//vertex-vertex extrema
NCollection_UBTree <Standard_Integer, Bnd_Box2d> aTreeVV;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFillerVV (aTreeVV);
for (Standard_Integer i = 1; i <= VV.Extent(); i++)
{
const TopoDS_Vertex& aV = TopoDS::Vertex(VV(i));
Bnd_Box2d aBB;
gp_Pnt aPV = BRep_Tool::Pnt(aV);
aBB.Add(gp_Pnt2d(aPV.X(), aPV.Y()));
aBB.Enlarge(BRep_Tool::Tolerance(aV));
aTreeFillerVV.Add(i, aBB);
}
aTreeFillerVV.Fill();
HLRVV_BndBoxTreeSelector aSelectorVV(VV, Precision::Infinite());
//vertex-edge extrema
NCollection_UBTree <Standard_Integer, Bnd_Box2d> aTreeVE;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFillerVE (aTreeVE);
int nbEE = EE.Extent();
//NCollection_Array1<BRepAdaptor_Curve2d> anEdgeAdapters(1, nbEE);
for (Standard_Integer i = 1; i <= nbEE; i++)
{
const TopoDS_Edge& anE = TopoDS::Edge(EE(i));
Bnd_Box2d aBB;
theEdAd.Add(anE, BRepAdaptor_Curve2d(anE, aDraftPrFace));
BndLib_Add2dCurve::Add(*theEdAd.Seek(anE), 0, aBB);
theEdBnd2d.Bind(anE, aBB);
aTreeFillerVE.Add(i, aBB);
}
aTreeFillerVE.Fill();
HLRVE_BndBoxTreeSelector aSelectorVE(theEdAd, Precision::Infinite()); //min dist doesn't matter here
//
TopTools_IndexedMapOfShape toadd, torem;//temp
for (int i = 1; i <= HV.Extent(); i++ )
{
const TopoDS_Vertex& CHV = TopoDS::Vertex(HV(i));
gp_Pnt CHVPnt = BRep_Tool::Pnt(CHV);
//
int id = VV.FindIndex(CHV);
aSelectorVV.Reset(Precision::Infinite());
aSelectorVV.SetCurrentPoint( id );
/*int resVV =*/ aTreeVV.Select(aSelectorVV);
double aMinDDistReached = aSelectorVV.GetMinDDist();
TopoDS_Vertex aResV = TopoDS::Vertex(VV(aSelectorVV.GetResVId()));
//
aSelectorVE.Reset(aMinDDistReached);
aSelectorVE.SetCurrentPoint( CHVPnt );
/*int resVE = */aTreeVE.Select(aSelectorVE);
Extrema_POnCurv2d aPSolRes;
BRepAdaptor_Curve2d aResEA;
bool VEFound = aSelectorVE.GetPResult(aPSolRes, aResEA);
if (VEFound)
{
///if (BRep_Tool::Degenerated(E)) //can be degenerted??
double aPar = aPSolRes.Parameter();
const TopoDS_Edge& aResE = aResEA.Edge();
TopoDS_Edge aDE1 = TopoDS::Edge(aResE.EmptyCopied().Oriented(TopAbs_FORWARD));
TopoDS_Edge aDE2 = TopoDS::Edge(aResE.EmptyCopied().Oriented(TopAbs_FORWARD));
TopoDS_Vertex aFV, aLV;
TopExp::Vertices(aResE, aFV, aLV);
double aFP = aResEA.FirstParameter();
double aLP = aResEA.LastParameter();
gp_Pnt2d aResP2d = aResEA.Value(aPar);
gp_Pnt aResP3d(aResP2d.X(), aResP2d.Y(), 0.0);
TopoDS_Vertex aDummyV = BRepLib_MakeVertex(aResP3d).Vertex();
//
NCollection_List<TopoDS_Shape> nls;
nls.Append(aDummyV);
nls.Append(CHV);
gp_Pnt aNC;
double aNTol;
BRepLib::BoundingVertex(nls, aNC, aNTol);
gp_Pnt aFVP = BRep_Tool::Pnt(aFV);
gp_Pnt aLVP = BRep_Tool::Pnt(aLV);
if (aFVP.Distance(aNC) < aNTol*1e10 ||
aLVP.Distance(aNC) < aNTol*1e10)
{
nls.RemoveFirst();
nls.Append(aResV);
BRepLib::BoundingVertex(nls, aNC, aNTol);
BRep_Builder().UpdateVertex(aResV, aNC, aNTol);
reshaper.Replace(CHV, aResV.Oriented(CHV.Orientation()));
if (HV.Contains(aResV)) //if the closest vertex lays on edge => never contains in HV
HV.RemoveKey(aResV);
}
else
{
BRep_Builder().UpdateVertex(CHV, aNC, aNTol);
BRep_Builder().Range(aDE1, aFP, aPar);
BRep_Builder().Add(aDE1, aFV.Oriented(TopAbs_FORWARD));
BRep_Builder().Add(aDE1, CHV.Oriented(TopAbs_REVERSED));
//
BRep_Builder().Range(aDE2, aPar, aLP );
BRep_Builder().Add(aDE2, CHV.Oriented(TopAbs_FORWARD));
BRep_Builder().Add(aDE2, aLV.Oriented(TopAbs_REVERSED));
//
///TODO temp
torem.Add(aResE);
toadd.Add(aDE1);
toadd.Add(aDE2);
//TopoDS_Compound aResCmp;
//BRep_Builder().MakeCompound(aResCmp);
//BRep_Builder().Add(aResCmp, aDE1);
//BRep_Builder().Add(aResCmp, aDE2);
//
//TopoDS_Wire aResW;
//BRep_Builder().MakeWire(aResW);
//BRep_Builder().Add(aResW, aDE1);
//BRep_Builder().Add(aResW, aDE2);
//TopoDS_Wire aResW = BRepBuilderAPI_MakeWire(aDE1, aDE2).Wire(); //this will control proper sharing and tolerance matching between vertices
/*{ //DEB
TopTools_IndexedMapOfShape VVVV;
TopExp::MapShapes(aResW, TopAbs_VERTEX, VVVV);
//cout << VVVV.Extent() << endl;
}*/
//aResW.Orientation(aResE.Orientation());
//reshape.Replace(aResE, aResCmp);
}
}
else
{
NCollection_List<TopoDS_Shape> nls; //TODO move to ext func
nls.Append(CHV);
nls.Append(aResV);
gp_Pnt aNC;
double aNTol;
BRepLib::BoundingVertex(nls, aNC, aNTol);
BRep_Builder().UpdateVertex(aResV, aNC, aNTol);
reshaper.Replace(CHV, aResV.Oriented(CHV.Orientation()));
if (HV.Contains(aResV)) //if the closest vertex lays on edge => never contains in HV
HV.RemoveKey(aResV);
}
}
//DEB
for (int i =1; i<= torem.Extent() ;i++)
BRep_Builder().Remove(theRes, torem(i));
//DEB
for (int i =1; i<= toadd.Extent() ;i++)
BRep_Builder().Add(theRes, toadd(i));
//
theRes = reshaper.Apply(theRes); //replace only vertices
}
static void FillNode2LLMap(Standard_Integer NewNode, const Poly_MakeLoops2D::Link& NewLink,
NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>& mNode2ListOfLinks)
{
if (!mNode2ListOfLinks.IsBound(NewNode))
mNode2ListOfLinks.Bound(NewNode, Poly_MakeLoops2D::ListOfLink())->Append(NewLink);
else
mNode2ListOfLinks(NewNode).Append(NewLink);
}
static TopAbs_State GetStateOfSamplePoint(const TopoDS_Face& ff2,
const IntTools_FClass2d& fclass,
const Bnd_Box2d& fbnd)
{
TopExp_Explorer exp(ff2, TopAbs_EDGE); //should contains at least one edge
TopoDS_Edge fe2 = TopoDS::Edge(exp.Current());
BRepAdaptor_Curve2d afe2(fe2, ff2);
gp_Pnt2d middlepoint = afe2.Value((afe2.LastParameter() + afe2.FirstParameter()) / 2.0);
Bnd_Box bb3d;
BRepBndLib::Add(ff2, bb3d);
Bnd_Box2d bb2d;
bb2d.Set(gp_Pnt2d(bb3d.CornerMin().X(), bb3d.CornerMin().Y()));
bb2d.Add(gp_Pnt2d(bb3d.CornerMax().X(), bb3d.CornerMax().Y()));
if (bb2d.IsOut(middlepoint))
return TopAbs_OUT;
else
return fclass.Perform(middlepoint);
}
bool HLRBRep_ParComp(const HLRFL_BndBoxTreeSelector::FaceParam& a,
const HLRFL_BndBoxTreeSelector::FaceParam& b)
{
return a.LPar < b.LPar;
}
static TopoDS_Shape ProcessLoops(const TopoDS_Shape& theRes,
NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& anEdAd,
NCollection_DataMap<TopoDS_Edge, Bnd_Box2d, TopTools_ShapeMapHasher> theEdBnd2d,
HLRAlgo_Projector& projector,
const TopTools_ListOfShape& anOrigShapes,
bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace )
{
NCollection_List<TopoDS_Wire> theLoops;
NCollection_List<TopoDS_Wire> SelfLoops;
NCollection_DataMap<TopoDS_Shape, Bnd_Box2d, TopTools_ShapeMapHasher> aShToBnd2d;
TopoDS_Face aDraftPrFace;
BRep_Builder().MakeFace(aDraftPrFace, BRepLib::Plane(), Precision::Confusion());
TopTools_IndexedMapOfShape mN2V;
TopExp::MapShapes(theRes, TopAbs_VERTEX, mN2V);
NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink> mNode2ListOfLinks;
NCollection_DataMap<Poly_MakeLoops2D::Link, BRepFill_TangentLinkInfo> mL2TI;
//Create links for Poly_MakeLoops algo and bind them to the existing edges
NCollection_DataMap<Poly_MakeLoops2D::Link, TopoDS_Edge> mL2E;
Standard_Integer LastIndV = mN2V.Extent();
TopExp_Explorer ExpE;
ExpE.Init(theRes, TopAbs_EDGE);
for (; ExpE.More(); ExpE.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(ExpE.Current());
// If edge contains only one vertex => self loop (should be non degenerated)
TopoDS_Vertex FV, LV;
FV = TopExp::FirstVertex(E, Standard_True);
LV = TopExp::LastVertex(E, Standard_True);
if (FV.IsSame(LV))
{
if (!BRep_Tool::Degenerated(E))
{
const TopoDS_Wire& aW = BRepLib_MakeWire(E).Wire();
SelfLoops.Append(aW);
Bnd_Box2d aBB;
BndLib_Add2dCurve::Add(BRepAdaptor_Curve2d(E, aDraftPrFace), 0, aBB);
aShToBnd2d.Bind(aW, aBB);
}
continue;
}
const BRepAdaptor_Curve2d* anAd = anEdAd.Seek(E);
if (!anAd)
{
anEdAd.Add(E, BRepAdaptor_Curve2d(E, aDraftPrFace));
anAd = anEdAd.Seek(E);
Bnd_Box2d aBB;
BndLib_Add2dCurve::Add(*anEdAd.Seek(E), 0, aBB);
theEdBnd2d.Bind(E, aBB);
}
//NCollection_Handle<BRepAdaptor_Curve2d> adapt = new BRepAdaptor_Curve2d(E, aDraftPrFace);
gp_Pnt2d Pnt;
gp_Vec2d Vec;
gp_Dir2d D1F, D1L;
if (anAd->Curve().IsNull())
continue;
TopAbs_Orientation EOri = E.Orientation();
if (EOri == TopAbs_FORWARD)
{
anAd->D1(anAd->FirstParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->FirstParameter() + Precision::Confusion(), Pnt, Vec);
D1F.SetCoord(Vec.X(), Vec.Y());
anAd->D1(anAd->LastParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->LastParameter() - Precision::Confusion(), Pnt, Vec);
D1L.SetCoord(Vec.X(), Vec.Y());
}
else if (EOri == TopAbs_REVERSED)
{
anAd->D1(anAd->LastParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->LastParameter() - Precision::Confusion(), Pnt, Vec);
D1F.SetCoord(-Vec.X(), -Vec.Y());
anAd->D1(anAd->FirstParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->FirstParameter() + Precision::Confusion(), Pnt, Vec);
D1L.SetCoord(-Vec.X(), -Vec.Y());
}
else
continue;
Standard_Integer Node1 = mN2V.FindIndex(FV);
Standard_Integer Node2 = mN2V.FindIndex(LV);
Poly_MakeLoops2D::Link aLink(Node1, Node2);
aLink.flags = Poly_MakeLoops2D::LF_Both;
if (!mL2E.IsBound(aLink))
{
mL2E.Bind(aLink, E);
FillNode2LLMap(Node1, aLink, mNode2ListOfLinks);
FillNode2LLMap(Node2, aLink, mNode2ListOfLinks);
BRepFill_TangentLinkInfo* Info = mL2TI.Bound(aLink, BRepFill_TangentLinkInfo());
Info->myD1F = D1F;
Info->myD1L = D1L;
}
else
{
//link have been met twise. This may indicate that it is has
//opposite direction now. Try to divide it (node1, node2) => (node1, ind) + (ind, node2)
//so it can be passed to loop maker
LastIndV++;
Poly_MakeLoops2D::Link aLink1(Node1, LastIndV);
aLink1.flags = Poly_MakeLoops2D::LF_Both;
Poly_MakeLoops2D::Link aLink2(LastIndV, Node2);
aLink2.flags = Poly_MakeLoops2D::LF_Both;
mL2E.Bind(aLink1, E);
mL2E.Bind(aLink2, TopoDS_Edge()); //indicates that one edge represented as two links
FillNode2LLMap(Node1, aLink1, mNode2ListOfLinks);
FillNode2LLMap(Node2, aLink2, mNode2ListOfLinks);
FillNode2LLMap(LastIndV, aLink1, mNode2ListOfLinks);
FillNode2LLMap(LastIndV, aLink2, mNode2ListOfLinks);
BRepFill_TangentLinkInfo* Info1 = mL2TI.Bound(aLink1, BRepFill_TangentLinkInfo());
Info1->myD1F = D1F;
Info1->myD1L = gp_Dir2d(1., 1.);
BRepFill_TangentLinkInfo* Info2 = mL2TI.Bound(aLink2, BRepFill_TangentLinkInfo());
Info2->myD1F = gp_Dir2d(1., 1.);
Info2->myD1L = D1L;
}
}
//DEBUG: print D1F
/*{
NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>::Iterator it(mNode2ListOfLinks);
for (;it.More();it.Next())
{
int nK = it.Key();
Poly_MakeLoops2D::ListOfLink links = it.Value();
Poly_MakeLoops2D::ListOfLink::Iterator itl(links);
cout << "next:" << endl;
for (;itl.More();itl.Next())
{
BRepFill_TangentLinkInfo linfo = mL2TI(itl.Value());
cout << linfo.myD1F.X() << " " << linfo.myD1F.Y() << endl;
TopoDS_Edge eee = mL2E(itl.Value());
}
}
*/
//
BRepFill_PolyHelper helper(mL2TI, mNode2ListOfLinks);
Poly_MakeLoops2D aLoopMaker(1, &helper, NCollection_BaseAllocator::CommonBaseAllocator() );
for (NCollection_DataMap<Poly_MakeLoops2D::Link, TopoDS_Edge>::Iterator aMapIt (mL2E); aMapIt.More(); aMapIt.Next())
aLoopMaker.AddLink(aMapIt.Key());
aLoopMaker.Perform(); //try to find loops
Standard_Integer NbLoops = aLoopMaker.GetNbLoops();
Standard_Integer NbHangs = aLoopMaker.GetNbHanging();
cout << "NbLoops=" << NbLoops << endl;
cout << "NbHangs=" << NbHangs << endl;
// if (NbLoops == 0 || NbHangs != 0 )
// return Standard_False;
theLoops.Append(SelfLoops);
for (Standard_Integer i = 1; i <= NbLoops; i++) //loops to wires
{
Poly_MakeLoops2D::Loop aLoop = aLoopMaker.GetLoop(i);
Poly_MakeLoops2D::Loop::Iterator it(aLoop);
BRepBuilderAPI_MakeWire aWM;
Bnd_Box2d aWBox2d;
TopoDS_Edge E;
for (;it.More(); it.Next())
{
const Poly_MakeLoops2D::Link& Link = it.Value();
E = mL2E(Link);
if (Link.flags & Poly_MakeLoops2D::LF_Reversed)
E.Reverse();
//if null => probably this edge was passed as two links (based on the same edge); so skip this edge
if (!E.IsNull())
{
aWM.Add(E);
aWBox2d.Add(theEdBnd2d(E));
}
}
if (aWM.IsDone())
{
TopoDS_Wire W = aWM.Wire();
if (W.Closed())
{
theLoops.Append(W);
aShToBnd2d.Bind(W, aWBox2d);
}
}
}
//DEBUG
/* Poly_MakeLoops2D::ListOfLink theHLinks;
aLoopMaker.GetHangingLinks(theHLinks);
Poly_MakeLoops2D::ListOfLink::Iterator itt(theHLinks);
TopoDS_Compound cmpH;BRep_Builder().MakeCompound(cmpH);
for (; itt.More();itt.Next())
{
Poly_MakeLoops2D::Link alink = itt.Value();
const Poly_MakeLoops2D::Link& Link = itt.Value();
TopoDS_Edge E = mL2E(Link);
if (Link.flags & Poly_MakeLoops2D::LF_Reversed)
E.Reverse();
//if null => probably this edge was passed as two links (based on the same edge); so skip this edge
if (!E.IsNull())
BRep_Builder().Add(cmpH, E);
}*/
//
IntTools_Context context1;// = new IntTools_Context();
NCollection_List<TopoDS_Wire>::Iterator itL(theLoops);
NCollection_IndexedDataMap<TopoDS_Shape, double> lf1, lf2;
for (; itL.More(); itL.Next())
{
const TopoDS_Wire& aW = itL.Value();
if (aW.IsNull())
continue;
TopoDS_Face ff;
BRep_Builder().MakeFace(ff, BRepLib::Plane(), Precision::Confusion());
//plane is static; pcurves of edges are already based on this plane
BRep_Builder().Add(ff, aW);
aShToBnd2d(aW).Enlarge(0.001);
aShToBnd2d.Bind(ff, aShToBnd2d(aW)); //bndbox still the same
GProp_GProps pr;
BRepGProp::SurfaceProperties(ff, pr);
Standard_Real CurMass = pr.Mass();
if (Abs(CurMass) < 1e-10) //?? TODO
continue;
if (CurMass >= 0)
lf1.Add(ff, CurMass);
else
lf2.Add(ff, CurMass);
}
NCollection_IndexedDataMap<TopoDS_Face, NCollection_List<TopoDS_Face>> FaceToIntWires;
for (int i = 1; i <= lf1.Size() && !lf2.IsEmpty(); i++)
{
//NCollection_Handle<BRepTopAdaptor_FClass2d> fclass;
NCollection_Sequence<TopoDS_Face> intf;
const TopoDS_Face& ff1 = TopoDS::Face(lf1.FindKey(i));
for (int j=1;j<= lf2.Size();j++)
{
double pm = lf1.FindFromIndex(i);
double nm = lf2.FindFromIndex(j);
if (pm < -nm)
continue;
const TopoDS_Face& ff2 = TopoDS::Face(lf2.FindKey(j));
//if (!fclass)
// fclass = new BRepTopAdaptor_FClass2d(ff1, Precision::Confusion());
IntTools_FClass2d& fclass = context1.FClass2d(ff1);
Bnd_Box2d fbnd = aShToBnd2d(ff1);
TopAbs_State st = GetStateOfSamplePoint(ff2, fclass, fbnd);
if (st == TopAbs_IN)
intf.Append(ff2);
}
NCollection_Map<int> intfInd;
for (int i = 1; i<= intf.Size();i++)
{
if (intfInd.Contains(i))
continue;
//BRepTopAdaptor_FClass2d fclassInt(intf(i), Precision::Confusion());
IntTools_FClass2d& fclassInt = context1.FClass2d(intf(i));
Bnd_Box2d fbndi = aShToBnd2d(intf(i));
for (int j=1; j<= intf.Size();j++)
{
if (i==j)
continue;
if (intfInd.Contains(j))
continue;
TopAbs_State st = GetStateOfSamplePoint(intf(j), fclassInt, fbndi);
if (st == TopAbs_OUT) //note that intf-faces are holes
intfInd.Add(j);
}
}
FaceToIntWires.Add(ff1, NCollection_List<TopoDS_Face>());
NCollection_List<TopoDS_Face>& nl = FaceToIntWires.ChangeFromKey(ff1);
for (int i = 1; i<= intf.Size();i++)
{
if (intfInd.Contains(i))
continue;
nl.Append(intf(i));
}
}
TopoDS_Compound aResCmp;
BRep_Builder().MakeCompound(aResCmp);
TopTools_ListIteratorOfListOfShape itOrS(anOrigShapes);
TopTools_IndexedMapOfShape anOrigFaces;
for (;itOrS.More();itOrS.Next())
TopExp::MapShapes(itOrS.Value(), TopAbs_FACE, anOrigFaces);
NCollection_UBTree <Standard_Integer, Bnd_Box> aTreeFL;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFillerFL (aTreeFL);
for (Standard_Integer i = 1; i <= anOrigFaces.Extent(); i++)
{
const TopoDS_Face& aF = TopoDS::Face(anOrigFaces(i));
Bnd_Box aBB;
BRepBndLib::Add(aF, aBB);
aTreeFillerFL.Add(i, aBB);
}
aTreeFillerFL.Fill();
HLRFL_BndBoxTreeSelector aSelFL(anOrigFaces, theMode);
for (int i = 1; i <= FaceToIntWires.Extent(); i++)
{
TopoDS_Face cf = FaceToIntWires.FindKey(i);
NCollection_List<TopoDS_Face>::Iterator it(FaceToIntWires.FindFromIndex(i));
for (;it.More();it.Next())
{
TopoDS_Face ff = it.Value();
TopoDS_Iterator it(ff);
TopoDS_Shape int_wire = it.Value();
BRep_Builder().Add(cf, int_wire);
}
gp_Pnt2d p2d;
gp_Pnt p3d;
TopExp_Explorer exp(cf, TopAbs_EDGE);
Handle(IntTools_Context) context = new IntTools_Context();
BOPTools_AlgoTools3D::PointNearEdge( TopoDS::Edge(exp.Current()), cf, p2d, p3d, context);
gp_Lin shot_line = projector.Shoot(p2d.X(), p2d.Y());
aSelFL.ResetResult();
aSelFL.SetLine( shot_line );
aTreeFL.Select(aSelFL);
std::vector<HLRFL_BndBoxTreeSelector::FaceParam> fp = aSelFL.GetRParams();
if (!fp.empty())
{
BRep_Builder().Add(aResCmp, cf);
if (theMode)
{
std::sort(fp.begin(), fp.end(), HLRBRep_ParComp);
OrigFaceToProjFace.Bind(cf, fp.front().myF);
}
}
}
//
return aResCmp;
}
TopoDS_Shape HLRBRep_HLRToShape::CompoundOfFaces(bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace)
{
//
TopTools_ListOfShape anOrigShapes;
const HLRBRep_SeqOfShapeBounds& aSeqOfShBnds = myAlgo->SeqOfShapeBounds();
for (int i=1; i<= aSeqOfShBnds.Size(); i++)
anOrigShapes.Append(aSeqOfShBnds(i).Shape()->OriginalShape());
//
TopoDS_Compound aTotalOSh;
BRep_Builder BB;
BB.MakeCompound(aTotalOSh);
TopoDS_Shape aSharpSh = InternalCompound(HLRBRep_Sharp, Standard_True, TopoDS_Shape(), Standard_False); //TODO check
if (!aSharpSh.IsNull())
BB.Add(aTotalOSh, aSharpSh);
TopoDS_Shape anOutLSh = InternalCompound(HLRBRep_OutLine, Standard_True, TopoDS_Shape(), Standard_False);
if (!anOutLSh.IsNull())
BB.Add(aTotalOSh, anOutLSh);
TopoDS_Shape aRg1Sh = InternalCompound(HLRBRep_Rg1Line, Standard_True, TopoDS_Shape(), Standard_False);
if (!aRg1Sh.IsNull())
BB.Add(aTotalOSh, aRg1Sh);
//
BRepLib::BuildCurves3d(aTotalOSh);
BRepLib::SameParameter(aTotalOSh, Precision::PConfusion(),Standard_False);
//
if( !FuseVE (aTotalOSh))
return TopoDS_Shape();
//
NCollection_DataMap<TopoDS_Edge, Bnd_Box2d, TopTools_ShapeMapHasher> theEdBnd2d;
NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher> anEdAd;
ProcessHVertices(aTotalOSh, anEdAd, theEdBnd2d);
//
TopoDS_Shape aRes = ProcessLoops(aTotalOSh, anEdAd, theEdBnd2d,
myAlgo->Projector(), anOrigShapes, theMode, OrigFaceToProjFace);
//
return aRes;
}

View File

@@ -25,7 +25,6 @@
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <HLRBRep_TypeOfResultingEdge.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
class HLRBRep_Algo;
class TopoDS_Shape;
class HLRBRep_Data;
@@ -132,8 +131,6 @@ public:
const Standard_Boolean visible,
const Standard_Boolean In3d);
TopoDS_Shape CompoundOfFaces (bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace);
protected:

View File

@@ -39,7 +39,6 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <OSD_Parallel.hxx>
//=======================================================================
// Function : Load
@@ -174,7 +173,7 @@ HLRBRep_ShapeToHLR::Load(const Handle(HLRTopoBRep_OutLiner)& S,
void
HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
Handle(HLRBRep_Data)& DS,
const Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM,
Standard_Integer& i,
@@ -194,7 +193,7 @@ HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next())
nw++;
fd.Set (theFace, orient, closed, nw, Standard_False);
fd.Set (theFace, orient, closed, nw);
nw = 0;
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next()) {
@@ -235,47 +234,15 @@ HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
//purpose :
//=======================================================================
class ParallelSurfInitFunctor
{
public:
ParallelSurfInitFunctor(HLRBRep_Array1OfFData& theFaceDataArr, const TopTools_IndexedMapOfShape& theFM)
: myFaceDataArr (theFaceDataArr), myFM (theFM)
{
}
void operator() (const Standard_Integer theIndex) const
{
const TopoDS_Face& aF = TopoDS::Face(myFM(theIndex));
HLRBRep_FaceData& fd = myFaceDataArr.ChangeValue(theIndex);
fd.Geometry().Surface( TopoDS::Face(aF.Oriented (TopAbs_FORWARD)));
}
private:
ParallelSurfInitFunctor( const ParallelSurfInitFunctor& );
ParallelSurfInitFunctor& operator =( ParallelSurfInitFunctor& );
private:
HLRBRep_Array1OfFData& myFaceDataArr;
const TopTools_IndexedMapOfShape& myFM;
};
void
HLRBRep_ShapeToHLR::ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S,
Handle(HLRBRep_Data)& DS,
const Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM)
{
TopTools_MapOfShape ShapeMap;
TopExp_Explorer exshell, exface, exedge;
Standard_Integer i = 1;
ParallelSurfInitFunctor aSurfFunctor(DS->FDataArray(), FM);
OSD_Parallel::For(1, FM.Extent() + 1, aSurfFunctor, Standard_False);
i = 0;
Standard_Integer i = 0;
for (exshell.Init (S->OriginalShape(), TopAbs_SHELL);
exshell.More ();
@@ -309,7 +276,7 @@ HLRBRep_ShapeToHLR::ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S,
delete [] flag;
flag = NULL;
}
for (exface.Init(exshell.Current(), TopAbs_FACE);
exface.More();
exface.Next()) {

View File

@@ -57,9 +57,9 @@ protected:
private:
Standard_EXPORT static void ExploreFace (const Handle(HLRTopoBRep_OutLiner)& S, Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM, Standard_Integer& i, const TopoDS_Face& F, const Standard_Boolean closed);
Standard_EXPORT static void ExploreFace (const Handle(HLRTopoBRep_OutLiner)& S, const Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM, Standard_Integer& i, const TopoDS_Face& F, const Standard_Boolean closed);
Standard_EXPORT static void ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S, Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM);
Standard_EXPORT static void ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S, const Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM);

View File

@@ -62,109 +62,14 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <HLRAlgo_Projector.hxx>
#include <Adaptor3d_HSurface.hxx>
#include <NCollection_Handle.hxx>
#include <BRepAdaptor_HSurface.hxx>
#include <OSD_Parallel.hxx>
#include <math_FunctionSetRoot.hxx>
#include <Adaptor3d_HSurfaceTool.hxx>
#include <NCollection_List.hxx>
struct ContourSurfInfo
{
ContourSurfInfo() : myDomain(NULL), mySurface(NULL)
{};
ContourSurfInfo(NCollection_Handle<Contap_Contour> theHFO,
const Handle(BRepTopAdaptor_TopolTool)& theDomain,
const Handle(Adaptor3d_HSurface) theSurface) :
myHFO(theHFO), myDomain (theDomain.get()), mySurface (theSurface.get())
{};
ContourSurfInfo& operator=( const ContourSurfInfo& otherSurfInfo)
{
myHFO = otherSurfInfo.myHFO;
myDomain = otherSurfInfo.myDomain;
mySurface = otherSurfInfo.mySurface;
return *this;
};
NCollection_Handle<Contap_Contour> myHFO;
const BRepTopAdaptor_TopolTool* myDomain;
const Adaptor3d_HSurface* mySurface;
};
struct BRTInfo
{
BRTInfo()
{};
BRTInfo(BRepTopAdaptor_Tool* thepBRT, ContourSurfInfo* theCSI, const TopoDS_Face& theF )
: mypBRT (thepBRT), myCSI (theCSI), myF (theF)
{};
BRepTopAdaptor_Tool* mypBRT;
ContourSurfInfo* myCSI;
TopoDS_Face myF;
};
class ParallelContourFunctor
{
public:
ParallelContourFunctor(NCollection_Array1<ContourSurfInfo>& theContourSurfInfo)
: myContourSurfInfo (theContourSurfInfo)
{
}
void operator() (const Standard_Integer theIndex) const
{
ContourSurfInfo& aCSInfo = myContourSurfInfo(theIndex);
aCSInfo.myHFO->Perform(aCSInfo.mySurface, aCSInfo.myDomain);
}
private:
ParallelContourFunctor( const ParallelContourFunctor& );
ParallelContourFunctor& operator =( ParallelContourFunctor& );
private:
NCollection_Array1<ContourSurfInfo>& myContourSurfInfo;
};
class ParallelBRTInitFunctor
{
public:
ParallelBRTInitFunctor(NCollection_Array1<BRTInfo>& theBRTInfo)
: myBRTInfo (theBRTInfo)
{
}
void operator() (const Standard_Integer theIndex) const
{
BRTInfo& BI = myBRTInfo(theIndex);
BI.mypBRT->Init(BI.myF,Precision::PConfusion());
BI.myCSI->myDomain = BI.mypBRT->GetTopolTool().get();
BI.myCSI->mySurface = BI.mypBRT->GetSurface().get();
}
private:
ParallelBRTInitFunctor( const ParallelBRTInitFunctor& );
ParallelBRTInitFunctor& operator =( ParallelBRTInitFunctor& );
private:
NCollection_Array1<BRTInfo>& myBRTInfo;
};
//=======================================================================
//function : Insert
//purpose : explore the faces and insert them
//=======================================================================
void HLRTopoBRep_DSFiller::Insert (const TopoDS_Shape& S,
const HLRAlgo_Projector& P,
const gp_Vec& Vecz,
Contap_Contour& FO,
HLRTopoBRep_Data& DS,
BRepTopAdaptor_MapOfShapeTool& MST,
const Standard_Integer nbIso)
@@ -173,135 +78,38 @@ void HLRTopoBRep_DSFiller::Insert (const TopoDS_Shape& S,
TopExp_Explorer ex(S,TopAbs_FACE);
DS.Clear();
Standard_Boolean withPCurve = Standard_True; // instead of nbIso != 0;
gp_Pnt Eye;
gp_Dir DirZ;
if (P.Perspective ())
Eye.SetXYZ (P.Focus ()*Vecz.XYZ ());
else
DirZ = Vecz;
NCollection_List<ContourSurfInfo> ContourSurfInfoList;
NCollection_List<BRTInfo> nonInitBRTs;
while (ex.More())
{
if (ShapeMap.Add(ex.Current()))
{
Standard_Integer f = 0;
while (ex.More()) {
if (ShapeMap.Add(ex.Current())) {
f++;
TopoDS_Face S1 = TopoDS::Face(ex.Current());
S1.Orientation(TopAbs_FORWARD);
//
NCollection_Handle<Contap_Contour> HFO = new Contap_Contour();
if (P.Perspective ())
HFO->Init(Eye);
else
HFO->Init(DirZ);
//
BRepTopAdaptor_Tool* pBRT = MST.ChangeSeek(S1);
if(pBRT)
{
ContourSurfInfo CSInfo(HFO, pBRT->GetTopolTool(), pBRT->GetSurface());
ContourSurfInfoList.Append(CSInfo);
Handle(BRepTopAdaptor_TopolTool) Domain;
Handle(Adaptor3d_HSurface) Surface;
if(MST.IsBound(S1)) {
BRepTopAdaptor_Tool& BRT = MST.ChangeFind(S1);
Domain = BRT.GetTopolTool();
Surface = BRT.GetSurface();
}
else
{
pBRT = MST.Bound(S1,BRepTopAdaptor_Tool());
BRTInfo& brtI = nonInitBRTs.Append(BRTInfo());
brtI.mypBRT = pBRT;
brtI.myCSI = &ContourSurfInfoList.Append(ContourSurfInfo(HFO, NULL, NULL));
brtI.myF = S1;
else {
BRepTopAdaptor_Tool BRT(S1,Precision::PConfusion());
MST.Bind(S1,BRT);
Domain = BRT.GetTopolTool();
Surface = BRT.GetSurface();
}
FO.Perform(Surface, Domain);
if (FO.IsDone()) {
if (!FO.IsEmpty())
InsertFace(f,S1,FO,DS,withPCurve);
}
if (nbIso != 0) HLRTopoBRep_FaceIsoLiner::Perform(f,S1,DS,nbIso);
}
ex.Next();
}
//
NCollection_List<BRTInfo>::Iterator itBRTIt(nonInitBRTs);
NCollection_Array1<BRTInfo> nonInitBRTArr(1, nonInitBRTs.Extent());
Standard_Integer f = 1;
for (;itBRTIt.More();itBRTIt.Next(), f++)
nonInitBRTArr(f) = itBRTIt.Value();
ParallelBRTInitFunctor aBRTFunctor(nonInitBRTArr);
OSD_Parallel::For(nonInitBRTArr.Lower(), nonInitBRTArr.Upper() + 1, aBRTFunctor, Standard_False);
//
NCollection_List<ContourSurfInfo>::Iterator itCS(ContourSurfInfoList);
int nbC = ContourSurfInfoList.Extent();
f = 1;
NCollection_Array1<ContourSurfInfo> aContourSurfInfoArray(1, nbC);
for (;itCS.More();itCS.Next(), f++)
aContourSurfInfoArray(f) = itCS.Value();
//
ParallelContourFunctor aContourFunctor(aContourSurfInfoArray);
OSD_Parallel::For(aContourSurfInfoArray.Lower(), aContourSurfInfoArray.Upper() + 1, aContourFunctor, Standard_False);
//
for (f = aContourSurfInfoArray.Lower(); f <= aContourSurfInfoArray.Upper(); f++)
{
ContourSurfInfo& CSInfo = aContourSurfInfoArray(f);
Handle(BRepAdaptor_HSurface) BrepSurf = Handle(BRepAdaptor_HSurface)::DownCast(CSInfo.mySurface);
const TopoDS_Face& S1 = BrepSurf->ChangeSurface().Face();
if (CSInfo.myHFO->IsDone())
if (!CSInfo.myHFO->IsEmpty())
InsertFace(f,S1,*CSInfo.myHFO, CSInfo.myDomain, DS,withPCurve);
if (nbIso != 0)
HLRTopoBRep_FaceIsoLiner::Perform(f,S1,DS,nbIso);
}
//
ProcessEdges(DS);
}
static void GetSurfInfo(const Handle(Adaptor3d_HSurface)& Surf, math_Vector& tol,
math_Vector& inf, math_Vector& sup)
{
tol(1) = Adaptor3d_HSurfaceTool::UResolution(Surf,Precision::Confusion());
tol(2) = Adaptor3d_HSurfaceTool::VResolution(Surf,Precision::Confusion());
inf(1) = Adaptor3d_HSurfaceTool::FirstUParameter(Surf);
inf(2) = Adaptor3d_HSurfaceTool::FirstVParameter(Surf);
sup(1) = Adaptor3d_HSurfaceTool::LastUParameter(Surf);
sup(2) = Adaptor3d_HSurfaceTool::LastVParameter(Surf);
}
//=======================================================================
//function : ClarifyPoint
//purpose : p2d - point to clarify, p2d corresponds to the clarifying 2d point on surface Surf
//=======================================================================
static bool ClarifyPoint(math_FunctionSetRoot& rsnld, Contap_SurfFunction& SFunc,
const BRepTopAdaptor_TopolTool* Domain, math_Vector& inf, math_Vector& sup,
gp_Pnt2d& P2d, gp_Pnt& p3d)
{
math_Vector StartP(1,2);
StartP.Value(1) = P2d.X() ;
StartP.Value(2) = P2d.Y();
rsnld.Perform(SFunc,StartP,inf,sup);
if (rsnld.IsDone())
{
math_Vector Sol(1,2);
math_Vector F(1,1);
rsnld.Root(Sol);
SFunc.Value(Sol,F);
if (Abs(F(1)) <= SFunc.Tolerance())
{
P2d.SetCoord(Sol(1), Sol(2));
TopAbs_State state = const_cast<BRepTopAdaptor_TopolTool*>(Domain)
->Classify(P2d,Precision::PConfusion());
if (state == TopAbs_IN || state == TopAbs_ON)
{
const Handle(Adaptor3d_HSurface)& Surf = SFunc.Surface();
p3d = Adaptor3d_HSurfaceTool::Value(Surf,P2d.X(),P2d.Y());
return true;
}
}
}
return false;
}
//=======================================================================
//function : InsertFace
//purpose : private, insert the outlines of a face
@@ -309,7 +117,7 @@ static bool ClarifyPoint(math_FunctionSetRoot& rsnld, Contap_SurfFunction& SFunc
void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
const TopoDS_Face& F,
Contap_Contour& FO, const BRepTopAdaptor_TopolTool* Domain,
Contap_Contour& FO,
HLRTopoBRep_Data& DS,
const Standard_Boolean withPCurve)
{
@@ -531,8 +339,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
Maxx=Maxy=Maxz=Maxu=Maxv=-RealLast();
Minx=Miny=Minz=Minu=Minv=RealLast();
for(Standard_Integer i=1;i<=nbp;i++)
{
for(Standard_Integer i=1;i<=nbp;i++) {
knots.SetValue(i,(Standard_Real)i);
mults.SetValue(i,1);
const gp_Pnt& P= Line.Point(i+ipF-1).Value();
@@ -545,30 +352,29 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
Points.SetValue(i,P);
}
mults(1)=mults(nbp)=2;
//Handle(Geom_BSplineCurve) AppC;
//Handle(Geom2d_BSplineCurve) AppC2d;
//AppC = new Geom_BSplineCurve(Points,knots,mults,1);
Handle(Geom_BSplineCurve) AppC;
Handle(Geom2d_BSplineCurve) AppC2d;
AppC = new Geom_BSplineCurve(Points,knots,mults,1);
TColgp_Array1OfPnt2d Points2d(1,nbp);
for(Standard_Integer i=1;i<=nbp;i++)
{
Standard_Real u,v;
Line.Point(i+ipF-1).ParametersOnS2(u,v);
if(u<Minu) Minu=u;
if(v<Minv) Minv=v;
if(u>Maxu) Maxu=u;
if(v>Maxv) Maxv=v;
Points2d.SetValue(i,gp_Pnt2d(u,v));
if(withPCurve) {
TColgp_Array1OfPnt2d Points2d(1,nbp);
for(Standard_Integer i=1;i<=nbp;i++) {
Standard_Real u,v;
Line.Point(i+ipF-1).ParametersOnS2(u,v);
if(u<Minu) Minu=u;
if(v<Minv) Minv=v;
if(u>Maxu) Maxu=u;
if(v>Maxv) Maxv=v;
Points2d.SetValue(i,gp_Pnt2d(u,v));
}
AppC2d = new Geom2d_BSplineCurve(Points2d,knots,mults,1);
}
//AppC2d = new Geom2d_BSplineCurve(Points2d,knots,mults,1);
first = 1;
last = nbp;
//Handle(BRepApprox_ApproxLine) AppLine;
Handle(BRepApprox_ApproxLine) AppLine;
Handle(Geom2d_BSplineCurve) CNull;
//AppLine = new BRepApprox_ApproxLine(AppC,AppC2d,CNull);
AppLine = new BRepApprox_ApproxLine(AppC,AppC2d,CNull);
Standard_Integer dmin=4,dmax=8,niter=0;
Standard_Boolean tg= Standard_False;
@@ -583,140 +389,14 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
TOL3d=TOL*Maxx; if(TOL3d<1e-12) TOL3d=1e-12; else if(TOL3d>0.1) TOL3d=0.1;
TOL2d=TOL*Maxu; if(TOL2d<1e-12) TOL2d=1e-12; else if(TOL2d>0.1) TOL2d=0.1;
Contap_SurfFunction& SFunc = FO.SurfaceFunction();
const Handle(Adaptor3d_HSurface)& Surf = SFunc.Surface();
double cmax = 2.0;
double c = 100;
int newsize;
NCollection_List<gp_Pnt2d> lp2d;
NCollection_List<gp_Pnt> lp;
lp2d.Append(Points2d.First());
lp.Append(Points.First());
for (int jj=2; jj < Points.Size(); jj++ )
{
gp_Pnt curPnt = Points(jj);
gp_Pnt2d curPnt2d = Points2d(jj);
double d3_1 = lp.Last().Distance(curPnt);
double d3_2 = curPnt.Distance(Points(jj+1));
double d1 = lp2d.Last().Distance(Points2d(jj));
double d2 = Points2d(jj).Distance(Points2d(jj+1));
double x0 = curPnt2d.X();
double y0 = curPnt2d.Y();
double coeff = d3_1/d3_2;
c = 1.4;
if (coeff > cmax)
{
//left is wider
double t = 1;
double x1 = lp2d.Last().X();
double y1 = lp2d.Last().Y();
NCollection_List<gp_Pnt2d> dp;
NCollection_List<gp_Pnt> dp3d;
math_Vector tol(1,2), inf(1,2), sup(1,2);
GetSurfInfo(Surf, tol, inf, sup);
math_FunctionSetRoot rsnld(SFunc,tol,50);
for (;;)
{
t = 1 - d2/d1*c;
if (t <= 0)
break;
gp_Pnt2d pnt;
double Xt = x0 + (x1-x0)*t;
double Yt = y0 + (y1-y0)*t;
c=c*c;
gp_Pnt2d draft2d(Xt, Yt);
gp_Pnt draft3d;
//
if (ClarifyPoint(rsnld, SFunc, Domain, inf, sup, draft2d, draft3d))
{
lp2d.Append(dp);
lp.Append(dp3d);
}
}
//
lp2d.Append(curPnt2d);
lp.Append(curPnt);
}
else if (1/coeff > cmax )
{
//right is wider
double t = 0;
lp2d.Append(curPnt2d);
lp.Append(curPnt);
double x1 = Points2d(jj+1).X();
double y1 = Points2d(jj+1).Y();
math_Vector tol(1,2), inf(1,2), sup(1,2);
GetSurfInfo(Surf, tol, inf, sup);
math_FunctionSetRoot rsnld(SFunc,tol,50);
for (;;)
{
t = d1/d2*c;
if (t >= 1)
break;
gp_Pnt2d pnt;
double Xt = x0 + (x1-x0)*t;
double Yt = y0 + (y1-y0)*t;
c=c*c;
gp_Pnt2d draft2d(Xt, Yt);
gp_Pnt draft3d;
//
if (ClarifyPoint(rsnld, SFunc, Domain, inf, sup, draft2d, draft3d))
{
lp.Append(draft3d);
lp2d.Append(draft2d);
}
}
}
else
{
lp2d.Append(curPnt2d);
lp.Append(curPnt);
}
}
lp2d.Append(Points2d.Last());
lp.Append(Points.Last());
//
newsize = lp.Size();
TColgp_Array1OfPnt2d newPoints2dA(1,newsize);
TColgp_Array1OfPnt newPoints3dA(1,newsize);
TColStd_Array1OfReal nknots(1,newsize);
TColStd_Array1OfInteger nmults(1,newsize);
NCollection_List<gp_Pnt>::Iterator itl(lp);
NCollection_List<gp_Pnt2d>::Iterator itl2(lp2d);
for (int jj = 1;itl.More(), itl2.More();itl.Next(), itl2.Next(), jj++)
{
nknots.SetValue(jj,(Standard_Real)jj);
nmults.SetValue(jj,1);
newPoints2dA.SetValue(jj, itl2.Value());
newPoints3dA.SetValue(jj, itl.Value());
}
nmults(1)=nmults(newsize)=2;
Handle_BRepApprox_ApproxLine nAppLine ;
Handle(Geom_BSplineCurve) nAppC =
new Geom_BSplineCurve(newPoints3dA,nknots,nmults,1);
Handle(Geom2d_BSplineCurve) nAppC2d=
new Geom2d_BSplineCurve(newPoints2dA,nknots,nmults,1);
nAppLine = new BRepApprox_ApproxLine(nAppC,nAppC2d,CNull);
//AppC2d = new Geom2d_BSplineCurve(Points2d,knots,mults,1);
//-- cout<<"\nHLRTopoBRep_DSFiller : nbp="<<nbp<<" Tol3d="<<TOL3d<<" Tol2d="<<TOL2d<<endl;
Approx.SetParameters(TOL3d, TOL2d, dmin, dmax, niter, 30, tg);
Approx.Perform(nAppLine,Standard_True,Standard_True,Standard_False,1,newsize/*nbp*/);
Approx.Perform(AppLine,Standard_True,Standard_True,Standard_False,1,nbp);
if (!Approx.IsDone()) {
C = nAppC;
C2d=nAppC2d;
C = AppC;
C2d=AppC2d;
first = 1;
last = nbp;
}

View File

@@ -32,7 +32,6 @@ class TopoDS_Face;
class TopoDS_Vertex;
class Contap_Point;
class TopoDS_Edge;
class HLRAlgo_Projector;
//! Provides methods to fill a HLRTopoBRep_Data.
@@ -45,7 +44,7 @@ public:
//! Stores in <DS> the outlines of <S> using the current
//! outliner and stores the isolines in <DS> using a Hatcher.
Standard_EXPORT static void Insert (const TopoDS_Shape& S,const HLRAlgo_Projector& P, const gp_Vec& Vecz, HLRTopoBRep_Data& DS, BRepTopAdaptor_MapOfShapeTool& MST, const Standard_Integer nbIso);
Standard_EXPORT static void Insert (const TopoDS_Shape& S, Contap_Contour& FO, HLRTopoBRep_Data& DS, BRepTopAdaptor_MapOfShapeTool& MST, const Standard_Integer nbIso);
@@ -61,8 +60,7 @@ private:
//! Stores in <DS> the outlines of <F> using the current
//! outliner.
Standard_EXPORT static void InsertFace (const Standard_Integer FI, const TopoDS_Face& F, Contap_Contour& FO,
const BRepTopAdaptor_TopolTool* Domain, HLRTopoBRep_Data& DS, const Standard_Boolean withPCurve);
Standard_EXPORT static void InsertFace (const Standard_Integer FI, const TopoDS_Face& F, Contap_Contour& FO, HLRTopoBRep_Data& DS, const Standard_Boolean withPCurve);
//! Make a vertex from an intersection point <P>and
//! store it in the data structure <DS>.

View File

@@ -82,7 +82,17 @@ void HLRTopoBRep_OutLiner::Fill(const HLRAlgo_Projector& P,
gp_Trsf Tr (P.Transformation ());
Tr.Invert ();
Vecz.Transform (Tr);
HLRTopoBRep_DSFiller::Insert(myOriginalShape,P,Vecz,myDS,MST,nbIso);
Contap_Contour FO;
if (P.Perspective ()) {
gp_Pnt Eye;
Eye.SetXYZ (P.Focus ()*Vecz.XYZ ());
FO.Init(Eye);
}
else {
gp_Dir DirZ(Vecz);
FO.Init(DirZ);
}
HLRTopoBRep_DSFiller::Insert(myOriginalShape,FO,myDS,MST,nbIso);
BuildShape(MST);
}
}

View File

@@ -174,16 +174,26 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
if (nbsu > aMaxSamples) nbsu = aMaxSamples;
if (nbsv > aMaxSamples) nbsv = aMaxSamples;
if (Max(dU, dV) > Min(dU, dV) * aTresh)
{
aMinSamples = 10;
nbsu = (Standard_Integer)(Sqrt(dU / dV) * aMaxSamples);
if (nbsu < aMinSamples) nbsu = aMinSamples;
nbsv = aMaxSamples2 / nbsu;
if (nbsv < aMinSamples)
if (dU > gp::Resolution() && dV > gp::Resolution()) {
if (Max(dU, dV) > Min(dU, dV) * aTresh)
{
nbsv = aMinSamples;
nbsu = aMaxSamples2 / aMinSamples;
aMinSamples = 10;
nbsu = (Standard_Integer)(Sqrt(dU / dV) * aMaxSamples);
if (nbsu < aMinSamples) nbsu = aMinSamples;
nbsv = aMaxSamples2 / nbsu;
if (nbsv < aMinSamples)
{
nbsv = aMinSamples;
nbsu = aMaxSamples2 / aMinSamples;
}
}
}
else {
if (dU < gp::Resolution()) {
nbsu = 1;
}
if (dV < gp::Resolution()) {
nbsv = 1;
}
}

View File

@@ -1371,18 +1371,17 @@ Standard_Real ResolutionCoeff(const BRepAdaptor_Curve& theBAC,
case GeomAbs_OffsetCurve : {
const Handle(Geom_OffsetCurve)& anOffsetCurve = Handle(Geom_OffsetCurve)::DownCast(aCurve);
const Handle(Geom_Curve)& aBasisCurve = anOffsetCurve->BasisCurve();
const GeomAbs_CurveType aBCType = GeomAdaptor_Curve(aBasisCurve).GetType();
GeomAdaptor_Curve aGBasisCurve(aBasisCurve);
const GeomAbs_CurveType aBCType = aGBasisCurve.GetType();
if (aBCType == GeomAbs_Line) {
break;
}
else if (aBCType == GeomAbs_Circle) {
aResCoeff = 1. / (2 * (anOffsetCurve->Offset() +
Handle(Geom_Circle)::DownCast (aBasisCurve)->Circ().Radius()));
aResCoeff = 1. / (2 * (anOffsetCurve->Offset() + aGBasisCurve.Circle().Radius()));
break;
}
else if (aBCType == GeomAbs_Ellipse) {
aResCoeff = 1. / (anOffsetCurve->Offset() +
Handle(Geom_Ellipse)::DownCast (aBasisCurve)->MajorRadius());
aResCoeff = 1. / (anOffsetCurve->Offset() + aGBasisCurve.Ellipse().MajorRadius());
break;
}
}

View File

@@ -212,7 +212,18 @@ public:
myDeletable (Standard_False)
{
Standard_RangeError_Raise_if (theUpper < theLower, "NCollection_Array1::Create");
myData = (TheItemType *) &theBegin - theLower;
#if (defined(__GNUC__) && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
// gcc emits -Warray-bounds warning when NCollection_Array1 is initialized
// from local array with lower index 1 (so that (&theBegin - 1) points out of array bounds).
// NCollection_Array1 initializes myData with a shift to avoid this shift within per-element access.
// It is undesired changing this logic, and -Warray-bounds is not useful here.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
myData = (TheItemType *) &theBegin - theLower;
#if (defined(__GNUC__) && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#pragma GCC diagnostic pop
#endif
}
//! Initialise the items with theValue

View File

@@ -223,12 +223,14 @@ public:
Standard_EXPORT virtual void UnsetAttributes();
//! Returns the hilight attributes settings.
//! When not NULL, overrides both Prs3d_TypeOfHighlight_LocalSelected and Prs3d_TypeOfHighlight_Selected defined within AIS_InteractiveContext.
const Handle(Prs3d_Drawer)& HilightAttributes() const { return myHilightDrawer; }
//! Initializes the hilight drawing tool theDrawer.
virtual void SetHilightAttributes(const Handle(Prs3d_Drawer)& theDrawer) { myHilightDrawer = theDrawer; }
//! Returns the hilight attributes settings.
//! When not NULL, overrides both Prs3d_TypeOfHighlight_LocalDynamic and Prs3d_TypeOfHighlight_Dynamic defined within AIS_InteractiveContext.
const Handle(Prs3d_Drawer)& DynamicHilightAttributes() const { return myDynHilightDrawer; }
//! Initializes the dynamic hilight drawing tool.

View File

@@ -1584,7 +1584,6 @@ static Standard_Integer OCC26930(Draw_Interpretor& theDI,
//function : OCC27341
//purpose : check exact HLR algorighm's work
//=======================================================================
#include <OSD_Timer.hxx>
static Standard_Integer OCC27341 (Draw_Interpretor& , Standard_Integer n, const char** a)
{
if (n != 4)
@@ -1644,11 +1643,7 @@ static Standard_Integer OCC27341 (Draw_Interpretor& , Standard_Integer n, const
anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
aDX.X(), aDX.Y(), aDX.Z());
OSD_Timer aTimer;
aTimer.Start();
Reflector.Perform();
aTimer.Stop();
aTimer.Show();
TopoDS_Compound Result;
BRep_Builder BB;
@@ -1663,86 +1658,12 @@ static Standard_Integer OCC27341 (Draw_Interpretor& , Standard_Integer n, const
TopoDS_Shape SmoothEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Rg1Line, Standard_True, Standard_False);
if (!SmoothEdges.IsNull())
BB.Add(Result, SmoothEdges);
DBRep::Set(a[1], Result);
return 0;
}
//=======================================================================
//function : OCC28991
//purpose :
//=======================================================================
static Standard_Integer OCC28991 (Draw_Interpretor& , Standard_Integer n, const char** a)
{
if (n != 4)
{
cout << "Use: OCC28991 res shape axo/top/bottom/front/back/left/right" << endl;
return 1;
}
TopoDS_Shape aShape = DBRep::Get(a[2]);
if (aShape.IsNull())
return 1;
gp_Pnt anOrigin(0.,0.,0.);
gp_Dir aNormal(0.57735026918962573, -0.57735026918962573, 0.57735026918962573);
gp_Ax2 anAxes(anOrigin, aNormal);
gp_Dir aDX = anAxes.XDirection();
HLRAppli_ReflectLines Reflector(aShape);
if (strcmp(a[3],"axo") == 0)
{
aNormal.SetCoord(0.57735026918962573, -0.57735026918962573, 0.57735026918962573);
aDX.SetCoord(-0.40824829046386307, 0.40824829046386307, 0.81649658092772615);
}
else if (strcmp(a[3],"top") == 0)
{
aNormal.SetCoord(0,0,1);
aDX.SetCoord(0,1,0);
}
else if (strcmp(a[3],"bottom") == 0)
{
aNormal.SetCoord(0,0,-1);
aDX.SetCoord(0,-1,0);
}
else if (strcmp(a[3],"front") == 0)
{
aNormal.SetCoord(0,-1,0);
aDX.SetCoord(0,0,1);
}
else if (strcmp(a[3],"back") == 0)
{
aNormal.SetCoord(0,1,0);
aDX.SetCoord(0,0,1);
}
else if (strcmp(a[3],"left") == 0)
{
aNormal.SetCoord(-1,0,0);
aDX.SetCoord(0,0,1);
}
else if (strcmp(a[3],"right") == 0)
{
aNormal.SetCoord(1,0,0);
aDX.SetCoord(0,0,1);
}
Reflector.SetAxes(aNormal.X(), aNormal.Y(), aNormal.Z(),
anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
aDX.X(), aDX.Y(), aDX.Z());
Reflector.Perform();
TopTools_DataMapOfShapeShape aDummy;
TopoDS_Shape aFaces = Reflector.GetCompoundOfFaces(true, aDummy);
DBRep::Set(a[1], aFaces);
return 0;
}
//=======================================================================
//function : OCC27466
//purpose :
@@ -2526,9 +2447,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
theCommands.Add("OCC27341",
"OCC27341 res shape axo/top/bottom/front/back/left/right",
__FILE__, OCC27341, group);
theCommands.Add("OCC28991",
"OCC289911 res shape axo/top/bottom/front/back/left/right",
__FILE__, OCC28991, group);
theCommands.Add ("OCC26747_1", "OCC26747_1 result", __FILE__, OCC26747_1, group);
theCommands.Add ("OCC26747_2", "OCC26747_2 result", __FILE__, OCC26747_2, group);
theCommands.Add ("OCC26747_3", "OCC26747_3 result", __FILE__, OCC26747_3, group);

View File

@@ -80,6 +80,9 @@ namespace
//! Creates Poly_Triangulation from collected data
Handle(Poly_Triangulation) GetTriangulation()
{
if (myTriangles.IsEmpty())
return Handle(Poly_Triangulation)();
Handle(Poly_Triangulation) aPoly = new Poly_Triangulation (myNodes.Length(), myTriangles.Length(), Standard_False);
for (Standard_Integer aNodeIter = 0; aNodeIter < myNodes.Size(); ++aNodeIter)
{
@@ -109,10 +112,9 @@ Handle(Poly_Triangulation) RWStl::ReadFile (const Standard_CString theFile,
const Handle(Message_ProgressIndicator)& theProgress)
{
Reader aReader;
if (!aReader.Read (theFile, theProgress))
{
return Handle(Poly_Triangulation)();
}
aReader.Read (theFile, theProgress);
// note that returned bool value is ignored intentionally -- even if something went wrong,
// but some data have been read, we at least will return these data
return aReader.GetTriangulation();
}
@@ -209,10 +211,15 @@ Handle(Poly_Triangulation) RWStl::ReadAscii (const OSD_Path& theFile,
//function : Write
//purpose :
//=============================================================================
Standard_Boolean RWStl::WriteBinary (const Handle(Poly_Triangulation)& aMesh,
Standard_Boolean RWStl::WriteBinary (const Handle(Poly_Triangulation)& theMesh,
const OSD_Path& thePath,
const Handle(Message_ProgressIndicator)& theProgInd)
{
if (theMesh.IsNull() || theMesh->NbTriangles() <= 0)
{
return Standard_False;
}
TCollection_AsciiString aPath;
thePath.SystemName (aPath);
@@ -222,7 +229,7 @@ Standard_Boolean RWStl::WriteBinary (const Handle(Poly_Triangulation)& aMesh,
return Standard_False;
}
Standard_Boolean isOK = writeBinary (aMesh, aFile, theProgInd);
Standard_Boolean isOK = writeBinary (theMesh, aFile, theProgInd);
fclose (aFile);
return isOK;
@@ -236,6 +243,11 @@ Standard_Boolean RWStl::WriteAscii (const Handle(Poly_Triangulation)& theMesh,
const OSD_Path& thePath,
const Handle(Message_ProgressIndicator)& theProgInd)
{
if (theMesh.IsNull() || theMesh->NbTriangles() <= 0)
{
return Standard_False;
}
TCollection_AsciiString aPath;
thePath.SystemName (aPath);

View File

@@ -138,9 +138,15 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
std::streampos theEnd = aStream.tellg();
aStream.seekg (0, aStream.beg);
while (!aStream.eof() && !aStream.bad())
// binary STL files cannot be shorter than 134 bytes
// (80 bytes header + 4 bytes facet count + 50 bytes for one facet);
// thus assume files shorter than 134 as Ascii without probing
// (probing may bring stream to fail state if EOF is reached)
bool isAscii = ((size_t)theEnd < THE_STL_MIN_FILE_SIZE || IsAscii (aStream));
while (aStream.good())
{
if (IsAscii (aStream))
if (isAscii)
{
if (!ReadAscii (aStream, theEnd, theProgress))
{
@@ -156,7 +162,7 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
}
aStream >> std::ws; // skip any white spaces
}
return !aStream.bad();
return ! aStream.fail();
}
//==============================================================================
@@ -169,10 +175,10 @@ Standard_Boolean RWStl_Reader::IsAscii (Standard_IStream& theStream)
// read first 134 bytes to detect file format
char aBuffer[THE_STL_MIN_FILE_SIZE];
std::streamsize aNbRead = theStream.read (aBuffer, THE_STL_MIN_FILE_SIZE).gcount();
if (!theStream)
if (! theStream)
{
Message::DefaultMessenger()->Send ("Error: Cannot read file", Message_Fail);
return false;
return true;
}
// put back the read symbols
@@ -240,7 +246,8 @@ Standard_Boolean RWStl_Reader::ReadAscii (Standard_IStream& theStream,
// use method seekpos() to get true 64-bit offset to enable
// handling of large files (VS 2010 64-bit)
const int64_t aStartPos = GETPOS(theStream.tellg());
const int64_t aEndPos = (theUntilPos > 0 ? GETPOS(theUntilPos) : std::numeric_limits<int64_t>::max());
// Note: 1 is added to theUntilPos to be sure to read the last symbol (relevant for files without EOL at the end)
const int64_t aEndPos = (theUntilPos > 0 ? 1 + GETPOS(theUntilPos) : std::numeric_limits<int64_t>::max());
// skip header "solid ..."
theStream.ignore (aEndPos - aStartPos, '\n');

View File

@@ -47,6 +47,7 @@
#include <StepDimTol_GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_CartesianTransformationOperator3d.hxx>
#include <StepGeom_Direction.hxx>
#include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx>
#include <StepGeom_GeometricRepresentationItem.hxx>
#include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
@@ -823,18 +824,30 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
nsh ++;
}
}
// [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
if (!isManifold) {
Handle(Standard_Transient) info;
// IMPORTANT: any fixing on non-manifold topology must be done after the shape is transferred from STEP
TopoDS_Shape fixedResult =
XSAlgo::AlgoContainer()->ProcessShape( comp, myPrecision, myMaxTol,
"read.step.resource.name",
"read.step.sequence", info,
TP->GetProgress() );
TP->GetProgress(), Standard_True);
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
if (fixedResult.ShapeType() == TopAbs_COMPOUND)
{
comp = TopoDS::Compound(fixedResult);
}
else
{
comp.Nullify();
B.MakeCompound(comp);
B.Add(comp, fixedResult);
}
BRep_Builder brepBuilder;
// [BEGIN] Try to close OPEN Shells in I-DEAS case (ssv; 17.11.2010)
@@ -874,20 +887,19 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
// [BEGIN] Reconstruct Solids from Closed Shells (ssv; 15.11.2010)
TopoDS_Compound reconstComp;
brepBuilder.MakeCompound(reconstComp);
TopoDS_Iterator it(comp);
for ( ; it.More(); it.Next() ) {
TopoDS_Shape aSubShape = it.Value();
if ( aSubShape.ShapeType() == TopAbs_SHELL && aSubShape.Closed() ) {
TopoDS_Solid nextSolid;
brepBuilder.MakeSolid(nextSolid);
brepBuilder.Add(nextSolid, aSubShape);
brepBuilder.Add(reconstComp, nextSolid);
}
else if (aSubShape.ShapeType() == TopAbs_SHELL)
brepBuilder.Add(reconstComp, aSubShape);
TopExp_Explorer exp(comp, TopAbs_SHELL);
for (; exp.More(); exp.Next())
{
TopoDS_Shape aSubShape = exp.Current();
if (aSubShape.ShapeType() == TopAbs_SHELL && aSubShape.Closed()) {
TopoDS_Solid nextSolid;
brepBuilder.MakeSolid(nextSolid);
brepBuilder.Add(nextSolid, aSubShape);
brepBuilder.Add(reconstComp, nextSolid);
}
else if (aSubShape.ShapeType() == TopAbs_SHELL)
brepBuilder.Add(reconstComp, aSubShape);
}
comp = reconstComp;
// [END] Reconstruct Solids from Closed Shells (ssv; 15.11.2010)
}
@@ -896,6 +908,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
if (nsh == 0) shbinder.Nullify();
else if (nsh == 1) shbinder = new TransferBRep_ShapeBinder (OneResult);
else shbinder = new TransferBRep_ShapeBinder (comp);
PrepareUnits ( oldSRContext, TP ); //:S4136
TP->Bind(sr, shbinder);

View File

@@ -378,6 +378,32 @@ Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetSelectPresentation (co
return mySelectionPrs;
}
//=======================================================================
//function : ErasePresentations
//purpose :
//=======================================================================
void SelectMgr_SelectableObject::ErasePresentations (Standard_Boolean theToRemove)
{
if (!mySelectionPrs.IsNull())
{
mySelectionPrs->Erase();
if (theToRemove)
{
mySelectionPrs->Clear();
mySelectionPrs.Nullify();
}
}
if (!myHilightPrs.IsNull())
{
myHilightPrs->Erase();
if (theToRemove)
{
myHilightPrs->Clear();
myHilightPrs.Nullify();
}
}
}
//=======================================================================
//function : SetZLayer
//purpose :

View File

@@ -168,7 +168,10 @@ public:
Standard_EXPORT Handle(Prs3d_Presentation) GetHilightPresentation (const Handle(PrsMgr_PresentationManager3d)& TheMgr);
Standard_EXPORT Handle(Prs3d_Presentation) GetSelectPresentation (const Handle(PrsMgr_PresentationManager3d)& TheMgr);
//! Removes presentations returned by GetHilightPresentation() and GetSelectPresentation().
Standard_EXPORT virtual void ErasePresentations (Standard_Boolean theToRemove);
//! Set Z layer ID and update all presentations of the selectable object.
//! The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers.
Standard_EXPORT virtual void SetZLayer (const Graphic3d_ZLayerId theLayerId) Standard_OVERRIDE;
@@ -219,14 +222,15 @@ protected:
SelectMgr_SequenceOfSelection myselections;
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
Handle(Prs3d_Presentation) mySelectionPrs;
Handle(Prs3d_Presentation) myHilightPrs;
Standard_Boolean myAutoHilight;
private:
Standard_Integer mycurrent;
Handle(Prs3d_Presentation) mySelectionPrs;
Handle(Prs3d_Presentation) myHilightPrs;
Standard_Integer myGlobalSelMode;
};
#endif // _SelectMgr_SelectableObject_HeaderFile

View File

@@ -18,9 +18,10 @@
// purpose :
//=======================================================================
SelectMgr_ToleranceMap::SelectMgr_ToleranceMap()
: myLargestKey (-1),
myCustomTolerance (-1)
{
myLargestKey = -1;
myCustomTolerance = -1;
//
}
//=======================================================================
@@ -38,24 +39,23 @@ SelectMgr_ToleranceMap::~SelectMgr_ToleranceMap()
//=======================================================================
void SelectMgr_ToleranceMap::Add (const Standard_Integer& theTolerance)
{
if (myTolerances.IsBound (theTolerance))
if (Standard_Integer* aFreq = myTolerances.ChangeSeek (theTolerance))
{
Standard_Integer& aFreq = myTolerances.ChangeFind (theTolerance);
aFreq++;
if (aFreq == 1 && theTolerance != myLargestKey)
++(*aFreq);
if (*aFreq == 1 && theTolerance != myLargestKey)
{
myLargestKey = Max (theTolerance, myLargestKey);
}
return;
}
myTolerances.Bind (theTolerance, 1);
if (myTolerances.Extent() == 1)
{
myLargestKey = theTolerance;
}
else
{
if (myTolerances.IsEmpty())
{
myTolerances.Bind (theTolerance, 1);
myLargestKey = theTolerance;
return;
}
myTolerances.Bind (theTolerance, 1);
myLargestKey = Max (theTolerance, myLargestKey);
}
}
@@ -66,18 +66,22 @@ void SelectMgr_ToleranceMap::Add (const Standard_Integer& theTolerance)
//=======================================================================
void SelectMgr_ToleranceMap::Decrement (const Standard_Integer& theTolerance)
{
if (myTolerances.IsBound (theTolerance))
Standard_Integer* aFreq = myTolerances.ChangeSeek (theTolerance);
if (aFreq == NULL)
{
Standard_Integer& aFreq = myTolerances.ChangeFind (theTolerance);
aFreq--;
return;
}
if (Abs (theTolerance - myLargestKey) < Precision::Confusion() && aFreq == 0)
--(*aFreq);
if (theTolerance == myLargestKey
&& *aFreq == 0)
{
myLargestKey = 0;
for (NCollection_DataMap<Standard_Integer, Standard_Integer>::Iterator anIter (myTolerances); anIter.More(); anIter.Next())
{
myLargestKey = 0;
for (NCollection_DataMap<Standard_Integer, Standard_Integer>::Iterator anIter (myTolerances); anIter.More(); anIter.Next())
if (anIter.Value() != 0)
{
if (anIter.Value() != 0)
myLargestKey = Max (myLargestKey, anIter.Key());
myLargestKey = Max (myLargestKey, anIter.Key());
}
}
}

View File

@@ -1070,9 +1070,8 @@ Standard_Boolean ShapeAnalysis_Curve::GetSamplePoints (const Handle(Geom_Curve)&
GeomAdaptor_Curve GAC(curve);
Standard_Real step = ( last - first ) / (Standard_Real)( nbp - 1 );
Standard_Real par = first, stop = last - 0.5 * step;
for ( ; par < stop; par += step )
seq.Append(GAC.Value(par));
for (Standard_Integer i = 0; i < nbp - 1; ++i)
seq.Append(GAC.Value(first + step * i));
seq.Append(GAC.Value(last));
return Standard_True;
}
@@ -1093,9 +1092,8 @@ Standard_Boolean ShapeAnalysis_Curve::GetSamplePoints (const Handle(Geom2d_Curve
//-- Attention aux bsplines rationnelles de degree 3. (bouts de cercles entre autres)
if (nbs > 2) nbs*=4;
Standard_Real step = ( last - first ) / (Standard_Real)( nbs - 1 );
Standard_Real par = first, stop = last - 0.5 * step;
for ( ; par < stop; par += step )
seq.Append(C.Value(par));
for (Standard_Integer i = 0; i < nbs - 1; ++i)
seq.Append(C.Value(first + step * i));
seq.Append(C.Value(last));
return Standard_True;
/*

View File

@@ -243,6 +243,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
aPSentry.Next();
myResult = Context()->Apply(S);
if ( NeedFix(myFixSameParameterMode) )
{
SameParameter(myResult, Standard_False, theProgress);
@@ -269,6 +270,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
}
}
}
myResult = Context()->Apply(myResult);
if ( !fft.IsNull() )

View File

@@ -70,6 +70,7 @@ ShapeFix_Shell::ShapeFix_Shell()
myFixOrientationMode = -1;
myFixFace = new ShapeFix_Face;
myNbShells =0;
myNonManifold = Standard_False;
}
//=======================================================================
@@ -84,6 +85,7 @@ ShapeFix_Shell::ShapeFix_Shell(const TopoDS_Shell& shape)
myFixOrientationMode = -1;
myFixFace = new ShapeFix_Face;
Init(shape);
myNonManifold = Standard_False;
}
//=======================================================================
@@ -138,9 +140,10 @@ Standard_Boolean ShapeFix_Shell::Perform(const Handle(Message_ProgressIndicator)
if ( !aPSentry.More() )
return Standard_False;
}
TopoDS_Shape newsh = Context()->Apply(myShell);
if ( NeedFix ( myFixOrientationMode) )
FixFaceOrientation(TopoDS::Shell(newsh));
FixFaceOrientation(TopoDS::Shell(newsh), Standard_True, myNonManifold);
TopoDS_Shape aNewsh = Context()->Apply (newsh);
ShapeAnalysis_Shell aSas;
@@ -853,7 +856,10 @@ static void CreateClosedShell(TopTools_SequenceOfShape& OpenShells,
// purpose :
//=======================================================================
Standard_Boolean ShapeFix_Shell::FixFaceOrientation(const TopoDS_Shell& shell,const Standard_Boolean isAccountMultiConex,const Standard_Boolean NonManifold)
Standard_Boolean ShapeFix_Shell::FixFaceOrientation(
const TopoDS_Shell& shell,
const Standard_Boolean isAccountMultiConex,
const Standard_Boolean NonManifold)
{
//myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);
Standard_Boolean done = Standard_False;
@@ -1101,6 +1107,7 @@ void ShapeFix_Shell::SetMaxTolerance (const Standard_Real maxtol)
ShapeFix_Root::SetMaxTolerance ( maxtol );
myFixFace->SetMaxTolerance ( maxtol );
}
//=======================================================================
//function : NbShells
//purpose :
@@ -1110,3 +1117,13 @@ Standard_Integer ShapeFix_Shell::NbShells() const
{
return myNbShells;
}
//=======================================================================
//function : SetNonManifoldFlag
//purpose :
//=======================================================================
void ShapeFix_Shell::SetNonManifoldFlag(const Standard_Boolean isNonManifold)
{
myNonManifold = isNonManifold;
}

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