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

Compare commits

..

55 Commits

Author SHA1 Message Date
jgv
26f0bc0d01 Next version 2022-05-20 11:12:40 +03:00
jgv
6b9da86201 0032833: Shape Healing - FixShape needs to be improved
First version
2022-05-16 16:12:04 +03:00
ifv
33463eef63 0032942: Modeling Algorithms - Boolean operation Common has no result in specific example
IntTools/IntTools_BeanFaceIntersector.cxx - calculation of deflection for surface bnd box is added
tests/bugs/modalg_8/bug32942,bug32943,bug32944,bug32945 - new test cases added
2022-05-06 00:44:14 +03:00
abulyche
84f42008b7 0027081: BRepOffsetAPI_MakeOffsetShape fails on shapes with internal edges
Added the test for this problem.
Added new draw command "mkoffsetshape".
2022-05-06 00:43:27 +03:00
kgv
cb6c7c458c 0032955: Draw Harness, ViewerTest - extend vcolorconvert command to print color in hex format 2022-05-06 00:42:12 +03:00
aml
d2c11b791c 0032961: Coding - get rid of unused headers [IGESAppli to IGESToBRep] 2022-05-06 00:41:19 +03:00
ddzama
73035770f6 0032908: Coding Rules - fix E0349 MSVC compilation error on VS2019/C++20
Get rid of raw C strings in error code to avoid error 0349.
Use std::string instead.
2022-05-04 21:12:54 +03:00
ddzama
1966e6af07 0032919: Coding Rules - suppress useless MSVC warning C26812 on VS2019/C++20 (prefer 'enum class' over 'enum')
CMake and genproj scripts have been updated to suppress this misleading warning that cannot be fixed without breaking existing API.
2022-05-04 21:11:11 +03:00
aml
5dd4cb6e60 0032958: Coding - problem compile OCCT on Debian80-64 and MacOS-x86_64 with debugging mode
Add missing include.
2022-05-04 21:10:02 +03:00
aml
034d1403b1 0032953: Coding - add missing references where applicable 2022-05-04 21:08:16 +03:00
kgv
267738fc40 0032959: Visualization, OpenVR - add Oculus Touch controller bindings 2022-05-04 12:55:59 +03:00
ddzama
e976df2329 0032920: Coding - fix checking of std::stringstream buffer size on VS2019/C++20
Use tellp() instead of in_avail() for testing non-empty std::stringstream state.
2022-04-30 13:22:46 +03:00
aml
82598ec0f2 0032951: Coding - get rid of unused headers [GeomConvert to IGESBasic] 2022-04-29 18:09:58 +03:00
ddzama
7b3f255f23 0032917: Coding Rules - eliminate MSVS warning C26440 on VS2019/C++20 (If your function may not throw, declare it noexcept)
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warning C26440: "If your function may not throw, declare it noexcept"

"If code is not supposed to cause any exceptions,
it should be marked as such by using the 'noexcept' specifier.
This would help to simplify error handling on the client code side,
as well as enable compiler to do additional optimizations."
2022-04-29 18:09:00 +03:00
ddzama
4e1b5fcbf0 0032903: Coding Rules - eliminate MSVC warning C26451 on VS2019/C++20
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
2022-04-27 00:59:45 +03:00
ddzama
9416ba5fb0 0032907: Coding Rules - eliminate MSVC warning C5054 on VS2019/C++20 (operator &,|: deprecated between enumerations of different types)
operator `&`,`|`: deprecated between enumerations of different types
2022-04-27 00:58:30 +03:00
snn
e9a13cf123 0032914: Data Exchange - Some parts of compound are lost while writing STEP in nonmanifold mode
Code related to supporting of single SDR for a non-manifold group, which prevents writing all translation results except the first one, is removed.
SDRs with null used representation object are excluded from writing.
2022-04-27 00:57:20 +03:00
ifv
a0b4fff17a 0028866: Modeling Data - Problem with GeomAPI_ProjectPointOnSurf
Extrema/Extrema_GenExtPS.cxx - adaptive setting of sample points is implemented
bugs/moddata_3/bug28866 - test case added
2022-04-22 18:51:27 +03:00
jgv
51db8cab7b 0032864: Modeling Algorithms - Normal projection of a wire on a cylinder produces wrong result
Minor correction in method BRepAlgo_NormalProjection::Build: correct mixed up first and last parameters of the projected curve.
2022-04-22 00:29:38 +03:00
ddzama
8af9bbd59a 0032906: Coding Rules - get rid of std::iterator inheritance (deprecated since C++17) 2022-04-22 00:27:47 +03:00
jgv
1f45f21358 0032721: Modeling Algorithms - BOP wrong results on a cone and an extrusion
1. Modify method IntPatch_ALineToWLine::MakeWLine: add correction of end points of each line on 2 surfaces if an end point is a pole on a surface.
2. Modify method IntPatch_WLine::ComputeVertexParameters: adjust a point on curve to corresponding vertex the following way: set 3D point as the point of the vertex and 2D points as the points of the point on curve.
2022-04-19 19:23:10 +03:00
ifv
d7f5072158 0032882: Modeling Data - Extrema curve/curve cannot find all solutions
Extrema/Extrema_GenExtCC.gxx - estimation of Lipchitz constant is improved
Extrema_GlobOptFuncCC.cxx - function value is changed

LocOpe/LocOpe_WiresOnShape.cxx - small correction to fix regression

lowalgos/extcc/bug32882 - new test case is added

some test were updated according new behavior of extrema algo
2022-04-19 19:20:12 +03:00
kgv
7090725e2b 0032935: Visualization, TKOpenGles - use size window within OpenGl_Window::init() 2022-04-19 19:18:42 +03:00
azv
d8bfee7b03 0031437: Modeling Data - Offset surface throws exception when trying to evaluate at singularity point
Add test case to prove the exception is avoided.
2022-04-16 22:29:47 +03:00
kgv
879768fbf2 0032886: Visualization, V3d_View - introduce interface for creating a subview
V3d_View/Graphic3d_CView pair has been extended to define subview within the other V3d_View instance.
The initialization is done in form of V3d_View::SetWindow() taking parent V3d_View instance on input.

Subview definition includes dimensions defined as a fraction of a parent view and offset from a corner.
This scheme allows splitting window into several subviews automatically occupying entire viewport,
like splitting window into two vertial subviews (100%x50% + 100%x50%),
three horizontal subviews (33%x100% + 30%x100% + 30%x100%),
1 + 2 stacked subviews (50%x100% + 50%x50% + 50%x50%),
as well as thumbnail-alike subviews displayed on top of another larger view.

OpenGl_View::Redraw() blits content of subviews into the window within immediate redraw step.

AIS_ViewController::FlushViewEvents() has been extended
to re-calculate mouse input into local subview coordinates.
AIS_ViewController::handleViewRedraw() first redraws subviews and then parent views.
Introduced new callback AIS_ViewController::OnSubviewChanged()
to switch input focus to another subview on mouse click,
implemented by ViewerTest_EventManager (has to be done at application level).

vinit command has been extended with parameters -subview and -parent to create a subview.
In addition, view dimension arguments now can be defined as a fraction of screen size instead of pixels.
2022-04-15 18:23:16 +03:00
atychini
179fb34661 0029435: Data Exchange - Exporting wires consisting of more than one edge results in loss of color data in IGES
Colors wasn't read correctly because of incorrect curve transfers in IGESToBRep_TopoCurve.cxx
I added new calls to SetShapeResult() at the necessary places.
Also in the IGESCAFControl_Writer.cxx I added new condition because of the possible NULL exception.
2022-04-15 18:21:46 +03:00
kgv
1caf5fd317 0032924: Configuration, CMake - export INTERFACE_INCLUDE_DIRECTORIES within targets
Add 'INCLUDES' property within INSTALL targets.
2022-04-15 18:20:01 +03:00
ifv
fc41d3b1c0 0032842: Modeling Data - a regression in conversion of a face to bspline
GeomConvert/GeomConvert_1.cxx - forbid using CheckAndSegment if trim is out of base period when converting
                                trimmed torus

tests/bugs/moddata_3/bug32842 - test case added
2022-04-12 20:50:29 +03:00
kgv
08d9c0ae45 0032926: Coding, StdPrs_ToolTriangulatedShape::Normal() - range of "for" not correspond to the NCollection index which run in "for"
Obsolete method has been removed.
2022-04-12 20:46:27 +03:00
ddzama
7021de2fe7 0032909: Coding Rules - replace (removed from C++17) std::random_shuffle with std::shuffle for random permutation algorithm
Since C++17 the accessible version of permutation function left the function:

template< class RandomIt, class URBG >
void shuffle( RandomIt first, RandomIt last, URBG&& g );

See details and example of use: https://en.cppreference.com/w/cpp/algorithm/random_shuffle
2022-04-08 19:04:34 +03:00
ddzama
e455c54bf0 0032918: Coding Rules - suppress MSVS warnings from 3rdparty rapidjson on VS2019/C++20
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Disable warning messages, occures in rapidjson library.
2022-04-08 19:02:14 +03:00
ddzama
d31e5dbbb4 0032916: Coding Rules - eliminate MSVS warning C26451 on VS2019/C++20 (Arithmetic overflow: Using operator '+' on a 4 byte value...)
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of `Warning C26451 Arithmetic overflow: Using operator '+' on a 4 byte value
and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '+' to avoid overflow (io.2)`
2022-04-08 18:55:02 +03:00
ddzama
878ea8cd2b 0032910: Coding Rules - fix uninitialized class fields in constructor initialization block reported by VS2019/C++20
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warnings about uninitialized class fields in constructor initialization block.
2022-04-08 18:52:41 +03:00
azv
ee6581adbe 0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0
Use precision depending on radii of participating circles.
2022-04-08 18:50:30 +03:00
mpv
1fff4ad5a7 0032870: Tests - bugs/caf/bug31918_1 is unstable
# Make the compared values more stable.
2022-04-07 19:21:40 +03:00
azv
a793b75e21 0032809: Sweep algorithm with Round Corner mode failed
Fix indentation within GeomFill_Sweep.cxx

0032809: Sweep algorithm with Round Corner mode failed

Add fix what repair shipping at corner after circle edge at path
Add fix test for bug 24909_3
2022-04-07 19:20:09 +03:00
kgv
5078d0d84e 0032912: Visualization - crash when displaying an OBJ file with missing texture file
Fix NULL dereference within Graphic3d_TextureRoot::convertToCompatible() due to wrong order of checks.
2022-04-06 22:58:16 +03:00
azv
ad3825f821 0030160: DBRep_IsoBuilder builds wrong isolines for planar faces
Add test case
2022-04-06 03:20:38 +03:00
AndreyLA
fe12f15cb4 0024657: 2dintersect returns different number of intersect points in curve intersecting the polygon points is never replaced by line
Test for 2d intersection is added
2022-04-06 03:19:45 +03:00
mgerus
b2ec2f5d42 0031361: Modeling algorithms - An exception arise when building tube
* Add status flag to GeomFill_Pipe
* Add myIsPerform flag to GeomFill_Pipe
* Add checking vectors in GeomFill_CorrectedFrenet
* Add boolean return to SetCurve virtual methods
* Add test case
2022-04-06 03:17:55 +03:00
sshutina
e3fd3d83da 0032861: Visualization - Separate rotate and move the object behavior in AIS_ViewController
Added the flag in Dragging structure that defines perform dragging (ToMove).
2022-04-06 03:16:12 +03:00
ifv
1f37f1d50a 0031661: Modeling Data - Exception when projecting parabola or hyperbola to plane
ProjLib/ProjLib_ProjectOnPlane.cxx - formatting

0031661: Modeling Data - Algorithm crashes when projecting parabola or hyperbola to plane

ProjLib/ProjLib_ProjectOnPlane.cxx - building of analytical parabola and hyperbola is added
bugs/moddata_3/bug31661_* - new test cases are added
2022-04-06 03:15:07 +03:00
AndreyLA
1f000e5974 0031009: Modeling Algorithms - leak reported by Clang address sanitizer in IntCurvesFace_ShapeIntersector
Refactor IntCurvesFace_ShapeIntersector. Use handles and std::unique_ptr instead of raw pointers.
2022-04-06 03:13:47 +03:00
kgv
2491eec38b 0032897: Tests - include elapsed time into test log
Added "ELAPSED TIME" to test case log.
Improved syntax of chrono/dchrono command:
added -elapsed, -userCPU, -sysCPU options printing individual values in seconds.

OSD_Chronometer::IsThisThreadOnly() - added missing accessors to the property.
2022-03-31 21:49:12 +03:00
abulyche
ab279b126b 0029745: Modeling Data - GeomAdaptor_Surface::VIntervals fails on periodic surfaces
Fixed GeomAdaptor_Curve::LocalContinuity() for periodic curves.
Fixed GeomAdaptor_Curve::NbIntervals() for periodic curves.
Fixed GeomAdaptor_Curve::Intervals() for periodic curves.
Improved definition of length in tests.
Update Geom2dAdaptor_Curve to the same behavior.
2022-03-31 21:47:58 +03:00
azv
e4753a7d16 0032863: Cone surface returns wrong v derivative
* Fix error on computing V first derivative on a cone (take into account the slope of the conical generatrix).
* Add DRAW command 'sderivative' to compute certain derivative on a surface.
2022-03-25 20:13:38 +03:00
knosulko
5ae6f08cc6 0024772: Modeling Algorithms - Intersection of cylinder and cone produces incorrect results
GeomInt/GeomInt_IntSS.cxx - handle flat cone case
IntPatch/IntPatch_Intersection.hxx, IntPatch/IntPatch_Intersection.cxx - method for preparing surfaces is added
bugs/lowalgos/intss/bug24772 - test case is changed according new behavior
2022-03-24 19:56:56 +03:00
azv
9b337ad8e5 0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0
Improve tolerance criteria to check values of extremas for equality: use multiplier, which depends on the value, instead of magic number
2022-03-21 19:11:50 +03:00
AndreiLA
3425e83f4b 0023820: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces
The tests are added to verify the correctness of the projection algorithm's work in two cases.
2022-03-21 19:08:57 +03:00
mpv
e720157864 0032442: Application Framework - Problems of testing on MacOS arm64 platform
Fixed the problem of reading XML files on MacOS. 'errno' was not reseted
even the 'strtol' function produced a good value. So, now it is erased
forcibly before the call.
2022-03-18 17:53:47 +03:00
atychini
452ba192d5 0032817: Data Exchange - Step export - writing untrimmed Curve
Incorrect curve handling.
If curve doesn't have trims and vertexes, we handle it such as trimmed curve, but it should be a simple curve.
Curves with only one vertex and one trim should handle by another way, such as a curve that has trims but doesn't have vertexes.
So I added conditions which handles these cases
2022-03-17 18:44:06 +03:00
azv
9140163ba8 0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation
Do not limit the normalization factor of the highly anisotropic parametric space when filtering start points in the algorithm of walking line construction.
Additionally check the knots are in the increasing orders when merging two B-spline curves
2022-03-17 18:42:34 +03:00
mpv
7573a45deb 0032870: Tests - bugs/caf/bug31918_1 is unstable
Improved the test stability: created 10 iterations of measurements and take the minimum to
minimize the affect of other processes and threads; increased the compare range of
the quarter and the whole of the document load.
2022-03-14 19:25:14 +03:00
jgv
802180e1a5 0032719: Modelling Algorithms - UnifySameDomain result has incorrect triangulation
Correct method ShapeUpgrade_UnifySameDomain::UnionPCurves: reparametrize unified pcurves to fit the new range of 3D-curve.
2022-03-14 19:24:17 +03:00
kgv
8ca58a51a7 0032866: Visualization, TKOpenGles - FitAll() is broken when performance counters are displayed
OpenGl_View::MinMaxValues() - added missing theToIncludeAuxiliary check.
2022-03-07 02:13:22 +03:00
1574 changed files with 8915 additions and 6937 deletions

View File

@@ -25,6 +25,9 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif()
if (MSVC)
# suppress C26812 on VS2019/C++20 (prefer 'enum class' over 'enum')
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /wd\"26812\"")
# suppress warning on using portable non-secure functions in favor of non-portable secure ones
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")

View File

@@ -255,7 +255,8 @@ else()
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
if (NOT WIN32)
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")

View File

@@ -100,7 +100,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL32__
@@ -148,7 +148,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
@@ -196,7 +196,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL64__
@@ -244,7 +244,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>

View File

@@ -95,7 +95,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
<ResourceCompile>
@@ -140,7 +140,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile>
@@ -185,7 +185,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>
<ResourceCompile>
@@ -229,7 +229,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile>

View File

@@ -2333,3 +2333,8 @@ Applications extending OCCT 3D Viewer and calling OpenGL functions directly (lik
This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
@subsection upgrade_occt770_tooltriangulatedshape StdPrs_ToolTriangulatedShape
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.

View File

@@ -25,6 +25,7 @@
#include <AIS_InteractiveObject.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <TopoDS_Face.hxx>
#include <TColGeom_SequenceOfCurve.hxx>

View File

@@ -24,6 +24,7 @@
#include <AIS_InteractiveObject.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
//! AIS AIS interactive object for sample 2D marker
class Sample2D_Markers : public AIS_InteractiveObject

View File

@@ -17,6 +17,8 @@
#define _AIS_LightSource_HeaderFile
#include <AIS_InteractiveObject.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <SelectMgr_EntityOwner.hxx>
class Select3D_SensitiveSphere;

View File

@@ -34,6 +34,8 @@ enum AIS_MouseGesture
AIS_MouseGesture_Pan, //!< view panning gesture
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
AIS_MouseGesture_RotateView, //!< view rotation gesture
AIS_MouseGesture_Drag, //!< object dragging;
//! press button to start, move mouse to define rectangle, release to finish
};
//! Map defining mouse gestures.

View File

@@ -18,6 +18,7 @@
#include <AIS_Shape.hxx>
#include <gp_Pnt2d.hxx>
#include <Graphic3d_NameOfTexture2D.hxx>
#include <Image_PixMap.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>

View File

@@ -92,6 +92,7 @@ AIS_ViewController::AIS_ViewController()
myTouchPanThresholdPx (4.0f),
myTouchZoomThresholdPx (6.0f),
myTouchZoomRatio (0.13f),
myTouchDraggingThresholdPx (6.0f),
//
myNbTouchesLast (0),
myUpdateStartPointPan (true),
@@ -116,22 +117,37 @@ AIS_ViewController::AIS_ViewController()
myRubberBand->SetDisplayMode (0);
myRubberBand->SetMutable (true);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_SHIFT, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT, AIS_MouseGesture_SelectRectangle);
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_SHIFT, AIS_MouseGesture_SelectRectangle);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton,
AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_MouseGesture_Pan);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT,
AIS_MouseGesture_SelectRectangle);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_MouseGesture_SelectRectangle);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton, AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT, AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_SHIFT, AIS_SelectionScheme_XOR);
myMouseSelectionSchemes.Bind (Aspect_VKeyMouse_LeftButton | Aspect_VKeyFlags_ALT | Aspect_VKeyFlags_SHIFT, AIS_SelectionScheme_XOR);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton,
AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT,
AIS_SelectionScheme_Replace);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_SelectionScheme_XOR);
myMouseSelectionSchemes.Bind ((Standard_UInteger )Aspect_VKeyMouse_LeftButton | (Standard_UInteger )Aspect_VKeyFlags_ALT | (Standard_UInteger )Aspect_VKeyFlags_SHIFT,
AIS_SelectionScheme_XOR);
myMouseGestureMap.Bind (Aspect_VKeyMouse_RightButton, AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind (Aspect_VKeyMouse_RightButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_RightButton,
AIS_MouseGesture_Zoom);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_RightButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
AIS_MouseGesture_RotateOrbit);
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_MiddleButton,
AIS_MouseGesture_Pan);
myMouseGestureMap.Bind ((Standard_UInteger )Aspect_VKeyMouse_MiddleButton | (Standard_UInteger )Aspect_VKeyFlags_CTRL,
AIS_MouseGesture_Pan);
myMouseGestureMapDrag.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag);
myXRTeleportHaptic.Duration = 3600.0f;
myXRTeleportHaptic.Frequency = 0.1f;
@@ -181,6 +197,53 @@ void AIS_ViewController::FlushViewEvents (const Handle(AIS_InteractiveContext)&
{
flushBuffers (theCtx, theView);
flushGestures(theCtx, theView);
if (theView->IsSubview())
{
// move input coordinates inside the view
const Graphic3d_Vec2i aDelta = theView->View()->SubviewTopLeft();
if (myGL.MoveTo.ToHilight || myGL.Dragging.ToStart)
{
myGL.MoveTo.Point -= aDelta;
}
if (myGL.Panning.ToStart)
{
myGL.Panning.PointStart -= aDelta;
}
if (myGL.Dragging.ToStart)
{
myGL.Dragging.PointStart -= aDelta;
}
if (myGL.Dragging.ToMove)
{
myGL.Dragging.PointTo -= aDelta;
}
if (myGL.OrbitRotation.ToStart)
{
myGL.OrbitRotation.PointStart -= Graphic3d_Vec2d (aDelta);
}
if (myGL.OrbitRotation.ToRotate)
{
myGL.OrbitRotation.PointTo -= Graphic3d_Vec2d (aDelta);
}
if (myGL.ViewRotation.ToStart)
{
myGL.ViewRotation.PointStart -= Graphic3d_Vec2d (aDelta);
}
if (myGL.ViewRotation.ToRotate)
{
myGL.ViewRotation.PointTo -= Graphic3d_Vec2d (aDelta);
}
for (Graphic3d_Vec2i& aPntIter : myGL.Selection.Points)
{
aPntIter -= aDelta;
}
for (Aspect_ScrollDelta& aZoomIter : myGL.ZoomActions)
{
aZoomIter.Point -= aDelta;
}
}
if (theToHandle)
{
HandleViewEvents (theCtx, theView);
@@ -261,12 +324,21 @@ void AIS_ViewController::flushBuffers (const Handle(AIS_InteractiveContext)& ,
myUI.Dragging.ToStop = false;
myGL.Dragging.ToStop = true;
}
else if (myUI.Dragging.ToStart)
else
{
myUI.Dragging.ToStart = false;
myGL.Dragging.ToStart = true;
myGL.Dragging.PointStart = myUI.Dragging.PointStart;
if (myUI.Dragging.ToStart)
{
myUI.Dragging.ToStart = false;
myGL.Dragging.ToStart = true;
myGL.Dragging.PointStart = myUI.Dragging.PointStart;
}
if (myUI.Dragging.ToMove)
{
myUI.Dragging.ToMove = false;
myGL.Dragging.ToMove = true;
}
}
myGL.Dragging.PointTo = myUI.Dragging.PointTo;
if (myUI.OrbitRotation.ToStart)
@@ -351,6 +423,7 @@ void AIS_ViewController::flushGestures (const Handle(AIS_InteractiveContext)& ,
const Graphic3d_Vec2d aRotDelta = aTouch.To - myGL.OrbitRotation.PointStart;
myGL.OrbitRotation.ToRotate = true;
myGL.OrbitRotation.PointTo = myGL.OrbitRotation.PointStart + aRotDelta * aRotAccel;
myGL.Dragging.ToMove = true;
myGL.Dragging.PointTo.SetValues ((int )aTouch.To.x(), (int )aTouch.To.y());
}
else
@@ -358,6 +431,7 @@ void AIS_ViewController::flushGestures (const Handle(AIS_InteractiveContext)& ,
const Graphic3d_Vec2d aRotDelta = aTouch.To - myGL.ViewRotation.PointStart;
myGL.ViewRotation.ToRotate = true;
myGL.ViewRotation.PointTo = myGL.ViewRotation.PointStart + aRotDelta * aRotAccel;
myGL.Dragging.ToMove = true;
myGL.Dragging.PointTo.SetValues ((int )aTouch.To.x(), (int )aTouch.To.y());
}
@@ -780,6 +854,19 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
UpdatePolySelection (thePoint, true);
break;
}
case AIS_MouseGesture_Drag:
{
if (myToAllowDragging)
{
myUI.Dragging.ToStart = true;
myUI.Dragging.PointStart = thePoint;
}
else
{
myMouseActiveGesture = AIS_MouseGesture_NONE;
}
break;
}
case AIS_MouseGesture_NONE:
{
break;
@@ -787,12 +874,19 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
}
}
if (theButtons == Aspect_VKeyMouse_LeftButton
&& theModifiers == Aspect_VKeyFlags_NONE
&& myToAllowDragging)
AIS_MouseGesture aSecGesture = AIS_MouseGesture_NONE;
if (myMouseGestureMapDrag.Find (theButtons | theModifiers, aSecGesture))
{
myUI.Dragging.ToStart = true;
myUI.Dragging.PointStart = thePoint;
if (aSecGesture == AIS_MouseGesture_Drag
&& myToAllowDragging)
{
myUI.Dragging.ToStart = true;
myUI.Dragging.PointStart = thePoint;
if (myMouseActiveGesture == AIS_MouseGesture_NONE)
{
myMouseActiveGesture = aSecGesture;
}
}
}
}
@@ -916,7 +1010,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
const double aRotTol = theIsEmulated
? double(myTouchToleranceScale) * myTouchRotationThresholdPx
: 0.0;
if (double (Abs (aDelta.x()) + Abs (aDelta.y())) > aRotTol)
const Graphic3d_Vec2d aDeltaF (aDelta);
if (Abs (aDeltaF.x()) + Abs (aDeltaF.y()) > aRotTol)
{
const double aRotAccel = myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
const Graphic3d_Vec2i aRotDelta = thePoint - myMousePressPoint;
@@ -932,6 +1027,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
myUI.ViewRotation.PointTo = Graphic3d_Vec2d (myMousePressPoint.x(), myMousePressPoint.y())
+ Graphic3d_Vec2d (aRotDelta.x(), aRotDelta.y()) * aRotAccel;
}
myUI.Dragging.ToMove = true;
myUI.Dragging.PointTo = thePoint;
myMouseProgressPoint = thePoint;
@@ -967,7 +1064,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
const double aPanTol = theIsEmulated
? double(myTouchToleranceScale) * myTouchPanThresholdPx
: 0.0;
if (double (Abs (aDelta.x()) + Abs (aDelta.y())) > aPanTol)
const Graphic3d_Vec2d aDeltaF (aDelta);
if (Abs (aDeltaF.x()) + Abs (aDeltaF.y()) > aPanTol)
{
if (myUpdateStartPointPan)
{
@@ -991,6 +1089,31 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
}
break;
}
case AIS_MouseGesture_Drag:
{
if (!myToAllowDragging)
{
break;
}
const double aDragTol = theIsEmulated
? double(myTouchToleranceScale) * myTouchDraggingThresholdPx
: 0.0;
if (double (Abs (aDelta.x()) + Abs (aDelta.y())) > aDragTol)
{
const double aRotAccel = myNavigationMode == AIS_NavigationMode_FirstPersonWalk ? myMouseAccel : myOrbitAccel;
const Graphic3d_Vec2i aRotDelta = thePoint - myMousePressPoint;
myUI.ViewRotation.ToRotate = true;
myUI.ViewRotation.PointTo = Graphic3d_Vec2d (myMousePressPoint.x(), myMousePressPoint.y())
+ Graphic3d_Vec2d (aRotDelta.x(), aRotDelta.y()) * aRotAccel;
myUI.Dragging.ToMove = true;
myUI.Dragging.PointTo = thePoint;
myMouseProgressPoint = thePoint;
toUpdateView = true;
}
break;
}
default:
{
break;
@@ -1508,10 +1631,11 @@ void AIS_ViewController::handleZoom (const Handle(V3d_View)& theView,
Graphic3d_Vec2i aWinSize;
theView->Window()->Size (aWinSize.x(), aWinSize.y());
const Graphic3d_Vec2d aPanFromCenterPx (double(theParams.Point.x()) - 0.5 * double(aWinSize.x()),
double(aWinSize.y() - theParams.Point.y() - 1) - 0.5 * double(aWinSize.y()));
aDxy.x() += -aViewDims1.X() * aPanFromCenterPx.x() / double(aWinSize.x());
aDxy.y() += -aViewDims1.Y() * aPanFromCenterPx.y() / double(aWinSize.y());
const Graphic3d_Vec2d aWinSizeF (aWinSize);
const Graphic3d_Vec2d aPanFromCenterPx (double(theParams.Point.x()) - 0.5 * aWinSizeF.x(),
aWinSizeF.y() - double(theParams.Point.y()) - 1.0 - 0.5 * aWinSizeF.y());
aDxy.x() += -aViewDims1.X() * aPanFromCenterPx.x() / aWinSizeF.x();
aDxy.y() += -aViewDims1.Y() * aPanFromCenterPx.y() / aWinSizeF.y();
}
//theView->Translate (aCam, aDxy.x(), aDxy.y());
@@ -2566,6 +2690,17 @@ void AIS_ViewController::OnSelectionChanged (const Handle(AIS_InteractiveContext
//
}
// =======================================================================
// function : OnSubviewChanged
// purpose :
// =======================================================================
void AIS_ViewController::OnSubviewChanged (const Handle(AIS_InteractiveContext)& ,
const Handle(V3d_View)& ,
const Handle(V3d_View)& )
{
//
}
// =======================================================================
// function : OnObjectDragged
// purpose :
@@ -2913,8 +3048,7 @@ void AIS_ViewController::handleDynamicHighlight (const Handle(AIS_InteractiveCon
myGL.OrbitRotation.ToRotate = false;
myGL.ViewRotation .ToRotate = false;
}
else if (myGL.OrbitRotation.ToRotate
|| myGL.ViewRotation.ToRotate)
else if (myGL.Dragging.ToMove)
{
OnObjectDragged (theCtx, theView, AIS_DragAction_Update);
myGL.OrbitRotation.ToRotate = false;
@@ -2942,6 +3076,8 @@ void AIS_ViewController::handleMoveTo (const Handle(AIS_InteractiveContext)& the
void AIS_ViewController::handleViewRedraw (const Handle(AIS_InteractiveContext)& ,
const Handle(V3d_View)& theView)
{
Handle(V3d_View) aParentView = theView->IsSubview() ? theView->ParentView() : theView;
// manage animation state
if (!myViewAnimation.IsNull()
&& !myViewAnimation->IsStopped())
@@ -2969,31 +3105,82 @@ void AIS_ViewController::handleViewRedraw (const Handle(AIS_InteractiveContext)&
myToAskNextFrame = true;
}
for (V3d_ListOfViewIterator aViewIter (theView->Viewer()->ActiveViewIterator()); aViewIter.More(); aViewIter.Next())
for (int aSubViewPass = 0; aSubViewPass < 2; ++aSubViewPass)
{
const Handle(V3d_View)& aView = aViewIter.Value();
if (aView->IsInvalidated()
|| (myToAskNextFrame && aView == theView))
const bool isSubViewPass = (aSubViewPass == 0);
for (V3d_ListOfViewIterator aViewIter (theView->Viewer()->ActiveViewIterator()); aViewIter.More(); aViewIter.Next())
{
if (aView->ComputedMode())
const Handle(V3d_View)& aView = aViewIter.Value();
if (isSubViewPass
&& !aView->IsSubview())
{
aView->Update();
for (const Handle(V3d_View)& aSubviewIter : aView->Subviews())
{
if (aSubviewIter->Viewer() != theView->Viewer())
{
if (aSubviewIter->IsInvalidated())
{
if (aSubviewIter->ComputedMode())
{
aSubviewIter->Update();
}
else
{
aSubviewIter->Redraw();
}
}
else if (aSubviewIter->IsInvalidatedImmediate())
{
aSubviewIter->RedrawImmediate();
}
}
}
continue;
}
else
else if (!isSubViewPass
&& aView->IsSubview())
{
aView->Redraw();
continue;
}
if (aView->IsInvalidated()
|| (myToAskNextFrame && aView == theView))
{
if (aView->ComputedMode())
{
aView->Update();
}
else
{
aView->Redraw();
}
if (aView->IsSubview())
{
aView->ParentView()->InvalidateImmediate();
}
}
else if (aView->IsInvalidatedImmediate())
{
if (aView->IsSubview())
{
aView->ParentView()->InvalidateImmediate();
}
aView->RedrawImmediate();
}
}
else if (aView->IsInvalidatedImmediate())
{
aView->RedrawImmediate();
}
}
if (theView->IsSubview()
&& theView->Viewer() != aParentView->Viewer())
{
aParentView->RedrawImmediate();
}
if (myToAskNextFrame)
{
// ask more frames
theView->Window()->InvalidateContent (Handle(Aspect_DisplayConnection)());
aParentView->Window()->InvalidateContent (Handle(Aspect_DisplayConnection)());
}
}
@@ -3238,6 +3425,36 @@ void AIS_ViewController::HandleViewEvents (const Handle(AIS_InteractiveContext)&
{
const bool wasImmediateUpdate = theView->SetImmediateUpdate (false);
Handle(V3d_View) aPickedView;
if (theView->IsSubview()
|| !theView->Subviews().IsEmpty())
{
// activate another subview on mouse click
bool toPickSubview = false;
Graphic3d_Vec2i aClickPoint;
if (myGL.Selection.Tool == AIS_ViewSelectionTool_Picking
&& !myGL.Selection.Points.IsEmpty())
{
aClickPoint = myGL.Selection.Points.Last();
toPickSubview = true;
}
else if (!myGL.ZoomActions.IsEmpty())
{
//aClickPoint = myGL.ZoomActions.Last().Point;
//toPickSubview = true;
}
if (toPickSubview)
{
if (theView->IsSubview())
{
aClickPoint += theView->View()->SubviewTopLeft();
}
Handle(V3d_View) aParent = !theView->IsSubview() ? theView : theView->ParentView();
aPickedView = aParent->PickSubview (aClickPoint);
}
}
handleViewOrientationKeys (theCtx, theView);
const AIS_WalkDelta aWalk = handleNavigationKeys (theCtx, theView);
handleXRInput (theCtx, theView, aWalk);
@@ -3255,6 +3472,12 @@ void AIS_ViewController::HandleViewEvents (const Handle(AIS_InteractiveContext)&
theView->SetImmediateUpdate (wasImmediateUpdate);
if (!aPickedView.IsNull()
&& aPickedView != theView)
{
OnSubviewChanged (theCtx, theView, aPickedView);
}
// make sure to not process the same events twice
myGL.Reset();
myToAskNextFrame = false;

View File

@@ -492,6 +492,12 @@ public:
const Handle(V3d_View)& theView,
AIS_DragAction theAction);
//! Callback called by HandleViewEvents() on Selection of another (sub)view.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void OnSubviewChanged (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theOldView,
const Handle(V3d_View)& theNewView);
//! Pick closest point under mouse cursor.
//! This method is expected to be called from rendering thread.
//! @param thePnt [out] result point
@@ -757,6 +763,7 @@ protected: //! @name mouse input variables
Standard_ShortReal myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default
AIS_MouseGestureMap myMouseGestureMap; //!< map defining mouse gestures
AIS_MouseGestureMap myMouseGestureMapDrag; //!< secondary map defining mouse gestures for dragging
AIS_MouseGesture myMouseActiveGesture; //!< initiated mouse gesture (by pressing mouse button)
AIS_MouseSelectionSchemeMap
myMouseSelectionSchemes; //!< map defining selection schemes bound to mouse + modifiers
@@ -777,6 +784,7 @@ protected: //! @name multi-touch input variables
Standard_ShortReal myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default
Standard_ShortReal myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default
Standard_ShortReal myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default
Standard_ShortReal myTouchDraggingThresholdPx; //!< distance for starting one-touch dragging gesture in pixels; 6 by default
Aspect_Touch myTouchClick; //!< single touch position for handling clicks
OSD_Timer myTouchDoubleTapTimer; //!< timer for handling double tap

View File

@@ -87,12 +87,13 @@ public:
struct _draggingParams
{
bool ToStart; //!< start dragging
bool ToMove; //!< perform dragging
bool ToStop; //!< stop dragging
bool ToAbort; //!< abort dragging (restore previous position)
Graphic3d_Vec2i PointStart; //!< drag start point
Graphic3d_Vec2i PointTo; //!< drag end point
_draggingParams() : ToStart (false), ToStop (false), ToAbort (false) {}
_draggingParams() : ToStart (false), ToMove (false), ToStop (false), ToAbort (false) {}
} Dragging;
struct _orbitRotation
@@ -141,6 +142,7 @@ public:
Panning.ToStart = false;
Panning.ToPan = false;
Dragging.ToStart = false;
Dragging.ToMove = false;
Dragging.ToStop = false;
Dragging.ToAbort = false;
OrbitRotation.ToStart = false;

View File

@@ -15,6 +15,7 @@
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Graphic3d_Group.hxx>
#include <Image_Texture.hxx>
#include <Prs3d_LineAspect.hxx>

View File

@@ -99,10 +99,10 @@ static gp_Parab to3d(const gp_Pln& Pl, const gp_Parab2d& P)
return gp_Parab(to3d(Pl,P.Axis()),P.Focal());
}
static gp_Vec SetLinearForm(const gp_Vec2d DW, const gp_Vec2d D2W,const gp_Vec2d D3W,
const gp_Vec D1U, const gp_Vec D1V, const gp_Vec D2U,
const gp_Vec D2V, const gp_Vec D2UV, const gp_Vec D3U,
const gp_Vec D3V, const gp_Vec D3UUV,const gp_Vec D3UVV)
static gp_Vec SetLinearForm(const gp_Vec2d& DW, const gp_Vec2d& D2W, const gp_Vec2d& D3W,
const gp_Vec& D1U, const gp_Vec& D1V, const gp_Vec& D2U,
const gp_Vec& D2V, const gp_Vec& D2UV, const gp_Vec& D3U,
const gp_Vec& D3V, const gp_Vec& D3UUV,const gp_Vec& D3UVV)
{gp_Vec V31, V32, V33, V34,V3 ;
V31.SetLinearForm(DW.X(),D1U,
D2W.X()*DW.X(),D2U,

View File

@@ -30,34 +30,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
#define myInfinite Precision::Infinite()
static void GetConeApexParam(const gp_Cone& C, Standard_Real& U, Standard_Real& V)
{
const gp_Ax3& Pos = C.Position();
Standard_Real Radius = C.RefRadius();
Standard_Real SAngle = C.SemiAngle();
const gp_Pnt& P = C.Apex();
gp_Trsf T;
T.SetTransformation (Pos);
gp_Pnt Ploc = P.Transformed (T);
if(Ploc.X() ==0.0 && Ploc.Y()==0.0 ) {
U = 0.0;
}
else if ( -Radius > Ploc.Z()* Tan(SAngle) ) {
// the point is at the `wrong` side of the apex
U = atan2(-Ploc.Y(), -Ploc.X());
}
else {
U = atan2(Ploc.Y(),Ploc.X());
}
if (U < -1.e-16) U += (M_PI+M_PI);
else if (U < 0) U = 0;
V = sin(SAngle) * ( Ploc.X() * cos(U) + Ploc.Y() * sin(U) - Radius)
+ cos(SAngle) * Ploc.Z();
}
Adaptor3d_TopolTool::Adaptor3d_TopolTool ()
: myNbSamplesU(-1),
@@ -1376,3 +1348,39 @@ Standard_Boolean Adaptor3d_TopolTool::IsUniformSampling() const
return Standard_False;
return Standard_True;
}
//=======================================================================
//function : GetConeApexParam
//purpose : Computes the cone's apex parameters
//=======================================================================
void Adaptor3d_TopolTool::GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV)
{
const gp_Ax3& Pos = theC.Position();
Standard_Real Radius = theC.RefRadius();
Standard_Real SAngle = theC.SemiAngle();
const gp_Pnt& P = theC.Apex();
gp_Trsf T;
T.SetTransformation(Pos);
gp_Pnt Ploc = P.Transformed(T);
if (Ploc.X() == 0.0 && Ploc.Y() == 0.0)
{
theU = 0.0;
}
else if (-Radius > Ploc.Z() * Tan(SAngle))
{
// the point is at the `wrong` side of the apex
theU = atan2(-Ploc.Y(), -Ploc.X());
}
else
{
theU = atan2(Ploc.Y(), Ploc.X());
}
if (theU < -1.e-16) theU += (M_PI + M_PI);
else if (theU < 0) theU = 0;
theV = sin(SAngle) * (Ploc.X() * cos(theU) + Ploc.Y() * sin(theU) - Radius)
+ cos(SAngle) * Ploc.Z();
}

View File

@@ -146,6 +146,12 @@ public:
//! Returns true if provide uniform sampling of points.
Standard_EXPORT virtual Standard_Boolean IsUniformSampling() const;
//! Computes the cone's apex parameters.
//! @param[in] theC conical surface
//! @param[in] theU U parameter of cone's apex
//! @param[in] theV V parameter of cone's apex
Standard_EXPORT static void GetConeApexParam (const gp_Cone& theC, Standard_Real& theU, Standard_Real& theV);
DEFINE_STANDARD_RTTIEXT(Adaptor3d_TopolTool,Standard_Transient)
protected:

View File

@@ -108,7 +108,7 @@ void Approx_SameParameter_Evaluator::Evaluate (Standard_Integer *,/*Dimension*/
//purpose :
//=======================================================================
static void ProjectPointOnCurve(const Standard_Real InitValue,
const gp_Pnt APoint,
const gp_Pnt& APoint,
const Standard_Real Tolerance,
const Standard_Integer NumIteration,
const Adaptor3d_Curve& Curve,

View File

@@ -40,18 +40,58 @@ class Aspect_Window : public Standard_Transient
DEFINE_STANDARD_RTTIEXT(Aspect_Window, Standard_Transient)
public:
//! Modifies the window background.
Standard_EXPORT void SetBackground (const Aspect_Background& ABack);
//! Returns True if the window <me> is virtual
Standard_EXPORT Standard_Boolean IsVirtual() const;
//! Setup the virtual state
Standard_EXPORT void SetVirtual (const Standard_Boolean theVirtual);
//! Returns window top-left corner.
Graphic3d_Vec2i TopLeft() const
{
Graphic3d_Vec2i aTopLeft, aBotRight;
Position (aTopLeft.x(), aTopLeft.y(), aBotRight.x(), aBotRight.y());
return aTopLeft;
}
//! Returns window dimensions.
Graphic3d_Vec2i Dimensions() const
{
Graphic3d_Vec2i aSize;
Size (aSize.x(), aSize.y());
return aSize;
}
//! Returns connection to Display or NULL.
const Handle(Aspect_DisplayConnection)& DisplayConnection() const { return myDisplay; }
//! Returns the window background.
Standard_EXPORT Aspect_Background Background() const;
//! Returns the current image background fill mode.
Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const;
//! Returns the window gradient background.
Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
//! Modifies the window background.
Standard_EXPORT void SetBackground (const Quantity_Color& color);
Standard_EXPORT void SetBackground (const Aspect_Background& theBack);
//! Modifies the window background.
Standard_EXPORT void SetBackground (const Quantity_Color& theColor);
//! Modifies the window gradient background.
Standard_EXPORT void SetBackground (const Aspect_GradientBackground& ABackground);
Standard_EXPORT void SetBackground (const Aspect_GradientBackground& theBackground);
//! Modifies the window gradient background.
Standard_EXPORT void SetBackground (const Quantity_Color& theFirstColor, const Quantity_Color& theSecondColor, const Aspect_GradientFillMethod theFillMethod);
public:
//! Returns True if the window <me> is opened
//! and False if the window is closed.
Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0;
//! Opens the window <me>.
Standard_EXPORT virtual void Map() const = 0;
@@ -65,25 +105,6 @@ public:
//! and returns TRUE if the window is mapped at screen.
Standard_EXPORT virtual Standard_Boolean DoMapping() const = 0;
//! Returns the window background.
Standard_EXPORT Aspect_Background Background() const;
//! Returns the current image background fill mode.
Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const;
//! Returns the window gradient background.
Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
//! Returns True if the window <me> is opened
//! and False if the window is closed.
Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0;
//! Returns True if the window <me> is virtual
Standard_EXPORT Standard_Boolean IsVirtual() const;
//! Setup the virtual state
Standard_EXPORT void SetVirtual (const Standard_Boolean theVirtual);
//! Returns The Window RATIO equal to the physical
//! WIDTH/HEIGHT dimensions
Standard_EXPORT virtual Standard_Real Ratio() const = 0;
@@ -103,9 +124,6 @@ public:
//! Returns native Window FB config (GLXFBConfig on Xlib)
Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0;
//! Returns connection to Display or NULL.
const Handle(Aspect_DisplayConnection)& DisplayConnection() const { return myDisplay; }
//! Sets window title.
virtual void SetTitle (const TCollection_AsciiString& theTitle) { (void )theTitle; }

View File

@@ -525,7 +525,7 @@ protected:
Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE,
const Standard_Real aTolNew);
Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger theEdges);
Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger& theEdges);
Standard_EXPORT void CorrectToleranceOfSE();

View File

@@ -3394,7 +3394,7 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks
//function : RemovePaveBlocks
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::RemovePaveBlocks(const TColStd_MapOfInteger theEdges)
void BOPAlgo_PaveFiller::RemovePaveBlocks(const TColStd_MapOfInteger& theEdges)
{
// Remove all pave blocks referring to input edges:
//

View File

@@ -334,7 +334,7 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
if(Only2d && Only3d) {
BRepLib_MakeEdge MKed(GeomAdaptor::MakeCurve(hcur->Curve()),
Ufin, Udeb);
Udeb, Ufin);
prj = MKed.Edge();
BB.UpdateEdge(TopoDS::Edge(prj),
PCur2d,

View File

@@ -316,7 +316,6 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
Standard_Real eps = Precision::PConfusion();
Standard_Boolean toRunParallel = !myMutex.IsNull();
const Handle(Adaptor3d_Curve)& aLocalHCurve = GetEdgeCurve(TopoDS::Face(S));
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
@@ -373,13 +372,13 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Handle(Geom_Surface) Sb = cr->Surface();
Sb = Handle(Geom_Surface)::DownCast
// (Su->Transformed(L.Transformation()));
(Su->Transformed(/*L*/TFloc.Transformation()));
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(Sb);
Handle(Geom2dAdaptor_Curve) GHPC = new Geom2dAdaptor_Curve(PC,f,l);
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
BRepLib_ValidateEdge aValidateEdge(aLocalHCurve, ACS, SameParameter);
BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
aValidateEdge.SetExitIfToleranceExceeded(Tol);
aValidateEdge.SetExactMethod(myIsExactMethod);
aValidateEdge.SetParallel(toRunParallel);
@@ -403,7 +402,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
GHPC->Load(cr->PCurve2(),f,l); // same bounds
ACS->Load(GHPC, GAHS); // sans doute inutile
BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(aLocalHCurve, ACS, SameParameter);
BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(myHCurve, ACS, SameParameter);
aValidateEdgeOnClosedSurf.SetExitIfToleranceExceeded(Tol);
aValidateEdgeOnClosedSurf.SetExactMethod(myIsExactMethod);
aValidateEdgeOnClosedSurf.SetParallel(toRunParallel);
@@ -441,12 +440,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
// plan en position
if (myGctrl) {
P = Handle(Geom_Plane)::
DownCast(P->Transformed(/*L*/TFloc.Transformation()));// eap occ332
DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
//on projette Cref sur ce plan
Handle(GeomAdaptor_Surface) GAHS = new GeomAdaptor_Surface(P);
// Dub - Normalement aLocalHCurve est une GeomAdaptor_Curve
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(aLocalHCurve);
// Dub - Normalement myHCurve est une GeomAdaptor_Curve
Handle(GeomAdaptor_Curve) Gac = Handle(GeomAdaptor_Curve)::DownCast(myHCurve);
Handle(Geom_Curve) C3d = Gac->Curve();
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
@@ -459,12 +458,12 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
Handle(Geom2dAdaptor_Curve) GHPC =
new Geom2dAdaptor_Curve(PC,
aLocalHCurve->FirstParameter(),
aLocalHCurve->LastParameter());
myHCurve->FirstParameter(),
myHCurve->LastParameter());
Handle(Adaptor3d_CurveOnSurface) ACS = new Adaptor3d_CurveOnSurface(GHPC,GAHS);
BRepLib_ValidateEdge aValidateEdgeProj(aLocalHCurve, ACS, SameParameter);
BRepLib_ValidateEdge aValidateEdgeProj(myHCurve, ACS, SameParameter);
aValidateEdgeProj.SetExitIfToleranceExceeded(Tol);
aValidateEdgeProj.SetExactMethod(myIsExactMethod);
aValidateEdgeProj.SetParallel(toRunParallel);
@@ -666,50 +665,6 @@ Standard_Real BRepCheck_Edge::Tolerance()
}
//=======================================================================
//function : GetEdgeCurve
//purpose :
//=======================================================================
Handle(Adaptor3d_Curve) BRepCheck_Edge::GetEdgeCurve(const TopoDS_Face& theFace)
{
Handle(Adaptor3d_Curve) aLocalCurve;
Handle(BRep_GCurve) GCref(Handle(BRep_GCurve)::DownCast(myCref));
Standard_Real First, Last;
GCref->Range(First, Last);
if (myCref->IsCurve3D())
{
TopLoc_Location aLoc = !theFace.IsNull()
? (myShape.Location() * myCref->Location()).Predivided(theFace.Location())
: myShape.Location() * myCref->Location();
Handle(Geom_Curve) C3d = Handle(Geom_Curve)::DownCast
(myCref->Curve3D()->Transformed
(aLoc.Transformation()));
GeomAdaptor_Curve GAC3d(C3d, C3d->TransformedParameter(First, aLoc.Transformation()),
C3d->TransformedParameter(Last, aLoc.Transformation()));
aLocalCurve = new GeomAdaptor_Curve(GAC3d);
}
else // curve on surface
{
TopLoc_Location aFaceLoc = theFace.Location();
Handle(Geom_Surface) Sref = myCref->Surface();
Sref = !theFace.IsNull()
? Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Predivided(aFaceLoc).Transformation()))
: Handle(Geom_Surface)::DownCast(Sref->Transformed(myCref->Location().Transformation()));
const Handle(Geom2d_Curve)& PCref = myCref->PCurve();
Handle(GeomAdaptor_Surface) GAHSref = new GeomAdaptor_Surface(Sref);
Handle(Geom2dAdaptor_Curve) GHPCref =
new Geom2dAdaptor_Curve(PCref, First, Last);
Adaptor3d_CurveOnSurface ACSref(GHPCref, GAHSref);
aLocalCurve = new Adaptor3d_CurveOnSurface(ACSref);
}
return aLocalCurve;
}
//=======================================================================
//function : CheckPolygonOnTriangulation
//purpose :

View File

@@ -23,7 +23,6 @@
class BRep_CurveRepresentation;
class TopoDS_Edge;
class TopoDS_Face;
class TopoDS_Shape;
class BRepCheck_Edge;
@@ -50,11 +49,6 @@ public:
Standard_EXPORT Standard_Real Tolerance();
//! Creates a 3d curve or curve on surface by subtracting the location of the face
//! @param[in] theFace input face to get the location from it
//! @return a 3d curve or curve on surface
Standard_EXPORT Handle(Adaptor3d_Curve) GetEdgeCurve (const TopoDS_Face& theFace);
//! Sets status of Edge;
Standard_EXPORT void SetStatus (const BRepCheck_Status theStatus);

View File

@@ -31,11 +31,13 @@
#include <BRepCheck_ListOfStatus.hxx>
#include <BRepCheck_Wire.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRepTools.hxx>
#include <ElCLib.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom_Curve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <gp_Lin.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
@@ -114,6 +116,11 @@ static Standard_Boolean GetPnt2d(const TopoDS_Vertex &theVertex,
const TopoDS_Edge &theEdge,
const TopoDS_Face &theFace,
gp_Pnt2d &aPnt);
static void DefinePeriods(const TopoDS_Face& theFace,
Standard_Real& theUperiod,
Standard_Real& theVperiod);
// Modified by Sergey KHROMOV - Wed May 22 10:44:08 2002 End
//=======================================================================
@@ -419,12 +426,24 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
const gp_Pnt2d& thePnt,
const gp_Pnt2d& thePntRef,
const Standard_Real aTol3d,
const Standard_Boolean theIsOnSingularity,
#ifdef OCCT_DEBUG
const Standard_Boolean PrintWarnings = Standard_True)
#else
const Standard_Boolean = Standard_True)
#endif
{
gp_Pnt aP;
gp_Vec aDU, aDV;
Standard_Real um = (thePnt.X() + thePntRef.X()) / 2.;
Standard_Real vm = (thePnt.Y() + thePntRef.Y()) / 2.;
aFaceSurface.D1(um, vm, aP, aDU, aDV);
Standard_Real aMDU = aDU.Magnitude();
Standard_Real aMDV = aDV.Magnitude();
if (!theIsOnSingularity ||
(aMDU > Precision::Confusion() && aMDV > Precision::Confusion()))
return Standard_True; //we are not in singularity
Standard_Real dumax = 0.01 * (aFaceSurface.LastUParameter() - aFaceSurface.FirstUParameter());
Standard_Real dvmax = 0.01 * (aFaceSurface.LastVParameter() - aFaceSurface.FirstVParameter());
Standard_Real dumin = Abs(thePnt.X() - thePntRef.X());
@@ -453,17 +472,17 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
#endif
dumax = aFaceSurface.UResolution(aTol3d);
dvmax = aFaceSurface.VResolution(aTol3d);
gp_Pnt aP;
gp_Vec aDU, aDV;
Standard_Real um = (thePnt.X() + thePntRef.X()) / 2.;
Standard_Real vm = (thePnt.Y() + thePntRef.Y()) / 2.;
aFaceSurface.D1(um, vm, aP, aDU, aDV);
Standard_Real aMDU = aDU.Magnitude();
//gp_Pnt aP;
//gp_Vec aDU, aDV;
//Standard_Real um = (thePnt.X() + thePntRef.X()) / 2.;
//Standard_Real vm = (thePnt.Y() + thePntRef.Y()) / 2.;
//aFaceSurface.D1(um, vm, aP, aDU, aDV);
//Standard_Real aMDU = aDU.Magnitude();
if (aMDU > Precision::Confusion())
{
dumax = Max((aTol3d / aMDU), dumax);
}
Standard_Real aMDV = aDV.Magnitude();
//Standard_Real aMDV = aDV.Magnitude();
if (aMDV > Precision::Confusion())
{
dvmax = Max((aTol3d / aMDV), dvmax);
@@ -676,7 +695,14 @@ BRepCheck_Status BRepCheck_Wire::Closed2d(const TopoDS_Face& theFace,
gp_Pnt aPntRef = BRep_Tool::Pnt(aFirstVertex);
gp_Pnt aPnt = BRep_Tool::Pnt(aWireExp.CurrentVertex());
if (!(IsDistanceIn2DTolerance(aFaceSurface, aP_first, aP_last, aTol3d)))
Standard_Real aUperiod = 0., aVperiod = 0.;
DefinePeriods (theFace, aUperiod, aVperiod);
if ((aUperiod != 0. && Abs(aP_first.X() - aP_last.X()) > aUperiod/2) ||
(aVperiod != 0. && Abs(aP_first.Y() - aP_last.Y()) > aVperiod/2))
aClosedStat = BRepCheck_NotClosed;
if (!(IsDistanceIn2DTolerance(aFaceSurface, aP_first, aP_last, aTol3d, Standard_True)))
aClosedStat = BRepCheck_NotClosed;
if(!IsDistanceIn3DTolerance(aPntRef, aPnt, aTol3d))
@@ -1710,10 +1736,24 @@ void ChoixUV(const TopoDS_Vertex& theVertex,
if (aVOrientation != anEdgOrientation)
aDerRef.Reverse();
//Check if there is a seam edge in the list
Standard_Real aUperiod = 0., aVperiod = 0.;
DefinePeriods (theFace, aUperiod, aVperiod);
Standard_Boolean anIsOnSingularity = Standard_False;
for (It.Initialize(theLOfShape); It.More(); It.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge (It.Value());
if (BRep_Tool::Degenerated (anEdge))
{
anIsOnSingularity = Standard_True;
break;
}
}
It.Initialize(theLOfShape);
for (; It.More(); It.Next())
{
{
anIndex++;
const TopoDS_Edge& anE=TopoDS::Edge(It.Value());
C2d = BRep_Tool::CurveOnSurface(anE, theFace, aFirstParam, aLastParam);
@@ -1724,7 +1764,11 @@ void ChoixUV(const TopoDS_Vertex& theVertex,
aParam =(aVOrientation != anE.Orientation()) ? aFirstParam : aLastParam;
aPnt = aCA.Value(aParam);
if(!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d, Standard_False))
if ((aUperiod != 0. && Abs(aPnt.X() - aPntRef.X()) > aUperiod/2) ||
(aVperiod != 0. && Abs(aPnt.Y() - aPntRef.Y()) > aVperiod/2))
continue;
if(!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d, anIsOnSingularity, Standard_False))
continue;
CurveDirForParameter(aCA, aParam, aPnt, aDer);
@@ -1743,22 +1787,22 @@ void ChoixUV(const TopoDS_Vertex& theVertex,
anAngle += 2.*M_PI;
if ( theFace.Orientation() == TopAbs_FORWARD )
{
{
if ( anAngle < aMinAngle )
{
{
anIndMin = anIndex;
aMinAngle = anAngle;
}
}
}
else //theFace.Orientation() != TopAbs_FORWARD
{
{
if ( anAngle > aMaxAngle )
{
{
anIndMin = anIndex;
aMaxAngle = anAngle;
}
}
}//end of for
}
}//end of for
// Update edge
if (anIndMin == 0)
@@ -1770,7 +1814,7 @@ void ChoixUV(const TopoDS_Vertex& theVertex,
if(anEFound.IsNull() || BRep_Tool::Degenerated(theEdge) ||
BRep_Tool::Degenerated(anEFound))
IsFound = Standard_False; //bad
else if (!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d))
else if (!IsDistanceIn2DTolerance(aFaceSurface, aPnt, aPntRef, aTol3d, Standard_True))
IsFound = Standard_False; //bad
else
// clousureness in 3D
@@ -1959,3 +2003,20 @@ static Standard_Boolean IsClosed2dForPeriodicFace
return Standard_True;
}
// Modified by Sergey KHROMOV - Thu Jun 20 10:58:05 2002 End
void DefinePeriods(const TopoDS_Face& theFace,
Standard_Real& theUperiod,
Standard_Real& theVperiod)
{
theUperiod = theVperiod = 0.;
Handle(Geom_Surface) aSurf = BRep_Tool::Surface (theFace);
if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
aSurf = (Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf))->BasisSurface();
Standard_Real aUmin, aUmax, aVmin, aVmax;
aSurf->Bounds (aUmin, aUmax, aVmin, aVmax);
if (aSurf->IsUClosed())
theUperiod = aUmax - aUmin;
if (aSurf->IsVClosed())
theVperiod = aVmax - aVmin;
}

View File

@@ -861,7 +861,8 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
Prof2 = BRep_Tool::Curve(E2, f2, l2);
// Indeed, both Prof1 and Prof2 are the same curves but in different positions
// Prof1's param domain may equals to Prof2's param domain *(-1), which means EF.Orientation() == EL.Orientation()
Standard_Boolean bSameCurveDomain = EF.Orientation() != EL.Orientation();
gp_Pnt P1, P2, P;
// Choose the angle of opening
@@ -887,7 +888,8 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
}
}
const gp_Pnt aP2 = Prof2->Value(aPrm[aMaxIdx]).Transformed(aTf);
const Standard_Real aPrm2[] = { f2, 0.5*(f2 + l2), l2 };
const gp_Pnt aP2 = Prof2->Value(aPrm2[bSameCurveDomain ? aMaxIdx : 2 - aMaxIdx]).Transformed(aTf);
const gp_Vec2d aV1(aP1[aMaxIdx].Z(), aP1[aMaxIdx].X());
const gp_Vec2d aV2(aP2.Z(), aP2.X());
if (aV1.SquareMagnitude() <= gp::Resolution() ||

View File

@@ -205,10 +205,10 @@ static void fillParams (const TColStd_Array1OfReal& theKnots,
theParams.Append (theParMax);
}
static void fillPoints (const BRepAdaptor_Curve& theCurve,
const NCollection_Vector<Standard_Real> theParams,
TColgp_SequenceOfPnt& thePoints,
TColStd_SequenceOfReal& theWeights)
static void fillPoints (const BRepAdaptor_Curve& theCurve,
const NCollection_Vector<Standard_Real>& theParams,
TColgp_SequenceOfPnt& thePoints,
TColStd_SequenceOfReal& theWeights)
{
Standard_Real aDistPrev = 0., aDistNext;
gp_Pnt aPPrev (theCurve.Value (theParams (0))), aPNext;

View File

@@ -29,7 +29,7 @@
//purpose :
//=======================================================================
static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M,
const gp_Ax3 Axis)
const gp_Ax3& Axis)
{
Handle(Geom2d_Curve) C;
C = GeomProjLib::Curve2d(M,new Geom_Plane(Axis));

View File

@@ -42,6 +42,7 @@
#include <LocOpe_FindEdgesInFace.hxx>
#include <BRepOffset_MakeOffset.hxx>
#include <BRepOffsetAPI_MakeOffsetShape.hxx>
#include <BRepOffset_MakeSimpleOffset.hxx>
#include <BRep_Builder.hxx>
#include <DBRep.hxx>
@@ -976,6 +977,81 @@ Standard_Integer thickshell(Draw_Interpretor& theCommands,
return 0;
}
//=======================================================================
//function : mkoffsetshape
//purpose :
//=======================================================================
static Standard_Integer mkoffsetshape(Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
if (theArgNb < 4)
{
return 0;
}
TopoDS_Shape aShape = DBRep::Get(theArgVec[2]);
if (aShape.IsNull())
{
theDI << "Shape is null";
return 1;
}
Standard_Real anOffVal = Draw::Atof(theArgVec[3]);
BRepOffsetAPI_MakeOffsetShape aMaker;
if (theArgNb == 4)
{
aMaker.PerformBySimple(aShape, anOffVal);
}
else
{
Standard_Real aTol = Draw::Atof(theArgVec[4]);
Standard_Boolean anInt = Standard_False;
if (theArgNb > 5)
{
if ((Draw::Atof(theArgVec[5]) == 1))
{
anInt = Standard_True;
}
}
Standard_Boolean aSelfInt = Standard_False;
if (theArgNb > 6)
{
if (Draw::Atof(theArgVec[6]) == 1)
{
aSelfInt = Standard_True;
}
}
GeomAbs_JoinType aJoin = GeomAbs_Arc;
if (theArgNb > 7)
{
if (!strcmp(theArgVec[7], "i"))
{
aJoin = GeomAbs_Intersection;
}
}
Standard_Boolean aRemIntEdges = Standard_False;
if (theArgNb > 8)
{
if (Draw::Atof(theArgVec[8]) == 1)
{
aRemIntEdges = Standard_True;
}
}
aMaker.PerformByJoin(aShape, anOffVal, aTol, BRepOffset_Skin, anInt, aSelfInt, aJoin, aRemIntEdges);
}
if (!aMaker.IsDone())
{
theDI << " Error: Offset is not done.\n";
return 1;
}
DBRep::Set(theArgVec[1], aMaker.Shape());
return 0;
}
//=======================================================================
//function : offsetshape
//purpose :
@@ -2477,6 +2553,10 @@ void BRepTest::FeatureCommands(Draw_Interpretor& theCommands)
"thickshell r shape offset [jointype [tol] ]",
__FILE__, thickshell, g);
theCommands.Add("mkoffsetshape",
"mkoffsetshape r shape offset [Tol] [Intersection(0/1)] [SelfInter(0/1)] [JoinType(a/i)] [RemoveInternalEdges(0/1)]",
__FILE__, mkoffsetshape, g);
theCommands.Add("offsetshape",
"offsetshape r shape offset [tol] [face ...]",
__FILE__, offsetshape, g);

View File

@@ -54,6 +54,29 @@ static Standard_Real GetNextParamOnPC(const Handle(Geom2d_Curve)& aPC,
const Standard_Real& tolV,
const Standard_Boolean& reverse);
static Standard_Real LocalUresol (const TopoDS_Vertex& theVertex,
const TopoDS_Face& theFace,
const gp_Pnt2d& theP2d1,
const gp_Pnt2d& theP2d2)
{
Standard_Real aResol = -1;
BRepAdaptor_Surface aBAsurf (theFace, Standard_False);
if (aBAsurf.GetType() == GeomAbs_Sphere)
{
Standard_Real aRadius = aBAsurf.Sphere().Radius();
Standard_Real aVmid = (theP2d1.Y() + theP2d2.Y())/2.;
Standard_Real aLocalRad = aRadius * Cos(aVmid);
if (aLocalRad > Precision::Confusion())
{
Standard_Real aTolVertex = BRep_Tool::Tolerance (theVertex);
aResol = aTolVertex / aLocalRad;
}
}
return aResol;
}
//=======================================================================
//function : BRepTools_WireExplorer
//purpose :
@@ -536,56 +559,56 @@ void BRepTools_WireExplorer::Next()
it.Initialize(l);
while( it.More() )
{
const TopoDS_Edge& E = TopoDS::Edge(it.Value());
if( E.IsSame(myEdge) )
{
it.Next();
k++;
continue;
}
TopoDS_Vertex aVert1, aVert2;
TopExp::Vertices (E, aVert1, aVert2, Standard_True);
if( aVert1.IsNull() || aVert2.IsNull() )
const TopoDS_Edge& E = TopoDS::Edge(it.Value());
if( E.IsSame(myEdge) )
{
it.Next();
k++;
continue;
}
aPCurve = BRep_Tool::CurveOnSurface (E, myFace, dfFPar, dfLPar);
if( aPCurve.IsNull() )
TopoDS_Vertex aVert1, aVert2;
TopExp::Vertices (E, aVert1, aVert2, Standard_True);
if( aVert1.IsNull() || aVert2.IsNull() )
{
it.Next();
k++;
continue;
}
gp_Pnt2d aPEb, aPEe;
if( aVert1.IsSame(aVert2) == isDegenerated )
{
if( E.Orientation() == TopAbs_REVERSED )
aPCurve->D0(dfLPar, aPEb);
else
aPCurve->D0(dfFPar, aPEb);
if( Abs(dfLPar-dfFPar) > Precision::PConfusion() )
{
isrevese = ( E.Orientation() == TopAbs_REVERSED );
isrevese = !isrevese;
Standard_Real aEPm = GetNextParamOnPC(aPCurve,aPEb,dfFPar,dfLPar,myTolU,myTolV,isrevese);
aPCurve->D0 (aEPm, aPEe);
aPCurve = BRep_Tool::CurveOnSurface (E, myFace, dfFPar, dfLPar);
if( aPCurve.IsNull() )
{
it.Next();
k++;
continue;
}
gp_Pnt2d aPEb, aPEe;
if( aVert1.IsSame(aVert2) == isDegenerated )
{
if( E.Orientation() == TopAbs_REVERSED )
aPCurve->D0(dfLPar, aPEb);
else
aPCurve->D0(dfFPar, aPEb);
if( Abs(dfLPar-dfFPar) > Precision::PConfusion() )
{
isrevese = ( E.Orientation() == TopAbs_REVERSED );
isrevese = !isrevese;
Standard_Real aEPm = GetNextParamOnPC(aPCurve,aPEb,dfFPar,dfLPar,myTolU,myTolV,isrevese);
aPCurve->D0 (aEPm, aPEe);
if(aPEb.SquareDistance(aPEe) <= gp::Resolution())
{
//seems to be very short curve
gp_Vec2d aD;
aPCurve->D1(aEPm, aPEe, aD);
if( E.Orientation() == TopAbs_REVERSED )
if( E.Orientation() == TopAbs_REVERSED )
aPEe.SetXY(aPEb.XY()-aD.XY());
else
else
aPEe.SetXY(aPEb.XY()+aD.XY());
if(aPEb.SquareDistance(aPEe) <= gp::Resolution())
{
it.Next();
@@ -593,35 +616,39 @@ void BRepTools_WireExplorer::Next()
continue;
}
}
gp_Vec2d anEDir(aPEb, aPEe);
dfCurAngle = Abs( anEDir.Angle(anERefDir) );
}
if( dfCurAngle <= dfMinAngle )
{
Standard_Real d = PRef.SquareDistance(aPEb);
if( d <= Precision::PConfusion() )
d = 0.;
if( Abs(aPEb.X()-PRef.X()) < myTolU && Abs(aPEb.Y()-PRef.Y()) < myTolV )
{
if( d <= dmin )
{
dfMinAngle = dfCurAngle;
kMin = k;
dmin = d;
}
}
}
}
it.Next();
k++;
gp_Vec2d anEDir(aPEb, aPEe);
dfCurAngle = Abs( anEDir.Angle(anERefDir) );
}
if( dfCurAngle <= dfMinAngle )
{
Standard_Real d = PRef.SquareDistance(aPEb);
if( d <= Precision::PConfusion() )
d = 0.;
//jgv
Standard_Real aLocalUresol = LocalUresol (myVertex, myFace, PRef, aPEb);
aLocalUresol = Max (aLocalUresol, myTolU);
/////
if( Abs(aPEb.X()-PRef.X()) < aLocalUresol && Abs(aPEb.Y()-PRef.Y()) < myTolV )
{
if( d <= dmin )
{
dfMinAngle = dfCurAngle;
kMin = k;
dmin = d;
}
}
}
}
it.Next();
k++;
}// while it
if( kMin == 0 )
{
isDegenerated = Standard_False;
k = 1;
dmin = RealLast();
isDegenerated = Standard_False;
k = 1;
dmin = RealLast();
}
else
break;

View File

@@ -28,7 +28,7 @@ const Standard_CString BinTools_ShapeSetBase::THE_ASCII_VERSIONS[BinTools_Format
//function : operator << (gp_Pnt)
//purpose :
//=======================================================================
Standard_OStream& operator << (Standard_OStream& OS, const gp_Pnt P)
Standard_OStream& operator << (Standard_OStream& OS, const gp_Pnt& P)
{
BinTools::PutReal (OS, P.X());
BinTools::PutReal (OS, P.Y());

View File

@@ -27,7 +27,7 @@ class TopoDS_Shape;
class gp_Pnt;
//! Writes to the stream a gp_Pnt data
Standard_OStream& operator << (Standard_OStream& OS, const gp_Pnt P);
Standard_OStream& operator << (Standard_OStream& OS, const gp_Pnt& P);
//! Computes a hash code for the given value of the uint64_t type, in range [1, theUpperBound]
inline Standard_Integer HashCode (const uint64_t theValue, const Standard_Integer theUpperBound)

View File

@@ -46,7 +46,7 @@ Bnd_Box::Bnd_Box()
//function : Bnd_Box
//purpose :
//=======================================================================
Bnd_Box::Bnd_Box (const gp_Pnt theMin, const gp_Pnt theMax)
Bnd_Box::Bnd_Box (const gp_Pnt& theMin, const gp_Pnt& theMax)
: Gap (0.0)
{
SetVoid();

View File

@@ -71,7 +71,7 @@ public:
//! Creates a bounding box, it contains:
//! - minimum/maximum point of bounding box,
//! The constructed box is qualified Void. Its gap is null.
Standard_EXPORT Bnd_Box (const gp_Pnt theMin, const gp_Pnt theMax);
Standard_EXPORT Bnd_Box (const gp_Pnt& theMin, const gp_Pnt& theMax);
//! Sets this bounding box so that it covers the whole of 3D space.
//! It is infinitely long in all directions.

View File

@@ -798,7 +798,7 @@ public:
private:
SurfMaxMinCoord & operator = (const SurfMaxMinCoord & theOther);
Standard_Boolean CheckInputData(const math_Vector theParams)
Standard_Boolean CheckInputData(const math_Vector& theParams)
{
if (theParams(1) < myUMin ||
theParams(1) > myUMax ||

View File

@@ -1502,12 +1502,12 @@ static Standard_Boolean containE(const TopoDS_Face & F1,
// <tol> from <Param>, check points between <Pf> and <Pl>
//=======================================================================
static Standard_Boolean IsShrink(const Geom2dAdaptor_Curve PC,
const Standard_Real Pf,
const Standard_Real Pl,
const Standard_Real Param,
const Standard_Boolean isU,
const Standard_Real tol)
static Standard_Boolean IsShrink(const Geom2dAdaptor_Curve& PC,
const Standard_Real Pf,
const Standard_Real Pl,
const Standard_Real Param,
const Standard_Boolean isU,
const Standard_Real tol)
{
switch (PC.GetType()) {
case GeomAbs_Line: {

View File

@@ -60,10 +60,10 @@
// la distance de PntD par rapport au plan passant par les trois
// points PntA, PntB, PntC
//=======================================================================
static Standard_Boolean CoPlanar(const gp_Pnt PntA,
const gp_Pnt PntB,
const gp_Pnt PntC,
const gp_Pnt PntD)
static Standard_Boolean CoPlanar(const gp_Pnt& PntA,
const gp_Pnt& PntB,
const gp_Pnt& PntC,
const gp_Pnt& PntD)
{
gp_Vec vecAB(PntA, PntB);
gp_Vec vecAC(PntA, PntC);

View File

@@ -128,7 +128,8 @@ IDirect3DSurface9* D3DHost_View::D3dColorSurface() const
// function : SetWindow
// purpose :
// =======================================================================
void D3DHost_View::SetWindow (const Handle(Aspect_Window)& theWindow,
void D3DHost_View::SetWindow (const Handle(Graphic3d_CView)& theParentVIew,
const Handle(Aspect_Window)& theWindow,
const Aspect_RenderingContext theContext)
{
if (!myD3dWglFbo.IsNull())
@@ -142,7 +143,7 @@ void D3DHost_View::SetWindow (const Handle(Aspect_Window)& theWindow,
myD3dDevice = NULL;
}
OpenGl_View::SetWindow (theWindow, theContext);
OpenGl_View::SetWindow (theParentVIew, theWindow, theContext);
if (!myWindow.IsNull())
{

View File

@@ -44,12 +44,8 @@ public:
Standard_EXPORT virtual void ReleaseGlResources (const Handle(OpenGl_Context)& theCtx) Standard_OVERRIDE;
//! Creates and maps rendering window to the view.
//! @param theWindow [in] the window.
//! @param theContext [in] the rendering context. If NULL the context will be created internally.
//! @param theDisplayCB [in] the display callback function. If is not a NULL value, then the callback will be
//! invoked at the end of the OCC graphic traversal and just before the swap of buffers.
//! @param theClientData [in] the client data for the callback.
Standard_EXPORT virtual void SetWindow (const Handle(Aspect_Window)& theWindow,
Standard_EXPORT virtual void SetWindow (const Handle(Graphic3d_CView)& theParentVIew,
const Handle(Aspect_Window)& theWindow,
const Aspect_RenderingContext theContext) Standard_OVERRIDE;
//! Resizes the window.

View File

@@ -56,7 +56,7 @@ static Standard_Integer DPrsStd_AISInitViewer (Draw_Interpretor& theDI,
TCollection_AsciiString aViewName = TCollection_AsciiString ("Driver1/Document_") + theArgVec[1] + "/View1";
if (!TPrsStd_AISViewer::Find (aRoot, aDocViewer))
{
ViewerTest::ViewerInit (0, 0, 0, 0, aViewName.ToCString(), "");
ViewerTest::ViewerInit (aViewName);
aDocViewer = TPrsStd_AISViewer::New (aRoot, ViewerTest::GetAISContext());
}

View File

@@ -75,146 +75,150 @@ static OSD_Timer aTimer;
extern Standard_Boolean Draw_Chrono;
static Standard_Integer chronom(Draw_Interpretor& di,
Standard_Integer n,const char** a)
static Standard_Integer dchronom (Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
if ((n == 1) || (*a[1] == '0') || (*a[1] == '1')) {
if (n == 1)
if (theNbArgs == 1
|| (theNbArgs == 2
&& (*theArgVec[1] == '0'
|| *theArgVec[1] == '1')))
{
if (theNbArgs == 1)
{
Draw_Chrono = !Draw_Chrono;
}
else
Draw_Chrono = (*a[1] == '1');
{
Draw_Chrono = (*theArgVec[1] == '1');
}
if (Draw_Chrono) di << "Chronometers activated.\n";
else di << "Chronometers deactivated.\n";
theDI << (Draw_Chrono
? "Chronometers activated.\n"
: "Chronometers deactivated.\n");
return 0;
}
else {
Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
Handle(Draw_Chronometer) C;
if (!D.IsNull()) {
C = Handle(Draw_Chronometer)::DownCast(D);
}
if (C.IsNull()) {
C = new Draw_Chronometer();
Draw::Set(a[1],C,Standard_False);
}
if (n <= 2) {
C->Timer().Reset();
}
else {
for (Standard_Integer anIter = 2; anIter < n; ++anIter)
{
TCollection_AsciiString anArg (a[anIter]);
anArg.LowerCase();
if (anArg == "reset")
{
C->Timer().Reset();
}
else if (anArg == "restart")
{
C->Timer().Restart();
}
else if (anArg == "start")
{
C->Timer().Start();
}
else if (anArg == "stop")
{
C->Timer().Stop();
}
else if (anArg == "show")
{
C->Timer().Show();
}
else if (anArg == "counter")
{
Standard_Real aSeconds,aCPUtime;
Standard_Integer aMinutes, aHours;
C->Timer().Show(aSeconds,aMinutes,aHours,aCPUtime);
std::cout << "COUNTER " << a[++anIter] << ": " << aCPUtime << "\n";
}
else
{
std::cerr << "Unknown argument '" << a[anIter] << "'!\n";
}
const char* aTimerName = theArgVec[1];
Handle(Draw_Chronometer) aChronom;
if (Handle(Draw_Drawable3D) aDrawable = Draw::Get (aTimerName))
{
aChronom = Handle(Draw_Chronometer)::DownCast (aDrawable);
}
if (aChronom.IsNull())
{
aChronom = new Draw_Chronometer();
Draw::Set (aTimerName, aChronom, false);
}
if (theNbArgs <= 2)
{
aChronom->Timer().Reset();
return 0;
}
const bool toShowCout = (TCollection_AsciiString (theArgVec[0]) == "chrono");
int aNbPuts = false;
for (Standard_Integer anIter = 2; anIter < theNbArgs; ++anIter)
{
TCollection_AsciiString anArg (theArgVec[anIter]);
anArg.LowerCase();
if (anArg == "-reset"
|| anArg == "reset")
{
aChronom->Timer().Reset();
}
else if (anArg == "-restart"
|| anArg == "restart")
{
aChronom->Timer().Restart();
}
else if (anArg == "-start"
|| anArg == "-resume"
|| anArg == "start")
{
aChronom->Timer().Start();
}
else if (anArg == "-stop"
|| anArg == "-pause"
|| anArg == "stop")
{
aChronom->Timer().Stop();
}
else if (anArg == "-show"
|| anArg == "show")
{
if (toShowCout)
{
aChronom->Timer().Show (std::cout);
}
else
{
Standard_SStream aStream;
aChronom->Timer().Show (aStream);
theDI << aStream;
}
}
else if (anIter + 1 < theNbArgs
&& (anArg == "-counter"
|| anArg == "counter"))
{
Standard_Real aSeconds = 0.0, aCPUtime = 0.0;
Standard_Integer aMinutes = 0, aHours = 0;
aChronom->Timer().Show (aSeconds, aMinutes, aHours, aCPUtime);
if (toShowCout)
{
std::cout << "COUNTER " << theArgVec[++anIter] << ": " << aCPUtime << "\n";
}
else
{
theDI << "COUNTER " << theArgVec[++anIter] << ": " << aCPUtime << "\n";
}
}
else if (anArg == "-elapsed")
{
if (++aNbPuts > 1) { theDI << " "; }
theDI << aChronom->Timer().ElapsedTime();
}
else if (anArg == "-cpu"
|| anArg == "-usercpu"
|| anArg == "-cpuuser")
{
if (++aNbPuts > 1) { theDI << " "; }
theDI << aChronom->Timer().UserTimeCPU();
}
else if (anArg == "-systemcpu"
|| anArg == "-syscpu"
|| anArg == "-cpusystem"
|| anArg == "-cpusys")
{
if (++aNbPuts > 1) { theDI << " "; }
theDI << aChronom->Timer().SystemTimeCPU();
}
else if (anArg == "-thread"
|| anArg == "-threadonly")
{
bool isThreadOnly = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anIter);
aChronom->Timer().Stop();
aChronom->Timer().Reset();
aChronom->Timer().SetThisThreadOnly (isThreadOnly);
}
else if (anArg == "-process")
{
bool isProcessTime = Draw::ParseOnOffIterator (theNbArgs, theArgVec, anIter);
aChronom->Timer().Stop();
aChronom->Timer().Reset();
aChronom->Timer().SetThisThreadOnly (!isProcessTime);
}
else
{
theDI << "Syntax error at '" << theArgVec[anIter] << "'\n";
return 1;
}
}
return 0;
}
static Standard_Integer dchronom(Draw_Interpretor& theDI,
Standard_Integer n,const char** a)
{
if ((n == 1) || (*a[1] == '0') || (*a[1] == '1')) {
if (n == 1)
Draw_Chrono = !Draw_Chrono;
else
Draw_Chrono = (*a[1] == '1');
if (Draw_Chrono) theDI << "Chronometers activated.\n";
else theDI << "Chronometers deactivated.\n";
}
else {
Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
Handle(Draw_Chronometer) C;
if (!D.IsNull()) {
C = Handle(Draw_Chronometer)::DownCast(D);
}
if (C.IsNull()) {
C = new Draw_Chronometer();
Draw::Set(a[1],C,Standard_False);
}
if (n <= 2) {
C->Timer().Reset();
}
else {
for (Standard_Integer anIter = 2; anIter < n; ++anIter)
{
TCollection_AsciiString anArg (a[anIter]);
anArg.LowerCase();
if (anArg == "reset")
{
C->Timer().Reset();
}
else if (anArg == "restart")
{
C->Timer().Restart();
}
else if (anArg == "start")
{
C->Timer().Start();
}
else if (anArg == "stop")
{
C->Timer().Stop();
}
else if (anArg == "show")
{
Standard_SStream ss;
C->Timer().Show(ss);
theDI << ss;
}
else if (anArg == "counter")
{
Standard_Real aSeconds,aCPUtime;
Standard_Integer aMinutes, aHours;
C->Timer().Show(aSeconds,aMinutes,aHours,aCPUtime);
theDI << "COUNTER " << a[++anIter] << ": " << aCPUtime << "\n";
}
else
{
theDI << "Unknown argument '" << a[anIter] << "'!\n";
}
}
}
}
return 0;
}
//=======================================================================
//function : ifbatch
//purpose :
@@ -878,7 +882,8 @@ static int dmeminfo (Draw_Interpretor& theDI,
}
else
{
std::cerr << "Unknown argument '" << theArgVec[anIter] << "'!\n";
theDI << "Syntax error at '" << theArgVec[anIter] << "'!\n";
return 1;
}
}
@@ -1304,11 +1309,33 @@ void Draw::BasicCommands(Draw_Interpretor& theCommands)
__FILE__,Draw_wait,g);
theCommands.Add("cpulimit","cpulimit [nbseconds], no args remove limits",
__FILE__,cpulimit,g);
theCommands.Add("chrono","chrono [name action [action...]] \n Operates named timer.\n"
" Supported actions: reset, start, stop, restart, show, counter [text].\n"
" Without arguments enables / disables global timer for all DRAW commands.",
__FILE__,chronom,g);
theCommands.Add("dchrono","see help of chrono command",
const char* aChronoHelp =
"chrono Name [-start] [-stop] [-reset] [-restart] [-counter Text]"
"\n\t\t: [-show] [-elapsed] [-userCPU] [-sysCPU]"
"\n\t\t: [-thread|-process {0|1}]"
"\n\t\t: Operates named timer:"
"\n\t\t: -start starts (resumes) timer"
"\n\t\t: -stop stops (pauses) timer"
"\n\t\t: -reset resets timer progress"
"\n\t\t: -restart resets and starts timer"
"\n\t\t: -show prints timer progress"
"\n\t\t: ('dchrono' puts into Tcl, 'chrono' puts into std::cout)"
"\n\t\t: -elapsed prints elapsed time in seconds"
"\n\t\t: -userCPU prints user CPU time in seconds"
"\n\t\t: -sysCPU prints system CPU time in seconds"
"\n\t\t: -counter prints 'COUNTER <Text>'"
"\n\t\t: -thread stops timer and sets measuring of CPU time for this thread only (FALSE by default)"
"\n\t\t: -process stops timer and sets measuring of CPU time for all threads (TRUE by default)"
"\n\t\t: Without arguments enables / disables global timer for all DRAW commands."
"\n\t\t: chrono {0|1}"
"\n\t\t: Typical usage:"
"\n\t\t: chrono t -restart"
"\n\t\t: <algorithm>"
"\n\t\t: chrono t -stop -show";
theCommands.Add("chrono", aChronoHelp,
__FILE__,dchronom,g);
theCommands.Add("dchrono", aChronoHelp,
__FILE__,dchronom,g);
theCommands.Add("mallochook",
"debug memory allocation/deallocation, w/o args for help",

View File

@@ -14,69 +14,50 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Draw_Chronometer.hxx>
#include <Draw_Display.hxx>
#include <Draw_Drawable3D.hxx>
#include <OSD_Timer.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Draw_Chronometer,Draw_Drawable3D)
#include <Draw_Display.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Draw_Chronometer, Draw_Drawable3D)
//=======================================================================
//function : Draw_Chronometer
//purpose :
//purpose :
//=======================================================================
Draw_Chronometer::Draw_Chronometer()
{
//
}
//=======================================================================
//function : Timer
//purpose :
//=======================================================================
OSD_Timer& Draw_Chronometer::Timer()
{
return myTimer;
}
//=======================================================================
//function : DrawOn
//purpose :
//purpose :
//=======================================================================
void Draw_Chronometer::DrawOn(Draw_Display&)const
void Draw_Chronometer::DrawOn (Draw_Display& ) const
{
//
}
//=======================================================================
//function : Copy
//purpose :
//purpose :
//=======================================================================
Handle(Draw_Drawable3D) Draw_Chronometer::Copy()const
Handle(Draw_Drawable3D) Draw_Chronometer::Copy() const
{
Handle(Draw_Chronometer) C = new Draw_Chronometer();
return C;
}
//=======================================================================
//function : Dump
//purpose :
//purpose :
//=======================================================================
void Draw_Chronometer::Dump(Standard_OStream& S)const
void Draw_Chronometer::Dump (Standard_OStream& S) const
{
S << "Chronometer : ";
S << "Chronometer, ";
myTimer.Show (S);
}
//=======================================================================
//function : Whatis
//purpose :

View File

@@ -17,32 +17,25 @@
#ifndef _Draw_Chronometer_HeaderFile
#define _Draw_Chronometer_HeaderFile
#include <Standard.hxx>
#include <OSD_Timer.hxx>
#include <Draw_Drawable3D.hxx>
#include <Standard_OStream.hxx>
#include <Draw_Interpretor.hxx>
class Draw_Display;
#include <OSD_Timer.hxx>
class Draw_Chronometer;
DEFINE_STANDARD_HANDLE(Draw_Chronometer, Draw_Drawable3D)
//! Class to store chronometer variables.
class Draw_Chronometer : public Draw_Drawable3D
{
DEFINE_STANDARD_RTTIEXT(Draw_Chronometer, Draw_Drawable3D)
public:
Standard_EXPORT Draw_Chronometer();
Standard_EXPORT OSD_Timer& Timer();
//! Does nothhing,
//! Return timer.
OSD_Timer& Timer() { return myTimer; }
//! Does nothing,
Standard_EXPORT void DrawOn (Draw_Display& dis) const Standard_OVERRIDE;
//! For variable copy.
Standard_EXPORT virtual Handle(Draw_Drawable3D) Copy() const Standard_OVERRIDE;
@@ -52,28 +45,10 @@ public:
//! For variable whatis command.
Standard_EXPORT virtual void Whatis (Draw_Interpretor& I) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Draw_Chronometer,Draw_Drawable3D)
protected:
private:
OSD_Timer myTimer;
};
#endif // _Draw_Chronometer_HeaderFile

View File

@@ -1402,10 +1402,10 @@ proc _run_test {scriptsdir group gridname casefile echo} {
append stats "MEMORY DELTA: [expr ($memuse - $membase) / 1024] KiB\n"
}
uplevel dchrono _timer stop
set time [uplevel dchrono _timer show]
if { [regexp -nocase {CPU user time:[ \t]*([0-9.e-]+)} $time res cpu_usr] } {
append stats "TOTAL CPU TIME: $cpu_usr sec\n"
}
set cpu_usr [uplevel dchrono _timer -userCPU]
set elps [uplevel dchrono _timer -elapsed]
append stats "TOTAL CPU TIME: $cpu_usr sec\n"
append stats "ELAPSED TIME: $elps sec\n"
if { $dlog_exists && ! $echo } {
dlog add $stats
} else {

View File

@@ -176,6 +176,8 @@ gp_Vec ElSLib::ConeDN (const Standard_Real U,
}
else if(Nv == 1) {
Xdir.Multiply(sin(SAngle));
if (Nu == 0)
Xdir.Add(Pos.Direction().XYZ() * cos(SAngle));
return gp_Vec(Xdir);
}
return gp_Vec(0.0,0.0,0.0);

View File

@@ -602,6 +602,9 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
const Bnd_Range aRange(theUt21, theUt22);
Bnd_Range aProjRng1;
// Precision of the calculation depends on circles radii
const Standard_Real aPrecision = Max(Epsilon(myC[0]->Circle().Radius()), Epsilon(myC[1]->Circle().Radius()));
// Project arc of the 1st circle between points theUt11 and theUt12 to the
// 2nd circle. It is necessary to chose correct arc from two possible ones.
@@ -678,7 +681,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
aMinSqD = Min(aMinSqD, ExtPCir.SquareDistance(anExtID));
}
if (aMinSqD <= aMinSquareDist + 10.* Epsilon(1. + aMinSqD))
if (aMinSqD <= aMinSquareDist + (1. + aMinSqD) * aPrecision)
{
ClearSolutions();
mySqDist.Append(aMinSqD);
@@ -778,7 +781,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
imin = k;
}
}
if (aDmin <= aMinSquareDist + 10.* Epsilon(1. + aDmin))
if (aDmin <= aMinSquareDist + (1. + aDmin) * aPrecision)
{
if (imin == 0)
{

View File

@@ -163,7 +163,6 @@ static Standard_Real ProjPOnC(const Pnt& theP,
if (aD < aDist)
aDist = aD;
}
aDist = sqrt(aDist);
}
return aDist;
}
@@ -340,10 +339,20 @@ void Extrema_GenExtCC::Perform()
aNbInter[1] = anIntervals2->Length() - 1;
}
}
if (C1.IsClosed() && aNbInter[0] == 1)
{
ChangeIntervals(anIntervals1, 3);
aNbInter[0] = anIntervals1->Length() - 1;
}
if (C2.IsClosed() && aNbInter[1] == 1)
{
ChangeIntervals(anIntervals2, 3);
aNbInter[1] = anIntervals2->Length() - 1;
}
// Lipchitz constant computation.
const Standard_Real aMaxLC = 10000.;
Standard_Real aLC = 9.0; // Default value.
Standard_Real aLC = 100.0; // Default value.
const Standard_Real aMaxDer1 = 1.0 / C1.Resolution(1.0);
const Standard_Real aMaxDer2 = 1.0 / C2.Resolution(1.0);
Standard_Real aMaxDer = Max(aMaxDer1, aMaxDer2) * Sqrt(2.0);
@@ -383,6 +392,43 @@ void Extrema_GenExtCC::Perform()
}
Extrema_GlobOptFuncCCC2 aFunc (C1, C2);
if (aLC < aMaxLC || aMaxDer > aMaxLC)
{
//Estimation of Lipschitz constant by gradient of optimization function
//using sampling in parameter space.
math_Vector aT(1, 2), aG(1, 2);
Standard_Real aF, aMaxG = 0.;
Standard_Real t1, t2, dt1, dt2;
Standard_Integer n1 = 21, n2 = 21, i1, i2;
dt1 = (C1.LastParameter() - C1.FirstParameter()) / (n1 - 1);
dt2 = (C2.LastParameter() - C2.FirstParameter()) / (n2 - 1);
for (i1 = 1, t1 = C1.FirstParameter(); i1 <= n1; ++i1, t1 += dt1)
{
aT(1) = t1;
for (i2 = 1, t2 = C2.FirstParameter(); i2 <= n2; ++i2, t2 += dt2)
{
aT(2) = t2;
aFunc.Values(aT, aF, aG);
Standard_Real aMod = aG(1)*aG(1) + aG(2)*aG(2);
aMaxG = Max(aMaxG, aMod);
}
}
aMaxG = Sqrt(aMaxG);
if (aMaxG > aMaxDer)
{
aLC = Min(aMaxG, aMaxLC);
isConstLockedFlag = Standard_True;
}
if (aMaxG > 100. * aMaxLC)
{
aLC = 100. * aMaxLC;
isConstLockedFlag = Standard_True;
}
else if (aMaxG < 0.1 * aMaxDer)
{
isConstLockedFlag = Standard_True;
}
}
math_GlobOptMin aFinder(&aFunc, myLowBorder, myUppBorder, aLC);
aFinder.SetLipConstState(isConstLockedFlag);
aFinder.SetContinuity(aContinuity == GeomAbs_C2 ? 2 : 1);
@@ -518,7 +564,6 @@ void Extrema_GenExtCC::Perform()
aVec(2) = (aCurrent.Y() + aNext.Y()) * 0.5;
aFunc.Value(aVec, aVal);
if (Abs(aVal - aF) < Precision::Confusion())
{
// It seems the parallel segment is found.

View File

@@ -715,23 +715,114 @@ void Extrema_GenExtPS::BuildGrid(const gp_Pnt &thePoint)
}
}
// Parametrization of the sample
static Standard_Real LengthOfIso(const Adaptor3d_Surface& theS, const GeomAbs_IsoType theIso,
const Standard_Real thePar1, const Standard_Real thePar2,
const Standard_Integer theNbPnts, const Standard_Real thePar)
{
Standard_Real aLen = 0.;
Standard_Integer i;
Standard_Real dPar = (thePar2 - thePar1) / (theNbPnts - 1);
gp_Pnt aP1, aP2;
Standard_Real aPar = thePar1 + dPar;
if(theIso == GeomAbs_IsoU)
{
aP1 = theS.Value(thePar, thePar1);
}
else
{
aP1 = theS.Value(thePar1, thePar);
}
for (i = 2; i <= theNbPnts; ++i)
{
if (theIso == GeomAbs_IsoU)
{
aP2 = theS.Value(thePar, aPar);
}
else
{
aP2 = theS.Value(aPar, thePar);
}
aLen += aP1.Distance(aP2);
aP1 = aP2;
aPar += dPar;
}
return aLen;
}
static void CorrectNbSamples(const Adaptor3d_Surface& theS,
const Standard_Real theU1, const Standard_Real theU2, Standard_Integer& theNbU,
const Standard_Real theV1, const Standard_Real theV2, Standard_Integer& theNbV)
{
Standard_Real aMinLen = 1.e-3;
Standard_Integer nbp = Min(23, theNbV);
Standard_Real aLenU1 = LengthOfIso(theS, GeomAbs_IsoU, theV1, theV2, nbp, theU1);
if (aLenU1 <= aMinLen)
{
Standard_Real aL = LengthOfIso(theS, GeomAbs_IsoU, theV1, theV2, nbp, .7*theU1 + 0.3*theU2);
aLenU1 = Max(aL, aLenU1);
}
Standard_Real aLenU2 = LengthOfIso(theS, GeomAbs_IsoU, theV1, theV2, nbp, theU2);
if (aLenU2 <= aMinLen)
{
Standard_Real aL = LengthOfIso(theS, GeomAbs_IsoU, theV1, theV2, nbp, .3*theU1 + 0.7*theU2);
aLenU2 = Max(aL, aLenU2);
}
nbp = Min(23, theNbV);
Standard_Real aLenV1 = LengthOfIso(theS, GeomAbs_IsoV, theU1, theU2, nbp, theV1);
if (aLenV1 <= aMinLen)
{
Standard_Real aL = LengthOfIso(theS, GeomAbs_IsoV, theU1, theU2, nbp, .7*theV1 + 0.3*theV2);
aLenV1 = Max(aL, aLenV1);
}
Standard_Real aLenV2 = LengthOfIso(theS, GeomAbs_IsoV, theU1, theU2, nbp, theV2);
if (aLenV2 <= aMinLen)
{
Standard_Real aL = LengthOfIso(theS, GeomAbs_IsoV, theU1, theU2, nbp, .3*theV1 + 0.7*theV2);
aLenV2 = Max(aL, aLenV2);
}
//
Standard_Real aStepV1 = aLenU1 / theNbV;
Standard_Real aStepV2 = aLenU2 / theNbV;
Standard_Real aStepU1 = aLenV1 / theNbU;
Standard_Real aStepU2 = aLenV2 / theNbU;
Standard_Real aMaxStepV = Max(aStepV1, aStepV2);
Standard_Real aMaxStepU = Max(aStepU1, aStepU2);
//
Standard_Real aRatio = aMaxStepV / aMaxStepU;
if (aRatio > 10.)
{
Standard_Integer aMult = RealToInt(Log(aRatio) );
if(aMult > 1)
theNbV *= aMult;
}
else if (aRatio < 0.1)
{
Standard_Integer aMult = RealToInt( - Log(aRatio));
if(aMult > 1)
theNbV *= aMult;
}
}
void Extrema_GenExtPS::BuildTree()
{
// if tree already exists, assume it is already correctly filled
if ( ! mySphereUBTree.IsNull() )
if (!mySphereUBTree.IsNull())
return;
if (myS->GetType() == GeomAbs_BSplineSurface) {
Handle(Geom_BSplineSurface) aBspl = myS->BSpline();
Standard_Integer aUValue = aBspl->UDegree() * aBspl->NbUKnots();
Standard_Integer aVValue = aBspl->VDegree() * aBspl->NbVKnots();
if (aUValue > myusample)
myusample = aUValue;
if (aVValue > myvsample)
myvsample = aVValue;
}
if (myS->GetType() == GeomAbs_BSplineSurface) {
Handle(Geom_BSplineSurface) aBspl = myS->BSpline();
Standard_Integer aUValue = aBspl->UDegree() * aBspl->NbUKnots();
Standard_Integer aVValue = aBspl->VDegree() * aBspl->NbVKnots();
// 300 is value, which is used for singular points (see Extrema_ExtPS.cxx::Initialize(...))
if (aUValue > myusample)
myusample = Min(aUValue, 300);
if (aVValue > myvsample)
myvsample = Min(aVValue, 300);
}
//
CorrectNbSamples(*myS, myumin, myusup, myusample, myvmin, myvsup, myvsample);
//
Standard_Real PasU = myusup - myumin;
Standard_Real PasV = myvsup - myvmin;
Standard_Real U0 = PasU / myusample / 100.;

View File

@@ -43,7 +43,7 @@ static Standard_Boolean _Value(const Adaptor3d_Curve& C1,
return Standard_False;
}
F = C2.Value(v).Distance(C1.Value(u));
F = C2.Value(v).SquareDistance(C1.Value(u));
return Standard_True;
}
@@ -64,7 +64,7 @@ static Standard_Boolean _Value(const Adaptor2d_Curve2d& C1,
return Standard_False;
}
F = C2.Value(v).Distance(C1.Value(u));
F = C2.Value(v).SquareDistance(C1.Value(u));
return Standard_True;
}
@@ -89,13 +89,14 @@ static Standard_Boolean _Gradient(const Adaptor3d_Curve& C1,
C1.D1(X(1), C1D0, C1D1);
C2.D1(X(2), C2D0, C2D1);
G(1) = - (C2D0.X() - C1D0.X()) * C1D1.X()
- (C2D0.Y() - C1D0.Y()) * C1D1.Y()
- (C2D0.Z() - C1D0.Z()) * C1D1.Z();
G(2) = (C2D0.X() - C1D0.X()) * C2D1.X()
+ (C2D0.Y() - C1D0.Y()) * C2D1.Y()
+ (C2D0.Z() - C1D0.Z()) * C2D1.Z();
G *= 2.;
return Standard_True;
}
@@ -121,8 +122,11 @@ static Standard_Boolean _Gradient(const Adaptor2d_Curve2d& C1,
G(1) = - (C2D0.X() - C1D0.X()) * C1D1.X()
- (C2D0.Y() - C1D0.Y()) * C1D1.Y();
G(2) = (C2D0.X() - C1D0.X()) * C2D1.X()
+ (C2D0.Y() - C1D0.Y()) * C2D1.Y();
G *= 2.;
return Standard_True;
}
@@ -166,6 +170,7 @@ static Standard_Boolean _Hessian (const Adaptor3d_Curve& C1,
+ (C2D0.X() - C1D0.X()) * C2D2.X()
+ (C2D0.Y() - C1D0.Y()) * C2D2.Y()
+ (C2D0.Z() - C1D0.Z()) * C2D2.Z();
H *= 2.;
return Standard_True;
}
@@ -204,10 +209,11 @@ static Standard_Boolean _Hessian (const Adaptor2d_Curve2d& C1,
+ C2D1.Y() * C2D1.Y()
+ (C2D0.X() - C1D0.X()) * C2D2.X()
+ (C2D0.Y() - C1D0.Y()) * C2D2.Y();
H *= 2.;
return Standard_True;
}
// C0
//C0
//=======================================================================
//function : Extrema_GlobOptFuncCCC0
@@ -415,6 +421,5 @@ Standard_Boolean Extrema_GlobOptFuncCCC2::Values(const math_Vector& X,Standard_R
else
isHessianComputed = _Hessian(*myC1_2d, *myC2_2d, X, H);
return (Value(X, F) && Gradient(X, G) && isHessianComputed);
}

View File

@@ -14,11 +14,8 @@
#include <GProp.hxx>
#include <gp.hxx>
#include <gp_Mat.hxx>
#include <gp_Pnt.hxx>
#include <gp_XYZ.hxx>
#include <Standard_DimensionError.hxx>
void GProp::HOperator (

View File

@@ -14,11 +14,9 @@
#include <ElCLib.hxx>
#include <gp.hxx>
#include <gp_Circ.hxx>
#include <gp_Lin.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <GProp.hxx>
#include <GProp_CelGProps.hxx>
#include <math_Jacobi.hxx>

View File

@@ -19,10 +19,8 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <GProp_GProps.hxx>
#include <Standard_Real.hxx>
class gp_Circ;
class gp_Pnt;
class gp_Lin;

View File

@@ -13,7 +13,6 @@
// commercial license or contractual agreement.
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Mat.hxx>
#include <gp_Pnt.hxx>

View File

@@ -19,10 +19,8 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Pnt.hxx>
#include <Standard_Real.hxx>
#include <gp_Mat.hxx>
class gp_Ax1;
class GProp_PrincipalProps;

View File

@@ -13,7 +13,6 @@
// commercial license or contractual agreement.
#include <gp_Lin.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>

View File

@@ -19,14 +19,11 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <GProp_EquaType.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class gp_Pln;
class gp_Lin;

View File

@@ -13,9 +13,6 @@
// commercial license or contractual agreement.
#include <gp.hxx>
#include <gp_Pnt.hxx>
#include <gp_XYZ.hxx>
#include <GProp_PGProps.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_DomainError.hxx>

View File

@@ -22,7 +22,6 @@
#include <Standard_Handle.hxx>
#include <GProp_GProps.hxx>
#include <Standard_Real.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>

View File

@@ -13,10 +13,7 @@
// commercial license or contractual agreement.
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <GProp_PrincipalProps.hxx>
#include <GProp_UndefinedAxis.hxx>
typedef gp_Vec Vec;
typedef gp_Pnt Pnt;

View File

@@ -21,7 +21,6 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <gp_Vec.hxx>
#include <gp_Pnt.hxx>
#include <GProp_GProps.hxx>

View File

@@ -23,7 +23,6 @@
#include <math_Jacobi.hxx>
#include <math_Matrix.hxx>
#include <math_Vector.hxx>
#include <Standard_NotImplemented.hxx>
GProp_SelGProps::GProp_SelGProps(){}

View File

@@ -19,10 +19,8 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <GProp_GProps.hxx>
#include <Standard_Real.hxx>
class gp_Cylinder;
class gp_Pnt;
class gp_Cone;

View File

@@ -18,7 +18,6 @@
#define _GProp_UndefinedAxis_HeaderFile
#include <Standard_Type.hxx>
#include <Standard_DefineException.hxx>
#include <Standard_SStream.hxx>
#include <Standard_DomainError.hxx>

View File

@@ -13,7 +13,6 @@
// commercial license or contractual agreement.
#include <gp.hxx>
#include <gp_Cone.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Pnt.hxx>
@@ -24,7 +23,6 @@
#include <math_Jacobi.hxx>
#include <math_Matrix.hxx>
#include <math_Vector.hxx>
#include <Standard_NotImplemented.hxx>
GProp_VelGProps::GProp_VelGProps(){}

View File

@@ -19,10 +19,8 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <GProp_GProps.hxx>
#include <Standard_Real.hxx>
class gp_Cylinder;
class gp_Pnt;
class gp_Cone;

View File

@@ -58,6 +58,65 @@ 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 :
@@ -115,7 +174,7 @@ GeomAbs_Shape Geom2dAdaptor_Curve::LocalContinuity(const Standard_Real U1,
if ( myBSplineCurve->IsPeriodic() && Index1 == Nb )
Index1 = 1;
if ( Index2 - Index1 <= 0) {
if ((Index2 - Index1 <= 0) && (!myBSplineCurve->IsPeriodic())) {
MultMax = 100; // CN entre 2 Noeuds consecutifs
}
else {
@@ -295,6 +354,158 @@ 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 :
@@ -306,77 +517,179 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
if ( S > Continuity()) {
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) {
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
throw Standard_DomainError("Geom2dAdaptor_Curve::NbIntervals");
break;
case GeomAbs_C0:
myNbIntervals = 1;
break;
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;
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++;
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);
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)
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
if ( newLast-TK(Index2)> Eps) Index2++;
myNbIntervals = 1;
for ( Standard_Integer i=1; i<=NbInt; i++)
if (Inter(i)>Index1 && Inter(i)<Index2) myNbIntervals++;
}
break;
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;
}
}
}
@@ -399,6 +712,204 @@ Standard_Integer Geom2dAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
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;
}
}
}
//=======================================================================
//function : Intervals
//purpose :
@@ -413,7 +924,9 @@ void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
if ( S > Continuity()) {
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:
@@ -427,72 +940,127 @@ void Geom2dAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
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;
{
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++;
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);
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);
}
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)
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
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));
}
}
break;
// 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;
return;
}
}
}

View File

@@ -58,6 +58,65 @@ 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 :
@@ -114,7 +173,7 @@ GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
if ( (myBSplineCurve->IsPeriodic()) && (Index1 == Nb) )
Index1 = 1;
if ( Index2 - Index1 <= 0) {
if ((Index2 - Index1 <= 0) && (!myBSplineCurve->IsPeriodic())) {
MultMax = 100; // CN entre 2 Noeuds consecutifs
}
else {
@@ -251,6 +310,159 @@ 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 :
@@ -262,11 +474,14 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
Standard_Integer NbSplit;
if (myTypeCurve == GeomAbs_BSplineCurve) {
Standard_Integer FirstIndex = myBSplineCurve->FirstUKnotIndex();
Standard_Integer LastIndex = myBSplineCurve->LastUKnotIndex();
TColStd_Array1OfInteger Inter (1, LastIndex-FirstIndex+1);
if ( S > Continuity()) {
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) {
switch (S) {
case GeomAbs_G1:
case GeomAbs_G2:
throw Standard_DomainError("GeomAdaptor_Curve::NbIntervals");
@@ -276,68 +491,168 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
break;
case GeomAbs_C1:
case GeomAbs_C2:
case GeomAbs_C3:
case GeomAbs_CN:
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 ( 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;
const TColStd_Array1OfReal& TK = myBSplineCurve->Knots();
const TColStd_Array1OfInteger& TM = myBSplineCurve->Multiplicities();
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);
// Protection against myFirst = UFirst - eps, which located as ULast - eps
if (myBSplineCurve->IsPeriodic() && (newLast - newFirst) < Precision::PConfusion())
if (Degree - Mults(Index) < Cont)
{
if (Abs(newLast - myBSplineCurve->FirstParameter()) < Precision::PConfusion())
newLast += myBSplineCurve->Period();
else
newFirst -= myBSplineCurve->Period();
Inter(NbSplit) = Index;
NbSplit++;
}
// On decale eventuellement les indices
// On utilise une "petite" tolerance, la resolution ne doit
// servir que pour les tres longue courbes....(PRO9248)
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if ( Abs(newFirst-TK(Index1+1))< Eps) Index1++;
if ( newLast-TK(Index2)> Eps) Index2++;
myNbIntervals = 1;
for ( Standard_Integer i=1; i<=NbInt; i++)
if (Inter(i)>Index1 && Inter(i)<Index2) myNbIntervals++;
Index++;
}
break;
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;
}
}
}
@@ -373,6 +688,206 @@ Standard_Integer GeomAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
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;
}
}
}
//=======================================================================
//function : Intervals
//purpose :
@@ -385,106 +900,166 @@ void GeomAdaptor_Curve::Intervals(TColStd_Array1OfReal& T,
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);
if ( S > Continuity()) {
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();
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)
Standard_Real Eps = Min(Resolution(Precision::Confusion()),
Precision::PConfusion());
if ( Abs(FirstParam-TK(Index1+1))< Eps) Index1++;
if ( LastParam-TK(Index2)> Eps) Index2++;
myNbIntervals = 1;
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();
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));
}
}
break;
}
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;
return;
}
}
}
else if (myTypeCurve == GeomAbs_OffsetCurve){
GeomAbs_Shape BaseS=GeomAbs_C0;

View File

@@ -14,7 +14,6 @@
#include <GeomConvert.hxx>
#include <BSplCLib.hxx>
#include <Convert_CircleToBSplineCurve.hxx>
#include <Convert_ConicToBSplineCurve.hxx>
#include <Convert_EllipseToBSplineCurve.hxx>
@@ -24,7 +23,6 @@
#include <Geom2d_BSplineCurve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Conic.hxx>
#include <Geom_Curve.hxx>
@@ -34,7 +32,6 @@
#include <Geom_Line.hxx>
#include <Geom_OffsetCurve.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomConvert_ApproxCurve.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
@@ -44,7 +41,6 @@
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Hypr2d.hxx>
#include <gp_Lin.hxx>
#include <gp_Parab2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>

View File

@@ -14,7 +14,6 @@
#include <GeomConvert.hxx>
#include <BSplCLib.hxx>
#include <Convert_ConeToBSplineSurface.hxx>
#include <Convert_CylinderToBSplineSurface.hxx>
#include <Convert_ElementarySurfaceToBSplineSurface.hxx>
@@ -22,7 +21,6 @@
#include <Convert_TorusToBSplineSurface.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_CylindricalSurface.hxx>
@@ -41,22 +39,18 @@
#include <gp_Cone.hxx>
#include <gp_Cylinder.hxx>
#include <gp_GTrsf.hxx>
#include <gp_Pln.hxx>
#include <gp_Sphere.hxx>
#include <gp_Torus.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Precision.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_NotImplemented.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array2OfInteger.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>
typedef Geom_Surface Surface;
typedef Geom_BSplineSurface BSplineSurface;
@@ -477,7 +471,13 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
Handle(Geom_ToroidalSurface)::DownCast(Surf);
gp_Torus Tr = TheElSurf->Torus();
if (isUClosed) {
//
// if isUClosed = true and U trim does not coinside with first period of torus,
// method CheckAndSegment shifts position of U seam boundary of surface.
// probably bug? So, for this case we must build not periodic surface.
Standard_Boolean isUFirstPeriod = !(UFirst < 0. || ULast > 2.*M_PI);
Standard_Boolean isVFirstPeriod = !(VFirst < 0. || VLast > 2.*M_PI);
if (isUClosed && isUFirstPeriod) {
Convert_TorusToBSplineSurface Convert (Tr, VFirst, VLast,
Standard_False);
TheSurface = BSplineSurfaceBuilder (Convert);
@@ -487,7 +487,7 @@ Handle(Geom_BSplineSurface) GeomConvert::SurfaceToBSplineSurface
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
}
}
else if (Strim->IsVClosed()) {
else if (Strim->IsVClosed() && isVFirstPeriod) {
Convert_TorusToBSplineSurface Convert (Tr, UFirst, ULast);
TheSurface = BSplineSurfaceBuilder (Convert);
Standard_Integer aNbK = TheSurface->NbVKnots();

View File

@@ -25,8 +25,6 @@
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Precision.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_HArray1OfReal.hxx>

View File

@@ -21,7 +21,6 @@
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Precision.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Real.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_HArray2OfReal.hxx>

View File

@@ -18,7 +18,6 @@
#include <BSplCLib.hxx>
#include <Geom_BSplineCurve.hxx>
#include <GeomConvert_BSplineCurveKnotSplitting.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_RangeError.hxx>
typedef TColStd_Array1OfInteger Array1OfInteger;

View File

@@ -18,7 +18,6 @@
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <GeomConvert_BSplineCurveToBezierCurve.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TColgp_Array1OfPnt.hxx>

View File

@@ -21,7 +21,6 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <TColGeom_Array1OfBezierCurve.hxx>
#include <TColStd_Array1OfReal.hxx>

View File

@@ -18,7 +18,6 @@
#include <BSplCLib.hxx>
#include <Geom_BSplineSurface.hxx>
#include <GeomConvert_BSplineSurfaceKnotSplitting.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_RangeError.hxx>
typedef TColStd_Array1OfInteger Array1OfInteger;

View File

@@ -18,7 +18,6 @@
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <GeomConvert_BSplineSurfaceToBezierSurface.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TColgp_Array2OfPnt.hxx>

View File

@@ -21,7 +21,6 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <TColGeom_Array2OfBezierSurface.hxx>
#include <TColStd_Array1OfReal.hxx>

View File

@@ -24,7 +24,6 @@
#include <gp_XYZ.hxx>
#include <Precision.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_NotImplemented.hxx>
#include <TColGeom_Array2OfBezierSurface.hxx>
#include <TColgp_HArray2OfPnt.hxx>

View File

@@ -25,9 +25,7 @@
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColgp_HArray2OfPnt.hxx>
#include <Standard_Boolean.hxx>
#include <TColGeom_Array2OfBezierSurface.hxx>
#include <Standard_Real.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <GeomAbs_Shape.hxx>

View File

@@ -132,7 +132,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
if (SecondCurve->Degree() < Deg) { SecondCurve->IncreaseDegree(Deg); }
// Declarationd
Standard_Real L1, L2, U_de_raccord;
Standard_Real L1, L2;
Standard_Integer ii, jj;
Standard_Real Ratio=1, Ratio1, Ratio2, Delta1, Delta2;
Standard_Integer NbP1 = FirstCurve->NbPoles(), NbP2 = SecondCurve->NbPoles();
@@ -159,7 +159,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
Delta1 = 0;
Ratio2 = 1/Ratio;
Delta2 = Ratio2*SecondCurve->Knot(1) - FirstCurve->Knot(NbK1);
U_de_raccord = FirstCurve->LastParameter();
}
else {
// On ne bouge pas la seconde courbe
@@ -167,12 +166,11 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
Delta1 = Ratio1*FirstCurve->Knot(NbK1) - SecondCurve->Knot(1);
Ratio2 = 1;
Delta2 = 0;
U_de_raccord = SecondCurve->FirstParameter();
}
// Les Noeuds
Standard_Real eps;
for (ii=1; ii<NbK1; ii++) {
for (ii=1; ii<=NbK1; ii++) {
Noeuds(ii) = Ratio1*FirstCurve->Knot(ii) - Delta1;
if(ii > 1) {
eps = Epsilon (Abs(Noeuds(ii-1)));
@@ -183,11 +181,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
}
Mults(ii) = FirstCurve->Multiplicity(ii);
}
Noeuds(NbK1) = U_de_raccord;
eps = Epsilon (Abs(Noeuds(NbK1-1)));
if(Noeuds(NbK1) - Noeuds(NbK1-1) <= eps) {
Noeuds(NbK1) += eps;
}
Mults(NbK1) = FirstCurve->Degree();
for (ii=2, jj=NbK1+1; ii<=NbK2; ii++, jj++) {
Noeuds(jj) = Ratio2*SecondCurve->Knot(ii) - Delta2;

View File

@@ -21,9 +21,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Convert_ParameterisationType.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class Geom_BSplineCurve;
class Geom_BoundedCurve;

View File

@@ -12,8 +12,6 @@
// commercial license or contractual agreement.
#include <GeomConvert_Units.hxx>
#include <Geom2d_BoundedCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2d_Conic.hxx>
#include <Geom2d_Curve.hxx>

View File

@@ -14,7 +14,6 @@
#ifndef _GeomConvert_Units_HeaderFile
#define _GeomConvert_Units_HeaderFile
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class Geom2d_Curve;
class Geom_Surface;

View File

@@ -15,7 +15,6 @@
#ifndef _GeomEvaluator_OffsetCurve_HeaderFile
#define _GeomEvaluator_OffsetCurve_HeaderFile
#include <Geom_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomEvaluator_Curve.hxx>
#include <gp_Dir.hxx>

View File

@@ -16,7 +16,6 @@
#include <GeomFill.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_Curve.hxx>

View File

@@ -21,9 +21,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <TColgp_HArray2OfPnt.hxx>
#include <TColStd_HArray2OfReal.hxx>
#include <TColStd_HArray1OfReal.hxx>

View File

@@ -21,9 +21,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <TColgp_HArray2OfPnt.hxx>
#include <TColStd_HArray2OfReal.hxx>
#include <TColStd_HArray1OfReal.hxx>

View File

@@ -18,12 +18,10 @@
#define _GeomFill_BoundWithSurf_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <GeomFill_Boundary.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class Law_Function;
class gp_Pnt;
class gp_Vec;

View File

@@ -22,7 +22,6 @@
#include <Standard_Real.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Boolean.hxx>
class gp_Pnt;
class gp_Vec;

View File

@@ -21,7 +21,6 @@
#include <GeomFill_CircularBlendFunc.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Type.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_SequenceOfReal.hxx>

View File

@@ -21,10 +21,8 @@
#include <Standard_Type.hxx>
#include <gp_Pnt.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Convert_ParameterisationType.hxx>
#include <Standard_Boolean.hxx>
#include <Approx_SweepFunction.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array1OfPnt2d.hxx>

View File

@@ -24,8 +24,6 @@
#include <gp_Lin.hxx>
#include <gp_Vec.hxx>
#include <Precision.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(GeomFill_ConstantBiNormal,GeomFill_TrihedronLaw)
@@ -66,12 +64,14 @@ GeomFill_ConstantBiNormal::GeomFill_ConstantBiNormal(const gp_Dir& BiNormal) : B
return copy;
}
void GeomFill_ConstantBiNormal::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_ConstantBiNormal::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
Standard_Boolean isOK = Standard_False;
GeomFill_TrihedronLaw::SetCurve(C);
if (! C.IsNull()) {
frenet->SetCurve(C);
if (! C.IsNull()) {
isOK = frenet->SetCurve(C);
}
return isOK;
}
Standard_Boolean GeomFill_ConstantBiNormal::D0(const Standard_Real Param,gp_Vec& Tangent,gp_Vec& Normal,gp_Vec& BiNormal)

View File

@@ -22,8 +22,6 @@
#include <gp_Vec.hxx>
#include <GeomFill_TrihedronLaw.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <GeomAbs_Shape.hxx>
#include <TColStd_Array1OfReal.hxx>
@@ -45,7 +43,9 @@ public:
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! initialize curve of trihedron law
//! @return Standard_True in case if execution end correctly
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! Computes Triedrhon on curve at parameter <Param>
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;

View File

@@ -19,19 +19,16 @@
#include <AdvApprox_ApproxAFunction.hxx>
#include <BSplCLib.hxx>
#include <Geom_BSplineSurface.hxx>
#include <GeomFill_Boundary.hxx>
#include <GeomFill_BoundWithSurf.hxx>
#include <GeomFill_ConstrainedFilling.hxx>
#include <GeomFill_CoonsAlgPatch.hxx>
#include <GeomFill_DegeneratedBound.hxx>
#include <GeomFill_TgtField.hxx>
#include <GeomFill_TgtOnCoons.hxx>
#include <gp_XYZ.hxx>
#include <Law.hxx>
#include <Law_BSpFunc.hxx>
#include <Law_BSpline.hxx>
#include <Law_Linear.hxx>
#include <PLib.hxx>
#include <Standard_Failure.hxx>
#include <Standard_NotImplemented.hxx>
#include <TColgp_Array1OfPnt.hxx>

View File

@@ -22,10 +22,8 @@
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <GeomFill_CornerState.hxx>
#include <gp_Vec.hxx>
#include <Standard_Boolean.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>

View File

@@ -19,7 +19,6 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <GeomFill_Filling.hxx>
#include <TColgp_Array1OfPnt.hxx>

View File

@@ -20,7 +20,6 @@
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <Law_Function.hxx>
#include <Law_Linear.hxx>
#include <Standard_Type.hxx>

View File

@@ -22,7 +22,6 @@
#include <gp_Pnt.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
class GeomFill_Boundary;
class Law_Function;

View File

@@ -27,7 +27,6 @@
#include <GeomFill_SnglrFunc.hxx>
#include <GeomFill_TrihedronLaw.hxx>
#include <GeomLib.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <Law_BSpFunc.hxx>
@@ -37,8 +36,6 @@
#include <Law_Function.hxx>
#include <Law_Interpolate.hxx>
#include <Precision.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Type.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColStd_HArray1OfReal.hxx>
@@ -337,34 +334,36 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
return copy;
}
void GeomFill_CorrectedFrenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_CorrectedFrenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
GeomFill_TrihedronLaw::SetCurve(C);
if (! C.IsNull()) {
if (! C.IsNull())
{
frenet->SetCurve(C);
GeomAbs_CurveType type;
type = C->GetType();
switch (type) {
switch (type)
{
case GeomAbs_Circle:
case GeomAbs_Ellipse:
case GeomAbs_Hyperbola:
case GeomAbs_Parabola:
case GeomAbs_Line:
{
// No probleme isFrenet
isFrenet = Standard_True;
break;
}
default :
{
// We have to search singularities
isFrenet = Standard_True;
Init();
}
{
// No probleme isFrenet
isFrenet = Standard_True;
break;
}
default :
{
// We have to search singularities
isFrenet = Standard_True;
Init();
}
}
}
return isFrenet;
}
@@ -438,16 +437,20 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
TLaw = EvolAroundT;
//OCC78
Standard_Integer iEnd = SeqPoles.Length();
HArrPoles = new TColStd_HArray1OfReal(1, iEnd);
HArrAngle = new TColStd_HArray1OfReal(1, iEnd);
HArrTangent = new TColgp_HArray1OfVec(1, iEnd);
HArrNormal = new TColgp_HArray1OfVec(1, iEnd);
for(i = 1; i <= iEnd; i++){
HArrPoles->ChangeValue(i) = SeqPoles(i);
HArrAngle->ChangeValue(i) = SeqAngle(i);
HArrTangent->ChangeValue(i) = SeqTangent(i);
HArrNormal->ChangeValue(i) = SeqNormal(i);
};
if (iEnd != 0)
{
HArrPoles = new TColStd_HArray1OfReal(1, iEnd);
HArrAngle = new TColStd_HArray1OfReal(1, iEnd);
HArrTangent = new TColgp_HArray1OfVec(1, iEnd);
HArrNormal = new TColgp_HArray1OfVec(1, iEnd);
for (i = 1; i <= iEnd; i++) {
HArrPoles->ChangeValue(i) = SeqPoles(i);
HArrAngle->ChangeValue(i) = SeqAngle(i);
HArrTangent->ChangeValue(i) = SeqTangent(i);
HArrNormal->ChangeValue(i) = SeqNormal(i);
};
}
#ifdef DRAW
if (Affich) {
@@ -612,7 +615,7 @@ Standard_Real GeomFill_CorrectedFrenet::CalcAngleAT(const gp_Vec& Tangent, const
Standard_Real angle;
gp_Vec Normal_rot, cross;
angle = Tangent.Angle(prevTangent);
if (Abs(angle) > Precision::Angular()) {
if (Abs(angle) > Precision::Angular() && Abs(angle) < M_PI - Precision::Angular()) {
cross = Tangent.Crossed(prevTangent).Normalized();
Normal_rot = Normal + sin(angle)*cross.Crossed(Normal) +
(1 - cos(angle))*cross.Crossed(cross.Crossed(Normal));

View File

@@ -18,10 +18,7 @@
#define _GeomFill_CorrectedFrenet_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <gp_Vec.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColgp_HArray1OfVec.hxx>
#include <GeomFill_TrihedronLaw.hxx>
@@ -52,7 +49,9 @@ public:
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! initialize curve of frenet law
//! @return Standard_True in case if execution end correctly
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;

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