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

Compare commits

..

38 Commits

Author SHA1 Message Date
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
vro
acce2c1448 0032796: Modeling Data - Calculation of distance between two circles crashes
Modified:
- Extrema_ExtCC.cxx, the method PrepareParallelResult() - angular tolerance is increased.

Added:
- A test: lowalgos extcc bug32796
2022-03-05 17:33:56 +03:00
kgv
633084b809 0032862: Visualization, Graphic3d_TextureMap - add 3D texture definition
Image_PixMap has been extended to support definition of 3D bitmap (as an array of 2D slices).

Graphic3d_TypeOfTexture enumeration values have been renamed to include full enum prefix.
Added Graphic3d_TypeOfTexture_3D redirecting to GL_TEXTURE_3D.
OpenGl_Texture::Init() has been extended to allow initialization of 3D texture.

Graphic3d_Texture2Dmanual merged into Graphic3d_Texture2D and marked as deprecated alias.
Graphic3d_TOT_2D_MIPMAP has been deprecated in favor of dedicated Graphic3d_TextureRoot::SetMipMaps().

Added Graphic3d_Texture3D class.
vtexture - added argument -3d for uploading 3D texture.
2022-03-05 17:31:39 +03:00
kgv
a9e5f65041 0032837: Documentation, Geom_Surface - add references to GeomLib::NormEstim() for Normal computations
References to GeomLib::NormEstim() have been put to Geom_Surface, Adaptor3d_Surface and BRepAdaptor_Surface.
Improved documentation of GeomLib::NormEstim().
2022-03-03 20:09:35 +03:00
kgv
b9a372bbcd 0032841: Visualization - add 16-bit grayscale pixel format to Image_PixMap
Added Image_Format_Gray16 pixel format definition, which could be uploaded into GL_R16 texture.
Added Image_Format_GrayF_half mapped to GL_R16F texture.
2022-03-03 20:07:53 +03:00
kgv
b5204c6c37 0032860: Coding Rules, Extrema_GenExtPS - add exported destructor
Added eplicit destructors to classes Extrema_GenExtCS, Extrema_GenExtPS and Extrema_GenExtSS.
2022-03-03 20:06:50 +03:00
kgv
75e2ba1695 0032856: Configuration, CMake - SONAME should include minor version in addition to major to reflect ABI compatibility
Added option BUILD_SOVERSION_NUMBERS to manage SOVERSION length.
Default option value is set to 2 (major.minor) instead of previously used 1 (major),
excluding Android/Emscripten/Windows platforms that use 0 by default.
2022-03-01 19:22:48 +03:00
ifv
5c48956f8e 0032849: Modeling Algorithms - Intersection algorithm returns incomplete result.
GeomInt/GeomInt_IntSS.cxx, IntTools/IntTools_FaceFace.cxx - setting deflection 0.01
for case of two bspline surfaces
IntPolyh/IntPolyh_Intersection.cxx, IntPolyh/IntPolyh_Intersection.hxx - status IsParallel is added

BndLib/BndLib_Add3dCurve.cxx, IntTools/IntTools_TopolTool.cxx - fix small bugs

Correction of test scripts according to current behavior of algorithms

lowalgos/intss/bug32849 - test case added
2022-03-01 18:57:09 +03:00
kgv
b9184c2714 0032834: Configuration, CMake - DESTDIR ignored for OpenCASCADECompileDefinitionsAndFlags-${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake
Replace redundant configure_file() with normal file copy for installing OpenCASCADECompileDefinitionsAndFlags- files.
2022-02-26 21:52:21 +03:00
kgv
e61aa824db 0032854: Documentation - minor clean-up of User Guide for XDE module
Applied minor formatting improvements to `xde.md`.
Fixed small misprints and artifacts in text.
Removed redundant section "Working with XDE".
2022-02-25 18:10:52 +03:00
vro
5a846a5d2c 0029219: Application Framework - XML document is written with CRLF on Windows
The last symbol of a line is synchronized with external products.
Also, XML ends by LF now.

Modified:
XML: XmlLDrivers_DocumentStorageDriver::Write() ends by LF
BREP: BRepTools::Write(), Draw_VariableCommands::save() ends by LF
STEP: StepSelect_WorkLibrary::WriteFile() ends by LF
IGES: IGESSelect_WorkLibrary::WriteFile(), IGESControl_Writer::Write(), XSDRAWIGES::WriteShape() ends by LF
VRML: VrmlAPI_Writer::write_v2() ends by LF

0029219: Application Framework - XML document is written with CRLF on Windows

The last symbol of a line is synchronized with external products.
Also, XML ends by LF now.

Modified:
XML: XmlLDrivers_DocumentStorageDriver::Write() ends by LF
BREP: BRepTools::Write(), Draw_VariableCommands::save() ends by LF
STEP: StepSelect_WorkLibrary::WriteFile() ends by LF
IGES: IGESSelect_WorkLibrary::WriteFile(), IGESControl_Writer::Write(), XSDRAWIGES::WriteShape() ends by LF
VRML: VrmlAPI_Writer::write_v2() ends by LF
STL: RWStl::WriteAscii() ends by CR LF (to synchronize with Blender)

0029219: Application Framework - XML document is written with CRLF on Windows

The last symbol of a line is synchronized with external products.
Also, XML ends by LF now.

Modified:
XML: XmlLDrivers_DocumentStorageDriver::Write() ends by LF
BREP: BRepTools::Write(), Draw_VariableCommands::save() ends by LF
STEP: StepSelect_WorkLibrary::WriteFile() ends by LF
IGES: IGESSelect_WorkLibrary::WriteFile(), IGESControl_Writer::Write(), XSDRAWIGES::WriteShape() ends by LF
VRML: VrmlAPI_Writer::write_v2() ends by LF
2022-02-22 20:25:47 +03:00
vro
b91e601442 0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux
The code is simplified - it checks the last character and if it is a folder separator, it removes it.

Modified file:
- CDF_Store.cxx, the method SetFolder().

0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux

The code is simplified - it checks the last character and if it is a folder separator, it removes it.

Modified file:
- CDF_Store.cxx, the method SetFolder().

0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux

The code is simplified - it checks the last character and if it is a folder separator, it removes it.
// Also, variable 'l' is renamed to 'aLen'.
// And a check on the number of characters is added to avoid removal of the root folder ('/').

Modified file:
- CDF_Store.cxx, the method SetFolder().
2022-02-22 20:23:29 +03:00
knosulko
cfde7eebb3 0024418: Modeling Algorithms - Wrong section curves when intersecting analytical surfaces
IntPatch_ALineToWLine.cxx - setting minimal number of points in a WLine depending on step size
IntPatch_WLineTool.cxx - fix WLines connecting check condition
test cases has been changed according to new behavior
2022-02-22 20:07:12 +03:00
304 changed files with 7951 additions and 5635 deletions

View File

@@ -56,6 +56,20 @@ set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
# set soversion variable determining compatibility version on platforms with symlinks
# 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
if (NOT BUILD_SOVERSION_NUMBERS)
set (BUILD_SOVERSION_NUMBERS "0" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
SET_PROPERTY(CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
# update default state of soversion on different platforms
if (WIN32 OR ANDROID OR EMSCRIPTEN)
set (BUILD_SOVERSION_NUMBERS 0)
else()
set (BUILD_SOVERSION_NUMBERS 2)
endif()
endif()
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
# Regeneration of OCCT resource files
@@ -1225,7 +1239,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
endforeach()
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
install (CODE "file(INSTALL FILES \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" DESTINATION \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/\" TYPE FILE)")
foreach (OCCT_MODULE ${OCCT_MODULES})
if (BUILD_MODULE_${OCCT_MODULE})

View File

@@ -280,14 +280,17 @@ get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
if (ANDROID)
# do not append version to the filename
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
else()
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
SOVERSION "${OCC_VERSION_MAJOR}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
set (OCC_SOVERSION "")
if (BUILD_SOVERSION_NUMBERS GREATER 2)
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
elseif (BUILD_SOVERSION_NUMBERS GREATER 1)
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}")
elseif (BUILD_SOVERSION_NUMBERS GREATER 0)
set (OCC_SOVERSION "${OCC_VERSION_MAJOR}")
endif()
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
SOVERSION "${OCC_SOVERSION}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
set (USED_TOOLKITS_BY_CURRENT_PROJECT)
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)

View File

@@ -28,6 +28,9 @@ Applies only for Debug configuration.")
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
"Append the postfix to names of output libraries")
set (BUILD_SOVERSION_NUMBERS_DESCR
"Version numbers to put into SONAME: 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
"Disables exceptions like Standard_OutOfRange in Release builds.
Defines No_Exception macros for Release builds when enabled (default).

View File

@@ -132,21 +132,31 @@ for (aPackage, aPackages) {
}
}
# extend clean with versioned .so files
!win32 {
aVerList = $$split(VERSION, ".")
aVerMaj = $$member(aVerList, 0)
aVerMin = $$member(aVerList, 1)
aVerMic = $$member(aVerList, 2)
equals(TEMPLATE, app) {
QMAKE_CLEAN += $$DESTDIR/$${TARGET}
} else {
mac {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.dylib.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .dylib files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
} else {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .so files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}

File diff suppressed because it is too large Load Diff

View File

@@ -26,9 +26,7 @@
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_Texture1D.hxx>
#include <Graphic3d_Texture1Dsegment.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Graphic3d_Texture2D.hxx>
#include <Image_AlienPixMap.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <TopoDS_Edge.hxx>
@@ -81,7 +79,7 @@ void Sample2D_Image::SetContext (const Handle(AIS_InteractiveContext)& theContex
this->Set(TopoDS_Shape(myFace));
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
Handle(Graphic3d_Texture2Dmanual) aTexture = new Graphic3d_Texture2Dmanual(myFilename);
Handle(Graphic3d_Texture2D) aTexture = new Graphic3d_Texture2D (myFilename);
aTexture->DisableModulate();
myDrawer->ShadingAspect()->Aspect()->SetTextureMap (aTexture);
myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn();

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

@@ -22,7 +22,7 @@
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Graphic3d_Texture2D.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <Prs3d_Drawer.hxx>
@@ -278,17 +278,17 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
TCollection_AsciiString aTextureDesc;
if (!myTexturePixMap.IsNull())
{
myTexture = new Graphic3d_Texture2Dmanual (myTexturePixMap);
myTexture = new Graphic3d_Texture2D (myTexturePixMap);
aTextureDesc = " (custom image)";
}
else if (myPredefTexture != Graphic3d_NOT_2D_UNKNOWN)
{
myTexture = new Graphic3d_Texture2Dmanual (myPredefTexture);
myTexture = new Graphic3d_Texture2D (myPredefTexture);
aTextureDesc = TCollection_AsciiString(" (predefined texture ") + myTexture->GetId() + ")";
}
else
{
myTexture = new Graphic3d_Texture2Dmanual (myTextureFile.ToCString());
myTexture = new Graphic3d_Texture2D (myTextureFile.ToCString());
aTextureDesc = TCollection_AsciiString(" (") + myTextureFile + ")";
}

View File

@@ -26,7 +26,7 @@
#include <PrsMgr_PresentationManager.hxx>
class Graphic3d_AspectFillArea3d;
class Graphic3d_Texture2Dmanual;
class Graphic3d_Texture2D;
//! This class allows to map textures on shapes.
//! Presentations modes AIS_WireFrame (0) and AIS_Shaded (1) behave in the same manner as in AIS_Shape,
@@ -184,7 +184,7 @@ protected: //! @name overridden methods
protected: //! @name presentation fields
Handle(Graphic3d_Texture2Dmanual) myTexture;
Handle(Graphic3d_Texture2D) myTexture;
Handle(Graphic3d_AspectFillArea3d) myAspect;
protected: //! @name texture source fields

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),
@@ -133,6 +134,8 @@ AIS_ViewController::AIS_ViewController()
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
myMouseGestureMapDrag.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Drag);
myXRTeleportHaptic.Duration = 3600.0f;
myXRTeleportHaptic.Frequency = 0.1f;
myXRTeleportHaptic.Amplitude = 0.2f;
@@ -261,12 +264,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 +363,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 +371,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 +794,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 +814,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;
}
}
}
}
@@ -932,6 +966,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;
@@ -991,6 +1027,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;
@@ -2913,8 +2974,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;

View File

@@ -757,6 +757,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 +778,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

@@ -23,14 +23,14 @@
#include <SelectMgr_EntityOwner.hxx>
//! Texture holder.
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2Dmanual
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2D
{
public:
//! Constructor.
XRTexture (const Handle(Image_Texture)& theImageSource,
const Graphic3d_TextureUnit theUnit = Graphic3d_TextureUnit_BaseColor)
: Graphic3d_Texture2Dmanual (""), myImageSource (theImageSource)
: Graphic3d_Texture2D (""), myImageSource (theImageSource)
{
if (!theImageSource->TextureId().IsEmpty())
{

View File

@@ -114,19 +114,20 @@ public:
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
Standard_EXPORT virtual Standard_Real VPeriod() const;
//! Computes the point of parameters U,V on the surface.
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
//! Computes the point of parameters U,V on the surface.
Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const;
//! Computes the point and the first derivatives on
//! the surface.
//! Raised if the continuity of the current
//! intervals is not C1.
//! Computes the point and the first derivatives on the surface.
//! Raised if the continuity of the current intervals is not C1.
//!
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
//! Computes the point, the first and second
//! derivatives on the surface.
//! Raised if the continuity of the current

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

@@ -141,17 +141,18 @@ public:
virtual Standard_Real VPeriod() const Standard_OVERRIDE { return mySurf.VPeriod(); }
//! Computes the point of parameters U,V on the surface.
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const Standard_OVERRIDE;
//! Computes the point of parameters U,V on the surface.
Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
//! Computes the point and the first derivatives on
//! the surface.
//! Raised if the continuity of the current
//! intervals is not C1.
//! Computes the point and the first derivatives on the surface.
//! Raised if the continuity of the current intervals is not C1.
//!
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
//! Computes the point, the first and second
//! derivatives on the surface.
//! Raised if the continuity of the current

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

@@ -370,18 +370,6 @@ Standard_Boolean BRepToIGES_BREntity::GetPCurveMode () const
{
return myPCurveMode;
}
void BRepToIGES_BREntity::SetConvertSurfaceMode(const Standard_Boolean theVal)
{
Interface_Static::SetIVal("write.convertsurface.mode", theVal);
myConvSurface = theVal;
}
Standard_EXPORT void BRepToIGES_BREntity::SetPCurveMode(const Standard_Boolean theVal)
{
Interface_Static::SetIVal("write.surfacecurve.mode", theVal);
myPCurveMode = theVal;
}
//=======================================================================
//function : ~BRepToIGES_BREntity

View File

@@ -109,24 +109,15 @@ public:
//! Returns mode for writing pcurves
//! (value of parameter write.surfacecurve.mode)
Standard_EXPORT Standard_Boolean GetPCurveMode() const;
Standard_EXPORT void SetConvertSurfaceMode(const Standard_Boolean theVal);
Standard_EXPORT void SetPCurveMode(const Standard_Boolean theVal);
Standard_EXPORT virtual ~BRepToIGES_BREntity();
protected:
Standard_Boolean myConvSurface;
Standard_Boolean myPCurveMode;
private:
Handle(IGESData_IGESModel) TheModel;
Standard_Real TheUnitFactor;
Standard_Boolean myConvSurface;
Standard_Boolean myPCurveMode;
Handle(Transfer_FinderProcess) TheMap;
};
#endif // _BRepToIGES_BREntity_HeaderFile

View File

@@ -494,7 +494,7 @@ Handle(IGESSolid_Face) BRepToIGESBRep_Entity ::TransferFace(const TopoDS_Face& s
GeomToIGES_GeomSurface GS;
//S4181 pdn 17.04.99 Boolean flags in order to define write of elementary surfaces added.
GS.SetBRepMode(Standard_True);
GS.SetAnalyticMode (myConvSurface == 0 );
GS.SetAnalyticMode ( Interface_Static::IVal("write.convertsurface.mode") ==0 );
GS.SetModel(GetModel());
Handle(Geom_Surface) st;

View File

@@ -140,6 +140,7 @@ private:
Handle(IGESSolid_EdgeList) myEdgeList;
Handle(IGESSolid_VertexList) myVertexList;
};

View File

@@ -695,7 +695,7 @@ Standard_Boolean BRepTools::Write (const TopoDS_Shape& theShape,
const Message_ProgressRange& theProgress)
{
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out);
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
if (aStream.get() == NULL || !aStream->good())
{
return Standard_False;

View File

@@ -217,7 +217,7 @@ void BndLib_Add3dCurve::Add( const Adaptor3d_Curve& C,
if(Bsaux->LastParameter() < U2 ) u2 = Bsaux->LastParameter();
// modified by NIZHNY-EAP Fri Dec 3 14:29:18 1999 ___END___
}
Standard_Real aSegmentTol = Precision::PConfusion();
Standard_Real aSegmentTol = 2. * Precision::PConfusion();
if (Abs(u2 - u1) < aSegmentTol)
aSegmentTol = Abs(u2 - u1) * 0.01;
Bsaux->Segment(u1, u2, aSegmentTol);

View File

@@ -78,19 +78,11 @@ Standard_Boolean CDF_Store::SetFolder(const Standard_ExtString aFolder) {
Standard_Boolean CDF_Store::SetFolder(const TCollection_ExtendedString& aFolder) {
TCollection_ExtendedString theFolder(aFolder);
Standard_Integer l = theFolder.Length();
Standard_Integer aLen = theFolder.Length();
// if the last character is the folder separator (which is always the first character)
// it is removed.
// This is correct for Unix systems but not for Windows! VMS and MAC? Thomas Haller, 23.11.01
if(l > 1) {
#ifndef _WIN32
if(theFolder.Value(l) == theFolder.Value(1)) theFolder.Trunc(l-1);
#else
if (theFolder.Value(l) == '/' || theFolder.Value(l) == '\\')
theFolder.Trunc(l-1);
#endif
}
// if the last character is the folder separator, remove it.
if (aLen > 1 && (theFolder.Value(aLen) == '/' || theFolder.Value(aLen) == '\\'))
theFolder.Trunc(aLen-1);
if(theMetaDataDriver->FindFolder(theFolder)) {
myCurrentDocument->SetRequestedFolder(theFolder);

View File

@@ -195,7 +195,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theCtx, myDepthFormat);
if (aDepthFormat.IsValid()
&& !myDepthStencilTexture->Init (theCtx, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
&& !myDepthStencilTexture->Init (theCtx, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TypeOfTexture_2D))
{
Release (theCtx.get());
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,

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

@@ -92,7 +92,7 @@ static Standard_Integer save (Draw_Interpretor& theDI,
const char* aName = theArgVec[2];
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (aName, std::ios::out);
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (aName, std::ios::out | std::ios::binary);
aStream->precision (15);
if (aStream.get() == NULL || !aStream->good())
{

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.
@@ -663,7 +666,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
// myIsParallel = TRUE and only the least distance will be returned.
//4. Arcs are not parallel. Then several (or single) extremas will be returned.
if (aRng.Delta() > Precision::Angular())
if (aRng.Delta() > Precision::Confusion())
{
Standard_Real aPar = 0.0;
aRng.GetIntermediatePoint(0.5, aPar);
@@ -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);
@@ -703,7 +706,6 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
break;
}
}
//Nearer solution can be found
}
else if (!aRng.IsVoid())
@@ -779,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

@@ -120,6 +120,15 @@ Extrema_GenExtCS::Extrema_GenExtCS()
{
}
// =======================================================================
// function : ~Extrema_GenExtCS
// purpose :
// =======================================================================
Extrema_GenExtCS::~Extrema_GenExtCS()
{
//
}
//=======================================================================
//function : Extrema_GenExtCS
//purpose :

View File

@@ -35,9 +35,12 @@ public:
DEFINE_STANDARD_ALLOC
//! Empty constructor.
Standard_EXPORT Extrema_GenExtCS();
//! Destructor.
Standard_EXPORT ~Extrema_GenExtCS();
//! It calculates all the distances.
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
//! extremum when gradient(F)=0. The algorithm searches

View File

@@ -224,7 +224,19 @@ Extrema_GenExtPS::Extrema_GenExtPS()
myAlgo = Extrema_ExtAlgo_Grad;
}
// =======================================================================
// function : ~Extrema_GenExtPS
// purpose :
// =======================================================================
Extrema_GenExtPS::~Extrema_GenExtPS()
{
//
}
// =======================================================================
// function : Extrema_GenExtPS
// purpose :
// =======================================================================
Extrema_GenExtPS::Extrema_GenExtPS (const gp_Pnt& P,
const Adaptor3d_Surface& S,
const Standard_Integer NbU,

View File

@@ -37,8 +37,12 @@ public:
DEFINE_STANDARD_ALLOC
//! Empty constructor.
Standard_EXPORT Extrema_GenExtPS();
//! Destructor.
Standard_EXPORT ~Extrema_GenExtPS();
//! It calculates all the distances.
//! The function F(u,v)=distance(P,S(u,v)) has an
//! extremum when gradient(F)=0. The algorithm searches

View File

@@ -118,6 +118,15 @@ Extrema_GenExtSS::Extrema_GenExtSS()
myInit = Standard_False;
}
// =======================================================================
// function : ~Extrema_GenExtSS
// purpose :
// =======================================================================
Extrema_GenExtSS::~Extrema_GenExtSS()
{
//
}
//=======================================================================
//function : Extrema_GenExtSS
//purpose :

View File

@@ -36,9 +36,12 @@ public:
DEFINE_STANDARD_ALLOC
//! Empty constructor.
Standard_EXPORT Extrema_GenExtSS();
//! Destructor.
Standard_EXPORT ~Extrema_GenExtSS();
//! It calculates all the distances.
//! The function F(u,v)=distance(S1(u1,v1),S2(u2,v2)) has an
//! extremum when gradient(F)=0. The algorithm searches

View File

@@ -27,29 +27,24 @@ class gp_Vec;
class Geom_Surface;
DEFINE_STANDARD_HANDLE(Geom_Surface, Geom_Geometry)
//! Describes the common behavior of surfaces in 3D
//! space. The Geom package provides many
//! implementations of concrete derived surfaces, such as
//! planes, cylinders, cones, spheres and tori, surfaces of
//! linear extrusion, surfaces of revolution, Bezier and
//! BSpline surfaces, and so on.
//! The key characteristic of these surfaces is that they
//! are parameterized. Geom_Surface demonstrates:
//! - how to work with the parametric equation of a
//! surface to compute the point of parameters (u,
//! v), and, at this point, the 1st, 2nd ... Nth derivative,
//! Describes the common behavior of surfaces in 3D space.
//! The Geom package provides many implementations of concrete derived surfaces,
//! such as planes, cylinders, cones, spheres and tori, surfaces of linear extrusion,
//! surfaces of revolution, Bezier and BSpline surfaces, and so on.
//! The key characteristic of these surfaces is that they are parameterized.
//! Geom_Surface demonstrates:
//! - how to work with the parametric equation of a surface
//! to compute the point of parameters (u, v), and, at this point, the 1st, 2nd ... Nth derivative;
//! - how to find global information about a surface in
//! each parametric direction (for example, level of
//! continuity, whether the surface is closed, its
//! periodicity, the bounds of the parameters and so on), and
//! - how the parameters change when geometric
//! transformations are applied to the surface, or the
//! orientation is modified.
//! Note that all surfaces must have a geometric
//! continuity, and any surface is at least "C0". Generally,
//! continuity is checked at construction time or when the
//! curve is edited. Where this is not the case, the
//! documentation makes this explicit.
//! each parametric direction (for example, level of continuity, whether the surface is closed,
//! its periodicity, the bounds of the parameters and so on);
//! - how the parameters change when geometric transformations are applied to the surface,
//! or the orientation is modified.
//!
//! Note that all surfaces must have a geometric continuity, and any surface is at least "C0".
//! Generally, continuity is checked at construction time or when the curve is edited.
//! Where this is not the case, the documentation makes this explicit.
//!
//! Warning
//! The Geom package does not prevent the construction of
//! surfaces with null areas, or surfaces which self-intersect.
@@ -142,47 +137,42 @@ public:
//! equal to Precision::Infinite: instead of Standard_Real::LastReal.
Standard_EXPORT virtual void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const = 0;
//! Checks whether this surface is closed in the u
//! parametric direction.
//! Returns true if, in the u parametric direction: taking
//! uFirst and uLast as the parametric bounds in
//! the u parametric direction, for each parameter v, the
//! distance between the points P(uFirst, v) and
//! Checks whether this surface is closed in the u parametric direction.
//! Returns true if, in the u parametric direction:
//! taking uFirst and uLast as the parametric bounds in
//! the u parametric direction, for each parameter v,
//! the distance between the points P(uFirst, v) and
//! P(uLast, v) is less than or equal to gp::Resolution().
Standard_EXPORT virtual Standard_Boolean IsUClosed() const = 0;
//! Checks whether this surface is closed in the u
//! parametric direction.
//! Returns true if, in the v parametric
//! direction: taking vFirst and vLast as the
//! parametric bounds in the v parametric direction, for
//! each parameter u, the distance between the points
//! P(u, vFirst) and P(u, vLast) is less than
//! or equal to gp::Resolution().
//! Checks whether this surface is closed in the u parametric direction.
//! Returns true if, in the v parametric direction:
//! taking vFirst and vLast as the parametric bounds in the v parametric direction,
//! for each parameter u, the distance between the points
//! P(u, vFirst) and P(u, vLast) is less than or equal to gp::Resolution().
Standard_EXPORT virtual Standard_Boolean IsVClosed() const = 0;
//! Checks if this surface is periodic in the u
//! parametric direction. Returns true if:
//! Checks if this surface is periodic in the u parametric direction.
//! Returns true if:
//! - this surface is closed in the u parametric direction, and
//! - there is a constant T such that the distance
//! between the points P (u, v) and P (u + T,
//! v) (or the points P (u, v) and P (u, v +
//! T)) is less than or equal to gp::Resolution().
//! between the points P (u, v) and P (u + T, v)
//! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution().
//!
//! Note: T is the parametric period in the u parametric direction.
Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const = 0;
//! Returns the period of this surface in the u
//! parametric direction.
//! raises if the surface is not uperiodic.
//! Returns the period of this surface in the u parametric direction.
//! Raises if the surface is not uperiodic.
Standard_EXPORT virtual Standard_Real UPeriod() const;
//! Checks if this surface is periodic in the v
//! parametric direction. Returns true if:
//! Checks if this surface is periodic in the v parametric direction.
//! Returns true if:
//! - this surface is closed in the v parametric direction, and
//! - there is a constant T such that the distance
//! between the points P (u, v) and P (u + T,
//! v) (or the points P (u, v) and P (u, v +
//! T)) is less than or equal to gp::Resolution().
//! between the points P (u, v) and P (u + T, v)
//! (or the points P (u, v) and P (u, v + T)) is less than or equal to gp::Resolution().
//!
//! Note: T is the parametric period in the v parametric direction.
Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const = 0;
@@ -197,25 +187,24 @@ public:
Standard_EXPORT virtual Handle(Geom_Curve) VIso (const Standard_Real V) const = 0;
//! Returns the Global Continuity of the surface in direction U and V :
//! C0 : only geometric continuity,
//! C1 : continuity of the first derivative all along the surface,
//! C2 : continuity of the second derivative all along the surface,
//! C3 : continuity of the third derivative all along the surface,
//! G1 : tangency continuity all along the surface,
//! G2 : curvature continuity all along the surface,
//! CN : the order of continuity is infinite.
//! Example :
//! - C0: only geometric continuity,
//! - C1: continuity of the first derivative all along the surface,
//! - C2: continuity of the second derivative all along the surface,
//! - C3: continuity of the third derivative all along the surface,
//! - G1: tangency continuity all along the surface,
//! - G2: curvature continuity all along the surface,
//! - CN: the order of continuity is infinite.
//!
//! Example:
//! If the surface is C1 in the V parametric direction and C2
//! in the U parametric direction Shape = C1.
Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0;
//! Returns the order of continuity of the surface in the
//! U parametric direction.
//! Returns the order of continuity of the surface in the U parametric direction.
//! Raised if N < 0.
Standard_EXPORT virtual Standard_Boolean IsCNu (const Standard_Integer N) const = 0;
//! Returns the order of continuity of the surface in the
//! V parametric direction.
//! Returns the order of continuity of the surface in the V parametric direction.
//! Raised if N < 0.
Standard_EXPORT virtual Standard_Boolean IsCNv (const Standard_Integer N) const = 0;
@@ -226,9 +215,10 @@ public:
Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const = 0;
//! Computes the point P and the first derivatives in the
//! directions U and V at this point.
//! Computes the point P and the first derivatives in the directions U and V at this point.
//! Raised if the continuity of the surface is not C1.
//!
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const = 0;
//! Computes the point P, the first and the second derivatives in
@@ -241,21 +231,18 @@ public:
//! Raised if the continuity of the surface is not C2.
Standard_EXPORT virtual void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const = 0;
//! ---Purpose ;
//! Computes the derivative of order Nu in the direction U and Nv
//! in the direction V at the point P(U, V).
//! Computes the derivative of order Nu in the direction U and Nv in the direction V at the point P(U, V).
//!
//! Raised if the continuity of the surface is not CNu in the U
//! direction or not CNv in the V direction.
//! Raised if the continuity of the surface is not CNu in the U direction or not CNv in the V direction.
//! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const = 0;
//! Computes the point of parameter U on the surface.
//! Computes the point of parameter (U, V) on the surface.
//!
//! It is implemented with D0
//! It is implemented with D0.
//! Tip: use GeomLib::NormEstim() to calculate surface normal at specified (U, V) point.
//!
//! Raised only for an "OffsetSurface" if it is not possible to
//! compute the current point.
//! Raised only for an "OffsetSurface" if it is not possible to compute the current point.
Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
//! Dumps the content of me into the stream

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

@@ -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

@@ -66,12 +66,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

@@ -45,7 +45,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

@@ -337,34 +337,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 +440,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 +618,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

@@ -52,7 +52,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;

View File

@@ -63,11 +63,11 @@ Handle(GeomFill_LocationLaw) GeomFill_CurveAndTrihedron::Copy() const
//Function: SetCurve
//Purpose :
//==================================================================
void GeomFill_CurveAndTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_CurveAndTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
myCurve = C;
myTrimmed = C;
myLaw->SetCurve(C);
return myLaw->SetCurve(C);
}
const Handle(Adaptor3d_Curve)& GeomFill_CurveAndTrihedron::GetCurve() const

View File

@@ -52,7 +52,9 @@ public:
Standard_EXPORT GeomFill_CurveAndTrihedron(const Handle(GeomFill_TrihedronLaw)& Trihedron);
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;
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;

View File

@@ -61,33 +61,36 @@ Handle(GeomFill_TrihedronLaw) GeomFill_DiscreteTrihedron::Copy() const
//purpose :
//=======================================================================
void GeomFill_DiscreteTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_DiscreteTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
GeomFill_TrihedronLaw::SetCurve(C);
if (! C.IsNull()) {
if (! C.IsNull())
{
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 problem
myUseFrenet = Standard_True;
myFrenet->SetCurve(C);
break;
}
{
// No problem
myUseFrenet = Standard_True;
myFrenet->SetCurve(C);
break;
}
default :
{
myUseFrenet = Standard_False;
// We have to fill <myKnots> and <myTrihedrons>
Init();
break;
}
{
myUseFrenet = Standard_False;
// We have to fill <myKnots> and <myTrihedrons>
Init();
break;
}
}
}
return myUseFrenet;
}
//=======================================================================

View File

@@ -51,7 +51,9 @@ public:
Standard_EXPORT void Init();
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;
//! compute Trihedron 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

@@ -117,7 +117,7 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
//purpose :
//=======================================================================
void GeomFill_Frenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_Frenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
GeomFill_TrihedronLaw::SetCurve(C);
if (! C.IsNull()) {
@@ -141,6 +141,7 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
}
}
}
return Standard_True;
}
//=======================================================================

View File

@@ -47,7 +47,9 @@ public:
Standard_EXPORT void Init();
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! initialize curve of frenet law
//! @return Standard_True
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! compute 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

@@ -292,7 +292,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curv
//function : SetCurve
//purpose :
//=======================================================================
void GeomFill_GuideTrihedronAC::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_GuideTrihedronAC::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
myCurve = C;
myTrimmed = C;
@@ -301,6 +301,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curv
L = myCurveAC->GetLength();
// CorrectOrient(myGuide);
}
return Standard_True;
}

View File

@@ -44,7 +44,9 @@ public:
Standard_EXPORT GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curve)& guide);
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! initialize curve of trihedron law
//! @return Standard_True
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;

View File

@@ -197,10 +197,11 @@ GeomFill_GuideTrihedronPlan::GeomFill_GuideTrihedronPlan (const Handle(Adaptor3d
//function : SetCurve
//purpose : calculation of trihedron
//=======================================================================
void GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
myCurve = C;
if (!myCurve.IsNull()) Init();
return Standard_True;
}
//=======================================================================

View File

@@ -48,7 +48,9 @@ public:
Standard_EXPORT GeomFill_GuideTrihedronPlan(const Handle(Adaptor3d_Curve)& theGuide);
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& thePath) 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)& thePath) Standard_OVERRIDE;
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;

View File

@@ -105,13 +105,14 @@ GeomFill_LocationDraft::GeomFill_LocationDraft
//Purpose : Calcul des poles sur la surfaces d'arret (intersection
// entre la generatrice et la surface en myNbPts points de la section)
//==================================================================
void GeomFill_LocationDraft::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_LocationDraft::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
myCurve = C;
myTrimmed = C;
myLaw->SetCurve(C);
Standard_Boolean isOK = myLaw->SetCurve(C);
Prepare();
return isOK;
}
//==================================================================

View File

@@ -46,7 +46,9 @@ public:
Standard_EXPORT void SetAngle (const Standard_Real Angle);
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! calculation of poles on locking surfaces (the intersection between the generatrixand the surface at the cross - section points myNbPts)
//! @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 const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;

View File

@@ -537,7 +537,7 @@ static void InGoodPeriod(const Standard_Real Prec,
//Purpose : Calcul des poles sur la surface d'arret (intersection
// courbe guide / surface de revolution en myNbPts points)
//==================================================================
void GeomFill_LocationGuide::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_LocationGuide::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
Standard_Real LastAngle;
myCurve = C;
@@ -550,6 +550,7 @@ static void InGoodPeriod(const Standard_Real Prec,
if (rotation) SetRotation(myPoles2d->Value(1,1).X(), LastAngle);
}
return myStatus == GeomFill_PipeOk;
}
//==================================================================

View File

@@ -56,7 +56,9 @@ public:
Standard_EXPORT void EraseRotation();
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
//! calculating poles on a surface (courbe guide / the surface of rotation in points myNbPts)
//! @return Standard_True
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;

View File

@@ -38,9 +38,8 @@ class GeomFill_LocationLaw : public Standard_Transient
{
public:
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) = 0;
//! initialize curve of location law
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) = 0;
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const = 0;

View File

@@ -205,7 +205,7 @@ static Standard_Boolean CheckSense(const TColGeom_SequenceOfCurve& Seq1,
//purpose : constructor with no parameters.
//=======================================================================
GeomFill_Pipe::GeomFill_Pipe() : myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
GeomFill_Pipe::GeomFill_Pipe() : myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
}
@@ -218,7 +218,7 @@ GeomFill_Pipe::GeomFill_Pipe() : myIsDone(Standard_False),myExchUV(Standard_Fals
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
const Standard_Real Radius)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
Init(Path, Radius);
@@ -232,7 +232,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
const Handle(Geom_Curve)& FirstSect,
const GeomFill_Trihedron Option)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
Init(Path, FirstSect, Option);
@@ -246,7 +246,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom2d_Curve)& Path,
const Handle(Geom_Surface)& Support,
const Handle(Geom_Curve)& FirstSect)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
Init(Path, Support, FirstSect);
@@ -260,7 +260,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom2d_Curve)& Path,
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
const Handle(Geom_Curve)& FirstSect,
const Handle(Geom_Curve)& LastSect)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
Init(Path, FirstSect, LastSect);
@@ -274,7 +274,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
const TColGeom_SequenceOfCurve& NSections)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
Init(Path, NSections);
@@ -288,7 +288,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
const Handle(Geom_Curve)& Curve1,
const gp_Dir& Direction)
: myIsDone(Standard_False),myExchUV(Standard_False), myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False), myKPart(Standard_False)
{
Init(Path, Curve1, Direction);
}
@@ -301,7 +301,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
const Handle(Geom_Curve)& Curve1,
const Handle(Geom_Curve)& Curve2,
const Standard_Real Radius)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
Handle(GeomAdaptor_Curve) AdpPath =
@@ -324,7 +324,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Adaptor3d_Curve)& Path,
const Handle(Adaptor3d_Curve)& Curve1,
const Handle(Adaptor3d_Curve)& Curve2,
const Standard_Real Radius)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
{
Init();
Init(Path,Curve1,Curve2,Radius);
@@ -344,7 +344,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
const Handle(Geom_Curve)& FirstSect,
const Standard_Boolean byACR,
const Standard_Boolean rotat)
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
// Path : trajectoire
// Guide : courbe guide
// FirstSect : section
@@ -751,31 +751,37 @@ void GeomFill_Pipe::Init(const Handle(Geom_Curve)& Path,
if (!TLaw.IsNull()) {
myLoc = new (GeomFill_CurveAndTrihedron) (TLaw);
myLoc->SetCurve(myAdpPath);
TColGeom_SequenceOfCurve SeqC;
TColStd_SequenceOfReal SeqP;
SeqC.Clear();
SeqP.Clear();
// sequence des sections
GeomFill_SectionPlacement Pl1(myLoc, FirstSect);
Pl1.Perform(first,Precision::Confusion());
SeqC.Append(Pl1.Section(Standard_False));
GeomFill_SectionPlacement Pl2(myLoc, LastSect);
Pl2.Perform(first,Precision::Confusion());
SeqC.Append(Pl2.Section(Standard_False));
// sequence des parametres associes
SeqP.Append(first);
SeqP.Append(last);
// verification de l'orientation
TColGeom_SequenceOfCurve NewSeq;
if (CheckSense(SeqC,NewSeq)) SeqC = NewSeq;
if (!(myLoc->SetCurve(myAdpPath)))
{
myStatus = GeomFill_ImpossibleContact;
return;
}
// creation de la NSections
Standard_Real deb,fin;
deb = SeqC.First()->FirstParameter();
fin = SeqC.First()->LastParameter();
mySec = new (GeomFill_NSections) (SeqC,SeqP,deb,fin,first,last);
TColGeom_SequenceOfCurve SeqC;
TColStd_SequenceOfReal SeqP;
SeqC.Clear();
SeqP.Clear();
// sequence of sections
GeomFill_SectionPlacement Pl1(myLoc, FirstSect);
Pl1.Perform(first, Precision::Confusion());
SeqC.Append(Pl1.Section(Standard_False));
GeomFill_SectionPlacement Pl2(myLoc, LastSect);
Pl2.Perform(first, Precision::Confusion());
SeqC.Append(Pl2.Section(Standard_False));
// sequence of associated parameters
SeqP.Append(first);
SeqP.Append(last);
// orientation verification
TColGeom_SequenceOfCurve NewSeq;
if (CheckSense(SeqC, NewSeq)) SeqC = NewSeq;
// creation of the NSections
Standard_Real deb, fin;
deb = SeqC.First()->FirstParameter();
fin = SeqC.First()->LastParameter();
mySec = new (GeomFill_NSections) (SeqC, SeqP, deb, fin, first, last);
}
}
@@ -831,6 +837,11 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
const Standard_Integer DegMax,
const Standard_Integer NbMaxSegment)
{
if (myStatus == GeomFill_ImpossibleContact)
{
return;
}
GeomAbs_Shape TheConti;
switch (Conti) {
case GeomAbs_C0:
@@ -884,7 +895,7 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
App.UDegree(),
App.VDegree());
myError = App.MaxErrorOnSurf();
myIsDone = Standard_True;
myStatus = GeomFill_PipeOk;
}
//else {
// throw Standard_ConstructionError("GeomFill_Pipe::Perform : Cannot make a surface");
@@ -898,7 +909,7 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
if (Sweep.IsDone()) {
mySurface = Sweep.Surface();
myError = Sweep.ErrorOnSurface();
myIsDone = Standard_True;
myStatus = GeomFill_PipeOk;
}
//else {
// throw Standard_ConstructionError("GeomFill_Pipe::Perform : Cannot make a surface");
@@ -975,7 +986,7 @@ Standard_Boolean GeomFill_Pipe::KPartT4()
myAdpPath->FirstParameter(),
myAdpPath->LastParameter());
Ok = Standard_True; //C'est bien un cylindre
myIsDone = Standard_True;
myStatus = GeomFill_PipeOk;
}
// ----------- Cas du tore ----------------------------------
else if (myAdpPath->GetType() == GeomAbs_Circle &&
@@ -1038,7 +1049,7 @@ Standard_Boolean GeomFill_Pipe::KPartT4()
myAdpPath->FirstParameter(),myAdpPath->LastParameter(),VV1,VV2);
myExchUV = Standard_True;
Ok = Standard_True;
myIsDone = Standard_True;
myStatus = GeomFill_PipeOk;
}
return Ok;
@@ -1137,6 +1148,6 @@ void GeomFill_Pipe::ApproxSurf(const Standard_Boolean WithParameters) {
App.VDegree());
Standard_Real t2d;
App.TolReached(myError, t2d);
myIsDone = Standard_True;
myStatus = GeomFill_PipeOk;
}
}

View File

@@ -21,6 +21,7 @@
#include <GeomFill_Trihedron.hxx>
#include <GeomAbs_Shape.hxx>
#include <TColGeom_SequenceOfCurve.hxx>
#include <GeomFill_PipeError.hxx>
class Geom_Surface;
class GeomFill_LocationLaw;
@@ -249,7 +250,11 @@ public:
//! Returns whether approximation was done.
Standard_Boolean IsDone() const;
//! Returns execution status
GeomFill_PipeError GetStatus() const
{
return myStatus;
}
protected:
@@ -271,8 +276,7 @@ private:
Standard_EXPORT Standard_Boolean KPartT4();
Standard_Boolean myIsDone;
GeomFill_PipeError myStatus;//!< Execution status
Standard_Real myRadius;
Standard_Real myError;
Handle(Adaptor3d_Curve) myAdpPath;
@@ -285,8 +289,6 @@ private:
Standard_Boolean myExchUV;
Standard_Boolean myKPart;
Standard_Boolean myPolynomial;
};

View File

@@ -70,6 +70,5 @@ inline Standard_Real GeomFill_Pipe::ErrorOnSurf() const
//=======================================================================
inline Standard_Boolean GeomFill_Pipe::IsDone() const
{
return myIsDone;
return myStatus == GeomFill_PipeOk;
}

File diff suppressed because it is too large Load Diff

View File

@@ -24,10 +24,11 @@
IMPLEMENT_STANDARD_RTTIEXT(GeomFill_TrihedronLaw,Standard_Transient)
void GeomFill_TrihedronLaw::SetCurve(const Handle(Adaptor3d_Curve)& C)
Standard_Boolean GeomFill_TrihedronLaw::SetCurve(const Handle(Adaptor3d_Curve)& C)
{
myCurve = C;
myTrimmed = myCurve;
return Standard_True;
}
//==================================================================

View File

@@ -34,8 +34,9 @@ class GeomFill_TrihedronLaw : public Standard_Transient
public:
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C);
//! initialize curve of trihedron law
//! @return Standard_True
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C);
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const = 0;

View File

@@ -77,33 +77,78 @@ void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
myTolReached2d = myTolReached3d = 0.0;
myNbrestr = 0;
sline.Clear();
Handle(Adaptor3d_TopolTool) dom1 = new Adaptor3d_TopolTool(myHS1);
Handle(Adaptor3d_TopolTool) dom2 = new Adaptor3d_TopolTool(myHS2);
myLConstruct.Load(dom1,dom2,myHS1,myHS2);
Standard_Real TolArc = Tol;
Standard_Real TolTang = Tol;
Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep(myHS1, dom1, myHS2, dom2);
Standard_Real Deflection = 0.1;
myIntersector.SetTolerances(TolArc,TolTang,UVMaxStep,Deflection);
if(myHS1 == myHS2) {
myIntersector.Perform(myHS1,dom1,TolArc,TolTang);
}
else if (!useStart) {
myIntersector.Perform(myHS1,dom1,myHS2,dom2,TolArc,TolTang);
}
else {
myIntersector.Perform(myHS1,dom1,myHS2,dom2,U1,V1,U2,V2,TolArc,TolTang);
if (myHS1->GetType() == GeomAbs_BSplineSurface && myHS2->GetType() == GeomAbs_BSplineSurface)
{
Deflection /= 10.;
}
// ============================================================
if (myIntersector.IsDone()) {
const Standard_Integer nblin = myIntersector.NbLines();
for (Standard_Integer i=1; i<= nblin; i++)
Handle(Adaptor3d_TopolTool) dom1 = new Adaptor3d_TopolTool (myHS1);
Handle(Adaptor3d_TopolTool) dom2 = new Adaptor3d_TopolTool (myHS2);
NCollection_Vector< Handle(Adaptor3d_Surface)> aVecHS1;
NCollection_Vector< Handle(Adaptor3d_Surface)> aVecHS2;
if (myHS1 == myHS2)
{
aVecHS1.Append (myHS1);
aVecHS2.Append (myHS2);
}
else
{
myIntersector.PrepareSurfaces (myHS1, dom1, myHS2, dom2, Tol, aVecHS1, aVecHS2);
}
for (Standard_Integer aNumOfHS1 = 0; aNumOfHS1 < aVecHS1.Length(); aNumOfHS1++)
{
const Handle(Adaptor3d_Surface)& aHS1 = aVecHS1.Value (aNumOfHS1);
for (Standard_Integer aNumOfHS2 = 0; aNumOfHS2 < aVecHS2.Length(); aNumOfHS2++)
{
MakeCurve(i,dom1,dom2,Tol,Approx,ApproxS1,ApproxS2);
const Handle(Adaptor3d_Surface)& aHS2 = aVecHS2.Value (aNumOfHS2);
Handle(Adaptor3d_TopolTool) aDom1 = new Adaptor3d_TopolTool (aHS1);
Handle(Adaptor3d_TopolTool) aDom2 = new Adaptor3d_TopolTool (aHS2);
myLConstruct.Load (aDom1 ,aDom2,
Handle(GeomAdaptor_Surface)::DownCast (aHS1),
Handle(GeomAdaptor_Surface)::DownCast (aHS2));
Standard_Real UVMaxStep = IntPatch_Intersection::DefineUVMaxStep (aHS1, aDom1, aHS2, aDom2);
myIntersector.SetTolerances (TolArc, TolTang, UVMaxStep, Deflection);
if (aHS1 == aHS2)
{
myIntersector.Perform (aHS1, aDom1, TolArc, TolTang);
}
else if (!useStart)
{
myIntersector.Perform (aHS1, aDom1, aHS2, aDom2, TolArc, TolTang);
}
else
{
TopAbs_State aState1 = aDom1->Classify (gp_Pnt2d (U1, V1), Tol);
TopAbs_State aState2 = aDom2->Classify (gp_Pnt2d (U2, V2), Tol);
if ((aState1 == TopAbs_IN || aState1 == TopAbs_ON) &&
(aState2 == TopAbs_IN || aState2 == TopAbs_ON))
{
myIntersector.Perform (aHS1, aDom1, aHS2, aDom2, U1, V1, U2, V2, TolArc, TolTang);
}
}
// ============================================================
if (myIntersector.IsDone()) {
const Standard_Integer nblin = myIntersector.NbLines();
for (Standard_Integer i = 1; i <= nblin; i++)
{
MakeCurve (i, aDom1, aDom2, Tol, Approx, ApproxS1, ApproxS2);
}
}
}
}
}

View File

@@ -2371,119 +2371,143 @@ void GeomLib::CancelDenominatorDerivative(Handle(Geom_BSplineSurface) &
//=======================================================================
//function : NormEstim
//purpose :
//purpose :
//=======================================================================
Standard_Integer GeomLib::NormEstim(const Handle(Geom_Surface)& S,
const gp_Pnt2d& UV,
const Standard_Real Tol, gp_Dir& N)
Standard_Integer GeomLib::NormEstim (const Handle(Geom_Surface)& theSurf,
const gp_Pnt2d& theUV,
const Standard_Real theTol,
gp_Dir& theNorm)
{
const Standard_Real aTol2 = Square (theTol);
gp_Vec DU, DV;
gp_Pnt DummyPnt;
Standard_Real aTol2 = Square(Tol);
gp_Pnt aDummyPnt;
theSurf->D1 (theUV.X(), theUV.Y(), aDummyPnt, DU, DV);
S->D1(UV.X(), UV.Y(), DummyPnt, DU, DV);
Standard_Real MDU = DU.SquareMagnitude(), MDV = DV.SquareMagnitude();
if(MDU >= aTol2 && MDV >= aTol2) {
gp_Vec Norm = DU^DV;
Standard_Real Magn = Norm.SquareMagnitude();
if(Magn < aTol2) return 3;
//Magn = sqrt(Magn);
N.SetXYZ(Norm.XYZ());
return 0;
}
else {
gp_Vec D2U, D2V, D2UV;
Standard_Boolean isDone;
CSLib_NormalStatus aStatus;
gp_Dir aNormal;
S->D2(UV.X(), UV.Y(), DummyPnt, DU, DV, D2U, D2V, D2UV);
CSLib::Normal(DU, DV, D2U, D2V, D2UV, Tol, isDone, aStatus, aNormal);
if (isDone) {
Standard_Real Umin, Umax, Vmin, Vmax;
Standard_Real step = 1.0e-5;
Standard_Real eps = 1.0e-16;
Standard_Real sign = -1.0;
S->Bounds(Umin, Umax, Vmin, Vmax);
// check for cone apex singularity point
if ((UV.Y() > Vmin + step) && (UV.Y() < Vmax - step))
{
gp_Dir aNormal1, aNormal2;
Standard_Real aConeSingularityAngleEps = 1.0e-4;
S->D1(UV.X(), UV.Y() - sign * step, DummyPnt, DU, DV);
if ((DU.XYZ().SquareModulus() > eps) && (DV.XYZ().SquareModulus() > eps)) {
aNormal1 = DU^DV;
S->D1(UV.X(), UV.Y() + sign * step, DummyPnt, DU, DV);
if ((DU.XYZ().SquareModulus() > eps) && (DV.XYZ().SquareModulus() > eps)) {
aNormal2 = DU^DV;
if (aNormal1.IsOpposite(aNormal2, aConeSingularityAngleEps))
return 2;
}
}
}
// Along V
if(MDU < aTol2 && MDV >= aTol2) {
if ((Vmax - UV.Y()) > (UV.Y() - Vmin))
sign = 1.0;
S->D1(UV.X(), UV.Y() + sign * step, DummyPnt, DU, DV);
gp_Vec Norm = DU^DV;
if (Norm.SquareMagnitude() < eps) {
Standard_Real sign1 = -1.0;
if ((Umax - UV.X()) > (UV.X() - Umin))
sign1 = 1.0;
S->D1(UV.X() + sign1 * step, UV.Y() + sign * step, DummyPnt, DU, DV);
Norm = DU^DV;
}
if ((Norm.SquareMagnitude() >= eps) && (Norm.Dot(aNormal) < 0.0))
aNormal.Reverse();
}
// Along U
if(MDV < aTol2 && MDU >= aTol2) {
if ((Umax - UV.X()) > (UV.X() - Umin))
sign = 1.0;
S->D1(UV.X() + sign * step, UV.Y(), DummyPnt, DU, DV);
gp_Vec Norm = DU^DV;
if (Norm.SquareMagnitude() < eps) {
Standard_Real sign1 = -1.0;
if ((Vmax - UV.Y()) > (UV.Y() - Vmin))
sign1 = 1.0;
S->D1(UV.X() + sign * step, UV.Y() + sign1 * step, DummyPnt, DU, DV);
Norm = DU^DV;
}
if ((Norm.SquareMagnitude() >= eps) && (Norm.Dot(aNormal) < 0.0))
aNormal.Reverse();
}
// quasysingular
if ((aStatus == CSLib_D1NuIsNull) || (aStatus == CSLib_D1NvIsNull) ||
(aStatus == CSLib_D1NuIsParallelD1Nv)) {
N.SetXYZ(aNormal.XYZ());
return 1;
}
// conical
if (aStatus == CSLib_InfinityOfSolutions)
return 2;
}
// computation is impossible
else {
// conical
if (aStatus == CSLib_D1NIsNull) {
return 2;
}
const Standard_Real MDU = DU.SquareMagnitude(), MDV = DV.SquareMagnitude();
if (MDU >= aTol2
&& MDV >= aTol2)
{
gp_Vec aNorm = DU ^ DV;
Standard_Real aMagn = aNorm.SquareMagnitude();
if (aMagn < aTol2)
{
return 3;
}
theNorm.SetXYZ (aNorm.XYZ());
return 0;
}
return 3;
gp_Vec D2U, D2V, D2UV;
Standard_Boolean isDone = false;
CSLib_NormalStatus aStatus;
gp_Dir aNormal;
theSurf->D2 (theUV.X(), theUV.Y(), aDummyPnt, DU, DV, D2U, D2V, D2UV);
CSLib::Normal (DU, DV, D2U, D2V, D2UV, theTol, isDone, aStatus, aNormal);
if (!isDone)
{
// computation is impossible
return aStatus == CSLib_D1NIsNull ? 2 : 3;
}
Standard_Real Umin, Umax, Vmin, Vmax;
Standard_Real step = 1.0e-5;
Standard_Real eps = 1.0e-16;
Standard_Real sign = -1.0;
theSurf->Bounds (Umin, Umax, Vmin, Vmax);
// check for cone apex singularity point
if ((theUV.Y() > Vmin + step)
&& (theUV.Y() < Vmax - step))
{
gp_Dir aNormal1, aNormal2;
Standard_Real aConeSingularityAngleEps = 1.0e-4;
theSurf->D1(theUV.X(), theUV.Y() - sign * step, aDummyPnt, DU, DV);
if ((DU.XYZ().SquareModulus() > eps) && (DV.XYZ().SquareModulus() > eps))
{
aNormal1 = DU ^ DV;
theSurf->D1 (theUV.X(), theUV.Y() + sign * step, aDummyPnt, DU, DV);
if ((DU.XYZ().SquareModulus() > eps)
&& (DV.XYZ().SquareModulus() > eps))
{
aNormal2 = DU^DV;
if (aNormal1.IsOpposite (aNormal2, aConeSingularityAngleEps))
{
return 2;
}
}
}
}
// Along V
if (MDU < aTol2
&& MDV >= aTol2)
{
if ((Vmax - theUV.Y()) > (theUV.Y() - Vmin))
{
sign = 1.0;
}
theSurf->D1 (theUV.X(), theUV.Y() + sign * step, aDummyPnt, DU, DV);
gp_Vec Norm = DU ^ DV;
if (Norm.SquareMagnitude() < eps)
{
Standard_Real sign1 = -1.0;
if ((Umax - theUV.X()) > (theUV.X() - Umin))
{
sign1 = 1.0;
}
theSurf->D1 (theUV.X() + sign1 * step, theUV.Y() + sign * step, aDummyPnt, DU, DV);
Norm = DU ^ DV;
}
if (Norm.SquareMagnitude() >= eps
&& Norm.Dot (aNormal) < 0.0)
{
aNormal.Reverse();
}
}
// Along U
if (MDV < aTol2
&& MDU >= aTol2)
{
if ((Umax - theUV.X()) > (theUV.X() - Umin))
{
sign = 1.0;
}
theSurf->D1 (theUV.X() + sign * step, theUV.Y(), aDummyPnt, DU, DV);
gp_Vec Norm = DU ^ DV;
if (Norm.SquareMagnitude() < eps)
{
Standard_Real sign1 = -1.0;
if ((Vmax - theUV.Y()) > (theUV.Y() - Vmin))
{
sign1 = 1.0;
}
theSurf->D1 (theUV.X() + sign * step, theUV.Y() + sign1 * step, aDummyPnt, DU, DV);
Norm = DU ^ DV;
}
if (Norm.SquareMagnitude() >= eps
&& Norm.Dot (aNormal) < 0.0)
{
aNormal.Reverse();
}
}
// quasysingular
if (aStatus == CSLib_D1NuIsNull
|| aStatus == CSLib_D1NvIsNull
|| aStatus == CSLib_D1NuIsParallelD1Nv)
{
theNorm.SetXYZ (aNormal.XYZ());
return 1;
}
return aStatus == CSLib_InfinityOfSolutions ? 2 : 3;
}
//=======================================================================

View File

@@ -183,8 +183,19 @@ public:
//! Cancel,on the boundaries,the denominator first derivative
//! in the directions wished by the user and set its value to 1.
Standard_EXPORT static void CancelDenominatorDerivative (Handle(Geom_BSplineSurface)& BSurf, const Standard_Boolean UDirection, const Standard_Boolean VDirection);
Standard_EXPORT static Standard_Integer NormEstim (const Handle(Geom_Surface)& S, const gp_Pnt2d& UV, const Standard_Real Tol, gp_Dir& N);
//! Estimate surface normal at the given (U, V) point.
//! @param[in] theSurf input surface
//! @param[in] theUV (U, V) point coordinates on the surface
//! @param[in] theTol estimation tolerance
//! @param[out] theNorm computed normal
//! @return 0 if normal estimated from D1,
//! 1 if estimated from D2 (quasysingular),
//! >=2 in case of failure (undefined or infinite solutions)
Standard_EXPORT static Standard_Integer NormEstim (const Handle(Geom_Surface)& theSurf,
const gp_Pnt2d& theUV,
const Standard_Real theTol,
gp_Dir& theNorm);
//! This method defines if opposite boundaries of surface
//! coincide with given tolerance

View File

@@ -87,7 +87,6 @@
GeomToIGES_GeomCurve::GeomToIGES_GeomCurve()
:GeomToIGES_GeomEntity()
{
myOffsetModeIVal = Interface_Static::IVal("write.iges.offset.mode");
}
@@ -99,7 +98,6 @@ GeomToIGES_GeomCurve::GeomToIGES_GeomCurve
(const GeomToIGES_GeomEntity& GE)
:GeomToIGES_GeomEntity(GE)
{
myOffsetModeIVal = Interface_Static::IVal("write.iges.offset.mode");
}
@@ -817,7 +815,7 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
if (Precision::IsNegativeInfinite(Udeb)) U1 = -Precision::Infinite();
if (Precision::IsPositiveInfinite(Ufin)) U2 = Precision::Infinite();
if (myOffsetModeIVal == 0)
if (Interface_Static::IVal("write.iges.offset.mode") == 0)
{
res = TransferCurve(GeomConvert::CurveToBSplineCurve(start),U1,U2);
return res;
@@ -855,14 +853,3 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomCurve::TransferCurve
res = OffsetC;
return res;
}
void GeomToIGES_GeomCurve::SetOffsetModeIVal(const Standard_Integer theVal)
{
Interface_Static::SetIVal("write.iges.offset.mode", theVal);
myOffsetModeIVal = theVal;
}
Standard_Integer GeomToIGES_GeomCurve::GetOffsetModeIVal() const
{
return myOffsetModeIVal;
}

View File

@@ -92,9 +92,7 @@ public:
Standard_EXPORT Handle(IGESData_IGESEntity) TransferCurve (const Handle(Geom_OffsetCurve)& start, const Standard_Real Udeb, const Standard_Real Ufin);
Standard_EXPORT void SetOffsetModeIVal(const Standard_Integer theVal);
Standard_EXPORT Standard_Integer GetOffsetModeIVal() const;
protected:
@@ -106,7 +104,7 @@ protected:
private:
Standard_Integer myOffsetModeIVal;
};

View File

@@ -100,7 +100,6 @@ GeomToIGES_GeomSurface::GeomToIGES_GeomSurface()
{
myBRepMode = Standard_False;
myAnalytic = Standard_False;
myPlaneModeIVal = Interface_Static::IVal("write.iges.plane.mode");
}
@@ -113,7 +112,6 @@ GeomToIGES_GeomSurface::GeomToIGES_GeomSurface(const GeomToIGES_GeomEntity& GE)
{
myBRepMode = Standard_False;
myAnalytic = Standard_False;
myPlaneModeIVal = Interface_Static::IVal("write.iges.plane.mode");
}
@@ -539,7 +537,7 @@ Handle(IGESData_IGESEntity) GeomToIGES_GeomSurface::TransferSurface(const Handle
if (start.IsNull()) {
return res;
}
if (myPlaneModeIVal == 0){
if (Interface_Static::IVal("write.iges.plane.mode") == 0){
Handle(IGESGeom_Plane) aPlane = new IGESGeom_Plane;
Standard_Real A,B,C,D;
start->Coefficients(A,B,C,D);
@@ -1349,13 +1347,3 @@ void GeomToIGES_GeomSurface::SetAnalyticMode(const Standard_Boolean flag)
myAnalytic = flag;
}
void GeomToIGES_GeomSurface::SetPlaneModeIVal(const Standard_Integer theVal)
{
Interface_Static::SetIVal("write.iges.plane.mode", theVal);
myPlaneModeIVal = theVal;
}
Standard_Integer GeomToIGES_GeomSurface::GetPlaneModeIVal() const
{
return myPlaneModeIVal;
}

View File

@@ -129,9 +129,7 @@ public:
//! Setst flag for writing elementary surfaces
Standard_EXPORT void SetAnalyticMode (const Standard_Boolean flag);
Standard_EXPORT void SetPlaneModeIVal(const Standard_Integer theVal);
Standard_EXPORT Standard_Integer GetPlaneModeIVal() const;
protected:
@@ -147,7 +145,6 @@ private:
Standard_Real TheLength;
Standard_Boolean myBRepMode;
Standard_Boolean myAnalytic;
Standard_Integer myPlaneModeIVal;
};

View File

@@ -237,8 +237,8 @@ static Standard_Integer tuyau (Draw_Interpretor& di,
Pipe.Perform(1.e-4, Standard_False, Cont);
if (!Pipe.IsDone()) {
di << "GeomFill_Pipe cannot make a surface\n";
return 1;
di << "Error: GeomFill_Pipe cannot make a surface\n";
return 0;
}
Standard_Real Accuracy = Pipe.ErrorOnSurf();

View File

@@ -941,6 +941,36 @@ static Standard_Integer value (Draw_Interpretor& ,
return 0;
}
//=======================================================================
//function : derivative
//purpose :
//=======================================================================
static Standard_Integer derivative(Draw_Interpretor&,
Standard_Integer theArgc,
const char** theArgv)
{
if (theArgc != 9)
return 1;
Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(theArgv[1]);
if (aSurf.IsNull())
return 1;
Standard_Real aU = Draw::Atof(theArgv[2]);
Standard_Real aV = Draw::Atof(theArgv[3]);
Standard_Integer aNu = Draw::Atoi(theArgv[4]);
Standard_Integer aNv = Draw::Atoi(theArgv[5]);
gp_Vec aDeriv = aSurf->DN(aU, aV, aNu, aNv);
Draw::Set(theArgv[6], aDeriv.X());
Draw::Set(theArgv[7], aDeriv.Y());
Draw::Set(theArgv[8], aDeriv.Z());
return 0;
}
//=======================================================================
//function : movepole
//purpose :
@@ -1851,6 +1881,15 @@ void GeomliteTest::SurfaceCommands(Draw_Interpretor& theCommands)
__FILE__,
value,g);
theCommands.Add("sderivative",
"sderivative surfname U V NU NV X Y Z\n"
" surfname : name of surface\n"
" U V : coordinates on probe point on surface\n"
" NU NV : order of derivative along U and V\n"
" X Y Z : output coordinates of the derivative",
__FILE__,
derivative, g);
theCommands.Add("parameters",
"parameters surf/curve X Y [Z] Tol U [V] : {X Y Z} point, {U V} output parameter(s)",
__FILE__,

View File

@@ -154,10 +154,11 @@ Graphic3d_Texture1Dsegment.cxx
Graphic3d_Texture1Dsegment.hxx
Graphic3d_Texture2D.cxx
Graphic3d_Texture2D.hxx
Graphic3d_Texture2Dmanual.cxx
Graphic3d_Texture2Dmanual.hxx
Graphic3d_Texture2Dplane.cxx
Graphic3d_Texture2Dplane.hxx
Graphic3d_Texture3D.cxx
Graphic3d_Texture3D.hxx
Graphic3d_TextureEnv.cxx
Graphic3d_TextureEnv.hxx
Graphic3d_TextureMap.cxx

View File

@@ -15,3 +15,40 @@
#include <Graphic3d_CubeMap.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CubeMap, Graphic3d_TextureMap)
// =======================================================================
// function : Graphic3d_CubeMap
// purpose :
// =======================================================================
Graphic3d_CubeMap::Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
Standard_Boolean theToGenerateMipmaps)
: Graphic3d_TextureMap (theFileName, Graphic3d_TypeOfTexture_CUBEMAP),
myCurrentSide (Graphic3d_CMS_POS_X),
myEndIsReached (false),
myZIsInverted (false)
{
myHasMipmaps = theToGenerateMipmaps;
}
// =======================================================================
// function : Graphic3d_CubeMap
// purpose :
// =======================================================================
Graphic3d_CubeMap::Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap,
Standard_Boolean theToGenerateMipmaps)
: Graphic3d_TextureMap (thePixmap, Graphic3d_TypeOfTexture_CUBEMAP),
myCurrentSide (Graphic3d_CMS_POS_X),
myEndIsReached (false),
myZIsInverted (false)
{
myHasMipmaps = theToGenerateMipmaps;
}
// =======================================================================
// function : ~Graphic3d_CubeMap
// purpose :
// =======================================================================
Graphic3d_CubeMap::~Graphic3d_CubeMap()
{
//
}

View File

@@ -26,24 +26,12 @@ class Graphic3d_CubeMap : public Graphic3d_TextureMap
public:
//! Constructor defining loading cubemap from file.
Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
Standard_Boolean theToGenerateMipmaps = Standard_False) :
Graphic3d_TextureMap (theFileName, Graphic3d_TOT_CUBEMAP),
myCurrentSide (Graphic3d_CMS_POS_X),
myEndIsReached (false),
myZIsInverted (false),
myHasMipmaps (theToGenerateMipmaps)
{}
Standard_EXPORT Graphic3d_CubeMap (const TCollection_AsciiString& theFileName,
Standard_Boolean theToGenerateMipmaps = Standard_False);
//! Constructor defining direct cubemap initialization from PixMap.
Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap = Handle(Image_PixMap)(),
Standard_Boolean theToGenerateMipmaps = Standard_False) :
Graphic3d_TextureMap (thePixmap, Graphic3d_TOT_CUBEMAP),
myCurrentSide (Graphic3d_CMS_POS_X),
myEndIsReached (false),
myZIsInverted (false),
myHasMipmaps (theToGenerateMipmaps)
{}
Standard_EXPORT Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap = Handle(Image_PixMap)(),
Standard_Boolean theToGenerateMipmaps = Standard_False);
//! Returns whether the iterator has reached the end (true if it hasn't).
Standard_Boolean More() const { return !myEndIsReached; }
@@ -100,14 +88,13 @@ public:
}
//! Empty destructor.
~Graphic3d_CubeMap() {}
Standard_EXPORT virtual ~Graphic3d_CubeMap();
protected:
Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state
Standard_Boolean myEndIsReached; //!< Indicates whether end of iteration has been reached or hasn't
Standard_Boolean myZIsInverted; //!< Indicates whether Z axis is inverted that allows to synchronize vertical flip of cubemap
Standard_Boolean myHasMipmaps; //!< Indicates whether mipmaps of cubemap will be generated or not
};

View File

@@ -42,7 +42,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_MediaTexture, Graphic3d_Texture2D)
// ================================================================
Graphic3d_MediaTexture::Graphic3d_MediaTexture (const Handle(Standard_HMutex)& theMutex,
Standard_Integer thePlane)
: Graphic3d_Texture2D ("", Graphic3d_TOT_2D),
: Graphic3d_Texture2D ("", Graphic3d_TypeOfTexture_2D),
myMutex (theMutex),
myPlane (thePlane)
{

View File

@@ -14,10 +14,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_Texture1Dmanual.hxx>
#include <Graphic3d_TypeOfTextureMode.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
@@ -27,7 +25,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
// purpose :
// =======================================================================
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const TCollection_AsciiString& theFileName)
: Graphic3d_Texture1D (theFileName, Graphic3d_TOT_1D)
: Graphic3d_Texture1D (theFileName, Graphic3d_TypeOfTexture_1D)
{
//
}
@@ -37,7 +35,7 @@ Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const TCollection_AsciiStr
// purpose :
// =======================================================================
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Graphic3d_NameOfTexture1D theNOT)
: Graphic3d_Texture1D (theNOT, Graphic3d_TOT_1D)
: Graphic3d_Texture1D (theNOT, Graphic3d_TypeOfTexture_1D)
{
//
}
@@ -47,7 +45,7 @@ Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Graphic3d_NameOfText
// purpose :
// =======================================================================
Graphic3d_Texture1Dmanual::Graphic3d_Texture1Dmanual (const Handle(Image_PixMap)& thePixMap)
: Graphic3d_Texture1D (thePixMap, Graphic3d_TOT_1D)
: Graphic3d_Texture1D (thePixMap, Graphic3d_TypeOfTexture_1D)
{
//
}

View File

@@ -17,55 +17,27 @@
#ifndef _Graphic3d_Texture1Dmanual_HeaderFile
#define _Graphic3d_Texture1Dmanual_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Graphic3d_Texture1D.hxx>
#include <Graphic3d_NameOfTexture1D.hxx>
class TCollection_AsciiString;
class Graphic3d_Texture1Dmanual;
DEFINE_STANDARD_HANDLE(Graphic3d_Texture1Dmanual, Graphic3d_Texture1D)
//! This class provides the implementation of a manual 1D texture.
//! you MUST provides texture coordinates on your facets if you want to see your texture.
//! you MUST provide texture coordinates on your facets if you want to see your texture.
class Graphic3d_Texture1Dmanual : public Graphic3d_Texture1D
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual, Graphic3d_Texture1D)
public:
//! Creates a texture from the file FileName.
Standard_EXPORT Graphic3d_Texture1Dmanual(const TCollection_AsciiString& theFileName);
//! Create a texture from a predefined texture name set.
Standard_EXPORT Graphic3d_Texture1Dmanual(const Graphic3d_NameOfTexture1D theNOT);
//! Creates a texture from the pixmap.
Standard_EXPORT Graphic3d_Texture1Dmanual(const Handle(Image_PixMap)& thePixMap);
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture1Dmanual,Graphic3d_Texture1D)
protected:
private:
};
#endif // _Graphic3d_Texture1Dmanual_HeaderFile

View File

@@ -28,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1Dsegment,Graphic3d_Texture1D)
// purpose :
// =======================================================================
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiString& theFileName)
: Graphic3d_Texture1D (theFileName, Graphic3d_TOT_1D),
: Graphic3d_Texture1D (theFileName, Graphic3d_TypeOfTexture_1D),
myX1 (0.0f),
myY1 (0.0f),
myZ1 (0.0f),
@@ -47,7 +47,7 @@ Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiS
// purpose :
// =======================================================================
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTexture1D theNOT)
: Graphic3d_Texture1D (theNOT, Graphic3d_TOT_1D),
: Graphic3d_Texture1D (theNOT, Graphic3d_TypeOfTexture_1D),
myX1 (0.0f),
myY1 (0.0f),
myZ1 (0.0f),
@@ -66,7 +66,7 @@ Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTe
// purpose :
// =======================================================================
Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Handle(Image_PixMap)& thePixMap)
: Graphic3d_Texture1D (thePixMap, Graphic3d_TOT_1D),
: Graphic3d_Texture1D (thePixMap, Graphic3d_TypeOfTexture_1D),
myX1 (0.0f),
myY1 (0.0f),
myZ1 (0.0f),

View File

@@ -16,6 +16,7 @@
#include <Graphic3d_Texture2D.hxx>
#include <Graphic3d_TextureParams.hxx>
#include <Standard_OutOfRange.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2D,Graphic3d_TextureMap)
@@ -46,6 +47,20 @@ static const char *NameOfTexture2d_to_FileName[] =
"2d_chess.rgba"
};
// =======================================================================
// function : Graphic3d_Texture2D
// purpose :
// =======================================================================
Graphic3d_Texture2D::Graphic3d_Texture2D (const TCollection_AsciiString& theFileName)
: Graphic3d_TextureMap (theFileName, Graphic3d_TypeOfTexture_2D),
myName (Graphic3d_NOT_2D_UNKNOWN)
{
myHasMipmaps = true;
myParams->SetModulate (true);
myParams->SetRepeat (true);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}
// =======================================================================
// function : Graphic3d_Texture2D
// purpose :
@@ -55,6 +70,25 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const TCollection_AsciiString& theFile
: Graphic3d_TextureMap (theFileName, theType),
myName (Graphic3d_NOT_2D_UNKNOWN)
{
//
}
// =======================================================================
// function : Graphic3d_Texture2D
// purpose :
// =======================================================================
Graphic3d_Texture2D::Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT)
: Graphic3d_TextureMap (NameOfTexture2d_to_FileName[theNOT], Graphic3d_TypeOfTexture_2D),
myName (theNOT)
{
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
myTexId = TCollection_AsciiString ("Graphic3d_Texture2D_")
+ NameOfTexture2d_to_FileName[theNOT];
myHasMipmaps = true;
myParams->SetModulate (true);
myParams->SetRepeat (true);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}
// =======================================================================
@@ -71,6 +105,20 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT
+ NameOfTexture2d_to_FileName[theNOT];
}
// =======================================================================
// function : Graphic3d_Texture2D
// purpose :
// =======================================================================
Graphic3d_Texture2D::Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixMap)
: Graphic3d_TextureMap (thePixMap, Graphic3d_TypeOfTexture_2D),
myName (Graphic3d_NOT_2D_UNKNOWN)
{
myHasMipmaps = true;
myParams->SetModulate (true);
myParams->SetRepeat (true);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}
// =======================================================================
// function : Graphic3d_Texture2D
// purpose :
@@ -80,6 +128,7 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixM
: Graphic3d_TextureMap (thePixMap, theType),
myName (Graphic3d_NOT_2D_UNKNOWN)
{
//
}
// =======================================================================

View File

@@ -34,6 +34,18 @@ public:
public:
//! Creates a texture from a file.
//! MipMaps levels will be automatically generated if needed.
Standard_EXPORT Graphic3d_Texture2D (const TCollection_AsciiString& theFileName);
//! Creates a texture from a predefined texture name set.
//! MipMaps levels will be automatically generated if needed.
Standard_EXPORT Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT);
//! Creates a texture from the pixmap.
//! MipMaps levels will be automatically generated if needed.
Standard_EXPORT Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixMap);
//! Returns the name of the predefined textures or NOT_2D_UNKNOWN
//! when the name is given as a filename.
Standard_EXPORT Graphic3d_NameOfTexture2D Name() const;
@@ -42,13 +54,6 @@ public:
//! Note that this method does not invalidate already uploaded resources - consider calling ::UpdateRevision() if needed.
Standard_EXPORT void SetImage (const Handle(Image_PixMap)& thePixMap);
//! Return true if mip-maps should be used.
Standard_Boolean HasMipMaps() const { return myType == Graphic3d_TOT_2D_MIPMAP; }
//! Set if mip-maps should be used (generated if needed).
//! Note that this method should be called before loading / using the texture.
void SetMipMaps (const Standard_Boolean theToUse) { myType = theToUse ? Graphic3d_TOT_2D_MIPMAP : Graphic3d_TOT_2D; }
protected:
Standard_EXPORT Graphic3d_Texture2D(const TCollection_AsciiString& theFileName, const Graphic3d_TypeOfTexture theType);

View File

@@ -1,58 +0,0 @@
// Created on: 1997-07-28
// Created by: Pierre CHALAMET
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Graphic3d_TextureParams.hxx>
#include <Graphic3d_TypeOfTextureMode.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2Dmanual,Graphic3d_Texture2D)
// =======================================================================
// function : Graphic3d_Texture2Dmanual
// purpose :
// =======================================================================
Graphic3d_Texture2Dmanual::Graphic3d_Texture2Dmanual (const TCollection_AsciiString& theFileName)
: Graphic3d_Texture2D (theFileName, Graphic3d_TOT_2D_MIPMAP)
{
myParams->SetModulate (Standard_True);
myParams->SetRepeat (Standard_True);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}
// =======================================================================
// function : Graphic3d_Texture2Dmanual
// purpose :
// =======================================================================
Graphic3d_Texture2Dmanual::Graphic3d_Texture2Dmanual (const Graphic3d_NameOfTexture2D theNOT)
: Graphic3d_Texture2D (theNOT, Graphic3d_TOT_2D_MIPMAP)
{
myParams->SetModulate (Standard_True);
myParams->SetRepeat (Standard_True);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}
// =======================================================================
// function : Graphic3d_Texture2Dmanual
// purpose :
// =======================================================================
Graphic3d_Texture2Dmanual::Graphic3d_Texture2Dmanual (const Handle(Image_PixMap)& thePixMap)
: Graphic3d_Texture2D (thePixMap, Graphic3d_TOT_2D_MIPMAP)
{
myParams->SetModulate (Standard_True);
myParams->SetRepeat (Standard_True);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}

View File

@@ -20,28 +20,7 @@
#include <Graphic3d_Texture2D.hxx>
#include <Graphic3d_NameOfTexture2D.hxx>
//! This class defined a manual texture 2D
//! facets MUST define texture coordinate
//! if you want to see somethings on.
class Graphic3d_Texture2Dmanual : public Graphic3d_Texture2D
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture2Dmanual,Graphic3d_Texture2D)
public:
//! Creates a texture from a file.
//! MipMaps levels will be automatically generated if needed.
Standard_EXPORT Graphic3d_Texture2Dmanual(const TCollection_AsciiString& theFileName);
//! Creates a texture from a predefined texture name set.
//! MipMaps levels will be automatically generated if needed.
Standard_EXPORT Graphic3d_Texture2Dmanual(const Graphic3d_NameOfTexture2D theNOT);
//! Creates a texture from the pixmap.
//! MipMaps levels will be automatically generated if needed.
Standard_EXPORT Graphic3d_Texture2Dmanual(const Handle(Image_PixMap)& thePixMap);
};
DEFINE_STANDARD_HANDLE(Graphic3d_Texture2Dmanual, Graphic3d_Texture2D)
Standard_DEPRECATED ("Deprecated alias to Graphic3d_Texture2D")
typedef Graphic3d_Texture2D Graphic3d_Texture2Dmanual;
#endif // _Graphic3d_Texture2Dmanual_HeaderFile

View File

@@ -28,11 +28,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2Dplane,Graphic3d_Texture2D)
// purpose :
// =======================================================================
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const TCollection_AsciiString& theFileName)
: Graphic3d_Texture2D (theFileName, Graphic3d_TOT_2D_MIPMAP)
: Graphic3d_Texture2D (theFileName)
{
myParams->SetModulate (Standard_True);
myParams->SetRepeat (Standard_True);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
@@ -43,11 +40,8 @@ Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const TCollection_AsciiStrin
// purpose :
// =======================================================================
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Graphic3d_NameOfTexture2D theNOT)
: Graphic3d_Texture2D (theNOT, Graphic3d_TOT_2D_MIPMAP)
: Graphic3d_Texture2D (theNOT)
{
myParams->SetModulate (Standard_True);
myParams->SetRepeat (Standard_True);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));
@@ -58,11 +52,8 @@ Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Graphic3d_NameOfTextur
// purpose :
// =======================================================================
Graphic3d_Texture2Dplane::Graphic3d_Texture2Dplane (const Handle(Image_PixMap)& thePixMap)
: Graphic3d_Texture2D (thePixMap, Graphic3d_TOT_2D_MIPMAP)
: Graphic3d_Texture2D (thePixMap)
{
myParams->SetModulate (Standard_True);
myParams->SetRepeat (Standard_True);
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
Graphic3d_Vec4 (0.0f, 1.0f, 0.0f, 0.0f));

View File

@@ -0,0 +1,127 @@
// Copyright (c) 2022 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Graphic3d_Texture3D.hxx>
#include <Graphic3d_TextureParams.hxx>
#include <Image_AlienPixMap.hxx>
#include <Message.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture3D, Graphic3d_TextureMap)
// =======================================================================
// function : Graphic3d_Texture3D
// purpose :
// =======================================================================
Graphic3d_Texture3D::Graphic3d_Texture3D (const TCollection_AsciiString& theFileName)
: Graphic3d_TextureMap (theFileName, Graphic3d_TypeOfTexture_3D)
{
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}
// =======================================================================
// function : Graphic3d_Texture3D
// purpose :
// =======================================================================
Graphic3d_Texture3D::Graphic3d_Texture3D (const Handle(Image_PixMap)& thePixMap)
: Graphic3d_TextureMap (thePixMap, Graphic3d_TypeOfTexture_3D)
{
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
}
// =======================================================================
// function : Graphic3d_Texture3D
// purpose :
// =======================================================================
Graphic3d_Texture3D::Graphic3d_Texture3D (const NCollection_Array1<TCollection_AsciiString>& theFiles)
: Graphic3d_TextureMap ("", Graphic3d_TypeOfTexture_3D)
{
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
myPaths.Resize (theFiles.Lower(), theFiles.Upper(), false);
myPaths.Assign (theFiles);
}
// =======================================================================
// function : ~Graphic3d_Texture3D
// purpose :
// =======================================================================
Graphic3d_Texture3D::~Graphic3d_Texture3D()
{
//
}
// =======================================================================
// function : SetImage
// purpose :
// =======================================================================
void Graphic3d_Texture3D::SetImage (const Handle(Image_PixMap)& thePixMap)
{
myPixMap = thePixMap;
myPath = OSD_Path();
NCollection_Array1<TCollection_AsciiString> anArr;
myPaths.Move (anArr);
}
// =======================================================================
// function : GetImage
// purpose :
// =======================================================================
Handle(Image_PixMap) Graphic3d_Texture3D::GetImage (const Handle(Image_SupportedFormats)& theSupported)
{
if (myPaths.IsEmpty()
|| !myPixMap.IsNull())
{
return base_type::GetImage (theSupported);
}
Handle(Image_PixMap) anImage3D;
const Standard_Integer aNbSlices = myPaths.Length();
for (Standard_Integer aSlice = 0; aSlice < aNbSlices; ++aSlice)
{
const TCollection_AsciiString& aSlicePath = myPaths[myPaths.Lower() + aSlice];
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap();
if (!anImage->Load (aSlicePath))
{
Message::SendFail() << "Graphic3d_Texture3D::GetImage() failed to load slice " << aSlice << " from '" << aSlicePath << "'";
return Handle(Image_PixMap)();
}
convertToCompatible (theSupported, anImage);
if (anImage3D.IsNull())
{
myIsTopDown = anImage->IsTopDown();
anImage3D = new Image_PixMap();
anImage3D->SetTopDown (myIsTopDown);
if (!anImage3D->InitTrash3D (anImage->Format(),
NCollection_Vec3<Standard_Size> (anImage->SizeX(), anImage->SizeY(), aNbSlices),
anImage->SizeRowBytes()))
{
Message::SendFail() << "Graphic3d_Texture3D::GetImage() failed to allocate 3D image " << (int )anImage->SizeX() << "x" << (int )anImage->SizeY() << "x" << aNbSlices;
return Handle(Image_PixMap)();
}
}
if (anImage->Format() != anImage3D->Format()
|| anImage->SizeX() != anImage3D->SizeX()
|| anImage->SizeY() != anImage3D->SizeY()
|| anImage->SizeRowBytes() != anImage3D->SizeRowBytes())
{
Message::SendFail() << "Graphic3d_Texture3D::GetImage() slice " << aSlice << " from '" << aSlicePath << "' have different dimensions";
return Handle(Image_PixMap)();
}
memcpy (anImage3D->ChangeSlice (aSlice), anImage->Data(), anImage->SizeBytes());
}
return anImage3D;
}

View File

@@ -0,0 +1,51 @@
// Copyright (c) 2022 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Graphic3d_Texture3D_HeaderFile
#define _Graphic3d_Texture3D_HeaderFile
#include <Graphic3d_TextureMap.hxx>
#include <NCollection_Array1.hxx>
//! This abstract class for managing 3D textures.
class Graphic3d_Texture3D : public Graphic3d_TextureMap
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_Texture3D, Graphic3d_TextureMap)
public:
//! Creates a texture from a file.
Standard_EXPORT Graphic3d_Texture3D (const TCollection_AsciiString& theFileName);
//! Creates a texture from the pixmap.
Standard_EXPORT Graphic3d_Texture3D (const Handle(Image_PixMap)& thePixMap);
//! Creates a texture from a file.
Standard_EXPORT Graphic3d_Texture3D (const NCollection_Array1<TCollection_AsciiString>& theFiles);
//! Destructor.
Standard_EXPORT virtual ~Graphic3d_Texture3D();
//! Assign new image to the texture.
//! Note that this method does not invalidate already uploaded resources - consider calling ::UpdateRevision() if needed.
Standard_EXPORT void SetImage (const Handle(Image_PixMap)& thePixMap);
//! Load and return image.
Standard_EXPORT virtual Handle(Image_PixMap) GetImage (const Handle(Image_SupportedFormats)& theSupported) Standard_OVERRIDE;
protected:
NCollection_Array1<TCollection_AsciiString> myPaths;
};
#endif // _Graphic3d_Texture3D_HeaderFile

View File

@@ -42,9 +42,10 @@ static const char *NameOfTextureEnv_to_FileName[] =
// purpose :
// =======================================================================
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFileName)
: Graphic3d_TextureRoot (theFileName, Graphic3d_TOT_2D_MIPMAP),
: Graphic3d_TextureRoot (theFileName, Graphic3d_TypeOfTexture_2D),
myName (Graphic3d_NOT_ENV_UNKNOWN)
{
myHasMipmaps = true;
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),
@@ -56,9 +57,10 @@ Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFi
// purpose :
// =======================================================================
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv theNOT)
: Graphic3d_TextureRoot (NameOfTextureEnv_to_FileName[theNOT], Graphic3d_TOT_2D_MIPMAP),
: Graphic3d_TextureRoot (NameOfTextureEnv_to_FileName[theNOT], Graphic3d_TypeOfTexture_2D),
myName (theNOT)
{
myHasMipmaps = true;
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
myTexId = TCollection_AsciiString ("Graphic3d_TextureEnv_")
+ NameOfTextureEnv_to_FileName[theNOT];
@@ -74,9 +76,10 @@ Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv the
// purpose :
// =======================================================================
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Handle(Image_PixMap)& thePixMap)
: Graphic3d_TextureRoot (thePixMap, Graphic3d_TOT_2D_MIPMAP),
: Graphic3d_TextureRoot (thePixMap, Graphic3d_TypeOfTexture_2D),
myName (Graphic3d_NOT_ENV_UNKNOWN)
{
myHasMipmaps = true;
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
Graphic3d_Vec4 (1.0f, 0.0f, 0.0f, 0.0f),

View File

@@ -92,9 +92,10 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const TCollection_AsciiString& the
: myParams (new Graphic3d_TextureParams()),
myPath (theFileName),
myRevision (0),
myType (theType),
myType (theType == Graphic3d_TOT_2D_MIPMAP ? Graphic3d_TypeOfTexture_2D : theType),
myIsColorMap (true),
myIsTopDown (true)
myIsTopDown (true),
myHasMipmaps (theType == Graphic3d_TOT_2D_MIPMAP)
{
generateId();
}
@@ -108,9 +109,10 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const Handle(Image_PixMap)& theP
: myParams (new Graphic3d_TextureParams()),
myPixMap (thePixMap),
myRevision (0),
myType (theType),
myType (theType == Graphic3d_TOT_2D_MIPMAP ? Graphic3d_TypeOfTexture_2D : theType),
myIsColorMap (true),
myIsTopDown (true)
myIsTopDown (true),
myHasMipmaps (theType == Graphic3d_TOT_2D_MIPMAP)
{
generateId();
}
@@ -214,9 +216,9 @@ Handle(Image_PixMap) Graphic3d_TextureRoot::GetImage (const Handle(Image_Support
void Graphic3d_TextureRoot::convertToCompatible (const Handle(Image_SupportedFormats)& theSupported,
const Handle(Image_PixMap)& theImage)
{
if (theSupported.IsNull()
|| theSupported->IsSupported (theImage->Format())
|| theImage.IsNull())
if (theImage.IsNull()
|| theSupported.IsNull()
|| theSupported->IsSupported (theImage->Format()))
{
return;
}

View File

@@ -113,6 +113,12 @@ public:
//! Set flag indicating color nature of values within the texture.
void SetColorMap (Standard_Boolean theIsColor) { myIsColorMap = theIsColor; }
//! Returns whether mipmaps should be generated or not.
Standard_Boolean HasMipmaps() const { return myHasMipmaps; }
//! Sets whether to generate mipmaps or not.
void SetMipmapsGeneration (Standard_Boolean theToGenerateMipmaps) { myHasMipmaps = theToGenerateMipmaps; }
//! Returns whether row's memory layout is top-down.
Standard_Boolean IsTopDown() const { return myIsTopDown; }
@@ -148,7 +154,7 @@ protected:
Graphic3d_TypeOfTexture myType; //!< texture type
Standard_Boolean myIsColorMap; //!< flag indicating color nature of values within the texture
Standard_Boolean myIsTopDown; //!< Stores rows's memory layout
Standard_Boolean myHasMipmaps; //!< Indicates whether mipmaps should be generated or not
};

View File

@@ -20,10 +20,26 @@
//! Type of the texture file format.
enum Graphic3d_TypeOfTexture
{
Graphic3d_TOT_1D,
Graphic3d_TOT_2D,
Graphic3d_TOT_2D_MIPMAP,
Graphic3d_TOT_CUBEMAP
//! 1D texture (array).
//! Note that this texture type might be unsupported by graphics API (emulated by 2D texture with 1 pixel height).
Graphic3d_TypeOfTexture_1D,
//! 2D texture (image plane).
Graphic3d_TypeOfTexture_2D,
//! 3D texture (a set of image planes).
Graphic3d_TypeOfTexture_3D,
//! Cubemap texture (6 image planes defining cube sides).
Graphic3d_TypeOfTexture_CUBEMAP,
//! Obsolete type - Graphic3d_TextureRoot::SetMipmapsGeneration() should be used instead.
Graphic3d_TOT_2D_MIPMAP,
// old aliases
Graphic3d_TOT_1D = Graphic3d_TypeOfTexture_1D,
Graphic3d_TOT_2D = Graphic3d_TypeOfTexture_2D,
Graphic3d_TOT_CUBEMAP = Graphic3d_TypeOfTexture_CUBEMAP
};
#endif // _Graphic3d_TypeOfTexture_HeaderFile

View File

@@ -35,12 +35,7 @@
IMPLEMENT_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
IGESControl_ActorWrite::IGESControl_ActorWrite ()
{
ModeTrans() = 0;
myPrecRVal = Interface_Static::RVal("write.precision.val");
myMaxPrecRVal = Interface_Static::RVal("read.maxprecision.val");
}
IGESControl_ActorWrite::IGESControl_ActorWrite () { ModeTrans() = 0; }
Standard_Boolean IGESControl_ActorWrite::Recognize
(const Handle(Transfer_Finder)& start)
@@ -75,8 +70,8 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
if (shape.IsNull()) return NullResult();
// modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
Handle(Standard_Transient) info;
Standard_Real Tol = myPrecRVal;
Standard_Real maxTol = myMaxPrecRVal;
Standard_Real Tol = Interface_Static::RVal("write.precision.val");
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol,
"write.iges.resource.name",
"write.iges.sequence", info,
@@ -118,25 +113,3 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
return NullResult();
}
void IGESControl_ActorWrite::SetPrecRVal(const Standard_Real theVal)
{
Interface_Static::SetRVal("write.precision.val", theVal);
myPrecRVal = theVal;
}
void IGESControl_ActorWrite::SetMaxPrecRVal(const Standard_Real theVal)
{
Interface_Static::SetRVal("read.maxprecision.val", theVal);
myMaxPrecRVal = theVal;
}
Standard_Real IGESControl_ActorWrite::GetPrecRVal() const
{
return myPrecRVal;
}
Standard_Real IGESControl_ActorWrite::GetMaxPrecRVal() const
{
return myMaxPrecRVal;
}

View File

@@ -51,13 +51,8 @@ public:
const Handle(Transfer_FinderProcess)& FP,
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
Standard_EXPORT void SetPrecRVal(const Standard_Real theVal);
Standard_EXPORT void SetMaxPrecRVal(const Standard_Real theVal);
Standard_EXPORT Standard_Real GetPrecRVal() const;
Standard_EXPORT Standard_Real GetMaxPrecRVal() const;
DEFINE_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess)
@@ -68,8 +63,7 @@ protected:
private:
Standard_Real myPrecRVal;
Standard_Real myMaxPrecRVal;
};

View File

@@ -52,7 +52,6 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESControl_IGESBoundary,IGESToBRep_IGESBoundary)
//=======================================================================
IGESControl_IGESBoundary::IGESControl_IGESBoundary() : IGESToBRep_IGESBoundary()
{
myParModeIVal = Interface_Static::IVal("read.stdsameparameter.mode");
}
//=======================================================================
@@ -63,7 +62,6 @@ IGESControl_IGESBoundary::IGESControl_IGESBoundary() : IGESToBRep_IGESBoundary()
IGESControl_IGESBoundary::IGESControl_IGESBoundary(const IGESToBRep_CurveAndSurface& CS) :
IGESToBRep_IGESBoundary (CS)
{
myParModeIVal = Interface_Static::IVal("read.stdsameparameter.mode");
}
//=======================================================================
@@ -304,7 +302,7 @@ static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
#endif
}
//#74 rln 10.03.99 S4135: handling use of BRepLib::SameParameter by new static parameter
if (myParModeIVal) {
if (Interface_Static::IVal ("read.stdsameparameter.mode")) {
Standard_Real first, last;
BRep_Tool::Range(edge3d,first,last);
// pdn 08.04.99 S4135 optimizing in computation of SPTol
@@ -407,13 +405,3 @@ static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
return okCurve;
}
void IGESControl_IGESBoundary::SetParModeIVal(const Standard_Integer theVal)
{
Interface_Static::SetIVal("read.stdsameparameter.mode", theVal);
myParModeIVal = theVal;
}
Standard_Integer IGESControl_IGESBoundary::GetParModeIVal() const
{
return myParModeIVal;
}

View File

@@ -54,20 +54,12 @@ public:
//! wire to contain only closed representation.
Standard_EXPORT virtual void Check (const Standard_Boolean result, const Standard_Boolean checkclosure, const Standard_Boolean okCurve3d, const Standard_Boolean okCurve2d) Standard_OVERRIDE;
Standard_EXPORT void SetParModeIVal(const Standard_Integer theVal);
Standard_EXPORT Standard_Integer GetParModeIVal() const;
DEFINE_STANDARD_RTTIEXT(IGESControl_IGESBoundary,IGESToBRep_IGESBoundary)
protected:
Standard_EXPORT virtual Standard_Boolean Transfer (Standard_Boolean& okCurve, Standard_Boolean& okCurve3d, Standard_Boolean& okCurve2d, const Handle(IGESData_IGESEntity)& icurve3d, const Handle(ShapeExtend_WireData)& scurve3d, const Standard_Boolean usescurve, const Standard_Boolean toreverse3d, const Handle(IGESData_HArray1OfIGESEntity)& curves2d, const Standard_Boolean toreverse2d, const Standard_Integer number, Handle(ShapeExtend_WireData)& lsewd) Standard_OVERRIDE;
private:
Standard_Integer myParModeIVal;
};
#endif // _IGESControl_IGESBoundary_HeaderFile

View File

@@ -61,7 +61,7 @@ IGESControl_Reader::IGESControl_Reader ()
SetWS (new XSControl_WorkSession);
SetNorm("IGES");
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
myOnlyVisIVal = (onlyvisible == 1);
theReadOnlyVisible = (onlyvisible == 1);
}
@@ -77,7 +77,7 @@ IGESControl_Reader::IGESControl_Reader
SetWS (WS,scratch);
SetNorm ("IGES");
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
myOnlyVisIVal = (onlyvisible == 1);
theReadOnlyVisible = (onlyvisible == 1);
}
@@ -114,14 +114,14 @@ Standard_Integer IGESControl_Reader::NbRootsForTransfer()
Interface_ShareFlags SH (model,protocol);
// sln 11.06.2002 OCC448
Interface_Static::SetIVal("read.iges.onlyvisible",myOnlyVisIVal);
Interface_Static::SetIVal("read.iges.onlyvisible",theReadOnlyVisible);
Standard_Integer nb = model->NbEntities();
for (Standard_Integer i = 1; i <= nb; i ++) {
Handle(IGESData_IGESEntity) ent = model->Entity(i);
if ( SH.IsShared(ent) || ! actor->Recognize (ent) ) continue;
// on ajoute un traitement pour ne prendre que les entites visibles
if ( ! myOnlyVisIVal || ent->BlankStatus() == 0 ) {
if ( ! theReadOnlyVisible || ent->BlankStatus() == 0 ) {
theroots.Append(ent);
}
}
@@ -320,14 +320,3 @@ void IGESControl_Reader::PrintTransferInfo
}
}
}
void IGESControl_Reader::SetOnlyVisibleIVal(const Standard_Integer theVal)
{
Interface_Static::SetIVal("read.iges.onlyvisible", theVal);
myOnlyVisIVal = theVal;
}
Standard_Integer IGESControl_Reader::GetOnlyVisibleIVal() const
{
return myOnlyVisIVal;
}

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