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

Compare commits

..

61 Commits

Author SHA1 Message Date
ika
2866e52daa 0033266: Modeling Algorithms - Wrong behavior of split shape algorithm
Do not skip both faces after splitting in case of the second one is invalid (has one edge or overlapping edges)
2023-01-04 12:54:02 +03:00
akaftasev
686926c0a9 0033247: Modeling Algorithm - BOP report small edges problem and produce empty result
Build shifted pcurve for ellipse and circle cases.
2022-12-22 16:20:54 +00:00
akaftasev
a638dd6224 0033265: Modeling Algorithms - Boolean operation hangs on the attached shapes
Added test case.
2022-12-16 14:28:08 +00:00
ifv
961a306dc4 0033244: Modeling Algorithms - Surface-surface intersection produces the double curves
IntAna_QuadQuadGeo.cxx - estimation of angular tolerance is added for case cone-cone

tests/lowalgos/intss/bug33244 - new test case added
2022-12-12 10:27:10 +03:00
ifv
195a068c4f 0030781: Sweep algorithm creates non-planar edges (orig. BOPAlgo_MakerVolume fails to build a solid)
BRepFill/BRepFill_AdvancedEvolved.cxx - estimation of angular tolerance is added in method GetLids()

tests/evolved/voluved/bug30781 - new test added
2022-12-10 14:04:53 +00:00
dpasukhi
669e0dfc17 0033246: Data Exchange, DE Wrapper - Checking license leads to performance problem
ReWork UpdateLoad functionality:
UpdateLoad calls only if provider is found.
UpdateLoad calls only for chosen type of translation (read/write)
Add new method to UpdateLoad all registered nodes.
2022-12-10 14:02:56 +00:00
nunomsil
74cb5673a5 0031919: Modeling Algorithms - General Fuse raises exception on attempt to imprint a contour to a shell
Exception no longer occurs in current version. However, fuzzyvalue should be set to 1 for the result of the operation to make sense (result of common is 1 wire). Test case added
2022-12-07 14:45:36 +00:00
dpasukhi
768f3a4a19 0033235: Configuration - Solving the problem with static building of ExpToCasExe
Added new dependency to ExpToCasExe - CSF_wsock32 (on Win only)
2022-12-04 13:49:06 +03:00
dpasukhi
2a8c5ad46c 0033250: Configuration - Missing Limits header file
Added new include limits to fix build problem
2022-12-04 13:48:24 +03:00
stv
7ea3eff4f8 0033218: Data Exchange - XCAFPrs_Texture not allow to use classes inherited from Image_Texture
Type of field XCAFPrs_Texture::myImageSource was changed from Image_Texture to Handle(Image_Texture)
2022-12-04 13:47:36 +03:00
dpasukhi
c07f4ee70d 0033232: Data Exchange, DE_Wrapper - Implement ability to change global session
Add ability to set/get global session
2022-12-04 13:46:38 +03:00
dpasukhi
6cc679d81c 0033230: Data Exchange, DE Wrapper - Update API to find CAD provider
Moved FindProvider method to public section
Made FindProvider as virtual to make it possible to overwrite.
2022-12-04 13:46:38 +03:00
dpasukhi
62f554bc3f 0033228: Data Exchange, DE Wrapper - Make the document argument of the method Read const handle
Rewrite document argument for DE_Wrapper Read method
2022-12-04 13:46:37 +03:00
sshutina
7eeb5d5fbf 0032965: PMIVis - PMIVis_TOT_Vectorized text regressions
Added the ability to draw a shaded shape in the required group.
2022-12-04 13:44:52 +03:00
oan
9b7f1aea28 0031865: Mesh - triangulation fails with large deflection values due to unhandled Standard_OutOfRange, BRepMesh_PairOfIndex::Append()
Define minimum number of points for specific types of curves like it was done for circular edges.
2022-12-04 13:43:52 +03:00
knosulko
1e96cf65fa 0033156: Modeling Algorithms - Planar face creation problem
BRepLib_MakeFace::BRepLib_MakeFace: deleted degenerative edges from the input wire;
add test tests\mkface\mkplane\bug33156.
2022-12-04 13:42:28 +03:00
ddzama
03275c0be1 0022821: Crash with BRepFilletAPI_MakeFillet
test bugs modalg_7 bug22821 failed on fillet shape with 5-th edge.
Experimentally has been found that reducing of parameter
ChFi3d_Builder::tolesp for this task solves the issue.

So, as soluton it is proposed to link parameter toleps with parameter range of
spine curve. So, production coefficient has been set to pass all tests and
2 teset was extended: tests/blend/complex/A6, tests/bugs/modalg_7/bug22821

first has been extended to test different scaling factors,
second has been extended to make fillet on all edges from 12.

Additionally:
 - fixed misusage of tolesp in contexts where tolerance of point in 3d is excepted;
     In some context usage of tol_esp is irrelevant, because its essentiality - tolerance of the parameter on the 3d curve.
     So, in such context it has been replaced with new parameter tol3d (with fix value 1.0e-4).
     Get rid of tolapp3d duplication constant - tol_3d
 - tolesp = 5.0e-5 * (umax - umin)
 - tolesp replaced by tolpoint2d/tolpoint3d in several classes.
     Blend_Walking
     BRepBlend_SurfRstLineBuilder
     BRepBlend_RstRstLineBuilder
     Blend_CSWalking
     Instead `tolesp` - `tolgui` is employed in contexts where tolerance of guide curve parameter is excepted.
     Instead `tolesp` - `tolpoint2d` or `tolpoint3d` is employed in contexts where tolerance of point in 2d or 3d space is excepted.
 - Replace tolesp with tolpoint2d/tolpoint3d in BBPP function argument.
 - Use tolapp3d instead tolesp in BonVoisin function,
2022-12-04 13:41:29 +03:00
ddzama
2f33e34038 0032934: Modelling Algorithms - BRepExtrema_DistShapeShape returns two solutions instead of one
distmini of two edges returns two solution points instead one.
Second unneeded solution point is the same as first.

The problem was in fact that second edge has continuity C0.
In this case additional extremas analysis performed in special procedure

PERFORM_C0

And second point found in this procedure.
Folowing code of

BRepExtrema_DistanceSS::Perform (variant for Edge/Edge)

we should this additional solution extremas set
to be object of test TRI_SOLUTION before pushing
into main list of solution.
This solves the problem.
Corresponding test and compound with edges has been created.

Additionally, in the function

PERFORM_C0

an obvious error has fixed.
2022-12-04 13:39:35 +03:00
akaftasev
3eb891ec49 0033180: We had a problem calling the OCC library at the customer site, and the program crashed
Added status for thrusection operations and changed throw constructions to set of the status and break the function.
2022-12-04 13:35:24 +03:00
smoskvin
057dcfddf7 0033225: Changing the status of tests on Ubuntu 20.04 and Windows 64 VC142 2022-11-28 00:04:06 +03:00
atereshi
3837b3bf28 0033217: DRAW - Missed Standard_EXPORT attribute in DrawTrSurf_Set* functions 2022-11-25 13:03:27 +03:00
gelin
db2bfd1e83 0032818: Modeling Algorithms - Result of sweep operation is invalid
BRepFill_TrimShellCorner.cxx - setting correct orientation for NewEdge
tests/pipe/bugs/bug32818 - new test case added
2022-11-21 20:13:47 +03:00
ika
a855215141 0030256: ACIS Import - crash while importing SAT file on constructing a pipe
Fix for thin section with both first and last parameters located in one segment.
2022-11-21 20:11:13 +03:00
ifv
195aac3a42 0033193: Modeling Algorithms - Regression: UnifySameDomain raises SIGSEGV
ShapeUpgrade_UnifySameDomain.cxx - method ReconstructMissedSeam is improved.

tests/bugs/heal/bug33193 - new test case added
2022-11-21 20:10:06 +03:00
atereshi
f706dd34b3 0027122: Data Exchange - invalid shapes are produced during model translation due to huge face tolerance
Problem: The shape has two faces that dimensions are less than tolerance in the specified STEP file. This situation produces the invalid shape.
Change: Shape process has operator FixFaceSize, that is exactly suitable for this shape. The only option of FixFaceSize operator was added to InterfaceStatic, to manage the operator from DRAW command.
Result: The shape without artifacts can be reproduced from STEP file with an extra healing procedure.
2022-11-21 20:06:04 +03:00
ifv
c325231de6 0033179: Modeling Algorithms - Crash in ShapeFix_Shape with the attached object, when healing for fixing SameParameterFlag
BSplCLib_2.cxx - method MergeBSplineKnots is modified in order to have always not empty result.
Geom2dConvert.cxx - in static function MultNumandDenom tolerance for comparing knots is decreased.

tests/bugs/modalg_8/bug33179 test case added
2022-11-21 20:03:35 +03:00
ifv
91a2f58f8f 0026441: Modeling Algorithms - BRepOffset_MakeOffset affects original shape
BRepOffset_MakeOffset.cxx - tolerance control for building planar faces is implemented,
                            updating tolerance for initial entities is avoided

BRepAlgo_Loop.cxx - "total" setting tolerance 0.001 is removing

BRepLib.cxx - checking of "locked" for vertex is removing in static function UpdShTol

QABugs_20.cxx - add new command OCC26441 for checking tolerance differenses between two "identical" shapes

tests/bugs/modalg_7/bug30054 - case now is "BAD", because really result shape is invalid: many faces has not closed wires with huge gaps between ends of edges. Result was "OK" only because tolerances of vertices were increased by algorithm to cover all gaps.

tests/bugs/modalg_8/bug26441 - new test case added

Other test: B3, C8, A7, C8: they were "BAD" and now are "BAD", only some problems are changed.
2022-11-21 20:00:23 +03:00
ifv
8175a70c4e 0033173: Modeling Algorithms - Regression in BRepExtrema_DistShapeShape causing Standard_OutOfRange exception
Extrema/Extrema_ExtCC.cxx - checking number of solutions is added

tests/bugs/modalg_8/bug33173 - test case added
2022-11-21 19:57:45 +03:00
atereshi
f9990707fe 0033187: Modeling Algorithms - Crash in postprocessing of imported shape
Problem: Desynchronization of behaviors of GeomAdaptor_Curve::NbIntervals and
 GeomAdaptor_Curve::Intervals functions. First calculates number of intervals, then
 array is created and second fills the array. In some cases the size of array
 is less than need for filling.

Change:
1. Added function BSplCLib::Intervals that calculates number of interval and fills
 the array with its (if needed).
2. Simplified the algorithm of intervals calculation.
3. GeomAdaptor_Curve::NbIntervals/Intervals and Geom2dAdaptor_Curve::NbIntervals/Intervals
 use BSplCLib::Intervals.
4. When creating an adapter for the base curve, the boundaries of the adapter for the offset curve are applied.
5. Test for problem shape was created: bugs modalg_8 bug33187.

Result: The new approach eliminates the problem of writing outside the array bounds.
2022-11-21 19:53:59 +03:00
knosulko
aba5c241c6 0033144: Modeling Algorithms - Wrong result of Shape Proximity
Added step of refinement the coarser of the two shapes meshes to produce two meshes with approximately the same density.
Added tests lowalgos/proximity.

Fixed accounting of parameters to adjust number of initial sample points
2022-11-21 19:50:40 +03:00
ifv
cc164fd7dc 0033170: Modeling Algorithms - Checking for canonical geometry: plane detection problems
GeomLib_IsPlanarSurface.cxx - using poles for checking BSpline, Bezier curves and surface changed
                              on checking by curve, surface points.

BRepOffset_MakeOffset.cxx - set normal of plane surface according to normal of initial face surface

tests/cr/bugs/bug33170 - new test case added
2022-11-21 19:44:10 +03:00
ona
d7d89acb39 0032977: OCC V7.5, V7.6 cannot read STEP color correctly for the root label, but v6.8 can
- color overriding mechanism is implemented for assembles, parts and instances
2022-11-21 19:41:08 +03:00
Eugeny Maltchikov
d444cc35c6 0033171: Modeling Algorithms - Invalid result of faces unification
Avoid unification of the faces belonging to the different shells.
2022-11-21 19:38:22 +03:00
smoskvin
eeba62cbd3 Increment OCCT version up to 7.8.0dev 2022-11-12 01:20:10 +03:00
dpasukhi
185d29b92f 0033198: Using a third-party Draco to compile in DEBUG mode
Added new CMake variables to build using DRACO
Windows OS works with Debug and Release configuration DRACO
Linux works with Release configuration DRACO
2022-11-12 01:19:44 +03:00
smoskvin
2923ef0df8 fixed compilation by the genproj tool 2022-11-11 11:26:00 +03:00
atychini
402ad27743 0033190: Error on de_wrapper/configuration/A3
Removing provider.VRML.OCC.read.memory.limit from the test because this parameter doesn't exist inside the Vrml_ConfigurationNode class
2022-11-02 22:22:09 +03:00
aba
f8d4cfbb80 0027142: Data Exchange - add possibility to set location in XCAFDoc_ShapeTool interface 2022-10-31 19:19:33 +03:00
azv
aaacd83510 0033032: Samples - Warning on Ubuntu 20.04
Fix warnings:
* catching polymorphic type 'class Standard_Failure' by value [-Wcatch-value=]
* this 'if' clause does not guard... [-Wmisleading-indentation]
2022-10-31 19:18:08 +03:00
mahaidong
3e06b70623 0032350: Data Exchange - STEPControl_Writer.writeStream(std::ostream)
STEPCAFControl_Writer::WriteStream(), STEPControl_Writer::WriteStream() - added interface for writing into stream.
STEPCAFControl_Reader::ReadStream() - added stream reading method (similar to STEPControl_Reader::ReadStream()).

Added option -stream to commands ReadStep, WriteStep, and testwritestep.
2022-10-31 19:18:08 +03:00
oan
b77de43fb0 0032053: Mesh - Invalid mesh after shape scaling
Added test case
2022-10-31 19:18:08 +03:00
oan
59223e118d 0031926: Shape Healing - ShapeAnalysis::OuterWire() considers next iteration element always to be a wire causing skipping of primal one
ShapeAnalysis::OuterWire(): fixed missed logic when TopoDS_Iterator notifies about more objects to iterate, but there are only vertices and no additional wires at all.
2022-10-31 19:18:07 +03:00
oan
3b5a94a165 0033050: [Regression to OCCT 7.3.0] Mesh - meshing deflection is not reached
Add parameter EnableControlSurfaceDeflectionAllSurfaces to IMeshTools_Parameters enabling possibility to optimize mesh even on analytical surfaces;
Add corresponding parameter -surf_def_all to incmesh Draw command.
2022-10-31 19:18:07 +03:00
akaftasev
5cbd98a5be 0029093: BOP PaveFiller hungs and constantly consumes memory
Method IntWalk_PWalking::ExtendLineInCommonZone(...) now is not called if the already found intersection point is on surface boundary.
As result, the intersection line going along any boundary will never be extended. It is appropriate for high-level OCCT-algorithm because they will take the boundary (not computed line) as intersection result.
2022-10-31 19:18:07 +03:00
akaftasev
25b5e83a4c 0032691: Modeling Algorithms - Exception when trying to build solid during sweep algorithm
Changed the condition for checking the correctness of the sweep algorithm. Exception is no longer raised, algorithm finishes with "Not done" status.
2022-10-31 19:18:06 +03:00
vmigunov
3c9178dd5c 0033165: Data exchange - Instance name is not saved during writing step file
Instance name is saved also with identity location transformation
2022-10-31 18:22:37 +03:00
oan
f73592edf0 0028500: Artifact in shaded view of the shape
Increase minimum number of discretization points by one explicitly on each iteration of model healer to cover cases degenerated to line (for cases when face consists of 2 edges only).
2022-10-31 18:21:44 +03:00
oan
a24391a133 0033163: Bad definition of values in IMeshData_Status
Corrected value of status enum
2022-10-31 18:21:08 +03:00
oan
3a24514d48 0031476: Wrong shading of a toroidal face from a SAT file
Added test case
2022-10-31 18:20:29 +03:00
kgv
3453354ee1 0033141: BVH_BaseBox<T, 3, BVH_Box>::Transformed() returns empty box for identity matrix 2022-10-31 18:19:37 +03:00
Eugeny Maltchikov
9218d04b9a 0033138: [Foundation Classes] - NCollection_IncAllocator- Decrease the default block size
Set default memory block size for IncAllocator to 12KB to make sure the Low Fragmentation Heap is used for memory allocations on Windows platform.
2022-10-31 18:18:21 +03:00
abulyche
259b930379 0023954: Modeling Algorithms - BRepPrimAPI_MakeRevol fails to recognize a torus case
Fixed the Toroidal surface recognition;
The test case bugs/moddata_1/bug22296: the result is a torus with parameters: u [0, 2*PI], v [PI, 3*PI];
The test case bugs/modalg_5/bug23954: BAD -> OK.
2022-10-31 18:17:37 +03:00
ddzama
3536158f11 0033153: Configuration: Linker error when building from source for VS2022 x64.
With enabled flag BUILD_USE_PCH we get an error of compilation of TKService:

1>Image_VideoRecorder.obj :
  error LNK2019:
    unresolved external symbol
      "int __cdecl av_strerror(int,char *,unsigned __int64)"
      (?av_strerror@@YAHHPEAD_K@Z) referenced in function
      "protected: class TCollection_AsciiString __cdecl Image_VideoRecorder::formatAvError(int)const "
      (?formatAvError@Image_VideoRecorder@@IEBA?AVTCollection_AsciiString@@H@Z)
1>Media_FormatContext.obj :
  error LNK2001:
    unresolved external symbol
      "int __cdecl av_strerror(int,char *,unsigned __int64)" (?av_strerror@@YAHHPEAD_K@Z)

And many other similar errors. Similar errors occures in some other projects too:

TKService
TKOpenGl
TKOpenGles
TKXCAF
TKXDEDRAW
TKDFBrowser
TKMessageModel
TKMessageView
TKShapeView
TKTInspector
TKTreeModel
TKVInspector
TKView

Proposed solution: turn off cotire from targets, whose compilation cause error while applying cotire tool.
In this ticket migration to cotire 1.8.1 (from 1.7.9) is done.

COTIRE_PREFIX_HEADER_IGNORE_PATH does not apply here, because its employing
causes some errors in 3rdparty libraries (for example, in TKService project).

Projects (TKDFBrowser TKMessageModel TKMessageView TKShapeView TKTInspector TKTreeModel TKVInspector TKView)
which use Qt may be proceeded by cotire tool, but after fixing a bug of cotire:

https://gitlab.kitware.com/cmake/cmake/-/issues/18353

0033153: Fix cotire bug, causing impossibility of compilation targets depending from Qt.

Solution is proposed in:
https://gitlab.kitware.com/cmake/cmake/-/issues/18353
2022-10-31 18:16:19 +03:00
ddzama
cb77bfc4f0 0033155: Regression [0033117] Coding, relocation R_X86_64_PC32 against symbol `TT_RunIns' can not be used.
After emploing intel oneTBB of version 2021.5 on NEXT platforms arises error on OCC Pr.:

`
*/ld: */libfreetype.a(truetype.o): relocation R_X86_64_PC32 against symbol `TT_RunIns' can not be used when making a shared object; recompile with -fPIC
*/ld: final link failed: bad value
`

Proposed solution: linking with shared object of libfreetype, rather than with archive library.
Despite that error occurred only in OCC Pr., it is worth to accept changes for OCCT too.
2022-10-31 18:14:31 +03:00
ddzama
92f1875fc0 0033147: [Regression to 7.6.3] Coding, Configuration - CMake Error TBB "Directory is not set".
Previous approach do not taking into account, that oneTBB library may be installed in the system folder
on Linux. So, solve the problem it is proposed to employ find_package utility, that works great
as on Windows, as on Linux.
2022-10-31 18:13:44 +03:00
atereshi
a453f9d128 0028414: Data Exchange, STEP - Face on a closed surface with single inner wire and without natural bound not correctly read
Problem: From the point of view of the STEP format (and others), it is allowed
to describe a face on a surface with natural boundaries (torus, sphere) without
specifying these boundaries. Thus, a face on a closed surface and containing
an inner wire (or several) is correctly defined and describes a face with a
cutout defined by this wire. At the same time, there is a function
(ShapeFix_Face::FixOrientation) in the ShapeHealing procedure that corrects the
orientation of the wires, and it starts before the function of adding natural
boundaries (ShapeFix_Face::FixAddNaturalBound). There are many shapes that have
incorrectly oriented wires and this procedure successfully heals them, but on a
correctly specified face with single inner wire on closed surface, we do not get
the entire surface with a cutout, but a part of the surface defined by the wire.
This fix is intended to resolve this ambiguity.

Change:
1. Added function isNeedAddNaturalBound that returns TRUE if face needs to add
 natural bounds.
2. Corrected condition in FixOrientation to ignoring faces that needs to add
 natural bounds.
3. For tests in which one wire was incorrectly oriented on a closed surface,
flag AddNaturalBound was disabled.
5. Test with cutout from torus was created: bugs step bug28414.

Result: By default, it is correct to add natural boundaries, because this case
 is correct from the point of view of the STEP format and others.
2022-10-31 18:10:55 +03:00
gelin
492b09dcae 0032850: Modeling Algorithms - Surface Surface Intersect Lost one line
IntStart_SearchOnBoundaries.gxx - improving tangent criteria
2022-10-31 18:09:15 +03:00
kgv
f55fe3b3f7 0033149: Mesh - misprint in BRepMesh_NURBSRangeSplitter::computeGrainAndFilterParameters() 2022-10-31 18:08:24 +03:00
atereshi
51329afcef 0028024: Data Exchange - create a convenient mechanism for managing shape healing options when reading STEP or IGES file
Problem: There is no possibility to change shape healing options from DRAW without rewriting resource file.
Change: Shape healing parameters from STEP and IGES resource files were duplicated to InterfaceStatic. Resource manager initialize from InterfaceStatic if resource file name is empty.
Result: User can operationally change shape healing parameters from DRAW command using "param" command.
2022-10-31 18:06:02 +03:00
ddzama
13f5da81ad 0033152: Fix searching tbb in 3rdparty directory.
Currently directory containing tbb 3rdparty installation should match the template tbb*.
But after using oneTbb of version 2021.5 standard installation directory is onetbb*.
So, for this 3rdparty modify searching template.
2022-10-31 18:01:27 +03:00
nmanchen
f0049a9599 0028640: Modeling Algorithms - BRepBuilderAPI_Transform builds invalid shape
Adapt test case, the problem is not reproduced any more.
Problem is fixed by the commit: 46478ffe32 (0030008: BRepMesh does not respect angular deflection in internal area of bspline surface)
2022-09-30 10:35:34 +03:00
365 changed files with 6804 additions and 5470 deletions

View File

@@ -3,7 +3,7 @@
# See the cotire manual for usage hints.
#
#=============================================================================
# Copyright 2012-2016 Sascha Kratky
# Copyright 2012-2018 Sascha Kratky
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -32,16 +32,18 @@ if(__COTIRE_INCLUDED)
endif()
set(__COTIRE_INCLUDED TRUE)
# Caution! Be careful, when increase minimal cmake version:
# using of newer version may leads (by default) to applying
# of some new policies. It may break compilation.
# For canceling of applying new policies use:
# cmake_policy(PUSH) before `cmake_minimum_required`
# and cmake_policy(POP) after.
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
# call cmake_minimum_required, but prevent modification of the CMake policy stack in include mode
# cmake_minimum_required also sets the policy version as a side effect, which we have to avoid
if (NOT CMAKE_SCRIPT_MODE_FILE)
cmake_policy(PUSH)
endif()
cmake_minimum_required(VERSION 2.8.12)
if (NOT CMAKE_SCRIPT_MODE_FILE)
cmake_policy(POP)
endif()
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9")
set (COTIRE_CMAKE_MODULE_VERSION "1.8.1")
# activate select policies
if (POLICY CMP0025)
@@ -104,6 +106,11 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
if (POLICY CMP0055)
# strict checking for break() command
cmake_policy(SET CMP0055 NEW)
endif()
include(CMakeParseArguments)
include(ProcessorCount)
@@ -232,7 +239,13 @@ function (cotire_filter_language_source_files _language _target _sourceFilesVar
# add to excluded sources, if file has custom compile flags
list (APPEND _excludedSourceFiles "${_sourceFile}")
else()
list (APPEND _sourceFiles "${_sourceFile}")
get_source_file_property(_sourceCompileOptions "${_sourceFile}" COMPILE_OPTIONS)
if (_sourceCompileOptions)
# add to excluded sources, if file has list of custom compile options
list (APPEND _excludedSourceFiles "${_sourceFile}")
else()
list (APPEND _sourceFiles "${_sourceFile}")
endif()
endif()
endif()
endforeach()
@@ -291,7 +304,7 @@ function (cotire_get_source_file_property_values _valuesVar _property)
set (${_valuesVar} ${_values} PARENT_SCOPE)
endfunction()
function (cotire_resolve_config_properites _configurations _propertiesVar)
function (cotire_resolve_config_properties _configurations _propertiesVar)
set (_properties "")
foreach (_property ${ARGN})
if ("${_property}" MATCHES "<CONFIG>")
@@ -307,8 +320,8 @@ function (cotire_resolve_config_properites _configurations _propertiesVar)
set (${_propertiesVar} ${_properties} PARENT_SCOPE)
endfunction()
function (cotire_copy_set_properites _configurations _type _source _target)
cotire_resolve_config_properites("${_configurations}" _properties ${ARGN})
function (cotire_copy_set_properties _configurations _type _source _target)
cotire_resolve_config_properties("${_configurations}" _properties ${ARGN})
foreach (_property ${_properties})
get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET)
if (_isSet)
@@ -318,13 +331,18 @@ function (cotire_copy_set_properites _configurations _type _source _target)
endforeach()
endfunction()
function (cotire_get_target_usage_requirements _target _targetRequirementsVar)
function (cotire_get_target_usage_requirements _target _config _targetRequirementsVar)
set (_targetRequirements "")
get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES)
while (_librariesToProcess)
# remove from head
list (GET _librariesToProcess 0 _library)
list (REMOVE_AT _librariesToProcess 0)
if (_library MATCHES "^\\$<\\$<CONFIG:${_config}>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
elseif (_config STREQUAL "None" AND _library MATCHES "^\\$<\\$<CONFIG:>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
endif()
if (TARGET ${_library})
list (FIND _targetRequirements ${_library} _index)
if (_index LESS 0)
@@ -439,7 +457,7 @@ function (cotire_get_target_compile_flags _config _language _target _flagsVar)
# interface compile options from linked library targets
if (_target)
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets)
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS)
if (_targetOptions)
@@ -571,7 +589,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
# interface include directories from linked library targets
if (_target)
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets)
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_linkedTargetType ${_linkedTarget} TYPE)
if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND
@@ -625,7 +643,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES)
list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
if (WIN32)
if (WIN32 AND NOT MINGW)
# convert Windows paths in include directories to CMake paths
if (_includeDirs)
set (_paths "")
@@ -701,7 +719,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
endif()
# interface compile definitions from linked library targets
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets)
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS)
if (_definitions)
@@ -709,7 +727,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
endif()
endforeach()
# parse additional compile definitions from target compile flags
# and don't look at directory compile definitions, which we already handled
# and do not look at directory compile definitions, which we already handled
set (_targetFlags "")
cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags)
cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags})
@@ -857,6 +875,9 @@ macro (cotire_set_cmd_to_prologue _cmdVar)
list (APPEND ${_cmdVar} "--warn-uninitialized")
endif()
list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$<CONFIGURATION>")
if (XCODE)
list (APPEND ${_cmdVar} "-DXCODE:BOOL=TRUE")
endif()
if (COTIRE_VERBOSE)
list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON")
elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles")
@@ -874,6 +895,9 @@ function (cotire_init_compile_cmd _cmdVar _language _compilerLauncher _compilerE
if (NOT _compilerArg1)
set (_compilerArg1 ${CMAKE_${_language}_COMPILER_ARG1})
endif()
if (WIN32)
file (TO_NATIVE_PATH "${_compilerExe}" _compilerExe)
endif()
string (STRIP "${_compilerArg1}" _compilerArg1)
if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
# compiler launcher is only supported for Makefile and Ninja
@@ -900,16 +924,16 @@ function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemInclu
foreach (_include ${_includeDirs})
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
file (TO_NATIVE_PATH "${_include}" _include)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
else()
set (_index -1)
if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+")
list (FIND ${_systemIncludesVar} "${_include}" _index)
endif()
if (_index GREATER -1)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
else()
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
endif()
endif()
endforeach()
@@ -1044,10 +1068,10 @@ macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar)
set (${_headerIsIgnoredVar} TRUE)
elseif (IS_DIRECTORY "${_headerFile}")
set (${_headerIsIgnoredVar} TRUE)
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed" AND "${_headerFile}" MATCHES "\\.h$")
# heuristic: ignore C headers with embedded parent directory references or "-fixed" or "_fixed" in path
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed")
# heuristic: ignore headers with embedded parent directory references or "-fixed" or "_fixed" in path
# these often stem from using GCC #include_next tricks, which may break the precompiled header compilation
# with the error message "error: no include path in which to search for header.h"
# with the error message "error: no include path in which to search for header"
set (${_headerIsIgnoredVar} TRUE)
else()
set (${_headerIsIgnoredVar} FALSE)
@@ -1068,12 +1092,11 @@ endmacro()
macro (cotire_parse_line _line _headerFileVar _headerDepthVar)
if (MSVC)
# cl.exe /showIncludes output looks different depending on the language pack used, e.g.:
# cl.exe /showIncludes produces different output, depending on the language pack used, e.g.:
# English: "Note: including file: C:\directory\file"
# German: "Hinweis: Einlesen der Datei: C:\directory\file"
# We use a very general regular expression, relying on the presence of the : characters
if (_line MATCHES "( +)([a-zA-Z]:[^:]+)$")
# Visual Studio compiler output
string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar})
get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" ABSOLUTE)
else()
@@ -1231,11 +1254,19 @@ function (cotire_scan_includes _includesVar)
set (${_includesVar} "" PARENT_SCOPE)
return()
endif()
list (APPEND _cmd ${_existingSourceFiles})
# add source files to be scanned
if (WIN32)
foreach (_sourceFile ${_existingSourceFiles})
file (TO_NATIVE_PATH "${_sourceFile}" _sourceFileNative)
list (APPEND _cmd "${_sourceFileNative}")
endforeach()
else()
list (APPEND _cmd ${_existingSourceFiles})
endif()
if (COTIRE_VERBOSE)
message (STATUS "execute_process: ${_cmd}")
endif()
if (_option_COMPILER_ID MATCHES "MSVC")
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
unset (ENV{VS_UNICODE_OUTPUT})
endif()
@@ -1471,11 +1502,16 @@ function (cotire_generate_prefix_header _prefixFile)
if (_unparsedLines)
if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders)
list (LENGTH _unparsedLines _skippedLineCount)
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}")
if (WIN32)
file (TO_NATIVE_PATH "${_unparsedLinesFile}" _unparsedLinesLogPath)
else()
set (_unparsedLinesLogPath "${_unparsedLinesFile}")
endif()
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesLogPath}")
endif()
string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}")
endif()
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}")
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}\n")
endfunction()
function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar)
@@ -1505,7 +1541,7 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
# append to list
list (APPEND _flags -H -E)
if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0")
list (APPEND _flags "-fdirectives-only")
list (APPEND _flags -fdirectives-only)
endif()
else()
# return as a flag string
@@ -1515,16 +1551,36 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
endif()
endif()
elseif (_compilerID MATCHES "Clang")
# Clang options used
# -H print the name of each header file used
# -E invoke preprocessor
# -fno-color-diagnostics don't prints diagnostics in color
if (_flags)
# append to list
list (APPEND _flags -H -E -fno-color-diagnostics)
else()
# return as a flag string
set (_flags "-H -E -fno-color-diagnostics")
if (UNIX)
# Clang options used
# -H print the name of each header file used
# -E invoke preprocessor
# -fno-color-diagnostics do not print diagnostics in color
# -Eonly just run preprocessor, no output
if (_flags)
# append to list
list (APPEND _flags -H -E -fno-color-diagnostics -Xclang -Eonly)
else()
# return as a flag string
set (_flags "-H -E -fno-color-diagnostics -Xclang -Eonly")
endif()
elseif (WIN32)
# Clang-cl.exe options used
# /TC treat all files named on the command line as C source files
# /TP treat all files named on the command line as C++ source files
# /EP preprocess to stdout without #line directives
# -H print the name of each header file used
# -fno-color-diagnostics do not print diagnostics in color
# -Eonly just run preprocessor, no output
set (_sourceFileTypeC "/TC")
set (_sourceFileTypeCXX "/TP")
if (_flags)
# append to list
list (APPEND _flags "${_sourceFileType${_language}}" /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly)
else()
# return as a flag string
set (_flags "${_sourceFileType${_language}} /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly")
endif()
endif()
elseif (_compilerID MATCHES "Intel")
if (WIN32)
@@ -1598,8 +1654,8 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}")
endif()
endif()
elseif (_compilerID MATCHES "GNU|Clang")
# GCC / Clang options used
elseif (_compilerID MATCHES "GNU")
# GCC options used
# -x specify the source language
# -c compile but do not link
# -o place output in file
@@ -1609,11 +1665,55 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
set (_xLanguage_CXX "c++-header")
if (_flags)
# append to list
list (APPEND _flags "-x" "${_xLanguage_${_language}}" "-c" "${_prefixFile}" -o "${_pchFile}")
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
else()
# return as a flag string
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
endif()
elseif (_compilerID MATCHES "Clang")
if (UNIX)
# Clang options used
# -x specify the source language
# -c compile but do not link
# -o place output in file
# -fno-pch-timestamp disable inclusion of timestamp in precompiled headers (clang 4.0.0+)
set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header")
if (_flags)
# append to list
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
list (APPEND _flags -Xclang -fno-pch-timestamp)
endif()
else()
# return as a flag string
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
set (_flags "${_flags} -Xclang -fno-pch-timestamp")
endif()
endif()
elseif (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative)
# Clang-cl.exe options used
# /Yc creates a precompiled header file
# /Fp specifies precompiled header binary file name
# /FI forces inclusion of file
# /Zs syntax check only
# /TC treat all files named on the command line as C source files
# /TP treat all files named on the command line as C++ source files
set (_sourceFileTypeC "/TC")
set (_sourceFileTypeCXX "/TP")
if (_flags)
# append to list
list (APPEND _flags "${_sourceFileType${_language}}"
"/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}")
else()
# return as a flag string
set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
endif()
endif()
elseif (_compilerID MATCHES "Intel")
if (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
@@ -1655,20 +1755,28 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
get_filename_component(_pchName "${_pchFile}" NAME)
set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header")
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags)
# append to list
if ("${_language}" STREQUAL "CXX")
list (APPEND _flags -Kc++)
endif()
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-create" "${_pchName}" "-fsyntax-only" "${_hostFile}")
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-create "${_pchName}" -fsyntax-only "${_hostFile}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
list (APPEND _flags "-Wpch-messages")
if (NOT _pchSuppressMessages)
list (APPEND _flags -Wpch-messages)
endif()
endif()
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
set (_flags "${_flags} -Wpch-messages")
if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
endif()
endif()
endif()
@@ -1719,23 +1827,48 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}")
list (APPEND _flags -Winvalid-pch -include "${_prefixFile}")
else()
# return as a flag string
set (_flags "-Winvalid-pch -include \"${_prefixFile}\"")
endif()
elseif (_compilerID MATCHES "Clang")
# Clang options used
# -include process include file as the first line of the primary source file
# -include-pch include precompiled header file
# -Qunused-arguments don't emit warning for unused driver arguments
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}")
else()
# return as a flag string
set (_flags "-Qunused-arguments -include \"${_prefixFile}\"")
if (UNIX)
# Clang options used
# -include process include file as the first line of the primary source file
# note: ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags -include "${_prefixFile}")
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\"")
endif()
elseif (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
# Clang-cl.exe options used
# /Yu uses a precompiled header file during build
# /Fp specifies precompiled header binary file name
# /FI forces inclusion of file
if (_pchFile)
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
if (_flags)
# append to list
list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}")
else()
# return as a flag string
set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
endif()
else()
# no precompiled header, force inclusion of prefix header
if (_flags)
# append to list
list (APPEND _flags "/FI${_prefixFileNative}")
else()
# return as a flag string
set (_flags "/FI\"${_prefixFileNative}\"")
endif()
endif()
endif()
elseif (_compilerID MATCHES "Intel")
if (WIN32)
@@ -1779,24 +1912,32 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
if (_pchFile)
get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
get_filename_component(_pchName "${_pchFile}" NAME)
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags)
# append to list
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-use" "${_pchName}")
list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-use "${_pchName}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
list (APPEND _flags "-Wpch-messages")
if (NOT _pchSuppressMessages)
list (APPEND _flags -Wpch-messages)
endif()
endif()
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
set (_flags "${_flags} -Wpch-messages")
if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
endif()
endif()
else()
# no precompiled header, force inclusion of prefix header
if (_flags)
# append to list
list (APPEND _flags "-include" "${_prefixFile}")
list (APPEND _flags -include "${_prefixFile}")
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\"")
@@ -1834,9 +1975,17 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
if (COTIRE_VERBOSE)
message (STATUS "execute_process: ${_cmd}")
endif()
if (_option_COMPILER_ID MATCHES "MSVC")
if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
unset (ENV{VS_UNICODE_OUTPUT})
elseif (_option_COMPILER_ID MATCHES "Clang" AND _option_COMPILER_VERSION VERSION_LESS "4.0.0")
if (_option_COMPILER_LAUNCHER MATCHES "ccache" OR
_option_COMPILER_EXECUTABLE MATCHES "ccache")
# Newer versions of Clang embed a compilation timestamp into the precompiled header binary,
# which results in "file has been modified since the precompiled header was built" errors if ccache is used.
# We work around the problem by disabling ccache upon pre-compiling the prefix header.
set (ENV{CCACHE_DISABLE} "true")
endif()
endif()
execute_process(
COMMAND ${_cmd}
@@ -1851,7 +2000,7 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
set (_unsupportedCompiler
"Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}")
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC")
# supported since Visual Studio C++ 6.0
# PCH supported since Visual Studio C++ 6.0
# and CMake does not support an earlier version
set (${_msgVar} "" PARENT_SCOPE)
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU")
@@ -1862,8 +2011,16 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
set (${_msgVar} "" PARENT_SCOPE)
endif()
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang")
# all Clang versions have PCH support
set (${_msgVar} "" PARENT_SCOPE)
if (UNIX)
# all Unix Clang versions have PCH support
set (${_msgVar} "" PARENT_SCOPE)
elseif (WIN32)
# only clang-cl is supported under Windows
get_filename_component(_compilerName "${CMAKE_${_language}_COMPILER}" NAME_WE)
if (NOT _compilerName MATCHES "cl$")
set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}. Use clang-cl instead." PARENT_SCOPE)
endif()
endif()
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel")
# Intel PCH support requires version >= 8.0.0
if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0")
@@ -1874,29 +2031,38 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
else()
set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE)
endif()
# check if ccache is used as a compiler launcher
get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER)
if (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache")
get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" REALPATH)
if (_realCompilerExe MATCHES "ccache" OR _launcher MATCHES "ccache")
# verify that ccache configuration is compatible with precompiled headers
# always check environment variable CCACHE_SLOPPINESS, because earlier versions of ccache
# do not report the "sloppiness" setting correctly upon printing ccache configuration
if (DEFINED ENV{CCACHE_SLOPPINESS})
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR
NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
set (${_msgVar}
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE)
endif()
else()
if (_launcher MATCHES "ccache")
get_filename_component(_ccacheExe "${_launcher}" REALPATH)
if (_realCompilerExe MATCHES "ccache")
set (_ccacheExe "${_realCompilerExe}")
else()
get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH)
set (_ccacheExe "${_launcher}")
endif()
# ccache 3.7.0 replaced --print-config with --show-config
# use -p instead, which seems to work for all version for now, sigh
execute_process(
COMMAND "${_ccacheExe}" "--print-config"
COMMAND "${_ccacheExe}" "-p"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if (_result OR NOT
_ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR NOT
_ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
if (_result)
set (${_msgVar} "ccache configuration cannot be determined." PARENT_SCOPE)
elseif (NOT _ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR
NOT _ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
set (${_msgVar}
"ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE)
@@ -2189,7 +2355,7 @@ function (cotire_generate_target_script _language _configurations _target _targe
XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES
CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION
CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_SEP_${_language}
CMAKE_INCLUDE_SYSTEM_FLAG_${_language}
CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG
CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG
@@ -2222,8 +2388,9 @@ endfunction()
function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile)
set (_sourceFiles ${ARGN})
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# for Visual Studio and Intel, we attach the precompiled header compilation to the host file
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# for MSVC, Intel and Clang-cl, we attach the precompiled header compilation to the host file
# the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion
if (_sourceFiles)
set (_flags "")
@@ -2231,6 +2398,9 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags)
set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_hostFile} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}")
# make object file generated from host file depend on prefix header
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}")
@@ -2268,8 +2438,9 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
endfunction()
function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile)
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# for Visual Studio and Intel, we include the precompiled header in all but the host file
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# for MSVC, Intel and clang-cl, we include the precompiled header in all but the host file
# the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation
set (_sourceFiles ${ARGN})
list (LENGTH _sourceFiles _numberOfSourceFiles)
@@ -2281,6 +2452,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# make object files generated from source files depend on precompiled header
set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}")
endif()
@@ -2294,6 +2468,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# mark sources as cotired to prevent them from being used in another cotired target
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
endif()
@@ -2311,6 +2488,9 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile)
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# mark sources as cotired to prevent them from being used in another cotired target
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
# make object files generated from source files depend on prefix header
@@ -2400,7 +2580,7 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}")
endif()
# because CMake PRE_BUILD command does not support dependencies,
# we check dependencies explicitly in cotire script mode when the pre-build action is run
# we check dependencies explicity in cotire script mode when the pre-build action is run
add_custom_command(
TARGET "${_target}"
PRE_BUILD ${_cmds}
@@ -2415,9 +2595,10 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
# if this is a single-language target without any excluded files
if (_wholeTarget)
set (_language "${_languages}")
# for Visual Studio and Intel, precompiled header inclusion is always done on the source file level
# for MSVC, Intel and clang-cl, precompiled header inclusion is always done on the source file level
# see cotire_setup_pch_file_inclusion
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
if (_prefixFile)
get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER)
@@ -2426,6 +2607,9 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _options)
set_property(TARGET ${_target} APPEND PROPERTY ${_options})
if (COTIRE_DEBUG)
message (STATUS "set_property: TARGET ${_target} APPEND PROPERTY ${_options}")
endif()
endif()
endif()
endif()
@@ -2452,7 +2636,8 @@ function (cotire_setup_unity_generation_commands _language _target _targetScript
set_property (SOURCE "${_unityFile}" PROPERTY OBJECT_DEPENDS ${_objectDependsPaths})
endif()
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# unity file compilation results in potentially huge object file, thus use /bigobj by default unter MSVC and Windows Intel
# unity file compilation results in potentially huge object file,
# thus use /bigobj by default unter cl.exe and Windows Intel
set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj")
endif()
cotire_set_cmd_to_prologue(_unityCmd)
@@ -2658,6 +2843,9 @@ function (cotire_make_target_message _target _languages _disableMsg _targetMsgVa
else()
set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.")
endif()
if (_disableMsg)
set (_targetMsg "${_targetMsg} ${_disableMsg}")
endif()
else()
if (_excludedStr)
set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.")
@@ -2747,6 +2935,20 @@ function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTarge
set (_targetUsePCH FALSE)
endif()
endif()
if (_targetAddSCU)
# disable unity builds if automatic Qt processing is used
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
get_target_property(_targetAutoUic ${_target} AUTOUIC)
get_target_property(_targetAutoRcc ${_target} AUTORCC)
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
if (_disableMsg)
set (_disableMsg "${_disableMsg} Target uses automatic CMake Qt processing.")
else()
set (_disableMsg "Target uses automatic CMake Qt processing.")
endif()
set (_targetAddSCU FALSE)
endif()
endif()
set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH})
set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU})
cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles})
@@ -2774,7 +2976,11 @@ function (cotire_compute_unity_max_number_of_includes _target _maxIncludesVar)
set (_sourceFiles ${ARGN})
get_target_property(_maxIncludes ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES)
if (_maxIncludes MATCHES "(-j|--parallel|--jobs) ?([0-9]*)")
set (_numberOfThreads "${CMAKE_MATCH_2}")
if (DEFINED CMAKE_MATCH_2)
set (_numberOfThreads "${CMAKE_MATCH_2}")
else()
set (_numberOfThreads "")
endif()
if (NOT _numberOfThreads)
# use all available cores
ProcessorCount(_numberOfThreads)
@@ -2887,8 +3093,9 @@ function (cotire_setup_pch_target _languages _configurations _target)
set (_dependsFiles "")
foreach (_language ${_languages})
set (_props COTIRE_${_language}_PREFIX_HEADER COTIRE_${_language}_UNITY_SOURCE)
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# Visual Studio and Intel only create precompiled header as a side effect
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# MSVC, Intel and clang-cl only create precompiled header as a side effect
list (INSERT _props 0 COTIRE_${_language}_PRECOMPILED_HEADER)
endif()
cotire_get_first_set_property_value(_dependsFile TARGET ${_target} ${_props})
@@ -2936,6 +3143,7 @@ function (cotire_collect_unity_target_sources _target _languages _unityTargetSou
list (APPEND _unityTargetSources ${_unityFiles})
endif()
endforeach()
# handle object libraries which are part of the target's sources
get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT)
if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$")
cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles})
@@ -2980,21 +3188,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
# determine unity target sources
set (_unityTargetSources "")
cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources)
# handle automatic Qt processing
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
get_target_property(_targetAutoUic ${_target} AUTOUIC)
get_target_property(_targetAutoRcc ${_target} AUTORCC)
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# if the original target sources are subject to CMake's automatic Qt processing,
# also include implicitly generated <targetname>_automoc.cpp file
if (CMAKE_VERSION VERSION_LESS "3.8.0")
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
else()
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
endif()
endif()
# prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created
set (CMAKE_AUTOMOC OFF)
set (CMAKE_AUTOUIC OFF)
@@ -3008,21 +3201,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
else()
add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources})
endif()
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
# depend on original target's automoc target, if it exists
if (TARGET ${_target}_automoc)
add_dependencies(${_unityTargetName} ${_target}_automoc)
endif()
else()
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# depend on the original target's implicitly generated <targetname>_automoc target
if (CMAKE_VERSION VERSION_LESS "3.8.0")
add_dependencies(${_unityTargetName} ${_target}_automoc)
else()
add_dependencies(${_unityTargetName} ${_target}_autogen)
endif()
endif()
endif()
# copy output location properties
set (_outputDirProperties
ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>
@@ -3034,8 +3212,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}")
else()
# append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties})
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
cotire_resolve_config_properties("${_configurations}" _properties ${_outputDirProperties})
foreach (_property ${_properties})
get_property(_outputDir TARGET ${_target} PROPERTY ${_property})
if (_outputDir)
@@ -3055,11 +3233,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
RUNTIME_OUTPUT_DIRECTORY "${_outputDir}")
endif()
else()
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
${_outputDirProperties})
endif()
# copy output name
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG>
LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG>
OUTPUT_NAME OUTPUT_NAME_<CONFIG>
@@ -3067,7 +3245,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
PREFIX <CONFIG>_POSTFIX SUFFIX
IMPORT_PREFIX IMPORT_SUFFIX)
# copy compile stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG>
COMPILE_FLAGS COMPILE_OPTIONS
Fortran_FORMAT Fortran_MODULE_DIRECTORY
@@ -3079,12 +3257,12 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN
C_CLANG_TIDY CXX_CLANG_TIDY)
# copy compile features
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED
CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED
COMPILE_FEATURES)
# copy interface stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN
COMPATIBLE_INTERFACE_STRING
INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS
@@ -3092,8 +3270,9 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED)
# copy link stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUILD_WITH_INSTALL_RPATH BUILD_WITH_INSTALL_NAME_DIR
INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED
LINK_FLAGS LINK_FLAGS_<CONFIG>
LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_<CONFIG>
@@ -3101,18 +3280,18 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC
STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_<CONFIG>
NO_SONAME SOVERSION VERSION
LINK_WHAT_YOU_USE)
LINK_WHAT_YOU_USE BUILD_RPATH)
# copy cmake stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK)
# copy Apple platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR
MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH
OSX_ARCHITECTURES OSX_ARCHITECTURES_<CONFIG> PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST
IOS_INSTALL_COMBINED)
IOS_INSTALL_COMBINED XCODE_EXPLICIT_FILE_TYPE XCODE_PRODUCT_TYPE)
# copy Windows platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
GNUtoMS
COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG>
COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
@@ -3126,15 +3305,19 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES
WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS
DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE
VS_SDK_REFERENCES)
VS_SDK_REFERENCES VS_USER_PROPS VS_DEBUGGER_WORKING_DIRECTORY)
# copy Android platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
ANDROID_API ANDROID_API_MIN ANDROID_GUI
ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES
ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR
ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES
ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH
ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE)
# copy CUDA platform specific stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
CUDA_PTX_COMPILATION CUDA_SEPARABLE_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS
CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED)
# use output name from original target
get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME)
if (NOT _targetOutputName)
@@ -3148,6 +3331,13 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
set_property(TARGET ${_unityTargetName} PROPERTY ENABLE_EXPORTS TRUE)
endif()
endif()
# enable parallel compilation for MSVC
if (MSVC AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
list (LENGTH _unityTargetSources _numberOfUnityTargetSources)
if (_numberOfUnityTargetSources GREATER 1)
set_property(TARGET ${_unityTargetName} APPEND PROPERTY COMPILE_OPTIONS "/MP")
endif()
endif()
cotire_init_target(${_unityTargetName})
cotire_add_to_unity_all_target(${_unityTargetName})
set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_TARGET_NAME "${_unityTargetName}")
@@ -3306,6 +3496,13 @@ function (cotire_target_link_libraries _target)
message (STATUS "unity target ${_unityTargetName} interface link libraries: ${_unityLinkInterfaceLibraries}")
endif()
endif()
get_target_property(_manualDependencies ${_target} MANUALLY_ADDED_DEPENDENCIES)
if (_manualDependencies)
cotire_map_libraries("${_linkLibrariesStrategy}" _unityManualDependencies ${_manualDependencies})
if (_unityManualDependencies)
add_dependencies("${_unityTargetName}" ${_unityManualDependencies})
endif()
endif()
endif()
endif()
endfunction(cotire_target_link_libraries)
@@ -3338,9 +3535,9 @@ function (cotire_init_target _targetName)
set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}")
endif()
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE)
if (MSVC_IDE)
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
endif()
# if (MSVC_IDE)
# set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
# endif()
endfunction()
function (cotire_add_to_pch_all_target _pchTargetName)
@@ -3602,7 +3799,7 @@ else()
set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING
"Ignore sources with the listed file extensions from the generated unity source.")
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "2" CACHE STRING
"Minimum number of sources in target required to enable use of precompiled header.")
if (NOT DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT)
@@ -3701,7 +3898,7 @@ else()
FULL_DOCS
"The variable can be set to an integer > 0."
"If a target contains less than that number of source files, cotire will not enable the use of the precompiled header for the target."
"If not defined, defaults to 3."
"If not defined, defaults to 2."
)
define_property(

View File

@@ -3,10 +3,6 @@
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
if (NOT DEFINED INSTALL_DRACO)
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
endif()
@@ -15,14 +11,24 @@ if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY)
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DEBUG)
set (3RDPARTY_DRACO_LIBRARY_DEBUG "" CACHE FILEPATH "Draco debug library")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR_DEBUG)
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "" CACHE PATH "The directory containing Draco debug library")
endif()
endif()
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
@@ -32,20 +38,19 @@ if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
endif()
endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
endif()
# header
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
set (HEADER_NAMES draco)
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
endif()
endif()
# set 3RDPARTY_DRACO_INCLUDE_DIR as notfound, otherwise find_path can't assign a new value to 3RDPARTY_DRACO_INCLUDE_DIR
set (3RDPARTY_DRACO_INCLUDE_DIR "3RDPARTY_DRACO_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing headers of the Draco" FORCE)
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
find_path (3RDPARTY_DRACO_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATHS ${3RDPARTY_DRACO_DIR}
PATH_SUFFIXES "include"
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
endif()
endif()
@@ -57,11 +62,11 @@ endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
PATHS "${3RDPARTY_DRACO_DIR}"
PATH_SUFFIXES lib
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
@@ -70,27 +75,19 @@ if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
endif()
endif()
endif()
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
endif()
if (WIN32 AND (NOT 3RDPARTY_DRACO_LIBRARY_DEBUG OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}"))
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
set (3RDPARTY_DRACO_LIBRARY_DEBUG "3RDPARTY_DRACO_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "The path to debug Draco library" FORCE)
if (INSTALL_DRACO)
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d")
find_library (3RDPARTY_DRACO_LIBRARY_DEBUG NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_DIR}"
PATH_SUFFIXES libd
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
if (3RDPARTY_DRACO_LIBRARY_DEBUG AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}")
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DEBUG}" PATH)
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DIR_DEBUG}" CACHE FILEPATH "The directory containing debug Draco library" FORCE)
endif()
endif()
endif()

View File

@@ -110,8 +110,19 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
endif()
unset (FREETYPE_LIBRARY_RELEASE)
find_package(Freetype)
# Only for UNIX (not APPLE)
if ((NOT WIN32) AND (NOT APPLE))
# To avoid linker error on Ubuntu 18.04 and others linux distributives we should
# link with freetype library, compiled as Position Independent Code (PIC),
# for example, with shared object.
if ((DEFINED FREETYPE_LIBRARY_RELEASE) AND (NOT "${FREETYPE_LIBRARY_RELEASE}" STREQUAL "") AND (EXISTS "${FREETYPE_LIBRARY_RELEASE}"))
string (REPLACE "\.a" "\.so" FREETYPE_LIBRARY_RELEASE "${FREETYPE_LIBRARY_RELEASE}")
endif()
endif()
# restore ENV{FREETYPE_DIR}
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
set (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
@@ -122,7 +133,7 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header")
if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY_RELEASE FILEPATH "freetype library")
endif()
endif()
@@ -141,8 +152,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
if (FREETYPE_LIBRARY_RELEASE AND EXISTS "${FREETYPE_LIBRARY_RELEASE}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY_RELEASE}" CACHE FILEPATH "The path to freetype library" FORCE)
endif()
endif()
@@ -220,7 +231,7 @@ endif()
# freetype library
#if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
set (FREETYPE_PATH_SUFFIXES lib)
if (ANDROID)
@@ -242,6 +253,16 @@ endif()
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
# Only for UNIX (not APPLE)
if ((NOT WIN32) AND (NOT APPLE))
# To avoid linker error on Ubuntu 18.04 and some others linux distributives we should
# link with freetype library, compiled as Position Independent Code (PIC),
# for example, with shared object.
if ((DEFINED 3RDPARTY_FREETYPE_LIBRARY) AND (NOT "${3RDPARTY_FREETYPE_LIBRARY}" STREQUAL "") AND (EXISTS "${3RDPARTY_FREETYPE_LIBRARY}"))
string (REPLACE "\.a" "\.so" 3RDPARTY_FREETYPE_LIBRARY "${3RDPARTY_FREETYPE_LIBRARY}")
endif()
endif()
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
@@ -350,7 +371,7 @@ endif()
# unset all redundant variables
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY_RELEASE)
if (BUILD_SHARED_LIBS)
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)

View File

@@ -160,6 +160,8 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
if ("${lower_PRODUCT_NAME}" STREQUAL "egl")
string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME)
list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*")
elseif ("${lower_PRODUCT_NAME}" STREQUAL "tbb")
list (APPEND SEARCH_TEMPLATES "^.*${lower_PRODUCT_NAME}.*")
else()
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")

View File

@@ -245,6 +245,18 @@ endif (USE_QT)
if (EXECUTABLE_PROJECT)
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
else()
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
# So, we just exclude PROJECT_NAME from cotire list.
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
# endif()
endif()
install (TARGETS ${PROJECT_NAME}
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
@@ -254,6 +266,18 @@ if (EXECUTABLE_PROJECT)
else()
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
else()
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
# So, we just exclude PROJECT_NAME from cotire list.
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
# endif()
endif()
if (MSVC)
if (BUILD_FORCE_RelWithDebInfo)
set (aReleasePdbConf "Release")
@@ -346,6 +370,10 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
add_definitions (-DHAVE_GLES2)
endif()
if ("${CURRENT_CSF}" STREQUAL "${CSF_Draco}")
set (CURRENT_CSF "")
set (USED_DRACO 1)
endif()
set (LIBRARY_FROM_CACHE 0)
separate_arguments (CURRENT_CSF)
foreach (CSF_LIBRARY ${CURRENT_CSF})
@@ -373,7 +401,7 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endforeach()
endforeach()
if (NOT ${LIBRARY_FROM_CACHE})
if (NOT ${LIBRARY_FROM_CACHE} AND NOT "${CURRENT_CSF}" STREQUAL "")
# prepare a list from a string with whitespaces
separate_arguments (CURRENT_CSF)
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
@@ -384,6 +412,28 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endif()
endforeach()
if (USE_DRACO)
if (USED_DRACO)
set (USED_LIB_RELEASE ${3RDPARTY_DRACO_LIBRARY})
if (WIN32)
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY_DEBUG})
else()
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY})
endif()
set (USED_LIB_CONF)
if (EXISTS ${USED_LIB_DEBUG})
set (USED_LIB_CONF "$<$<CONFIG:DEBUG>:${USED_LIB_DEBUG}>;${USED_LIB_CONF}")
endif()
if (EXISTS ${USED_LIB_RELEASE})
set (USED_LIB_CONF "$<$<CONFIG:RELEASE>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
set (USED_LIB_CONF "$<$<CONFIG:RELWITHDEBINFO>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
endif()
if (DEFINED USED_LIB_CONF)
set_property (TARGET ${PROJECT_NAME} APPEND PROPERTY LINK_LIBRARIES "${USED_LIB_CONF}")
endif()
endif()
endif()
if (APPLE)
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
if (NOT ${IS_X11_FOUND} EQUAL -1)

View File

@@ -1,262 +1,240 @@
# tbb
if (NOT DEFINED 3RDPARTY_DIR)
message (FATAL_ERROR "3RDPARTY_DIR is not defined.")
endif()
if ((NOT EXISTS "${3RDPARTY_DIR}") OR ("${3RDPARTY_DIR}" STREQUAL ""))
message (FATAL_ERROR "Directory ${3RDPARTY_DIR} is not set.")
endif()
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
# tbb directory
if (NOT DEFINED 3RDPARTY_TBB_DIR)
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif()
if (MSVC AND BUILD_SHARED_LIBS)
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
endif()
# include occt macros. compiler_bitness, os_wiht_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
# specify TBB folder in connectin with 3RDPARTY_DIR
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
#CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_TBB_DIR PATH "The directory containing tbb")
# Initialize tbb directory.
if (NOT DEFINED 3RDPARTY_TBB_DIR)
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif()
if (NOT 3RDPARTY_TBB_DIR OR NOT EXISTS "${3RDPARTY_TBB_DIR}")
if (WIN32)
if (NOT DEFINED 3RDPARTY_DIR)
message (FATAL_ERROR "3RDPARTY_DIR is not defined.")
endif()
if ("${3RDPARTY_DIR}" STREQUAL "")
message (FATAL_ERROR "3RDPARTY_DIR is empty string.")
endif()
if (NOT EXISTS "${3RDPARTY_DIR}")
message (FATAL_ERROR "3RDPARTY_DIR is not exist.")
endif()
# Below, we have correct 3RDPARTY_DIR.
# Initialize TBB folder in connectin with 3RDPARTY_DIR.
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
if (TBB_DIR_NAME)
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
endif()
endif()
else()
#set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing TBB" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
endif()
# Here we have full path name to installation directory of TBB.
# Employ it.
if (EXISTS "${3RDPARTY_TBB_DIR}")
find_package (
TBB 2021.5
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
REQUIRED
CONFIG)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
# check 3RDPARTY_TBB_INCLUDE_DIR for consictency with specified 3RDPARTY_TBB_DIR
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_TBB_INCLUDE_DIR PATH "The directory containing headers of the TBB")
endif()
# tbb.h
if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
set (HEADER_NAMES tbb.h tbb/tbb.h)
# set 3RDPARTY_TBB_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_TBB_INCLUDE_DIR
set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to tbb.h" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATHS ${3RDPARTY_TBB_DIR}
PATH_SUFFIXES include
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATH_SUFFIXES include
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
endif()
if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
endif()
# Throw execution if 3RDPARTY_TBB_DIR is equal to void string.
if ("${3RDPARTY_TBB_DIR}" STREQUAL "")
message (FATAL_ERROR "Directory with one TBB have not found.")
endif()
# Searching TBBConfig.cmake and TBBTargets-release.cmake in 3RDPARTY_TBB_DIR
# TBBConfig.cmake - is required, TBBTargets-release.cmake is optional.
file (GLOB_RECURSE TBB_CONFIG_CMAKE_FILE "${3RDPARTY_TBB_DIR}/*TBBConfig.cmake")
if (NOT EXISTS "${TBB_CONFIG_CMAKE_FILE}")
message (FATAL_ERROR "TBBConfig.cmake has not been found.")
endif()
include ("${TBB_CONFIG_CMAKE_FILE}")
file (GLOB_RECURSE TBB_TARGET_CMAKE_FILE "${3RDPARTY_TBB_DIR}/*TBBTargets-release.cmake")
if (EXISTS "${TBB_TARGET_CMAKE_FILE}")
include ("${TBB_TARGET_CMAKE_FILE}")
endif()
# We do not know, full path to file is pointed, or local.
# So, we should check it and output FULL PATH to FILE.
macro (TBB_FILE_NAME_TO_FILEPATH FL_NAME FL_PATH)
if (EXISTS "${FL_NAME}")
# FL_NAME is full path.
set (${FL_PATH} "${FL_NAME}")
else()
# Here we deal with local path, so assign to var full path to file.
# Acquire full path.
set (${FL_PATH} "${3RDPARTY_TBB_DIR}${FL_NAME}")
if (NOT EXISTS "${${FL_PATH}}")
message (FATAL_ERROR "TBB: needed file not found (${FL_PATH}).")
# Achive include directory
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
endif()
endif()
endmacro()
# TARGET_NAME - is target name from oneTBB cmake file
# it is either "TBB::tbb", or "TBB::tbbmalloc"
# LIB_NAME_UC - is library id (TBB or TBBMALLOC)
# PROPERTY_TO_SET - LIBRARY or DLL
macro (WIN_TBB_PARSE TARGET_NAME LIB_NAME PROPERTY_TO_SET)
set (FILE_NAME "")
set (FILE_PATH "")
set (FILE_DIR "")
if ("${PROPERTY_TO_SET}" STREQUAL "LIBRARY")
get_target_property (FILE_NAME "${TARGET_NAME}" IMPORTED_IMPLIB_RELEASE)
else()
get_target_property (FILE_NAME "${TARGET_NAME}" IMPORTED_LOCATION_RELEASE)
endif()
# acquire full path
TBB_FILE_NAME_TO_FILEPATH("${FILE_NAME}" FILE_PATH)
get_filename_component (FILE_NAME "${FILE_PATH}" NAME)
get_filename_component (FILE_DIR "${FILE_PATH}" DIRECTORY)
if (NOT EXISTS "${FILE_DIR}/${FILE_NAME}")
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET} "" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR "" CACHE PATH "The directory containing ${LIB_NAME} shared library")
if ("${PROPERTY_TO_SET}" STREQUAL "LIBRARY")
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR)
if (EXISTS "${TBB_INCLUDE_DIR}")
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR)
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
endif()
else()
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET} "${FILE_DIR}/${FILE_NAME}" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_${PROPERTY_TO_SET}_DIR "${FILE_DIR}" CACHE PATH "The directory containing ${LIB_NAME} shared library")
if ("${PROPERTY_TO_SET}" STREQUAL "LIBRARY")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${FILE_DIR}")
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
# Achive *.lib files and directory containing it.
get_target_property (TBB_LIB_FILE "TBB::${LIB_LOWER}" IMPORTED_IMPLIB_RELEASE)
# Reserve cache variable for *.lib.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.lib)")
endif()
# Reserve cache variable for directory containing *.lib file.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.lib)")
endif()
if (EXISTS "${TBB_LIB_FILE}")
set (3RDPARTY_${LIB_UPPER}_LIBRARY
"${TBB_LIB_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.lib)"
FORCE)
get_filename_component (TBB_LIB_FILE_DIRECTORY "${TBB_LIB_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
"${TBB_LIB_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.lib)"
FORCE)
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
endif()
# Achive *.dll files and directory containing it.
get_target_property (TBB_DLL_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
# Reserve cache variable for *.dll.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL)
set (3RDPARTY_${LIB_UPPER}_DLL "" CACHE FILEPATH "${LIB_UPPER} library (*.dll)")
endif()
# Reserve cache variable for directory containing *.dll file.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL_DIR)
set (3RDPARTY_${LIB_UPPER}_DLL_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.dll)")
endif()
if (EXISTS "${TBB_DLL_FILE}")
set (3RDPARTY_${LIB_UPPER}_DLL
"${TBB_DLL_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.dll)"
FORCE)
get_filename_component (TBB_DLL_FILE_DIRECTORY "${TBB_DLL_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_DLL_DIR
"${TBB_DLL_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.dll)"
FORCE)
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${LIB_UPPER}_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_UPPER}_DLL_DIR)
endif()
# install *.dll (tbb & tbbmalloc)
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
else()
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_BIN}d")
endif()
endif()
mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
endforeach()
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
list (APPEND 3RDPARTY_DLL_DIRS "${FILE_DIR}")
# the *.dll/*.so* directory for using by the executable
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
endif()
endif()
endmacro()
# TARGET_NAME - is target name from oneTBB cmake file
# it is either "TBB::tbb", or "TBB::tbbmalloc"
# LIB_NAME_UC - is library id (TBB or TBBMALLOC)
macro (LIN_TBB_PARSE TARGET_NAME LIB_NAME)
set (FILE_NAME "")
set (FILE_PATH "")
set (FILE_DIR "")
get_target_property (FILE_NAME "${TARGET_NAME}" IMPORTED_LOCATION_RELEASE)
# acquire full path
TBB_FILE_NAME_TO_FILEPATH("${FILE_NAME}" FILE_PATH)
get_filename_component (FILE_NAME "${FILE_PATH}" NAME)
get_filename_component (FILE_DIR "${FILE_PATH}" DIRECTORY)
if (NOT EXISTS "${FILE_DIR}/${FILE_NAME}")
set (3RDPARTY_${LIB_NAME}_LIBRARY "" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_NAME} shared library")
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_NAME}_LIBRARY_DIR)
else()
set (3RDPARTY_${LIB_NAME}_LIBRARY "${FILE_DIR}/${FILE_NAME}" CACHE FILEPATH "${LIB_NAME} library" FORCE)
set (3RDPARTY_${LIB_NAME}_LIBRARY_DIR "${FILE_DIR}" CACHE PATH "The directory containing ${LIB_NAME} shared library")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_NAME}_LIBRARY_DIR}")
message (FATAL_ERROR "Installation directory with TBB is not exist.")
endif()
endmacro()
else ()
# NOT WIN32 branch
if ((DEFINED 3RDPARTY_DIR) AND (NOT "${3RDPARTY_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_DIR}"))
# Here, we have correct 3RDPARTY_DIR.
# Trying to specify TBB folder in connection with 3RDPARTY_DIR
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
if (TBB_DIR_NAME)
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
endif()
endif()
if ((NOT "${3RDPARTY_TBB_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_TBB_DIR}"))
# Find TBB 2021.5 in existing directory.
find_package (
TBB 2021.5
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
REQUIRED
CONFIG)
else()
# Find TBB 2021.5 in system directory.
find_package (
TBB 2021.5
REQUIRED
CONFIG)
endif()
else()
# Find TBB 2021.5 in system directory.
find_package (
TBB 2021.5
REQUIRED
CONFIG)
endif()
# TBB has been configured (in other case FATAL_ERROR occures).
if (WIN32)
# Here we should set:
# - 3RDPARTY_*_LIBRARY
# - 3RDPARTY_*_LIBRARY_DIR
# - 3RDPARTY_*_DLL
# - 3RDPARTY_*_DLL_DIR
# where * - is TBB or TBBMALLOC
# Achive include directory.
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
endif()
if (EXISTS "${TBB_INCLUDE_DIR}")
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
endif()
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
WIN_TBB_PARSE("TBB::${LIB_LOWER}" "${LIB_UPPER}" "LIBRARY")
WIN_TBB_PARSE("TBB::${LIB_LOWER}" "${LIB_UPPER}" "DLL")
endforeach()
else()
# Here we should set:
# - 3RDPARTY_*_LIBRARY
# - 3RDPARTY_*_LIBRARY_DIR
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
LIN_TBB_PARSE("TBB::${LIB_LOWER}" "${LIB_UPPER}")
endforeach()
endif()
# install tbb/tbbmalloc
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
if (SINGLE_GENERATOR)
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
endforeach()
else()
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_BIN}d")
endforeach()
# Achive *.so files and directory containing it.
get_target_property (TBB_SO_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
# Reserve cache variable for *.so.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.so)")
endif()
else()
if (SINGLE_GENERATOR)
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
# Reserve cache variable for directory containing *.so file.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.so)")
endif()
if (EXISTS "${TBB_SO_FILE}")
set (3RDPARTY_${LIB_UPPER}_LIBRARY
"${TBB_SO_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.so)"
FORCE)
get_filename_component (TBB_SO_FILE_DIRECTORY "${TBB_SO_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
"${TBB_SO_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.so)"
FORCE)
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
endif()
# install *.so* (tbb & tbbmalloc)
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} DESTINATION "${INSTALL_DIR_LIB}")
endforeach()
else()
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
else()
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_LIB}d")
endforeach()
endif()
endif()
endif()
endif()
foreach (LIB IN LISTS CSF_TBB)
string(TOUPPER "${LIB}" LIB_UPPER)
mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
endforeach()
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
endforeach()
if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "")
else()
# the *.so* directory for using by the executable
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
endif()
endif()

View File

@@ -1331,7 +1331,7 @@ Therefore if the user of *NCollection* does not specify any allocator as a param
Nevertheless, it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for this algorithm.
As one possible choice, the class *NCollection_IncAllocator* is included.
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory.
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 12kB) and the allocator keeps track of the amount of occupied memory.
The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value.
Memory is only released in the destructor of *NCollection_IncAllocator*, the method *Free* is empty.
If used properly, this Allocator can greatly improve the performance of specific algorithms.

View File

@@ -221,7 +221,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importModel( const int format, cons
shapes = importSTEP( file );
break;
}
} catch ( Standard_Failure ) {
} catch ( const Standard_Failure& ) {
shapes.Nullify();
}
return shapes;
@@ -256,7 +256,7 @@ bool Translate::exportModel( const int format, const QString& file, const Handle
case FormatSTL: return exportSTL ( file, shapes );
case FormatVRML: return exportVRML( file, shapes );
}
} catch ( Standard_Failure ) {
} catch ( const Standard_Failure& ) {
//
}
return false;
@@ -528,26 +528,26 @@ bool Translate::exportSTL( const QString& file, const Handle(TopTools_HSequenceO
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
}
builder.Add( res, shape );
}
builder.Add( res, shape );
}
StlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
StlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
return true;
}
@@ -557,26 +557,26 @@ bool Translate::exportVRML( const QString& file, const Handle(TopTools_HSequence
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = QObject::tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
}
builder.Add( res, shape );
}
builder.Add( res, shape );
}
VrmlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
VrmlAPI_Writer writer;
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
return true;
}

View File

@@ -42,12 +42,14 @@
#include <TopTools_SequenceOfShape.hxx>
#include <stdio.h>
//#define OCCT_DEBUG_ALGO
//#define DRAW
#ifdef DRAW
#include <DBRep.hxx>
#pragma comment(lib,"TKDraw")
#endif
#ifdef OCCT_DEBUG_ALGO
Standard_Boolean AffichLoop = Standard_False;
Standard_Boolean AffichLoop = Standard_True;
Standard_Integer NbLoops = 0;
Standard_Integer NbWires = 1;
static char* name = new char[100];
@@ -58,7 +60,8 @@ static char* name = new char[100];
//purpose :
//=======================================================================
BRepAlgo_Loop::BRepAlgo_Loop()
BRepAlgo_Loop::BRepAlgo_Loop():
myTolConf (0.001)
{
}
@@ -185,7 +188,6 @@ static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E,
Standard_Boolean OnStart = 0, OnEnd = 0;
//// modified by jgv, 13.04.04 for OCC5634 ////
TopExp::Vertices (E,V1,V2);
//Standard_Real Tol = Precision::Confusion();
Standard_Real Tol = BRep_Tool::Tolerance( V1 );
///////////////////////////////////////////////
@@ -427,13 +429,12 @@ static void StoreInMVE (const TopoDS_Face& F,
TopoDS_Edge& E,
TopTools_IndexedDataMapOfShapeListOfShape& MVE,
Standard_Boolean& YaCouture,
TopTools_DataMapOfShapeShape& VerticesForSubstitute )
TopTools_DataMapOfShapeShape& VerticesForSubstitute,
const Standard_Real theTolConf)
{
TopoDS_Vertex V1, V2, V;
TopTools_ListOfShape Empty;
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
// gp_Pnt P1, P2, P;
gp_Pnt P1, P;
BRep_Builder BB;
for (Standard_Integer iV = 1; iV <= MVE.Extent(); iV++)
@@ -449,7 +450,7 @@ static void StoreInMVE (const TopoDS_Face& F,
{
V1 = TopoDS::Vertex( itl.Value() );
P1 = BRep_Tool::Pnt( V1 );
if (P.IsEqual( P1, Tol ) && !V.IsSame(V1))
if (P.IsEqual( P1, theTolConf ) && !V.IsSame(V1))
{
V.Orientation( V1.Orientation() );
if (VerticesForSubstitute.IsBound( V1 ))
@@ -574,7 +575,7 @@ void BRepAlgo_Loop::Perform()
TopoDS_Edge& E = TopoDS::Edge(itl1.Value());
if (!Emap.Add(E))
continue;
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
}
}
}
@@ -586,7 +587,7 @@ void BRepAlgo_Loop::Perform()
for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) {
TopoDS_Edge& E = TopoDS::Edge(itl.Value());
if (DejaVu.Add(E))
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute, myTolConf);
}
#ifdef DRAW
@@ -626,42 +627,42 @@ void BRepAlgo_Loop::Perform()
//--------------------------------
RemovePendingEdges(MVE);
if (MVE.Extent() == 0) break;
if (MVE.Extent() == 0) break;
//--------------------------------
// Start edge.
//--------------------------------
EF = CE = TopoDS::Edge(MVE(1).First());
TopExp::Vertices(CE,V1,V2);
TopExp::Vertices(CE, V1, V2);
//--------------------------------
// VF vertex start of new wire
//--------------------------------
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1;}
else { CV = VF = V2;}
if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1; }
else { CV = VF = V2; }
if (!MVE.Contains(CV)) continue;
TopTools_ListOfShape& aListEdges = MVE.ChangeFromKey(CV);
for ( itl.Initialize(aListEdges); itl.More(); itl.Next()) {
for (itl.Initialize(aListEdges); itl.More(); itl.Next()) {
if (itl.Value().IsEqual(CE)) {
aListEdges.Remove(itl);
break;
aListEdges.Remove(itl);
break;
}
}
End = Standard_False;
End = Standard_False;
while (!End) {
//-------------------------------
// Construction of a wire.
//-------------------------------
TopExp::Vertices(CE,V1,V2);
TopExp::Vertices(CE, V1, V2);
if (!CV.IsSame(V1)) CV = V1; else CV = V2;
B.Add (NW,CE);
B.Add(NW, CE);
UsedEdges.Add(CE);
if (!MVE.Contains(CV) || MVE.FindFromKey(CV).IsEmpty()) {
End = Standard_True;
}
else {
End = !SelectEdge(myFace,CE,CV,NE,MVE.ChangeFromKey(CV));
End = !SelectEdge(myFace, CE, CV, NE, MVE.ChangeFromKey(CV));
if (!End) {
CE = NE;
if (MVE.FindFromKey(CV).IsEmpty())
@@ -672,35 +673,41 @@ void BRepAlgo_Loop::Perform()
//--------------------------------------------------
// Add new wire to the set of wires
//------------------------------------------------
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
TopExp_Explorer explo( NW, TopAbs_VERTEX );
for (; explo.More(); explo.Next())
{
const TopoDS_Vertex& aV = TopoDS::Vertex( explo.Current() );
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &(aV).TShape());
TV->Tolerance( Tol );
TV->Modified( Standard_True );
}
for (explo.Init( NW, TopAbs_EDGE ); explo.More(); explo.Next())
{
const TopoDS_Edge& aE = TopoDS::Edge( explo.Current() );
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &(aE).TShape());
TE->Tolerance( Tol );
TE->Modified( Standard_True );
}
if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
if (VF.IsSame(CV))
{
NW.Closed (Standard_True);
myNewWires.Append (NW);
if (SamePnt2d(VF, EF, CE, myFace))
{
NW.Closed(Standard_True);
myNewWires.Append(NW);
}
else if(BRep_Tool::Tolerance(VF) < myTolConf)
{
BRep_Builder aBB;
aBB.UpdateVertex(VF, myTolConf);
if (SamePnt2d(VF, EF, CE, myFace))
{
NW.Closed(Standard_True);
myNewWires.Append(NW);
}
#ifdef OCCT_DEBUG_ALGO
else
{
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
if (AffichLoop)
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
}
#endif
}
}
#ifdef OCCT_DEBUG_ALGO
else {
std::cout <<"BRepAlgo_Loop: Open Wire"<<std::endl;
std::cout << "BRepAlgo_Loop: Open Wire" << std::endl;
if (AffichLoop)
std::cout << "OpenWire is : NW_"<<NbLoops<<"_"<<NbWires<<std::endl;
}
std::cout << "OpenWire is : NW_" << NbLoops << "_" << NbWires << std::endl;
}
#endif
#ifdef DRAW
if (AffichLoop) {
sprintf(name,"NW_%d_%d",NbLoops,NbWires++);
@@ -777,8 +784,6 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
VF = TopoDS::Vertex(aLocalV);
aLocalV = VCEI.Oriented(TopAbs_REVERSED);
VL = TopoDS::Vertex(aLocalV);
// VF = TopoDS::Vertex(VCEI.Oriented(TopAbs_FORWARD));
// VL = TopoDS::Vertex(VCEI.Oriented(TopAbs_REVERSED));
}
SV.Prepend(VF);
SV.Append(VL);
@@ -813,13 +818,9 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
B.Add (NewEdge,aLocalEdge);
aLocalEdge = V2.Oriented(TopAbs_REVERSED);
B.Add (TopoDS::Edge(NewEdge),aLocalEdge);
// B.Add (NewEdge,V1.Oriented(TopAbs_FORWARD));
// B.Add (NewEdge,V2.Oriented(TopAbs_REVERSED));
if (V1.IsSame(VF))
U1 = f;
else
// U1=BRep_Tool::Parameter
// (TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),WE);
{
TopoDS_Shape aLocalV = V1.Oriented(TopAbs_INTERNAL);
U1=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
@@ -830,8 +831,6 @@ void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
{
TopoDS_Shape aLocalV = V2.Oriented(TopAbs_INTERNAL);
U2=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
// U2=BRep_Tool::Parameter
// (TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),WE);
}
B.Range (TopoDS::Edge(NewEdge),U1,U2);
#ifdef DRAW

View File

@@ -86,8 +86,17 @@ public:
Standard_EXPORT void VerticesForSubstitute (TopTools_DataMapOfShapeShape& VerVerMap);
//! Set maximal tolerance used for comparing distaces between vertices.
void SetTolConf(const Standard_Real theTolConf)
{
myTolConf = theTolConf;
}
//! Get maximal tolerance used for comparing distaces between vertices.
Standard_Real GetTolConf() const
{
return myTolConf;
}
protected:
@@ -108,6 +117,7 @@ private:
TopTools_DataMapOfShapeListOfShape myCutEdges;
TopTools_DataMapOfShapeShape myVerticesForSubstitute;
BRepAlgo_Image myImageVV;
Standard_Real myTolConf;
};

View File

@@ -51,7 +51,7 @@ public:
Standard_EXPORT BRepBlend_CSWalking(const Handle(Adaptor3d_Curve)& Curv, const Handle(Adaptor3d_Surface)& Surf, const Handle(Adaptor3d_TopolTool)& Domain);
Standard_EXPORT void Perform (Blend_CSFunction& F, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT void Perform (Blend_CSFunction& F, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real Tol3d, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT Standard_Boolean Complete (Blend_CSFunction& F, const Standard_Real Pmin);
@@ -80,7 +80,7 @@ private:
Handle(Adaptor3d_Surface) surf;
Handle(Adaptor3d_Curve) curv;
Handle(Adaptor3d_TopolTool) domain;
Standard_Real tolesp;
Standard_Real tolpoint3d;
Standard_Real tolgui;
Standard_Real pasmax;
Standard_Real fleche;

View File

@@ -173,7 +173,7 @@ BRepBlend_RstRstLineBuilder::BRepBlend_RstRstLineBuilder
done(Standard_False), sol(1, 2), surf1(Surf1),
domain1(Domain1), surf2(Surf2),
domain2(Domain2), rst1(Rst1), rst2(Rst2),
tolesp(0.0), tolgui(0.0), pasmax(0.0),
tolpoint3d(0.0), tolgui(0.0), pasmax(0.0),
fleche(0.0), param(0.0), rebrou(Standard_False),
iscomplete(Standard_False), comptra(Standard_False), sens(0.0),
decrochdeb(Blend_NoDecroch), decrochfin(Blend_NoDecroch)
@@ -193,9 +193,9 @@ void BRepBlend_RstRstLineBuilder::Perform(Blend_RstRstFunction& Func,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
const Standard_Real Tol3d,
const Standard_Real TolGuide,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Fleche,
const Standard_Boolean Appro)
{
@@ -203,7 +203,7 @@ void BRepBlend_RstRstLineBuilder::Perform(Blend_RstRstFunction& Func,
iscomplete = Standard_False;
comptra = Standard_False;
line = new BRepBlend_Line();
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolgui = Abs(TolGuide);
fleche = Abs(Fleche);
rebrou = Standard_False;
@@ -225,7 +225,7 @@ void BRepBlend_RstRstLineBuilder::Perform(Blend_RstRstFunction& Func,
TopAbs_State siturst1, siturst2;
Blend_DecrochStatus decroch;
math_Vector tolerance(1, 2), infbound(1, 2), supbound(1, 2);
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
Func.GetBounds(infbound, supbound);
math_FunctionSetRoot rsnld(Func, tolerance, 30);
@@ -258,9 +258,9 @@ void BRepBlend_RstRstLineBuilder::Perform(Blend_RstRstFunction& Func,
U = previousP.ParameterOnC1();
V = previousP.ParameterOnC2();
BRepBlend_Extremity ptf1 (previousP.PointOnC1(),
U, previousP.Parameter(),tolesp);
U, previousP.Parameter(),tolpoint3d);
BRepBlend_Extremity ptf2 (previousP.PointOnC2(),
V, previousP.Parameter(),tolesp);
V, previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint()) {
ptf1.SetTangent(previousP.TangentOnC1());
ptf2.SetTangent(previousP.TangentOnC2());
@@ -291,7 +291,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
const Standard_Real Pdep,
const Standard_Real Pmax,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Tol3d,
const Standard_Real TolGuide,
const Standard_Boolean RecRst1,
const Standard_Boolean RecP1,
@@ -304,7 +304,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
iscomplete = Standard_False;
comptra = Standard_False;
line = new BRepBlend_Line();
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolgui = Abs(TolGuide);
rebrou = Standard_False;
@@ -327,7 +327,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::PerformFirstSection
wp1 = wp2 = wrst1 = wrst2 = Pmax;
param = Pdep;
Func.Set(param);
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
Func.GetBounds(infbound, supbound);
math_FunctionSetRoot rsnld(Func, tolerance, 30);
@@ -573,7 +573,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction& Func,
//IntSurf_Transition Tline, Tarc;
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
Func.GetBounds(infbound, supbound);
math_FunctionSetRoot rsnld(Func, tolerance, 30);
@@ -595,14 +595,14 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction& Func,
if (rsnld.IsDone()) {
rsnld.Root(sol);
Blend_Point bp1;
if(BBPP(param, Func, sol, tolesp, bp1)){
if(BBPP(param, Func, sol, tolpoint3d, bp1)){
Standard_Real dw = 1.e-10;
Func.Set(param + dw);
rsnld.Perform(Func, parinit, infbound, supbound);
if (rsnld.IsDone()) {
rsnld.Root(sol);
Blend_Point bp2;
if(BBPP(param + dw, Func, sol, tolesp, bp2)){
if(BBPP(param + dw, Func, sol, tolpoint3d, bp2)){
tracederiv(Func, bp1, bp2);
}
}
@@ -854,7 +854,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction& Func,
Arrive = Standard_True;
Extrst1.SetValue(previousP.PointOnC1(),
previousP.ParameterOnC1(),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
MakeExtremity(Extrst2, Standard_False, rst2, sol(2), IsVtxrst2, Vtxrst2);
// Show that end is on Bound.
}
@@ -873,10 +873,10 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction& Func,
if (Abs(stepw) < tolgui) {
Extrst1.SetValue(previousP.PointOnC1(),
previousP.ParameterOnC1(),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
Extrst2.SetValue(previousP.PointOnC2(),
previousP.ParameterOnC2(),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
Arrive = Standard_True;
#ifdef OCCT_DEBUG
if (line->NbPoints()>=2) {
@@ -913,7 +913,7 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction& Func,
Arrive = Standard_True;
Extrst1.SetValue(previousP.PointOnC1(),
previousP.ParameterOnC1(),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
MakeExtremity(Extrst2, Standard_False, rst2, sol(2), IsVtxrst2, Vtxrst2);
// Indicate that end is on Bound.
}
@@ -993,10 +993,10 @@ void BRepBlend_RstRstLineBuilder::InternalPerform(Blend_RstRstFunction& Func,
#endif
Extrst1.SetValue(previousP.PointOnC1(),
previousP.ParameterOnC1(),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
Extrst2.SetValue(previousP.PointOnC2(),
previousP.ParameterOnC2(),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
Arrive = Standard_True;
}
break;
@@ -1029,7 +1029,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&
Handle(Adaptor3d_HVertex)& Vtx)
{
math_Vector toler(1, 3), infb(1, 3), supb(1, 3);
Finv.GetTolerance(toler, tolesp);
Finv.GetTolerance(toler, tolpoint3d);
Finv.GetBounds(infb, supb);
Solinv(1) = param;
Solinv(2) = sol(2);
@@ -1049,7 +1049,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&
// It is necessary to check if the function value meets the
// second restriction
if (Finv.IsSolution(Solinv, tolesp)) {
if (Finv.IsSolution(Solinv, tolpoint3d)) {
Standard_Real w = Solinv(2);
if(w < rst2->FirstParameter() - toler(2)||
w > rst2->LastParameter() + toler(2)){
@@ -1079,7 +1079,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_RstRstFunction&
math_Vector infbound(1, 2), supbound(1, 2);
math_Vector parinit(1, 2), tolerance(1, 2);
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
Func.GetBounds(infbound, supbound);
math_FunctionSetRoot rsnld2(Func, tolerance, 30);
@@ -1112,7 +1112,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_RstRstFunction&
Handle(Adaptor3d_HVertex)& Vtx)
{
math_Vector toler(1, 3), infb(1, 3), supb(1, 3);
Finv.GetTolerance(toler, tolesp);
Finv.GetTolerance(toler, tolpoint3d);
Finv.GetBounds(infb, supb);
Solinv(1) = param;
Solinv(2) = sol(1);
@@ -1130,7 +1130,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_RstRstFunction&
rsnld.Root(Solinv);
// It is necessary to check the value of the function
if (Finv.IsSolution(Solinv, tolesp)) {
if (Finv.IsSolution(Solinv, tolpoint3d)) {
Standard_Real w = Solinv(2);
if(w < rst1->FirstParameter() - toler(2)||
w > rst1->LastParameter() + toler(2)){
@@ -1159,7 +1159,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_RstRstFunction&
math_Vector infbound(1, 2), supbound(1, 2);
math_Vector parinit(1,2), tolerance(1,2);
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
Func.GetBounds(infbound, supbound);
math_FunctionSetRoot rsnld2(Func, tolerance, 30);
@@ -1199,7 +1199,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_CurvPointFuncInv&
FinvP.Set(thepoint);
math_Vector toler(1,2), infb(1, 2), supb(1, 2);
FinvP.GetTolerance(toler, tolesp);
FinvP.GetTolerance(toler, tolpoint3d);
FinvP.GetBounds(infb, supb);
Solinv(1) = param;
Solinv(2) = sol(2);
@@ -1214,7 +1214,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre1(Blend_CurvPointFuncInv&
}
rsnld.Root(Solinv);
if(FinvP.IsSolution(Solinv, tolesp)){
if(FinvP.IsSolution(Solinv, tolpoint3d)){
gp_Pnt2d p2drst2 = rst2->Value(Solinv(2));
TopAbs_State situ = domain2->Classify(p2drst2, toler(2), 0);
if ((situ != TopAbs_IN) && (situ != TopAbs_ON)) {
@@ -1267,7 +1267,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_CurvPointFuncInv&
FinvP.Set(thepoint);
math_Vector toler(1,2), infb(1, 2), supb(1, 2);
FinvP.GetTolerance(toler, tolesp);
FinvP.GetTolerance(toler, tolpoint3d);
FinvP.GetBounds(infb, supb);
Solinv(1) = param;
Solinv(2) = sol(1);
@@ -1282,7 +1282,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::Recadre2(Blend_CurvPointFuncInv&
}
rsnld.Root(Solinv);
if(FinvP.IsSolution(Solinv, tolesp)){
if(FinvP.IsSolution(Solinv, tolpoint3d)){
gp_Pnt2d p2drst1 = rst1->Value(Solinv(2));
TopAbs_State situ = domain1->Classify(p2drst1, toler(2), 0);
if ((situ != TopAbs_IN) && (situ != TopAbs_ON)) {
@@ -1378,7 +1378,7 @@ void BRepBlend_RstRstLineBuilder::MakeExtremity(BRepBlend_Extremity&
if (OnFirst) {
Extrem.SetValue(previousP.PointOnC1(),
sol(1),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnC1());
Iter = domain1;
@@ -1386,7 +1386,7 @@ void BRepBlend_RstRstLineBuilder::MakeExtremity(BRepBlend_Extremity&
else {
Extrem.SetValue(previousP.PointOnC2(),
sol(2),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnC1());
Iter = domain2;
@@ -1453,12 +1453,13 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst1(const Blend_Poin
Norme = Corde.SquareMagnitude();
if (!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp * tolesp) {
const Standard_Real toler3d = 0.01 * tolpoint3d;
if (Norme <= toler3d * toler3d) {
// it can be necessary to force the same point
return Blend_SamePoints;
}
if(!prevpointistangent){
if (prevNorme <= tolesp * tolesp) {
if (prevNorme <= toler3d * toler3d) {
return Blend_SamePoints;
}
Cosi = sens * Corde * prevTg;
@@ -1530,12 +1531,13 @@ Blend_Status BRepBlend_RstRstLineBuilder::CheckDeflectionOnRst2(const Blend_Poin
Norme = Corde.SquareMagnitude();
if (!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp * tolesp){
const Standard_Real toler3d = 0.01 * tolpoint3d;
if (Norme <= toler3d * toler3d){
// it can be necessary to force the same point
return Blend_SamePoints;
}
if (!prevpointistangent) {
if (prevNorme <= tolesp * tolesp) {
if (prevNorme <= toler3d * toler3d) {
return Blend_SamePoints;
}
Cosi = sens * Corde * prevTg;
@@ -1597,7 +1599,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::TestArret(Blend_RstRstFunction& Func,
IntSurf_TypeTrans trarst1 = IntSurf_Undecided, trarst2 = IntSurf_Undecided;
Blend_Point curpoint;
if (Func.IsSolution(sol, tolesp)) {
if (Func.IsSolution(sol, tolpoint3d)) {
Standard_Boolean curpointistangent = Func.IsTangencyPoint();
ptrst1 = Func.PointOnRst1();
ptrst2 = Func.PointOnRst2();
@@ -1644,7 +1646,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::TestArret(Blend_RstRstFunction& Func,
Standard_Real testra = tg2drst1.Dot(tg2drstref);
TopAbs_Orientation Or = domain1->Orientation(rst1);
if (Abs(testra) > tolesp) {
if (Abs(testra) > tolpoint3d) {
if (testra < 0.) {
trarst1 = ConvOrToTra(TopAbs::Reverse(Or));
}
@@ -1656,7 +1658,7 @@ Blend_Status BRepBlend_RstRstLineBuilder::TestArret(Blend_RstRstFunction& Func,
testra = tg2drst2.Dot(tg2drstref);
Or = domain2->Orientation(rst2);
if (Abs(testra) > tolesp) {
if (Abs(testra) > tolpoint3d) {
if (testra < 0.) {
trarst2 = ConvOrToTra(TopAbs::Reverse(Or));
}
@@ -1705,7 +1707,7 @@ Standard_Boolean BRepBlend_RstRstLineBuilder::CheckInside(Blend_RstRstFunction&
{
// Standard_Boolean inside = Standard_True;
math_Vector tolerance(1, 2);
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
//face pcurve 1.
Standard_Real v = sol(1);

View File

@@ -72,9 +72,9 @@ public:
Standard_EXPORT BRepBlend_RstRstLineBuilder(const Handle(Adaptor3d_Surface)& Surf1, const Handle(Adaptor2d_Curve2d)& Rst1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_Surface)& Surf2, const Handle(Adaptor2d_Curve2d)& Rst2, const Handle(Adaptor3d_TopolTool)& Domain2);
Standard_EXPORT void Perform (Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& Finv1, Blend_CurvPointFuncInv& FinvP1, Blend_SurfCurvFuncInv& Finv2, Blend_CurvPointFuncInv& FinvP2, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT void Perform (Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& Finv1, Blend_CurvPointFuncInv& FinvP1, Blend_SurfCurvFuncInv& Finv2, Blend_CurvPointFuncInv& FinvP2, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real Tol3d, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& Finv1, Blend_CurvPointFuncInv& FinvP1, Blend_SurfCurvFuncInv& Finv2, Blend_CurvPointFuncInv& FinvP2, const Standard_Real Pdep, const Standard_Real Pmax, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real TolGuide, const Standard_Boolean RecRst1, const Standard_Boolean RecP1, const Standard_Boolean RecRst2, const Standard_Boolean RecP2, Standard_Real& Psol, math_Vector& ParSol);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& Finv1, Blend_CurvPointFuncInv& FinvP1, Blend_SurfCurvFuncInv& Finv2, Blend_CurvPointFuncInv& FinvP2, const Standard_Real Pdep, const Standard_Real Pmax, const math_Vector& Soldep, const Standard_Real Tol3d, const Standard_Real TolGuide, const Standard_Boolean RecRst1, const Standard_Boolean RecP1, const Standard_Boolean RecRst2, const Standard_Boolean RecP2, Standard_Real& Psol, math_Vector& ParSol);
Standard_EXPORT Standard_Boolean Complete (Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& Finv1, Blend_CurvPointFuncInv& FinvP1, Blend_SurfCurvFuncInv& Finv2, Blend_CurvPointFuncInv& FinvP2, const Standard_Real Pmin);
@@ -134,7 +134,7 @@ private:
Handle(Adaptor3d_TopolTool) domain2;
Handle(Adaptor2d_Curve2d) rst1;
Handle(Adaptor2d_Curve2d) rst2;
Standard_Real tolesp;
Standard_Real tolpoint3d;
Standard_Real tolgui;
Standard_Real pasmax;
Standard_Real fleche;

View File

@@ -210,7 +210,7 @@ BRepBlend_SurfRstLineBuilder::BRepBlend_SurfRstLineBuilder
const Handle(Adaptor3d_TopolTool)& Domain2):
done(Standard_False), sol(1, 3), surf1(Surf1),
domain1(Domain1), surf2(Surf2), rst(Rst),
domain2(Domain2), tolesp(0.0), tolgui(0.0),
domain2(Domain2), tolpoint3d(0.0), tolpoint2d(0.0), tolgui(0.0),
pasmax(0.0), fleche(0.0), param(0.0),
rebrou(Standard_False), iscomplete(Standard_False),
comptra(Standard_False), sens(0.0),
@@ -230,9 +230,10 @@ void BRepBlend_SurfRstLineBuilder::Perform(Blend_SurfRstFunction& Func,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
const Standard_Real Tol3d,
const Standard_Real Tol2d,
const Standard_Real TolGuide,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Fleche,
const Standard_Boolean Appro)
{
@@ -240,7 +241,8 @@ void BRepBlend_SurfRstLineBuilder::Perform(Blend_SurfRstFunction& Func,
iscomplete = Standard_False;
comptra = Standard_False;
line = new BRepBlend_Line();
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolpoint2d = Tol2d;
tolgui = Abs(TolGuide);
fleche = Abs(Fleche);
rebrou = Standard_False;
@@ -262,7 +264,7 @@ void BRepBlend_SurfRstLineBuilder::Perform(Blend_SurfRstFunction& Func,
TopAbs_State siturst,situs;
Standard_Boolean decroch;
math_Vector tolerance(1,3),infbound(1,3),supbound(1,3);
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
@@ -296,9 +298,9 @@ void BRepBlend_SurfRstLineBuilder::Perform(Blend_SurfRstFunction& Func,
// W = previousP.ParameterOnC();
BRepBlend_Extremity ptf1(previousP.PointOnS(),
U,V,previousP.Parameter(),tolesp);
U,V,previousP.Parameter(),tolpoint3d);
BRepBlend_Extremity ptf2(previousP.PointOnC(),
U,V,previousP.Parameter(),tolesp);
U,V,previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint()) {
ptf1.SetTangent(previousP.TangentOnS());
ptf2.SetTangent(previousP.TangentOnC());
@@ -327,7 +329,8 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::PerformFirstSection
const Standard_Real Pdep,
const Standard_Real Pmax,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Tol3d,
const Standard_Real Tol2d,
const Standard_Real TolGuide,
const Standard_Boolean RecRst,
const Standard_Boolean RecP,
@@ -339,7 +342,8 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::PerformFirstSection
iscomplete = Standard_False;
comptra = Standard_False;
line = new BRepBlend_Line();
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolpoint2d = Tol2d;
tolgui = Abs(TolGuide);
rebrou = Standard_False;
@@ -362,7 +366,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::PerformFirstSection
wp = wrst = ws = Pmax;
param = Pdep;
Func.Set(param);
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
@@ -536,7 +540,7 @@ void BRepBlend_SurfRstLineBuilder::InternalPerform(Blend_SurfRstFunction& Func,
//IntSurf_Transition Tline,Tarc;
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
@@ -558,14 +562,14 @@ void BRepBlend_SurfRstLineBuilder::InternalPerform(Blend_SurfRstFunction& Func,
if (rsnld.IsDone()) {
rsnld.Root(sol);
Blend_Point bp1;
if(BBPP(param,Func,sol,tolesp,bp1)){
if(BBPP(param,Func,sol,tolpoint3d,bp1)){
Standard_Real dw = 1.e-10;
Func.Set(param+dw);
rsnld.Perform(Func,parinit,infbound,supbound);
if (rsnld.IsDone()) {
rsnld.Root(sol);
Blend_Point bp2;
if(BBPP(param+dw,Func,sol,tolesp,bp2)){
if(BBPP(param+dw,Func,sol,tolpoint3d,bp2)){
tracederiv(Func,bp1,bp2);
}
}
@@ -746,7 +750,7 @@ void BRepBlend_SurfRstLineBuilder::InternalPerform(Blend_SurfRstFunction& Func,
Arrive = Standard_True;
Exts.SetValue(previousP.PointOnS(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
MakeExtremity(Extrst,Standard_False,rst,sol(3),IsVtxrst,Vtxrst);
// Indicate end on Bound.
}
@@ -765,10 +769,10 @@ void BRepBlend_SurfRstLineBuilder::InternalPerform(Blend_SurfRstFunction& Func,
if (Abs(stepw) < tolgui) {
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Extrst.SetValue(previousP.PointOnC(),
previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Arrive = Standard_True;
if (line->NbPoints()>=2) {
// Indicate that one stops during the processing
@@ -804,7 +808,7 @@ void BRepBlend_SurfRstLineBuilder::InternalPerform(Blend_SurfRstFunction& Func,
if (param == Bound) {
Arrive = Standard_True;
Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
MakeExtremity(Extrst,Standard_False,rst,sol(3),IsVtxrst,Vtxrst);
// Indicate end on Bound.
}
@@ -850,7 +854,7 @@ void BRepBlend_SurfRstLineBuilder::InternalPerform(Blend_SurfRstFunction& Func,
line->Prepend(previousP);
}
Exts.SetValue(previousP.PointOnS(),sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
MakeExtremity(Extrst,Standard_False,rst,sol(3),IsVtxrst,Vtxrst);
Arrive = Standard_True;
}
@@ -883,10 +887,10 @@ void BRepBlend_SurfRstLineBuilder::InternalPerform(Blend_SurfRstFunction& Func,
#endif
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Extrst.SetValue(previousP.PointOnC(),
previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Arrive = Standard_True;
}
break;
@@ -941,7 +945,10 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfCurvFuncInv&
FinvC.Set(Arc);
math_Vector toler(1,3),infb(1,3),supb(1,3);
FinvC.GetTolerance(toler,tolesp);
// use reduced Tol argument value to pass testcase
// blend complex A6 with scale factor of model 0.1 (base scale = 1000)
// So, here we using 1.0e-5 rather than 1.0e-4 of tolerance of point in 3d
FinvC.GetTolerance(toler,0.1 * tolpoint3d);
FinvC.GetBounds(infb,supb);
Solinv(1) = param;
Solinv(2) = sol(3);
@@ -958,7 +965,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfCurvFuncInv&
else {
// It is necessary to check the value of the function
rsnld.Root(Solinv);
recadre = FinvC.IsSolution(Solinv,tolesp);
recadre = FinvC.IsSolution(Solinv,tolpoint3d);
}
// In case of fail, it is checked if another arc
@@ -981,7 +988,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfCurvFuncInv&
Arc = domain1->Value();
FinvC.Set(Arc);
FinvC.GetTolerance(toler,tolesp);
FinvC.GetTolerance(toler,tolpoint3d);
FinvC.GetBounds(infb,supb);
Solinv(3) = pmin;
@@ -997,7 +1004,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfCurvFuncInv&
else {
// It is necessary to check the value of the function
aRsnld.Root(Solinv);
recadre = FinvC.IsSolution(Solinv,tolesp);
recadre = FinvC.IsSolution(Solinv,tolpoint3d);
}
}
@@ -1041,7 +1048,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfRstFunction&
Handle(Adaptor3d_HVertex)& Vtx)
{
math_Vector toler(1,4),infb(1,4),supb(1,4);
Finv.GetTolerance(toler,tolesp);
Finv.GetTolerance(toler,tolpoint3d);
Finv.GetBounds(infb,supb);
Solinv(1) = sol(3);
Solinv(2) = param;
@@ -1058,9 +1065,9 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfRstFunction&
}
rsnld.Root(Solinv);
if(Finv.IsSolution(Solinv,tolesp)){
if(Finv.IsSolution(Solinv,tolpoint3d)){
gp_Pnt2d p2d(Solinv(3),Solinv(4));
TopAbs_State situ = domain1->Classify(p2d,Min(toler(3),toler(4)),0);
TopAbs_State situ = domain1->Classify(p2d,tolpoint2d,0);
if ((situ != TopAbs_IN) && (situ != TopAbs_ON)) {
return Standard_False;
}
@@ -1086,7 +1093,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfRstFunction&
math_Vector infbound(1,3),supbound(1,3);
math_Vector parinit(1,3),tolerance(1,3);
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld2(Func,tolerance,30);
@@ -1126,7 +1133,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfPointFuncInv&
FinvP.Set(thepoint);
math_Vector toler(1,3),infb(1,3),supb(1,3);
FinvP.GetTolerance(toler,tolesp);
FinvP.GetTolerance(toler,tolpoint3d);
FinvP.GetBounds(infb,supb);
Solinv(1) = param;
Solinv(2) = sol(1);
@@ -1142,9 +1149,9 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::Recadre(Blend_SurfPointFuncInv&
}
rsnld.Root(Solinv);
if(FinvP.IsSolution(Solinv,tolesp)){
if(FinvP.IsSolution(Solinv,tolpoint3d)){
gp_Pnt2d p2d(Solinv(2),Solinv(3));
TopAbs_State situ = domain1->Classify(p2d,Min(toler(2),toler(3)),0);
TopAbs_State situ = domain1->Classify(p2d,tolpoint2d,0);
if ((situ != TopAbs_IN) && (situ != TopAbs_ON)) {
return Standard_False;
}
@@ -1237,7 +1244,7 @@ void BRepBlend_SurfRstLineBuilder::MakeExtremity(BRepBlend_Extremity&
if (OnFirst) {
Extrem.SetValue(previousP.PointOnS(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnS());
Iter = domain1;
@@ -1245,7 +1252,7 @@ void BRepBlend_SurfRstLineBuilder::MakeExtremity(BRepBlend_Extremity&
else {
Extrem.SetValue(previousP.PointOnC(),
sol(3),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnC());
Iter = domain2;
@@ -1312,12 +1319,13 @@ Blend_Status BRepBlend_SurfRstLineBuilder::CheckDeflectionOnSurf(const Blend_Poi
// if(!curpointistangent) curNorme = Tgsurf.SquareMagnitude();
if(!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp*tolesp){
const Standard_Real toler3d = 0.01 * tolpoint3d;
if (Norme <= toler3d * toler3d){
// it can be necessary to force same point
return Blend_SamePoints;
}
if(!prevpointistangent){
if(prevNorme <= tolesp*tolesp) {
if(prevNorme <= toler3d * toler3d) {
return Blend_SamePoints;
}
Cosi = sens*Corde*prevTg;
@@ -1388,12 +1396,13 @@ Blend_Status BRepBlend_SurfRstLineBuilder::CheckDeflectionOnRst(const Blend_Poin
// if(!curpointistangent) curNorme = Tgsurf.SquareMagnitude();
if(!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp*tolesp){
const Standard_Real toler3d = 0.01 * tolpoint3d;
if (Norme <= toler3d * toler3d){
// it can be necessary to force same point
return Blend_SamePoints;
}
if(!prevpointistangent){
if(prevNorme <= tolesp*tolesp) {
if(prevNorme <= toler3d * toler3d) {
return Blend_SamePoints;
}
Cosi = sens*Corde*prevTg;
@@ -1455,7 +1464,7 @@ Blend_Status BRepBlend_SurfRstLineBuilder::TestArret(Blend_SurfRstFunction& Func
IntSurf_TypeTrans tras = IntSurf_Undecided, trarst = IntSurf_Undecided;
Blend_Point curpoint;
if (Func.IsSolution(sol,tolesp)) {
if (Func.IsSolution(sol,tolpoint3d)) {
Standard_Boolean curpointistangent = Func.IsTangencyPoint();
pts = Func.PointOnS();
ptrst = Func.PointOnRst();
@@ -1499,7 +1508,7 @@ Blend_Status BRepBlend_SurfRstLineBuilder::TestArret(Blend_SurfRstFunction& Func
Func.Decroch(sol,nors,tgsecs);
nors.Normalize();
Standard_Real testra = tgsecs.Dot(nors.Crossed(tgs));
if (Abs(testra) > tolesp) {
if (Abs(testra) > tolpoint3d) {
if (testra < 0.) {
tras = IntSurf_In;
}
@@ -1558,7 +1567,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::CheckInside(Blend_SurfRstFunction
Standard_Boolean& Decroch)
{
math_Vector tolerance(1,3);
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
//face pcurve.
Standard_Real w = sol(3);
if(w < rst->FirstParameter() - tolerance(3)||
@@ -1573,7 +1582,7 @@ Standard_Boolean BRepBlend_SurfRstLineBuilder::CheckInside(Blend_SurfRstFunction
//face surface
gp_Pnt2d p2d(sol(1),sol(2));
SituOnS = domain1->Classify(p2d,Min(tolerance(1),tolerance(2)),0);
SituOnS = domain1->Classify(p2d,tolpoint2d,0);
//lost contact
gp_Vec tgs,nors;

View File

@@ -71,9 +71,9 @@ public:
Standard_EXPORT BRepBlend_SurfRstLineBuilder(const Handle(Adaptor3d_Surface)& Surf1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_Surface)& Surf2, const Handle(Adaptor2d_Curve2d)& Rst, const Handle(Adaptor3d_TopolTool)& Domain2);
Standard_EXPORT void Perform (Blend_SurfRstFunction& Func, Blend_FuncInv& Finv, Blend_SurfPointFuncInv& FinvP, Blend_SurfCurvFuncInv& FinvC, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT void Perform (Blend_SurfRstFunction& Func, Blend_FuncInv& Finv, Blend_SurfPointFuncInv& FinvP, Blend_SurfCurvFuncInv& FinvC, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_SurfRstFunction& Func, Blend_FuncInv& Finv, Blend_SurfPointFuncInv& FinvP, Blend_SurfCurvFuncInv& FinvC, const Standard_Real Pdep, const Standard_Real Pmax, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real TolGuide, const Standard_Boolean RecRst, const Standard_Boolean RecP, const Standard_Boolean RecS, Standard_Real& Psol, math_Vector& ParSol);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_SurfRstFunction& Func, Blend_FuncInv& Finv, Blend_SurfPointFuncInv& FinvP, Blend_SurfCurvFuncInv& FinvC, const Standard_Real Pdep, const Standard_Real Pmax, const math_Vector& Soldep, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Real TolGuide, const Standard_Boolean RecRst, const Standard_Boolean RecP, const Standard_Boolean RecS, Standard_Real& Psol, math_Vector& ParSol);
Standard_EXPORT Standard_Boolean Complete (Blend_SurfRstFunction& Func, Blend_FuncInv& Finv, Blend_SurfPointFuncInv& FinvP, Blend_SurfCurvFuncInv& FinvC, const Standard_Real Pmin);
@@ -128,7 +128,8 @@ private:
Handle(Adaptor3d_Surface) surf2;
Handle(Adaptor2d_Curve2d) rst;
Handle(Adaptor3d_TopolTool) domain2;
Standard_Real tolesp;
Standard_Real tolpoint3d;
Standard_Real tolpoint2d;
Standard_Real tolgui;
Standard_Real pasmax;
Standard_Real fleche;

View File

@@ -58,11 +58,11 @@ public:
//! To define singular points computed before walking.
Standard_EXPORT void AddSingularPoint (const Blend_Point& P);
Standard_EXPORT void Perform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT void Perform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real Tol3d, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_Function& F, const Standard_Real Pdep, math_Vector& ParDep, const Standard_Real Tolesp, const Standard_Real TolGuide, TopAbs_State& Pos1, TopAbs_State& Pos2);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_Function& F, const Standard_Real Pdep, math_Vector& ParDep, const Standard_Real Tol3d, const Standard_Real TolGuide, TopAbs_State& Pos1, TopAbs_State& Pos2);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const math_Vector& ParDep, const Standard_Real Tolesp, const Standard_Real TolGuide, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, Standard_Real& Psol, math_Vector& ParSol);
Standard_EXPORT Standard_Boolean PerformFirstSection (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const math_Vector& ParDep, const Standard_Real Tol3d, const Standard_Real TolGuide, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, Standard_Real& Psol, math_Vector& ParSol);
Standard_EXPORT Standard_Boolean Continu (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real P);
@@ -131,7 +131,7 @@ private:
Standard_Boolean ToCorrectOnRst1;
Standard_Boolean ToCorrectOnRst2;
Standard_Real CorrectedParam;
Standard_Real tolesp;
Standard_Real tolpoint3d;
Standard_Real tolgui;
Standard_Real pasmax;
Standard_Real fleche;

View File

@@ -468,7 +468,14 @@ static void PERFORM_C0(const TopoDS_Edge& S1, const TopoDS_Edge& S2,
if (fabs(Dstmin - sqrt(Ext.SquareDistance(ii))) < Eps)
{
Pt = Ext.Point(ii);
if (TRI_SOLUTION(SeqSol2, Pt))
// Pt - point on the curve pCurvOther/Eother, but
// if iE == 0 -> Eother correspond to edge S2
// and to edge S1 in the opposite case.
// Therefore we should search Pt through previous solution points on Other curve (edge):
// if iE == 0 - on edge S2, namely through SeqSol2,
// else - on edge S1, namely through SeqSol1.
const bool triSolutionResult = (iE == 0) ? TRI_SOLUTION(SeqSol2, Pt) : TRI_SOLUTION(SeqSol1, Pt);
if (triSolutionResult)
{
// Check if the parameter does not correspond to a vertex
const Standard_Real t = Ext.Parameter(ii);
@@ -869,9 +876,19 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1,
if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty())
{
theSeqSolShape1.Append(seqSol1);
theSeqSolShape2.Append(seqSol2);
myModif = Standard_True;
BRepExtrema_SeqOfSolution::iterator anIt1 = seqSol1.begin();
BRepExtrema_SeqOfSolution::iterator anIt2 = seqSol2.begin();
for (; anIt1 != seqSol1.end() && anIt2 != seqSol2.end(); anIt1++, anIt2++)
{
gp_Pnt Pt1 = anIt1->Point();
gp_Pnt Pt2 = anIt2->Point();
if (TRI_SOLUTION(theSeqSolShape1, Pt1) || TRI_SOLUTION(theSeqSolShape2, Pt2))
{
theSeqSolShape1.Append(*anIt1);
theSeqSolShape2.Append(*anIt2);
myModif = Standard_True;
}
}
}
}

View File

@@ -43,6 +43,8 @@ BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool()
//=======================================================================
BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
@@ -55,6 +57,7 @@ BRepExtrema_ProximityDistTool::BRepExtrema_ProximityDistTool (const Handle(BRepE
{
LoadTriangleSets (theSet1, theSet2);
LoadShapeLists (theShapeList1, theShapeList2);
LoadAdditionalPointsFirstSet (theAddVertices1, theAddStatus1);
}
//=======================================================================
@@ -69,7 +72,7 @@ void BRepExtrema_ProximityDistTool::LoadTriangleSets (const Handle(BRepExtrema_T
}
//=======================================================================
//function : LoadTriangleSets
//function : LoadShapeLists
//purpose : Loads the given list of subshapes into the proximity tool
//=======================================================================
void BRepExtrema_ProximityDistTool::LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
@@ -78,23 +81,33 @@ void BRepExtrema_ProximityDistTool::LoadShapeLists (const BRepExtrema_ShapeList&
myShapeList1 = theShapeList1;
myShapeList2 = theShapeList2;
}
//=======================================================================
//function : Perform
//purpose : Performs searching of the proximity distance
//=======================================================================
void BRepExtrema_ProximityDistTool::Perform()
{
SetBVHSet (mySet2.get());
const BVH_Array3d& aVertices1 = mySet1->GetVertices();
Standard_Integer aVtxSize = (Standard_Integer)aVertices1.size();
//=======================================================================
//function : LoadAdditionalPointsFirstSet
//purpose : Loads given additional vertices and their statuses
//=======================================================================
void BRepExtrema_ProximityDistTool::LoadAdditionalPointsFirstSet (const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1)
{
myAddVertices1 = theAddVertices1;
myAddStatus1 = theAddStatus1;
}
//=======================================================================
//function : goThroughtSet1
//purpose : Goes throught vertices from the 1st set
//=======================================================================
void BRepExtrema_ProximityDistTool::goThroughtSet1 (const BVH_Array3d& theVertices1,
const Standard_Boolean theIsAdditionalSet)
{
Standard_Integer aVtxSize = (Standard_Integer)theVertices1.size();
Standard_Integer aVtxStep = Max (myNbSamples1 <= 0 ? 1 : aVtxSize / myNbSamples1, 1);
for (Standard_Integer aVtxIdx = 0; aVtxIdx < aVtxSize; aVtxIdx += aVtxStep)
{
myDistance = std::numeric_limits<Standard_Real>::max();
myMinDistance = std::numeric_limits<Standard_Real>::max();
myIsDone = Standard_False;
SetObject (aVertices1[aVtxIdx]);
SetObject (theVertices1[aVtxIdx]);
ComputeDistance();
@@ -102,20 +115,31 @@ void BRepExtrema_ProximityDistTool::Perform()
if (IsDone() && myDistance > myProxDist)
{
myPnt1 = aVertices1[aVtxIdx];
myPnt1 = theVertices1[aVtxIdx];
myPnt2 = myExtremaPoint;
myProxDist = myDistance;
myProxVtxIdx1 = aVtxIdx;
myIsProxVtx1FromAddSet = theIsAdditionalSet;
myProxPrjState = myExtPrjState;
}
}
}
myIsDone = myProxDist > -1.;
//=======================================================================
//function : Perform
//purpose : Performs searching of the proximity distance
//=======================================================================
void BRepExtrema_ProximityDistTool::Perform()
{
SetBVHSet (mySet2.get());
goThroughtSet1 (mySet1->GetVertices(), Standard_False);
goThroughtSet1 (myAddVertices1, Standard_True);
if (myIsDone)
{
DefineStatusProxPnt();
}
myIsDone = myProxDist > -1.;
if (myIsDone)
{
DefineStatusProxPnt();
}
}
static Standard_Real pointBoxSquareMaxDistance (const BVH_Vec3d& thePoint,
@@ -247,7 +271,12 @@ Standard_Real BRepExtrema_ProximityDistTool::ComputeDistance()
return myDistance;
}
static Standard_Boolean isNodeOnBorder (const Standard_Integer theNodeIdx, const Handle (Poly_Triangulation)& theTr)
//=======================================================================
//function : IsNodeOnBorder
//purpose : Returns true if the node is on the boarder
//=======================================================================
Standard_Boolean BRepExtrema_ProximityDistTool::IsNodeOnBorder (const Standard_Integer theNodeIdx,
const Handle(Poly_Triangulation)& theTr)
{
Poly_Connect aPolyConnect (theTr);
@@ -279,12 +308,49 @@ static Standard_Boolean isNodeOnBorder (const Standard_Integer theNodeIdx, const
return Standard_False;
}
//=======================================================================
//function : IsEdgeOnBorder
//purpose : Returns true if the edge is on the boarder
//=======================================================================
Standard_Boolean BRepExtrema_ProximityDistTool::IsEdgeOnBorder (const Standard_Integer theTrgIdx,
const Standard_Integer theFirstEdgeNodeIdx,
const Standard_Integer theSecondEdgeNodeIdx,
const Handle(Poly_Triangulation)& theTr)
{
Poly_Connect aPolyConnect (theTr);
Standard_Integer aAdjTrg[3];
aPolyConnect.Triangles (theTrgIdx, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
for (Standard_Integer j = 0; j < 3; j++)
{
Standard_Integer k = (j + 1) % 3;
if (aAdjTrg[j] == 0) //free segment of triangle
{
//are ends of free segment and it is a part of border
if (j == theFirstEdgeNodeIdx &&
k == theSecondEdgeNodeIdx)
{
return Standard_True;
}
}
}
return Standard_False;
}
//=======================================================================
//function : defineStatusProxPnt1
//purpose : Defines the status of proximity point from 1st BVH
//=======================================================================
void BRepExtrema_ProximityDistTool::defineStatusProxPnt1()
{
if (myIsProxVtx1FromAddSet)
{
myPntStatus1 = myAddStatus1[myProxVtxIdx1];
return;
}
Standard_Integer aFaceID1 = mySet1->GetShapeIDOfVtx (myProxVtxIdx1);
if (myShapeList1 (aFaceID1).ShapeType() == TopAbs_EDGE)
@@ -314,9 +380,9 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt1()
TopLoc_Location aLocation;
const TopoDS_Face& aF = TopoDS::Face (myShapeList1 (aFaceID1));
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
if (isNodeOnBorder (aNodeIdx, aTr))
if (IsNodeOnBorder (aNodeIdx, aTr))
{
myPntStatus1 = ProxPnt_Status_BORDER;
}
@@ -398,7 +464,7 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
{
TopLoc_Location aLocation;
const TopoDS_Face& aF = TopoDS::Face (myShapeList2 (aFaceID2));
Handle (Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (aF, aLocation);
NCollection_Array1<Standard_Integer> aVtxIndicesOfTrg;
mySet2->GetVtxIndices (aTrgIdx, aVtxIndicesOfTrg);
@@ -408,7 +474,7 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
Standard_Integer aNodeNum = myProxPrjState.GetNumberOfFirstNode();
Standard_Integer aNodeIdx = mySet2->GetVtxIdxInShape (aVtxIndicesOfTrg[aNodeNum]) + 1;
if (isNodeOnBorder (aNodeIdx, aTr))
if (IsNodeOnBorder (aNodeIdx, aTr))
{
myPntStatus2 = ProxPnt_Status_BORDER;
}
@@ -419,27 +485,18 @@ void BRepExtrema_ProximityDistTool::defineStatusProxPnt2()
}
else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
Poly_Connect aPolyConnect (aTr);
Standard_Integer aTrgIdxInShape = mySet2->GetTrgIdxInShape (aTrgIdx) + 1;
Standard_Integer aAdjTrg[3];
aPolyConnect.Triangles (aTrgIdxInShape, aAdjTrg[0], aAdjTrg[1], aAdjTrg[2]); //indices of adjacent triangles
for (Standard_Integer j = 0; j < 3; j++)
if (IsEdgeOnBorder (aTrgIdxInShape,
myProxPrjState.GetNumberOfFirstNode(),
myProxPrjState.GetNumberOfLastNode(),
aTr))
{
Standard_Integer k = (j + 1) % 3;
if (aAdjTrg[j] == 0) //free segment of triangle
{
//aVtxIndicesOfTrg[j] and aVtxIndicesOfTrg[k] are ends of free segment and it is a part of border
if (j == myProxPrjState.GetNumberOfFirstNode() &&
k == myProxPrjState.GetNumberOfLastNode())
{
myPntStatus2 = ProxPnt_Status_BORDER;
break;
}
}
myPntStatus2 = ProxPnt_Status_BORDER;
}
else
{
myPntStatus2 = ProxPnt_Status_MIDDLE;
}
} //else if (myProxPrjState.GetPrjState() == BVH_PrjState::BVH_PrjStateInTriangle_EDGE)
}

View File

@@ -21,6 +21,7 @@
#include <BRepExtrema_TriangleSet.hxx>
#include <BVH_Distance.hxx>
#include <BVH_Tools.hxx>
#include <Poly_Triangulation.hxx>
//! Tool class for computation the proximity distance from first
//! primitive set to second one that is the maximal from minimum
@@ -93,6 +94,8 @@ public:
//! Creates new tool for the given element sets.
Standard_EXPORT BRepExtrema_ProximityDistTool (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
@@ -107,6 +110,10 @@ public:
Standard_EXPORT void LoadShapeLists (const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2);
//! Loads given additional vertices and their statuses.
void LoadAdditionalPointsFirstSet (const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1);
//! Performs searching of the proximity distance.
Standard_EXPORT void Perform();
@@ -121,6 +128,20 @@ public: //! @name Reject/Accept implementations
Standard_EXPORT virtual Standard_Boolean Accept (const Standard_Integer theSgmIdx,
const Standard_Real&) Standard_OVERRIDE;
public:
//! Returns true if the node is on the boarder.
Standard_EXPORT static Standard_Boolean IsNodeOnBorder (const Standard_Integer theNodeIdx,
const Handle (Poly_Triangulation)& theTr);
//! Returns true if the edge is on the boarder.
Standard_EXPORT static Standard_Boolean IsEdgeOnBorder (const Standard_Integer theTrgIdx,
const Standard_Integer theFirstEdgeNodeIdx,
const Standard_Integer theSecondEdgeNodeIdx,
const Handle (Poly_Triangulation)& theTr);
public:
//! Returns points on triangles sets, which provide the proximity distance.
void ProximityPoints (BVH_Vec3d& thePoint1, BVH_Vec3d& thePoint2) const
{
@@ -148,6 +169,10 @@ protected:
private:
//! Goes throught vertices from the 1st set.
void goThroughtSet1 (const BVH_Array3d& aVertices1,
const Standard_Boolean theIsAdditionalSet);
//! Defines the status of proximity point from 1st BVH.
void defineStatusProxPnt1();
@@ -183,6 +208,11 @@ private:
Standard_Integer myNbSamples1; //!< Number of samples points on the first shape
//! Is vertex corresponding to proximity point of 1st shape from additional set
Standard_Integer myIsProxVtx1FromAddSet;
BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape
NCollection_Vector<ProxPnt_Status> myAddStatus1; //!< Status of additional vertices on the 1st shape
//! Vertex index from 1st BVH corresponding to proximity point of 1st shape
Standard_Integer myProxVtxIdx1;

View File

@@ -1,4 +1,4 @@
// Created on: 2022-08-08
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// Copyright (c) 2022 OPEN CASCADE SAS
//
@@ -14,17 +14,32 @@
// commercial license or contractual agreement.
#include <BRepExtrema_ProximityValueTool.hxx>
#include <BRepExtrema_ProximityDistTool.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepGProp.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GCPnts_QuasiUniformAbscissa.hxx>
#include <GProp_GProps.hxx>
#include <Poly_Connect.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : BRepExtrema_ProximityValueTool
//purpose : Creates new unitialized proximity tool
//=======================================================================
BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool()
: myDistance (std::numeric_limits<Standard_Real>::max()),
: myIsRefinementRequired1 (Standard_False),
myIsRefinementRequired2 (Standard_False),
myDistance (std::numeric_limits<Standard_Real>::max()),
myIsDone (Standard_False),
myNbSamples1(0),
myNbSamples2(0)
{}
{
// Should be initialized later
myIsInitS1 = myIsInitS2 = Standard_False;
}
//=======================================================================
//function : BRepExtrema_ProximityValueTool
@@ -34,13 +49,15 @@ BRepExtrema_ProximityValueTool::BRepExtrema_ProximityValueTool (const Handle(BRe
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2)
: myDistance (std::numeric_limits<Standard_Real>::max()),
: myIsRefinementRequired1 (Standard_False),
myIsRefinementRequired2 (Standard_False),
myDistance (std::numeric_limits<Standard_Real>::max()),
myIsDone (Standard_False),
myNbSamples1(0),
myNbSamples2(0)
myNbSamples1 (0),
myNbSamples2 (0)
{
LoadTriangleSets (theSet1, theSet2);
LoadShapeLists (theShapeList1, theShapeList2);
LoadTriangleSets (theSet1, theSet2);
}
//=======================================================================
@@ -53,7 +70,94 @@ void BRepExtrema_ProximityValueTool::LoadTriangleSets (const Handle(BRepExtrema_
mySet1 = theSet1;
mySet2 = theSet2;
myIsDone = Standard_False;
MarkDirty();
}
//=======================================================================
//function : calcEdgeRefinementStep
//purpose : Calculates the edge refinement step
//=======================================================================
static Standard_Real calcEdgeRefinementStep (const TopoDS_Edge& theEdge,
const Standard_Integer theNbNodes)
{
if (theNbNodes < 2)
return 0;
BRepAdaptor_Curve aBAC (theEdge);
Standard_Real aLen = GCPnts_AbscissaPoint::Length (aBAC);
return aLen / (Standard_Real)(theNbNodes - 1);
}
//=======================================================================
//function : calcFaceRefinementStep
//purpose : Calculates the face refinement step as an approximate square
// (Shape area / number triangles) * 2
//=======================================================================
static Standard_Real calcFaceRefinementStep (const TopoDS_Face& theFace,
const Standard_Integer theNbTrg)
{
if (theNbTrg < 1)
return 0;
GProp_GProps props;
BRepGProp::SurfaceProperties (theFace, props);
Standard_Real aArea = props.Mass();
return 2 * (aArea / (Standard_Real)theNbTrg);
}
//=======================================================================
//function : getInfoForRefinement
//purpose : Gets shape data for further refinement
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getInfoForRefinement (const TopoDS_Shape& theShape,
TopAbs_ShapeEnum& theShapeType,
Standard_Integer& theNbNodes,
Standard_Real& theStep)
{
if (theShape.ShapeType() == TopAbs_FACE)
{
theShapeType = TopAbs_FACE;
TopoDS_Face aF = TopoDS::Face (theShape);
TopLoc_Location aLocation;
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (aF, aLocation);
if (aTriangulation.IsNull())
{
return Standard_False;
}
theNbNodes = aTriangulation->NbNodes();
Standard_Integer aNbTrg = aTriangulation->NbTriangles();
theStep = calcFaceRefinementStep (aF, aNbTrg);
}
else if (theShape.ShapeType() == TopAbs_EDGE)
{
theShapeType = TopAbs_EDGE;
TopoDS_Edge aE = TopoDS::Edge (theShape);
TopLoc_Location aLocation;
Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (aE, aLocation);
if (aPolygon.IsNull())
{
return Standard_False;
}
theNbNodes = aPolygon->NbNodes();
theStep = calcEdgeRefinementStep (aE, theNbNodes);
}
else
{
return Standard_False;
}
if (theStep < Precision::Confusion())
{
return Standard_False;
}
return Standard_True;
}
//=======================================================================
@@ -66,7 +170,13 @@ void BRepExtrema_ProximityValueTool::LoadShapeLists (const BRepExtrema_ShapeList
myShapeList1 = theShapeList1;
myShapeList2 = theShapeList2;
myIsDone = Standard_False;
myShape1 = theShapeList1 (0);
myIsInitS1 = getInfoForRefinement (myShape1, myShapeType1, myNbNodes1, myStep1);
myShape2 = theShapeList2 (0);
myIsInitS2 = getInfoForRefinement (myShape2, myShapeType2, myNbNodes2, myStep2);
MarkDirty();
}
//=======================================================================
@@ -79,7 +189,7 @@ void BRepExtrema_ProximityValueTool::SetNbSamplePoints(const Standard_Integer th
myNbSamples1 = theSamples1;
myNbSamples2 = theSamples2;
myIsDone = Standard_False;
MarkDirty();
}
//=======================================================================
@@ -88,6 +198,8 @@ void BRepExtrema_ProximityValueTool::SetNbSamplePoints(const Standard_Integer th
//=======================================================================
Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2,
@@ -96,7 +208,8 @@ Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle
ProxPnt_Status& thePointStatus1,
ProxPnt_Status& thePointStatus2) const
{
BRepExtrema_ProximityDistTool aProxDistTool (theSet1, theNbSamples1, theSet2, theShapeList1, theShapeList2);
BRepExtrema_ProximityDistTool aProxDistTool (theSet1, theNbSamples1, theAddVertices1, theAddStatus1,
theSet2, theShapeList1, theShapeList2);
aProxDistTool.Perform();
if (!aProxDistTool.IsDone())
@@ -108,21 +221,311 @@ Standard_Real BRepExtrema_ProximityValueTool::computeProximityDist (const Handle
return aProxDistTool.ProximityDistance();
}
//=======================================================================
//function : getEdgeAdditionalVertices
//purpose : Gets additional vertices and their statuses on the edge with the input step
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getEdgeAdditionalVertices (
const TopoDS_Edge& theEdge,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
{
BRepAdaptor_Curve aBAC (theEdge);
if (!aBAC.Is3DCurve() || theStep < Precision::Confusion())
{
return Standard_False;
}
Standard_Real aLen = GCPnts_AbscissaPoint::Length (aBAC);
Standard_Integer aNbSamplePoints = (Standard_Integer) (aLen / theStep) + 1;
GCPnts_QuasiUniformAbscissa aGCPnts (aBAC, Max (3, aNbSamplePoints));
if (!aGCPnts.IsDone())
return Standard_False;
Standard_Integer aNbNodes = aGCPnts.NbPoints();
for (Standard_Integer aVertIdx = 2; aVertIdx < aNbNodes; ++aVertIdx) //don't add extreme points
{
Standard_Real aPar = aGCPnts.Parameter (aVertIdx);
gp_Pnt aP = aBAC.Value (aPar);
theAddVertices.push_back (BVH_Vec3d (aP.X(), aP.Y(), aP.Z()));
theAddStatuses.Append (ProxPnt_Status::ProxPnt_Status_MIDDLE);
}
return Standard_True;
}
//=======================================================================
//function : doRecurTrgSplit
//purpose : Splits the triangle into two ones recursively, halving the longest side
// untill the area of the current triangle > input step
//! @param theTrg points of the triangle to be splitted
//! @param theEdgesStatus status of triangle edges - on the border or middle of the face
//! @param theTol telerance used in search of coincidence points
//! @param theStep minimum area of the resulting triangle
//! @param theAddVertices vertices obtained halving sides
//! @param theAddStatuses status of obtained vertices - on the border or middle of the face,
//! from triangulation of which the input triangle is
//=======================================================================
void BRepExtrema_ProximityValueTool::doRecurTrgSplit (const gp_Pnt (&theTrg)[3],
const ProxPnt_Status (&theEdgesStatus)[3],
const Standard_Real theTol,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
{
gp_XYZ aTrgSide1 = theTrg[1].Coord() - theTrg[0].Coord();
gp_XYZ aTrgSide2 = theTrg[2].Coord() - theTrg[0].Coord();
Standard_Real aTrgArea = 0.5 * aTrgSide1.CrossMagnitude (aTrgSide2);
if (aTrgArea - theStep < Precision::SquareConfusion())
return;
Standard_Real aD[3] { theTrg[0].Distance (theTrg[1]),
theTrg[1].Distance (theTrg[2]),
theTrg[2].Distance (theTrg[0]) };
Standard_Integer aBisectedEdgeIdx = aD[0] > aD[1] ? (aD[0] > aD[2] ? 0 : 2) : (aD[1] > aD[2] ? 1 : 2);
gp_Pnt aCenterOfMaxSide (theTrg[aBisectedEdgeIdx].Coord());
aCenterOfMaxSide.BaryCenter (0.5, theTrg[(aBisectedEdgeIdx + 1) % 3], 0.5);
Bnd_Box aBox;
aBox.Add (aCenterOfMaxSide);
aBox.Enlarge (theTol);
myInspector.SetCurrent (aCenterOfMaxSide.Coord());
myCells.Inspect (aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ(), myInspector);
if (myInspector.IsNeedAdd()) //is point aCenterOfMaxSide unique
{
BVH_Vec3d aBisectingPnt (aCenterOfMaxSide.X(), aCenterOfMaxSide.Y(), aCenterOfMaxSide.Z());
theAddVertices.push_back (aBisectingPnt);
theAddStatuses.Append (theEdgesStatus[aBisectedEdgeIdx]);
myInspector.Add (aCenterOfMaxSide.Coord());
myCells.Add (static_cast<BRepExtrema_VertexInspector::Target>(theAddVertices.size()),
aBox.CornerMin().XYZ(), aBox.CornerMax().XYZ());
}
gp_Pnt aTrg1[3] = { theTrg[0], theTrg[1], theTrg[2] };
gp_Pnt aTrg2[3] = { theTrg[0], theTrg[1], theTrg[2] };
ProxPnt_Status aEdgesStatus1[3] = { theEdgesStatus[0], theEdgesStatus[1], theEdgesStatus[2] };
ProxPnt_Status aEdgesStatus2[3] = { theEdgesStatus[0], theEdgesStatus[1], theEdgesStatus[2] };
switch (aBisectedEdgeIdx)
{
case 0:
aTrg1[0] = aTrg2[1] = aCenterOfMaxSide;
aEdgesStatus1[2] = aEdgesStatus2[1] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
break;
case 1:
aTrg1[1] = aTrg2[2] = aCenterOfMaxSide;
aEdgesStatus1[0] = aEdgesStatus2[2] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
break;
case 2:
aTrg1[2] = aTrg2[0] = aCenterOfMaxSide;
aEdgesStatus1[1] = aEdgesStatus2[0] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
break;
}
doRecurTrgSplit (aTrg1, aEdgesStatus1, theTol, theStep, theAddVertices, theAddStatuses);
doRecurTrgSplit (aTrg2, aEdgesStatus2, theTol, theStep, theAddVertices, theAddStatuses);
}
static Standard_Real getModelRange (const TopLoc_Location& theLocation,
const Handle(Poly_Triangulation)& theTr)
{
Bnd_Box aBox;
theTr->MinMax (aBox, theLocation.Transformation());
Standard_Real aXm = 0.0, aYm = 0.0, aZm = 0.0, aXM = 0.0, aYM = 0.0, aZM = 0.0;
aBox.Get (aXm, aYm, aZm, aXM, aYM, aZM);
Standard_Real aRange = aXM - aXm;
aRange = Max (aRange, aYM - aYm);
aRange = Max (aRange, aZM - aZm);
return aRange;
}
static void getNodesOfTrg (const Standard_Integer theTriIdx,
const TopLoc_Location& theLocation,
const Handle (Poly_Triangulation)& theTr,
gp_Pnt (&theTrg)[3])
{
Standard_Integer aVtxIdx1;
Standard_Integer aVtxIdx2;
Standard_Integer aVtxIdx3;
theTr->Triangle (theTriIdx).Get (aVtxIdx1, aVtxIdx2, aVtxIdx3);
gp_Pnt aVtx1 = theTr->Node (aVtxIdx1);
aVtx1.Transform (theLocation);
theTrg[0] = aVtx1;
gp_Pnt aVtx2 = theTr->Node (aVtxIdx2);
aVtx2.Transform (theLocation);
theTrg[1] = aVtx2;
gp_Pnt aVtx3 = theTr->Node (aVtxIdx3);
aVtx3.Transform (theLocation);
theTrg[2] = aVtx3;
}
// Gets status of triangle edges - on the border or middle of the face
static void getEdgesStatus(const Standard_Integer theTriIdx,
const Handle(Poly_Triangulation)& theTr,
ProxPnt_Status (&theEdgesStatus1)[3])
{
for (Standard_Integer j = 0; j < 3; j++)
{
Standard_Integer k = (j + 1) % 3;
if (BRepExtrema_ProximityDistTool::IsEdgeOnBorder (theTriIdx, j, k, theTr))
{
theEdgesStatus1[j] = ProxPnt_Status::ProxPnt_Status_BORDER;
}
else
{
theEdgesStatus1[j] = ProxPnt_Status::ProxPnt_Status_MIDDLE;
}
}
}
//=======================================================================
//function : getFaceAdditionalVertices
//purpose : Gets additional vertices and their statuses on the face with the input step (triangle square)
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getFaceAdditionalVertices (
const TopoDS_Face& theFace,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses)
{
Standard_Real aTol = Precision::Confusion();
TopLoc_Location aLocation;
Handle(Poly_Triangulation) aTr = BRep_Tool::Triangulation (theFace, aLocation);
if (aTr.IsNull())
{
return Standard_False;
}
myCells.Reset (Max (aTol, getModelRange (aLocation, aTr) / IntegerLast()));
for (Standard_Integer aTriIdx = 1; aTriIdx <= aTr->NbTriangles(); ++aTriIdx)
{
gp_Pnt aTrg[3];
ProxPnt_Status aEdgesStatus[3];
getNodesOfTrg (aTriIdx, aLocation, aTr, aTrg);
getEdgesStatus (aTriIdx, aTr, aEdgesStatus);
doRecurTrgSplit (aTrg, aEdgesStatus, aTol, theStep, theAddVertices, theAddStatuses);
}
return Standard_True;
}
//=======================================================================
//function : getShapesVertices
//purpose : Gets additional vertices on shapes with refining a coarser one if it's needed
//=======================================================================
Standard_Boolean BRepExtrema_ProximityValueTool::getShapesAdditionalVertices()
{
// estimate the density of meshes of shapes to add points to a coarcer one
// target steps for refinement
Standard_Real aStep1 = myStep1;
Standard_Real aStep2 = myStep2;
if ((myShapeType1 == TopAbs_EDGE) && (myShapeType2 == TopAbs_EDGE))
{
if (myNbSamples1 > myNbNodes1) // 1st edge needs refinement
{
aStep1 = calcEdgeRefinementStep (TopoDS::Edge (myShape1), myNbSamples1);
myIsRefinementRequired1 = Standard_True;
}
if (myNbSamples2 > myNbNodes2) // 2nd edge needs refinement
{
aStep2 = calcEdgeRefinementStep (TopoDS::Edge (myShape2), myNbSamples2);
myIsRefinementRequired2 = Standard_True;
}
if (aStep1 / aStep2 > 2.) // 1st edge needs refinement
{
myIsRefinementRequired1 = Standard_True;
aStep1 = aStep2;
}
else if (aStep2 / aStep1 > 2.) // 2nd edge needs refinement
{
myIsRefinementRequired2 = Standard_True;
aStep2 = aStep1;
}
if (myIsRefinementRequired1)
{
if (!getEdgeAdditionalVertices (TopoDS::Edge (myShape1), aStep1, myAddVertices1, myAddStatus1))
{
return Standard_False;
}
}
if (myIsRefinementRequired2)
{
if (!getEdgeAdditionalVertices (TopoDS::Edge (myShape2), aStep2, myAddVertices2, myAddStatus2))
{
return Standard_False;
}
}
}
else if ((myShapeType1 == TopAbs_FACE) && (myShapeType2 == TopAbs_FACE))
{
if (aStep1 / aStep2 > 2) // 1st face needs refinement
{
myIsRefinementRequired1 = Standard_True;
aStep1 = myStep2;
}
else if (aStep2 / aStep1 > 2.) // 2nd face needs refinement
{
myIsRefinementRequired2 = Standard_True;
aStep2 = myStep1;
}
if (myIsRefinementRequired1)
{
return getFaceAdditionalVertices (TopoDS::Face (myShape1), aStep1, myAddVertices1, myAddStatus1);
}
if (myIsRefinementRequired2)
{
return getFaceAdditionalVertices (TopoDS::Face (myShape2), aStep2, myAddVertices2, myAddStatus2);
}
}
return Standard_True;
}
//=======================================================================
//function : Perform
//purpose : Performs the computation of the proximity value
//=======================================================================
void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
{
myIsDone = Standard_False;
if (!myIsInitS1 || !myIsInitS2 || (myShapeType1 != myShapeType2))
return;
//get vertices on shapes with refining a coarser mesh if it's needed
if (!getShapesAdditionalVertices())
return;
// max(min) dist from the 1st shape to the 2nd one
BVH_Vec3d aP1_1, aP1_2;
ProxPnt_Status aPointStatus1_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
ProxPnt_Status aPointStatus1_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
Standard_Real aProximityDist1 = computeProximityDist (mySet1, myNbSamples1, mySet2, myShapeList1, myShapeList2,
aP1_1, aP1_2, aPointStatus1_1, aPointStatus1_2);
Standard_Real aProximityDist1 = computeProximityDist (mySet1, myNbSamples1, myAddVertices1, myAddStatus1,
mySet2,
myShapeList1, myShapeList2,
aP1_1, aP1_2,
aPointStatus1_1, aPointStatus1_2);
if (aProximityDist1 < 0.)
return;
@@ -132,8 +535,11 @@ void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
ProxPnt_Status aPointStatus2_1 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
ProxPnt_Status aPointStatus2_2 = ProxPnt_Status::ProxPnt_Status_UNKNOWN;
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, mySet1, myShapeList2, myShapeList1,
aP2_2, aP2_1, aPointStatus2_2, aPointStatus2_1);
Standard_Real aProximityDist2 = computeProximityDist (mySet2, myNbSamples2, myAddVertices2, myAddStatus2,
mySet1,
myShapeList2, myShapeList1,
aP2_2, aP2_1,
aPointStatus2_2, aPointStatus2_1);
if (aProximityDist2 < 0.)
return;
@@ -159,3 +565,23 @@ void BRepExtrema_ProximityValueTool::Perform (Standard_Real& theTolerance)
myIsDone = Standard_True;
theTolerance = myDistance;
}
//=======================================================================
//function : Inspect
//purpose : Used for selection and storage of coinciding nodes
//=======================================================================
NCollection_CellFilter_Action BRepExtrema_VertexInspector::Inspect (const Standard_Integer theTarget)
{
myIsNeedAdd = Standard_True;
const gp_XYZ& aPnt = myPoints.Value (theTarget - 1);
Standard_Real aDx, aDy, aDz;
aDx = myCurrent.X() - aPnt.X();
aDy = myCurrent.Y() - aPnt.Y();
aDz = myCurrent.Z() - aPnt.Z();
if ((aDx * aDx <= myTol) && (aDy * aDy <= myTol) && (aDz * aDz <= myTol))
myIsNeedAdd = Standard_False;
return CellFilter_Keep;
}

View File

@@ -1,4 +1,4 @@
// Created on: 2022-08-08
// Created on: 2022-08-08
// Created by: Kseniya NOSULKO
// Copyright (c) 2022 OPEN CASCADE SAS
//
@@ -18,9 +18,67 @@
#include <BRepExtrema_ProximityDistTool.hxx>
#include <BRepExtrema_TriangleSet.hxx>
#include <NCollection_CellFilter.hxx>
#include <Precision.hxx>
typedef NCollection_Vector<gp_XYZ> VectorOfPoint;
//! Class BRepExtrema_VertexInspector
//! derived from NCollection_CellFilter_InspectorXYZ
//! This class define the Inspector interface for CellFilter algorithm,
//! working with gp_XYZ points in 3d space.
//! Used in search of coincidence points with a certain tolerance.
class BRepExtrema_VertexInspector : public NCollection_CellFilter_InspectorXYZ
{
public:
typedef Standard_Integer Target;
//! Constructor; remembers the tolerance
BRepExtrema_VertexInspector()
: myTol (Precision::SquareConfusion()),
myIsNeedAdd (Standard_True)
{}
//! Keep the points used for comparison
void Add (const gp_XYZ& thePnt)
{
myPoints.Append (thePnt);
}
//! Set tolerance for comparison of point coordinates
void SetTol (const Standard_Real theTol)
{
myTol = theTol;
}
//! Set current point to search for coincidence
void SetCurrent (const gp_XYZ& theCurPnt)
{
myCurrent = theCurPnt;
myIsNeedAdd = Standard_True;
}
Standard_Boolean IsNeedAdd()
{
return myIsNeedAdd;
}
//! Implementation of inspection method
Standard_EXPORT NCollection_CellFilter_Action Inspect (const Standard_Integer theTarget);
private:
Standard_Real myTol;
Standard_Boolean myIsNeedAdd;
VectorOfPoint myPoints;
gp_XYZ myCurrent;
};
typedef NCollection_CellFilter<BRepExtrema_VertexInspector> BRepExtrema_CellFilter;
typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
//! Tool class for computation of the proximity value from one BVH
//! primitive set to another, solving max(min) problem.
//! Handles only edge/edge or face/face cases.
//! This tool is not intended to be used independently, and is integrated
//! in other classes, implementing algorithms based on shape tessellation
//! (BRepExtrema_ShapeProximity and BRepExtrema_SelfIntersection).
@@ -29,8 +87,6 @@
//! on the quality of input tessellation(s).
class BRepExtrema_ProximityValueTool
{
public:
typedef typename BRepExtrema_ProximityDistTool::ProxPnt_Status ProxPnt_Status;
public:
@@ -86,9 +142,17 @@ public:
private:
//! Gets shape data for further refinement.
Standard_Boolean getInfoForRefinement (const TopoDS_Shape& theShapes,
TopAbs_ShapeEnum& theShapeType,
Standard_Integer& theNbNodes,
Standard_Real& theStep);
//! Returns the computed proximity value from first BVH to another one.
Standard_Real computeProximityDist (const Handle(BRepExtrema_TriangleSet)& theSet1,
const Standard_Integer theNbSamples1,
const BVH_Array3d& theAddVertices1,
const NCollection_Vector<ProxPnt_Status>& theAddStatus1,
const Handle(BRepExtrema_TriangleSet)& theSet2,
const BRepExtrema_ShapeList& theShapeList1,
const BRepExtrema_ShapeList& theShapeList2,
@@ -97,6 +161,29 @@ private:
ProxPnt_Status& thePointStatus1,
ProxPnt_Status& thePointStatus2) const;
//! Gets additional vertices on shapes with refining a coarser one if it's needed.
Standard_Boolean getShapesAdditionalVertices();
//! Gets additional vertices and their statuses on the edge with the input step.
Standard_Boolean getEdgeAdditionalVertices (const TopoDS_Edge& theEdge,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
//! Gets additional vertices and their statuses on the face with the input step (triangle square).
Standard_Boolean getFaceAdditionalVertices (const TopoDS_Face& theFace,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
//! Splits the triangle recursively, halving the longest side
//! to the area of the current triangle > input step
void doRecurTrgSplit (const gp_Pnt (&theTrg)[3],
const ProxPnt_Status (&theEdgesStatus)[3],
const Standard_Real theTol,
const Standard_Real theStep,
BVH_Array3d& theAddVertices,
NCollection_Vector<ProxPnt_Status>& theAddStatuses);
private:
//! Set of all mesh primitives of the 1st shape.
@@ -109,6 +196,35 @@ private:
//! List of subshapes of the 2nd shape.
BRepExtrema_ShapeList myShapeList2;
//! The 1st shape.
TopoDS_Shape myShape1;
//! The 2nd shape.
TopoDS_Shape myShape2;
BVH_Array3d myAddVertices1; //!< Additional vertices on the 1st shape if its mesh is coarser.
BVH_Array3d myAddVertices2; //!< Additional vertices on the 2nd shape if its mesh is coarser.
NCollection_Vector<ProxPnt_Status> myAddStatus1; //!< Status of additional vertices on the 1st shape.
NCollection_Vector<ProxPnt_Status> myAddStatus2; //!< Status of additional vertices on the 2nd shape.
Standard_Boolean myIsInitS1; //!< Is the 1st shape initialized?
Standard_Boolean myIsInitS2; //!< Is the 2nd shape initialized?
Standard_Boolean myIsRefinementRequired1; //!< Flag about the need to refine the 1st shape.
Standard_Boolean myIsRefinementRequired2; //!< Flag about the need to refine the 2nd shape.
Standard_Integer myNbNodes1; //!< Number of nodes in triangulation of the 1st shape.
Standard_Integer myNbNodes2; //!< Number of nodes in triangulation of the 2nd shape.
Standard_Real myStep1; //!< Step for getting vertices on the 1st shape.
Standard_Real myStep2; //!< Step for getting vertices on the 2nd shape.
BRepExtrema_CellFilter myCells;
BRepExtrema_VertexInspector myInspector;
TopAbs_ShapeEnum myShapeType1; //!< 1st shape type.
TopAbs_ShapeEnum myShapeType2; //!< 2nd shape type.
Standard_Real myDistance; //!< Distance
Standard_Boolean myIsDone; //!< State of the algorithm

View File

@@ -129,6 +129,7 @@ void BRepExtrema_ShapeProximity::Perform()
myElementSet2);
myProxValTool.LoadShapeLists (myShapeList1,
myShapeList2);
myProxValTool.SetNbSamplePoints (myNbSamples1, myNbSamples2);
myProxValTool.Perform (myTolerance);
myProxValTool.ProximityPoints(myProxPoint1, myProxPoint2);

View File

@@ -37,7 +37,8 @@
//! on distance less than the given tolerance from each other.
//!
//! Second approach:
//! Compute the proximity value between two shapes if the tolerance is not defined (Precision::Infinite()).
//! Compute the proximity value between two shapes (handles only edge/edge or face/face cases)
//! if the tolerance is not defined (Precision::Infinite()).
//! In this case the proximity value is a minimal thickness of a layer containing both shapes.
//!
//! For the both approaches the high performance is achieved through the use of existing
@@ -46,8 +47,6 @@
//! triangulation).
class BRepExtrema_ShapeProximity
{
public:
typedef typename BRepExtrema_ProximityValueTool::ProxPnt_Status ProxPnt_Status;
public:

View File

@@ -44,6 +44,8 @@
#include <BRepGProp_Face.hxx>
#include <BRep_TEdge.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#ifdef BRepFill_AdvancedEvolved_DEBUG
#include <BinTools.hxx>
@@ -524,9 +526,14 @@ void BRepFill_AdvancedEvolved::GetLids()
return;
}
Standard_Real aTol = Max(aFS.Tolerance(), aFS.ToleranceReached());
aTol += myFuzzyValue;
Bnd_Box aProfBox;
BRepBndLib::Add(myProfile, aProfBox);
Standard_Real aSqDiag = aProfBox.SquareExtent();
//Square of the default angular tolerance in
//BOPAlgo_Tools::EdgesToWires(...) and BOPAlgo_Tools::WiresToFaces(...) methods
const Standard_Real aSqAnguarTol = 1.0e-16;
const Standard_Real aSqAnguarTol = aTol*aTol / aSqDiag;
const gp_Dir &aNormal = aSurf->Position().Direction();
// Obtain free-edges from myPipeShell. All edges must be planar
@@ -541,6 +548,7 @@ void BRepFill_AdvancedEvolved::GetLids()
gp_Pnt aPtmp;
gp_Vec aTan;
Standard_Real aDPMax = 0.;
for (Standard_Integer i = 1; i <= aMapEF.Size(); i++)
{
TopTools_ListOfShape& aListF = aMapEF(i);
@@ -564,6 +572,8 @@ void BRepFill_AdvancedEvolved::GetLids()
continue;
const Standard_Real aDP = aTan.XYZ().Dot(aNormal.XYZ());
if (Abs(aDP) > aDPMax)
aDPMax = Abs(aDP);
if (aDP*aDP>aSqModulus*aSqAnguarTol)
{
//Only planar edges are considered
@@ -594,8 +604,9 @@ void BRepFill_AdvancedEvolved::GetLids()
aBB.MakeCompound(aCompW);
aBB.MakeCompound(aCompF);
aBB.MakeCompound(myTopBottom);
BOPAlgo_Tools::EdgesToWires(aFreeEdges, aCompW, Standard_True);
BOPAlgo_Tools::WiresToFaces(aCompW, aCompF);
Standard_Real anAngTol = Sqrt(aSqAnguarTol);
BOPAlgo_Tools::EdgesToWires(aFreeEdges, aCompW, Standard_True, anAngTol);
BOPAlgo_Tools::WiresToFaces(aCompW, aCompF, anAngTol);
{
// Check orientation

View File

@@ -656,7 +656,7 @@ static void BuildConnectedEdges(const TopoDS_Wire& aWire,
//=======================================================================
BRepFill_CompatibleWires::BRepFill_CompatibleWires()
:myIsDone(Standard_False)
:myStatus(BRepFill_ThruSectionErrorStatus_NotDone)
{
}
@@ -682,7 +682,7 @@ void BRepFill_CompatibleWires::Init(const TopTools_SequenceOfShape& Sections)
myInit = Sections;
myWork = Sections;
myPercent = 0.01;
myIsDone = Standard_False;
myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
myMap.Clear();
}
@@ -707,7 +707,7 @@ void BRepFill_CompatibleWires::SetPercent(const Standard_Real Percent)
Standard_Boolean BRepFill_CompatibleWires::IsDone() const
{
return myIsDone;
return myStatus == BRepFill_ThruSectionErrorStatus_Done;
}
@@ -766,6 +766,7 @@ Standard_Boolean BRepFill_CompatibleWires::IsDegeneratedLastSection() const
void BRepFill_CompatibleWires::Perform (const Standard_Boolean WithRotation)
{
myStatus = BRepFill_ThruSectionErrorStatus_Done;
// compute origin and orientation on wires to avoid twisted results
// and update wires to have same number of edges
@@ -838,7 +839,7 @@ void BRepFill_CompatibleWires::Perform (const Standard_Boolean WithRotation)
allClosed = (allClosed && wClosed);
allOpen = (allOpen && !wClosed);
}
if (allClosed) {
// All sections are closed
if (report) {
@@ -849,24 +850,26 @@ void BRepFill_CompatibleWires::Perform (const Standard_Boolean WithRotation)
// origin
ComputeOrigin(Standard_False);
}
myIsDone = Standard_True;
}
else if (allOpen) {
// All sections are open
// origin
SearchOrigin();
if (myStatus != BRepFill_ThruSectionErrorStatus_Done)
{
return;
}
// same number of elements
if (report) {
SameNumberByACR(report);
}
myIsDone = Standard_True;
}
else {
// There are open and closed sections :
// not processed
throw Standard_DomainError("Sections must be all closed or all open");
myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
return;
}
}
@@ -906,7 +909,10 @@ void BRepFill_CompatibleWires::
//allClosed = (allClosed && myWork(i).Closed());
}
if (!allClosed)
throw Standard_NoSuchObject("BRepFill_CompatibleWires::SameNumberByPolarMethod : the wires must be closed");
{
myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
return;
}
// sections ponctuelles, sections bouclantes ?
if (myDegen1) ideb++;
@@ -986,8 +992,11 @@ void BRepFill_CompatibleWires::
// sequence of vertices of the first wire
SeqOfVertices(wire1,SeqV);
if (SeqV.Length()>NbMaxV)
throw Standard_NoSuchObject("BRepFill::SameNumberByPolarMethod failed");
if (SeqV.Length() > NbMaxV)
{
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
return;
}
// loop on vertices of wire1
for (ii=1;ii<=SeqV.Length();ii++) {
@@ -1062,7 +1071,10 @@ void BRepFill_CompatibleWires::
// sequence of vertices of the first wire
SeqOfVertices(wire1,SeqV);
if ( SeqV.Length()>NbMaxV || SeqV.Length()>SizeMap )
throw Standard_NoSuchObject("BRepFill::SameNumberByPolarMethod failed");
{
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
return;
}
// next wire
@@ -1184,14 +1196,17 @@ void BRepFill_CompatibleWires::
}
} //end of for(; itW.More(); itW.Next())
if (Esol.IsNull())
throw Standard_ConstructionError("BRepFill :: profiles are inconsistent");
{
myStatus = BRepFill_ThruSectionErrorStatus_ProfilesInconsistent;
return;
}
MW.Add(Esol);
TopTools_ListOfShape ConnectedEdges;
BuildConnectedEdges( TopoDS::Wire(myWork(i)), Esol, V2, ConnectedEdges );
TopTools_ListIteratorOfListOfShape itCE(ConnectedEdges);
for(; anExp.More(), itCE.More(); anExp.Next(), itCE.Next())
for(; anExp.More() && itCE.More(); anExp.Next(), itCE.Next())
{
ECur = anExp.Current();
TopExp::Vertices(ECur,VF,VL,Standard_True);
@@ -1264,8 +1279,10 @@ void BRepFill_CompatibleWires::
if (nbmax<nbEdges) nbmax = nbEdges;
if (nbmin>nbEdges) nbmin = nbEdges;
}
if (nbmin!=nbmax) {
throw Standard_NoSuchObject("BRepFill_CompatibleWires::SameNumberByPolarMethod failed");
if (nbmin!=nbmax)
{
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
return;
}
//Fill <myMap>
@@ -1487,7 +1504,10 @@ void BRepFill_CompatibleWires::SameNumberByACR(const Standard_Boolean report)
if (nbmin>nbEdges(i)) nbmin = nbEdges(i);
}
if (nbmax!=nbmin)
throw Standard_NoSuchObject("BRepFill_CompatibleWires::SameNumberByACR failed");
{
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
return;
}
}
//=======================================================================
@@ -1532,7 +1552,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
}
*/
if (!allClosed)
throw Standard_NoSuchObject("BRepFill_CompatibleWires::ComputeOrigin : the wires must be closed");
{
myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
return;
}
/*
// Max number of possible cuts
@@ -1869,7 +1892,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const Standard_Boolean /*polar*/ )
gp_Pnt Pmini,P1,P2;
SeqOfVertices(wire,SeqV);
if (SeqV.Length()>NbMaxV)
throw Standard_NoSuchObject("BRepFill::ComputeOrigin failed");
{
myStatus = BRepFill::ThruSectionsError_Failed;
return;
}
if (!polar) {
// choix du vertex le plus proche comme origine
distmini = Precision::Infinite();
@@ -2094,7 +2120,10 @@ void BRepFill_CompatibleWires::SearchOrigin()
allOpen = (allOpen && !myWork(i).Closed());
}
if (!allOpen)
throw Standard_NoSuchObject("BRepFill_CompatibleWires::SearchOrigin : the wires must be open");
{
myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
return;
}
// init

View File

@@ -20,6 +20,7 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <BRepFill_ThruSectionErrorStatus.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
@@ -49,6 +50,11 @@ public:
Standard_EXPORT void Perform (const Standard_Boolean WithRotation = Standard_True);
Standard_EXPORT Standard_Boolean IsDone() const;
BRepFill_ThruSectionErrorStatus GetStatus() const
{
return myStatus;
}
//! returns the generated sequence.
Standard_EXPORT const TopTools_SequenceOfShape& Shape() const;
@@ -101,7 +107,7 @@ private:
Standard_Real myPercent;
Standard_Boolean myDegen1;
Standard_Boolean myDegen2;
Standard_Boolean myIsDone;
BRepFill_ThruSectionErrorStatus myStatus;
TopTools_DataMapOfShapeListOfShape myMap;

View File

@@ -65,6 +65,7 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2)
{
// initializations
// !Note if IType set as -1 it means that occurs error with null 3d curve for the edge
Standard_Integer IType = 0;
// characteristics of the first edge
@@ -89,7 +90,9 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
else {
curv1 = BRep_Tool::Curve(Edge1, loc, first1, last1);
if (curv1.IsNull())
throw Standard_NullObject("Null 3D curve in edge");
{
return -1;
}
curv1 =
Handle(Geom_Curve)::DownCast(curv1->Transformed(loc.Transformation()));
ff = first1;
@@ -156,7 +159,9 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
else {
curv = BRep_Tool::Curve(Edge2, loc, first2, last2);
if (curv.IsNull())
throw Standard_NullObject("Null 3D curve in edge");
{
return -1;
}
curv =
Handle(Geom_Curve)::DownCast(curv->Transformed(loc.Transformation()));
ff = first2;
@@ -312,12 +317,12 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
//=======================================================================
//function : CreateKPart
//purpose :
//purpose : Returns true if there is no errors occur
//=======================================================================
void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
const Standard_Integer IType,
Handle(Geom_Surface)& Surf)
Standard_Boolean CreateKPart (const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
const Standard_Integer IType,
Handle(Geom_Surface)& Surf)
{
// find the dimension
TopoDS_Vertex V1, V2;
@@ -326,6 +331,8 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
Standard_Real a1, b1, aa =0., bb =0.;
TopoDS_Vertex v1f,v1l,v2f,v2l;
Standard_Boolean isDone = Standard_True;
// find characteristics of the first edge
Handle(Geom_Curve) C1;
Standard_Boolean degen1 = BRep_Tool::Degenerated(Edge1);
@@ -336,7 +343,9 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
else {
C1 = BRep_Tool::Curve(Edge1, loc, a1, b1);
if (C1.IsNull())
throw Standard_NullObject("Null 3D curve in edge");
{
return Standard_False;
}
C1 = Handle(Geom_Curve)::DownCast(C1->Transformed(loc.Transformation()));
aa = a1;
bb = b1;
@@ -361,7 +370,9 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
else {
C2 = BRep_Tool::Curve(Edge2, loc, a1, b1);
if (C2.IsNull())
throw Standard_NullObject("Null 3D curve in edge");
{
return Standard_False;
}
C2 = Handle(Geom_Curve)::DownCast(C2->Transformed(loc.Transformation()));
if (Edge2.Orientation() == TopAbs_REVERSED) {
C2->Reverse();
@@ -496,6 +507,7 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
// IType incorrect
}
Surf = surface;
return isDone;
}
//=======================================================================
@@ -528,7 +540,8 @@ static TopoDS_Edge CreateNewEdge(const TopoDS_Edge& theEdge, TopTools_DataMapOfS
//=======================================================================
BRepFill_Generator::BRepFill_Generator():
myMutableInput (Standard_True)
myMutableInput (Standard_True),
myStatus (BRepFill_ThruSectionErrorStatus_NotDone)
{
}
@@ -551,6 +564,8 @@ void BRepFill_Generator::AddWire(const TopoDS_Wire& Wire)
void BRepFill_Generator::Perform()
{
myStatus = BRepFill_ThruSectionErrorStatus_Done;
TopoDS_Shell Shell;
TopoDS_Face Face;
TopoDS_Shape S1, S2;
@@ -679,6 +694,12 @@ void BRepFill_Generator::Perform()
// processing of KPart
Standard_Integer IType = DetectKPart(Edge1,Edge2);
if (IType == -1)
{
myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
return;
}
if (IType==0) {
// no part cases
TopLoc_Location L,L1,L2;
@@ -694,7 +715,10 @@ void BRepFill_Generator::Perform()
else {
C1 = BRep_Tool::Curve(Edge1,L1,f1,l1);
if (C1.IsNull())
throw Standard_NullObject("Null 3D curve in edge");
{
myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
return;
}
}
if (degen2) {
Extremities(1) = BRep_Tool::Pnt(V2l);
@@ -704,7 +728,10 @@ void BRepFill_Generator::Perform()
else {
C2 = BRep_Tool::Curve(Edge2,L2,f2,l2);
if (C2.IsNull())
throw Standard_NullObject("Null 3D curve in edge");
{
myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
return;
}
}
// compute the location
@@ -746,7 +773,11 @@ void BRepFill_Generator::Perform()
}
else {
// particular case
CreateKPart(Edge1,Edge2,IType,Surf);
if (!CreateKPart(Edge1, Edge2, IType, Surf))
{
myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
return;
}
B.MakeFace(Face,Surf,Precision::Confusion());
}

View File

@@ -20,6 +20,7 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <BRepFill_ThruSectionErrorStatus.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
@@ -68,6 +69,12 @@ public:
//! Returns the current mutable input state
Standard_EXPORT Standard_Boolean IsMutableInput() const;
//! Returns status of the operation
BRepFill_ThruSectionErrorStatus GetStatus() const
{
return myStatus;
}
protected:
private:
@@ -78,6 +85,7 @@ private:
TopTools_DataMapOfShapeShape myOldNewShapes;
BRepTools_ReShape myReshaper;
Standard_Boolean myMutableInput;
BRepFill_ThruSectionErrorStatus myStatus;
};

View File

@@ -3002,7 +3002,7 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
}
}
if (aNbFaces == 0)
if ((NbTrous > 0) ? (aNbFaces < NbLaw) : (aNbFaces == 0))
{
isDone = Standard_False;
return;

View File

@@ -0,0 +1,29 @@
// Copyright (c) 2022 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 _BRepFill_ThruSectionErrorStatus_HeaderFile
#define _BRepFill_ThruSectionErrorStatus_HeaderFile
//! Errors that can occur at thrusection algorithm.
enum BRepFill_ThruSectionErrorStatus
{
BRepFill_ThruSectionErrorStatus_Done, //!< Thrusection algorithm is done
BRepFill_ThruSectionErrorStatus_NotDone, //!< Thrusection algorithm is not done
BRepFill_ThruSectionErrorStatus_NotSameTopology, //!< All profiles have not same topology (they should be all closed or all opened)
BRepFill_ThruSectionErrorStatus_ProfilesInconsistent, //!< Profiles are inconsistent
BRepFill_ThruSectionErrorStatus_WrongUsage, //!< Wrong usage of punctual sections
BRepFill_ThruSectionErrorStatus_Null3DCurve, //!< Null 3D curve in edge
BRepFill_ThruSectionErrorStatus_Failed //!< Thrusection algorithm has failed
};
#endif // _BRepFill_ThruSectionErrorStatus_HeaderFile

View File

@@ -56,6 +56,7 @@
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <BRepExtrema_ExtCC.hxx>
#include <ShapeFix_Edge.hxx>
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
TopoDS_Compound& theComp,
@@ -534,6 +535,26 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
if(bHasNewEdge) {
aNewEdge.Orientation(TopAbs_FORWARD);
// Refer to BrepFill_Sweep.cxx BuildEdge Construct an edge via an iso
gp_Pnt P1, P2;
Standard_Real p11, p12, p21, p22;
P1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aNewEdge)));
P2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aNewEdge)));
TopoDS_Edge aERef = TopoDS::Edge(fit == 1 ? aE1 : aE2);
p11 = P1.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
p22 = P2.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
p12 = P1.Distance(BRep_Tool::Pnt(TopExp::LastVertex(aERef)));
p21 = P2.Distance(BRep_Tool::Pnt(TopExp::FirstVertex(aERef)));
if (p11 > p12 && p22 > p21) {
aNewEdge.Reverse();
}
// for nonPlane surface, we should add pCurve
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge();
sfe->FixAddPCurve(aNewEdge, TopoDS::Face(aFace), Standard_False);
}
TopTools_ListOfShape aOrderedList;

View File

@@ -77,6 +77,7 @@ BRepFill_ShapeLaw.hxx
BRepFill_ShapeLaw.lxx
BRepFill_Sweep.cxx
BRepFill_Sweep.hxx
BRepFill_ThruSectionErrorStatus.hxx
BRepFill_TransitionStyle.hxx
BRepFill_TrimEdgeTool.cxx
BRepFill_TrimEdgeTool.hxx

View File

@@ -44,13 +44,13 @@ BRepFilletAPI_MakeFillet::BRepFilletAPI_MakeFillet(const TopoDS_Shape& S,
//=======================================================================
void BRepFilletAPI_MakeFillet::SetParams(const Standard_Real Tang,
const Standard_Real Tesp,
const Standard_Real T2d,
const Standard_Real TApp3d,
const Standard_Real TolApp2d,
const Standard_Real Fleche)
const Standard_Real Tesp,
const Standard_Real T2d,
const Standard_Real TApp3d,
const Standard_Real TolApp2d,
const Standard_Real Fleche)
{
myBuilder.SetParams(Tang,Tesp, T2d, TApp3d, TolApp2d, Fleche);
myBuilder.SetParams(Tang, Tesp, T2d, TApp3d, TolApp2d, Fleche);
}
//=======================================================================

View File

@@ -802,7 +802,7 @@ static void GetEdgeTol(const TopoDS_Edge& theEdge,
}
if(temp > d2) d2 = temp;
}
d2 = 1.5*sqrt(d2);
d2 = 1.05*sqrt(d2);
theEdTol = d2;
}
@@ -884,10 +884,6 @@ static void UpdShTol(const TopTools_DataMapOfShapeReal& theShToTol,
case TopAbs_VERTEX:
{
const Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aNsh.TShape());
//
if(aTV->Locked())
throw TopoDS_LockedShape("BRep_Builder::UpdateVertex");
//
if (theVForceUpdate)
aTV->Tolerance(aTol);
else
@@ -965,6 +961,9 @@ static void InternalSameParameter(const TopoDS_Shape& theSh, BRepTools_ReShape&
TopExp_Explorer ex2;
for(ex2.Init(curface,TopAbs_EDGE); ex2.More(); ex2.Next()){
const TopoDS_Edge& E = TopoDS::Edge(ex2.Current());
if (BRep_Tool::Degenerated(E))
continue;
TopoDS_Shape aNe = theReshaper.Value(E);
Standard_Real aNewEtol = -1;
GetEdgeTol(TopoDS::Edge(aNe), curface, aNewEtol);
@@ -1709,8 +1708,8 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
for (iCur=1; iCur<=nbV; iCur++) {
tol=0;
const TopoDS_Vertex& V = TopoDS::Vertex(parents.FindKey(iCur));
Bnd_Box box;
box.Add(BRep_Tool::Pnt(V));
gp_Pnt aPV = BRep_Tool::Pnt(V);
Standard_Real aMaxDist = 0.;
gp_Pnt p3d;
for (lConx.Initialize(parents(iCur)); lConx.More(); lConx.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(lConx.Value());
@@ -1732,8 +1731,10 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
if (!C.IsNull()) { // edge non degenerated
p3d = C->Value(par);
p3d.Transform(L.Transformation());
box.Add(p3d);
}
Standard_Real aDist = p3d.SquareDistance(aPV);
if (aDist > aMaxDist)
aMaxDist = aDist;
}
}
else if (cr->IsCurveOnSurface()) {
const Handle(Geom_Surface)& Su = cr->Surface();
@@ -1745,21 +1746,22 @@ static void InternalUpdateTolerances(const TopoDS_Shape& theOldShape,
gp_Pnt2d p2d = PC->Value(par);
p3d = Su->Value(p2d.X(),p2d.Y());
p3d.Transform(L.Transformation());
box.Add(p3d);
Standard_Real aDist = p3d.SquareDistance(aPV);
if (aDist > aMaxDist)
aMaxDist = aDist;
if (!PC2.IsNull()) {
p2d = PC2->Value(par);
p3d = Su->Value(p2d.X(),p2d.Y());
p3d.Transform(L.Transformation());
box.Add(p3d);
aDist = p3d.SquareDistance(aPV);
if (aDist > aMaxDist)
aMaxDist = aDist;
}
}
itcr.Next();
}
}
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
box.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
aXmax -= aXmin; aYmax -= aYmin; aZmax -= aZmin;
tol = Max(tol,sqrt(aXmax*aXmax+aYmax*aYmax+aZmax*aZmax));
tol = Max(tol, sqrt(aMaxDist));
tol += 2.*Epsilon(tol);
//
Standard_Real aVTol = BRep_Tool::Tolerance(V);

View File

@@ -256,7 +256,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W,
myError = BRepLib_NotPlanar;
return;
}
// build the face and add the wire
BRep_Builder B;
myError = BRepLib_FaceDone;
@@ -264,13 +264,40 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W,
Standard_Real tol = Max(1.2*FS.ToleranceReached(), FS.Tolerance());
B.MakeFace(TopoDS::Face(myShape),FS.Surface(),FS.Location(),tol);
Add(W);
TopoDS_Wire aW;
if (OnlyPlane)
{
// get rid of degenerative edges in the input wire
BRep_Builder aB;
aB.MakeWire (aW);
TopoDS_Wire aWForw = W;
aWForw.Orientation (TopAbs_FORWARD);
TopoDS_Iterator anIter (aWForw);
for (; anIter.More(); anIter.Next())
{
const TopoDS_Edge& aE = TopoDS::Edge (anIter.Value());
if (!BRep_Tool::Degenerated (aE))
aB.Add (aW, aE);
}
aW.Orientation (W.Orientation()); // return to original orient
aW.Closed (W.Closed());
}
else
{
aW = W;
}
Add (aW);
//
BRepLib::UpdateTolerances(myShape);
//
BRepLib::SameParameter(myShape, tol, Standard_True);
//
if (BRep_Tool::IsClosed(W))
if (BRep_Tool::IsClosed(aW))
CheckInside();
}

View File

@@ -35,11 +35,13 @@ IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellato
//=======================================================================
BRepMesh_CurveTessellator::BRepMesh_CurveTessellator(
const IMeshData::IEdgeHandle& theEdge,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
: myDEdge(theEdge),
myParameters(theParameters),
myEdge(theEdge->GetEdge()),
myCurve(myEdge)
myCurve(myEdge),
myMinPointsNb (theMinPointsNb)
{
init();
}
@@ -52,11 +54,13 @@ BRepMesh_CurveTessellator::BRepMesh_CurveTessellator (
const IMeshData::IEdgeHandle& theEdge,
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
: myDEdge(theEdge),
myParameters(theParameters),
myEdge(TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation))),
myCurve(myEdge, theFace->GetFace())
myCurve(myEdge, theFace->GetFace()),
myMinPointsNb (theMinPointsNb)
{
init();
}
@@ -97,8 +101,21 @@ void BRepMesh_CurveTessellator::init()
myEdgeSqTol = BRep_Tool::Tolerance (myEdge);
myEdgeSqTol *= myEdgeSqTol;
const Standard_Integer aMinPntNb = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287
Standard_Integer aMinPntThreshold = 2;
switch (myCurve.GetType())
{
case GeomAbs_Circle:
case GeomAbs_Ellipse:
case GeomAbs_Parabola:
case GeomAbs_Hyperbola:
aMinPntThreshold = 4;
break;
default:
break;
}
const Standard_Integer aMinPntNb = Max (myMinPointsNb, aMinPntThreshold); //OCC287
myDiscretTool.Initialize (myCurve,
myCurve.FirstParameter(), myCurve.LastParameter(),
aPreciseAngDef, aPreciseLinDef, aMinPntNb,

View File

@@ -34,14 +34,16 @@ public:
//! Constructor.
Standard_EXPORT BRepMesh_CurveTessellator(
const IMeshData::IEdgeHandle& theEdge,
const IMeshTools_Parameters& theParameters);
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Constructor.
Standard_EXPORT BRepMesh_CurveTessellator (
const IMeshData::IEdgeHandle& theEdge,
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters);
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_CurveTessellator ();
@@ -96,6 +98,7 @@ private:
const IMeshTools_Parameters& myParameters;
TopoDS_Edge myEdge;
BRepAdaptor_Curve myCurve;
Standard_Integer myMinPointsNb;
GCPnts_TangentialDeflection myDiscretTool;
TopoDS_Vertex myFirstVertex;
TopoDS_Vertex myLastVertex;

View File

@@ -49,9 +49,10 @@ BRepMesh_EdgeDiscret::~BRepMesh_EdgeDiscret ()
//=======================================================================
Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
{
return new BRepMesh_CurveTessellator(theDEdge, theParameters);
return new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb);
}
//=======================================================================
@@ -62,11 +63,12 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge,
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb)
{
return theDEdge->GetSameParam() ?
new BRepMesh_CurveTessellator(theDEdge, theParameters) :
new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters);
new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb) :
new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters, theMinPointsNb);
}
//=======================================================================

View File

@@ -38,14 +38,16 @@ public:
//! Creates instance of free edge tessellator.
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge,
const IMeshTools_Parameters& theParameters);
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Creates instance of edge tessellator.
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
const IMeshData::IEdgeHandle& theDEdge,
const TopAbs_Orientation theOrientation,
const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters);
const IMeshTools_Parameters& theParameters,
const Standard_Integer theMinPointsNb = 2);
//! Creates instance of tessellation extractor.
Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor(

View File

@@ -73,27 +73,37 @@ Handle(IMeshTools_MeshAlgo) BRepMesh_MeshAlgoFactory::GetAlgo(
switch (theSurfaceType)
{
case GeomAbs_Plane:
return theParameters.InternalVerticesMode ?
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
new BaseMeshAlgo::Type;
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
new DeflectionControlMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
(theParameters.InternalVerticesMode ?
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
new BaseMeshAlgo::Type);
break;
case GeomAbs_Sphere:
return new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
new DeflectionControlMeshAlgo<BRepMesh_SphereRangeSplitter>::Type :
new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
break;
case GeomAbs_Cylinder:
return theParameters.InternalVerticesMode ?
new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
new BaseMeshAlgo::Type;
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
new DeflectionControlMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
(theParameters.InternalVerticesMode ?
new NodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
new BaseMeshAlgo::Type);
break;
case GeomAbs_Cone:
return new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
new DeflectionControlMeshAlgo<BRepMesh_ConeRangeSplitter>::Type :
new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
break;
case GeomAbs_Torus:
return new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
return theParameters.EnableControlSurfaceDeflectionAllSurfaces ?
new DeflectionControlMeshAlgo<BRepMesh_TorusRangeSplitter>::Type :
new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
break;
case GeomAbs_SurfaceOfRevolution:

View File

@@ -50,14 +50,32 @@ namespace
void operator()(const IMeshData::IEdgePtr& theDEdge) const
{
const IMeshData::IEdgeHandle aDEdge = theDEdge;
Standard_Integer aPointsNb = aDEdge->GetCurve()->ParametersNb();
aDEdge->Clear(Standard_True);
aDEdge->SetDeflection(Max(aDEdge->GetDeflection() / 3., Precision::Confusion()));
for (Standard_Integer aPCurveIt = 0; aPCurveIt < aDEdge->PCurvesNb(); ++aPCurveIt)
{
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(aPCurveIt);
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
// Check that outer wire contains 2 edges or less and add an additional point.
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(0);
if (aDWire->EdgesNb() <= 2)
{
++aPointsNb;
break;
}
}
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(0);
const IMeshData::IFaceHandle aDFace = aPCurve->GetFace();
Handle(IMeshTools_CurveTessellator) aTessellator =
BRepMesh_EdgeDiscret::CreateEdgeTessellator(
aDEdge, aPCurve->GetOrientation(), aDFace, myParameters);
aDEdge, aPCurve->GetOrientation(), aDFace,
myParameters, aPointsNb);
BRepMesh_EdgeDiscret::Tessellate3d(aDEdge, aTessellator, Standard_False);
BRepMesh_EdgeDiscret::Tessellate2d(aDEdge, Standard_False);

View File

@@ -556,7 +556,7 @@ Handle(IMeshData::SequenceOfReal) BRepMesh_NURBSRangeSplitter::computeGrainAndFi
const Handle(BRepAdaptor_Surface)& aSurface = GetSurface();
const Standard_Real aMinSize2d = Max(
aSurface->UResolution(theParameters.MinSize),
aSurface->UResolution(theParameters.MinSize));
aSurface->VResolution(theParameters.MinSize));
aMinDiff = Max(aMinSize2d, aMinDiff);

View File

@@ -336,8 +336,10 @@ static BRepOffset_Error checkSinglePoint(const Standard_Real theUParam,
const NCollection_Vector<gp_Pnt>& theBadPoints);
//---------------------------------------------------------------------
static void UpdateTolerance ( TopoDS_Shape& myShape,
const TopTools_IndexedMapOfShape& myFaces);
static void UpdateTolerance ( TopoDS_Shape& theShape,
const TopTools_IndexedMapOfShape& theFaces,
const TopoDS_Shape& theInitShape);
static Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
const Handle(Geom_Curve)& theCrv,
const Standard_Real theFirst,
@@ -1036,8 +1038,16 @@ void BRepOffset_MakeOffset::MakeOffsetShape(const Message_ProgressRange& theRang
// MAJ Tolerance edge and Vertex
// ----------------------------
if (!myOffsetShape.IsNull()) {
UpdateTolerance (myOffsetShape,myFaces);
BRepLib::UpdateTolerances( myOffsetShape );
if (myThickening)
{
UpdateTolerance(myOffsetShape, myFaces, myShape);
}
else
{
TopoDS_Shape aDummy;
UpdateTolerance(myOffsetShape, myFaces, aDummy);
}
BRepLib::UpdateTolerances(myOffsetShape);
}
CorrectConicalFaces();
@@ -3165,13 +3175,38 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
} //if both edges are arcs of circles
if (NewFace.IsNull())
{
BRepLib_MakeFace MF(theWire, Standard_True); //Only plane
if (MF.Error() == BRepLib_FaceDone)
Standard_Real anEdgeTol = BRep_Tool::Tolerance(anEdge);
//Tolerances of input shape should not be increased by BRepLib_MakeFace
BRepLib_FindSurface aFindPlane(theWire, anEdgeTol, Standard_True); //only plane
IsPlanar = Standard_False;
if(aFindPlane.Found() && aFindPlane.ToleranceReached() <= anEdgeTol)
{
NewFace = MF.Face();
IsPlanar = Standard_True;
Standard_Real f, l;
Handle(Geom_Curve) aGC = BRep_Tool::Curve(anEdge, f, l);
Handle(Geom_Plane) aPln = Handle(Geom_Plane)::DownCast(aFindPlane.Surface());
Standard_Real aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
if (aMaxDist <= anEdgeTol)
{
BRepLib_MakeFace MF(aPln->Pln(), theWire);
if (MF.IsDone())
{
NewFace = MF.Face();
TopoDS_Iterator anItE(theWire);
for (; anItE.More(); anItE.Next())
{
const TopoDS_Edge& anE = TopoDS::Edge(anItE.Value());
if (anE.IsSame(anEdge))
continue;
aGC = BRep_Tool::Curve(anE, f, l);
aMaxDist = ComputeMaxDist(aPln->Pln(), aGC, f, l);
BB.UpdateEdge(anE, aMaxDist);
}
IsPlanar = Standard_True;
}
}
}
else //Extrusion (by thrusections)
//
if(!IsPlanar) //Extrusion (by thrusections)
{
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
Handle(Geom_TrimmedCurve) TrEdgeCurve =
@@ -3185,7 +3220,6 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
ThrusecGenerator.AddCurve( TrOffsetCurve );
ThrusecGenerator.Perform( Precision::PConfusion() );
theSurf = ThrusecGenerator.Surface();
//theSurf = new Geom_SurfaceOfLinearExtrusion( TrOffsetCurve, OffsetDir );
Standard_Real Uf, Ul, Vf, Vl;
theSurf->Bounds(Uf, Ul, Vf, Vl);
TopLoc_Location Loc;
@@ -3272,8 +3306,14 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
BB.Range( anE3, FirstPar, LastPar );
}
}
BRepLib::SameParameter(NewFace);
BRepTools::Update(NewFace);
if (!IsPlanar)
{
// For planar faces these operations are useless,
// because there are no curves on surface
BRepLib::SameParameter(NewFace);
BRepTools::Update(NewFace);
}
//Check orientation
TopAbs_Orientation anOr = OrientationOfEdgeInFace(anEdge, aFaceOfEdge);
TopAbs_Orientation OrInNewFace = OrientationOfEdgeInFace(anEdge, NewFace);
@@ -3781,6 +3821,7 @@ void BRepOffset_MakeOffset::EncodeRegularity ()
#endif
}
//=======================================================================
//function : ComputeMaxDist
//purpose :
@@ -3807,13 +3848,15 @@ Standard_Real ComputeMaxDist(const gp_Pln& thePlane,
}
return sqrt(aMaxDist)*1.05;
}
//=======================================================================
//function : UpDateTolerance
//function : UpdateTolerance
//purpose :
//=======================================================================
void UpdateTolerance (TopoDS_Shape& S,
const TopTools_IndexedMapOfShape& Faces)
const TopTools_IndexedMapOfShape& Faces,
const TopoDS_Shape& theInitShape)
{
BRep_Builder B;
TopTools_MapOfShape View;
@@ -3829,12 +3872,31 @@ void UpdateTolerance (TopoDS_Shape& S,
}
}
Standard_Real Tol;
TopExp_Explorer ExpF;
for (ExpF.Init(S, TopAbs_FACE); ExpF.More(); ExpF.Next())
// The edges of initial shape are not modified
TopTools_MapOfShape aMapInitF;
if (!theInitShape.IsNull())
{
const TopoDS_Shape& F = ExpF.Current();
if (Faces.Contains(F))
TopExp_Explorer anExpF(theInitShape, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next()) {
aMapInitF.Add(anExpF.Current());
TopExp_Explorer anExpE;
for (anExpE.Init(anExpF.Current(), TopAbs_EDGE); anExpE.More(); anExpE.Next()) {
View.Add(anExpE.Current());
TopoDS_Iterator anItV(anExpE.Current());
for (; anItV.More(); anItV.Next())
{
View.Add(anItV.Value());
}
}
}
}
Standard_Real Tol;
TopExp_Explorer anExpF(S, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
{
const TopoDS_Shape& F = anExpF.Current();
if (Faces.Contains(F) || aMapInitF.Contains(F))
{
continue;
}
@@ -3843,6 +3905,7 @@ void UpdateTolerance (TopoDS_Shape& S,
for (Exp.Init(F, TopAbs_EDGE); Exp.More(); Exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
Standard_Boolean isUpdated = Standard_False;
Standard_Real aCurrTol = BRep_Tool::Tolerance(E);
if (aBAS.GetType() == GeomAbs_Plane)
{
//Edge does not seem to have pcurve on plane,
@@ -3850,17 +3913,22 @@ void UpdateTolerance (TopoDS_Shape& S,
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCrv = BRep_Tool::Curve(E, aFirst, aLast);
Standard_Real aMaxDist = ComputeMaxDist(aBAS.Plane(), aCrv, aFirst, aLast);
E.Locked (Standard_False);
B.UpdateEdge(E, aMaxDist);
isUpdated = Standard_True;
if (aMaxDist > aCurrTol)
{
B.UpdateEdge(E, aMaxDist);
isUpdated = Standard_True;
}
}
if (View.Add(E))
{
E.Locked(Standard_False);
BRepCheck_Edge EdgeCorrector(E);
Tol = EdgeCorrector.Tolerance();
B.UpdateEdge(E, Tol);
isUpdated = Standard_True;
if (Tol > aCurrTol)
{
B.UpdateEdge(E, Tol);
isUpdated = Standard_True;
}
}
if (isUpdated)
{
@@ -3869,11 +3937,11 @@ void UpdateTolerance (TopoDS_Shape& S,
TopExp::Vertices(E, V[0], V[1]);
for (Standard_Integer i = 0; i <= 1; i++) {
V[i].Locked(Standard_False);
if (View.Add(V[i])) {
Handle(BRep_TVertex) TV = Handle(BRep_TVertex)::DownCast(V[i].TShape());
TV->Tolerance(0.);
BRepCheck_Vertex VertexCorrector(V[i]);
V[i].Locked (Standard_False);
B.UpdateVertex(V[i], VertexCorrector.Tolerance());
// use the occasion to clean the vertices.
(TV->ChangePoints()).Clear();
@@ -4953,6 +5021,53 @@ Standard_Boolean BRepOffset_MakeOffset::IsPlanar()
if (aPlanarityChecker.IsPlanar())
{
gp_Pln aPln = aPlanarityChecker.Plan();
Standard_Real u1, u2, v1, v2, um, vm;
aSurf->Bounds(u1, u2, v1, v2);
Standard_Boolean isInf1 = Precision::IsInfinite(u1), isInf2 = Precision::IsInfinite(u2);
if (!isInf1 && !isInf2)
{
um = (u1 + u2) / 2.;
}
else if(isInf1 && !isInf2)
{
um = u2 - 1.;
}
else if(!isInf1 && isInf2)
{
um = u1 + 1.;
}
else //isInf1 && isInf2
{
um = 0.;
}
isInf1 = Precision::IsInfinite(v1), isInf2 = Precision::IsInfinite(v2);
if (!isInf1 && !isInf2)
{
vm = (v1 + v2) / 2.;
}
else if (isInf1 && !isInf2)
{
vm = v2 - 1.;
}
else if(!isInf1 && isInf2)
{
vm = v1 + 1.;
}
else //isInf1 && isInf2
{
vm = 0.;
}
gp_Pnt aP;
gp_Vec aD1, aD2;
aBAS.D1(um, vm, aP, aD1, aD2);
gp_Vec aNorm = aD1.Crossed(aD2);
gp_Dir aPlnNorm = aPln.Position().Direction();
if (aNorm.Dot(aPlnNorm) < 0.)
{
aPlnNorm.Reverse();
gp_Ax1 anAx(aPln.Position().Location(), aPlnNorm);
aPln.SetAxis(anAx);
}
Handle(Geom_Plane) aPlane = new Geom_Plane(aPln);
TopoDS_Face aPlanarFace;
aBB.MakeFace(aPlanarFace, aPlane, aTolForFace);

View File

@@ -262,6 +262,7 @@ BRepOffsetAPI_ThruSections::BRepOffsetAPI_ThruSections(const Standard_Boolean is
myCritWeights[1] = .2;
myCritWeights[2] = .4;
myUseSmoothing = Standard_False;
myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
}
@@ -286,7 +287,7 @@ void BRepOffsetAPI_ThruSections::Init(const Standard_Boolean isSolid, const Stan
myCritWeights[1] = .2;
myCritWeights[2] = .4;
myUseSmoothing = Standard_False;
myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
}
@@ -343,6 +344,7 @@ void BRepOffsetAPI_ThruSections::CheckCompatibility(const Standard_Boolean check
void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/)
{
myStatus = BRepFill_ThruSectionErrorStatus_Done;
myBFGenerator.Nullify();
//Check set of section for right configuration of punctual sections
Standard_Integer i;
@@ -356,7 +358,10 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
wdeg = wdeg && (BRep_Tool::Degenerated(anEdge));
}
if (wdeg)
throw Standard_Failure("Wrong usage of punctual sections");
{
myStatus = BRepFill_ThruSectionErrorStatus_WrongUsage;
return;
}
}
if (myWires.Length() <= 2)
{
@@ -371,7 +376,8 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
}
if (wdeg)
{
throw Standard_Failure("Wrong usage of punctual sections");
myStatus = BRepFill_ThruSectionErrorStatus_WrongUsage;
return;
}
}
@@ -447,6 +453,13 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
}
}
}
else
{
myStatus = Georges.GetStatus();
NotDone();
return;
}
myWires = WorkingSections;
} //if (myWCheck)
else //no check
@@ -498,6 +511,12 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
NotDone();
return;
}
if (myStatus != BRepFill_ThruSectionErrorStatus_Done)
{
NotDone();
return;
}
// Encode the Regularities
BRepLib::EncodeRegularity(myShape);
}
@@ -520,6 +539,12 @@ void BRepOffsetAPI_ThruSections::CreateRuled()
myBFGenerator->AddWire(TopoDS::Wire(myWires(i)));
}
myBFGenerator->Perform();
BRepFill_ThruSectionErrorStatus aStatus = myBFGenerator->GetStatus();
if (aStatus != BRepFill_ThruSectionErrorStatus_Done)
{
myStatus = aStatus;
return;
}
TopoDS_Shell shell = myBFGenerator->Shell();
if (myIsSolid) {
@@ -739,6 +764,7 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
TS = TotalSurf(shapes,nbSects,nbEdges,w1Point,w2Point,vClosed);
if(TS.IsNull()) {
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
return;
}
@@ -934,14 +960,12 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
else {
myShape = MakeSolid(shell, newW1, newW2, myPres3d, myFirst, myLast);
}
Done();
}
else {
myShape = shell;
Done();
}
Done();
TopTools_DataMapOfShapeReal aVertexToleranceMap;
TopExp_Explorer aTopExplorer(myShape,TopAbs_EDGE);
@@ -1040,7 +1064,9 @@ static Handle(Geom_BSplineCurve) EdgeToBSpline (const TopoDS_Edge& theEdge)
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aLoc, aFirst, aLast);
if (aCurve.IsNull())
throw Standard_NullObject("Null 3D curve in edge");
{
return nullptr;
}
// convert its part used by edge to bspline; note that if edge curve is bspline,
// conversion made via trimmed curve is still needed -- it will copy it, segment
@@ -1132,6 +1158,10 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
// read the first edge to initialise CompBS;
TopoDS_Edge aPrevEdge = TopoDS::Edge (shapes((j-1)*NbEdges+1));
Handle(Geom_BSplineCurve) curvBS = EdgeToBSpline (aPrevEdge);
if (curvBS.IsNull())
{
return nullptr;
}
// initialization
GeomConvert_CompCurveToBSplineCurve CompBS(curvBS);
@@ -1145,6 +1175,10 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
aTolV = Max(aTolV, BRep_Tool::Tolerance(vl));
aTolV = Min(aTolV, 1.e-3);
curvBS = EdgeToBSpline (aNextEdge);
if (curvBS.IsNull())
{
return nullptr;
}
// concatenation
CompBS.Add(curvBS, aTolV, Standard_True, Standard_False, 1);
@@ -1503,7 +1537,11 @@ void BRepOffsetAPI_ThruSections::CriteriumWeight(Standard_Real& W1, Standard_Rea
void BRepOffsetAPI_ThruSections::SetCriteriumWeight(const Standard_Real W1, const Standard_Real W2, const Standard_Real W3)
{
if (W1 < 0 || W2 < 0 || W3 < 0 ) throw Standard_DomainError();
if (W1 < 0 || W2 < 0 || W3 < 0)
{
myStatus = BRepFill_ThruSectionErrorStatus_Failed;
return;
}
myCritWeights[0] = W1;
myCritWeights[1] = W2;
myCritWeights[2] = W3;

View File

@@ -21,6 +21,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BRepFill_ThruSectionErrorStatus.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS_Face.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
@@ -163,6 +164,11 @@ public:
//! Returns the current mutable input state
Standard_EXPORT Standard_Boolean IsMutableInput() const;
//! Returns the status of thrusection operation
BRepFill_ThruSectionErrorStatus GetStatus() const
{
return myStatus;
}
protected:
@@ -206,6 +212,7 @@ private:
Standard_Boolean myUseSmoothing;
Standard_Boolean myMutableInput;
NCollection_Handle<BRepFill_Generator> myBFGenerator;
BRepFill_ThruSectionErrorStatus myStatus;
};

View File

@@ -112,6 +112,7 @@ static Standard_Boolean pidef = Standard_False;
static Standard_Boolean lfdef = Standard_False;
static Standard_Boolean rfdef = Standard_False;
static Standard_Real tesp = 1.0e-4;
static Standard_Real t3d = 1.e-4;
static Standard_Real t2d = 1.e-5;
static Standard_Real ta = 1.e-2;
@@ -2361,7 +2362,7 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
if (Rakk)
delete Rakk;
Rakk = new BRepFilletAPI_MakeFillet(V, FSh);
Rakk->SetParams(ta, t3d, t2d, t3d, t2d, fl);
Rakk->SetParams(ta, tesp, t2d, t3d, t2d, fl);
Rakk->SetContinuity(blend_cont, tapp_angle);
Standard_Real Rad;
TopoDS_Shape S;

View File

@@ -47,7 +47,7 @@
#include <stdio.h>
static Standard_Real tesp = 1.0e-4;
static Standard_Real t3d = 1.e-4;
static Standard_Real t2d = 1.e-5;
static Standard_Real ta = 1.e-2;
@@ -152,7 +152,7 @@ static Standard_Integer BLEND(Draw_Interpretor& di, Standard_Integer narg, const
}
}
Rakk = new BRepFilletAPI_MakeFillet(V,FSh);
Rakk->SetParams(ta,t3d,t2d,t3d,t2d,fl);
Rakk->SetParams(ta, tesp, t2d, t3d, t2d, fl);
Rakk->SetContinuity(blend_cont, tapp_angle);
Standard_Real Rad;
TopoDS_Edge E;
@@ -254,7 +254,7 @@ static Standard_Integer MKEVOL(Draw_Interpretor& di,
if (narg < 3) return 1;
TopoDS_Shape V = DBRep::Get(a[2]);
Rake = new BRepFilletAPI_MakeFillet(V);
Rake->SetParams(ta,t3d,t2d,t3d,t2d,fl);
Rake->SetParams(ta, tesp, t2d, t3d, t2d, fl);
Rake->SetContinuity(blend_cont, tapp_angle);
if (narg == 4) {
ChFi3d_FilletShape FSh = ChFi3d_Rational;
@@ -410,7 +410,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
const TopoDS_Shape& aSolid = Explo.Current();
BRepFilletAPI_MakeFillet Blender(aSolid);
Blender.SetParams(ta,t3d,t2d,t3d,t2d,fl);
Blender.SetParams(ta, tesp, t2d, t3d, t2d, fl);
Blender.SetContinuity( blend_cont, tapp_angle );
TopExp_Explorer expsec( theSection, TopAbs_EDGE );

View File

@@ -443,7 +443,7 @@ Standard_Integer gener(Draw_Interpretor&, Standard_Integer n, const char** a)
//purpose :
//=======================================================================
Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char** a)
Standard_Integer thrusections(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 6) return 1;
@@ -525,7 +525,30 @@ Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char*
BRepTest_Objects::SetHistory(Generator->Wires(), *Generator);
}
else {
std::cout << "Algorithm is not done" << std::endl;
BRepFill_ThruSectionErrorStatus aStatus = Generator->GetStatus();
switch (aStatus)
{
case BRepFill_ThruSectionErrorStatus_NotDone:
di << "Algorithm is not done\n";
break;
case BRepFill_ThruSectionErrorStatus_NotSameTopology:
di << "The input profiles should be all closed or all opened\n";
break;
case BRepFill_ThruSectionErrorStatus_ProfilesInconsistent:
di << "Profiles inconsistent\n";
break;
case BRepFill_ThruSectionErrorStatus_WrongUsage:
di << "Wrong usage of punctual sections\n";
break;
case BRepFill_ThruSectionErrorStatus_Null3DCurve:
di << "Some edges have null 3d curve";
break;
case BRepFill_ThruSectionErrorStatus_Failed:
di << "Algorithm has failed\n";
break;
default:
break;
}
}
return 0;

View File

@@ -4234,6 +4234,133 @@ void BSplCLib::Resolution( Standard_Real& Poles,
UTolerance = Tolerance3D / RealSmall();
}
//=======================================================================
// function : Intervals
// purpose :
//=======================================================================
Standard_Integer BSplCLib::Intervals (const TColStd_Array1OfReal& theKnots,
const TColStd_Array1OfInteger& theMults,
Standard_Integer theDegree,
Standard_Boolean isPeriodic,
Standard_Integer theContinuity,
Standard_Real theFirst,
Standard_Real theLast,
Standard_Real theTolerance,
TColStd_Array1OfReal* theIntervals)
{
// remove all knots with multiplicity less or equal than (degree - continuity) except first and last
Standard_Integer aFirstIndex = isPeriodic ? 1 : FirstUKnotIndex (theDegree, theMults);
Standard_Integer aLastIndex = isPeriodic ? theKnots.Size() : LastUKnotIndex (theDegree, theMults);
TColStd_Array1OfReal aNewKnots (1, aLastIndex - aFirstIndex + 1);
Standard_Integer aNbNewKnots = 0;
for (Standard_Integer anIndex = aFirstIndex; anIndex <= aLastIndex; anIndex++)
{
if (theMults(anIndex) > (theDegree - theContinuity) ||
anIndex == aFirstIndex ||
anIndex == aLastIndex)
{
aNbNewKnots++;
aNewKnots(aNbNewKnots) = theKnots[anIndex];
}
}
aNewKnots.Resize (1, aNbNewKnots, Standard_True);
// the range boundaries
Standard_Real aCurFirst = theFirst;
Standard_Real aCurLast = theLast;
Standard_Real aPeriod = 0.0;
Standard_Integer aFirstPeriod = 0;
Standard_Integer aLastPeriod = 0;
// move boundaries into period
if (isPeriodic)
{
Standard_Real aLower = theKnots.First();
Standard_Real anUpper = theKnots.Last();
aPeriod = anUpper - aLower;
while (aCurFirst < aLower)
{
aCurFirst += aPeriod;
aFirstPeriod--;
}
while (aCurLast < aLower)
{
aCurLast += aPeriod;
aLastPeriod--;
}
while (aCurFirst >= anUpper)
{
aCurFirst -= aPeriod;
aFirstPeriod += 1;
}
while (aCurLast >= anUpper)
{
aCurLast -= aPeriod;
aLastPeriod += 1;
}
}
// locate the left and nearest knot for boundaries
Standard_Integer anIndex1 = 0;
Standard_Integer anIndex2 = 0;
Standard_Real aDummyDouble;
// we use version of LocateParameter that doesn't need multiplicities
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurFirst, Standard_False, 1, aNbNewKnots, anIndex1, aDummyDouble);
LocateParameter(theDegree, aNewKnots, TColStd_Array1OfInteger(), aCurLast, Standard_False, 1, aNbNewKnots, anIndex2, aDummyDouble);
// the case when the beginning of the range coincides with the next knot
if (anIndex1 < aNbNewKnots && Abs(aNewKnots[anIndex1 + 1] - aCurFirst) < theTolerance)
{
anIndex1 += 1;
}
// the case when the ending of the range coincides with the current knot
if (aNbNewKnots && Abs(aNewKnots[anIndex2] - aCurLast) < theTolerance)
{
anIndex2 -= 1;
}
Standard_Integer aNbIntervals = anIndex2 - anIndex1 + 1 + (aLastPeriod - aFirstPeriod) * (aNbNewKnots - 1);
// fill the interval array
if (theIntervals)
{
theIntervals->Resize (1, aNbIntervals + 1, Standard_False);
if (isPeriodic && aLastPeriod != aFirstPeriod)
{
Standard_Integer anIndex = 1;
// part from the begging of range to the end of the first period
for (Standard_Integer i = anIndex1; i < aNewKnots.Size(); i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
}
// full periods
for (Standard_Integer aPeriodNum = aFirstPeriod + 1; aPeriodNum < aLastPeriod; aPeriodNum++)
{
for (Standard_Integer i = 1; i < aNewKnots.Size(); i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aPeriodNum * aPeriod;
}
}
// part from the begging of the last period to the end of range
for (Standard_Integer i = 1; i <= anIndex2; i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aLastPeriod * aPeriod;
}
}
else
{
Standard_Integer anIndex = 1;
for (Standard_Integer i = anIndex1; i <= anIndex2; i++, anIndex++)
{
theIntervals->ChangeValue(anIndex) = aNewKnots[i] + aFirstPeriod * aPeriod;
}
}
// update the first position (the begging of range doesn't coincide with the knot at anIndex1 in general)
theIntervals->ChangeValue(1) = theFirst;
// write the ending of the range (we didn't write it at all)
theIntervals->ChangeValue(aNbIntervals + 1) = theLast;
}
return aNbIntervals;
}
//=======================================================================
// function: FlatBezierKnots
// purpose :

View File

@@ -1456,8 +1456,26 @@ public:
//! we have |f (u1) - f (u0)| < Tolerance3D
Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
//! Splits the given range to BSpline intervals of given continuity
//! @param[in] theKnots the knots of BSpline
//! @param[in] theMults the knots' multiplicities
//! @param[in] theDegree the degree of BSpline
//! @param[in] isPeriodic the periodicity of BSpline
//! @param[in] theContinuity the target interval's continuity
//! @param[in] theFirst the begin of the target range
//! @param[in] theLast the end of the target range
//! @param[in] theTolerance the tolerance
//! @param[in,out] theIntervals the array to store intervals if isn't nullptr
//! @return the number of intervals
Standard_EXPORT static Standard_Integer Intervals (const TColStd_Array1OfReal& theKnots,
const TColStd_Array1OfInteger& theMults,
Standard_Integer theDegree,
Standard_Boolean isPeriodic,
Standard_Integer theContinuity,
Standard_Real theFirst,
Standard_Real theLast,
Standard_Real theTolerance,
TColStd_Array1OfReal* theIntervals);
protected:

View File

@@ -1157,82 +1157,97 @@ void BSplCLib::MergeBSplineKnots
index,
num_knots ;
if (StartValue < EndValue - Tolerance) {
TColStd_Array1OfReal knots1(1,Knots1.Length()) ;
TColStd_Array1OfReal knots2(1,Knots2.Length()) ;
degree = Degree1 + Degree2 ;
index = 1 ;
TColStd_Array1OfReal knots1(1, Knots1.Length());
TColStd_Array1OfReal knots2(1, Knots2.Length());
degree = Degree1 + Degree2;
index = 1;
for (ii = Knots1.Lower() ; ii <= Knots1.Upper() ; ii++) {
knots1(index) = Knots1(ii) ;
index += 1 ;
for (ii = Knots1.Lower(); ii <= Knots1.Upper(); ii++) {
knots1(index) = Knots1(ii);
index += 1;
}
index = 1 ;
index = 1;
for (ii = Knots2.Lower() ; ii <= Knots2.Upper() ; ii++) {
knots2(index) = Knots2(ii) ;
index += 1 ;
for (ii = Knots2.Lower(); ii <= Knots2.Upper(); ii++) {
knots2(index) = Knots2(ii);
index += 1;
}
BSplCLib::Reparametrize(StartValue,
EndValue,
knots1) ;
BSplCLib::Reparametrize(StartValue,
EndValue,
knots2) ;
num_knots = 0 ;
jj = 1 ;
EndValue,
knots1);
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
BSplCLib::Reparametrize(StartValue,
EndValue,
knots2);
num_knots = 0;
jj = 1;
for (ii = 1; ii <= knots1.Length(); ii++) {
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
jj += 1 ;
num_knots += 1 ;
jj += 1;
num_knots += 1;
}
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
jj += 1 ;
jj += 1;
}
num_knots += 1 ;
num_knots += 1;
}
NewKnots =
new TColStd_HArray1OfReal(1,num_knots) ;
NewKnots =
new TColStd_HArray1OfReal(1, num_knots);
NewMults =
new TColStd_HArray1OfInteger(1,num_knots) ;
num_knots = 1 ;
jj = 1 ;
new TColStd_HArray1OfInteger(1, num_knots);
num_knots = 1;
jj = 1;
for (ii = 1 ; ii <= knots1.Length() ; ii++) {
for (ii = 1; ii <= knots1.Length(); ii++) {
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) - Tolerance) {
NewKnots->ChangeArray1()(num_knots) = knots2(jj) ;
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1 ;
jj += 1 ;
num_knots += 1 ;
NewKnots->ChangeArray1()(num_knots) = knots2(jj);
NewMults->ChangeArray1()(num_knots) = Mults2(jj) + Degree1;
jj += 1;
num_knots += 1;
}
set_mults_flag = 0 ;
set_mults_flag = 0;
while (jj <= knots2.Length() && knots2(jj) <= knots1(ii) + Tolerance) {
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj)) ;
set_mults_flag = 1 ;
NewMults->ChangeArray1()(num_knots) = degree - continuity ;
jj += 1 ;
continuity = Min(Degree1 - Mults1(ii), Degree2 - Mults2(jj));
set_mults_flag = 1;
NewMults->ChangeArray1()(num_knots) = degree - continuity;
jj += 1;
}
NewKnots->ChangeArray1()(num_knots) = knots1(ii) ;
if (! set_mults_flag) {
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2 ;
NewKnots->ChangeArray1()(num_knots) = knots1(ii);
if (!set_mults_flag) {
NewMults->ChangeArray1()(num_knots) = Mults1(ii) + Degree2;
}
num_knots += 1 ;
num_knots += 1;
}
num_knots -= 1 ;
NewMults->ChangeArray1()(1) = degree + 1 ;
NewMults->ChangeArray1()(num_knots) = degree + 1 ;
index = 0 ;
num_knots -= 1;
NewMults->ChangeArray1()(1) = degree + 1;
NewMults->ChangeArray1()(num_knots) = degree + 1;
index = 0;
for (ii = 1 ; ii <= num_knots ; ii++) {
index += NewMults->Value(ii) ;
for (ii = 1; ii <= num_knots; ii++) {
index += NewMults->Value(ii);
}
NumPoles = index - degree - 1 ;
NumPoles = index - degree - 1;
}
else
{
degree = Degree1 + Degree2;
num_knots = 2;
NewKnots =
new TColStd_HArray1OfReal(1, num_knots);
NewKnots->ChangeArray1()(1) = StartValue;
NewKnots->ChangeArray1()(num_knots) = EndValue;
NewMults =
new TColStd_HArray1OfInteger(1, num_knots);
NewMults->ChangeArray1()(1) = degree + 1;
NewMults->ChangeArray1()(num_knots) = degree + 1;
NumPoles = BSplCLib::NbPoles(degree, Standard_False, NewMults->Array1());
}
}

View File

@@ -64,19 +64,18 @@ public:
//! given transformation to this box.
BVH_Box<T, 3> Transformed (const NCollection_Mat4<T>& theTransform) const
{
BVH_Box<T, 3> aResultBox;
const BVH_Box<T, 3> *aThis = static_cast<const BVH_Box<T, 3>*>(this);
if (theTransform.IsIdentity())
{
return aResultBox;
return *aThis;
}
const BVH_Box<T, 3> *aThis = static_cast<const BVH_Box<T, 3>*>(this);
if (!aThis->IsValid())
{
return aResultBox;
return *aThis;
}
BVH_Box<T, 3> aResultBox;
for (size_t aX = 0; aX <= 1; ++aX)
{
for (size_t aY = 0; aY <= 1; ++aY)

View File

@@ -28,9 +28,9 @@ void Blend_CSWalking::Perform(Blend_CSFunction& Func,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
const Standard_Real Tol3d,
const Standard_Real TolGuide,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Fleche,
const Standard_Boolean Appro)
{
@@ -40,7 +40,7 @@ void Blend_CSWalking::Perform(Blend_CSFunction& Func,
comptra = Standard_False;
line = new TheLine ();
Standard_Integer Nbvar = Func.NbVariables();
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolgui = Abs(TolGuide);
fleche = Abs(Fleche);
rebrou = Standard_False;
@@ -68,7 +68,7 @@ void Blend_CSWalking::Perform(Blend_CSFunction& Func,
TopAbs_State situ;
// math_Vector tolerance(1,3),infbound(1,3),supbound(1,3);
math_Vector tolerance(1,Nbvar),infbound(1,Nbvar),supbound(1,Nbvar);
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
@@ -115,8 +115,8 @@ void Blend_CSWalking::Perform(Blend_CSFunction& Func,
Standard_Real U,V,W;
previousP.ParametersOnS(U,V);
W = previousP.ParameterOnC();
TheExtremity P1(previousP.PointOnS(),U,V,previousP.Parameter(),tolesp);
TheExtremity P2(previousP.PointOnC(),W,previousP.Parameter(),tolesp);
TheExtremity P1(previousP.PointOnS(),U,V,previousP.Parameter(),tolpoint3d);
TheExtremity P2(previousP.PointOnC(),W,previousP.Parameter(),tolpoint3d);
if (sens>0.) {
line->SetStartPoints(P1,P2);
}

View File

@@ -39,7 +39,7 @@ Blend_Status Blend_CSWalking::TestArret(Blend_CSFunction& Function,
Blend_Status State1,State2;
IntSurf_TypeTrans tras = IntSurf_Undecided;
if (Function.IsSolution(Sol,tolesp)) {
if (Function.IsSolution(Sol,tolpoint3d)) {
pt1 = Function.PointOnS();
pt2 = Function.PointOnC();
@@ -176,15 +176,16 @@ Blend_Status Blend_CSWalking::CheckDeflectionOnSurf
prevP = previousP.PointOnS();
prevTg = previousP.TangentOnS();
tolu = TheSurfaceTool::UResolution(surf,tolesp);
tolv = TheSurfaceTool::VResolution(surf,tolesp);
tolu = TheSurfaceTool::UResolution(surf,tolpoint3d);
tolv = TheSurfaceTool::VResolution(surf,tolpoint3d);
gp_Vec Corde(prevP,Psurf);
Norme = Corde.SquareMagnitude();
prevNorme = prevTg.SquareMagnitude(); // JAG MODIF 25.04.94
if (Norme <= tolesp*tolesp || prevNorme <= tolesp*tolesp) { // JAG MODIF 25.04.94
const Standard_Real toler3d = tolpoint3d;
if (Norme <= toler3d * toler3d || prevNorme <= toler3d * toler3d) { // JAG MODIF 25.04.94
// il faudra peut etre forcer meme point JAG MODIF 25.04.94
return Blend_SamePoints;
}
@@ -275,19 +276,20 @@ Blend_Status Blend_CSWalking::CheckDeflectionOnCurv
prevP = previousP.PointOnC();
prevTg = previousP.TangentOnC();
tolu = TheCurveTool::Resolution(curv,tolesp);
tolu = TheCurveTool::Resolution(curv,tolpoint3d);
gp_Vec Corde(prevP,Pcurv);
Norme = Corde.SquareMagnitude();
prevNorme = prevTg.SquareMagnitude(); // JAG MODIF 25.04.94
const Standard_Real toler3d = tolpoint3d;
// if (Norme <= tolesp*tolesp || prevNorme <= tolesp*tolesp) { // JAG MODIF 25.04.94
if (Norme <= tolesp*tolesp) { // le 95.01.10
if (Norme <= toler3d * toler3d) { // le 95.01.10
// il faudra peut etre forcer meme point JAG MODIF 25.04.94
return Blend_SamePoints;
}
else if (prevNorme > tolesp*tolesp) {
else if (prevNorme > toler3d * toler3d) {
Cosi = sens*Corde*prevTg;
if (Cosi <0.) { // angle 3d>pi/2. --> retour arriere
return Blend_Backward;
@@ -308,7 +310,7 @@ Blend_Status Blend_CSWalking::CheckDeflectionOnCurv
// Voir s il faut faire le controle sur le signe de prevtg*Tgsurf
if (Tgcurv.Magnitude() <= tolesp) {
if (Tgcurv.Magnitude() <= tolpoint3d) {
return Blend_SamePoints; // GROS BOBARD EN ATTENDANT
}
@@ -318,7 +320,7 @@ Blend_Status Blend_CSWalking::CheckDeflectionOnCurv
return Blend_StepTooLarge;
}
if (prevNorme > tolesp*tolesp) {
if (prevNorme > toler3d * toler3d) {
// Estimation de la fleche courante
/*

View File

@@ -205,7 +205,7 @@ void Blend_CSWalking::MakeExtremity(TheExtremity& Extrem,
// Extrem.SetValue(previousP.PointOnS(),sol(1),sol(2),tolesp);
previousP.ParametersOnS(U,V);
Extrem.SetValue(previousP.PointOnS(),U,V,previousP.Parameter(),tolesp);
Extrem.SetValue(previousP.PointOnS(),U,V,previousP.Parameter(),tolpoint3d);
Iter = domain;

View File

@@ -40,7 +40,7 @@ void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
//IntSurf_Transition Tline,Tarc;
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
@@ -146,9 +146,9 @@ void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
// Indiquer que fin sur Bound.
}
else {
@@ -171,9 +171,9 @@ void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Arrive = Standard_True;
if (line->NbPoints()>=2) {
// Indiquer qu on s arrete en cours de cheminement
@@ -214,9 +214,9 @@ void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
// Indiquer que fin sur Bound.
}
else {
@@ -244,7 +244,7 @@ void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
MakeExtremity(Exts,Index,solrst(1),Isvtx,Vtx);
// Extc.SetValue(previousP.PointOnC(),sol(3),tolesp);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Arrive = Standard_True;
}
break;
@@ -259,9 +259,9 @@ void Blend_CSWalking::InternalPerform(Blend_CSFunction& Func,
*/
previousP.ParametersOnS(U,V);
Exts.SetValue(previousP.PointOnS(),U,V,
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Extc.SetValue(previousP.PointOnC(),previousP.ParameterOnC(),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Arrive = Standard_True;
}
break;

View File

@@ -62,9 +62,9 @@ void Blend_Walking::Perform(Blend_Function& Func,
const Standard_Real Pdep,
const Standard_Real Pmax,
const Standard_Real MaxStep,
const Standard_Real Tol3d,
const Standard_Real TolGuide,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Fleche,
const Standard_Boolean Appro)
{
@@ -75,7 +75,7 @@ void Blend_Walking::Perform(Blend_Function& Func,
Standard_Boolean doextremities = 1;
if(line.IsNull()) line = new TheLine ();
else {line->Clear();doextremities = 0;}
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolgui = Abs(TolGuide);
fleche = Abs(Fleche);
rebrou = Standard_False;
@@ -96,7 +96,7 @@ void Blend_Walking::Perform(Blend_Function& Func,
TopAbs_State situ1,situ2;
math_Vector tolerance(1,4),infbound(1,4),supbound(1,4);
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
@@ -143,9 +143,9 @@ void Blend_Walking::Perform(Blend_Function& Func,
if(doextremities){
TheExtremity ptf1 (previousP.PointOnS1(),
sol(1),sol(2),tolesp);
sol(1),sol(2),tolpoint3d);
TheExtremity ptf2 (previousP.PointOnS2(),
sol(3),sol(4),tolesp);
sol(3),sol(4),tolpoint3d);
if (!previousP.IsTangencyPoint()) {
ptf1.SetTangent(previousP.TangentOnS1());
ptf2.SetTangent(previousP.TangentOnS2());
@@ -168,7 +168,7 @@ void Blend_Walking::Perform(Blend_Function& Func,
Standard_Boolean Blend_Walking::PerformFirstSection(Blend_Function& Func,
const Standard_Real Pdep,
math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Tol3d,
const Standard_Real TolGuide,
TopAbs_State& Pos1,
TopAbs_State& Pos2)
@@ -176,7 +176,7 @@ Standard_Boolean Blend_Walking::PerformFirstSection(Blend_Function& Func,
iscomplete = Standard_False;
comptra = Standard_False;
line = new TheLine ();
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolgui = Abs(TolGuide);
Pos1 = Pos2 = TopAbs_UNKNOWN;
@@ -185,7 +185,7 @@ Standard_Boolean Blend_Walking::PerformFirstSection(Blend_Function& Func,
Func.Set(param);
math_Vector tolerance(1, 4),infbound(1, 4),supbound(1, 4);
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
Func.GetBounds(infbound, supbound);
math_FunctionSetRoot rsnld(Func, tolerance, 30);
@@ -220,7 +220,7 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
const Standard_Real Pdep,
const Standard_Real Pmax,
const math_Vector& ParDep,
const Standard_Real Tolesp,
const Standard_Real Tol3d,
const Standard_Real TolGuide,
const Standard_Boolean RecOnS1,
const Standard_Boolean RecOnS2,
@@ -235,7 +235,7 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
Standard_Real w1, w2, extrapol;
Standard_Boolean recad1, recad2;
tolesp = Abs(Tolesp);
tolpoint3d = Tol3d;
tolgui = Abs(TolGuide);
if (Pmax - Pdep >= 0.0)
{
@@ -262,7 +262,7 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
Standard_Real CorrectedU = 0., CorrectedV = 0.;
gp_Pnt CorrectedPnt;
Func.GetTolerance(tolerance, tolesp);
Func.GetTolerance(tolerance, tolpoint3d);
Func.GetBounds(infbound, supbound);
math_FunctionSetRoot rsnld(Func, tolerance, 30);
@@ -409,9 +409,9 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
#endif
MakeExtremity(Ext1, Standard_True, Index1, solrst1(1), Isvtx1, Vtx1);
if (ToCorrectOnRst1)
Ext2.SetValue(CorrectedPnt, CorrectedU, CorrectedV, tolesp);
Ext2.SetValue(CorrectedPnt, CorrectedU, CorrectedV, tolpoint3d);
else
Ext2.SetValue(previousP.PointOnS2(), sol(3), sol(4), tolesp);
Ext2.SetValue(previousP.PointOnS2(), sol(3), sol(4), tolpoint3d);
}
break;
@@ -424,9 +424,9 @@ Standard_Boolean Blend_Walking::PerformFirstSection (Blend_Function& Func,
}
#endif
if (ToCorrectOnRst2)
Ext1.SetValue(CorrectedPnt, CorrectedU, CorrectedV, tolesp);
Ext1.SetValue(CorrectedPnt, CorrectedU, CorrectedV, tolpoint3d);
else
Ext1.SetValue(previousP.PointOnS1(), sol(1), sol(2), tolesp);
Ext1.SetValue(previousP.PointOnS1(), sol(1), sol(2), tolpoint3d);
MakeExtremity(Ext2, Standard_False, Index2, solrst2(1), Isvtx2, Vtx2);
}
break;

View File

@@ -41,7 +41,7 @@ Blend_Status Blend_Walking::TestArret(Blend_Function& Function,
IntSurf_TypeTrans tras1,tras2;
Blend_Point curpoint;
Standard_Boolean loctwist1 = Standard_False, loctwist2 = Standard_False;
Standard_Real tolsolu = tolesp;
Standard_Real tolsolu = tolpoint3d;
if ( !TestSolu) tolsolu *= 1000; //Ca doit toujours etre bon
if (Function.IsSolution(sol,tolsolu)) {
@@ -211,8 +211,8 @@ Blend_Status Blend_Walking::CheckDeflection
if(!prevpointistangent){
prevTg = previousP.TangentOnS1();
}
tolu = TheSurfaceTool::UResolution(surf1,tolesp);
tolv = TheSurfaceTool::VResolution(surf1,tolesp);
tolu = TheSurfaceTool::UResolution(surf1,tolpoint3d);
tolv = TheSurfaceTool::VResolution(surf1,tolpoint3d);
}
else {
Psurf = CurPoint.PointOnS2();
@@ -223,8 +223,8 @@ Blend_Status Blend_Walking::CheckDeflection
if(!prevpointistangent){
prevTg = previousP.TangentOnS2();
}
tolu = TheSurfaceTool::UResolution(surf2,tolesp);
tolv = TheSurfaceTool::VResolution(surf2,tolesp);
tolu = TheSurfaceTool::UResolution(surf2,tolpoint3d);
tolv = TheSurfaceTool::VResolution(surf2,tolpoint3d);
}
gp_Vec Corde(prevP,Psurf);
@@ -233,12 +233,13 @@ Blend_Status Blend_Walking::CheckDeflection
if(!prevpointistangent) prevNorme = prevTg.SquareMagnitude();
if (Norme <= tolesp*tolesp){
const Standard_Real toler3d = 0.01 * tolpoint3d;
if (Norme <= toler3d * toler3d){
// il faudra peut etre forcer meme point
return Blend_SamePoints;
}
if(!prevpointistangent){
if(prevNorme <= tolesp*tolesp) {
if(prevNorme <= toler3d * toler3d) {
return Blend_SamePoints;
}
Cosi = sens*Corde*prevTg;

View File

@@ -125,7 +125,7 @@ Standard_Boolean Blend_Walking::Recadre(Blend_FuncInv& FuncInv,
infb(2) -= Extrap;
supb(2) += Extrap;
FuncInv.GetTolerance(toler,tolesp/10);//Il vaut mieux garder un peu de marge
FuncInv.GetTolerance(toler,0.1 * tolpoint3d);//Il vaut mieux garder un peu de marge
math_FunctionSetRoot rsnld(FuncInv,toler,35);
toler *= 10; // Mais on fait les tests correctements
@@ -262,7 +262,7 @@ Standard_Boolean Blend_Walking::Recadre(Blend_FuncInv& FuncInv,
else solrst(1) = pmin;
}
// On verifie le jalon
jalons_Trouve = (FuncInv.IsSolution(solrst,tolesp));
jalons_Trouve = (FuncInv.IsSolution(solrst,tolpoint3d));
}
if (!jalons_Trouve) {
@@ -276,7 +276,7 @@ Standard_Boolean Blend_Walking::Recadre(Blend_FuncInv& FuncInv,
}
else {
rsnld.Root(solrst);
recadre = FuncInv.IsSolution(solrst,tolesp);
recadre = FuncInv.IsSolution(solrst,tolpoint3d);
}
}
@@ -310,7 +310,7 @@ Standard_Boolean Blend_Walking::Recadre(Blend_FuncInv& FuncInv,
// Le probleme a resoudre
FuncInv.Set(OnFirst,thecur);
FuncInv.GetBounds(infb,supb);
FuncInv.GetTolerance(toler,tolesp/10);//Il vaut mieux garder un peu de marge
FuncInv.GetTolerance(toler,0.1 * tolpoint3d);//Il vaut mieux garder un peu de marge
math_FunctionSetRoot aRsnld(FuncInv,toler,35);
toler *= 10; // Mais on fait les tests correctements
// Resolution...
@@ -324,7 +324,7 @@ Standard_Boolean Blend_Walking::Recadre(Blend_FuncInv& FuncInv,
}
else {
aRsnld.Root(solrst);
recadre = FuncInv.IsSolution(solrst,tolesp);
recadre = FuncInv.IsSolution(solrst,tolpoint3d);
}
}
@@ -453,7 +453,7 @@ void Blend_Walking::MakeExtremity(TheExtremity& Extrem,
if (OnFirst) {
Extrem.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnS1());
Iter = recdomain1;
@@ -461,7 +461,7 @@ void Blend_Walking::MakeExtremity(TheExtremity& Extrem,
else {
Extrem.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
if (!previousP.IsTangencyPoint())
Extrem.SetTangent(previousP.TangentOnS2());
Iter = recdomain2;

View File

@@ -135,7 +135,7 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
//IntSurf_Transition Tline,Tarc;
Func.GetTolerance(tolerance,tolesp);
Func.GetTolerance(tolerance,tolpoint3d);
Func.GetBounds(infbound,supbound);
math_FunctionSetRoot rsnld(Func,tolerance,30);
@@ -173,10 +173,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
if (Abs(stepw) < tolgui) {
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
@@ -227,7 +227,7 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
if (recad1) {
Standard_Real wtemp;
wtemp = solrst1(2);
if ((param - wtemp)/sens>= -10*tolesp){
if ((param - wtemp)/sens>= -10*tolgui){
w1 = solrst1(2);
control = Standard_True;
}
@@ -253,7 +253,7 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
if (recad2) {
Standard_Real wtemp;
wtemp = solrst2(2);
if ((param - wtemp)/sens>= -10*tolesp){
if ((param - wtemp)/sens>= -10*tolgui){
w2 = solrst2(2);
control = Standard_True;
}
@@ -505,10 +505,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
Arrive = Standard_True;
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(), tolesp);
previousP.Parameter(), tolpoint3d);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
@@ -533,10 +533,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
if (Abs(stepw) < tolgui) {
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
@@ -584,10 +584,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
Arrive = Standard_True;
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());
@@ -627,15 +627,15 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
MakeExtremity(Ext1,Standard_True,Index1,
solrst1(1),Isvtx1,Vtx1);
// On blinde le cas singulier ou un des recadrage a planter
if (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) {
if (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2.0 * tolpoint3d)) {
Ext2.SetValue(previousP.PointOnS1(),
sol(3),sol(4),tolesp);
sol(3),sol(4),tolpoint3d);
if (Isvtx1) MakeSingularExtremity(Ext2, Standard_False, Vtx1);
}
else {
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
}
Arrive = Standard_True;
}
@@ -661,15 +661,15 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
#endif
// On blinde le cas singulier ou un des recadrage a plante
if (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) {
if (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2.0 * tolpoint3d)) {
Ext1.SetValue(previousP.PointOnS2(),
sol(1),sol(2),tolesp);
sol(1),sol(2),tolpoint3d);
if (Isvtx2) MakeSingularExtremity(Ext1, Standard_True, Vtx2);
}
else {
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
}
MakeExtremity(Ext2,Standard_False,Index2,
solrst2(1),Isvtx2,Vtx2);
@@ -698,7 +698,7 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
#endif
if ( (Isvtx1 != Isvtx2) &&
(previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) ) {
(previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2.0 * tolpoint3d)) ) {
// On blinde le cas singulier ou un seul recadrage
// est reconnu comme vertex.
if (Isvtx1) {
@@ -727,10 +727,10 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
#endif
Ext1.SetValue(previousP.PointOnS1(),
sol(1),sol(2),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
Ext2.SetValue(previousP.PointOnS2(),
sol(3),sol(4),
previousP.Parameter(),tolesp);
previousP.Parameter(),tolpoint3d);
if (!previousP.IsTangencyPoint()) {
Ext1.SetTangent(previousP.TangentOnS1());
Ext2.SetTangent(previousP.TangentOnS2());

View File

@@ -198,7 +198,8 @@ void ChFi3d_Builder::Compute()
ChFi3d_InitChron(cl_total);
ChFi3d_InitChron(cl_extent);
#endif
UpdateTolesp();
if (myListStripe.IsEmpty())
throw Standard_Failure("There are no suitable edges for chamfer or fillet");
@@ -335,7 +336,7 @@ void ChFi3d_Builder::Compute()
}
// 05/02/02 akm ^^^
Standard_Integer solidindex = st->SolidIndex();
ChFi3d_FilDS(solidindex,st,DStr,myRegul,tolesp,tol2d);
ChFi3d_FilDS(solidindex,st,DStr,myRegul,tolapp3d,tol2d);
if (!done) break;
}

View File

@@ -849,6 +849,10 @@ private:
Handle(BRepAdaptor_Surface)& HS1,
Handle(BRepAdaptor_Surface)& HS2) const;
//! Assign to tolesp parameter minimal value of spine's tolesp if it is less
//! than default initial value.
Standard_EXPORT void UpdateTolesp();
TopoDS_Shape myShape;
Standard_Real angular;

View File

@@ -325,7 +325,7 @@ ChFi3d_Builder::ChFi3d_Builder(const TopoDS_Shape& S,
myEShMap.Fill(S,TopAbs_EDGE,TopAbs_SHELL);
myVFMap.Fill(S,TopAbs_VERTEX,TopAbs_FACE);
myVEMap.Fill(S,TopAbs_VERTEX,TopAbs_EDGE);
SetParams(Ta,1.e-4,1.e-5,1.e-4,1.e-5,1.e-3);
SetParams(Ta, 1.0e-4, 1.e-5, 1.e-4, 1.e-5, 1.e-3);
SetContinuity(GeomAbs_C1, Ta);
}
@@ -336,7 +336,7 @@ ChFi3d_Builder::ChFi3d_Builder(const TopoDS_Shape& S,
void ChFi3d_Builder::SetParams(const Standard_Real Tang,
const Standard_Real Tesp,
const Standard_Real T2d,
const Standard_Real T2d,
const Standard_Real TApp3d,
const Standard_Real TolApp2d,
const Standard_Real Fleche)

View File

@@ -188,7 +188,7 @@ static Standard_Boolean BonVoisin(const gp_Pnt& Point,
Standard_Real& XDep,
Standard_Real& YDep,
const ChFiDS_Map& EFMap,
const Standard_Real tolesp)
const Standard_Real tol3d)
{
Standard_Boolean bonvoisin = 1;
Standard_Real winter, Uf, Ul;
@@ -203,7 +203,7 @@ static Standard_Boolean BonVoisin(const gp_Pnt& Point,
const TopoDS_Edge& ecur = TopoDS::Edge(Ex.Current());
if(!ecur.IsSame(cured)){
hc->Initialize(ecur);
Standard_Real tolc = hc->Resolution(tolesp);
Standard_Real tolc = hc->Resolution(tol3d);
if(ChFi3d_InterPlaneEdge(plane,hc,winter,1,tolc)){
gp_Pnt np = hc->Value(winter);
Standard_Real ndist = np.SquareDistance(papp);
@@ -848,7 +848,7 @@ void ChFi3d_Builder::StartSol(const Handle(ChFiDS_Stripe)& Stripe,
const BRepAdaptor_Curve& Ced = Spine->CurrentElementarySpine(iedge);
gp_Pnt pnt = Ced.Value(woned);
if (Projection(PExt, pnt, els, w, tolesp) &&
if (Projection(PExt, pnt, els, w, tolapp3d) &&
PerformFirstSection(Spine,HGuide,Choix,HS1,HS2,
I1,I2,w,SolDep,Pos1,Pos2)) {
P1.SetCoord(SolDep(1),SolDep(2));
@@ -894,7 +894,7 @@ void ChFi3d_Builder::StartSol(const Handle(ChFiDS_Stripe)& Stripe,
// Extrema_LocateExtPC ext(pnt,els,w,1.e-8);
// if(ext.IsDone()){
// w = ext.Point().Parameter();
if (Projection(PExt, pnt, els, w, tolesp)) {
if (Projection(PExt, pnt, els, w, tolapp3d)) {
PerformFirstSection(Spine,HGuide,Choix,HS1,HS2,
I1,I2,w,SolDep,Pos1,Pos2);
gp_Pnt P;
@@ -909,11 +909,11 @@ void ChFi3d_Builder::StartSol(const Handle(ChFiDS_Stripe)& Stripe,
NbChangement++) {
if(Pos1 != TopAbs_IN){
bonvoisin = BonVoisin(P, HS1, f1, plane, cured,
SolDep(1),SolDep(2), myEFMap, tolesp);
SolDep(1),SolDep(2), myEFMap, tolapp3d);
}
if(Pos2 != TopAbs_IN && bonvoisin){
bonvoisin = BonVoisin(P, HS2, f2, plane, cured,
SolDep(3),SolDep(4), myEFMap, tolesp);
SolDep(3),SolDep(4), myEFMap, tolapp3d);
}
if(bonvoisin){
f1 = HS1->Face();
@@ -2712,7 +2712,7 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
pcprev1->D1(prevpar1,pdeb1,vdeb1);
pcnext1->D1(nextpar1,pfin1,vfin1);
Bon1 = ChFi3d_mkbound(S1,PC1,-1,pdeb1,vdeb1,1,
pfin1,vfin1,tolesp,2.e-4);
pfin1,vfin1,tolapp3d,2.e-4);
}
}
else{
@@ -2731,11 +2731,11 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
pdeb1 = PC1->Value(pardeb1);
pfin1 = PC1->Value(parfin1);
Bon1 = ChFi3d_mkbound(S1,PC1,-1,pdeb1,Vdeb1,1,
pfin1,Vfin1,tolesp,2.e-4);
pfin1,Vfin1,tolapp3d,2.e-4);
}
}
else{
Bon1 = ChFi3d_mkbound(S1,PC1,tolesp,2.e-4);
Bon1 = ChFi3d_mkbound(S1,PC1,tolapp3d,2.e-4);
}
if(tw2){
if(!yaprevon2 || !yanexton2){
@@ -2770,7 +2770,7 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
pcprev2->D1(prevpar2,pdeb2,vdeb2);
pcnext2->D1(nextpar2,pfin2,vfin2);
Bon2 = ChFi3d_mkbound(S2,PC2,-1,pdeb2,vdeb2,1,
pfin2,vfin2,tolesp,2.e-4);
pfin2,vfin2,tolapp3d,2.e-4);
}
}
else{
@@ -2789,11 +2789,11 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
pdeb2 = PC2->Value(pardeb2);
pfin2 = PC2->Value(parfin2);
Bon2 = ChFi3d_mkbound(S2,PC2,-1,pdeb2,Vdeb2,1,
pfin2,Vfin2,tolesp,2.e-4);
pfin2,Vfin2,tolapp3d,2.e-4);
}
}
else{
Bon2 = ChFi3d_mkbound(S2,PC2,tolesp,2.e-4);
Bon2 = ChFi3d_mkbound(S2,PC2,tolapp3d,2.e-4);
}
// The parameters of neighbor traces are updated, so
// straight lines uv are pulled.
@@ -2817,8 +2817,8 @@ void ChFi3d_Builder::PerformSetOfKGen(Handle(ChFiDS_Stripe)& Stripe,
gp_Pnt2d pdebs2 = pcsprev2->Value(prevpar2);
gp_Pnt2d pfins1 = pcsnext1->Value(nextpar1);
gp_Pnt2d pfins2 = pcsnext2->Value(nextpar2);
Bdeb = ChFi3d_mkbound(sprev,pdebs1,pdebs2,tolesp,2.e-4);
Bfin = ChFi3d_mkbound(snext,pfins1,pfins2,tolesp,2.e-4);
Bdeb = ChFi3d_mkbound(sprev,pdebs1,pdebs2,tolapp3d,2.e-4);
Bfin = ChFi3d_mkbound(snext,pfins1,pfins2,tolapp3d,2.e-4);
GeomFill_ConstrainedFilling fil(11,20);
if(pointuon1) fil.Init(Bon2,Bfin,Bdeb,1);
@@ -3046,7 +3046,7 @@ void ChFi3d_Builder::PerformSetOfSurf(Handle(ChFiDS_Stripe)& Stripe,
ChFi3d_InitChron(ch); // init perf for ChFi3d_MakeExtremities
#endif
if(!Simul) ChFi3d_MakeExtremities(Stripe,DStr,myEFMap,tolesp,tol2d);
if(!Simul) ChFi3d_MakeExtremities(Stripe,DStr,myEFMap,tolapp3d,tol2d);
#ifdef OCCT_DEBUG
ChFi3d_ResultChron(ch, t_makextremities); // result perf t_makextremities

View File

@@ -416,7 +416,7 @@ Standard_Boolean ChFi3d_Builder::CompleteData
const Standard_Boolean Gf2)
{
TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
Data->ChangeSurf(DStr.AddSurface(TopOpeBRepDS_Surface(Surfcoin,tolesp)));
Data->ChangeSurf(DStr.AddSurface(TopOpeBRepDS_Surface(Surfcoin,tolapp3d)));
#ifdef DRAW
ChFi3d_SettraceDRAWFIL(Standard_True);
if (ChFi3d_GettraceDRAWFIL()) {
@@ -987,7 +987,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
Standard_Real NewFirst = PFirst;
if(RecP || RecS || RecRst){
if(!TheWalk.PerformFirstSection(Func,FInv,FInvP,FInvC,PFirst,Target,Soldep,
tolesp,TolGuide,RecRst,RecP,RecS,
tolapp3d,tolapp2d,TolGuide,RecRst,RecP,RecS,
NewFirst,ParSol)){
#ifdef OCCT_DEBUG
std::cout<<"ChFi3d_Builder::ComputeData : calculation fail first section"<<std::endl;
@@ -1001,7 +1001,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
while (again < 2){
TheWalk.Perform (Func,FInv,FInvP,FInvC,NewFirst,Last,
MS,TolGuide,ParSol,tolesp,Fleche,Appro);
MS,tolapp3d,tolapp2d,TolGuide,ParSol,Fleche,Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG
@@ -1119,7 +1119,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
Standard_Real NewFirst = PFirst;
if (RecP1 || RecRst1 || RecP2 || RecRst2) {
if (!TheWalk.PerformFirstSection(Func, FInv1, FInvP1, FInv2, FInvP2, PFirst, Target, Soldep,
tolesp, TolGuide, RecRst1, RecP1, RecRst2, RecP2,
tolapp3d, TolGuide, RecRst1, RecP1, RecRst2, RecP2,
NewFirst, ParSol)){
#ifdef OCCT_DEBUG
std::cout<<"ChFi3d_Builder::ComputeData : fail calculation first section"<<std::endl;
@@ -1133,7 +1133,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
while (again < 2){
TheWalk.Perform (Func, FInv1, FInvP1, FInv2, FInvP2, NewFirst, Last,
MS, TolGuide, ParSol, tolesp, Fleche, Appro);
MS, tolapp3d, TolGuide, ParSol, Fleche, Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG
@@ -1249,7 +1249,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
Standard_Real NewFirst = PFirst;
if(RecP || RecS || RecRst){
if(!TheWalk.PerformFirstSection(Func,FInv,FInvP,FInvC,PFirst,Target,Soldep,
tolesp,TolGuide,RecRst,RecP,RecS,
tolapp3d,tolapp2d,TolGuide,RecRst,RecP,RecS,
NewFirst,ParSol)){
#ifdef OCCT_DEBUG
@@ -1264,7 +1264,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
while (again < 2){
TheWalk.Perform (Func,FInv,FInvP,FInvC,NewFirst,Last,
MS,TolGuide,ParSol,tolesp,Fleche,Appro);
MS,tolapp3d,tolapp2d,TolGuide,ParSol,Fleche,Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG
std::cout << "Path not done" << std::endl;
@@ -1375,7 +1375,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
Standard_Real NewFirst = PFirst;
if (RecP1 || RecRst1 || RecP2 || RecRst2) {
if(!TheWalk.PerformFirstSection(Func, FInv1, FInvP1, FInv2, FInvP2, PFirst, Target, Soldep,
tolesp, TolGuide, RecRst1, RecP1, RecRst2, RecP2,
tolapp3d, TolGuide, RecRst1, RecP1, RecRst2, RecP2,
NewFirst,ParSol)){
#ifdef OCCT_DEBUG
@@ -1390,7 +1390,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
while (again < 2){
TheWalk.Perform (Func, FInv1, FInvP1, FInv2, FInvP2, NewFirst, Last,
MS, TolGuide, ParSol, tolesp, Fleche, Appro);
MS, tolapp3d, TolGuide, ParSol, Fleche, Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG
std::cout << "Path not created" << std::endl;
@@ -1518,7 +1518,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
if(!HS.IsNull()) F2 = HS->Face();
// Path framing variables
Standard_Real TolGuide=tolguide, TolEsp = tolesp;
Standard_Real TolGuide=tolguide;
Standard_Integer nbptmin = 4;
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
@@ -1559,7 +1559,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
BP.ParametersOnS1(vec(1),vec(2));
BP.ParametersOnS2(vec(3),vec(4));
Func.Set(param);
if (Func.IsSolution(vec, tolesp)) {
if (Func.IsSolution(vec, tolapp3d)) {
TheWalk.AddSingularPoint(BP);
}
}
@@ -1574,7 +1574,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
BP.ParametersOnS1(vec(1),vec(2));
BP.ParametersOnS2(vec(3),vec(4));
Func.Set(param);
if (Func.IsSolution(vec, tolesp)) {
if (Func.IsSolution(vec, tolapp3d)) {
TheWalk.AddSingularPoint(BP);
}
}
@@ -1587,7 +1587,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
Standard_Real NewFirst = PFirst;
if(RecOnS1 || RecOnS2){
if(!TheWalk.PerformFirstSection(Func,FInv,PFirst,Target,Soldep,
tolesp,TolGuide,RecOnS1,RecOnS2,
tolapp3d,TolGuide,RecOnS1,RecOnS2,
NewFirst,ParSol)){
#ifdef OCCT_DEBUG
std::cout<<"ChFi3d_Builder::ComputeData : calculation fail first section"<<std::endl;
@@ -1617,10 +1617,9 @@ Standard_Boolean ChFi3d_Builder::ComputeData
if(!again && (MS < 5*TolGuide)) MS = 5*TolGuide;
else {
if (5*TolGuide > MS) TolGuide = MS/5;
if (5*TolEsp > MS) TolEsp = MS/5;
}
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
ParSol,TolEsp,Fleche,Appro);
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,tolapp3d,TolGuide,
ParSol,Fleche,Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG
std::cout << "Path is not created" << std::endl;
@@ -1776,7 +1775,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
narc2 = Lin->StartPointOnSecond().NbPointOnRst();
if(narc1 != 0) {
ChFi3d_FilCommonPoint(Lin->StartPointOnFirst(),Lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(), tolapp3d);
debarc1 = Standard_True;
if(!SearchFace(Spine,Data->VertexFirstOnS1(),F1,bif)){
//It is checked if there is not an obstacle.
@@ -1794,7 +1793,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
}
if(narc2 != 0){
ChFi3d_FilCommonPoint(Lin->StartPointOnSecond(),Lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
debarc2 = Standard_True;
if(!SearchFace(Spine,Data->VertexFirstOnS2(),F2,bif)){
//It is checked if it is not an obstacle.
@@ -1831,7 +1830,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
backwContinueFailed = Lin->StartPointOnFirst().ParameterOnGuide() > Target;
else {
ChFi3d_FilCommonPoint(Lin->StartPointOnFirst(),Lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(), tolapp3d);
debarc1 = Standard_True;
if(!SearchFace(Spine,Data->VertexFirstOnS1(),F1,bif)){
//It is checked if it is not an obstacle.
@@ -1853,7 +1852,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
backwContinueFailed = Lin->StartPointOnSecond().ParameterOnGuide() > Target;
else {
ChFi3d_FilCommonPoint(Lin->StartPointOnSecond(),Lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(), tolapp3d);
debarc2 = Standard_True;
if(!SearchFace(Spine,Data->VertexFirstOnS2(),F2,bif)){
//It is checked if it is not an obstacle.
@@ -1889,7 +1888,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
narc2 = Lin->EndPointOnSecond().NbPointOnRst();
if(narc1 != 0){
ChFi3d_FilCommonPoint(Lin->EndPointOnFirst(),Lin->TransitionOnS1(),
Standard_False, Data->ChangeVertexLastOnS1(),tolesp);
Standard_False, Data->ChangeVertexLastOnS1(), tolapp3d);
finarc1 = Standard_True;
if(!SearchFace(Spine,Data->VertexLastOnS1(),F1,bif)){
//It is checked if it is not an obstacle.
@@ -1902,7 +1901,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
}
if(narc2 != 0){
ChFi3d_FilCommonPoint(Lin->EndPointOnSecond(),Lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(), tolapp3d);
finarc2 = Standard_True;
if(!SearchFace(Spine,Data->VertexLastOnS2(),F2,bif)){
//It is checked if it is not an obstacle.
@@ -1934,7 +1933,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
forwContinueFailed = Lin->EndPointOnFirst().ParameterOnGuide() < Target;
else {
ChFi3d_FilCommonPoint(Lin->EndPointOnFirst(),Lin->TransitionOnS1(),
Standard_False, Data->ChangeVertexLastOnS1(),tolesp);
Standard_False, Data->ChangeVertexLastOnS1(), tolapp3d);
finarc1 = Standard_True;
if(!SearchFace(Spine,Data->VertexLastOnS1(),F1,bif)){
//It is checked if it is not an obstacle.
@@ -1951,7 +1950,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
forwContinueFailed = Lin->EndPointOnSecond().ParameterOnGuide() < Target;
else {
ChFi3d_FilCommonPoint(Lin->EndPointOnSecond(),Lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(), tolapp3d);
finarc2 = Standard_True;
if(!SearchFace(Spine,Data->VertexLastOnS2(),F2,bif)){
//On regarde si ce n'est pas un obstacle.
@@ -2125,7 +2124,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
TheWalk.Check2d(Standard_False);
Standard_Real MS = MaxStep;
Standard_Real TolGuide=tolguide, TolEsp = tolesp;
Standard_Real TolGuide=tolguide;
Standard_Integer Nbpnt = 0;
Standard_Real SpFirst = HGuide->FirstParameter();
Standard_Real SpLast = HGuide->LastParameter();
@@ -2145,7 +2144,7 @@ Standard_Boolean ChFi3d_Builder::SimulData
Standard_Real NewFirst = PFirst;
if(RecOnS1 || RecOnS2){
if(!TheWalk.PerformFirstSection(Func,FInv,PFirst,Target,Soldep,
tolesp,TolGuide,RecOnS1,RecOnS2,
tolapp3d,TolGuide,RecOnS1,RecOnS2,
NewFirst,ParSol)){
#ifdef OCCT_DEBUG
std::cout<<"ChFi3d_Builder::SimulData : calculation fail first section"<<std::endl;
@@ -2163,11 +2162,10 @@ Standard_Boolean ChFi3d_Builder::SimulData
if(!again && (MS < 5*TolGuide)) MS = 5*TolGuide;
else {
if (5*TolGuide > MS) TolGuide = MS/5;
if (5*TolEsp > MS) TolEsp = MS/5;
}
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
ParSol,TolEsp,Fleche,Appro);
TheWalk.Perform(Func,FInv,NewFirst,Target,MS,tolapp3d,TolGuide,
ParSol,Fleche,Appro);
if (!TheWalk.IsDone()) {
#ifdef OCCT_DEBUG

View File

@@ -725,7 +725,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
ChFiDS_CommonPoint saveCPopArc = CPopArc;
c3df = DStr.Curve(FiopArc.LineIndex()).Curve();
inters = IntersUpdateOnSame (HGs,HBs,c3df,Fop,Fv,Arcprol,Vtx,isfirst,10*tolesp, // in
inters = IntersUpdateOnSame (HGs,HBs,c3df,Fop,Fv,Arcprol,Vtx,isfirst,10*tolapp3d, // in
FiopArc,CPopArc,p2dbout,wop); // out
Handle(BRepAdaptor_Curve2d) pced = new BRepAdaptor_Curve2d();
@@ -763,7 +763,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
TopoDS_Edge edgecouture;
Standard_Boolean couture,intcouture=Standard_False;
Standard_Real tolreached = tolesp;
Standard_Real tolreached = tolapp3d;
Standard_Real par1 =0.,par2 =0.;
Standard_Integer indpt = 0,Icurv1 = 0,Icurv2 = 0;
Handle(Geom_TrimmedCurve) curv1,curv2;
@@ -817,7 +817,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
if (!ChFi3d_ComputeCurves(HGs,HBs,Pardeb,Parfin,Cc,
Ps,
Pc,tolesp,tol2d,tolreached))
Pc,tolapp3d,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
Udeb = Cc->FirstParameter();
@@ -1238,7 +1238,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
Handle(Geom2d_Curve) zob2dop, zob2dv;
//Standard_Real tolreached;
if (!ChFi3d_ComputeCurves(HBop,HBs,Pardeb,Parfin,zob3d,zob2dop,
zob2dv,tolesp,tol2d,tolreached))
zob2dv,tolapp3d,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
Udeb = zob3d->FirstParameter();
@@ -2143,7 +2143,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
const Handle(Geom_Curve)& c3df = DStr.Curve(Fi1.LineIndex()).Curve();
Standard_Real Ufi= Fi2.Parameter(isfirst);
ChFiDS_FaceInterference& Fi = Fd->ChangeInterferenceOnS1();
if (!IntersUpdateOnSame (HGs,HBs,c3df,F1,Face[0],Edge[0],Vtx,isfirst,10*tolesp, // in
if (!IntersUpdateOnSame (HGs,HBs,c3df,F1,Face[0],Edge[0],Vtx,isfirst,10*tolapp3d, // in
Fi,CV1,pfac1,Ufi)) // out
throw Standard_Failure("IntersectionAtEnd: pb intersection Face - Fi");
Fi1 = Fi;
@@ -2155,14 +2155,14 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
paredge2 = proj.LowerDistanceParameter();
}
// update stripe point
TopOpeBRepDS_Point tpoint (CV1.Point(),tolesp);
TopOpeBRepDS_Point tpoint (CV1.Point(),tolapp3d);
indpoint1=DStr.AddPoint(tpoint);
stripe->SetIndexPoint(indpoint1,isfirst,1);
// reset arc of CV1
TopoDS_Vertex vert1,vert2;
TopExp::Vertices(Edge[0],vert1,vert2);
TopAbs_Orientation arcOri = Vtx.IsSame(vert1) ? TopAbs_FORWARD : TopAbs_REVERSED;
CV1.SetArc(tolesp,Edge[0],paredge2,arcOri);
CV1.SetArc(tolapp3d,Edge[0],paredge2,arcOri);
}
else {
if (Hc1.IsNull()) {
@@ -2389,7 +2389,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
const Handle(Geom_Curve)& c3df = DStr.Curve(Fi2.LineIndex()).Curve();
Standard_Real Ufi= Fi1.Parameter(isfirst);
ChFiDS_FaceInterference& Fi = Fd->ChangeInterferenceOnS2();
if (!IntersUpdateOnSame (HGs,HBs,c3df,F2,F,Edge[nb],Vtx,isfirst,10*tolesp, // in
if (!IntersUpdateOnSame (HGs,HBs,c3df,F2,F,Edge[nb],Vtx,isfirst,10*tolapp3d, // in
Fi,CV2,pfac2,Ufi)) // out
throw Standard_Failure("IntersectionAtEnd: pb intersection Face - Fi");
Fi2 = Fi;
@@ -2403,14 +2403,14 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
paredge2 = proj.LowerDistanceParameter();
}
// update stripe point
TopOpeBRepDS_Point tpoint (CV2.Point(),tolesp);
TopOpeBRepDS_Point tpoint (CV2.Point(),tolapp3d);
indpoint2=DStr.AddPoint(tpoint);
stripe->SetIndexPoint(indpoint2,isfirst,2);
// reset arc of CV2
TopoDS_Vertex vert1,vert2;
TopExp::Vertices(Edge[nbface],vert1,vert2);
TopAbs_Orientation arcOri = Vtx.IsSame(vert1) ? TopAbs_FORWARD : TopAbs_REVERSED;
CV2.SetArc(tolesp,Edge[nbface],paredge2,arcOri);
CV2.SetArc(tolapp3d,Edge[nbface],paredge2,arcOri);
}
@@ -2483,7 +2483,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
//////////////////////////////////////////////////////////////////////
if (!ChFi3d_ComputeCurves(HGs,HBs,Pardeb,Parfin,Cc,
Ps,Pc,tolesp,tol2d,tolreached,nbface==1)) {
Ps,Pc,tolapp3d,tol2d,tolreached,nbface==1)) {
PerformMoreThreeCorner (Index,1);
return;
}
@@ -2799,7 +2799,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
Standard_Real aTolreached;
ChFi3d_ComputePCurv(Cc,UV1,UV2,Ps,
DStr.Surface(SDprev->Surf()).Surface(),
p1,p2,tolesp,aTolreached);
p1,p2,tolapp3d,aTolreached);
TopOpeBRepDS_Curve& TCurv = DStr.ChangeCurve(indcurve[nb-1]);
TCurv.Tolerance(Max(TCurv.Tolerance(),aTolreached));
@@ -2858,7 +2858,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
//box.Add(aSurf->Value(UV.X(), UV.Y()));
ChFi3d_ComputeArete(CV1,UV1,CV2,UV2,aSurf, // in
C3d,Ps,p1,p2,tolesp,tol2d,aTolreached,0); // out except tolers
C3d,Ps,p1,p2,tolapp3d,tol2d,aTolreached,0); // out except tolers
indpoint1 = indpoint2 = midIpoint;
gp_Pnt point;
@@ -2890,7 +2890,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const Standard_Integer Index)
UV1.SetCoord(isUShrink ? 1 : 2, prevSDParam);
UV2.SetCoord(isUShrink ? 1 : 2, prevSDParam);
ChFi3d_ComputePCurv(C3d,UV1,UV2,Pc,aSurf,p1,p2,tolesp,aTolreached);
ChFi3d_ComputePCurv(C3d,UV1,UV2,Pc,aSurf,p1,p2,tolapp3d,aTolreached);
Crv.Tolerance(Max(Crv.Tolerance(),aTolreached));
Interfc= ChFi3d_FilCurveInDS (Icurv,IsurfPrev,Pc,TopAbs::Reverse(orcourbe));
@@ -3974,7 +3974,7 @@ void ChFi3d_Builder::IntersectMoreCorner(const Standard_Integer Index)
Handle(Geom2dAdaptor_Curve) pcprol = new Geom2dAdaptor_Curve(gpcprol);
Standard_Real partemp = BRep_Tool::Parameter(Vtx,Arcprol);
inters = Update(HBs,pcprol,HGs,FiopArc,CPopArc,p2dbout,
isfirst,partemp,wop,10*tolesp);
isfirst,partemp,wop,10*tolapp3d);
}
Handle(BRepAdaptor_Curve2d) pced = new BRepAdaptor_Curve2d();
pced->Initialize(CPadArc.Arc(),Fv);
@@ -3987,7 +3987,7 @@ void ChFi3d_Builder::IntersectMoreCorner(const Standard_Integer Index)
TopoDS_Edge edgecouture;
Standard_Boolean couture,intcouture=Standard_False;
Standard_Real tolreached = tolesp;
Standard_Real tolreached = tolapp3d;
Standard_Real par1 = 0.,par2 = 0.;
Standard_Integer indpt =0,Icurv1 =0,Icurv2 =0;
Handle(Geom_TrimmedCurve) curv1,curv2;
@@ -4039,7 +4039,7 @@ void ChFi3d_Builder::IntersectMoreCorner(const Standard_Integer Index)
if (!ChFi3d_ComputeCurves(HGs,HBs,Pardeb,Parfin,Cc,
Ps,
Pc,tolesp,tol2d,tolreached))
Pc,tolapp3d,tol2d,tolreached))
throw Standard_Failure("OneCorner : failed calculation intersection");
Udeb = Cc->FirstParameter();
@@ -4311,7 +4311,7 @@ void ChFi3d_Builder::IntersectMoreCorner(const Standard_Integer Index)
Handle(Geom2d_Curve) zob2dop, zob2dv;
// Standard_Real tolreached;
if (!ChFi3d_ComputeCurves(HBop,HBs,Pardeb,Parfin,zob3d,zob2dop,
zob2dv,tolesp,tol2d,tolreached))
zob2dv,tolapp3d,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
Udeb = zob3d->FirstParameter();

View File

@@ -230,7 +230,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
}
gp_Pnt psp1 = Hpivot->Value(parCP1);
gp_Pnt psp2 = Hpivot->Value(parCP2);
Standard_Real sameparam = (psp1.Distance(psp2) < 10 * tolesp);
Standard_Real sameparam = (psp1.Distance(psp2) < 10.0 * tolapp3d);
TopoDS_Face FF1 = TopoDS::Face(DStr.Shape(Fd1->Index(IFaArc1)));
TopoDS_Face FF2 = TopoDS::Face(DStr.Shape(Fd2->Index(IFaArc2)));
@@ -289,10 +289,10 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
Reduce(UIntPC1,UIntPC2,HS1,HS2);
}
Standard_Real tolreached = tolesp;
Standard_Real tolreached = tolapp3d;
if (IFaCo1 == 1 &&
!ChFi3d_ComputeCurves(HS1,HS2,Pardeb,Parfin,Gc,
PGc1,PGc2,tolesp,tol2d,tolreached)) {
PGc1,PGc2,tolapp3d,tol2d,tolreached)) {
#ifdef OCCT_DEBUG
std::cout<<"failed to calculate bevel error interSS"<<std::endl;
#endif
@@ -301,7 +301,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
}
else if (IFaCo1 == 2 &&
!ChFi3d_ComputeCurves(HS1,HS2,Parfin,Pardeb,Gc,
PGc1,PGc2,tolesp,tol2d,tolreached)) {
PGc1,PGc2,tolapp3d,tol2d,tolreached)) {
#ifdef OCCT_DEBUG
std::cout<<"failed to calculate bevel error interSS"<<std::endl;
#endif
@@ -451,7 +451,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
Standard_Real tolreached;
if (!ChFi3d_ComputeCurves(SmaHS,BigHS,Pardeb,Parfin,Gc,
PGc1,PGc2,tolesp,tol2d,tolreached)) {
PGc1,PGc2,tolapp3d,tol2d,tolreached)) {
#ifdef OCCT_DEBUG
std::cout<<"failed to calculate bevel failed interSS"<<std::endl;
#endif
@@ -573,7 +573,7 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
ChFi3d_BoundFac (*HF, uu1, uu2, vv1, vv2, Standard_True);
if (!ChFi3d_ComputeCurves(HF,BigHS,Pardeb,Parfin,Gc,
PGc1,PGc2,tolesp,tol2d,tolreached)) {
PGc1,PGc2,tolapp3d,tol2d,tolreached)) {
#ifdef OCCT_DEBUG
std::cout<<"fail calculation bevel fail interSS"<<std::endl;
#endif
@@ -638,7 +638,26 @@ Standard_Boolean ChFi3d_Builder::PerformTwoCornerbyInter(const Standard_Integer
}
//=======================================================================
//function : UpdateTolesp
//purpose : Update tolesp field to fit it to range of parameter of spine curve
//=======================================================================
void ChFi3d_Builder::UpdateTolesp()
{
ChFiDS_ListIteratorOfListOfStripe itel;
// tolesp = Precision::Infinite();
for (itel.Initialize(myListStripe); itel.More(); itel.Next())
{
Handle(ChFiDS_Stripe)& curStripe = itel.Value();
Handle(ChFiDS_Spine)& Spine = curStripe->ChangeSpine();
const Standard_Real current_stripe_tolesp = Spine->GetTolesp();
if (tolesp > current_stripe_tolesp)
{
tolesp = current_stripe_tolesp;
}
}
}

View File

@@ -2053,7 +2053,7 @@ void ChFi3d_Builder::PerformMoreThreeCorner(const Standard_Integer Jndex,
// Using constraint order > 0 very often causes unpredicable undulations of solution
Standard_Integer degree = 3, nbcurvpnt = 10, nbiter = 1;
Standard_Integer constr = 1; //G1
GeomPlate_BuildPlateSurface PSurf(degree, nbcurvpnt, nbiter, tol2d, tolesp, angular);
GeomPlate_BuildPlateSurface PSurf(degree, nbcurvpnt, nbiter, tol2d, tolapp3d, angular);
// calculation of curves on surface for each stripe
for (ic=0;ic<nedge;ic++) {
gp_Pnt2d p2d1, p2d2;
@@ -2081,7 +2081,7 @@ void ChFi3d_Builder::PerformMoreThreeCorner(const Standard_Integer Jndex,
//Order.SetValue(ic,1);
Order.SetValue(ic, constr);
Handle(GeomPlate_CurveConstraint) Cont =
new GeomPlate_CurveConstraint(HCons,Order.Value(ic), nbcurvpnt,tolesp,angular,0.1);
new GeomPlate_CurveConstraint(HCons,Order.Value(ic),nbcurvpnt,tolapp3d,angular,0.1);
PSurf.Add(Cont);
// calculate indexes of points and of the curve for the DS
@@ -2378,7 +2378,7 @@ void ChFi3d_Builder::PerformMoreThreeCorner(const Standard_Integer Jndex,
if (isG1.Value(ic))
Order.SetValue(n3d,1);
Handle(GeomPlate_CurveConstraint) Cont =
new GeomPlate_CurveConstraint(HCons,Order.Value(n3d),10,tolesp,angular,0.1);
new GeomPlate_CurveConstraint(HCons,Order.Value(n3d),10,tolapp3d,angular,0.1);
PSurf.Add(Cont);
//calculation of curve 3d if it is not a projection
@@ -2502,7 +2502,7 @@ void ChFi3d_Builder::PerformMoreThreeCorner(const Standard_Integer Jndex,
Handle(Adaptor3d_CurveOnSurface) HCons =new Adaptor3d_CurveOnSurface(CurvOnS);
Order.SetValue(n3d,1);
Handle(GeomPlate_CurveConstraint) Cont =
new GeomPlate_CurveConstraint(HCons,Order.Value(n3d),10,tolesp,angular,0.1);
new GeomPlate_CurveConstraint(HCons,Order.Value(n3d),10,tolapp3d,angular,0.1);
PSurf.Add(Cont);
TopOpeBRepDS_Curve tcurv3d( cproj,error);
indcurve3d.SetValue(n3d, DStr.AddCurve(tcurv3d));
@@ -2615,7 +2615,7 @@ void ChFi3d_Builder::PerformMoreThreeCorner(const Standard_Integer Jndex,
Handle(Adaptor3d_CurveOnSurface) HCons =new Adaptor3d_CurveOnSurface(CurvOnS);
Order.SetValue(n3d,0);
Handle(GeomPlate_CurveConstraint) Cont =
new GeomPlate_CurveConstraint(HCons,Order.Value(n3d),10,tolesp,angular,0.1);
new GeomPlate_CurveConstraint(HCons,Order.Value(n3d),10,tolapp3d,angular,0.1);
PSurf.Add(Cont);
TopOpeBRepDS_Curve tcurv3d( ctrim,1.e-4);
indcurve3d.SetValue(n3d, DStr.AddCurve(tcurv3d));

View File

@@ -654,7 +654,7 @@ Standard_Boolean ChFi3d_Builder::SplitKPart
// Cutting of tangency lines (hatching).
Geom2dHatch_Intersector Inter(pitol,pitol);
Geom2dHatch_Hatcher H1(Inter,tol2d,tolesp), H2(Inter,tol2d,tolesp);
Geom2dHatch_Hatcher H1(Inter,tol2d,tolapp3d), H2(Inter,tol2d,tolapp3d);
Standard_Integer ie;
Handle(Geom2d_Curve) C1 = Data->InterferenceOnS1().PCurveOnFace();
Geom2dAdaptor_Curve ll1;

View File

@@ -822,13 +822,13 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
Data->SetSimul(sec);
Data->Set2dPoints(pf1,pl1,pf2,pl2);
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
Standard_False,Data->ChangeVertexLastOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(),tolapp3d);
Standard_Boolean reverse = (!Forward || Inside);
if(intf && reverse){
@@ -932,13 +932,13 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
Data->SetSimul(sec);
Data->Set2dPoints(pf1,pl1,pf2,pl2);
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
Standard_False,Data->ChangeVertexLastOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(),tolapp3d);
Standard_Boolean reverse = (!Forward || Inside);
if(intf && reverse){
@@ -1017,13 +1017,13 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
Data->SetSimul(sec);
Data->Set2dPoints(pf1,pl1,pf2,pl2);
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
Standard_False,Data->ChangeVertexLastOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(),tolapp3d);
Standard_Boolean reverse = (!Forward || Inside);
if(intf && reverse){
@@ -1175,7 +1175,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
if (chsp.IsNull())
throw Standard_ConstructionError("PerformSurf : this is not the spine of a chamfer");
Standard_Real TolGuide = HGuide->Resolution(tolesp) ;
Standard_Real TolGuide = HGuide->Resolution(tolapp3d);
if (chsp->IsChamfer() == ChFiDS_Sym) {
@@ -1244,7 +1244,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
}
return TheWalk.PerformFirstSection(*pFunc,Par,SolDep,
tolesp,TolGuide,Pos1,Pos2);
tolapp3d,TolGuide,Pos1,Pos2);
}
else if (chsp->IsChamfer() == ChFiDS_TwoDist) {
Standard_Real dis1, dis2;
@@ -1347,7 +1347,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
}
return TheWalk.PerformFirstSection(*pFunc,Par,SolDep,
tolesp,TolGuide,Pos1,Pos2);
tolapp3d,TolGuide,Pos1,Pos2);
}
else { //distance and angle
Standard_Real dis1, angle;
@@ -1415,7 +1415,7 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
}
return TheWalk.PerformFirstSection(Func,Par,SolDep,
tolesp,TolGuide,Pos1,Pos2);
tolapp3d,TolGuide,Pos1,Pos2);
} //distance and angle
}

View File

@@ -478,7 +478,7 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
if (!ComputeIntersection(DStr,fdpiv,coin,
p3d[fin],p2d[fin],p3d[deb],p2d[deb],
gcpiv,pivpc1,pivpc2,deru,derv,ptbid,
tolesp,tol2d,tolrcoinpiv))
tolapp3d,tol2d,tolrcoinpiv))
throw StdFail_NotDone("echec calcul intersection coin-pivot");
gp_Vec norpiv = deru.Crossed(derv);
@@ -495,7 +495,7 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
if (!ComputeIntersection(DStr,fddeb,coin,
p3d[pivot],p2d1,p3d[fin],p2d2,
gcdeb,debpc1,debpc2,deru,derv,ptbid,
tolesp,tol2d,tolrcoindeb))
tolapp3d,tol2d,tolrcoindeb))
throw StdFail_NotDone("echec calcul intersection coin-deb");
Icf = DStr.AddCurve(TopOpeBRepDS_Curve(gcdeb,tolrcoindeb));
@@ -514,7 +514,7 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
if (!ComputeIntersection(DStr,fdfin,coin,
p3dface,p2d1,p3d[deb],p2d2,
gcfin,finpc1,finpc2,deru,derv,ptbid,
tolesp,tol2d,tolrcoinfin))
tolapp3d,tol2d,tolrcoinfin))
throw StdFail_NotDone("echec calcul intersection coin-face");
Icl = DStr.AddCurve(TopOpeBRepDS_Curve(gcfin,tolrcoinfin));
@@ -543,8 +543,8 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
gaf->Initialize(face[pivot]);
Standard_Real tolr;
ChFi3d_ProjectPCurv(gac,gaf,facepc1,tolesp,tolr);
ChFi3d_ProjectPCurv(gac,gas,facepc2,tolesp,tolr);
ChFi3d_ProjectPCurv(gac,gaf,facepc1,tolapp3d,tolr);
ChFi3d_ProjectPCurv(gac,gas,facepc2,tolapp3d,tolr);
}
}
}
@@ -616,18 +616,18 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
// les bords de coin sont des lignes courbes qui suivent les
// tangentes donnees
Bfac = ChFi3d_mkbound(Fac,PCurveOnFace,sens[deb],p2d[pivot],Tgpiv,
sens[fin],p2d[3],Tg3,tolesp,2.e-4);
sens[fin],p2d[3],Tg3,tolapp3d,2.e-4);
Bpiv = ChFi3d_mkbound(Surf,PCurveOnPiv,sens[deb],p2d[fin],vpfin,
sens[fin],p2d[deb],vpdeb,tolesp,2.e-4);
sens[fin],p2d[deb],vpdeb,tolapp3d,2.e-4);
}
else {
// les bords de coin sont des segments
// Bfac = ChFi3d_mkbound(Fac,PCurveOnFace,p2d[pivot],
// p2d[3],tolesp,2.e-4);
Bfac = ChFi3d_mkbound(Fac,PCurveOnFace,p2d[pivot],
p2d[3],tolesp,2.e-4);
p2d[3],tolapp3d,2.e-4);
Bpiv = ChFi3d_mkbound(Surf,PCurveOnPiv,p2d[fin],
p2d[deb],tolesp,2.e-4);
p2d[deb],tolapp3d,2.e-4);
}
gp_Pnt2d pdeb1 = fddeb->Interference(jf[deb][pivot]).PCurveOnSurf()->Value(p[deb][pivot]);
@@ -637,15 +637,15 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
if (issmooth) {
// il faut homogeneiser, mettre les bords "BoundWithSurf"
Bdeb = ChFi3d_mkbound(DStr.Surface(fddeb->Surf()).Surface(),pdeb1,pdeb2,tolesp,2.e-4);
Bfin = ChFi3d_mkbound(DStr.Surface(fdfin->Surf()).Surface(),pfin1,pfin2,tolesp,2.e-4);
Bdeb = ChFi3d_mkbound(DStr.Surface(fddeb->Surf()).Surface(),pdeb1,pdeb2,tolapp3d,2.e-4);
Bfin = ChFi3d_mkbound(DStr.Surface(fdfin->Surf()).Surface(),pfin1,pfin2,tolapp3d,2.e-4);
}
else {
// ou les 4 bords de type "FreeBoundary"
Bdeb = ChFi3d_mkbound(DStr.Surface(fddeb->Surf()).Surface(),pdeb1,pdeb2,
tolesp,2.e-4,Standard_True);
tolapp3d,2.e-4,Standard_True);
Bfin = ChFi3d_mkbound(DStr.Surface(fdfin->Surf()).Surface(),pfin1,pfin2,
tolesp,2.e-4,Standard_True);
tolapp3d,2.e-4,Standard_True);
}
GeomFill_ConstrainedFilling fil(8,20);
fil.Init(Bpiv,Bfin,Bfac,Bdeb);
@@ -704,7 +704,7 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeFirstPCurve(),P1deb,P2deb,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
TopOpeBRepDS_Curve Tcurv(C3d,tolreached);
Icf = DStr.AddCurve(Tcurv);
}
@@ -733,7 +733,7 @@ void ChFi3d_ChBuilder::PerformThreeCorner(const Standard_Integer Jndex)
ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeLastPCurve(),P1fin,P2fin,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
TopOpeBRepDS_Curve Tcurv(C3d,tolreached);
Icl = DStr.AddCurve(Tcurv);
}

View File

@@ -689,13 +689,13 @@ ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
Data->SetSimul(sec);
Data->Set2dPoints(pf1,pl1,pf2,pl2);
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
Standard_False,Data->ChangeVertexLastOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(),tolapp3d);
Standard_Boolean reverse = (!Forward || Inside);
if(intf && reverse){
Standard_Boolean ok = Standard_False;
@@ -857,13 +857,13 @@ void ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
// gp_Pnt2d pbid;
Data->Set2dPoints(ppcf,ppcl,pf,pl);
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS2(),tolesp);
Standard_False,Data->ChangeVertexLastOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS1(),tolesp);
Standard_False, Data->ChangeVertexLastOnS1(),tolapp3d);
}
//=======================================================================
@@ -989,13 +989,13 @@ void ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
//gp_Pnt2d pbid;
Data->Set2dPoints(pf,pl,ppcf,ppcl);
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
Standard_False,Data->ChangeVertexLastOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(),tolapp3d);
}
@@ -1153,13 +1153,13 @@ void ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)& Data,
// Data->Set2dPoints(pf,pl,pbid,pbid);
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
Standard_False,Data->ChangeVertexLastOnS1(),tolapp3d);
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d);
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
Standard_False, Data->ChangeVertexLastOnS2(),tolapp3d);
}
@@ -1188,14 +1188,14 @@ Standard_Boolean ChFi3d_FilBuilder::PerformFirstSection
{
Handle(ChFiDS_FilSpine) fsp = Handle(ChFiDS_FilSpine)::DownCast(Spine);
if(fsp.IsNull()) throw Standard_ConstructionError("PerformSurf : this is not the spine of a fillet");
Standard_Real TolGuide = HGuide->Resolution(tolesp);
Standard_Real TolGuide = HGuide->Resolution(tolapp3d);
if(fsp->IsConstant()){
BRepBlend_ConstRad Func(S1,S2,HGuide);
Func.Set(fsp->Radius(),Choix);
Func.Set(myShape);
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
return TheWalk.PerformFirstSection(Func,Par,SolDep,
tolesp,TolGuide,Pos1,Pos2);
tolapp3d,TolGuide,Pos1,Pos2);
}
else {
BRepBlend_EvolRad Func(S1,S2,HGuide,fsp->Law(HGuide));
@@ -1203,7 +1203,7 @@ Standard_Boolean ChFi3d_FilBuilder::PerformFirstSection
Func.Set(myShape);
BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
return TheWalk.PerformFirstSection(Func,Par,SolDep,
tolesp,TolGuide,Pos1,Pos2);
tolapp3d,TolGuide,Pos1,Pos2);
}
}

View File

@@ -321,7 +321,7 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
parCP2 = CP2.ParameterOnArc();
gp_Pnt tst1 = Hpivot->Value(parCP1);
gp_Pnt tst2 = Hpivot->Value(parCP2);
sameparam = tst1.Distance(tst2) <= tolesp;
sameparam = tst1.Distance(tst2) <= tolapp3d;
}
Handle(BRepAdaptor_Surface) HFaCo = new BRepAdaptor_Surface();
Handle(BRepAdaptor_Surface) HFaPiv;
@@ -477,18 +477,18 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
#ifdef OCCT_DEBUG
ChFi3d_InitChron(ch ); // init perf filling
#endif
B1 = ChFi3d_mkbound(surf1,p2df1,p2da1,tolesp,2.e-4);
B2 = ChFi3d_mkbound(surf2,p2df2,p2da2,tolesp,2.e-4);
B1 = ChFi3d_mkbound(surf1,p2df1,p2da1,tolapp3d,2.e-4);
B2 = ChFi3d_mkbound(surf2,p2df2,p2da2,tolapp3d,2.e-4);
Handle(Geom2d_Curve) PCurveOnFace;
Bfac = ChFi3d_mkbound(HFaCo,PCurveOnFace,Sens1,p2dfac1,v2dfac1,
Sens2,p2dfac2,v2dfac2,tolesp,2.e-4);
Sens2,p2dfac2,v2dfac2,tolapp3d,2.e-4);
GeomFill_ConstrainedFilling fil(8,20);
if(sameparam) {
fil.Init(Bfac,B2,B1,1);
}
else {
Handle(Adaptor3d_Curve) HPivTrim = Hpivot->Trim(Min(parCP1,parCP2),Max(parCP1,parCP2),tolesp);
Bpiv = new GeomFill_SimpleBound(HPivTrim,tolesp,2.e-4);
Bpiv = new GeomFill_SimpleBound(HPivTrim,tolapp3d,2.e-4);
fil.Init(Bfac,B2,Bpiv,B1,1);
BRepAdaptor_Curve2d pcpivot;
gp_Vec dArc,dcf;
@@ -597,14 +597,14 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeFirstPCurve(),P1deb,P2deb,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
Standard_Real par1 = sd1->Interference(IFaArc1).Parameter(isfirst1);
pp1 = sd1->Interference(IFaCo1).PCurveOnSurf()->Value(par1);
pp2 = sd1->Interference(IFaArc1).PCurveOnSurf()->Value(par1);
Standard_Real tolr1;
ChFi3d_ComputePCurv(C3d,pp1,pp2,st1->ChangePCurve(isfirst1),
DStr.Surface(sd1->Surf()).Surface(),
P1deb,P2deb,tolesp,tolr1);
P1deb,P2deb,tolapp3d,tolr1);
tolreached = Max(tolreached,tolr1);
TopOpeBRepDS_Curve Tcurv1(C3d,tolreached);
Icf = DStr.AddCurve(Tcurv1);
@@ -624,14 +624,14 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeLastPCurve(),P1fin,P2fin,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
Standard_Real par2 = sd2->Interference(IFaArc2).Parameter(isfirst2);
pp1 = sd2->Interference(IFaCo2).PCurveOnSurf()->Value(par2);
pp2 = sd2->Interference(IFaArc2).PCurveOnSurf()->Value(par2);
Standard_Real tolr2;
ChFi3d_ComputePCurv(C3d,pp1,pp2,st2->ChangePCurve(isfirst2),
DStr.Surface(sd2->Surf()).Surface(),
P1deb,P2deb,tolesp,tolr2);
P1deb,P2deb,tolapp3d,tolr2);
tolreached = Max(tolreached,tolr2);
TopOpeBRepDS_Curve Tcurv2(C3d,tolreached);
Icl = DStr.AddCurve(Tcurv2);
@@ -732,7 +732,7 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
Handle(Geom_Surface) surfsam = DStr.Surface(sdsam->Surf()).Surface();
Handle(GeomAdaptor_Surface) Hsurfsam = new GeomAdaptor_Surface(surfsam);
Handle(Geom2d_Curve) pcsurfsam;
Bsam = ChFi3d_mkbound(Hsurfsam,pcsurfsam,ppopsam,ppcosam,tolesp,2.e-4);
Bsam = ChFi3d_mkbound(Hsurfsam,pcsurfsam,ppopsam,ppcosam,tolapp3d,2.e-4);
Standard_Real upcopdif = sddif->Interference(ifaopdif).Parameter(isfirstdif);
gp_Pnt2d ppopdif =
sddif->Interference(ifaopdif).PCurveOnSurf()->Value(upcopdif);
@@ -741,7 +741,7 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
Handle(Geom_Surface) surfdif = DStr.Surface(sddif->Surf()).Surface();
Handle(GeomAdaptor_Surface) Hsurfdif = new GeomAdaptor_Surface(surfdif);
Handle(Geom2d_Curve) pcsurfdif;
Bdif = ChFi3d_mkbound(Hsurfdif,pcsurfdif,ppcodif,ppopdif,tolesp,2.e-4);
Bdif = ChFi3d_mkbound(Hsurfdif,pcsurfdif,ppcodif,ppopdif,tolapp3d,2.e-4);
gp_Pnt2d ppfacsam,ppfacdif;
gp_Pnt PPfacsam,PPfacdif;
gp_Vec VVfacsam,VVfacdif;
@@ -773,7 +773,7 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
Handle(Geom2d_Curve) pcFopsam = ChFi3d_BuildPCurve(HBRFopsam,
ppfacsam,VVfacsam,
ppfacdif,VVfacdif,1);
Bfac = ChFi3d_mkbound(HBRFopsam,pcFopsam,tolesp,2.e-4);
Bfac = ChFi3d_mkbound(HBRFopsam,pcFopsam,tolapp3d,2.e-4);
GeomFill_ConstrainedFilling fil(8,20);
fil.Init(Bsam,Bdif,Bfac,1);
#if 0
@@ -827,10 +827,10 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeFirstPCurve(),P1deb,P2deb,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
Standard_Real tolr1;
Handle(GeomAdaptor_Curve) HC3d = new GeomAdaptor_Curve(C3d);
ChFi3d_SameParameter(HC3d,pcFopsam,HBRFopsam,tolesp,tolr1);
ChFi3d_SameParameter(HC3d,pcFopsam,HBRFopsam,tolapp3d,tolr1);
tolreached = Max(tolreached,tolr1);
TopOpeBRepDS_Curve Tcurv1(C3d,tolreached);
Icf = DStr.AddCurve(Tcurv1);
@@ -858,10 +858,10 @@ void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index)
ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeLastPCurve(),P1fin,P2fin,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
Standard_Real tolr2;
HC3d->Load(C3d);
ChFi3d_SameParameter(HC3d,pcsurfdif,Hsurfdif,tolesp,tolr2);
ChFi3d_SameParameter(HC3d,pcsurfdif,Hsurfdif,tolapp3d,tolr2);
tolreached = Max(tolreached,tolr2);
TopOpeBRepDS_Curve Tcurv2(C3d,tolreached);
Icl = DStr.AddCurve(Tcurv2);

View File

@@ -307,7 +307,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
pivot = ii; deb = jj; fin = kk;
}
}
if(!c1toric)c1spheric=(Abs(qr[0]-qr[1])<tolesp && Abs(qr[0]-qr[2])<tolesp);
if(!c1toric)c1spheric=(Abs(qr[0]-qr[1])<tolapp3d && Abs(qr[0]-qr[2])<tolapp3d);
}
// Previously to avoid loops the points were always located
@@ -543,14 +543,14 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
Handle(BRepBlend_Line) lin;
Standard_Real ffi = WFirst, lla = WLast + pasmax;
if (Abs(Rdeb-Rfin)<=tolesp){
if (Abs(Rdeb-Rfin)<=tolapp3d){
BRepBlend_ConstRad func(Fac,Surf,cornerspine);
BRepBlend_ConstRadInv finv(Fac,Surf,cornerspine);
func.Set(Rdeb,choix);
func.Set(myShape);
finv.Set(Rdeb,choix);
Standard_Real TolGuide = cornerspine->Resolution(tolesp);
Standard_Real TolGuide = cornerspine->Resolution(tolapp3d);
Standard_Integer intf = 3, intl = 3;
done = ComputeData(coin,cornerspine,NullSpine,lin,Fac,IFac,Surf,ISurf,
@@ -573,7 +573,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
func.Set(choix);
func.Set(myShape);
finv.Set(choix);
Standard_Real TolGuide = cornerspine->Resolution(tolesp);
Standard_Real TolGuide = cornerspine->Resolution(tolapp3d);
Standard_Integer intf = 3, intl = 3;
done = ComputeData(coin,cornerspine,NullSpine,lin,Fac,IFac,Surf,ISurf,
func,finv,ffi,pasmax,locfleche,TolGuide,ffi,lla,
@@ -607,7 +607,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
Handle(Geom2d_Curve) PCurveOnFace;
if(!c1pointu)
Bfac = ChFi3d_mkbound(Fac,PCurveOnFace,sens[deb],pfac1,vfac1,
sens[fin],pfac2,vfac2,tolesp,2.e-4);
sens[fin],pfac2,vfac2,tolapp3d,2.e-4);
Standard_Integer kkk;
gp_Pnt ppbid;
gp_Vec vp1,vp2;
@@ -620,7 +620,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
Handle(Geom2d_Curve) PCurveOnPiv;
// Bpiv = ChFi3d_mkbound(Surf,PCurveOnPiv,sens[deb],psurf1,vp1,
// sens[fin],psurf2,vp2,tolesp,2.e-4);
Bpiv = ChFi3d_mkbound(Surf,PCurveOnPiv,psurf1,psurf2,tolesp,2.e-4,0);
Bpiv = ChFi3d_mkbound(Surf,PCurveOnPiv,psurf1,psurf2,tolapp3d,2.e-4,0);
Standard_Real pardeb2 = p[deb][pivot];
Standard_Real parfin2 = p[fin][pivot];
if(c1pointu){
@@ -642,8 +642,8 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
DStr.Surface(CD[fin]->SetOfSurfData()->
Value(i[fin][pivot])->Surf()).Surface();
Bdeb = ChFi3d_mkbound(sdeb,pdeb1,pdeb2,tolesp,2.e-4);
Bfin = ChFi3d_mkbound(sfin,pfin1,pfin2,tolesp,2.e-4);
Bdeb = ChFi3d_mkbound(sdeb,pdeb1,pdeb2,tolapp3d,2.e-4);
Bfin = ChFi3d_mkbound(sfin,pfin1,pfin2,tolapp3d,2.e-4);
GeomFill_ConstrainedFilling fil(11,20);
if(c1pointu) fil.Init(Bpiv,Bfin,Bdeb,1);
@@ -712,7 +712,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeFirstPCurve(),P1deb,P2deb,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
TopOpeBRepDS_Curve Tcurv1(C3d,tolreached);
Icf = DStr.AddCurve(Tcurv1);
regdeb.SetCurve(Icf);
@@ -732,7 +732,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2,
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeLastPCurve(),P1fin,P2fin,
tolesp,tol2d,tolreached,0);
tolapp3d,tol2d,tolreached,0);
TopOpeBRepDS_Curve Tcurv2(C3d,tolreached);
Icl = DStr.AddCurve(Tcurv2);
regfin.SetCurve(Icl);
@@ -770,7 +770,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
Standard_Real tolrdeb;
ChFi3d_ComputePCurv(crefdeb,pp1,pp2,CD[deb]->ChangePCurve(isfirst),
DStr.Surface(fddeb->Surf()).Surface(),
P1deb,P2deb,tolesp,tolrdeb,rev);
P1deb,P2deb,tolapp3d,tolrdeb,rev);
tcdeb.Tolerance(Max(tolrdeb,tcdeb.Tolerance()));
if(rev) ChFi3d_EnlargeBox(DStr,CD[deb],fddeb,*pbf2,*pbf1,isfirst);
else ChFi3d_EnlargeBox(DStr,CD[deb],fddeb,*pbf1,*pbf2,isfirst);
@@ -800,7 +800,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
Standard_Real tolrfin;
ChFi3d_ComputePCurv(creffin,pp1,pp2,CD[fin]->ChangePCurve(isfirst),
DStr.Surface(fdfin->Surf()).Surface(),
P1fin,P2fin,tolesp,tolrfin,rev);
P1fin,P2fin,tolapp3d,tolrfin,rev);
tcfin.Tolerance(Max(tolrfin,tcfin.Tolerance()));
if(rev) ChFi3d_EnlargeBox(DStr,CD[fin],fdfin,*pbl2,*pbl1,isfirst);
else ChFi3d_EnlargeBox(DStr,CD[fin],fdfin,*pbl1,*pbl2,isfirst);
@@ -823,7 +823,7 @@ void ChFi3d_FilBuilder::PerformThreeCorner(const Standard_Integer Jndex)
Standard_Real tolr;
ChFi3d_SameParameter(Ccoinpiv,C2dOnPiv,Spiv,
fi.FirstParameter(),fi.LastParameter(),
tolesp,tolr);
tolapp3d,tolr);
TCcoinpiv.Tolerance(Max(TCcoinpiv.Tolerance(),tolr));
CD[pivot]->ChangePCurve(isfirst) = C2dOnPiv;
CD[pivot]->SetIndexPoint(If2,isfirst,isurf1);

View File

@@ -558,6 +558,17 @@ void ChFiDS_Spine::Load()
}
indexofcurve =1;
myCurve.Initialize(TopoDS::Edge(spine.Value(1)));
// Here, we should update tolesp according to curve parameter range
// if tolesp candidate less than default initial value.
const Standard_Real umin = FirstParameter();
const Standard_Real umax = LastParameter();
Standard_Real new_tolesp = 5.0e-5 * (umax - umin);
if (tolesp > new_tolesp)
{
tolesp = new_tolesp;
}
}

View File

@@ -244,6 +244,9 @@ public:
//! Return the mode of chamfers used
Standard_EXPORT ChFiDS_ChamfMode Mode() const;
//! Return tolesp parameter
Standard_EXPORT Standard_Real GetTolesp() const;
DEFINE_STANDARD_RTTIEXT(ChFiDS_Spine,Standard_Transient)

View File

@@ -214,3 +214,12 @@ inline ChFiDS_ChamfMode ChFiDS_Spine::Mode() const
return myMode;
}
//=======================================================================
//function : GetTolesp
//purpose :
//=======================================================================
inline Standard_Real ChFiDS_Spine::GetTolesp() const
{
return tolesp;
}

View File

@@ -88,8 +88,11 @@ bool DE_ConfigurationNode::Save(const TCollection_AsciiString& theResourcePath)
// function : UpdateLoad
// purpose :
//=======================================================================
bool DE_ConfigurationNode::UpdateLoad()
bool DE_ConfigurationNode::UpdateLoad(const Standard_Boolean theToImport,
const Standard_Boolean theToKeep)
{
(void)theToImport;
(void)theToKeep;
return true;
}

View File

@@ -85,9 +85,12 @@ public:
//! @return new object with the same field values
Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const = 0;
//! Update loading status. Checking for the license.
//! Update loading status. Checking for the ability to read and write.
//! @param[in] theToImport flag to updates for import. Standard_True-import, Standard_False-export
//! @param[in] theToKeep flag to save update result
//! @return Standard_True, if node can be used
Standard_EXPORT virtual bool UpdateLoad();
Standard_EXPORT virtual bool UpdateLoad(const Standard_Boolean theToImport,
const Standard_Boolean theToKeep);
public:

View File

@@ -34,6 +34,9 @@ namespace
static const TCollection_AsciiString aScope ("global");
return aScope;
}
//! Global configuration of current DE Session
static Handle(DE_Wrapper) THE_GLOBAL_CONFIGURATION;
}
//=======================================================================
@@ -41,6 +44,7 @@ namespace
// purpose :
//=======================================================================
DE_Wrapper::DE_Wrapper()
:myKeepUpdates(Standard_False)
{}
//=======================================================================
@@ -64,6 +68,7 @@ DE_Wrapper::DE_Wrapper(const Handle(DE_Wrapper)& theWrapper)
Bind(aVendorIter.Value());
}
}
theWrapper->myKeepUpdates = myKeepUpdates;
}
//=======================================================================
@@ -72,8 +77,23 @@ DE_Wrapper::DE_Wrapper(const Handle(DE_Wrapper)& theWrapper)
//=======================================================================
Handle(DE_Wrapper) DE_Wrapper::GlobalWrapper()
{
static const Handle(DE_Wrapper)& aConfiguration = new DE_Wrapper();
return aConfiguration;
if (THE_GLOBAL_CONFIGURATION.IsNull())
{
THE_GLOBAL_CONFIGURATION = new DE_Wrapper();
}
return THE_GLOBAL_CONFIGURATION;
}
//=======================================================================
// function : SetGlobalWrapper
// purpose :
//=======================================================================
void DE_Wrapper::SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper)
{
if (!theWrapper.IsNull())
{
THE_GLOBAL_CONFIGURATION = theWrapper;
}
}
//=======================================================================
@@ -81,7 +101,7 @@ Handle(DE_Wrapper) DE_Wrapper::GlobalWrapper()
// purpose :
//=======================================================================
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress)
{
@@ -94,7 +114,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
return Read(thePath, theDocument, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -119,7 +139,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
return Write(thePath, theDocument, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -131,7 +151,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
// purpose :
//=======================================================================
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress)
{
if (theDocument.IsNull())
@@ -139,7 +159,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
return Standard_False;
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -159,7 +179,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
return Standard_False;
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -180,7 +200,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
return Read(thePath, theShape, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -201,7 +221,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
return Write(thePath, theShape, theProgress);
}
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -218,7 +238,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
{
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_True, aProvider))
if (!FindProvider(thePath, Standard_True, aProvider))
{
return Standard_False;
}
@@ -234,7 +254,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
const Message_ProgressRange& theProgress)
{
Handle(DE_Provider) aProvider;
if (!findProvider(thePath, Standard_False, aProvider))
if (!FindProvider(thePath, Standard_False, aProvider))
{
return Standard_False;
}
@@ -427,7 +447,6 @@ void DE_Wrapper::ChangePriority(const TCollection_AsciiString& theFormat,
if (aVendorMap.FindFromKey(aVendorName, aNode))
{
aNode->SetEnabled(Standard_True);
aNode->UpdateLoad();
aNewVendorMap.Add(aVendorName, aNode);
}
}
@@ -482,10 +501,10 @@ Handle(DE_Wrapper) DE_Wrapper::Copy() const
}
//=======================================================================
// function : findProvider
// function : FindProvider
// purpose :
//=======================================================================
Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath,
Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath,
const Standard_Boolean theToImport,
Handle(DE_Provider)& theProvider) const
{
@@ -514,7 +533,8 @@ Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath
((theToImport && aNode->IsImportSupported()) ||
(!theToImport && aNode->IsExportSupported())) &&
(aNode->CheckExtension(anExtr) ||
(theToImport && aNode->CheckContent(aBuffer))))
(theToImport && aNode->CheckContent(aBuffer))) &&
aNode->UpdateLoad(theToImport, myKeepUpdates))
{
theProvider = aNode->BuildProvider();
aNode->GlobalParameters = GlobalParameters;
@@ -526,6 +546,28 @@ Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath
return Standard_False;
}
//=======================================================================
// function : UpdateLoad
// purpose :
//=======================================================================
Standard_EXPORT void DE_Wrapper::UpdateLoad(const Standard_Boolean theToForceUpdate) const
{
for (DE_ConfigurationFormatMap::Iterator aFormatIter(myConfiguration);
aFormatIter.More(); aFormatIter.Next())
{
for (DE_ConfigurationVendorMap::Iterator aVendorIter(aFormatIter.Value());
aVendorIter.More(); aVendorIter.Next())
{
const Handle(DE_ConfigurationNode)& aNode = aVendorIter.Value();
aNode->UpdateLoad(Standard_True, Standard_True);
aNode->UpdateLoad(Standard_False, Standard_True);
if (!theToForceUpdate)
continue;
aNode->SetEnabled(aNode->IsExportSupported() || aNode->IsImportSupported());
}
}
}
//=======================================================================
// function : sort
// purpose :

View File

@@ -61,10 +61,15 @@ public:
//! @param[in] theWrapper object to copy
Standard_EXPORT DE_Wrapper(const Handle(DE_Wrapper)& theWrapper);
//! Gets global configuration singleton
//! Gets global configuration singleton.
//! If wrapper is not set, create it by default as base class object.
//! @return point to global configuration
Standard_EXPORT static Handle(DE_Wrapper) GlobalWrapper();
//! Sets global configuration singleton
//! @param[in] theWrapper object to set as global configuration
Standard_EXPORT static void SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper);
public:
//! Reads a CAD file, according internal configuration
@@ -74,7 +79,7 @@ public:
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
Handle(XSControl_WorkSession)& theWS,
const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -95,7 +100,7 @@ public:
//! @param theProgress[in] progress indicator
//! @return true if Read operation has ended correctly
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
Handle(TDocStd_Document)& theDocument,
const Handle(TDocStd_Document)& theDocument,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Writes a CAD file, according internal configuration
@@ -211,13 +216,33 @@ public:
Standard_EXPORT void ChangePriority(const TColStd_ListOfAsciiString& theVendorPriority,
const Standard_Boolean theToDisable = Standard_False);
//! Find available provider from the configuration.
//! If there are several providers, choose the one with the highest priority.
//! @param[in] thePath path to the CAD file
//! @param[in] theToImport flag to finds for import. Standard_True-import, Standard_False-export
//! @param[out] theProvider created new provider
//! @return Standard_True if provider found and created
Standard_EXPORT virtual Standard_Boolean FindProvider(const TCollection_AsciiString& thePath,
const Standard_Boolean theToImport,
Handle(DE_Provider)& theProvider) const;
//! Updates all registered nodes, all changes will be saved in nodes
//! @param[in] theToForceUpdate flag that turns on/of nodes, according to updated ability to import/export
Standard_EXPORT void UpdateLoad(const Standard_Boolean theToForceUpdate = Standard_False) const;
//! Gets flag that keeps changes on configuration nodes which are being updated, false by default
Standard_Boolean KeepUpdates() const { return myKeepUpdates; }
//! Sets flag that keeps changes on configuration nodes which are being updated, false by default
void SetKeepUpdates(const Standard_Boolean theToKeepUpdates) { myKeepUpdates = theToKeepUpdates; }
//! Gets format map, contains vendor map with nodes
//! @return internal map of formats
Standard_EXPORT const DE_ConfigurationFormatMap& Nodes() const;
//! Copies values of all fields
//! @return new object with the same field values
Standard_EXPORT Handle(DE_Wrapper) Copy() const;
Standard_EXPORT virtual Handle(DE_Wrapper) Copy() const;
protected:
@@ -227,22 +252,13 @@ protected:
//! @param[in] theResource resource to get priority
void sort(const Handle(DE_ConfigurationContext)& theResource);
//! Find available provider from the configuration.
//! If there are several providers, choose the one with the highest priority.
//! @param[in] thePath path to the CAD file
//! @param[in] theToImport flag to finds for import. Standard_True-import, Standard_False-export
//! @param[out] theProvider created new provider
//! @return Standard_True if provider found and created
Standard_Boolean findProvider(const TCollection_AsciiString& thePath,
const Standard_Boolean theToImport,
Handle(DE_Provider)& theProvider) const;
public:
DE_ConfigurationNode::DE_SectionGlobal GlobalParameters; //!< Internal parameters for the all translators
private:
Standard_Boolean myKeepUpdates; //!< Flag that keeps changes on configuration nodes which are being updated
DE_ConfigurationFormatMap myConfiguration; //!< Internal map of formats
};

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
DEBRepCascade_ConfigurationNode::DEBRepCascade_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : DEBRepCascade_ConfigurationNode
@@ -46,7 +44,6 @@ DEBRepCascade_ConfigurationNode::DEBRepCascade_ConfigurationNode(const Handle(DE
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
DEXCAFCascade_ConfigurationNode::DEXCAFCascade_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : DEXCAFCascade_ConfigurationNode
@@ -46,7 +44,6 @@ DEXCAFCascade_ConfigurationNode::DEXCAFCascade_ConfigurationNode(const Handle(DE
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -16,7 +16,6 @@
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <Adaptor3d_TopolTool.hxx>
#include <GeomAdaptor_SurfaceOfLinearExtrusion.hxx>
#include <Approx_CurveOnSurface.hxx>
#include <BRep_Builder.hxx>
@@ -899,29 +898,8 @@ void Draft_Modification::Perform ()
// 1 - If ProjLib should make an Approx, it is stupid to approximate the
// entire intersection curve.
// 2 - Additionally, if YaRev, there is a risk to not be SameRange.
Handle(GeomAdaptor_Surface) HS[2] = {new GeomAdaptor_Surface(S1), new GeomAdaptor_Surface(S2)};
for (Standard_Integer i = 0; i < 2; ++i)
{
Handle(Geom_Surface) S = (i == 0 ? S1 : S2);
if (S->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
{
Standard_Real aVs, aVe;
Adaptor3d_TopolTool::GetConeApexParam(Handle(Geom_ConicalSurface)::DownCast(S)->Cone(), aVs, aVe);
if (aVe < 0.)
{
aVs = aVe;
aVe = Precision::Infinite();
}
else
{
aVs = -Precision::Infinite();
aVe = aVe;
}
HS[i]->Load(S, 0., 2 * M_PI, aVs, aVe, 0., 0.);
}
}
i2s.Perform(HS[0], HS[1], Precision::Confusion(),
Standard_True, Standard_False, Standard_False);
i2s.Perform(S1,S2,Precision::Confusion(),
Standard_True,Standard_False,Standard_False);
if (!i2s.IsDone() || i2s.NbLines() <= 0) {
errStat = Draft_EdgeRecomputation;
@@ -1130,9 +1108,8 @@ void Draft_Modification::Perform ()
for (i = 1; i <= Candidates.Length(); i++)
{
Handle( Geom_Curve ) aCurve = Candidates(i);
GeomAPI_ProjectPointOnCurve Projector(pfv, aCurve );
gp_Pnt aPnt = Projector.NbPoints() ? Projector.NearestPoint() : aCurve->Value(aCurve->FirstParameter());
const Standard_Real Dist = aPnt.Distance( pfv );
gp_Pnt Pnt = aCurve->Value( aCurve->FirstParameter() );
const Standard_Real Dist = Pnt.Distance( pfv );
if (Dist - DistMin < -Precision::Confusion())
{
DistMin = Dist;

View File

@@ -27,7 +27,7 @@
// intended for use from debugger prompt (Command Window in Visual Studio)
//! Save geometric object identified by pointer to handle
const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
Standard_EXPORT const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
{
if (theNameStr == 0 || theHandlePtr == 0)
{
@@ -57,7 +57,7 @@ const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
}
//! Set point to DRAW variable
const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
Standard_EXPORT const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
{
if (theNameStr == 0 || thePntPtr == 0)
{
@@ -77,7 +77,7 @@ const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
}
//! Set 2d point to DRAW variable
const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
Standard_EXPORT const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
{
if (theNameStr == 0 || thePnt2dPtr == 0)
{
@@ -102,17 +102,17 @@ const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
// work with them (DBX could, on SUN Solaris).
#ifndef _MSC_VER
const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
Standard_EXPORT const char* DrawTrSurf_Set (const char* name, const Handle(Standard_Transient)& G)
{
return DrawTrSurf_Set (name, (void*)&G);
}
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt& thePnt)
{
return DrawTrSurf_SetPnt (theName, (void*)&thePnt);
}
const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
Standard_EXPORT const char* DrawTrSurf_Set (const char* theName, const gp_Pnt2d& thePnt2d)
{
return DrawTrSurf_SetPnt2d (theName, (void*)&thePnt2d);
}

View File

@@ -1,2 +1,3 @@
TKernel
TKExpress
CSF_wsock32

View File

@@ -674,7 +674,10 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
Extrema_ExtPElC ExtPCir(aPCirc2,
Extrema_CurveTool::Circle (*myC[0]),
Precision::Confusion(), theUt11, theUt12);
if (ExtPCir.NbExt() < 1)
{
continue;
}
Standard_Real aMinSqD = ExtPCir.SquareDistance(1);
for (Standard_Integer anExtID = 2; anExtID <= ExtPCir.NbExt(); anExtID++)
{

View File

@@ -345,19 +345,19 @@ Standard_Boolean
if(!done) return Standard_False;
if(lin->StartPointOnFirst().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
Standard_True, Data->ChangeVertexFirstOnS1(), tolesp);
Standard_True, Data->ChangeVertexFirstOnS1(), tolapp3d);
}
if(lin->EndPointOnFirst().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
Standard_False,Data->ChangeVertexLastOnS1(), tolesp);
Standard_False,Data->ChangeVertexLastOnS1(), tolapp3d);
}
if(lin->StartPointOnSecond().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
Standard_True, Data->ChangeVertexFirstOnS2(), tolesp);
Standard_True, Data->ChangeVertexFirstOnS2(), tolapp3d);
}
if(lin->EndPointOnSecond().NbPointOnRst() !=0){
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(), tolesp);
Standard_False, Data->ChangeVertexLastOnS2(), tolapp3d);
}
done = CompleteData(Data,Func,lin,S1,S2,Or,0,0,0,0);
if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
@@ -554,7 +554,7 @@ Standard_Real FilletSurf_InternalBuilder::FirstParameter() const
Standard_Integer ind = 1;
if(sp->IsPeriodic()) ind = sp->Index(p);
Standard_Real ep;
if(ComputeEdgeParameter(sp,ind,p,ep,tolesp)) return ep;
if(ComputeEdgeParameter(sp,ind,p,ep,tolapp3d)) return ep;
return 0.0;
}
//=======================================================================
@@ -570,7 +570,7 @@ Standard_Real FilletSurf_InternalBuilder::LastParameter() const
Standard_Integer ind = sp->NbEdges();
if(sp->IsPeriodic()) ind = sp->Index(p);
Standard_Real ep;
if(ComputeEdgeParameter(sp,ind,p,ep,tolesp)) return ep;
if(ComputeEdgeParameter(sp,ind,p,ep,tolapp3d)) return ep;
return 0.0;
}

View File

@@ -58,65 +58,6 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
IMPLEMENT_STANDARD_RTTIEXT(Geom2dAdaptor_Curve, Adaptor2d_Curve2d)
static void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer);
static void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer);
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower = 0,
Standard_Real thePeriod = 0,
Standard_Integer theIndex1 = 0,
Standard_Integer theIndex2 = 0);
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt);
static void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals);
//=======================================================================
//function : ShallowCopy
//purpose :
@@ -354,158 +295,6 @@ GeomAbs_Shape Geom2dAdaptor_Curve::Continuity() const
}
}
//=======================================================================
//function : DefinFPeriod
//purpose :
//=======================================================================
void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer)
{
if (theCurFirst >= theLower)
{
while (theCurFirst >= theUpper)
{
theCurFirst = theCurFirst - thePeriod;
theFPer++;
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theFPer++;
theCurFirst = theLower;
}
}
else
{
while (theCurFirst < theLower)
{
theCurFirst = theCurFirst + thePeriod;
if (Abs(theLower - theCurFirst) > theEps)
{
theFPer--;
}
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theCurFirst = theLower;
}
}
}
//=======================================================================
//function : DefinLPeriod
//purpose :
//=======================================================================
void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer)
{
if (theCurLast >= theLower)
{
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
{
theCurLast = theUpper;
}
else
{
while (theCurLast >= theUpper)
{
theCurLast = theCurLast - thePeriod;
theLPer++;
}
if (Abs(theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
else
{
while (theCurLast < theLower)
{
theCurLast = theCurLast + thePeriod;
if (Abs(theLower - theCurLast) > theEps)
{
theLPer--;
}
}
if (Abs(theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
//=======================================================================
//function : LocalNbIntervals
//purpose :
//=======================================================================
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower,
Standard_Real thePeriod,
Standard_Integer theIndex1,
Standard_Integer theIndex2)
{
Standard_Real aNewFirst = theFirst;
Standard_Real aNewLast = theLast;
if (theIndex1 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
}
if (theIndex2 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
}
// Protection against theFirst = UFirst - eps, which located as ULast - eps
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
{
if (Abs(aNewLast - theLower) < Precision::PConfusion())
{
aNewLast += thePeriod;
}
else
{
aNewFirst -= thePeriod;
}
}
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
{
theIndex1++;
}
if ((aNewLast - theTK(theIndex2)) > theEps)
{
theIndex2++;
}
for (Standard_Integer i = 1; i <= theNbInt; i++)
{
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
}
return theNbIntervals;
}
//=======================================================================
//function : NbIntervals
//purpose :
@@ -513,187 +302,49 @@ Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if (aContPer || aContNotPer) {
Standard_Integer Cont;
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
Standard_Integer Nb = myBSplineCurve->NbKnots();
TColStd_Array1OfReal TK(1, Nb);
TColStd_Array1OfInteger TM(1, Nb);
myBSplineCurve->Knots(TK);
myBSplineCurve->Multiplicities(TM);
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
myNbIntervals = 1;
if (!myBSplineCurve->IsPeriodic())
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_False, myNbIntervals);
}
else
{
Standard_Real aCurFirst = myFirst;
Standard_Real aCurLast = myLast;
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
{
aCurLast = anUpper;
}
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
if ((Abs(aLower - myFirst) < Eps) && (Abs(anUpper - myLast) < Eps))
{
myNbIntervals = NbInt;
}
else
{
Standard_Integer aSumPer = Abs(aLPer - aFPer);
Standard_Real aFirst = 0;
if (aLower < 0 && anUpper == 0)
{
if (Abs(aCurLast) < Eps)
{
aCurLast = 0;
}
aFirst = aLower;
}
if (aSumPer <= 1)
{
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
}
if (aSumPer != 0)
{
Standard_Integer aFInt = 0;
Standard_Integer aLInt = 0;
Standard_Integer aPInt = NbInt;
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
{
aFInt = 1;
}
if ((aCurLast != 0) && (aCurLast != anUpper))
{
aLInt = 1;
}
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
if (aCurLast == anUpper)
{
aLInt = NbInt;
}
else
{
if (Abs(aCurLast - aFirst) > Eps)
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
}
else
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
}
}
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
}
else
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
}
}
}
}
break;
}
if (myTypeCurve == GeomAbs_BSplineCurve)
{
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
return 1;
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("Geom2dAdaptor_Curve::NbIntervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
return BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
nullptr);
}
else if (myTypeCurve == GeomAbs_OffsetCurve){
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
@@ -705,208 +356,14 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
Geom2dAdaptor_Curve anAdaptor( Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve() );
Geom2dAdaptor_Curve anAdaptor (Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve(), myFirst, myLast);
myNbIntervals = anAdaptor.NbIntervals(BaseS);
return myNbIntervals;
}
return myNbIntervals;
}
//=======================================================================
//function : WriteIntervals
//purpose :
//=======================================================================
void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt)
{
if (theFlagForFirst)
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
else
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
theFinalIntervals(theNbIntervals + 1) = theIndex2;
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
{
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
theCurInt++;
}
}
//=======================================================================
//function : SpreadInt
//purpose :
//=======================================================================
void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals)
{
Standard_Integer anIndex1 = 0;
Standard_Integer anIndex2 = 0;
Standard_Real aNewFirst, aNewLast;
Standard_Integer anUpper;
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
Standard_True, 1, theNb, anIndex1, aNewFirst);
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
Standard_True, 1, theNb, anIndex2, aNewLast);
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
{
anIndex1++;
}
if ((aNewLast - theTK(anIndex2)) > theEps)
{
anIndex2++;
}
theNbIntervals = 1;
if (anIndex1 == theNb)
{
anIndex1 = 1;
}
// Count the max number of boundaries of intervals
if (Abs(theLPer - theFPer) > 1)
{
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
}
else
{
anUpper = theNb - anIndex1 + anIndex2 + 1;
}
if (theLPer == theFPer)
{
anUpper = theInter.Upper();
}
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
aFinalIntervals(1) = anIndex1;
// If first and last are in the same period
if ((Abs(theLPer - theFPer) == 0))
{
Standard_Integer aCurInt = 1;
Standard_Real aCurPeriod = theFPer * thePeriod;
if (theFirst == aNewFirst && theLast == aNewLast)
{
aCurPeriod = 0;
}
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
// If the first and the last are in neighboring periods
if (Abs(theLPer - theFPer) == 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
}
// If the first and the last are far apart
if (Abs(theLPer - theFPer) > 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
return 1;
}
}
@@ -915,156 +372,53 @@ void SpreadInt(const TColStd_Array1OfReal &theTK,
//purpose :
//=======================================================================
void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
const GeomAbs_Shape S ) const
void Geom2dAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if (aContPer || aContNotPer) {
Standard_Integer Cont;
switch ( S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
Standard_Integer Nb = myBSplineCurve->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
TColStd_Array1OfReal TK(1, Nb);
TColStd_Array1OfInteger TM(1, Nb);
myBSplineCurve->Knots(TK);
myBSplineCurve->Multiplicities(TM);
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if (!myBSplineCurve->IsPeriodic())
{
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
myBSplineCurve->IsPeriodic(),
1, Nb, Index1, newFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
myBSplineCurve->IsPeriodic(),
1, Nb, Index2, newLast);
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
if (Abs(newFirst - TK(Index1 + 1)) < Eps) Index1++;
if (newLast - TK(Index2) > Eps) Index2++;
Inter(1) = Index1;
myNbIntervals = 1;
for (Standard_Integer i = 1; i <= NbInt; i++) {
if (Inter(i) > Index1 && Inter(i) < Index2) {
myNbIntervals++;
Inter(myNbIntervals) = Inter(i);
}
}
Inter(myNbIntervals + 1) = Index2;
Standard_Integer ii = T.Lower() - 1;
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
T(ii + I) = TK(Inter(I));
}
}
else
{
Standard_Real aFirst = myFirst;
Standard_Real aLast = myLast;
Standard_Real aCurFirst = aFirst;
Standard_Real aCurLast = aLast;
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
if (Abs(myFirst - aLower) <= Eps)
{
aCurFirst = aLower;
aFirst = aCurFirst;
}
if (Abs(myLast - anUpper) <= Eps)
{
aCurLast = anUpper;
aLast = aCurLast;
}
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
if (myFirst == aLower)
{
aFPer = 0;
}
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
aCurLast, Eps, T, myNbIntervals);
T(T.Lower()) = aFirst;
T(T.Lower() + myNbIntervals) = aLast;
return;
}
}
T(T.Lower()) = myFirst;
T(T.Lower() + myNbIntervals) = myLast;
if (myTypeCurve == GeomAbs_BSplineCurve)
{
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
return;
}
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("Geom2dAdaptor_Curve::Intervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
&T);
}
else if (myTypeCurve == GeomAbs_OffsetCurve){
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
@@ -1077,13 +431,18 @@ void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
default: BaseS = GeomAbs_CN;
}
Geom2dAdaptor_Curve anAdaptor( Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve() );
Geom2dAdaptor_Curve anAdaptor (Handle(Geom2d_OffsetCurve)::DownCast(myCurve)->BasisCurve(), myFirst, myLast);
myNbIntervals = anAdaptor.NbIntervals(BaseS);
anAdaptor.Intervals(T, BaseS);
T( T.Lower() ) = myFirst;
T( T.Lower() + myNbIntervals ) = myLast;
}
T( T.Lower() ) = myFirst;
T( T.Lower() + myNbIntervals ) = myLast;
else
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
}
}
//=======================================================================

View File

@@ -515,7 +515,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
Handle(TColStd_HArray1OfReal) resKnots;
Handle(TColStd_HArray1OfInteger) resMults;
Standard_Real start_value,end_value;
Standard_Real tolerance=Precision::Confusion();
Standard_Integer resNbPoles,degree,
ii,jj,
aStatus;
@@ -527,6 +526,7 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
BS->KnotSequence(BSFlatKnots);
start_value = BSKnots(1);
end_value = BSKnots(BS->NbKnots());
Standard_Real tolerance = 10.*Epsilon(Abs(end_value));
a->Knots(aKnots);
a->Poles(aPoles);
@@ -565,22 +565,6 @@ static Handle(Geom2d_BSplineCurve) MultNumandDenom(const Handle(Geom2d_BSplineCu
degree,
resDenPoles,
aStatus);
// BSplCLib::FunctionMultiply(law_evaluator,
// BS->Degree(),
// BSFlatKnots,
// BSPoles,
// resFlatKnots,
// degree,
// resNumPoles,
// aStatus);
// BSplCLib::FunctionMultiply(law_evaluator,
// BS->Degree(),
// BSFlatKnots,
// BSWeights,
// resFlatKnots,
// degree,
// resDenPoles,
// aStatus);
for (ii=1;ii<=resNbPoles;ii++)
for(jj=1;jj<=2;jj++)
resPoles(ii).SetCoord(jj,resNumPoles(ii).Coord(jj)/resDenPoles(ii));
@@ -1339,24 +1323,22 @@ void Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve& ArrayOf
Curve1Poles(ii).SetCoord(jj,Curve1Poles(ii).Coord(jj)*Curve1Weights(ii));
//POP pour NT
Geom2dConvert_reparameterise_evaluator ev (aPolynomialCoefficient);
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(),
Curve1FlatKnots,
Curve1Poles,
FlatKnots,
aNewCurveDegree,
aNewCurveDegree,
NewPoles,
aStatus
);
TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
// BSplCLib::FunctionReparameterise(reparameterise_evaluator,
TColStd_Array1OfReal NewWeights(1, FlatKnots.Length() - (aNewCurveDegree + 1));
BSplCLib::FunctionReparameterise(ev,
Curve1->Degree(),
Curve1FlatKnots,
Curve1Weights,
FlatKnots,
aNewCurveDegree,
aNewCurveDegree,
NewWeights,
aStatus
);

View File

@@ -58,65 +58,6 @@ static const Standard_Real PosTol = Precision::PConfusion() / 2;
IMPLEMENT_STANDARD_RTTIEXT(GeomAdaptor_Curve, Adaptor3d_Curve)
static void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer);
static void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer);
static Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower = 0,
Standard_Real thePeriod = 0,
Standard_Integer theIndex1 = 0,
Standard_Integer theIndex2 = 0);
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt);
static void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals);
//=======================================================================
//function : ShallowCopy
//purpose :
@@ -310,159 +251,6 @@ GeomAbs_Shape GeomAdaptor_Curve::Continuity() const
return GeomAbs_CN;
}
//=======================================================================
//function : DefinFPeriod
//purpose :
//=======================================================================
void DefinFPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurFirst,
Standard_Integer &theFPer)
{
if (theCurFirst >= theLower)
{
while (theCurFirst >= theUpper)
{
theCurFirst = theCurFirst - thePeriod;
theFPer++;
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theFPer++;
theCurFirst = theLower;
}
}
else
{
while (theCurFirst < theLower)
{
theCurFirst = theCurFirst + thePeriod;
if ((Abs(theLower - theCurFirst)) > theEps)
{
theFPer--;
}
}
if (Abs(theUpper - theCurFirst) <= theEps)
{
theCurFirst = theLower;
}
}
}
//=======================================================================
//function : DefinLPeriod
//purpose :
//=======================================================================
void DefinLPeriod(const Standard_Real theLower,
const Standard_Real theUpper,
const Standard_Real theEps,
const Standard_Real thePeriod,
Standard_Real &theCurLast,
Standard_Integer &theLPer)
{
if (theCurLast >= theLower)
{
if ((theCurLast >= theUpper) && (Abs(theCurLast - theUpper) <= theEps))
{
theCurLast = theUpper;
}
else
{
while (theCurLast >= theUpper)
{
theCurLast = theCurLast - thePeriod;
theLPer++;
}
if (Abs(theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
else
{
while (theCurLast < theLower)
{
theCurLast = theCurLast + thePeriod;
if (Abs(theLower - theCurLast) > theEps)
{
theLPer--;
}
}
if ((theUpper - theCurLast) <= theEps)
{
theCurLast = theLower;
}
}
}
//=======================================================================
//function : LocalNbIntervals
//purpose :
//=======================================================================
Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
const TColStd_Array1OfInteger& theTM,
const TColStd_Array1OfInteger& theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theNbInt,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theEps,
const Standard_Boolean thePeriodicCur,
Standard_Integer theNbIntervals,
Standard_Real theLower,
Standard_Real thePeriod,
Standard_Integer theIndex1,
Standard_Integer theIndex2)
{
Standard_Real aNewFirst = theFirst;
Standard_Real aNewLast = theLast;
if (theIndex1 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
thePeriodicCur, 1, theNb, theIndex1, aNewFirst);
}
if (theIndex2 == 0)
{
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLast,
thePeriodicCur, 1, theNb, theIndex2, aNewLast);
}
// Protection against theFirst = UFirst - eps, which located as ULast - eps
if (thePeriodicCur && ((aNewLast - aNewFirst) < Precision::PConfusion()))
{
if (Abs(aNewLast - theLower) < Precision::PConfusion())
{
aNewLast += thePeriod;
}
else
{
aNewFirst -= thePeriod;
}
}
if (Abs(aNewFirst - theTK(theIndex1 + 1)) < theEps)
{
theIndex1++;
}
if ((aNewLast - theTK(theIndex2)) > theEps)
{
theIndex2++;
}
for (Standard_Integer i = 1; i <= theNbInt; i++)
{
if (theInter(i) > theIndex1 && theInter(i) < theIndex2) theNbIntervals++;
}
return theNbIntervals;
}
//=======================================================================
//function : NbIntervals
//purpose :
@@ -470,207 +258,61 @@ Standard_Integer LocalNbIntervals(const TColStd_Array1OfReal& theTK,
Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if(aContPer || aContNotPer) {
Standard_Integer Cont;
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
Standard_Integer Nb = myBSplineCurve->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
myNbIntervals = 1;
if (!myBSplineCurve->IsPeriodic())
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_False, myNbIntervals);
}
else
{
Standard_Real aCurFirst = myFirst;
Standard_Real aCurLast = myLast;
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
if ((Abs(aCurFirst - aLower) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
if ((Abs(aCurLast - anUpper) < Eps) && (aCurLast < anUpper))
{
aCurLast = anUpper;
}
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Integer aLPer = 1; Standard_Integer aFPer = 1;
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
Standard_Real aNewFirst;
Standard_Real aNewLast;
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
Standard_True, 1, Nb, Index1, aNewFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
Standard_True, 1, Nb, Index2, aNewLast);
if ((aNewFirst == myFirst && aNewLast == myLast) && (aFPer != aLPer))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
}
else
{
Standard_Integer aSumPer = Abs(aLPer - aFPer);
Standard_Real aFirst = 0;
if (aLower < 0 && anUpper == 0)
{
if (Abs(aCurLast) < Eps)
{
aCurLast = 0;
}
aFirst = aLower;
}
if (aSumPer <= 1)
{
if ((Abs(myFirst - TK(Nb) - aPeriod * (aFPer - 1)) <= Eps) && (myLast < (TK(Nb) + aPeriod * (aLPer - 1))))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
if ((Abs(myFirst - aLower) < Eps) && (Abs(myLast - anUpper) < Eps))
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
myFirst, myLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
return myNbIntervals;
}
}
if (aSumPer != 0)
{
Standard_Integer aFInt = 0;
Standard_Integer aLInt = 0;
Standard_Integer aPInt = NbInt;
if ((aCurFirst != aPeriod) || ((aCurFirst != anUpper) && (Abs(myFirst) < Eps)))
{
aFInt = 1;
}
if ((aCurLast != aLower) && (aCurLast != anUpper))
{
aLInt = 1;
}
aFInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, anUpper, Eps, Standard_True, aFInt, aLower, aPeriod);
if (aCurLast == anUpper)
{
aLInt = NbInt;
}
else
{
if (Abs(aCurLast - aFirst) > Eps)
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod, 1);
}
else
{
aLInt = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aFirst, aCurLast, Eps, Standard_True, aLInt, aLower, aPeriod);
}
}
myNbIntervals = aFInt + aLInt + aPInt * (aSumPer - 1);
}
else
{
myNbIntervals = LocalNbIntervals(TK, TM, Inter, Degree, Nb, NbInt,
aCurFirst, aCurLast, Eps, Standard_True, myNbIntervals, aLower, aPeriod);
}
}
}
}
break;
}
if (myTypeCurve == GeomAbs_BSplineCurve)
{
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
return 1;
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("GeomAdaptor_Curve::NbIntervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
return BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
nullptr);
}
else if (myTypeCurve == GeomAbs_OffsetCurve) {
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0: BaseS = GeomAbs_C1; break;
case GeomAbs_C1: BaseS = GeomAbs_C2; break;
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
GeomAdaptor_Curve C
(Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve());
GeomAdaptor_Curve C (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve(), myFirst, myLast);
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
// the number of intervals obtained from the basis to
// vvv reflect parameter bounds
@@ -680,211 +322,16 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
TColStd_Array1OfReal rdfInter(1,1+iNbBasisInt);
C.Intervals(rdfInter,BaseS);
for (iInt=1; iInt<=iNbBasisInt; iInt++)
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
myNbIntervals++;
if (rdfInter(iInt)>myFirst && rdfInter(iInt)<myLast)
myNbIntervals++;
}
// akm 05/04/02 ^^^
return myNbIntervals;
}
return myNbIntervals;
}
//=======================================================================
//function : WriteIntervals
//purpose :
//=======================================================================
static void WriteIntervals(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theNbInt,
const Standard_Integer theIndex1,
const Standard_Integer theIndex2,
const Standard_Real theCurPeriod,
const Standard_Boolean theFlagForFirst,
TColStd_Array1OfReal &theT,
TColStd_Array1OfInteger &theFinalIntervals,
Standard_Integer &theNbIntervals,
Standard_Integer &theCurInt)
{
if (theFlagForFirst)
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) <= theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
else
{
for (Standard_Integer anId = 1; anId <= theNbInt; anId++)
{
if (theInter(anId) > theIndex1 && theInter(anId) < theIndex2)
{
theNbIntervals++;
theFinalIntervals(theNbIntervals) = theInter(anId);
}
}
}
theFinalIntervals(theNbIntervals + 1) = theIndex2;
for (Standard_Integer anId = theCurInt; anId <= theNbIntervals + 1; anId++)
{
theT(anId) = theTK(theFinalIntervals(anId)) + theCurPeriod;
theCurInt++;
}
}
//=======================================================================
//function : SpreadInt
//purpose :
//=======================================================================
void SpreadInt(const TColStd_Array1OfReal &theTK,
const TColStd_Array1OfInteger &theTM,
const TColStd_Array1OfInteger &theInter,
const Standard_Integer theCurDegree,
const Standard_Integer theNb,
const Standard_Integer theFPer,
const Standard_Integer theLPer,
const Standard_Integer theNbInt,
const Standard_Real theLower,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real thePeriod,
const Standard_Real theLastParam,
const Standard_Real theEps,
TColStd_Array1OfReal &theT,
Standard_Integer &theNbIntervals)
{
Standard_Integer anIndex1 = 0;
Standard_Integer anIndex2 = 0;
Standard_Real aNewFirst, aNewLast;
Standard_Integer anUpper;
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theFirst,
Standard_True, 1, theNb, anIndex1, aNewFirst);
BSplCLib::LocateParameter(theCurDegree, theTK, theTM, theLastParam,
Standard_True, 1, theNb, anIndex2, aNewLast);
if (Abs(aNewFirst - theTK(anIndex1 + 1)) < theEps)
{
anIndex1++;
}
if ((aNewLast - theTK(anIndex2)) > theEps)
{
anIndex2++;
}
theNbIntervals = 1;
if (anIndex1 == theNb)
{
anIndex1 = 1;
}
// Count the max number of boundaries of intervals
if (Abs(theLPer - theFPer) > 1)
{
anUpper = theNb - anIndex1 + anIndex2 + (theLPer - theFPer - 1) * theNb + 1;
}
else
{
anUpper = theNb - anIndex1 + anIndex2 + 1;
}
if (theLPer == theFPer)
{
anUpper = theInter.Upper();
}
TColStd_Array1OfInteger aFinalIntervals(1, anUpper);
aFinalIntervals(1) = anIndex1;
// If first and last are in the same period
if ((Abs(theLPer - theFPer) == 0))
{
Standard_Integer aCurInt = 1;
Standard_Real aCurPeriod = theFPer * thePeriod;
if (theFirst == aNewFirst && theLast == aNewLast)
{
aCurPeriod = 0;
}
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
anIndex2, aCurPeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
// If the first and the last are in neighboring periods
if (Abs(theLPer - theFPer) == 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
}
// If the first and the last are far apart
if (Abs(theLPer - theFPer) > 1)
{
Standard_Integer aCurInt = 1;
if (Abs(theLastParam - theLower) < theEps)
{
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
return;
}
else
{
// For period with first
WriteIntervals(theTK, theInter, theNbInt, anIndex1,
theNb, theFPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
Standard_Integer aNbPer = Abs(theLPer - theFPer);
Standard_Integer aCurPer = theFPer + 1;
while (aNbPer > 1)
{
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
theNb, aCurPer * thePeriod, Standard_True, theT, aFinalIntervals, theNbIntervals, aCurInt);
aNbPer--;
aCurPer++;
}
// For period with last
theNbIntervals++;
WriteIntervals(theTK, theInter, theNbInt, 1,
anIndex2, theLPer * thePeriod, Standard_False, theT, aFinalIntervals, theNbIntervals, aCurInt);
return;
}
return 1;
}
}
@@ -893,175 +340,53 @@ void SpreadInt(const TColStd_Array1OfReal &theTK,
//purpose :
//=======================================================================
void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
const GeomAbs_Shape S ) const
void GeomAdaptor_Curve::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
{
Standard_Integer myNbIntervals = 1;
Standard_Integer NbSplit;
Standard_Real FirstParam = myFirst, LastParam = myLast;
if (myTypeCurve == GeomAbs_BSplineCurve)
{
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter(1, LastIndex - FirstIndex + 1);
Standard_Boolean aContPer = (S >= Continuity()) && myBSplineCurve->IsPeriodic();
Standard_Boolean aContNotPer = (S > Continuity()) && !myBSplineCurve->IsPeriodic();
if (aContPer || aContNotPer) {
Standard_Integer Cont;
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
{
if (S == GeomAbs_C1) Cont = 1;
else if (S == GeomAbs_C2) Cont = 2;
else if (S == GeomAbs_C3) Cont = 3;
else Cont = myBSplineCurve->Degree();
Standard_Integer Degree = myBSplineCurve->Degree();
Standard_Integer NbKnots = myBSplineCurve->NbKnots();
TColStd_Array1OfInteger Mults(1, NbKnots);
myBSplineCurve->Multiplicities(Mults);
NbSplit = 1;
Standard_Integer Index = FirstIndex;
Inter(NbSplit) = Index;
Index++;
NbSplit++;
while (Index < LastIndex)
{
if (Degree - Mults(Index) < Cont)
{
Inter(NbSplit) = Index;
NbSplit++;
}
Index++;
}
Inter(NbSplit) = Index;
Standard_Integer NbInt = NbSplit - 1;
// GeomConvert_BSplineCurveKnotSplitting Convector(myBspl, Cont);
// Standard_Integer NbInt = Convector.NbSplits()-1;
// TColStd_Array1OfInteger Inter(1,NbInt+1);
// Convector.Splitting( Inter);
Standard_Integer Nb = myBSplineCurve->NbKnots();
Standard_Integer Index1 = 0;
Standard_Integer Index2 = 0;
Standard_Real newFirst, newLast;
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if (!myBSplineCurve->IsPeriodic() || ((Abs(myFirst - myBSplineCurve->FirstParameter()) < Eps) &&
(Abs(myLast - myBSplineCurve->LastParameter()) < Eps)))
{
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myFirst,
myBSplineCurve->IsPeriodic(),
1, Nb, Index1, newFirst);
BSplCLib::LocateParameter(myBSplineCurve->Degree(), TK, TM, myLast,
myBSplineCurve->IsPeriodic(),
1, Nb, Index2, newLast);
FirstParam = newFirst;
LastParam = newLast;
// Protection against myFirst = UFirst - eps, which located as ULast - eps
if (myBSplineCurve->IsPeriodic() && (LastParam - FirstParam) < Precision::PConfusion())
{
if (Abs(LastParam - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
LastParam += myBSplineCurve->Period();
else
FirstParam -= myBSplineCurve->Period();
}
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
if (Abs(FirstParam - TK(Index1 + 1)) < Eps) Index1++;
if (LastParam - TK(Index2) > Eps) Index2++;
myNbIntervals = 1;
TColStd_Array1OfInteger aFinalIntervals(1, Inter.Upper());
aFinalIntervals(1) = Index1;
for (Standard_Integer i = 1; i <= NbInt; i++) {
if (Inter(i) > Index1 && Inter(i) < Index2) {
myNbIntervals++;
aFinalIntervals(myNbIntervals) = Inter(i);
}
}
aFinalIntervals(myNbIntervals + 1) = Index2;
for (Standard_Integer I = 1; I <= myNbIntervals + 1; I++) {
T(I) = TK(aFinalIntervals(I));
}
}
else
{
Standard_Real aFirst = myFirst;
Standard_Real aLast = myLast;
Standard_Real aCurFirst = aFirst;
Standard_Real aCurLast = aLast;
Standard_Real aPeriod = myBSplineCurve->Period();
Standard_Real aLower = myBSplineCurve->FirstParameter();
Standard_Real anUpper = myBSplineCurve->LastParameter();
Standard_Integer aLPer = 0; Standard_Integer aFPer = 0;
if (Abs(myFirst - aLower) <= Eps)
{
aCurFirst = aLower;
aFirst = aCurFirst;
}
if (Abs(myLast - anUpper) <= Eps)
{
aCurLast = anUpper;
aLast = aCurLast;
}
if ((Abs(aLower - myFirst) < Eps) && (aCurFirst < aLower))
{
aCurFirst = aLower;
}
else
{
DefinFPeriod(aLower, anUpper,
Eps, aPeriod, aCurFirst, aFPer);
}
DefinLPeriod(aLower, anUpper,
Eps, aPeriod, aCurLast, aLPer);
if (myFirst == aLower)
{
aFPer = 0;
}
SpreadInt(TK, TM, Inter, myBSplineCurve->Degree(), Nb, aFPer, aLPer, NbInt, aLower, myFirst, myLast, aPeriod,
aCurLast, Eps, T, myNbIntervals);
T(T.Lower()) = aFirst;
T(T.Lower() + myNbIntervals) = aLast;
return;
}
}
T(T.Lower()) = myFirst;
T(T.Lower() + myNbIntervals) = myLast;
if ((!myBSplineCurve->IsPeriodic() && S <= Continuity()) || S == GeomAbs_C0)
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
return;
}
}
Standard_Integer aDegree = myBSplineCurve->Degree();
Standard_Integer aCont;
switch (S)
{
case GeomAbs_C1:
aCont = 1;
break;
case GeomAbs_C2:
aCont = 2;
break;
case GeomAbs_C3:
aCont = 3;
break;
case GeomAbs_CN:
aCont = aDegree;
break;
default:
throw Standard_DomainError ("GeomAdaptor_Curve::Intervals()");
}
Standard_Real anEps = Min(Resolution(Precision::Confusion()), Precision::PConfusion());
BSplCLib::Intervals(myBSplineCurve->Knots(),
myBSplineCurve->Multiplicities(),
aDegree,
myBSplineCurve->IsPeriodic(),
aCont,
myFirst,
myLast,
anEps,
&T);
}
else if (myTypeCurve == GeomAbs_OffsetCurve){
Standard_Integer myNbIntervals = 1;
GeomAbs_Shape BaseS=GeomAbs_C0;
switch(S){
case GeomAbs_G1:
@@ -1073,8 +398,7 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
case GeomAbs_C2: BaseS = GeomAbs_C3; break;
default: BaseS = GeomAbs_CN;
}
GeomAdaptor_Curve C
(Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve());
GeomAdaptor_Curve C (Handle(Geom_OffsetCurve)::DownCast (myCurve)->BasisCurve(), myFirst, myLast);
// akm 05/04/02 (OCC278) If our curve is trimmed we must recalculate
// the array of intervals obtained from the basis to
// vvv reflect parameter bounds
@@ -1090,10 +414,15 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
// old - myNbIntervals = C.NbIntervals(BaseS);
// old - C.Intervals(T, BaseS);
// akm 05/04/02 ^^^
T( T.Lower() ) = myFirst;
T( T.Lower() + myNbIntervals ) = myLast;
}
T( T.Lower() ) = FirstParam;
T( T.Lower() + myNbIntervals ) = LastParam;
else
{
T( T.Lower() ) = myFirst;
T( T.Lower() + 1 ) = myLast;
}
}
//=======================================================================

View File

@@ -502,16 +502,7 @@ GeomAbs_SurfaceType GeomAdaptor_SurfaceOfRevolution::GetType() const
MajorRadius = aLin.Distance(aLC);
if(MajorRadius > aR)
{
Standard_Real aT = 0., aDx, dX;
gp_Pnt aPx;
aPx = ElCLib::Value(aT, C);
aDx = aLin.Distance(aPx);
dX = aDx - MajorRadius - aR;
if (dX < 0.)
dX = -dX;
if (dX < TolConf)
return GeomAbs_Torus;
return GeomAbs_Torus;
}
}
break;

View File

@@ -276,6 +276,8 @@ GeomFill_SectionPlacement(const Handle(GeomFill_LocationLaw)& L,
Standard_Integer NbLocalPnts = 10;
Standard_Integer NbPnts = (NbKnots-1) * NbLocalPnts;
if (NbPnts < 0)
NbPnts = 0;
if (I1 != I2)
NbPnts += NbLocalPnts;
if (I3 != I4 && first < BC->Knot(I3))

View File

@@ -93,6 +93,15 @@ public:
//! converts RLine to Geom(2d)_Curve.
Standard_EXPORT static void TreatRLine (const Handle(IntPatch_RLine)& theRL, const Handle(GeomAdaptor_Surface)& theHS1, const Handle(GeomAdaptor_Surface)& theHS2, Handle(Geom_Curve)& theC3d, Handle(Geom2d_Curve)& theC2d1, Handle(Geom2d_Curve)& theC2d2, Standard_Real& theTolReached);
//! creates 2D-curve on given surface from given 3D-curve
Standard_EXPORT static void BuildPCurves (const Standard_Real theFirst, const Standard_Real theLast,
const Standard_Real theUmin, const Standard_Real theUmax,
const Standard_Real theVmin, const Standard_Real theVmax,
Standard_Real& theTol,
const Handle(Geom_Surface)& theSurface,
const Handle(Geom_Curve)& theCurve,
Handle(Geom2d_Curve)& theCurve2d);
//! creates 2D-curve on given surface from given 3D-curve
Standard_EXPORT static void BuildPCurves (const Standard_Real f, const Standard_Real l, Standard_Real& Tol, const Handle(Geom_Surface)& S, const Handle(Geom_Curve)& C, Handle(Geom2d_Curve)& C2d);

View File

@@ -1074,94 +1074,92 @@ void GeomInt_IntSS::TreatRLine(const Handle(IntPatch_RLine)& theRL,
//function : BuildPCurves
//purpose :
//=======================================================================
void GeomInt_IntSS::BuildPCurves (Standard_Real f,
Standard_Real l,
Standard_Real& Tol,
const Handle (Geom_Surface)& S,
const Handle (Geom_Curve)& C,
Handle (Geom2d_Curve)& C2d)
void GeomInt_IntSS::BuildPCurves (const Standard_Real theFirst, const Standard_Real theLast,
const Standard_Real theUmin, const Standard_Real theUmax,
const Standard_Real theVmin, const Standard_Real theVmax,
Standard_Real& theTol,
const Handle(Geom_Surface)& theSurface,
const Handle(Geom_Curve)& theCurve,
Handle(Geom2d_Curve)& theCurve2d)
{
if (!C2d.IsNull()) {
if (!theCurve2d.IsNull() || theSurface.IsNull()) {
return;
}
//
Standard_Real umin,umax,vmin,vmax;
//
S->Bounds(umin, umax, vmin, vmax);
// in class ProjLib_Function the range of parameters is shrank by 1.e-09
if((l - f) > 2.e-09) {
C2d = GeomProjLib::Curve2d(C,f,l,S,umin,umax,vmin,vmax,Tol);
if (C2d.IsNull()) {
if ((theLast - theFirst) > 2.e-09) {
theCurve2d = GeomProjLib::Curve2d(theCurve, theFirst, theLast, theSurface, theUmin, theUmax, theVmin, theVmax, theTol);
if (theCurve2d.IsNull()) {
// proj. a circle that goes through the pole on a sphere to the sphere
Tol += Precision::Confusion();
C2d = GeomProjLib::Curve2d(C,f,l,S,Tol);
theTol += Precision::Confusion();
theCurve2d = GeomProjLib::Curve2d(theCurve, theFirst, theLast, theSurface, theTol);
}
const Handle(Standard_Type)& aType = C2d->DynamicType();
if ( aType == STANDARD_TYPE(Geom2d_BSplineCurve))
{
const Handle(Standard_Type)& aType = theCurve2d->DynamicType();
if (aType == STANDARD_TYPE(Geom2d_BSplineCurve))
{
//Check first, last knots to avoid problems with trimming
//First, last knots can differ from f, l because of numerical error
//of projection and approximation
//The same checking as in Geom2d_TrimmedCurve
if((C2d->FirstParameter() - f > Precision::PConfusion()) ||
(l - C2d->LastParameter() > Precision::PConfusion()))
if ((theCurve2d->FirstParameter() - theFirst > Precision::PConfusion()) ||
(theLast - theCurve2d->LastParameter() > Precision::PConfusion()))
{
Handle(Geom2d_BSplineCurve) aBspl = Handle(Geom2d_BSplineCurve)::DownCast(C2d);
Handle(Geom2d_BSplineCurve) aBspl = Handle(Geom2d_BSplineCurve)::DownCast(theCurve2d);
TColStd_Array1OfReal aKnots(1, aBspl->NbKnots());
aBspl->Knots(aKnots);
BSplCLib::Reparametrize(f, l, aKnots);
BSplCLib::Reparametrize(theFirst, theLast, aKnots);
aBspl->SetKnots(aKnots);
}
}
}
else {
if((l - f) > Epsilon(Abs(f)))
if ((theLast - theFirst) > Epsilon(Abs(theFirst)))
{
//The domain of C2d is [Epsilon(Abs(f)), 2.e-09]
//On this small range C2d can be considered as segment
//of line.
Standard_Real aU=0., aV=0.;
Standard_Real aU = 0., aV = 0.;
GeomAdaptor_Surface anAS;
anAS.Load(S);
anAS.Load(theSurface);
Extrema_ExtPS anExtr;
const gp_Pnt aP3d1 = C->Value(f);
const gp_Pnt aP3d2 = C->Value(l);
const gp_Pnt aP3d1 = theCurve->Value(theFirst);
const gp_Pnt aP3d2 = theCurve->Value(theLast);
anExtr.SetAlgo(Extrema_ExtAlgo_Grad);
anExtr.Initialize(anAS, umin, umax, vmin, vmax,
Precision::Confusion(), Precision::Confusion());
anExtr.Initialize(anAS, theUmin, theUmax, theVmin, theVmax,
Precision::Confusion(), Precision::Confusion());
anExtr.Perform(aP3d1);
if(ParametersOfNearestPointOnSurface(anExtr, aU, aV))
if (ParametersOfNearestPointOnSurface(anExtr, aU, aV))
{
const gp_Pnt2d aP2d1(aU, aV);
anExtr.Perform(aP3d2);
if(ParametersOfNearestPointOnSurface(anExtr, aU, aV))
if (ParametersOfNearestPointOnSurface(anExtr, aU, aV))
{
const gp_Pnt2d aP2d2(aU, aV);
if(aP2d1.Distance(aP2d2) > gp::Resolution())
if (aP2d1.Distance(aP2d2) > gp::Resolution())
{
TColgp_Array1OfPnt2d poles(1,2);
TColStd_Array1OfReal knots(1,2);
TColStd_Array1OfInteger mults(1,2);
TColgp_Array1OfPnt2d poles(1, 2);
TColStd_Array1OfReal knots(1, 2);
TColStd_Array1OfInteger mults(1, 2);
poles(1) = aP2d1;
poles(2) = aP2d2;
knots(1) = f;
knots(2) = l;
knots(1) = theFirst;
knots(2) = theLast;
mults(1) = mults(2) = 2;
C2d = new Geom2d_BSplineCurve(poles,knots,mults,1);
theCurve2d = new Geom2d_BSplineCurve(poles, knots, mults, 1);
//Check same parameter in middle point .begin
const gp_Pnt PMid(C->Value(0.5*(f+l)));
const gp_Pnt PMid(theCurve->Value(0.5*(theFirst + theLast)));
const gp_Pnt2d pmidcurve2d(0.5*(aP2d1.XY() + aP2d2.XY()));
const gp_Pnt aPC(anAS.Value(pmidcurve2d.X(), pmidcurve2d.Y()));
const Standard_Real aDist = PMid.Distance(aPC);
Tol = Max(aDist, Tol);
theTol = Max(aDist, theTol);
//Check same parameter in middle point .end
}
}
@@ -1169,27 +1167,51 @@ void GeomInt_IntSS::BuildPCurves (Standard_Real f,
}
}
//
if (S->IsUPeriodic() && !C2d.IsNull()) {
if (theSurface->IsUPeriodic() && !theCurve2d.IsNull()) {
// Recadre dans le domaine UV de la face
Standard_Real aTm, U0, aEps, period, du, U0x;
Standard_Boolean bAdjust;
//
aEps = Precision::PConfusion();
period = S->UPeriod();
period = theSurface->UPeriod();
//
aTm = .5*(f + l);
gp_Pnt2d pm = C2d->Value(aTm);
aTm = .5 * (theFirst + theLast);
gp_Pnt2d pm = theCurve2d->Value(aTm);
U0 = pm.X();
//
bAdjust =
GeomInt::AdjustPeriodic(U0, umin, umax, period, U0x, du, aEps);
bAdjust =
GeomInt::AdjustPeriodic(U0, theUmin, theUmax, period, U0x, du, aEps);
if (bAdjust) {
gp_Vec2d T1(du, 0.);
C2d->Translate(T1);
theCurve2d->Translate(T1);
}
}
}
//=======================================================================
//function : BuildPCurves
//purpose :
//=======================================================================
void GeomInt_IntSS::BuildPCurves (const Standard_Real f,
const Standard_Real l,
Standard_Real& Tol,
const Handle (Geom_Surface)& S,
const Handle (Geom_Curve)& C,
Handle (Geom2d_Curve)& C2d)
{
if (!C2d.IsNull() || S.IsNull()) {
return;
}
//
Standard_Real umin,umax,vmin,vmax;
//
S->Bounds(umin, umax, vmin, vmax);
BuildPCurves(f, l, umin, umax, vmin, vmax, Tol, S, C, C2d);
}
//=======================================================================
//function : TrimILineOnSurfBoundaries
//purpose : This function finds intersection points of given curves with

View File

@@ -30,18 +30,6 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_HArray1OfPnt.hxx>
static Standard_Boolean Controle(const TColgp_Array1OfPnt& P,
const gp_Pln& Plan,
const Standard_Real Tol)
{
Standard_Integer ii;
Standard_Boolean B=Standard_True;
for (ii=1; ii<=P.Length() && B; ii++)
B = (Plan.Distance(P(ii)) < Tol);
return B;
}
static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
const Standard_Real Tol,
@@ -49,51 +37,36 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles,
gp_Pln& Plan)
{
Standard_Boolean IsPlan = Standard_False;
Standard_Boolean Essai = Standard_True;
Standard_Real gx,gy,gz;
Standard_Integer Nb = Poles.Length();
gp_Pnt Bary;
gp_Pnt Bary;
gp_Dir DX, DY;
Standard_Real aTolSingular = Precision::Confusion();
if (Nb > 10) {
// Test allege (pour une rejection rapide)
TColgp_Array1OfPnt Aux(1,5);
Aux(1) = Poles(1);
Aux(2) = Poles(Nb/3);
Aux(3) = Poles(Nb/2);
Aux(4) = Poles(Nb/2+Nb/3);
Aux(5) = Poles(Nb);
GeomLib::Inertia(Aux, Bary, DX, DY, gx, gy, gz);
Essai = (gz<Tol);
}
if (Essai) { // Test Grandeur nature...
GeomLib::Inertia(Poles, Bary, DX, DY, gx, gy, gz);
if (gz<Tol && gy>Tol) {
gp_Pnt P;
gp_Vec DU, DV;
Standard_Real umin, umax, vmin, vmax;
S->Bounds(umin, umax, vmin, vmax);
S->D1( (umin+umax)/2, (vmin+vmax)/2, P, DU, DV);
// On prend DX le plus proche possible de DU
gp_Dir du(DU);
Standard_Real Angle1 = du.Angle(DX);
Standard_Real Angle2 = du.Angle(DY);
if (Angle1 > M_PI/2) Angle1 = M_PI-Angle1;
if (Angle2 > M_PI/2) Angle2 = M_PI-Angle2;
if (Angle2 < Angle1) {
du = DY; DY = DX; DX = du;
}
if (DX.Angle(DU) > M_PI/2) DX.Reverse();
if (DY.Angle(DV) > M_PI/2) DY.Reverse();
gp_Ax3 axe(Bary, DX^DY, DX);
Plan.SetPosition(axe);
Plan.SetLocation(Bary);
IsPlan = Standard_True;
GeomLib::Inertia(Poles, Bary, DX, DY, gx, gy, gz);
if (gz < Tol && gy > aTolSingular) {
gp_Pnt P;
gp_Vec DU, DV;
Standard_Real umin, umax, vmin, vmax;
S->Bounds(umin, umax, vmin, vmax);
S->D1((umin + umax) / 2, (vmin + vmax) / 2, P, DU, DV);
// On prend DX le plus proche possible de DU
gp_Dir du(DU);
Standard_Real Angle1 = du.Angle(DX);
Standard_Real Angle2 = du.Angle(DY);
if (Angle1 > M_PI / 2) Angle1 = M_PI - Angle1;
if (Angle2 > M_PI / 2) Angle2 = M_PI - Angle2;
if (Angle2 < Angle1) {
du = DY; DY = DX; DX = du;
}
}
if (DX.Angle(DU) > M_PI / 2) DX.Reverse();
if (DY.Angle(DV) > M_PI / 2) DY.Reverse();
gp_Ax3 axe(Bary, DX^DY, DX);
Plan.SetPosition(axe);
Plan.SetLocation(Bary);
IsPlan = Standard_True;
}
return IsPlan;
}
@@ -106,8 +79,6 @@ static Standard_Boolean Controle(const Handle(Geom_Curve)& C,
GeomAbs_CurveType Type;
GeomAdaptor_Curve AC(C);
Type = AC.GetType();
Handle(TColgp_HArray1OfPnt) TabP;
TabP.Nullify();
switch (Type) {
case GeomAbs_Line :
@@ -131,40 +102,27 @@ static Standard_Boolean Controle(const Handle(Geom_Curve)& C,
case GeomAbs_BezierCurve:
{
Nb = AC.NbPoles();
Handle (Geom_BezierCurve) BZ = AC.Bezier();
TabP = new (TColgp_HArray1OfPnt) (1, AC.NbPoles());
for (ii=1; ii<=Nb; ii++)
TabP->SetValue(ii, BZ->Pole(ii));
break;
}
case GeomAbs_BSplineCurve:
{
Nb = AC.NbPoles();
Handle (Geom_BSplineCurve) BZ = AC.BSpline();
TabP = new (TColgp_HArray1OfPnt) (1, AC.NbPoles());
for (ii=1; ii<=Nb; ii++)
TabP->SetValue(ii, BZ->Pole(ii));
break;
}
default :
{
Nb = 8 + 3*AC.NbIntervals(GeomAbs_CN);
}
}
if (TabP.IsNull()) {
Standard_Real u, du, f, l, d;
f = AC.FirstParameter();
l = AC.LastParameter();
du = (l-f)/(Nb-1);
for (ii=1; ii<=Nb && B ; ii++) {
u = (ii-1)*du + f;
d = Plan.Distance(C->Value(u));
B = (d < Tol);
default :
{
Nb = 8 + 3*AC.NbIntervals(GeomAbs_CN);
}
}
else {
B = Controle(TabP->Array1(), Plan, Tol);
Standard_Real u, du, f, l, d;
f = AC.FirstParameter();
l = AC.LastParameter();
du = (l - f) / (Nb - 1);
for (ii = 1; ii <= Nb && B; ii++) {
u = (ii - 1)*du + f;
d = Plan.Distance(C->Value(u));
B = d < Tol;
}
return B;
@@ -196,30 +154,6 @@ GeomLib_IsPlanarSurface::GeomLib_IsPlanarSurface(const Handle(Geom_Surface)& S,
IsPlan = Standard_False;
break;
}
case GeomAbs_BezierSurface :
case GeomAbs_BSplineSurface :
{
Standard_Integer ii, jj, kk,
NbU = AS.NbUPoles(), NbV = AS.NbVPoles();
TColgp_Array1OfPnt Poles(1, NbU*NbV);
if (Type == GeomAbs_BezierSurface) {
Handle(Geom_BezierSurface) BZ;
BZ = AS.Bezier();
for(ii=1, kk=1; ii<=NbU; ii++)
for(jj=1; jj<=NbV; jj++,kk++)
Poles(kk) = BZ->Pole(ii,jj);
}
else {
Handle(Geom_BSplineSurface) BS;
BS = AS.BSpline();
for(ii=1, kk=1; ii<=NbU; ii++)
for(jj=1; jj<=NbV; jj++,kk++)
Poles(kk) = BS->Pole(ii,jj);
}
IsPlan = Controle(Poles, Tol, S, myPlan);
break;
}
case GeomAbs_SurfaceOfRevolution :
{
@@ -299,7 +233,7 @@ GeomLib_IsPlanarSurface::GeomLib_IsPlanarSurface(const Handle(Geom_Surface)& S,
break;
}
default :
default :
{
Standard_Integer NbU,NbV, ii, jj, kk;
NbU = 8 + 3*AS.NbUIntervals(GeomAbs_CN);

View File

@@ -839,14 +839,38 @@ static IFSelect_ReturnStatus fun27
Standard_Integer argc = pilot->NbWords();
Handle(IFSelect_WorkSession) WS = pilot->Session();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
Standard_CString arg2 = pilot->Arg(2);
const Standard_CString anEmptyStr = "";
if (arg2 && strlen(arg2) == 2 && arg2[0] == '"' && arg2[1] == '"')
{
arg2 = anEmptyStr;
}
// **** Param(Value) ****
Message_Messenger::StreamBuffer sout = Message::SendInfo();
if (argc < 2) {
if (argc < 2 || (argc == 3 && strcmp (arg1, "-p") == 0)) {
Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
Standard_Integer i,nb = li->Length();
sout<<" List of parameters : "<<nb<<" items : "<<std::endl;
Standard_Integer i,nb = li->Length(), aPatternNb = 0;
size_t aPatternLen = strlen(arg2);
if (argc == 3)
{
for (i = 1; i <= nb; i ++)
{
if (strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) == 0)
{
aPatternNb++;
}
}
}
else
{
aPatternNb = nb;
}
sout << " List of parameters : " << aPatternNb << " items : " << std::endl;
for (i = 1; i <= nb; i ++) {
if (argc == 3 && strncmp(li->Value(i)->String().ToCString(), arg2, aPatternLen) != 0)
{
continue;
}
sout<<li->Value(i)->String();
sout<<" : "<<Interface_Static::CVal(li->Value(i)->ToCString())<<std::endl;
}
@@ -864,7 +888,14 @@ static IFSelect_ReturnStatus fun27
if (argc == 2) sout<<"To modify, param name_param new_val"<<std::endl;
else {
sout<<" New demanded value : "<<arg2;
if (strlen(arg2) != 0)
{
sout<<" New demanded value : "<<arg2;
}
else
{
sout<<" New demanded value : not valued";
}
if (Interface_Static::SetCVal (arg1,arg2))
{ sout<<" OK"<<std::endl; return IFSelect_RetDone; }
else { sout <<" , refused"<<std::endl; return IFSelect_RetError; }
@@ -2437,7 +2468,9 @@ void IFSelect_Functions::Init()
IFSelect_Act::AddFunc("itemlabel","xxx xxx : liste items having this label",fun24);
IFSelect_Act::AddFunc("xsave","filename:string : sauve items-session",fun25);
IFSelect_Act::AddFunc("xrestore","filename:string : restaure items-session",fun26);
IFSelect_Act::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27);
IFSelect_Act::AddFunc("param","[-p Pattern] - displays all parameters or filtered by pattern;\n"
"par_name - displays parameter;\n"
"par_name par_value - changes parameter's value", fun27);
IFSelect_Act::AddFunc("sentfiles","Lists files sent from last Load",fun29);
IFSelect_Act::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);

View File

@@ -34,9 +34,7 @@ namespace
//=======================================================================
IGESCAFControl_ConfigurationNode::IGESCAFControl_ConfigurationNode() :
DE_ConfigurationNode()
{
UpdateLoad();
}
{}
//=======================================================================
// function : IGESCAFControl_ConfigurationNode
@@ -46,7 +44,6 @@ IGESCAFControl_ConfigurationNode::IGESCAFControl_ConfigurationNode(const Handle(
:DE_ConfigurationNode(theNode)
{
InternalParameters = theNode->InternalParameters;
UpdateLoad();
}
//=======================================================================

View File

@@ -90,10 +90,64 @@ static Handle(IGESData_DefaultSpecific) speci;
Interface_Static::SetIVal ("write.convertsurface.mode",0);
// abv 15.11.00: ShapeProcessing
Interface_Static::Init ("XSTEP","write.iges.resource.name",'t',"IGES");
Interface_Static::Init ("XSTEP","read.iges.resource.name",'t',"IGES");
Interface_Static::Init ("XSTEP","write.iges.sequence",'t',"ToIGES");
Interface_Static::Init ("XSTEP","read.iges.sequence",'t',"FromIGES");
Interface_Static::Init ("XSTEP", "write.iges.resource.name", 't', "IGES");
Interface_Static::Init ("XSTEP", "read.iges.resource.name", 't', "IGES");
Interface_Static::Init ("XSTEP", "write.iges.sequence", 't', "ToIGES");
Interface_Static::Init ("XSTEP", "read.iges.sequence", 't', "FromIGES");
Interface_Static::Init ("XSTEP", "ToIGES.exec.op", 't', "DirectFaces");
Interface_Static::Init ("XSTEP", "FromIGES.exec.op", 't', "FixShape");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.Tolerance3d", 't', "&Runtime.Tolerance");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTolerance3d", 't', "&Runtime.MaxTolerance");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MinTolerance3d", 't', "1.e-7");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeShellMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeFaceMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFreeWireMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSameParameterMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSolidMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShellOrientationMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.CreateOpenSolidMode", 't', "1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShellMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFaceOrientationMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixFaceMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixWireMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixOrientationMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddNaturalBoundMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixMissingSeamMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSmallAreaWireMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.RemoveSmallAreaFaceMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixIntersectingWiresMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixLoopWiresMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSplitFaceMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.AutoCorrectPrecisionMode", 't', "1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ModifyTopologyMode", 't', "0");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ModifyGeometryMode", 't', "1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.ClosedWireMode", 't', "1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.PreferencePCurveMode", 't', "1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixReorderMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSmallMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixConnectedMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixEdgeCurvesMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixDegeneratedMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixLackingMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSelfIntersectionMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.RemoveLoopMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixReversed2dMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixRemovePCurveMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixRemoveCurve3dMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddPCurveMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixAddCurve3dMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSeamMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixShiftedMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixEdgeSameParameterMode", 't', "0");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixNotchedEdgesMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixTailMode", 't', "0");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTailAngle", 't', "0.0");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.MaxTailWidth", 't', "-1.0");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixSelfIntersectingEdgeMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixIntersectingEdgesMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixNonAdjacentIntersectingEdgesMode", 't', "-1");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixVertexPositionMode", 't', "0");
Interface_Static::Init ("XSTEP", "FromIGES.FixShape.FixVertexToleranceMode", 't', "-1");
// sln 11.06.2002 OCC448 : Initialize "read.onlyvisible" parameter to control transferring
// invisible sub entities which logically depend on the grouping entities

View File

@@ -28,7 +28,7 @@ enum IMeshData_Status
IMeshData_TooFewPoints = 0x20, //!< Discrete model contains too few boundary points to generate mesh.
IMeshData_Outdated = 0x40, //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
IMeshData_Reused = 0x80, //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
IMeshData_UserBreak = 0x160 //!< User break
IMeshData_UserBreak = 0x100 //!< User break
};
#endif

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