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

Compare commits

..

1 Commits

Author SHA1 Message Date
oan
cb2e41f927 Exact intersection of discrete segments 2019-11-04 22:04:04 +03:00
109 changed files with 1746 additions and 1289 deletions

View File

@@ -130,9 +130,7 @@ elseif ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
if (APPLE)
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
elseif(NOT WIN32)
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
# does not support option "-std=c++0x"
else()
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif()
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)

View File

@@ -82,11 +82,6 @@ if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Micr
lappend ::SYS_VC_LIST "vc142-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
lappend ::SYS_VC_LIST "vclang"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
# detect installed Visual Studio instances from global environment
if { [info exists ::env(VS140COMNTOOLS)] } {

View File

@@ -241,11 +241,7 @@ proc wokdep:Preferred {theList theCmpl theArch} {
# keep only two first digits in "vc141"
if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
if { [regexp {^vclang} $theCmpl] } {
set aCmpl vc14
} else {
set aCmpl $theCmpl
}
set aCmpl $theCmpl
}
set aShortList {}
@@ -635,11 +631,7 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
# keep only two first digits in "vc141"
if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
if { [regexp {^vclang} ${::VCVER}] } {
set aVcLib vc14
} else {
set aVcLib ${::VCVER}
}
set aVcLib ${::VCVER}
}
set isFound "true"

View File

@@ -256,7 +256,7 @@ proc genAllResources {} {
# Wrapper-function to generate VS project files
proc genproj {theFormat args} {
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vclang" "cbp" "xcd" "pro"}
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "cbp" "xcd" "pro"}
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false
@@ -320,7 +320,6 @@ proc genproj {theFormat args} {
vc14 - Visual Studio 2015
vc141 - Visual Studio 2017
vc142 - Visual Studio 2019
vclang - Visual Studio with ClangCL toolset
cbp - CodeBlocks
xcd - XCode
pro - Qt Creator
@@ -530,8 +529,7 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution }
"vc12" -
"vc14" -
"vc141" -
"vc142" -
"vclang" { OS:MKVC $anOutDir $aModules $theSolution $theFormat $isUWP}
"vc142" { OS:MKVC $anOutDir $aModules $theSolution $theFormat $isUWP}
"cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
@@ -986,8 +984,7 @@ proc osutils:vcsolution:header { vcversion } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2013\n"
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" ||
"$vcversion" == "vc142" || "$vcversion" == "vclang" } {
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || "$vcversion" == "vc142" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n"
@@ -1228,9 +1225,6 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
} elseif { $theVcVer == "vc142" } {
set aVCRTVer "vc14"
set aToolset "v142"
} elseif { $theVcVer == "vclang" } {
set aVCRTVer "vc14"
set aToolset "ClangCL"
}
set what "$theVcVer"

View File

@@ -77,9 +77,6 @@ if "%VCVER:~-4%" == "-uwp" (
set VCLIB=%VCLIB%-uwp
set VCPROP=Universal
)
if "%VCFMT%" == "vclang" (
set VCLIB=vc14
)
rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%
rem ----- Parsing of Visual Studio platform -----
@@ -109,10 +106,6 @@ if not "%DevEnvDir%" == "" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
@@ -125,7 +118,6 @@ if not "%DevEnvDir%" == "" (
echo vc14 = VS 2015
echo vc141 = VS 2017
echo vc142 = VS 2019
echo vclang = VS 2019 with ClangCL toolset
exit /B
)
@@ -155,11 +147,6 @@ if /I "%VCFMT%" == "vc9" (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=ClangCL"
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (

View File

@@ -368,53 +368,3 @@ Each counter has its name shown when the collected statistics are printed.
In DRAW, use command *dperf* to print all performance statistics.
Note that performance counters are not thread-safe.
@section occt_debug_sanitizers Use of compiler sanitizers
GCC and Clang compilers provide options for instrumenting the code with the tools intended for detection of run-time errors, called sanitizers.
This section provides some hints for using sanitizers for detecting possible errors in OCCT code.
@subsection occt_debug_sanitizers_linux Linux
Example of configuration steps for Ubuntu:
1. In CMake configuration:
- Use up-to-date version of the GCC or CLang compiler; make sure that if CMAKE_CXX_COMPILER is set to C++ compiler (e.g. "clang++-6.0") and CMAKE_C_COMPILER is set to C compiler (e.g. "clang-6.0")
- Ensure that CMAKE_LINKER is set to the C++ linker bundled with compiler (e.g. clang++-6.0); this is important to avoid linking problems
- For building with Address sanitizer, set CMAKE_CXX_FLAGS and CMAKE_C_FLAGS to "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls"
- For building with Undefined Behavior sanitizer, set CMAKE_CXX_FLAGS and CMAKE_C_FLAGS to "-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls"
- Set CMAKE_BUILD_TYPE to RelWithDebInfo to get more informative stack traces on errors
2. Build as usual (make)
Be prepared that it works much slower than normal build and consumes more disk space.
3. Before running executable, make sure that "llvm-symbolizer" is in PATH; this is necessary to get human-readable stack traces. The tool must have exactly that name.
If it is installed in common folder (/usr/bin or similar) with different name, one option is to create a symlink, for instance:
> sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer
Alternatively, add directory where actual llvm-symbolizer is located (such as /usr/lib/llvm-6.0/bin) to the PATH variable.
4. Set environment variable to disable memory leaks detection (they seem to be reported for every global variable at exit, not much useful):
> export ASAN_OPTIONS=detect_leaks=0
5. Set environment variable CSF_CPULIMIT_FACTOR to reasonably large number to increase the time limits for program execution (used by OCCT tests) to compensate the performance penalty introduced by sanitizers:
> export CSF_CPULIMIT_FACTOR=20
6. When using UBSan, set environment variable UBSAN_OPTIONS to get stack traces:
> export UBSAN_OPTIONS=print_stacktrace=1
7. Run DRAW and perform tests as usual, keeping in mind that running with sanitizer is much heavier than normal build:
> ./draw.sh relwithdeb <br>
> Draw[]> testgrid -parallel 0
Note that when running tests under sanitizers, behavior may be different.
Known problems (as of CLang 6.0) are:
- Software signals (access violation etc.) are not handled
- Heap memory usage always reports zero
@subsection occt_debug_sanitizers_windows Windows
Though CLang toolset is available in Visual Studio 2015 and newer, sanitizer do not seem to be available out of the box (last tested with VS 2019 16.2.3).

View File

@@ -210,7 +210,7 @@ for which OCCT is certified to work.
| OS | Compiler |
| --------- | ----------- |
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br> GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer |
| Android | NDK r10, GNU gcc 4.8 or newer |

View File

@@ -65,7 +65,7 @@ public:
//! Returns true if the Interactive Objects in the relation
//! are movable.
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE { return Standard_True; }
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
//! computes the presentation according to a point of view
//! given by <aProjector>.
@@ -109,4 +109,6 @@ private:
};
#include <AIS_FixRelation.lxx>
#endif // _AIS_FixRelation_HeaderFile

View File

@@ -0,0 +1,24 @@
// Created on: 1997-02-28
// Created by: Jean-Pierre COMBE
// 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.
//=======================================================================
//function : IsMovable
//purpose :
//=======================================================================
inline Standard_Boolean AIS_FixRelation::IsMovable() const
{
return Standard_True;
}

View File

@@ -58,7 +58,7 @@ public:
void ClearUsers() { myUsers.Clear(); }
//! Returns true if the interactive object is movable.
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE { return Standard_True; }
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
//! computes the presentation according to a point of view
//! given by <aProjector>.
@@ -134,4 +134,11 @@ private:
};
#include <AIS_IdenticRelation.lxx>
#endif // _AIS_IdenticRelation_HeaderFile

View File

@@ -0,0 +1,24 @@
// Created on: 1997-03-04
// Created by: Jean-Pierre COMBE
// 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.
//=======================================================================
//function : IsMovable
//purpose :
//=======================================================================
inline Standard_Boolean AIS_IdenticRelation::IsMovable() const
{
return Standard_True;
}

View File

@@ -69,12 +69,14 @@ AIS_ExclusionFilter.hxx
AIS_ExclusionFilter.lxx
AIS_FixRelation.cxx
AIS_FixRelation.hxx
AIS_FixRelation.lxx
AIS_GlobalStatus.cxx
AIS_GlobalStatus.hxx
AIS_GraphicTool.cxx
AIS_GraphicTool.hxx
AIS_IdenticRelation.cxx
AIS_IdenticRelation.hxx
AIS_IdenticRelation.lxx
AIS_IndexedDataMapOfOwnerPrs.hxx
AIS_InteractiveContext.cxx
AIS_InteractiveContext.hxx

View File

@@ -16,8 +16,12 @@
#define AdvApp2Var_SysBase_HeaderFile
#include <Standard_Macro.hxx>
#include <Standard_TypeDef.hxx>
#include <AdvApp2Var_Data_f2c.hxx>
#if _MSC_VER
#include <stddef.h>
#else
#include <stdint.h>
#endif
class AdvApp2Var_SysBase {
public:

View File

@@ -96,21 +96,21 @@ public:
protected:
//! Filter out correct adjacent mesh elements.
Standard_EXPORT virtual BRepExtrema_ElementFilter::FilterResult PreCheckElements (const Standard_Integer theIndex1,
const Standard_Integer theIndex2);
virtual BRepExtrema_ElementFilter::FilterResult PreCheckElements (const Standard_Integer theIndex1,
const Standard_Integer theIndex2);
//! Checks if the given triangles have only single common vertex.
Standard_EXPORT BRepExtrema_ElementFilter::FilterResult isRegularSharedVertex (const BVH_Vec3d& theSharedVert,
const BVH_Vec3d& theTrng1Vtxs1,
const BVH_Vec3d& theTrng1Vtxs2,
const BVH_Vec3d& theTrng2Vtxs1,
const BVH_Vec3d& theTrng2Vtxs2);
BRepExtrema_ElementFilter::FilterResult isRegularSharedVertex (const BVH_Vec3d& theSharedVert,
const BVH_Vec3d& theTrng1Vtxs1,
const BVH_Vec3d& theTrng1Vtxs2,
const BVH_Vec3d& theTrng2Vtxs1,
const BVH_Vec3d& theTrng2Vtxs2);
//! Checks if the given triangles have only single common edge.
Standard_EXPORT BRepExtrema_ElementFilter::FilterResult isRegularSharedEdge (const BVH_Vec3d& theTrng1Vtxs0,
const BVH_Vec3d& theTrng1Vtxs1,
const BVH_Vec3d& theTrng1Vtxs2,
const BVH_Vec3d& theTrng2Vtxs2);
BRepExtrema_ElementFilter::FilterResult isRegularSharedEdge (const BVH_Vec3d& theTrng1Vtxs0,
const BVH_Vec3d& theTrng1Vtxs1,
const BVH_Vec3d& theTrng1Vtxs2,
const BVH_Vec3d& theTrng2Vtxs2);
private:

View File

@@ -78,10 +78,14 @@ public:
protected:
//! Computes parametric tolerance taking length along U and V into account.
Standard_EXPORT virtual void computeTolerance (const Standard_Real theLenU, const Standard_Real theLenV);
virtual void computeTolerance(
const Standard_Real theLenU,
const Standard_Real theLenV);
//! Computes parametric delta taking length along U and V and value of tolerance into account.
Standard_EXPORT virtual void computeDelta (const Standard_Real theLengthU, const Standard_Real theLengthV);
virtual void computeDelta(
const Standard_Real theLengthU,
const Standard_Real theLengthV);
public:
//! Returns face model.

View File

@@ -2434,8 +2434,9 @@ BRepMesh_GeomTool::IntFlag BRepMesh_Delaun::intSegSeg(
p3 = GetVertex( theEdg2.FirstNode() ).Coord();
p4 = GetVertex( theEdg2.LastNode() ).Coord();
Standard_Real aIntParams[2];
return BRepMesh_GeomTool::IntSegSeg(p1, p2, p3, p4,
isConsiderEndPointTouch, isConsiderPointOnEdge, theIntPnt);
isConsiderEndPointTouch, isConsiderPointOnEdge, theIntPnt, aIntParams);
}
//=============================================================================

View File

@@ -19,191 +19,6 @@
#include <OSD_Parallel.hxx>
#include <BRepMesh_GeomTool.hxx>
namespace
{
const Standard_Real MaxTangentAngle = 5. * M_PI / 180.;
//! Functor to be used to fill segments and bounding box tree in parallel.
class SegmentsFiller
{
public:
//! Constructor.
SegmentsFiller(const IMeshData::IFaceHandle& theDFace,
Handle(BRepMesh_FaceChecker::ArrayOfSegments)& theWiresSegments,
Handle(BRepMesh_FaceChecker::ArrayOfBndBoxTree)& theWiresBndBoxTree)
: myDFace(theDFace),
myWiresSegments(theWiresSegments),
myWiresBndBoxTree(theWiresBndBoxTree)
{
myWiresSegments = new BRepMesh_FaceChecker::ArrayOfSegments (0, myDFace->WiresNb() - 1);
myWiresBndBoxTree = new BRepMesh_FaceChecker::ArrayOfBndBoxTree (0, myDFace->WiresNb() - 1);
}
//! Performs initialization of wire with the given index.
void operator()(const Standard_Integer theWireIndex) const
{
const IMeshData::IWireHandle& aDWire = myDFace->GetWire(theWireIndex);
Handle(NCollection_IncAllocator) aTmpAlloc1 = new NCollection_IncAllocator();
Handle(BRepMesh_FaceChecker::Segments) aSegments =
new BRepMesh_FaceChecker::Segments(aDWire->EdgesNb(), aTmpAlloc1);
Handle(IMeshData::BndBox2dTree) aBndBoxTree = new IMeshData::BndBox2dTree(aTmpAlloc1);
myWiresSegments ->ChangeValue(theWireIndex) = aSegments;
myWiresBndBoxTree->ChangeValue(theWireIndex) = aBndBoxTree;
Handle(NCollection_IncAllocator) aTmpAlloc2 = new NCollection_IncAllocator();
IMeshData::BndBox2dTreeFiller aBndBoxTreeFiller(*aBndBoxTree, aTmpAlloc2);
for (Standard_Integer aEdgeIt = 0; aEdgeIt < aDWire->EdgesNb(); ++aEdgeIt)
{
// TODO: check 2d wire for consistency.
const IMeshData::IEdgePtr& aDEdge = aDWire->GetEdge(aEdgeIt);
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(myDFace.get(), aDWire->GetEdgeOrientation(aEdgeIt));
for (Standard_Integer aPointIt = 1; aPointIt < aPCurve->ParametersNb(); ++aPointIt)
{
gp_Pnt2d& aPnt1 = aPCurve->GetPoint(aPointIt - 1);
gp_Pnt2d& aPnt2 = aPCurve->GetPoint(aPointIt);
Bnd_Box2d aBox;
aBox.Add(aPnt1);
aBox.Add(aPnt2);
aBox.Enlarge(Precision::Confusion());
aBndBoxTreeFiller.Add(aSegments->Size(), aBox);
aSegments->Append(BRepMesh_FaceChecker::Segment(aDEdge, &aPnt1, &aPnt2));
}
}
aBndBoxTreeFiller.Fill();
}
private:
SegmentsFiller (const SegmentsFiller& theOther);
void operator=(const SegmentsFiller& theOther);
private:
const IMeshData::IFaceHandle& myDFace;
Handle(BRepMesh_FaceChecker::ArrayOfSegments)& myWiresSegments;
Handle(BRepMesh_FaceChecker::ArrayOfBndBoxTree)& myWiresBndBoxTree;
};
//! Selector.
//! Used to identify segments with overlapped bounding boxes.
class BndBox2dTreeSelector : public IMeshData::BndBox2dTree::Selector
{
public:
//! Constructor.
BndBox2dTreeSelector(const Standard_Real theTolerance)
: myMaxLoopSize(M_PI * theTolerance * theTolerance),
mySelfSegmentIndex(-1),
myIndices(256, new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE))
{
}
//! Sets working set of segments.
void SetSegments(const Handle(BRepMesh_FaceChecker::Segments)& theSegments)
{
mySegments = theSegments;
}
//! Resets current selector.
void Reset(const BRepMesh_FaceChecker::Segment* theSegment,
const Standard_Integer theSelfSegmentIndex)
{
myIndices.Clear();
mySelfSegmentIndex = theSelfSegmentIndex;
mySegment = theSegment;
myBox.SetVoid();
myBox.Add(*mySegment->Point1);
myBox.Add(*mySegment->Point2);
myBox.Enlarge(Precision::Confusion());
}
//! Indicates should the given box be rejected or not.
virtual Standard_Boolean Reject(const Bnd_Box2d& theBox) const
{
return myBox.IsOut(theBox);
}
//! Accepts segment with the given index in case if it fits conditions.
virtual Standard_Boolean Accept(const Standard_Integer& theSegmentIndex)
{
const BRepMesh_FaceChecker::Segment& aSegment = mySegments->Value(theSegmentIndex);
gp_Pnt2d aIntPnt;
const BRepMesh_GeomTool::IntFlag aIntStatus = BRepMesh_GeomTool::IntSegSeg(
mySegment->Point1->XY(), mySegment->Point2->XY(),
aSegment.Point1->XY(), aSegment.Point2->XY(),
Standard_False, Standard_False, aIntPnt);
if (aIntStatus == BRepMesh_GeomTool::Cross)
{
const Standard_Real aAngle = gp_Vec2d(mySegment->Point1->XY(), mySegment->Point2->XY()).Angle(
gp_Vec2d(aSegment.Point1->XY(), aSegment.Point2->XY()));
if (Abs(aAngle) < MaxTangentAngle)
{
return Standard_False;
}
if (mySelfSegmentIndex != -1)
{
gp_XY aPrevVec;
Standard_Real aSumS = 0.;
const gp_XY& aRefPnt = aIntPnt.Coord();
for (Standard_Integer i = mySelfSegmentIndex; i < theSegmentIndex; ++i)
{
const BRepMesh_FaceChecker::Segment& aCurrSegment = mySegments->Value(i);
gp_XY aCurVec = aCurrSegment.Point2->XY() - aRefPnt;
if (aCurVec.SquareModulus() < gp::Resolution())
continue;
if (aPrevVec.SquareModulus() > gp::Resolution())
aSumS += aPrevVec ^ aCurVec;
aPrevVec = aCurVec;
}
if (Abs(aSumS / 2.) < myMaxLoopSize)
{
return Standard_False;
}
}
myIndices.Append(theSegmentIndex);
return Standard_True;
}
return Standard_False;
}
//! Returns indices of intersecting segments.
const IMeshData::VectorOfInteger& Indices() const
{
return myIndices;
}
private:
Standard_Real myMaxLoopSize;
Standard_Integer mySelfSegmentIndex;
Handle(BRepMesh_FaceChecker::Segments) mySegments;
const BRepMesh_FaceChecker::Segment* mySegment;
Bnd_Box2d myBox;
IMeshData::VectorOfInteger myIndices;
};
}
//=======================================================================
//function : Constructor
//purpose :
@@ -211,8 +26,7 @@ namespace
BRepMesh_FaceChecker::BRepMesh_FaceChecker(
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters)
: myDFace(theFace),
myParameters(theParameters)
: BRepMesh_SegmentedFace (theFace, theParameters)
{
}
@@ -230,50 +44,39 @@ BRepMesh_FaceChecker::~BRepMesh_FaceChecker()
//=======================================================================
Standard_Boolean BRepMesh_FaceChecker::Perform()
{
myIntersectingEdges = new IMeshData::MapOfIEdgePtr;
collectSegments();
myIntersectingEdges = new IMeshData::MapOfIEdgePtr;
myWiresIntersectingEdges = new ArrayOfMapOfIEdgePtr(0, myDFace->WiresNb() - 1);
OSD_Parallel::For(0, myDFace->WiresNb(), *this, !isParallel());
collectResult();
myWiresBndBoxTree.Nullify();
myWiresSegments.Nullify();
myWiresBndBoxTree .Nullify();
myWiresSegments .Nullify();
myWiresIntersectingEdges.Nullify();
return myIntersectingEdges->IsEmpty();
}
//=======================================================================
//function : collectSegments
//purpose :
//=======================================================================
void BRepMesh_FaceChecker::collectSegments()
{
SegmentsFiller aSegmentsFiller(myDFace, myWiresSegments, myWiresBndBoxTree);
OSD_Parallel::For(0, myDFace->WiresNb(), aSegmentsFiller, !isParallel());
myWiresIntersectingEdges = new ArrayOfMapOfIEdgePtr(0, myDFace->WiresNb() - 1);
}
//=======================================================================
//function : perform
//purpose :
//=======================================================================
void BRepMesh_FaceChecker::perform(const Standard_Integer theWireIndex) const
{
const Handle(Segments)& aSegments1 = myWiresSegments->Value(theWireIndex);
const Handle(Segments)& aSegments1 = myWiresSegments ->Value (theWireIndex);
Handle(IMeshData::MapOfIEdgePtr)& aIntersections = myWiresIntersectingEdges->ChangeValue(theWireIndex);
// TODO: Tolerance is set to twice value of face deflection in order to fit regressions.
BndBox2dTreeSelector aSelector(2 * myDFace->GetDeflection());
BRepMesh_SegmentedFace::BndBox2dTreeSelector aSelector (Standard_False);
for (Standard_Integer aWireIt = theWireIndex; aWireIt < myDFace->WiresNb(); ++aWireIt)
{
const Handle(IMeshData::BndBox2dTree)& aBndBoxTree2 = myWiresBndBoxTree->Value(aWireIt);
const Handle(Segments)& aSegments2 = myWiresSegments->Value(aWireIt);
const Handle(Segments)& aSegments2 = myWiresSegments ->Value(aWireIt);
aSelector.SetSegments(aSegments2);
for (Standard_Integer aSegmentIt = 0; aSegmentIt < aSegments1->Size(); ++aSegmentIt)
{
const BRepMesh_FaceChecker::Segment& aSegment1 = aSegments1->Value(aSegmentIt);
const BRepMesh_SegmentedFace::Segment& aSegment1 = aSegments1->Value(aSegmentIt);
aSelector.Reset(&aSegment1, (aWireIt == theWireIndex) ? aSegmentIt : -1);
if (aBndBoxTree2->Select(aSelector) != 0)
{
@@ -287,7 +90,7 @@ void BRepMesh_FaceChecker::perform(const Standard_Integer theWireIndex) const
const IMeshData::VectorOfInteger& aSegments = aSelector.Indices();
for (Standard_Integer aSelIt = 0; aSelIt < aSegments.Size(); ++aSelIt)
{
const BRepMesh_FaceChecker::Segment& aSegment2 = aSegments2->Value(aSegments(aSelIt));
const BRepMesh_SegmentedFace::Segment& aSegment2 = aSegments2->Value(aSegments(aSelIt));
aIntersections->Add(aSegment2.EdgePtr);
}
}

View File

@@ -16,49 +16,18 @@
#ifndef _BRepMesh_FaceChecker_HeaderFile
#define _BRepMesh_FaceChecker_HeaderFile
#include <IMeshTools_Parameters.hxx>
#include <Standard_Transient.hxx>
#include <IMeshData_Face.hxx>
#include <Standard_Type.hxx>
#include <NCollection_Shared.hxx>
#include <BRepMesh_SegmentedFace.hxx>
//! Auxiliary class checking wires of target face for self-intersections.
//! Explodes wires of discrete face on sets of segments using tessellation
//! data stored in model. Each segment is then checked for intersection with
//! other ones. All collisions are registerd and returned as result of check.
class BRepMesh_FaceChecker : public Standard_Transient
class BRepMesh_FaceChecker : public BRepMesh_SegmentedFace
{
public: //! @name mesher API
//! Identifies segment inside face.
struct Segment
{
IMeshData::IEdgePtr EdgePtr;
gp_Pnt2d* Point1; // \ Use explicit pointers to points instead of accessing
gp_Pnt2d* Point2; // / using indices.
Segment()
: Point1(NULL)
, Point2(NULL)
{
}
Segment(const IMeshData::IEdgePtr& theEdgePtr,
gp_Pnt2d* thePoint1,
gp_Pnt2d* thePoint2)
: EdgePtr(theEdgePtr)
, Point1(thePoint1)
, Point2(thePoint2)
{
}
};
typedef NCollection_Shared<NCollection_Vector<Segment> > Segments;
typedef NCollection_Shared<NCollection_Array1<Handle(Segments)> > ArrayOfSegments;
typedef NCollection_Shared<NCollection_Array1<Handle(IMeshData::BndBox2dTree)> > ArrayOfBndBoxTree;
typedef NCollection_Shared<NCollection_Array1<Handle(IMeshData::MapOfIEdgePtr)> > ArrayOfMapOfIEdgePtr;
//! Default constructor
Standard_EXPORT BRepMesh_FaceChecker(const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters);
@@ -82,19 +51,10 @@ public: //! @name mesher API
perform(theWireIndex);
}
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceChecker, Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceChecker, BRepMesh_SegmentedFace)
private:
//! Returns True in case if check can be performed in parallel mode.
inline Standard_Boolean isParallel() const
{
return (myParameters.InParallel && myDFace->WiresNb() > 1);
}
//! Collects face segments.
void collectSegments();
//! Collects intersecting edges.
void collectResult();
@@ -109,11 +69,6 @@ private:
private:
IMeshData::IFaceHandle myDFace;
const IMeshTools_Parameters& myParameters;
Handle(ArrayOfSegments) myWiresSegments;
Handle(ArrayOfBndBoxTree) myWiresBndBoxTree;
Handle(ArrayOfMapOfIEdgePtr) myWiresIntersectingEdges;
Handle(IMeshData::MapOfIEdgePtr) myIntersectingEdges;

View File

@@ -0,0 +1,100 @@
// Created on: 2016-07-04
// Copyright (c) 2016 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 <BRepMesh_FaceIntersectionsSplitter.hxx>
#include <IMeshData_Wire.hxx>
#include <IMeshData_Edge.hxx>
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepMesh_FaceIntersectionsSplitter::BRepMesh_FaceIntersectionsSplitter(
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters)
: BRepMesh_SegmentedFace (theFace, theParameters)
{
}
//=======================================================================
//function : Destructor
//purpose :
//=======================================================================
BRepMesh_FaceIntersectionsSplitter::~BRepMesh_FaceIntersectionsSplitter()
{
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
Standard_Boolean BRepMesh_FaceIntersectionsSplitter::Perform()
{
for (Standard_Integer aWireIt = 0; aWireIt < myDFace->WiresNb(); ++aWireIt)
{
Standard_Boolean isSplit = Standard_True;
while (isSplit)
{
collectSegments();
isSplit = perform(aWireIt);
myWiresSegments .Nullify();
myWiresBndBoxTree.Nullify();
}
}
return Standard_False;
}
//=======================================================================
//function : perform
//purpose :
//=======================================================================
Standard_Boolean BRepMesh_FaceIntersectionsSplitter::perform(
const Standard_Integer theWireIndex)
{
const Handle(Segments)& aSegments1 = myWiresSegments->Value (theWireIndex);
BRepMesh_SegmentedFace::BndBox2dTreeSelector aSelector (Standard_True);
for (Standard_Integer aWireIt = theWireIndex; aWireIt < myDFace->WiresNb(); ++aWireIt)
{
const Handle(IMeshData::BndBox2dTree)& aBndBoxTree2 = myWiresBndBoxTree->Value(aWireIt);
const Handle(Segments)& aSegments2 = myWiresSegments ->Value(aWireIt);
aSelector.SetSegments(aSegments2);
for (Standard_Integer aSegmentIt = 0; aSegmentIt < aSegments1->Size(); ++aSegmentIt)
{
const BRepMesh_SegmentedFace::Segment& aSegment1 = aSegments1->Value(aSegmentIt);
aSelector.Reset(&aSegment1, (aWireIt == theWireIndex) ? aSegmentIt : -1);
if (aBndBoxTree2->Select(aSelector) != 0)
{
const IMeshData::VectorOfInteger& aSegments = aSelector.Indices();
const BRepMesh_SegmentedFace::VectorOfIntersectionParams& aIntParams = aSelector.IntParams();
for (Standard_Integer aSelIt = 0; aSelIt < aSegments.Size(); ++aSelIt)
{
const BRepMesh_SegmentedFace::Segment& aSegment2 = aSegments2->Value(aSegments(aSelIt));
//aIntersections->Add(aSegment1.EdgePtr);
//aIntersections->Add(aSegment2.EdgePtr);
}
//return Standard_False;
}
}
}
return Standard_False;
}

View File

@@ -0,0 +1,55 @@
// Created on: 2016-07-04
// Copyright (c) 2016 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 _BRepMesh_FaceIntersectionsSplitter_HeaderFile
#define _BRepMesh_FaceIntersectionsSplitter_HeaderFile
#include <BRepMesh_SegmentedFace.hxx>
//! Auxiliary class splitting intersecting segments of wires of target face.
//! Explodes wires of discrete face on sets of segments using tessellation
//! data stored in model. Each segment is then checked for intersection with
//! other ones and split on intersection point.
class BRepMesh_FaceIntersectionsSplitter : public BRepMesh_SegmentedFace
{
public: //! @name mesher API
//! Default constructor
Standard_EXPORT BRepMesh_FaceIntersectionsSplitter(
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters);
//! Destructor
Standard_EXPORT virtual ~BRepMesh_FaceIntersectionsSplitter();
//! Performs split of intersecting segments of wires of the face.
//! @return True if there is no intersection, False elsewhere.
Standard_EXPORT Standard_Boolean Perform();
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceIntersectionsSplitter, BRepMesh_SegmentedFace)
private:
//! Splits wire with the given index at first intersection point with others.
Standard_Boolean perform(const Standard_Integer theWireIndex);
private:
BRepMesh_FaceIntersectionsSplitter (const BRepMesh_FaceIntersectionsSplitter& theOther);
void operator=(const BRepMesh_FaceIntersectionsSplitter& theOther);
};
#endif

View File

@@ -333,7 +333,8 @@ BRepMesh_GeomTool::IntFlag BRepMesh_GeomTool::IntSegSeg(
const gp_XY& theEndPnt2,
const Standard_Boolean isConsiderEndPointTouch,
const Standard_Boolean isConsiderPointOnSegment,
gp_Pnt2d& theIntPnt)
gp_Pnt2d& theIntPnt,
Standard_Real (&theParamOnSegment)[2])
{
Standard_Integer aPointHash[] = {
classifyPoint(theStartPnt1, theEndPnt1, theStartPnt2),
@@ -393,9 +394,8 @@ BRepMesh_GeomTool::IntFlag BRepMesh_GeomTool::IntSegSeg(
else if ( aPosHash == 2 )
return BRepMesh_GeomTool::Glued;
Standard_Real aParam[2];
IntFlag aIntFlag = IntLinLin(theStartPnt1, theEndPnt1,
theStartPnt2, theEndPnt2, theIntPnt.ChangeCoord(), aParam);
theStartPnt2, theEndPnt2, theIntPnt.ChangeCoord(), theParamOnSegment);
if (aIntFlag == BRepMesh_GeomTool::NoIntersection)
return BRepMesh_GeomTool::NoIntersection;
@@ -416,7 +416,7 @@ BRepMesh_GeomTool::IntFlag BRepMesh_GeomTool::IntSegSeg(
const Standard_Real aEndPrec = 1 - aPrec;
for (Standard_Integer i = 0; i < 2; ++i)
{
if(aParam[i] < aPrec || aParam[i] > aEndPrec )
if(theParamOnSegment[i] < aPrec || theParamOnSegment[i] > aEndPrec )
return BRepMesh_GeomTool::NoIntersection;
}

View File

@@ -194,7 +194,8 @@ public: //! @name static API
const gp_XY& theEndPnt2,
const Standard_Boolean isConsiderEndPointTouch,
const Standard_Boolean isConsiderPointOnSegment,
gp_Pnt2d& theIntPnt);
gp_Pnt2d& theIntPnt,
Standard_Real (&theParamOnSegment)[2]);
//! Compute deflection of the given segment.
static Standard_Real SquareDeflectionOfSegment(

View File

@@ -108,18 +108,15 @@ void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theCont
myStatus = IMeshData_NoError;
const Handle(IMeshData_Model)& aModel = theContext->GetModel();
if (!aModel.IsNull())
for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
{
for (Standard_Integer aFaceIt = 0; aFaceIt < aModel->FacesNb(); ++aFaceIt)
{
const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
myStatus |= aDFace->GetStatusMask();
const IMeshData::IFaceHandle& aDFace = aModel->GetFace(aFaceIt);
myStatus |= aDFace->GetStatusMask();
for (Standard_Integer aWireIt = 0; aWireIt < aDFace->WiresNb(); ++aWireIt)
{
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(aWireIt);
myStatus |= aDWire->GetStatusMask();
}
for (Standard_Integer aWireIt = 0; aWireIt < aDFace->WiresNb(); ++aWireIt)
{
const IMeshData::IWireHandle& aDWire = aDFace->GetWire(aWireIt);
myStatus |= aDWire->GetStatusMask();
}
}

View File

@@ -17,6 +17,7 @@
#include <BRepMesh_Deflection.hxx>
#include <BRepMesh_ShapeTool.hxx>
#include <BRepMesh_FaceChecker.hxx>
#include <BRepMesh_FaceIntersectionsSplitter.hxx>
#include <BRepMesh_EdgeDiscret.hxx>
#include <IMeshData_Face.hxx>
#include <IMeshData_Wire.hxx>
@@ -150,7 +151,12 @@ Standard_Boolean BRepMesh_ModelHealer::performInternal(
{
const IMeshData::IFaceHandle aDFace = aFaceIt.Key();
aDFace->SetStatus(IMeshData_SelfIntersectingWire);
aDFace->SetStatus(IMeshData_Failure);
BRepMesh_FaceIntersectionsSplitter aSplitter (aDFace, myParameters);
if (!aSplitter.Perform())
{
aDFace->SetStatus(IMeshData_Failure);
}
}
}

View File

@@ -0,0 +1,204 @@
// Created on: 2016-07-04
// Copyright (c) 2016 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 <BRepMesh_SegmentedFace.hxx>
#include <IMeshData_Wire.hxx>
#include <IMeshData_Edge.hxx>
#include <OSD_Parallel.hxx>
namespace
{
//! Functor to be used to fill segments and bounding box tree in parallel.
class SegmentsFiller
{
public:
//! Constructor.
SegmentsFiller(const IMeshData::IFaceHandle& theDFace,
Handle(BRepMesh_SegmentedFace::ArrayOfSegments)& theWiresSegments,
Handle(BRepMesh_SegmentedFace::ArrayOfBndBoxTree)& theWiresBndBoxTree)
: myDFace(theDFace),
myWiresSegments(theWiresSegments),
myWiresBndBoxTree(theWiresBndBoxTree)
{
myWiresSegments = new BRepMesh_SegmentedFace::ArrayOfSegments (0, myDFace->WiresNb() - 1);
myWiresBndBoxTree = new BRepMesh_SegmentedFace::ArrayOfBndBoxTree (0, myDFace->WiresNb() - 1);
}
//! Performs initialization of wire with the given index.
void operator()(const Standard_Integer theWireIndex) const
{
const IMeshData::IWireHandle& aDWire = myDFace->GetWire(theWireIndex);
Handle(NCollection_IncAllocator) aTmpAlloc1 = new NCollection_IncAllocator();
Handle(BRepMesh_SegmentedFace::Segments) aSegments =
new BRepMesh_SegmentedFace::Segments(aDWire->EdgesNb(), aTmpAlloc1);
Handle(IMeshData::BndBox2dTree) aBndBoxTree = new IMeshData::BndBox2dTree(aTmpAlloc1);
myWiresSegments ->ChangeValue(theWireIndex) = aSegments;
myWiresBndBoxTree->ChangeValue(theWireIndex) = aBndBoxTree;
Handle(NCollection_IncAllocator) aTmpAlloc2 = new NCollection_IncAllocator();
IMeshData::BndBox2dTreeFiller aBndBoxTreeFiller(*aBndBoxTree, aTmpAlloc2);
for (Standard_Integer aEdgeIt = 0; aEdgeIt < aDWire->EdgesNb(); ++aEdgeIt)
{
// TODO: check 2d wire for consistency.
const IMeshData::IEdgePtr& aDEdge = aDWire->GetEdge(aEdgeIt);
const IMeshData::IPCurveHandle& aPCurve = aDEdge->GetPCurve(myDFace.get(), aDWire->GetEdgeOrientation(aEdgeIt));
for (Standard_Integer aPointIt = 1; aPointIt < aPCurve->ParametersNb(); ++aPointIt)
{
gp_Pnt2d& aPnt1 = aPCurve->GetPoint(aPointIt - 1);
gp_Pnt2d& aPnt2 = aPCurve->GetPoint(aPointIt);
Bnd_Box2d aBox;
aBox.Add(aPnt1);
aBox.Add(aPnt2);
aBox.Enlarge(Precision::Confusion());
aBndBoxTreeFiller.Add(aSegments->Size(), aBox);
aSegments->Append(BRepMesh_SegmentedFace::Segment(
aDEdge, aPCurve.get(),
&aPnt1, aPointIt - 1,
&aPnt2, aPointIt));
}
}
aBndBoxTreeFiller.Fill();
}
private:
SegmentsFiller (const SegmentsFiller& theOther);
void operator=(const SegmentsFiller& theOther);
private:
const IMeshData::IFaceHandle& myDFace;
Handle(BRepMesh_SegmentedFace::ArrayOfSegments)& myWiresSegments;
Handle(BRepMesh_SegmentedFace::ArrayOfBndBoxTree)& myWiresBndBoxTree;
};
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepMesh_SegmentedFace::BndBox2dTreeSelector::BndBox2dTreeSelector(
const Standard_Boolean isCollectIntersectionParams)
: myCollectIntersectionParams (isCollectIntersectionParams)
, mySelfSegmentIndex(-1)
, myIndices(256, new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE))
{
}
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
void BRepMesh_SegmentedFace::BndBox2dTreeSelector::Reset(
const BRepMesh_SegmentedFace::Segment* theSegment,
const Standard_Integer theSelfSegmentIndex)
{
myIndices .Clear();
myIntParams.Clear();
mySelfSegmentIndex = theSelfSegmentIndex;
mySegment = theSegment;
myBox.SetVoid();
myBox.Add(*mySegment->Point1);
myBox.Add(*mySegment->Point2);
myBox.Enlarge(Precision::Confusion());
}
//=======================================================================
//function : Reject
//purpose :
//=======================================================================
Standard_Boolean BRepMesh_SegmentedFace::BndBox2dTreeSelector::Reject(
const Bnd_Box2d& theBox) const
{
return myBox.IsOut(theBox);
}
//=======================================================================
//function : Accept
//purpose :
//=======================================================================
Standard_Boolean BRepMesh_SegmentedFace::BndBox2dTreeSelector::Accept(
const Standard_Integer& theSegmentIndex)
{
const BRepMesh_SegmentedFace::Segment& aSegment = mySegments->Value(theSegmentIndex);
IntersectionParams aIntNode;
aIntNode.Type = BRepMesh_GeomTool::IntSegSeg(
mySegment->Point1->XY(), mySegment->Point2->XY(),
aSegment .Point1->XY(), aSegment .Point2->XY(),
Standard_False, Standard_False,
aIntNode.Point, aIntNode.Params);
if (aIntNode.Type == BRepMesh_GeomTool::Cross ||
aIntNode.Type == BRepMesh_GeomTool::PointOnSegment ||
aIntNode.Type == BRepMesh_GeomTool::Glued)
{
myIndices.Append(theSegmentIndex);
if (myCollectIntersectionParams)
{
myIntParams.Append(aIntNode);
}
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepMesh_SegmentedFace::BRepMesh_SegmentedFace(
const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters)
: myDFace (theFace),
myParameters(theParameters)
{
}
//=======================================================================
//function : Destructor
//purpose :
//=======================================================================
BRepMesh_SegmentedFace::~BRepMesh_SegmentedFace()
{
}
//=======================================================================
//function : collectSegments
//purpose :
//=======================================================================
void BRepMesh_SegmentedFace::collectSegments()
{
SegmentsFiller aSegmentsFiller(myDFace, myWiresSegments, myWiresBndBoxTree);
OSD_Parallel::For(0, myDFace->WiresNb(), aSegmentsFiller, !isParallel());
}

View File

@@ -0,0 +1,169 @@
// Created on: 2016-07-04
// Copyright (c) 2016 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// 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 _BRepMesh_SegmentedFace_HeaderFile
#define _BRepMesh_SegmentedFace_HeaderFile
#include <IMeshTools_Parameters.hxx>
#include <Standard_Transient.hxx>
#include <IMeshData_Face.hxx>
#include <Standard_Type.hxx>
#include <NCollection_Shared.hxx>
#include <BRepMesh_GeomTool.hxx>
//! Auxiliary class providing common functionality for exploding wires of
//! discrete face on sets of segments using tessellation data stored in model.
class BRepMesh_SegmentedFace : public Standard_Transient
{
public: //! @name mesher API
//! Identifies segment inside face.
//! Uses explicit pointers to points instead of accessing using indices.
struct Segment
{
IMeshData::IEdgePtr EdgePtr;
IMeshData::IPCurvePtr PCurvePtr;
gp_Pnt2d* Point1;
Standard_Integer Param1;
gp_Pnt2d* Point2;
Standard_Integer Param2;
Segment()
: EdgePtr (NULL)
, PCurvePtr(NULL)
, Point1 (NULL)
, Param1 (0)
, Point2 (NULL)
, Param2 (0)
{
}
Segment(const IMeshData::IEdgePtr& theEdgePtr,
const IMeshData::IPCurvePtr& thePCurvePtr,
gp_Pnt2d* thePoint1,
const Standard_Integer theParam1,
gp_Pnt2d* thePoint2,
const Standard_Integer theParam2)
: EdgePtr (theEdgePtr)
, PCurvePtr(thePCurvePtr)
, Point1 (thePoint1)
, Param1 (theParam1)
, Point2 (thePoint2)
, Param2 (theParam2)
{
}
};
//! Keeps parameters of intersection of two segments.
//! Params are in range relative to distance between points of corresponding segment.
struct IntersectionParams
{
BRepMesh_GeomTool::IntFlag Type;
gp_Pnt2d Point;
Standard_Real Params[2];
};
typedef NCollection_Vector<IntersectionParams> VectorOfIntersectionParams;
typedef NCollection_Shared<NCollection_Vector<Segment> > Segments;
typedef NCollection_Shared<NCollection_Array1<Handle(Segments)> > ArrayOfSegments;
typedef NCollection_Shared<NCollection_Array1<Handle(IMeshData::BndBox2dTree)> > ArrayOfBndBoxTree;
//! Default constructor
Standard_EXPORT BRepMesh_SegmentedFace(const IMeshData::IFaceHandle& theFace,
const IMeshTools_Parameters& theParameters);
//! Destructor
Standard_EXPORT virtual ~BRepMesh_SegmentedFace();
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_SegmentedFace, Standard_Transient)
protected:
//! Returns True in case if check can be performed in parallel mode.
inline Standard_Boolean isParallel() const
{
return (myParameters.InParallel && myDFace->WiresNb() > 1);
}
//! Collects face segments.
void collectSegments();
private:
BRepMesh_SegmentedFace (const BRepMesh_SegmentedFace& theOther);
void operator=(const BRepMesh_SegmentedFace& theOther);
protected:
//! Selector.
//! Used to identify segments with overlapped bounding boxes.
class BndBox2dTreeSelector : public IMeshData::BndBox2dTree::Selector
{
public:
//! Constructor.
BndBox2dTreeSelector(const Standard_Boolean isCollectIntersectionParams);
//! Sets working set of segments.
inline void SetSegments(const Handle(BRepMesh_SegmentedFace::Segments)& theSegments)
{
mySegments = theSegments;
}
//! Returns indices of intersecting segments.
inline const IMeshData::VectorOfInteger& Indices() const
{
return myIndices;
}
//! Returns intersection parameters.
inline const BRepMesh_SegmentedFace::VectorOfIntersectionParams& IntParams() const
{
return myIntParams;
}
//! Resets current selector.
void Reset(const BRepMesh_SegmentedFace::Segment* theSegment,
const Standard_Integer theSelfSegmentIndex);
//! Indicates should the given box be rejected or not.
virtual Standard_Boolean Reject(const Bnd_Box2d& theBox) const;
//! Accepts segment with the given index in case if it fits conditions.
virtual Standard_Boolean Accept(const Standard_Integer& theSegmentIndex);
private:
Standard_Boolean myCollectIntersectionParams;
Standard_Integer mySelfSegmentIndex;
Handle(BRepMesh_SegmentedFace::Segments) mySegments;
const BRepMesh_SegmentedFace::Segment* mySegment;
Bnd_Box2d myBox;
IMeshData::VectorOfInteger myIndices;
BRepMesh_SegmentedFace::VectorOfIntersectionParams myIntParams;
};
protected:
IMeshData::IFaceHandle myDFace;
const IMeshTools_Parameters& myParameters;
Handle(ArrayOfSegments) myWiresSegments;
Handle(ArrayOfBndBoxTree) myWiresBndBoxTree;
};
#endif

View File

@@ -41,6 +41,8 @@ BRepMesh_EdgeTessellationExtractor.cxx
BRepMesh_EdgeTessellationExtractor.hxx
BRepMesh_FaceChecker.cxx
BRepMesh_FaceChecker.hxx
BRepMesh_FaceIntersectionsSplitter.cxx
BRepMesh_FaceIntersectionsSplitter.hxx
BRepMesh_FaceDiscret.cxx
BRepMesh_FaceDiscret.hxx
BRepMesh_FactoryError.hxx
@@ -68,6 +70,8 @@ BRepMesh_OrientedEdge.hxx
BRepMesh_PairOfIndex.hxx
BRepMesh_PluginEntryType.hxx
BRepMesh_PluginMacro.hxx
BRepMesh_SegmentedFace.cxx
BRepMesh_SegmentedFace.hxx
BRepMesh_SelectorOfDataStructureOfDelaun.cxx
BRepMesh_SelectorOfDataStructureOfDelaun.hxx
BRepMesh_ShapeTool.cxx

View File

@@ -62,7 +62,7 @@ public:
BVH_Object() {}
//! Releases resources of geometric object.
virtual ~BVH_Object() {}
virtual ~BVH_Object() = 0;
public:
@@ -71,4 +71,14 @@ public:
};
// =======================================================================
// function : ~BVH_Object
// purpose :
// =======================================================================
template<class T, int N>
BVH_Object<T, N>::~BVH_Object()
{
//
}
#endif // _BVH_Object_Header

View File

@@ -44,7 +44,7 @@ public:
myNumOfThreads (theNumOfThreads) {}
//! Releases resources of BVH queue based builder.
virtual ~BVH_QueueBuilder() {}
virtual ~BVH_QueueBuilder() = 0;
public:
@@ -288,4 +288,14 @@ void BVH_QueueBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
}
}
// =======================================================================
// function : ~BVH_QueueBuilder
// purpose :
// =======================================================================
template<class T, int N>
BVH_QueueBuilder<T, N>::~BVH_QueueBuilder()
{
//
}
#endif // _BVH_QueueBuilder_Header

View File

@@ -35,7 +35,7 @@ public:
BVH_Set() {}
//! Releases resources of set of objects.
virtual ~BVH_Set() {}
virtual ~BVH_Set() = 0;
//! Returns AABB of the entire set of objects.
virtual BVH_Box<T, N> Box() const
@@ -67,4 +67,14 @@ public:
};
// =======================================================================
// function : ~BVH_Set
// purpose :
// =======================================================================
template<class T, int N>
BVH_Set<T, N>::~BVH_Set()
{
//
}
#endif // _BVH_Set_Header

View File

@@ -223,7 +223,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
// Write attributes
TDF_AttributeIterator itAtt (theLabel);
for ( ; itAtt.More() && theOS; itAtt.Next()) {
const Handle(TDF_Attribute) tAtt = itAtt.Value();
const Handle(TDF_Attribute)& tAtt = itAtt.Value();
const Handle(Standard_Type)& aType = tAtt->DynamicType();
// Get type ID and driver
Handle(BinMDF_ADriver) aDriver;

View File

@@ -49,34 +49,17 @@ Standard_OStream& BinTools::PutInteger(Standard_OStream& OS, const Standard_Inte
//=======================================================================
//function : PutReal
//purpose :
//purpose :
//=======================================================================
Standard_OStream& BinTools::PutReal (Standard_OStream& theOS,
const Standard_Real& theValue)
{
#if DO_INVERSE
const Standard_Real aRValue = InverseReal (theValue);
theOS.write((char*)&aRValue, sizeof(Standard_Real));
#else
theOS.write((char*)&theValue, sizeof(Standard_Real));
#endif
return theOS;
}
//=======================================================================
//function : PutShortReal
//purpose :
//=======================================================================
Standard_OStream& BinTools::PutShortReal (Standard_OStream& theOS,
const Standard_ShortReal& theValue)
Standard_OStream& BinTools::PutReal(Standard_OStream& OS, const Standard_Real aValue)
{
Standard_Real aRValue = aValue;
#if DO_INVERSE
const Standard_ShortReal aValue = InverseShortReal (theValue);
theOS.write ((char*)&aValue, sizeof(Standard_ShortReal));
#else
theOS.write ((char*)&theValue, sizeof(Standard_ShortReal));
aRValue = InverseReal (aValue);
#endif
return theOS;
OS.write((char*)&aRValue, sizeof(Standard_Real));
return OS;
}
//=======================================================================
@@ -93,39 +76,19 @@ Standard_OStream& BinTools::PutExtChar(Standard_OStream& OS, const Standard_ExtC
OS.write((char*)&aSValue, sizeof(Standard_ExtCharacter));
return OS;
}
//=======================================================================
//function : GetReal
//purpose :
//purpose :
//=======================================================================
Standard_IStream& BinTools::GetReal (Standard_IStream& theIS,
Standard_Real& theValue)
{
if (!theIS.read ((char*)&theValue, sizeof(Standard_Real)))
{
throw Storage_StreamTypeMismatchError();
}
#if DO_INVERSE
theValue = InverseReal (theValue);
#endif
return theIS;
}
//=======================================================================
//function : GetShortReal
//purpose :
//=======================================================================
Standard_IStream& BinTools::GetShortReal (Standard_IStream& theIS,
Standard_ShortReal& theValue)
Standard_IStream& BinTools::GetReal(Standard_IStream& IS, Standard_Real& aValue)
{
if (!theIS.read ((char*)&theValue, sizeof(Standard_ShortReal)))
{
if(!IS.read ((char*)&aValue, sizeof(Standard_Real)))
throw Storage_StreamTypeMismatchError();
}
#if DO_INVERSE
theValue = InverseShortReal (theValue);
aValue = InverseReal (aValue);
#endif
return theIS;
return IS;
}
//=======================================================================

View File

@@ -42,10 +42,9 @@ public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT static Standard_OStream& PutReal (Standard_OStream& OS, const Standard_Real& theValue);
Standard_EXPORT static Standard_OStream& PutShortReal (Standard_OStream& OS, const Standard_ShortReal& theValue);
Standard_EXPORT static Standard_OStream& PutReal (Standard_OStream& OS, const Standard_Real theValue);
Standard_EXPORT static Standard_OStream& PutInteger (Standard_OStream& OS, const Standard_Integer theValue);
Standard_EXPORT static Standard_OStream& PutBool (Standard_OStream& OS, const Standard_Boolean theValue);
@@ -53,9 +52,7 @@ public:
Standard_EXPORT static Standard_OStream& PutExtChar (Standard_OStream& OS, const Standard_ExtCharacter theValue);
Standard_EXPORT static Standard_IStream& GetReal (Standard_IStream& IS, Standard_Real& theValue);
Standard_EXPORT static Standard_IStream& GetShortReal (Standard_IStream& IS, Standard_ShortReal& theValue);
Standard_EXPORT static Standard_IStream& GetInteger (Standard_IStream& IS, Standard_Integer& theValue);
Standard_EXPORT static Standard_IStream& GetBool (Standard_IStream& IS, Standard_Boolean& theValue);

View File

@@ -725,7 +725,7 @@ void BinTools_ShapeSet::WriteGeometry(const TopoDS_Shape& S,
const TopoDS_Face& F = TopoDS::Face(S);
// Write the surface geometry
Standard_Boolean aNatRes = BRep_Tool::NaturalRestriction(F);
Standard_Boolean aNatRes = (BRep_Tool::NaturalRestriction(F)) ? Standard_True : Standard_False;
BinTools::PutBool (OS, aNatRes);
BinTools::PutReal (OS, TF->Tolerance());
BinTools::PutInteger (OS, !TF->Surface().IsNull()
@@ -797,7 +797,7 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
BRep_ListOfPointRepresentation& lpr = TV->ChangePoints();
TopLoc_Location L;
Standard_Boolean aNewF = (myFormatNb > 2);
Standard_Boolean aNewF = (myFormatNb > 2) ? Standard_True : Standard_False;
do {
if(aNewF) {
val = (Standard_Integer)IS.get();//case {0|1|2|3}
@@ -1034,8 +1034,8 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
case 5 : // -5- Polygon3D
BinTools::GetInteger(IS, c);
BinTools::GetInteger(IS, l);
//??? Bug? myBuilder.UpdateEdge(E,myPolygons3D(c));
myBuilder.UpdateEdge(E, myPolygons3D(c), Locations().Location(l));
//??? Bug? myBuilder.UpdateEdge(E,Handle(Poly_Polygon3D)::DownCast(myPolygons3D(c)));
myBuilder.UpdateEdge(E,Handle(Poly_Polygon3D)::DownCast(myPolygons3D(c)), Locations().Location(l));
break;
case 6 : // -6- Polygon on triangulation
@@ -1047,13 +1047,18 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
BinTools::GetInteger(IS, t);
BinTools::GetInteger(IS, l);
if (closed)
{
myBuilder.UpdateEdge (E, myNodes(pt), myNodes(pt2), myTriangulations(t), Locations().Location(l));
if (closed) {
myBuilder.UpdateEdge
(E, Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt)),
Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt2)),
Handle(Poly_Triangulation)::DownCast(myTriangulations(t)),
Locations().Location(l));
}
else
{
myBuilder.UpdateEdge (E, myNodes(pt), myTriangulations(t), Locations().Location(l));
else {
myBuilder.UpdateEdge
(E,Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt)),
Handle(Poly_Triangulation)::DownCast(myTriangulations(t)),
Locations().Location(l));
}
// range
break;
@@ -1102,7 +1107,8 @@ void BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
// cas triangulation
if(aByte == 2) {
BinTools::GetInteger(IS, s);
myBuilder.UpdateFace(TopoDS::Face(S), myTriangulations(s));
myBuilder.UpdateFace(TopoDS::Face(S),
Handle(Poly_Triangulation)::DownCast(myTriangulations(s)));
}
}
break;
@@ -1176,213 +1182,197 @@ void BinTools_ShapeSet::AddShapes(TopoDS_Shape& S1,
//=======================================================================
//function : WritePolygonOnTriangulation
//purpose :
//purpose :
//=======================================================================
void BinTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS) const
{
const Standard_Integer aNbPol = myNodes.Extent();
OS << "PolygonOnTriangulations " << aNbPol << "\n";
try
{
Standard_Integer i, j, nbpOntri = myNodes.Extent();
OS << "PolygonOnTriangulations " << nbpOntri << "\n";
Handle(Poly_PolygonOnTriangulation) Poly;
Handle(TColStd_HArray1OfReal) Param;
try {
OCC_CATCH_SIGNALS
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
{
const Handle(Poly_PolygonOnTriangulation)& aPoly = myNodes.FindKey (aPolIter);
const TColStd_Array1OfInteger& aNodes = aPoly->Nodes();
BinTools::PutInteger(OS, aNodes.Length());
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNodes.Length(); ++aNodeIter)
{
BinTools::PutInteger(OS, aNodes.Value (aNodeIter));
}
for (i=1; i<=nbpOntri; i++) {
Poly = Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(i));
const TColStd_Array1OfInteger& Nodes = Poly->Nodes();
BinTools::PutInteger(OS, Nodes.Length());
for (j=1; j <= Nodes.Length(); j++)
BinTools::PutInteger(OS, Nodes.Value(j));
// write the deflection
BinTools::PutReal(OS, aPoly->Deflection());
// writing parameters:
Param = Poly->Parameters();
// writing parameters
if (const Handle(TColStd_HArray1OfReal)& aParam = aPoly->Parameters())
{
BinTools::PutBool(OS, Standard_True);
for (Standard_Integer aNodeIter = 1; aNodeIter <= aParam->Length(); ++aNodeIter)
{
BinTools::PutReal(OS, aParam->Value (aNodeIter));
}
}
else
{
BinTools::PutBool(OS, Standard_False);
// write the deflection
BinTools::PutReal(OS, Poly->Deflection());
if (!Param.IsNull()) {
BinTools::PutBool(OS, Standard_True);
for (j=1; j <= Param->Length(); j++)
BinTools::PutReal(OS, Param->Value(j));
}
else
BinTools::PutBool(OS, Standard_False);
}
}
catch (Standard_Failure const& anException)
{
catch(Standard_Failure const& anException) {
Standard_SStream aMsg;
aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygonOnTriangulation(..)\n" << anException << "\n";
aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygonOnTriangulation(..)" << std::endl;
aMsg << anException << std::endl;
throw Standard_Failure(aMsg.str().c_str());
}
}
//=======================================================================
//function : ReadPolygonOnTriangulation
//purpose :
//purpose :
//=======================================================================
void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
{
char aHeader[255];
IS >> aHeader;
if (IS.fail() || (strstr(aHeader,"PolygonOnTriangulations") == NULL))
{
char buffer[255];
IS >> buffer;
if (IS.fail() || (strstr(buffer,"PolygonOnTriangulations") == NULL)) {
throw Standard_Failure("BinTools_ShapeSet::ReadPolygonOnTriangulation: Not a PolygonOnTriangulation section");
}
Standard_Integer aNbPol = 0;
IS >> aNbPol;
IS.get();//remove LF
try
{
Standard_Integer i, j, val, nbpol = 0, nbnodes =0;
Standard_Boolean hasparameters;
Standard_Real par;
Handle(TColStd_HArray1OfReal) Param;
Handle(Poly_PolygonOnTriangulation) Poly;
IS >> nbpol;
IS.get();//remove LF
try {
OCC_CATCH_SIGNALS
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
{
Standard_Integer aNbNodes = 0;
BinTools::GetInteger(IS, aNbNodes);
Handle(Poly_PolygonOnTriangulation) aPoly = new Poly_PolygonOnTriangulation (aNbNodes, Standard_False);
TColStd_Array1OfInteger& aNodes = aPoly->ChangeNodes();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
BinTools::GetInteger(IS, aNodes.ChangeValue (aNodeIter));
}
for (i=1; i<=nbpol; i++) {
BinTools::GetInteger(IS, nbnodes);
Standard_Real aDefl = 0.0;
BinTools::GetReal(IS, aDefl);
aPoly->Deflection (aDefl);
Standard_Boolean hasParameters = Standard_False;
BinTools::GetBool(IS, hasParameters);
if (hasParameters)
{
Handle(TColStd_HArray1OfReal) aParams = new TColStd_HArray1OfReal (1, aNbNodes);
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
BinTools::GetReal(IS, aParams->ChangeValue (aNodeIter));
}
aPoly->SetParameters (aParams);
TColStd_Array1OfInteger Nodes(1, nbnodes);
for (j = 1; j <= nbnodes; j++) {
BinTools::GetInteger(IS, val);
Nodes(j) = val;
}
myNodes.Add (aPoly);
Standard_Real def;
BinTools::GetReal(IS, def);
BinTools::GetBool(IS, hasparameters);
if (hasparameters) {
TColStd_Array1OfReal Param1(1, nbnodes);
for (j = 1; j <= nbnodes; j++) {
BinTools::GetReal(IS, par);
Param1(j) = par;
}
Poly = new Poly_PolygonOnTriangulation(Nodes, Param1);
}
else Poly = new Poly_PolygonOnTriangulation(Nodes);
Poly->Deflection(def);
myNodes.Add(Poly);
}
}
catch (Standard_Failure const& anException)
{
catch(Standard_Failure const& anException) {
Standard_SStream aMsg;
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygonOnTriangulation(..)\n" << anException << "\n";
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygonOnTriangulation(..)" << std::endl;
aMsg << anException << std::endl;
throw Standard_Failure(aMsg.str().c_str());
}
}
//=======================================================================
//function : WritePolygon3D
//purpose :
//purpose :
//=======================================================================
void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS)const
{
const Standard_Integer aNbPol = myPolygons3D.Extent();
OS << "Polygon3D " << aNbPol << "\n";
try
{
Standard_Integer i, j, nbpol = myPolygons3D.Extent();
OS << "Polygon3D " << nbpol << "\n";
Handle(Poly_Polygon3D) P;
try {
OCC_CATCH_SIGNALS
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
{
const Handle(Poly_Polygon3D)& aPoly = myPolygons3D.FindKey (aPolIter);
BinTools::PutInteger(OS, aPoly->NbNodes());
BinTools::PutBool(OS, aPoly->HasParameters());
for (i = 1; i <= nbpol; i++) {
P = Handle(Poly_Polygon3D)::DownCast(myPolygons3D(i));
BinTools::PutInteger(OS, P->NbNodes());
BinTools::PutBool(OS, P->HasParameters()? 1:0);
// write the deflection
BinTools::PutReal(OS, aPoly->Deflection());
// write the deflection
BinTools::PutReal(OS, P->Deflection());
// write the nodes
const Standard_Integer aNbNodes = aPoly->NbNodes();
const TColgp_Array1OfPnt& aNodes = aPoly->Nodes();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
const gp_Pnt& aPnt = aNodes.Value (aNodeIter);
BinTools::PutReal(OS, aPnt.X());
BinTools::PutReal(OS, aPnt.Y());
BinTools::PutReal(OS, aPnt.Z());
// write the nodes
Standard_Integer i1, nbNodes = P->NbNodes();
const TColgp_Array1OfPnt& Nodes = P->Nodes();
for (j = 1; j <= nbNodes; j++) {
BinTools::PutReal(OS, Nodes(j).X());
BinTools::PutReal(OS, Nodes(j).Y());
BinTools::PutReal(OS, Nodes(j).Z());
}
if (aPoly->HasParameters())
{
const TColStd_Array1OfReal& aParam = aPoly->Parameters();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
BinTools::PutReal(OS, aParam.Value (aNodeIter));
}
if (P->HasParameters()) {
const TColStd_Array1OfReal& Param = P->Parameters();
for ( i1 = 1; i1 <= nbNodes; i1++ ) {
BinTools::PutReal(OS, Param(i1));
}
}
}
}
catch (Standard_Failure const& anException)
{
catch(Standard_Failure const& anException) {
Standard_SStream aMsg;
aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygon3D(..)\n" << anException << "\n";
aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygon3D(..)" << std::endl;
aMsg << anException << std::endl;
throw Standard_Failure(aMsg.str().c_str());
}
}
//=======================================================================
//function : ReadPolygon3D
//purpose :
//purpose :
//=======================================================================
void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
{
char aHeader[255];
IS >> aHeader;
char buffer[255];
Standard_Integer i, j, p, nbpol=0, nbnodes =0;
Standard_Boolean hasparameters = Standard_False;
Standard_Real d, x, y, z;
IS >> buffer;
if (IS.fail() || strstr(aHeader,"Polygon3D") == NULL)
{
if (IS.fail() || strstr(buffer,"Polygon3D") == NULL) {
#ifdef OCCT_DEBUG
std::cout <<"Buffer: " << aHeader << std::endl;
std::cout <<"Buffer: " << buffer << std::endl;
#endif
throw Standard_Failure("BinTools_ShapeSet::ReadPolygon3D: Not a Polygon3D section");
}
Handle(Poly_Polygon3D) P;
IS >> nbpol;
IS.get();//remove LF
Standard_Integer aNbPol = 0;
IS >> aNbPol;
IS.get();//remove LF
try
{
try {
OCC_CATCH_SIGNALS
for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
{
Standard_Integer aNbNodes = 0;
Standard_Boolean hasParameters = Standard_False;
Standard_Real aDefl = 0.0;
BinTools::GetInteger(IS, aNbNodes);
BinTools::GetBool(IS, hasParameters);
BinTools::GetReal(IS, aDefl);
Handle(Poly_Polygon3D) aPoly = new Poly_Polygon3D (aNbNodes, hasParameters);
aPoly->Deflection (aDefl);
TColgp_Array1OfPnt& aNodes = aPoly->ChangeNodes();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
gp_XYZ& aPnt = aNodes.ChangeValue (aNodeIter).ChangeCoord();
BinTools::GetReal(IS, aPnt.ChangeCoord (1));
BinTools::GetReal(IS, aPnt.ChangeCoord (2));
BinTools::GetReal(IS, aPnt.ChangeCoord (3));
}
if (hasParameters)
{
TColStd_Array1OfReal& aParam = aPoly->ChangeParameters();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
BinTools::GetReal(IS, aParam.ChangeValue (aNodeIter));
}
for (i=1; i<=nbpol; i++) {
BinTools::GetInteger(IS, nbnodes);
BinTools::GetBool(IS, hasparameters);
TColgp_Array1OfPnt Nodes(1, nbnodes);
BinTools::GetReal(IS, d);
for (j = 1; j <= nbnodes; j++) {
BinTools::GetReal(IS, x);
BinTools::GetReal(IS, y);
BinTools::GetReal(IS, z);
Nodes(j).SetCoord(x,y,z);
}
if (hasparameters) {
TColStd_Array1OfReal Param(1,nbnodes);
for (p = 1; p <= nbnodes; p++)
BinTools::GetReal(IS, Param(p));
myPolygons3D.Add (aPoly);
P = new Poly_Polygon3D(Nodes, Param);
}
else P = new Poly_Polygon3D(Nodes);
P->Deflection(d);
myPolygons3D.Add(P);
}
}
catch (Standard_Failure const& anException)
{
catch(Standard_Failure const& anException) {
Standard_SStream aMsg;
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygon3D(..)\n" << anException << "\n";
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygon3D(..)" << std::endl;
aMsg << anException << std::endl;
throw Standard_Failure(aMsg.str().c_str());
}
}
@@ -1390,134 +1380,125 @@ void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
//=======================================================================
//function : WriteTriangulation
//purpose :
//purpose :
//=======================================================================
void BinTools_ShapeSet::WriteTriangulation(Standard_OStream& OS) const
{
const Standard_Integer aNbTriangulations = myTriangulations.Extent();
OS << "Triangulations " << aNbTriangulations << "\n";
try
{
Standard_Integer i, j, nbNodes, nbtri = myTriangulations.Extent();
Standard_Integer nbTriangles = 0, n1, n2, n3;
OS << "Triangulations " << nbtri << "\n";
Handle(Poly_Triangulation) T;
try {
OCC_CATCH_SIGNALS
for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations; ++aTriangulationIter)
{
const Handle(Poly_Triangulation)& aTriangulation = myTriangulations.FindKey (aTriangulationIter);
const Standard_Integer aNbNodes = aTriangulation->NbNodes();
const Standard_Integer aNbTriangles = aTriangulation->NbTriangles();
BinTools::PutInteger(OS, aNbNodes);
BinTools::PutInteger(OS, aNbTriangles);
BinTools::PutBool(OS, aTriangulation->HasUVNodes() ? 1 : 0);
BinTools::PutReal(OS, aTriangulation->Deflection());
for (i = 1; i <= nbtri; i++) {
T = Handle(Poly_Triangulation)::DownCast(myTriangulations(i));
BinTools::PutInteger(OS, T->NbNodes());
BinTools::PutInteger(OS, T->NbTriangles());
BinTools::PutBool(OS, T->HasUVNodes()? 1:0);
// write the deflection
BinTools::PutReal(OS, T->Deflection());
// write the 3d nodes
const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
const gp_Pnt& aPnt = aNodes.Value (aNodeIter);
BinTools::PutReal(OS, aPnt.X());
BinTools::PutReal(OS, aPnt.Y());
BinTools::PutReal(OS, aPnt.Z());
// write the 3d nodes
nbNodes = T->NbNodes();
const TColgp_Array1OfPnt& Nodes = T->Nodes();
for (j = 1; j <= nbNodes; j++) {
BinTools::PutReal(OS, Nodes(j).X());
BinTools::PutReal(OS, Nodes(j).Y());
BinTools::PutReal(OS, Nodes(j).Z());
}
if (aTriangulation->HasUVNodes())
{
const TColgp_Array1OfPnt2d& aUVNodes = aTriangulation->UVNodes();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
const gp_Pnt2d aUV = aUVNodes.Value (aNodeIter);
BinTools::PutReal(OS, aUV.X());
BinTools::PutReal(OS, aUV.Y());
}
if (T->HasUVNodes()) {
const TColgp_Array1OfPnt2d& UVNodes = T->UVNodes();
for (j = 1; j <= nbNodes; j++) {
BinTools::PutReal(OS, UVNodes(j).X());
BinTools::PutReal(OS, UVNodes(j).Y());
}
}
const Poly_Array1OfTriangle& aTriangles = aTriangulation->Triangles();
for (Standard_Integer aTriIter = 1; aTriIter <= aNbTriangles; ++aTriIter)
{
const Poly_Triangle& aTri = aTriangles.Value (aTriIter);
BinTools::PutInteger(OS, aTri.Value (1));
BinTools::PutInteger(OS, aTri.Value (2));
BinTools::PutInteger(OS, aTri.Value (3));
nbTriangles = T->NbTriangles();
const Poly_Array1OfTriangle& Triangles = T->Triangles();
for (j = 1; j <= nbTriangles; j++) {
Triangles(j).Get(n1, n2, n3);
BinTools::PutInteger(OS, n1);
BinTools::PutInteger(OS, n2);
BinTools::PutInteger(OS, n3);
}
}
}
catch (Standard_Failure const& anException)
{
catch(Standard_Failure const& anException) {
Standard_SStream aMsg;
aMsg << "EXCEPTION in BinTools_ShapeSet::WriteTriangulation(..)\n" << anException << "\n";
aMsg << "EXCEPTION in BinTools_ShapeSet::WriteTriangulation(..)" << std::endl;
aMsg << anException << std::endl;
throw Standard_Failure(aMsg.str().c_str());
}
}
//=======================================================================
//function : ReadTriangulation
//purpose :
//purpose :
//=======================================================================
void BinTools_ShapeSet::ReadTriangulation (Standard_IStream& IS)
void BinTools_ShapeSet::ReadTriangulation(Standard_IStream& IS)
{
char aHeader[255];
IS >> aHeader;
if (IS.fail() || (strstr(aHeader, "Triangulations") == NULL))
{
char buffer[255];
Standard_Integer i, j, nbtri =0;
Standard_Real d, x, y, z;
Standard_Integer nbNodes =0, nbTriangles=0;
Standard_Boolean hasUV = Standard_False;
Handle(Poly_Triangulation) T;
IS >> buffer;
if (IS.fail() || (strstr(buffer,"Triangulations") == NULL)) {
throw Standard_Failure("BinTools_ShapeSet::Triangulation: Not a Triangulation section");
}
Standard_Integer aNbTriangulations = 0;
IS >> aNbTriangulations;
IS >> nbtri;
IS.get();// remove LF
try
{
try {
OCC_CATCH_SIGNALS
for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations; ++aTriangulationIter)
{
Standard_Integer aNbNodes = 0, aNbTriangles = 0;
Standard_Boolean hasUV = Standard_False;
Standard_Real aDefl = 0.0;
BinTools::GetInteger(IS, aNbNodes);
BinTools::GetInteger(IS, aNbTriangles);
for (i=1; i<=nbtri; i++) {
BinTools::GetInteger(IS, nbNodes);
BinTools::GetInteger(IS, nbTriangles);
TColgp_Array1OfPnt Nodes(1, nbNodes);
BinTools::GetBool(IS, hasUV);
BinTools::GetReal(IS, aDefl); //deflection
Handle(Poly_Triangulation) aTriangulation = new Poly_Triangulation (aNbNodes, aNbTriangles, hasUV);
aTriangulation->Deflection (aDefl);
TColgp_Array1OfPnt& aNodes = aTriangulation->ChangeNodes();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
Standard_Real* anXYZ = aNodes.ChangeValue (aNodeIter).ChangeCoord().ChangeData();
BinTools::GetReal(IS, anXYZ[0]);
BinTools::GetReal(IS, anXYZ[1]);
BinTools::GetReal(IS, anXYZ[2]);
TColgp_Array1OfPnt2d UVNodes(1, nbNodes);
BinTools::GetReal(IS, d); //deflection
for (j = 1; j <= nbNodes; j++) {
BinTools::GetReal(IS, x);
BinTools::GetReal(IS, y);
BinTools::GetReal(IS, z);
Nodes(j).SetCoord(x,y,z);
}
if (hasUV)
{
TColgp_Array1OfPnt2d& aUVNodes = aTriangulation->ChangeUVNodes();
for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
{
gp_XY& anUV = aUVNodes.ChangeValue (aNodeIter).ChangeCoord();
BinTools::GetReal(IS, anUV.ChangeCoord (1));
BinTools::GetReal(IS, anUV.ChangeCoord (2));
}
if (hasUV) {
for (j = 1; j <= nbNodes; j++) {
BinTools::GetReal(IS, x);
BinTools::GetReal(IS, y);
UVNodes(j).SetCoord(x,y);
}
}
// read the triangles
Poly_Array1OfTriangle& aTriangles = aTriangulation->ChangeTriangles();
for (Standard_Integer aTriIter = 1; aTriIter <= aNbTriangles; ++aTriIter)
{
Poly_Triangle& aTri = aTriangles.ChangeValue (aTriIter);
BinTools::GetInteger(IS, aTri.ChangeValue (1));
BinTools::GetInteger(IS, aTri.ChangeValue (2));
BinTools::GetInteger(IS, aTri.ChangeValue (3));
Standard_Integer n1,n2,n3;
Poly_Array1OfTriangle Triangles(1, nbTriangles);
for (j = 1; j <= nbTriangles; j++) {
BinTools::GetInteger(IS, n1);
BinTools::GetInteger(IS, n2);
BinTools::GetInteger(IS, n3);
Triangles(j).Set(n1,n2,n3);
}
myTriangulations.Add (aTriangulation);
if (hasUV) T = new Poly_Triangulation(Nodes,UVNodes,Triangles);
else T = new Poly_Triangulation(Nodes,Triangles);
T->Deflection(d);
myTriangulations.Add(T);
}
}
catch (Standard_Failure const& anException)
{
catch(Standard_Failure const& anException) {
Standard_SStream aMsg;
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadTriangulation(..)\n" << anException << "\n";
aMsg << "EXCEPTION in BinTools_ShapeSet::ReadTriangulation(..)" << std::endl;
aMsg << anException << std::endl;
throw Standard_Failure(aMsg.str().c_str());
}
}

View File

@@ -171,8 +171,19 @@ public:
//! be read back by Read.
Standard_EXPORT void WritePolygonOnTriangulation (Standard_OStream& OS) const;
protected:
private:
TopTools_IndexedMapOfShape myShapes;
BinTools_LocationSet myLocations;
Standard_Integer myFormatNb;
@@ -180,12 +191,19 @@ private:
BinTools_SurfaceSet mySurfaces;
BinTools_CurveSet myCurves;
BinTools_Curve2dSet myCurves2d;
NCollection_IndexedMap<Handle(Poly_Polygon2D), TColStd_MapTransientHasher> myPolygons2D;
NCollection_IndexedMap<Handle(Poly_Polygon3D), TColStd_MapTransientHasher> myPolygons3D;
NCollection_IndexedMap<Handle(Poly_Triangulation), TColStd_MapTransientHasher> myTriangulations;
NCollection_IndexedMap<Handle(Poly_PolygonOnTriangulation), TColStd_MapTransientHasher> myNodes;
TColStd_IndexedMapOfTransient myPolygons2D;
TColStd_IndexedMapOfTransient myPolygons3D;
TColStd_IndexedMapOfTransient myTriangulations;
TColStd_IndexedMapOfTransient myNodes;
Standard_Boolean myWithTriangles;
};
#endif // _BinTools_ShapeSet_HeaderFile

View File

@@ -3438,10 +3438,7 @@ static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
return 1;
} else {
TCollection_AsciiString aString =
(((TCollection_AsciiString("Key = ") + arg[3]) +
" Value = ") + anAtt->GetInteger(arg[3])) + "\n";
di << aString;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(arg[3])<<std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetInteger(arg[3]));
return 0;
@@ -3549,10 +3546,7 @@ static Standard_Integer DDataStd_GetNDReal (Draw_Interpretor& di,
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
return 1;
} else {
TCollection_AsciiString aString =
(((TCollection_AsciiString("Key = ") + arg[3]) +
" Value = ") + anAtt->GetReal(arg[3])) + "\n";
di << aString;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(arg[3])<<std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetReal(arg[3]));
return 0;
@@ -3662,10 +3656,7 @@ static Standard_Integer DDataStd_GetNDString (Draw_Interpretor& di,
return 1;
} else {
TCollection_AsciiString aValue (anAtt->GetString(arg[3]), '?');
TCollection_AsciiString aString =
(((TCollection_AsciiString("Key = ") + arg[3]) +
" Value = ") + aValue.ToCString()) + "\n";
di << aString;
std::cout << "Key = " << arg[3] << " Value = " << aValue.ToCString() << std::endl;
if(nb == 5)
Draw::Set(arg[4], aValue.ToCString());
return 0;

View File

@@ -537,24 +537,13 @@ static void *CpuFunc(void* /*threadarg*/)
}
#endif
// Returns time in seconds defined by the argument string,
// multiplied by factor defined in environment variable
// CSF_CPULIMIT_FACTOR (if it exists, 1 otherwise)
static clock_t GetCpuLimit (const Standard_CString theParam)
#ifdef _WIN32
static Standard_Integer cpulimit(Draw_Interpretor&, Standard_Integer n, const char** a)
{
clock_t aValue = Draw::Atoi (theParam);
OSD_Environment aEnv("CSF_CPULIMIT_FACTOR");
TCollection_AsciiString aEnvStr = aEnv.Value();
if (!aEnvStr.IsEmpty())
{
aValue *= Draw::Atoi (aEnvStr.ToCString());
}
return aValue;
}
#else
static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
#endif
static int aFirst = 1;
#ifdef _WIN32
// Windows specific code
@@ -564,7 +553,7 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const
if (n <= 1){
CPU_LIMIT = RLIM_INFINITY;
} else {
CPU_LIMIT = GetCpuLimit (a[1]);
CPU_LIMIT = Draw::Atoi (a[1]);
Standard_Real anUserSeconds, aSystemSeconds;
OSD_Chronometer::GetProcessCPU (anUserSeconds, aSystemSeconds);
CPU_CURRENT = clock_t(anUserSeconds + aSystemSeconds);
@@ -584,7 +573,7 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const
if (n <= 1)
rlp.rlim_cur = RLIM_INFINITY;
else
rlp.rlim_cur = GetCpuLimit (a[1]);
rlp.rlim_cur = Draw::Atoi(a[1]);
CPU_LIMIT = rlp.rlim_cur;
int status;
@@ -608,10 +597,10 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const
pthread_create(&cpulimitThread, NULL, CpuFunc, NULL);
}
#endif
di << "CPU and elapsed time limit set to " << (double)CPU_LIMIT << " seconds";
return 0;
}
//=======================================================================
//function : mallochook
//purpose :

View File

@@ -144,9 +144,7 @@ help testgrid {
-xml filename: write XML report for Jenkins (in JUnit-like format)
-beep: play sound signal at the end of the tests
-regress dirname: re-run only a set of tests that have been detected as regressions on some previous run.
-skipped dirname: re-run only a set of tests that have been skipped on some previous run.
Here "dirname" is path to directory containing results of previous run.
-skip N: skip first N tests (useful to restart after abort)
Groups, grids, and test cases to be executed can be specified by list of file
masks, separated by spaces or comma; default is all (*).
}
@@ -174,10 +172,7 @@ proc testgrid {args} {
set exc_grid 0
set exc_case 0
set regress 0
set skipped 0
set logdir_regr ""
set logdir_skip ""
set nbskip 0
set prev_logdir ""
for {set narg 0} {$narg < [llength $args]} {incr narg} {
set arg [lindex $args $narg]
@@ -239,29 +234,13 @@ proc testgrid {args} {
}
# re-run only a set of tests that have been detected as regressions on some previous run
if { $arg == "-regress" || $arg == "-skipped" } {
if { $arg == "-regress" } {
incr narg
if { $narg < [llength $args] && ! [regexp {^-} [lindex $args $narg]] } {
if { $arg == "-regress" } {
set logdir_regr [file normalize [string trim [lindex $args $narg]]]
set regress 1
} else {
set logdir_skip [file normalize [string trim [lindex $args $narg]]]
set skipped 1
}
set prev_logdir [lindex $args $narg]
set regress 1
} else {
error "Option $arg requires argument"
}
continue
}
# skip N first tests
if { $arg == "-skip" } {
incr narg
if { $narg < [llength $args] && [string is integer [lindex $args $narg]] } {
set nbskip [lindex $args $narg]
} else {
error "Option -skip requires integer argument"
error "Option -regress requires argument"
}
continue
}
@@ -324,6 +303,7 @@ proc testgrid {args} {
# check that target log directory is empty or does not exist
set logdir [file normalize [string trim $logdir]]
set prev_logdir [file normalize [string trim $prev_logdir]]
if { $logdir == "" } {
# if specified logdir is empty string, generate unique name like
# results/<branch>_<timestamp>
@@ -352,7 +332,7 @@ proc testgrid {args} {
# if option "regress" is given
set rerun_group_grid_case {}
if { ${regress} > 0 || ${skipped} > 0 } {
if { ${regress} > 0 } {
if { "${groupmask}" != "*"} {
lappend rerun_group_grid_case [list $groupmask $gridmask $casemask]
}
@@ -361,8 +341,8 @@ proc testgrid {args} {
}
if { ${regress} > 0 } {
if { [file exists ${logdir_regr}/tests.log] } {
set fd [open ${logdir_regr}/tests.log]
if { [file exists ${prev_logdir}/tests.log] } {
set fd [open ${prev_logdir}/tests.log]
while { [gets $fd line] >= 0 } {
if {[regexp {CASE ([^\s]+) ([^\s]+) ([^\s]+): FAILED} $line dump group grid casename] ||
[regexp {CASE ([^\s]+) ([^\s]+) ([^\s]+): IMPROVEMENT} $line dump group grid casename]} {
@@ -371,20 +351,7 @@ proc testgrid {args} {
}
close $fd
} else {
error "Error: file ${logdir_regr}/tests.log is not found, check your input arguments!"
}
}
if { ${skipped} > 0 } {
if { [file exists ${logdir_skip}/tests.log] } {
set fd [open ${logdir_skip}/tests.log]
while { [gets $fd line] >= 0 } {
if {[regexp {CASE ([^\s]+) ([^\s]+) ([^\s]+): SKIPPED} $line dump group grid casename] } {
lappend rerun_group_grid_case [list $group $grid $casename]
}
}
close $fd
} else {
error "Error: file ${logdir_skip}/tests.log is not found, check your input arguments!"
error "Error: file ${prev_logdir}/tests.log is not found, check your input arguments!"
}
}
@@ -534,11 +501,7 @@ proc testgrid {args} {
continue
}
if { $nbskip > 0 } {
incr nbskip -1
} else {
lappend tests_list [list $dir $group $grid $casename $casefile]
}
lappend tests_list [list $dir $group $grid $casename $casefile]
}
}
}
@@ -608,8 +571,7 @@ proc testgrid {args} {
if { $logdir != "" } { set imgdir_cmd "set imagedir $logdir/$group/$grid" }
# prepare command file for running test case in separate instance of DRAW
set file_cmd "$logdir/$group/$grid/${casename}.tcl"
set fd_cmd [open $file_cmd w]
set fd_cmd [open $logdir/$group/$grid/${casename}.tcl w]
puts $fd_cmd "$imgdir_cmd"
puts $fd_cmd "set test_image $casename"
puts $fd_cmd "_run_test $dir $group $grid $casefile t"
@@ -632,7 +594,7 @@ proc testgrid {args} {
# commant to run DRAW with a command file;
# note that empty string is passed as standard input to avoid possible
# hang-ups due to waiting for stdin of the launching process
set command "exec <<{} DRAWEXE -f $file_cmd"
set command "exec <<{} DRAWEXE -f $logdir/$group/$grid/${casename}.tcl"
# alternative method to run without temporary file; disabled as it needs too many backslashes
# else {
@@ -1596,7 +1558,6 @@ proc _log_and_puts {logvar message} {
proc _log_test_case {output logdir dir group grid casename logvar} {
upvar $logvar log
set show_errors 0
# check result and make HTML log
_check_log $dir $group $grid $casename $show_errors $output summary html_log
lappend log $summary
@@ -1606,11 +1567,6 @@ proc _log_test_case {output logdir dir group grid casename logvar} {
_log_html $logdir/$group/$grid/$casename.html $html_log "Test $group $grid $casename"
_log_save $logdir/$group/$grid/$casename.log "$output\n$summary" "Test $group $grid $casename"
}
# remove intermediate command file used to run test
if { [file exists $logdir/$group/$grid/${casename}.tcl] } {
file delete $logdir/$group/$grid/${casename}.tcl
}
}
# Auxiliary procedure to save log to file
@@ -1754,8 +1710,8 @@ proc _log_html_summary {logdir log totals regressions improvements skipped total
puts $fd "</table>"
# time stamp and elapsed time info
puts $fd "<p>Generated on [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}] on [info hostname]\n<p>"
if { $total_time != "" } {
puts $fd "<p>Generated on [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}] on [info hostname]\n<p>"
puts $fd [join [split $total_time "\n"] "<p>"]
} else {
puts $fd "<p>NOTE: This is intermediate summary; the tests are still running! This page will refresh automatically until tests are finished."

View File

@@ -57,10 +57,6 @@ static int yywrap()
// Note that Intel compiler also defines _MSC_VER but has different warning ids
#if defined(__INTEL_COMPILER)
#pragma warning(disable:177 1786 1736)
#elif defined(__clang__)
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
#else
#pragma warning(disable:4131 4244 4273 4127 4267)
#endif

View File

@@ -2106,10 +2106,6 @@ static int yywrap()
// Note that Intel compiler also defines _MSC_VER but has different warning ids
#if defined(__INTEL_COMPILER)
#pragma warning(disable:177 1786 1736)
#elif defined(__clang__)
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
#else
#pragma warning(disable:4131 4244 4273 4127 4267)
#endif

View File

@@ -33,35 +33,35 @@ protected:
public:
//! Creates an empty primitive set for BVH clipping.
Standard_EXPORT Graphic3d_BvhCStructureSet();
Graphic3d_BvhCStructureSet();
//! Returns total number of structures.
Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
virtual Standard_Integer Size() const Standard_OVERRIDE;
//! Returns AABB of the structure.
Standard_EXPORT virtual Graphic3d_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
virtual Graphic3d_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
//! Calculates center of the AABB along given axis.
Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx,
const Standard_Integer theAxis) const Standard_OVERRIDE;
virtual Standard_Real Center (const Standard_Integer theIdx,
const Standard_Integer theAxis) const Standard_OVERRIDE;
//! Swaps structures with the given indices.
Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
const Standard_Integer theIdx2) Standard_OVERRIDE;
virtual void Swap (const Standard_Integer theIdx1,
const Standard_Integer theIdx2) Standard_OVERRIDE;
//! Adds structure to the set.
//! @return true if structure added, otherwise returns false (structure already in the set).
Standard_EXPORT Standard_Boolean Add (const Graphic3d_CStructure* theStruct);
Standard_Boolean Add (const Graphic3d_CStructure* theStruct);
//! Removes the given structure from the set.
//! @return true if structure removed, otherwise returns false (structure is not in the set).
Standard_EXPORT Standard_Boolean Remove (const Graphic3d_CStructure* theStruct);
Standard_Boolean Remove (const Graphic3d_CStructure* theStruct);
//! Cleans the whole primitive set.
Standard_EXPORT void Clear();
void Clear();
//! Returns the structure corresponding to the given ID.
Standard_EXPORT const Graphic3d_CStructure* GetStructureById (Standard_Integer theId);
const Graphic3d_CStructure* GetStructureById (Standard_Integer theId);
//! Access directly a collection of structures.
const NCollection_IndexedMap<const Graphic3d_CStructure*>& Structures() const { return myStructs; }

View File

@@ -41,35 +41,35 @@ private:
public:
//! Creates an empty primitive set for BVH clipping.
Standard_EXPORT Graphic3d_BvhCStructureSetTrsfPers (const Handle(Select3D_BVHBuilder3d)& theBuilder);
Graphic3d_BvhCStructureSetTrsfPers (const Handle(Select3D_BVHBuilder3d)& theBuilder);
//! Returns total number of structures.
Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
virtual Standard_Integer Size() const Standard_OVERRIDE;
//! Returns AABB of the structure.
Standard_EXPORT virtual Graphic3d_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
virtual Graphic3d_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
//! Calculates center of the AABB along given axis.
Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx,
const Standard_Integer theAxis) const Standard_OVERRIDE;
virtual Standard_Real Center (const Standard_Integer theIdx,
const Standard_Integer theAxis) const Standard_OVERRIDE;
//! Swaps structures with the given indices.
Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
const Standard_Integer theIdx2) Standard_OVERRIDE;
virtual void Swap (const Standard_Integer theIdx1,
const Standard_Integer theIdx2) Standard_OVERRIDE;
//! Adds structure to the set.
//! @return true if structure added, otherwise returns false (structure already in the set).
Standard_EXPORT Standard_Boolean Add (const Graphic3d_CStructure* theStruct);
Standard_Boolean Add (const Graphic3d_CStructure* theStruct);
//! Removes the given structure from the set.
//! @return true if structure removed, otherwise returns false (structure is not in the set).
Standard_EXPORT Standard_Boolean Remove (const Graphic3d_CStructure* theStruct);
Standard_Boolean Remove (const Graphic3d_CStructure* theStruct);
//! Cleans the whole primitive set.
Standard_EXPORT void Clear();
void Clear();
//! Returns the structure corresponding to the given ID.
Standard_EXPORT const Graphic3d_CStructure* GetStructureById (Standard_Integer theId);
const Graphic3d_CStructure* GetStructureById (Standard_Integer theId);
//! Access directly a collection of structures.
const NCollection_IndexedMap<const Graphic3d_CStructure*>& Structures() const { return myStructs; }
@@ -81,12 +81,12 @@ public:
}
//! Returns BVH tree for the given world view projection (builds it if necessary).
Standard_EXPORT const opencascade::handle<BVH_Tree<Standard_Real, 3> >& BVH (const Handle(Graphic3d_Camera)& theCamera,
const Graphic3d_Mat4d& theProjectionMatrix,
const Graphic3d_Mat4d& theWorldViewMatrix,
const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight,
const Graphic3d_WorldViewProjState& theWVPState);
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& BVH (const Handle(Graphic3d_Camera)& theCamera,
const Graphic3d_Mat4d& theProjectionMatrix,
const Graphic3d_Mat4d& theWorldViewMatrix,
const Standard_Integer theViewportWidth,
const Standard_Integer theViewportHeight,
const Graphic3d_WorldViewProjState& theWVPState);
//! Returns builder for bottom-level BVH.
const Handle(Select3D_BVHBuilder3d)& Builder() const { return myBuilder; }

View File

@@ -85,10 +85,10 @@ public:
private:
//! Lock the frame for decoding into.
Standard_EXPORT virtual Handle(Media_Frame) LockFrame() Standard_OVERRIDE;
virtual Handle(Media_Frame) LockFrame() Standard_OVERRIDE;
//! Release the frame to present decoding results.
Standard_EXPORT virtual void ReleaseFrame (const Handle(Media_Frame)& theFrame) Standard_OVERRIDE;
virtual void ReleaseFrame (const Handle(Media_Frame)& theFrame) Standard_OVERRIDE;
protected:

View File

@@ -77,8 +77,9 @@ namespace IMeshData
const size_t MEMORY_BLOCK_SIZE_HUGE = 512 * 1024;
#endif
typedef IMeshData_Edge* IEdgePtr;
typedef IMeshData_Face* IFacePtr;
typedef IMeshData_Edge* IEdgePtr;
typedef IMeshData_PCurve* IPCurvePtr;
typedef IMeshData_Face* IFacePtr;
typedef Handle(IMeshData_Edge) IEdgeHandle;
typedef Handle(IMeshData_Wire) IWireHandle;

View File

@@ -34,7 +34,6 @@ namespace
//=======================================================================
void visitEdges (const Handle (IMeshTools_ShapeVisitor)& theVisitor,
const TopoDS_Shape& theShape,
const Standard_Boolean isResetLocation,
const TopAbs_ShapeEnum theToFind,
const TopAbs_ShapeEnum theToAvoid = TopAbs_SHAPE)
{
@@ -47,9 +46,7 @@ namespace
continue;
}
theVisitor->Visit (isResetLocation ?
TopoDS::Edge (aEdge.Located (TopLoc_Location ())) :
aEdge);
theVisitor->Visit (aEdge);
}
}
}
@@ -80,7 +77,7 @@ void IMeshTools_ShapeExplorer::Accept (
const Handle (IMeshTools_ShapeVisitor)& theVisitor)
{
// Explore all free edges in shape.
visitEdges (theVisitor, GetShape (), Standard_True, TopAbs_EDGE, TopAbs_FACE);
visitEdges (theVisitor, GetShape (), TopAbs_EDGE, TopAbs_FACE);
// Explore all related to some face edges in shape.
// make array of faces suitable for processing (excluding faces without surface)
@@ -108,7 +105,7 @@ void IMeshTools_ShapeExplorer::Accept (
}
// Explore all edges in face.
visitEdges (theVisitor, aFace, Standard_False, TopAbs_EDGE);
visitEdges (theVisitor, aFace, TopAbs_EDGE);
// Store only forward faces in order to prevent inverse issue.
theVisitor->Visit (TopoDS::Face (aFace.Oriented (TopAbs_FORWARD)));

View File

@@ -252,13 +252,13 @@ Standard_Integer GenerateId()
// Function : WClass
// Purpose :
//=========================================================
const Handle(WNT_WClass)& IVtkDraw::WClass()
const Handle(Standard_Transient)& IVtkDraw::WClass()
{
static Handle(WNT_WClass) aWindowClass;
static Handle(Standard_Transient) aWindowClass;
#ifdef _WIN32
if (aWindowClass.IsNull())
{
aWindowClass = new WNT_WClass ("GWVTK_Class", NULL,
aWindowClass = new WNT_WClass ("GWVTK_Class", DefWindowProc,
CS_VREDRAW | CS_HREDRAW, 0, 0,
::LoadCursorW (NULL, IDC_ARROW));
}
@@ -305,7 +305,8 @@ void IVtkDraw::ViewerInit (Standard_Integer thePxLeft,
#ifdef _WIN32
if (GetWindow().IsNull())
{
GetWindow() = new WNT_Window ("IVtkTest", WClass(),
GetWindow() = new WNT_Window ("IVtkTest",
Handle(WNT_WClass)::DownCast (WClass()),
WS_OVERLAPPEDWINDOW,
aPxLeft, aPxTop,
aPxWidth, aPxHeight,

View File

@@ -21,7 +21,6 @@
#include <Standard_Macro.hxx>
class Draw_Interpretor;
class WNT_WClass;
class IVtkDraw
{
@@ -38,7 +37,7 @@ public:
Standard_EXPORT static void Commands (Draw_Interpretor& theCommands);
private:
Standard_EXPORT static const Handle(WNT_WClass)& WClass();
Standard_EXPORT static const Handle(Standard_Transient)& WClass();
};
#endif

View File

@@ -187,10 +187,6 @@ void IVtkDraw_Interactor::Initialize()
this->Size[1] = aSize[1];
}
#ifdef _WIN32
LRESULT CALLBACK WndProc(HWND theHWnd, UINT theUMsg, WPARAM theWParam, LPARAM theLParam);
#endif
//===========================================================
// Function : Enable
// Purpose :

View File

@@ -593,34 +593,20 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
return false;
}
Image_Format aFormat = Image_Format_UNKNOWN;
if (FreeImage_GetBPP (anImage) == 1)
{
FIBITMAP* aTmpImage = FreeImage_ConvertTo8Bits (anImage);
FreeImage_Unload (anImage);
anImage = aTmpImage;
}
if (anImage != NULL)
{
aFormat = convertFromFreeFormat (FreeImage_GetImageType(anImage),
FreeImage_GetColorType(anImage),
FreeImage_GetBPP (anImage));
if (aFormat == Image_Format_UNKNOWN)
{
FIBITMAP* aTmpImage = FreeImage_ConvertTo24Bits (anImage);
FreeImage_Unload (anImage);
anImage = aTmpImage;
if (anImage != NULL)
{
aFormat = convertFromFreeFormat (FreeImage_GetImageType(anImage),
FreeImage_GetColorType(anImage),
FreeImage_GetBPP (anImage));
}
}
}
Image_Format aFormat = convertFromFreeFormat (FreeImage_GetImageType(anImage),
FreeImage_GetColorType(anImage),
FreeImage_GetBPP (anImage));
if (aFormat == Image_Format_UNKNOWN)
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported pixel format.",
//anImage = FreeImage_ConvertTo24Bits (anImage);
::Message::DefaultMessenger()->Send ( TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported pixel format.",
Message_Fail);
return false;
}

View File

@@ -181,7 +181,7 @@ Handle(Image_PixMap) Image_Texture::loadImageOffset (const TCollection_AsciiStri
// ================================================================
TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
{
static const Standard_Size THE_PROBE_SIZE = 20;
static const int THE_PROBE_SIZE = 20;
char aBuffer[THE_PROBE_SIZE];
if (!myBuffer.IsNull())
{

View File

@@ -805,7 +805,7 @@ static Standard_Integer wavefront(Draw_Interpretor&, Standard_Integer nbarg, con
k1 = n1+totalnodes;
k2 = n2+totalnodes;
k3 = n3+totalnodes;
fprintf(outfile, "f %d%s%d %d%s%d %d%s%d\n", k1,"//", k1, k2,"//", k2, k3,"//", k3);
fprintf(outfile, "%s %d%s%d %d%s%d %d%s%d\n", "fo", k1,"//", k1, k2,"//", k2, k3,"//", k3);
}
nbpolygons += nbTriangles;
totalnodes += nbNodes;

View File

@@ -75,7 +75,7 @@ protected:
{
Standard_Size myValue;
public:
AlignedSize() : myValue(0) {}
AlignedSize(){}
AlignedSize(const Standard_Size theValue)
: myValue((theValue + Align - 1) & ~(Align - 1)) {}
operator Standard_Size() const {return myValue;}
@@ -86,7 +86,7 @@ protected:
{
Standard_Byte* myValue;
public:
AlignedPtr() : myValue(0) {}
AlignedPtr(){}
AlignedPtr(const Standard_Address theValue)
: myValue((Standard_Byte*)((Standard_Size)theValue & ~(Align - 1))) {}
operator Standard_Address () const {return myValue;}

View File

@@ -190,8 +190,8 @@ public:
private:
// Copy constructor and assignment operator are private thus not accessible
NCollection_SparseArrayBase(const NCollection_SparseArrayBase&);
void operator = (const NCollection_SparseArrayBase&);
NCollection_SparseArrayBase (const NCollection_SparseArrayBase&) {}
void operator = (const NCollection_SparseArrayBase&) {}
protected:
// Object life

View File

@@ -29,7 +29,7 @@
#include <tchar.h>
#endif
void _osd_wnt_set_error (OSD_Error&, Standard_Integer, ... );
void _osd_wnt_set_error (OSD_Error&, OSD_WhoAmI, ... );
#else
#include <errno.h>
#include <stdio.h>

View File

@@ -193,7 +193,7 @@ Standard_Integer OSD_DirectoryIterator::Error()const{
#define _FD ( ( PWIN32_FIND_DATAW )myData )
void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
OSD_DirectoryIterator :: OSD_DirectoryIterator (
const OSD_Path& where,
@@ -318,12 +318,7 @@ Standard_Integer OSD_DirectoryIterator :: Error () const {
} // end OSD_DirectoryIterator :: Error
// For compatibility with UNIX version
OSD_DirectoryIterator::OSD_DirectoryIterator()
: myFlag(false),
myHandle(0),
myData(0),
myFirstCall(Standard_False)
{}
OSD_DirectoryIterator::OSD_DirectoryIterator() {}
void OSD_DirectoryIterator::Initialize(
const OSD_Path&,

View File

@@ -25,7 +25,7 @@
#ifdef _WIN32
#include <windows.h>
void _osd_wnt_set_error (OSD_Error&, Standard_Integer, ... );
void _osd_wnt_set_error (OSD_Error&, OSD_WhoAmI, ... );
static TCollection_AsciiString _osd_wnt_set_disk_name (const OSD_Path& thePath)
{

View File

@@ -42,7 +42,7 @@
#define OPEN_OLD 1
#define OPEN_APPEND 2
void _osd_wnt_set_error (OSD_Error&, Standard_Integer, ...);
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
#ifndef OCCT_UWP
PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, const wchar_t* );

View File

@@ -267,7 +267,7 @@ Standard_Integer OSD_FileIterator::Error()const{
#define _FD ( ( PWIN32_FIND_DATAW )myData )
void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
OSD_FileIterator :: OSD_FileIterator (
const OSD_Path& where,
@@ -392,12 +392,7 @@ Standard_Integer OSD_FileIterator :: Error () const {
} // end OSD_FileIterator :: Error
// For compatibility with UNIX version
OSD_FileIterator::OSD_FileIterator()
: myFlag(Standard_False),
myHandle(0),
myData(0),
myFirstCall(Standard_False)
{}
OSD_FileIterator::OSD_FileIterator() {}
void OSD_FileIterator::Initialize(
const OSD_Path&,

View File

@@ -393,7 +393,7 @@ BOOL __fastcall _osd_wnt_sd_to_protection (
#endif
Standard_Integer __fastcall _get_file_type ( Standard_CString, HANDLE );
void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
static BOOL __fastcall _get_file_time (const wchar_t*, LPSYSTEMTIME, BOOL );
static void __fastcall _test_raise ( TCollection_AsciiString, Standard_CString );
@@ -825,7 +825,7 @@ Standard_Integer OSD_FileNode::Error () const {
} // end OSD_FileNode :: Error
void _osd_wnt_set_error ( OSD_Error& err, Standard_Integer who, ... ) {
void _osd_wnt_set_error ( OSD_Error& err, OSD_WhoAmI who, ... ) {
DWORD errCode;

View File

@@ -189,7 +189,7 @@ Standard_Integer OSD_Host::Error()const{
#pragma comment( lib, "WSOCK32.LIB" )
#endif
void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
static BOOL fInit = FALSE;
static TCollection_AsciiString hostName;
@@ -218,7 +218,11 @@ OSD_Host :: OSD_Host () {
ZeroMemory (szHostName, sizeof(char) * (MAX_COMPUTERNAME_LENGTH + 1));
// suppress GetVersionEx() deprecation warning
Standard_DISABLE_DEPRECATION_WARNINGS
#if defined(__INTEL_COMPILER)
#pragma warning(disable : 1478)
#elif defined(_MSC_VER)
#pragma warning(disable : 4996)
#endif
if (!GetVersionExW (&osVerInfo))
{
_osd_wnt_set_error (myError, OSD_WHost);
@@ -232,7 +236,9 @@ OSD_Host :: OSD_Host () {
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus (&ms);
} // end else
Standard_ENABLE_DEPRECATION_WARNINGS
#ifdef _MSC_VER
#pragma warning(default : 4996)
#endif
if ( !Failed () ) {

View File

@@ -21,12 +21,10 @@
#include <OSD_ThreadPool.hxx>
#include <Standard_ProgramError.hxx>
Standard_DISABLE_DEPRECATION_WARNINGS
#include <tbb/parallel_for.h>
#include <tbb/parallel_for_each.h>
#include <tbb/blocked_range.h>
#include <tbb/task_scheduler_init.h>
Standard_ENABLE_DEPRECATION_WARNINGS
//=======================================================================
//function : forEachExternal

View File

@@ -882,9 +882,8 @@ void OSD_Path::SetExtension(const TCollection_AsciiString& aName){
static void __fastcall _test_raise ( OSD_SysType, Standard_CString );
static void __fastcall _remove_dup ( TCollection_AsciiString& );
OSD_Path :: OSD_Path ()
: myUNCFlag(Standard_False), mySysDep(OSD_WindowsNT)
{
OSD_Path :: OSD_Path () {
} // end constructor ( 1 )
OSD_Path :: OSD_Path (

View File

@@ -187,7 +187,7 @@ Standard_Integer OSD_Process::Error()const{
//------------------- WNT Sources of OSD_Path ---------------------------
//------------------------------------------------------------------------
void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
// =======================================================================
// function : OSD_Process

View File

@@ -52,10 +52,10 @@ static inline Standard_Real GetWallClockTime ()
LARGE_INTEGER time;
return isOk && QueryPerformanceCounter (&time) ?
(Standard_Real)time.QuadPart / (Standard_Real)freq.QuadPart :
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
0.001 * GetTickCount64();
#else
#ifndef OCCT_UWP
0.001 * GetTickCount();
#else
0.001 * GetTickCount64();
#endif
}

View File

@@ -41,25 +41,25 @@ public:
public:
//! Default constructor.
Standard_EXPORT OpenGl_GraduatedTrihedron();
OpenGl_GraduatedTrihedron();
//! Destructor.
Standard_EXPORT virtual ~OpenGl_GraduatedTrihedron();
virtual ~OpenGl_GraduatedTrihedron();
//! Draw the element.
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
//! Release OpenGL resources.
Standard_EXPORT virtual void Release (OpenGl_Context* theCtx);
virtual void Release (OpenGl_Context* theCtx);
//! Setup configuration.
Standard_EXPORT void SetValues (const Graphic3d_GraduatedTrihedron& theData);
void SetValues (const Graphic3d_GraduatedTrihedron& theData);
//! Sets up-to-date values of scene bounding box.
//! Can be used in callback mechanism to get up-to-date values.
//! @sa Graphic3d_GraduatedTrihedron::CubicAxesCallback
Standard_EXPORT void SetMinMax (const OpenGl_Vec3& theMin,
const OpenGl_Vec3& theMax);
void SetMinMax (const OpenGl_Vec3& theMin,
const OpenGl_Vec3& theMax);
private:

View File

@@ -35,10 +35,10 @@ class OpenGl_LayerList
public:
//! Constructor
Standard_EXPORT OpenGl_LayerList (const Standard_Integer theNbPriorities);
OpenGl_LayerList (const Standard_Integer theNbPriorities);
//! Destructor
Standard_EXPORT virtual ~OpenGl_LayerList();
virtual ~OpenGl_LayerList();
//! Method returns the number of available priorities
Standard_Integer NbPriorities() const { return myNbPriorities; }
@@ -50,40 +50,40 @@ public:
Standard_Integer NbImmediateStructures() const { return myImmediateNbStructures; }
//! Insert a new layer with id.
Standard_EXPORT void InsertLayerBefore (const Graphic3d_ZLayerId theNewLayerId,
const Graphic3d_ZLayerSettings& theSettings,
const Graphic3d_ZLayerId theLayerAfter);
void InsertLayerBefore (const Graphic3d_ZLayerId theNewLayerId,
const Graphic3d_ZLayerSettings& theSettings,
const Graphic3d_ZLayerId theLayerAfter);
//! Insert a new layer with id.
Standard_EXPORT void InsertLayerAfter (const Graphic3d_ZLayerId theNewLayerId,
const Graphic3d_ZLayerSettings& theSettings,
const Graphic3d_ZLayerId theLayerBefore);
void InsertLayerAfter (const Graphic3d_ZLayerId theNewLayerId,
const Graphic3d_ZLayerSettings& theSettings,
const Graphic3d_ZLayerId theLayerBefore);
//! Remove layer by its id.
Standard_EXPORT void RemoveLayer (const Graphic3d_ZLayerId theLayerId);
void RemoveLayer (const Graphic3d_ZLayerId theLayerId);
//! Add structure to list with given priority. The structure will be inserted
//! to specified layer. If the layer isn't found, the structure will be put
//! to default bottom-level layer.
Standard_EXPORT void AddStructure (const OpenGl_Structure* theStruct,
const Graphic3d_ZLayerId theLayerId,
const Standard_Integer thePriority,
Standard_Boolean isForChangePriority = Standard_False);
void AddStructure (const OpenGl_Structure* theStruct,
const Graphic3d_ZLayerId theLayerId,
const Standard_Integer thePriority,
Standard_Boolean isForChangePriority = Standard_False);
//! Remove structure from structure list and return its previous priority
Standard_EXPORT void RemoveStructure (const OpenGl_Structure* theStructure);
void RemoveStructure (const OpenGl_Structure* theStructure);
//! Change structure z layer
//! If the new layer is not presented, the structure will be displayed
//! in default z layer
Standard_EXPORT void ChangeLayer (const OpenGl_Structure* theStructure,
const Graphic3d_ZLayerId theOldLayerId,
const Graphic3d_ZLayerId theNewLayerId);
void ChangeLayer (const OpenGl_Structure* theStructure,
const Graphic3d_ZLayerId theOldLayerId,
const Graphic3d_ZLayerId theNewLayerId);
//! Changes structure priority within its ZLayer
Standard_EXPORT void ChangePriority (const OpenGl_Structure* theStructure,
const Graphic3d_ZLayerId theLayerId,
const Standard_Integer theNewPriority);
void ChangePriority (const OpenGl_Structure* theStructure,
const Graphic3d_ZLayerId theLayerId,
const Standard_Integer theNewPriority);
//! Returns reference to the layer with given ID.
OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) { return *myLayerIds.Find (theLayerId); }
@@ -92,19 +92,19 @@ public:
const OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) const { return *myLayerIds.Find (theLayerId); }
//! Assign new settings to the layer.
Standard_EXPORT void SetLayerSettings (const Graphic3d_ZLayerId theLayerId,
const Graphic3d_ZLayerSettings& theSettings);
void SetLayerSettings (const Graphic3d_ZLayerId theLayerId,
const Graphic3d_ZLayerSettings& theSettings);
//! Update culling state - should be called before rendering.
Standard_EXPORT void UpdateCulling (const Handle(OpenGl_Workspace)& theWorkspace,
const Standard_Boolean theToDrawImmediate);
void UpdateCulling (const Handle(OpenGl_Workspace)& theWorkspace,
const Standard_Boolean theToDrawImmediate);
//! Render this element
Standard_EXPORT void Render (const Handle(OpenGl_Workspace)& theWorkspace,
const Standard_Boolean theToDrawImmediate,
const OpenGl_LayerFilter theLayersToProcess,
OpenGl_FrameBuffer* theReadDrawFbo,
OpenGl_FrameBuffer* theOitAccumFbo) const;
void Render (const Handle(OpenGl_Workspace)& theWorkspace,
const Standard_Boolean theToDrawImmediate,
const OpenGl_LayerFilter theLayersToProcess,
OpenGl_FrameBuffer* theReadDrawFbo,
OpenGl_FrameBuffer* theOitAccumFbo) const;
//! Returns the set of OpenGL Z-layers.
const NCollection_List<Handle(Graphic3d_Layer)>& Layers() const { return myLayers; }
@@ -114,7 +114,7 @@ public:
//! Marks BVH tree for given priority list as dirty and
//! marks primitive set for rebuild.
Standard_EXPORT void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId);
void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId);
//! Returns structure modification state (for ray-tracing).
Standard_Size ModificationStateOfRaytracable() const { return myModifStateOfRaytraceable; }
@@ -123,7 +123,7 @@ public:
const Handle(Select3D_BVHBuilder3d)& FrustumCullingBVHBuilder() const { return myBVHBuilder; }
//! Assigns BVH tree builder for frustom culling.
Standard_EXPORT void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder);
void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder);
protected:
@@ -184,16 +184,16 @@ protected:
//! @param theGlobalSettings [in] the set of global settings used for rendering.
//! @param theReadDrawFbo [in] the framebuffer for reading depth and writing final color.
//! @param theOitAccumFbo [in] the framebuffer for accumulating color and coverage for OIT process.
Standard_EXPORT void renderTransparent (const Handle(OpenGl_Workspace)& theWorkspace,
OpenGl_LayerStack::iterator& theLayerIter,
const OpenGl_GlobalLayerSettings& theGlobalSettings,
OpenGl_FrameBuffer* theReadDrawFbo,
OpenGl_FrameBuffer* theOitAccumFbo) const;
void renderTransparent (const Handle(OpenGl_Workspace)& theWorkspace,
OpenGl_LayerStack::iterator& theLayerIter,
const OpenGl_GlobalLayerSettings& theGlobalSettings,
OpenGl_FrameBuffer* theReadDrawFbo,
OpenGl_FrameBuffer* theOitAccumFbo) const;
// Render structures within specified layer.
Standard_EXPORT void renderLayer (const Handle(OpenGl_Workspace)& theWorkspace,
const OpenGl_GlobalLayerSettings& theDefaultSettings,
const Graphic3d_Layer& theLayer) const;
void renderLayer (const Handle(OpenGl_Workspace)& theWorkspace,
const OpenGl_GlobalLayerSettings& theDefaultSettings,
const Graphic3d_Layer& theLayer) const;
protected:

View File

@@ -48,13 +48,13 @@ public:
//! By default the parameters are:
//! - IsEnabled (true),
//! - TypeOfHatch (0).
Standard_EXPORT OpenGl_LineAttributes();
OpenGl_LineAttributes();
//! Default destructor.
Standard_EXPORT virtual ~OpenGl_LineAttributes();
virtual ~OpenGl_LineAttributes();
//! Release GL resources.
Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx) Standard_OVERRIDE;
virtual void Release (OpenGl_Context* theGlCtx) Standard_OVERRIDE;
//! Returns estimated GPU memory usage - not implemented.
virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
@@ -63,14 +63,14 @@ public:
int TypeOfHatch() const { return myTypeOfHatch; }
//! Sets type of the hatch.
Standard_EXPORT int SetTypeOfHatch (const OpenGl_Context* theGlCtx,
const Handle(Graphic3d_HatchStyle)& theStyle);
int SetTypeOfHatch (const OpenGl_Context* theGlCtx,
const Handle(Graphic3d_HatchStyle)& theStyle);
//! Current enabled state of the hatching rasterization.
bool IsEnabled() const { return myIsEnabled; }
//! Turns on/off the hatching rasterization rasterization.
Standard_EXPORT bool SetEnabled (const OpenGl_Context* theGlCtx, const bool theToEnable);
bool SetEnabled (const OpenGl_Context* theGlCtx, const bool theToEnable);
protected:

View File

@@ -33,13 +33,13 @@ class OpenGl_PrimitiveArray;
namespace OpenGl_Raytrace
{
//! Checks to see if the group contains ray-trace geometry.
Standard_EXPORT Standard_Boolean IsRaytracedGroup (const OpenGl_Group* theGroup);
Standard_Boolean IsRaytracedGroup (const OpenGl_Group* theGroup);
//! Checks to see if the element contains ray-trace geometry.
Standard_EXPORT Standard_Boolean IsRaytracedElement (const OpenGl_ElementNode* theNode);
Standard_Boolean IsRaytracedElement (const OpenGl_ElementNode* theNode);
//! Checks to see if the element contains ray-trace geometry.
Standard_EXPORT Standard_Boolean IsRaytracedElement (const OpenGl_Element* theElement);
Standard_Boolean IsRaytracedElement (const OpenGl_Element* theElement);
}
//! Stores properties of surface material.
@@ -70,7 +70,7 @@ struct OpenGl_RaytraceMaterial
public:
//! Empty constructor.
Standard_EXPORT OpenGl_RaytraceMaterial();
OpenGl_RaytraceMaterial();
//! Returns packed (serialized) representation of material.
const Standard_ShortReal* Packed()
@@ -92,8 +92,8 @@ public:
OpenGl_RaytraceLight() { }
//! Creates new light source.
Standard_EXPORT OpenGl_RaytraceLight (const BVH_Vec4f& theEmission,
const BVH_Vec4f& thePosition);
OpenGl_RaytraceLight (const BVH_Vec4f& theEmission,
const BVH_Vec4f& thePosition);
//! Returns packed (serialized) representation of light source.
const Standard_ShortReal* Packed()
@@ -118,8 +118,8 @@ public:
public:
//! Creates new OpenGL element triangulation.
Standard_EXPORT OpenGl_TriangleSet (const Standard_Size theArrayID,
const opencascade::handle<BVH_Builder<Standard_ShortReal, 3> >& theBuilder);
OpenGl_TriangleSet (const Standard_Size theArrayID,
const opencascade::handle<BVH_Builder<Standard_ShortReal, 3> >& theBuilder);
//! Returns ID of associated primitive array.
Standard_Size AssociatedPArrayID() const
@@ -154,10 +154,10 @@ public:
using BVH_Triangulation<Standard_ShortReal, 3>::Box;
//! Returns centroid position along the given axis.
Standard_EXPORT virtual Standard_ShortReal Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const Standard_OVERRIDE;
virtual Standard_ShortReal Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const Standard_OVERRIDE;
//! Returns quad BVH (QBVH) tree produced from binary BVH.
Standard_EXPORT const QuadBvhHandle& QuadBVH();
const QuadBvhHandle& QuadBVH();
public:
@@ -228,35 +228,35 @@ public:
}
//! Clears ray-tracing geometry.
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
virtual void Clear() Standard_OVERRIDE;
public: //! @name methods related to acceleration structure
//! Performs post-processing of high-level scene BVH.
Standard_EXPORT Standard_Boolean ProcessAcceleration();
Standard_Boolean ProcessAcceleration();
//! Returns offset of bottom-level BVH for given leaf node.
//! If the node index is not valid the function returns -1.
//! @note Can be used after processing acceleration structure.
Standard_EXPORT Standard_Integer AccelerationOffset (Standard_Integer theNodeIdx);
Standard_Integer AccelerationOffset (Standard_Integer theNodeIdx);
//! Returns offset of triangulation vertices for given leaf node.
//! If the node index is not valid the function returns -1.
//! @note Can be used after processing acceleration structure.
Standard_EXPORT Standard_Integer VerticesOffset (Standard_Integer theNodeIdx);
Standard_Integer VerticesOffset (Standard_Integer theNodeIdx);
//! Returns offset of triangulation elements for given leaf node.
//! If the node index is not valid the function returns -1.
//! @note Can be used after processing acceleration structure.
Standard_EXPORT Standard_Integer ElementsOffset (Standard_Integer theNodeIdx);
Standard_Integer ElementsOffset (Standard_Integer theNodeIdx);
//! Returns triangulation data for given leaf node.
//! If the node index is not valid the function returns NULL.
//! @note Can be used after processing acceleration structure.
Standard_EXPORT OpenGl_TriangleSet* TriangleSet (Standard_Integer theNodeIdx);
OpenGl_TriangleSet* TriangleSet (Standard_Integer theNodeIdx);
//! Returns quad BVH (QBVH) tree produced from binary BVH.
Standard_EXPORT const QuadBvhHandle& QuadBVH();
const QuadBvhHandle& QuadBVH();
public: //! @name methods related to texture management
@@ -267,16 +267,16 @@ public: //! @name methods related to texture management
}
//! Adds new OpenGL texture to the scene and returns its index.
Standard_EXPORT Standard_Integer AddTexture (const Handle(OpenGl_Texture)& theTexture);
Standard_Integer AddTexture (const Handle(OpenGl_Texture)& theTexture);
//! Updates unique 64-bit texture handles to use in shaders.
Standard_EXPORT Standard_Boolean UpdateTextureHandles (const Handle(OpenGl_Context)& theContext);
Standard_Boolean UpdateTextureHandles (const Handle(OpenGl_Context)& theContext);
//! Makes the OpenGL texture handles resident (must be called before using).
Standard_EXPORT Standard_Boolean AcquireTextures (const Handle(OpenGl_Context)& theContext);
Standard_Boolean AcquireTextures (const Handle(OpenGl_Context)& theContext);
//! Makes the OpenGL texture handles non-resident (must be called after using).
Standard_EXPORT Standard_Boolean ReleaseTextures (const Handle(OpenGl_Context)& theContext) const;
Standard_Boolean ReleaseTextures (const Handle(OpenGl_Context)& theContext) const;
//! Returns array of texture handles.
const std::vector<GLuint64>& TextureHandles() const

View File

@@ -23,19 +23,19 @@ class OpenGl_StencilTest : public OpenGl_Element
public:
//! Default constructor
Standard_EXPORT OpenGl_StencilTest ();
OpenGl_StencilTest ();
//! Render primitives to the window
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
virtual void Release (OpenGl_Context* theContext);
Standard_EXPORT void SetOptions (const Standard_Boolean theIsEnabled);
void SetOptions (const Standard_Boolean theIsEnabled);
protected:
//! Destructor
Standard_EXPORT virtual ~OpenGl_StencilTest();
virtual ~OpenGl_StencilTest();
private:
Standard_Boolean myIsEnabled;

View File

@@ -100,10 +100,10 @@ public:
Standard_EXPORT void Clear (const Handle(OpenGl_Context)& theGlCtx);
//! Renders the structure.
Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
//! Releases structure resources.
Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
//! This method releases GL resources without actual elements destruction.
//! As result structure could be correctly destroyed layer without GL context

View File

@@ -31,10 +31,10 @@ public:
public:
//! Raise exception on API misuse.
Standard_EXPORT virtual void Connect (Graphic3d_CStructure& ) Standard_OVERRIDE;
virtual void Connect (Graphic3d_CStructure& ) Standard_OVERRIDE;
//! Raise exception on API misuse.
Standard_EXPORT virtual void Disconnect (Graphic3d_CStructure& ) Standard_OVERRIDE;
virtual void Disconnect (Graphic3d_CStructure& ) Standard_OVERRIDE;
private:

View File

@@ -19,10 +19,15 @@ Poly_MakeLoops.cxx
Poly_MakeLoops.hxx
Poly_Polygon2D.cxx
Poly_Polygon2D.hxx
Poly_Polygon2D.lxx
Poly_Polygon3D.cxx
Poly_Polygon3D.hxx
Poly_Polygon3D.lxx
Poly_PolygonOnTriangulation.cxx
Poly_PolygonOnTriangulation.hxx
Poly_PolygonOnTriangulation.lxx
Poly_Triangle.cxx
Poly_Triangle.hxx
Poly_Triangle.lxx
Poly_Triangulation.cxx
Poly_Triangulation.hxx

View File

@@ -14,24 +14,17 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Pnt2d.hxx>
#include <Poly_Polygon2D.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
//=======================================================================
//function : Poly_Polygon2D
//purpose :
//=======================================================================
Poly_Polygon2D::Poly_Polygon2D (const Standard_Integer theNbNodes)
: myDeflection (0.0),
myNodes (1, theNbNodes)
{
//
}
//=======================================================================
//function : Poly_Polygon2D
//purpose :
//purpose :
//=======================================================================
Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes):
myDeflection(0.),
@@ -41,3 +34,35 @@ Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes):
for (i = Nodes.Lower(); i <= Nodes.Upper(); i++)
myNodes(j++) = Nodes(i);
}
//=======================================================================
//function : Deflection
//purpose :
//=======================================================================
Standard_Real Poly_Polygon2D::Deflection() const
{
return myDeflection;
}
//=======================================================================
//function : Deflection
//purpose :
//=======================================================================
void Poly_Polygon2D::Deflection(const Standard_Real D)
{
myDeflection = D;
}
//=======================================================================
//function : Nodes
//purpose :
//=======================================================================
const TColgp_Array1OfPnt2d& Poly_Polygon2D::Nodes() const
{
return myNodes;
}

View File

@@ -17,10 +17,17 @@
#ifndef _Poly_Polygon2D_HeaderFile
#define _Poly_Polygon2D_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Real.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Integer.hxx>
class Standard_NullObject;
class Poly_Polygon2D;
DEFINE_STANDARD_HANDLE(Poly_Polygon2D, Standard_Transient)
//! Provides a polygon in 2D space (for example, in the
@@ -31,14 +38,13 @@ DEFINE_STANDARD_HANDLE(Poly_Polygon2D, Standard_Transient)
//! repeated at the end of the table of nodes.
class Poly_Polygon2D : public Standard_Transient
{
public:
//! Constructs a 2D polygon with specified number of nodes.
Standard_EXPORT explicit Poly_Polygon2D (const Standard_Integer theNbNodes);
//! Constructs a 2D polygon defined by the table of points, <Nodes>.
Standard_EXPORT Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes);
//! Returns the deflection of this polygon.
//! Deflection is used in cases where the polygon is an
//! approximate representation of a curve. Deflection
@@ -58,30 +64,44 @@ public:
//! deflection to each polygon. In this case, the Deflection
//! function is used to set a value on each polygon, and
//! later to fetch the value.
Standard_Real Deflection() const { return myDeflection; }
//! Sets the deflection of this polygon.
void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
Standard_EXPORT Standard_Real Deflection() const;
//! Sets the deflection of this polygon to D
Standard_EXPORT void Deflection (const Standard_Real D);
//! Returns the number of nodes in this polygon.
//! Note: If the polygon is closed, the point of closure is
//! repeated at the end of its table of nodes. Thus, on a closed
//! triangle, the function NbNodes returns 4.
Standard_Integer NbNodes() const { return myNodes.Length(); }
Standard_Integer NbNodes() const;
//! Returns the table of nodes for this polygon.
const TColgp_Array1OfPnt2d& Nodes() const { return myNodes; }
Standard_EXPORT const TColgp_Array1OfPnt2d& Nodes() const;
//! Returns the table of nodes for this polygon.
TColgp_Array1OfPnt2d& ChangeNodes() { return myNodes; }
DEFINE_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
protected:
private:
Standard_Real myDeflection;
TColgp_Array1OfPnt2d myNodes;
};
#include <Poly_Polygon2D.lxx>
#endif // _Poly_Polygon2D_HeaderFile

View File

@@ -0,0 +1,26 @@
// Created on: 1995-03-09
// Created by: Laurent PAINNOT
// Copyright (c) 1995-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.
//=======================================================================
//function : NbNodes
//purpose :
//=======================================================================
inline Standard_Integer Poly_Polygon2D::NbNodes() const
{
return myNodes.Length();
}

View File

@@ -14,25 +14,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Pnt.hxx>
#include <Poly_Polygon3D.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
//=======================================================================
//function : Poly_Polygon3D
//purpose :
//=======================================================================
Poly_Polygon3D::Poly_Polygon3D (const Standard_Integer theNbNodes,
const Standard_Boolean theHasParams)
: myDeflection (0.0),
myNodes (1, theNbNodes)
{
if (theHasParams)
{
myParameters = new TColStd_HArray1OfReal (1, theNbNodes);
}
}
//=======================================================================
//function : Poly_Polygon3D
//purpose :
@@ -81,3 +70,67 @@ Handle(Poly_Polygon3D) Poly_Polygon3D::Copy() const
aCopy->Deflection(myDeflection);
return aCopy;
}
//=======================================================================
//function : Deflection
//purpose :
//=======================================================================
Standard_Real Poly_Polygon3D::Deflection() const
{
return myDeflection;
}
//=======================================================================
//function : Deflection
//purpose :
//=======================================================================
void Poly_Polygon3D::Deflection(const Standard_Real D)
{
myDeflection = D;
}
//=======================================================================
//function : Nodes
//purpose :
//=======================================================================
const TColgp_Array1OfPnt& Poly_Polygon3D::Nodes() const
{
return myNodes;
}
//=======================================================================
//function : HasParameters
//purpose :
//=======================================================================
Standard_Boolean Poly_Polygon3D::HasParameters() const
{
return !myParameters.IsNull();
}
//=======================================================================
//function : Parameters
//purpose :
//=======================================================================
const TColStd_Array1OfReal& Poly_Polygon3D::Parameters() const
{
return myParameters->Array1();
}
//=======================================================================
//function : ChangeParameters
//purpose :
//=======================================================================
TColStd_Array1OfReal& Poly_Polygon3D::ChangeParameters() const
{
return myParameters->ChangeArray1();
}

View File

@@ -17,12 +17,20 @@
#ifndef _Poly_Polygon3D_HeaderFile
#define _Poly_Polygon3D_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <Standard_Real.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <Standard_Transient.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_NullObject;
class Poly_Polygon3D;
DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
//! This class Provides a polygon in 3D space. It is generally an approximate representation of a curve.
@@ -34,13 +42,11 @@ DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
//! parameter of the corresponding point on the curve.
class Poly_Polygon3D : public Standard_Transient
{
public:
//! Constructs a 3D polygon with specific number of nodes.
Standard_EXPORT Poly_Polygon3D (const Standard_Integer theNbNodes,
const Standard_Boolean theHasParams);
//! Constructs a 3D polygon defined by the table of points, Nodes.
//! onstructs a 3D polygon defined by the table of points, Nodes.
Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes);
//! Constructs a 3D polygon defined by
@@ -57,45 +63,59 @@ public:
Standard_EXPORT virtual Handle(Poly_Polygon3D) Copy() const;
//! Returns the deflection of this polygon
Standard_Real Deflection() const { return myDeflection; }
//! Sets the deflection of this polygon. See more on deflection in Poly_Polygon2D
void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
Standard_EXPORT Standard_Real Deflection() const;
//! Sets the deflection of this polygon to D. See more on deflection in Poly_Polygon2D
Standard_EXPORT void Deflection (const Standard_Real D);
//! Returns the number of nodes in this polygon.
//! Note: If the polygon is closed, the point of closure is
//! repeated at the end of its table of nodes. Thus, on a closed
//! triangle the function NbNodes returns 4.
Standard_Integer NbNodes() const { return myNodes.Length(); }
Standard_Integer NbNodes() const;
//! Returns the table of nodes for this polygon.
const TColgp_Array1OfPnt& Nodes() const { return myNodes; }
//! Returns the table of nodes for this polygon.
TColgp_Array1OfPnt& ChangeNodes() { return myNodes; }
Standard_EXPORT const TColgp_Array1OfPnt& Nodes() const;
//! Returns the table of the parameters associated with each node in this polygon.
//! HasParameters function checks if parameters are associated with the nodes of this polygon.
Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
Standard_EXPORT Standard_Boolean HasParameters() const;
//! Returns true if parameters are associated with the nodes
//! in this polygon.
const TColStd_Array1OfReal& Parameters() const { return myParameters->Array1(); }
Standard_EXPORT const TColStd_Array1OfReal& Parameters() const;
//! Returns the table of the parameters associated with each node in this polygon.
//! ChangeParameters function returnes the array as shared. Therefore if the table is selected by
//! reference you can, by simply modifying it, directly modify
//! the data structure of this polygon.
TColStd_Array1OfReal& ChangeParameters() const { return myParameters->ChangeArray1(); }
Standard_EXPORT TColStd_Array1OfReal& ChangeParameters() const;
DEFINE_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
protected:
private:
Standard_Real myDeflection;
TColgp_Array1OfPnt myNodes;
Handle(TColStd_HArray1OfReal) myParameters;
};
#include <Poly_Polygon3D.lxx>
#endif // _Poly_Polygon3D_HeaderFile

View File

@@ -0,0 +1,26 @@
// Created on: 1995-03-09
// Created by: Laurent PAINNOT
// Copyright (c) 1995-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.
//=======================================================================
//function : NbNodes
//purpose :
//=======================================================================
inline Standard_Integer Poly_Polygon3D::NbNodes() const
{
return myNodes.Length();
}

View File

@@ -14,25 +14,13 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Poly_PolygonOnTriangulation.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
//=======================================================================
//function : Poly_PolygonOnTriangulation
//purpose :
//=======================================================================
Poly_PolygonOnTriangulation::Poly_PolygonOnTriangulation (const Standard_Integer theNbNodes,
const Standard_Boolean theHasParams)
: myDeflection (0.0),
myNodes (1, theNbNodes)
{
if (theHasParams)
{
myParameters = new TColStd_HArray1OfReal (1, theNbNodes);
}
}
//=======================================================================
//function : Poly_PolygonOnTriangulation
//purpose :
@@ -78,16 +66,53 @@ Handle(Poly_PolygonOnTriangulation) Poly_PolygonOnTriangulation::Copy() const
}
//=======================================================================
//function : SetParameters
//purpose :
//function : Deflection
//purpose :
//=======================================================================
void Poly_PolygonOnTriangulation::SetParameters (const Handle(TColStd_HArray1OfReal)& theParameters)
Standard_Real Poly_PolygonOnTriangulation::Deflection() const
{
if (!theParameters.IsNull()
&& (theParameters->Lower() != myNodes.Lower()
|| theParameters->Upper() != myNodes.Upper()))
{
throw Standard_OutOfRange ("Poly_PolygonOnTriangulation::SetParameters() - invalid array size");
}
myParameters = theParameters;
return myDeflection;
}
//=======================================================================
//function : Deflection
//purpose :
//=======================================================================
void Poly_PolygonOnTriangulation::Deflection(const Standard_Real D)
{
myDeflection = D;
}
//=======================================================================
//function : Nodes
//purpose :
//=======================================================================
const TColStd_Array1OfInteger& Poly_PolygonOnTriangulation::Nodes() const
{
return myNodes;
}
//=======================================================================
//function : HasParameters
//purpose :
//=======================================================================
Standard_Boolean Poly_PolygonOnTriangulation::HasParameters() const
{
return (!myParameters.IsNull());
}
//=======================================================================
//function : Parameters
//purpose :
//=======================================================================
Handle(TColStd_HArray1OfReal) Poly_PolygonOnTriangulation::Parameters() const
{
return myParameters;
}

View File

@@ -17,13 +17,20 @@
#ifndef _Poly_PolygonOnTriangulation_HeaderFile
#define _Poly_PolygonOnTriangulation_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <Standard_Real.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <Standard_Transient.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_NullObject;
class Poly_PolygonOnTriangulation;
DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
//! This class provides a polygon in 3D space, based on the triangulation
@@ -40,15 +47,14 @@ DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
//! curve.represents a 3d Polygon
class Poly_PolygonOnTriangulation : public Standard_Transient
{
public:
//! Constructs a 3D polygon on the triangulation of a shape with specified size of nodes.
Standard_EXPORT Poly_PolygonOnTriangulation (const Standard_Integer theNbNodes,
const Standard_Boolean theHasParams);
//! Constructs a 3D polygon on the triangulation of a shape,
//! defined by the table of nodes, <Nodes>.
Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes);
//! Constructs a 3D polygon on the triangulation of a shape, defined by:
//! - the table of nodes, Nodes, and the table of parameters, <Parameters>.
@@ -67,51 +73,59 @@ public:
Standard_EXPORT virtual Handle(Poly_PolygonOnTriangulation) Copy() const;
//! Returns the deflection of this polygon
Standard_Real Deflection() const { return myDeflection; }
//! Sets the deflection of this polygon.
Standard_EXPORT Standard_Real Deflection() const;
//! Sets the deflection of this polygon to D.
//! See more on deflection in Poly_Polygones2D.
void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
Standard_EXPORT void Deflection (const Standard_Real D);
//! Returns the number of nodes for this polygon.
//! Note: If the polygon is closed, the point of closure is
//! repeated at the end of its table of nodes. Thus, on a closed
//! triangle, the function NbNodes returns 4.
Standard_Integer NbNodes() const { return myNodes.Length(); }
Standard_Integer NbNodes() const;
//! Returns the table of nodes for this polygon. A node value
//! is an index in the table of nodes specific to an existing
//! triangulation of a shape.
const TColStd_Array1OfInteger& Nodes() const { return myNodes; }
//! Returns the table of nodes for this polygon for modification.
TColStd_Array1OfInteger& ChangeNodes() { return myNodes; }
Standard_EXPORT const TColStd_Array1OfInteger& Nodes() const;
//! Returns true if parameters are associated with the nodes in this polygon.
Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
Standard_EXPORT Standard_Boolean HasParameters() const;
//! Returns the table of the parameters associated with each node in this polygon.
//! Warning
//! Use the function HasParameters to check if parameters
//! are associated with the nodes in this polygon.
const Handle(TColStd_HArray1OfReal)& Parameters() const { return myParameters; }
Standard_EXPORT Handle(TColStd_HArray1OfReal) Parameters() const;
//! Returns the table of the parameters associated with each node in this polygon.
//! Warning! HasParameters() should be called beforehand to check if parameters array is allocated.
TColStd_Array1OfReal& ChangeParameters() { return myParameters->ChangeArray1(); }
//! Sets the table of the parameters associated with each node in this polygon.
//! Raises exception if array size doesn't much number of polygon nodes.
Standard_EXPORT void SetParameters (const Handle(TColStd_HArray1OfReal)& theParameters);
DEFINE_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
protected:
private:
Standard_Real myDeflection;
TColStd_Array1OfInteger myNodes;
Handle(TColStd_HArray1OfReal) myParameters;
};
#include <Poly_PolygonOnTriangulation.lxx>
#endif // _Poly_PolygonOnTriangulation_HeaderFile

View File

@@ -0,0 +1,24 @@
// Copyright (c) 1996-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.
//=======================================================================
//function : NbNodes
//purpose :
//=======================================================================
inline Standard_Integer Poly_PolygonOnTriangulation::NbNodes() const
{
return myNodes.Length();
}

View File

@@ -0,0 +1,71 @@
// Created on: 1995-03-06
// Created by: Laurent PAINNOT
// Copyright (c) 1995-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 <Poly_Triangle.hxx>
#include <Standard_OutOfRange.hxx>
//=======================================================================
//function : Poly_Triangle
//purpose :
//=======================================================================
Poly_Triangle::Poly_Triangle()
{
myNodes[0] = myNodes[1] = myNodes[2] = 0;
}
//=======================================================================
//function : Poly_Triangle
//purpose :
//=======================================================================
Poly_Triangle::Poly_Triangle(const Standard_Integer N1,
const Standard_Integer N2,
const Standard_Integer N3)
{
myNodes[0] = N1;
myNodes[1] = N2;
myNodes[2] = N3;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void Poly_Triangle::Set(const Standard_Integer N1,
const Standard_Integer N2,
const Standard_Integer N3)
{
myNodes[0] = N1;
myNodes[1] = N2;
myNodes[2] = N3;
}
//=======================================================================
//function : Get
//purpose :
//=======================================================================
void Poly_Triangle::Get(Standard_Integer& N1,
Standard_Integer& N2,
Standard_Integer& N3) const
{
N1 = myNodes[0];
N2 = myNodes[1];
N3 = myNodes[2];
}

View File

@@ -20,79 +20,81 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OutOfRange.hxx>
//! Describes a component triangle of a triangulation (Poly_Triangulation object).
//! A Triangle is defined by a triplet of nodes.
//! Each node is an index in the table of nodes specific to an existing
#include <Standard_Integer.hxx>
class Standard_OutOfRange;
//! Describes a component triangle of a triangulation
//! (Poly_Triangulation object).
//! A Triangle is defined by a triplet of nodes. Each node is an
//! index in the table of nodes specific to an existing
//! triangulation of a shape, and represents a point on the surface.
class Poly_Triangle
class Poly_Triangle
{
public:
DEFINE_STANDARD_ALLOC
//! Constructs a triangle and sets all indices to zero.
Poly_Triangle() { myNodes[0] = myNodes[1] = myNodes[2] = 0; }
//! Constructs a triangle and sets its three indices,
//! where these node values are indices in the table of nodes specific to an existing triangulation of a shape.
Poly_Triangle (const Standard_Integer theN1, const Standard_Integer theN2, const Standard_Integer theN3)
{
myNodes[0] = theN1;
myNodes[1] = theN2;
myNodes[2] = theN3;
}
//! Sets the value of the three nodes of this triangle.
void Set (const Standard_Integer theN1, const Standard_Integer theN2, const Standard_Integer theN3)
{
myNodes[0] = theN1;
myNodes[1] = theN2;
myNodes[2] = theN3;
}
//! Sets the value of node with specified index of this triangle.
//! Raises Standard_OutOfRange if index is not in 1,2,3
void Set (const Standard_Integer theIndex, const Standard_Integer theNode)
{
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::Set(), invalid index");
myNodes[theIndex - 1] = theNode;
}
//! Returns the node indices of this triangle.
void Get (Standard_Integer& theN1, Standard_Integer& theN2, Standard_Integer& theN3) const
{
theN1 = myNodes[0];
theN2 = myNodes[1];
theN3 = myNodes[2];
}
//! Constructs a triangle and sets all indices to zero.
Standard_EXPORT Poly_Triangle();
//! Constructs a triangle and sets its three indices
//! to N1, N2 and N3 respectively, where these node values
//! are indices in the table of nodes specific to an existing
//! triangulation of a shape.
Standard_EXPORT Poly_Triangle(const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
//! Sets the value of the three nodes of this triangle to N1, N2 and N3 respectively.
Standard_EXPORT void Set (const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
//! Sets the value of the Indexth node of this triangle to Node.
//! Raises OutOfRange if Index is not in 1,2,3
void Set (const Standard_Integer Index, const Standard_Integer Node);
//! Returns the node indices of this triangle in N1, N2 and N3.
Standard_EXPORT void Get (Standard_Integer& N1, Standard_Integer& N2, Standard_Integer& N3) const;
//! Get the node of given Index.
//! Raises OutOfRange from Standard if Index is not in 1,2,3
Standard_Integer Value (const Standard_Integer theIndex) const
{
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::Value(), invalid index");
return myNodes[theIndex - 1];
}
Standard_Integer operator() (const Standard_Integer Index) const { return Value(Index); }
Standard_Integer Value (const Standard_Integer Index) const;
Standard_Integer operator() (const Standard_Integer Index) const
{
return Value(Index);
}
//! Get the node of given Index.
//! Raises OutOfRange if Index is not in 1,2,3
Standard_Integer& ChangeValue (const Standard_Integer theIndex)
{
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::ChangeValue(), invalid index");
return myNodes[theIndex - 1];
}
Standard_Integer& ChangeValue (const Standard_Integer Index);
Standard_Integer& operator() (const Standard_Integer Index)
{
return ChangeValue(Index);
}
protected:
Standard_Integer& operator() (const Standard_Integer Index) { return ChangeValue(Index); }
private:
Standard_Integer myNodes[3];
};
#include <Poly_Triangle.lxx>
#endif // _Poly_Triangle_HeaderFile

View File

@@ -0,0 +1,52 @@
// Created on: 1995-03-06
// Created by: Laurent PAINNOT
// Copyright (c) 1995-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 <Standard_OutOfRange.hxx>
//=======================================================================
//function : Set
//purpose :
//=======================================================================
inline void Poly_Triangle::Set(const Standard_Integer Index, const Standard_Integer Node)
{
Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
myNodes[Index-1] = Node;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
inline Standard_Integer Poly_Triangle::Value(const Standard_Integer Index) const
{
Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
return myNodes[Index-1];
}
//=======================================================================
//function : ChangeValue
//purpose :
//=======================================================================
inline Standard_Integer& Poly_Triangle::ChangeValue
(const Standard_Integer Index)
{
Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
return myNodes[Index-1];
}

View File

@@ -2174,7 +2174,7 @@ static int StackOverflow (int i = -1)
#endif
// this code does not work with optimize mode on Windows
#if defined(_MSC_VER) && !defined(__clang__)
#if defined(_MSC_VER)
#pragma optimize( "", off )
#endif
static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
@@ -2488,7 +2488,7 @@ static Standard_Integer OCC30775 (Draw_Interpretor& theDI, Standard_Integer theN
return 0;
}
#if defined(_MSC_VER) && !defined(__clang__)
#if defined(_MSC_VER)
#pragma optimize( "", on )
#endif

View File

@@ -57,11 +57,9 @@
#include <Standard_Atomic.hxx>
#ifdef HAVE_TBB
Standard_DISABLE_DEPRECATION_WARNINGS
#include <tbb/parallel_for.h>
#include <tbb/parallel_for_each.h>
#include <tbb/blocked_range.h>
Standard_ENABLE_DEPRECATION_WARNINGS
#endif
#include <cstdio>
@@ -3154,7 +3152,7 @@ static Standard_Integer OCC25547(
aIntFlag = BRepMesh_GeomTool::IntSegSeg(
aRefPnts[0], aRefPnts[1], aRefPnts[2], aRefPnts[3],
Standard_False, Standard_False, aIntPnt);
Standard_False, Standard_False, aIntPnt, aParams);
aDiff = aIntPnt.Distance(gp::Origin2d());
if (aIntFlag != BRepMesh_GeomTool::Cross || aDiff > Precision::PConfusion())

View File

@@ -44,7 +44,7 @@ namespace
const ColorInteger theColorComponentBase)
{
Standard_ASSERT_RETURN (theColorComponentBase >= 2,
"'theColorComponentBase' must be greater than 1.",
__FUNCTION__ ": 'theColorComponentBase' must be greater than 1.",
0.0f);
const ColorInteger aColorComponentMaxValue = theColorComponentBase - 1;
const ColorInteger aColorComponentAsInteger = theColorInteger % theColorComponentBase;
@@ -67,7 +67,7 @@ namespace
Quantity_ColorRGBA& theColor)
{
Standard_ASSERT_RETURN (theColorComponentBase >= 2,
"'theColorComponentBase' must be greater than 1.",
__FUNCTION__ ": 'theColorComponentBase' must be greater than 1.",
0.0f);
NCollection_Vec4<float> aColor (1.0f);
if (hasAlphaComponent)

View File

@@ -70,7 +70,6 @@ void RWObj_CafReader::BindNamedShape (const TopoDS_Shape& theShape,
aMat = new XCAFDoc_VisMaterial();
aMat->SetCommonMaterial (aMatXde);
aMat->SetRawName (new TCollection_HAsciiString (theMaterial->Name));
myObjMaterialMap.Bind (theMaterial->Name, aMat);
}
aShapeAttribs.Style.SetMaterial (aMat);
}

View File

@@ -43,21 +43,22 @@ protected:
//! Create reader context.
//! Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.
Standard_EXPORT virtual Handle(RWObj_TriangulationReader) createReaderContext();
virtual Handle(RWObj_TriangulationReader) createReaderContext();
//! @param theShape shape to register
//! @param theName shape name
//! @param theMaterial shape material
//! @param theIsRootShape indicates that this is a root object (free shape)
Standard_EXPORT virtual void BindNamedShape (const TopoDS_Shape& theShape,
const TCollection_AsciiString& theName,
const RWObj_Material* theMaterial,
const Standard_Boolean theIsRootShape) Standard_OVERRIDE;
virtual void BindNamedShape (const TopoDS_Shape& theShape,
const TCollection_AsciiString& theName,
const RWObj_Material* theMaterial,
const Standard_Boolean theIsRootShape) Standard_OVERRIDE;
protected:
NCollection_DataMap<TCollection_AsciiString, Handle(XCAFDoc_VisMaterial)> myObjMaterialMap;
Standard_Boolean myIsSinglePrecision; //!< flag for reading vertex data with single or double floating point precision
};
#endif // _RWObj_CafReader_HeaderFile

View File

@@ -37,9 +37,9 @@ public:
public:
SelectBasics_SelectingVolumeManager() {}
SelectBasics_SelectingVolumeManager() {};
virtual ~SelectBasics_SelectingVolumeManager() {}
virtual ~SelectBasics_SelectingVolumeManager() {};
virtual Standard_Integer GetActiveSelectionType() const = 0;

View File

@@ -36,7 +36,7 @@ public:
//! Creates instances of all available selecting volume types
Standard_EXPORT SelectMgr_SelectingVolumeManager (Standard_Boolean theToAllocateFrustums = Standard_True);
virtual ~SelectMgr_SelectingVolumeManager() {}
virtual ~SelectMgr_SelectingVolumeManager() {};
//! IMPORTANT: Scaling makes sense only for frustum built on a single point!
//! Note that this method does not perform any checks on type of the frustum.

View File

@@ -36,7 +36,7 @@ public:
//! Empty constructor.
Standard_EXPORT SelectMgr_SensitiveEntitySet (const Handle(Select3D_BVHBuilder3d)& theBuilder);
virtual ~SelectMgr_SensitiveEntitySet() {}
virtual ~SelectMgr_SensitiveEntitySet() {};
//! Adds new entity to the set and marks BVH tree for rebuild
Standard_EXPORT void Append (const Handle(SelectMgr_SensitiveEntity)& theEntity);

View File

@@ -831,13 +831,20 @@ vec4 PathTrace (in SRay theRay, in vec3 theInverse, in int theNbSamples)
if (aBSDF.Kd.w >= 0.f)
{
vec4 aTexCoord = vec4 (SmoothUV (aHit.UV, aTriIndex), 0.f, 1.f);
vec4 aTrsfRow1 = texelFetch (uRaytraceMaterialTexture, MATERIAL_TRS1 (aTriIndex.w));
vec4 aTrsfRow2 = texelFetch (uRaytraceMaterialTexture, MATERIAL_TRS2 (aTriIndex.w));
vec4 aTrsfRow1 = texelFetch (
uRaytraceMaterialTexture, MATERIAL_TRS1 (aTriIndex.w));
vec4 aTrsfRow2 = texelFetch (
uRaytraceMaterialTexture, MATERIAL_TRS2 (aTriIndex.w));
aTexCoord.st = vec2 (dot (aTrsfRow1, aTexCoord),
dot (aTrsfRow2, aTexCoord));
vec4 aTexColor = textureLod (sampler2D (uTextureSamplers[int (aBSDF.Kd.w)]), aTexCoord.st, 0.f);
aBSDF.Kd.rgb *= aTexColor.rgb * aTexColor.w;
vec4 aTexColor = textureLod (
sampler2D (uTextureSamplers[int (aBSDF.Kd.w)]), aTexCoord.st, 0.f);
aBSDF.Kd.rgb *= (aTexColor.rgb * aTexColor.rgb) * aTexColor.w; // de-gamma correction (for gamma = 2)
if (aTexColor.w != 1.0f)
{
// mix transparency BTDF with texture alpha-channel

View File

@@ -834,13 +834,20 @@ static const char Shaders_PathtraceBase_fs[] =
" if (aBSDF.Kd.w >= 0.f)\n"
" {\n"
" vec4 aTexCoord = vec4 (SmoothUV (aHit.UV, aTriIndex), 0.f, 1.f);\n"
" vec4 aTrsfRow1 = texelFetch (uRaytraceMaterialTexture, MATERIAL_TRS1 (aTriIndex.w));\n"
" vec4 aTrsfRow2 = texelFetch (uRaytraceMaterialTexture, MATERIAL_TRS2 (aTriIndex.w));\n"
"\n"
" vec4 aTrsfRow1 = texelFetch (\n"
" uRaytraceMaterialTexture, MATERIAL_TRS1 (aTriIndex.w));\n"
" vec4 aTrsfRow2 = texelFetch (\n"
" uRaytraceMaterialTexture, MATERIAL_TRS2 (aTriIndex.w));\n"
"\n"
" aTexCoord.st = vec2 (dot (aTrsfRow1, aTexCoord),\n"
" dot (aTrsfRow2, aTexCoord));\n"
"\n"
" vec4 aTexColor = textureLod (sampler2D (uTextureSamplers[int (aBSDF.Kd.w)]), aTexCoord.st, 0.f);\n"
" aBSDF.Kd.rgb *= aTexColor.rgb * aTexColor.w;\n"
" vec4 aTexColor = textureLod (\n"
" sampler2D (uTextureSamplers[int (aBSDF.Kd.w)]), aTexCoord.st, 0.f);\n"
"\n"
" aBSDF.Kd.rgb *= (aTexColor.rgb * aTexColor.rgb) * aTexColor.w; // de-gamma correction (for gamma = 2)\n"
"\n"
" if (aTexColor.w != 1.0f)\n"
" {\n"
" // mix transparency BTDF with texture alpha-channel\n"

View File

@@ -202,8 +202,6 @@ inline Standard_ErrorHandler::Callback::Callback ()
}
inline Standard_ErrorHandler::Callback::~Callback ()
{
(void)myHandler;
(void)myPrev;
}
inline void Standard_ErrorHandler::Callback::RegisterCallback ()
{

View File

@@ -147,14 +147,14 @@
#if defined(__ICL) || defined (__INTEL_COMPILER)
#define Standard_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478))
#define Standard_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop))
#elif defined(_MSC_VER)
#define Standard_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996))
#define Standard_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop))
#elif (defined(__GNUC__) && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || defined(__clang__)
// available since at least gcc 4.2 (maybe earlier), however only gcc 4.6+ supports this pragma inside the function body
// CLang also supports this gcc syntax (in addition to "clang diagnostic ignored")
#define Standard_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
#define Standard_ENABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
#elif defined(_MSC_VER)
#define Standard_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996))
#define Standard_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop))
#else
#define Standard_DISABLE_DEPRECATION_WARNINGS
#define Standard_ENABLE_DEPRECATION_WARNINGS

View File

@@ -552,10 +552,6 @@ void rec_typarg(int argtype);
// Note that Intel compiler also defines _MSC_VER but has different warning ids
#if defined(__INTEL_COMPILER)
#pragma warning(disable:177 1786 1736)
#elif defined(__clang__)
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
#else
#pragma warning(disable:4131 4244 4273 4267 4127)
#endif

View File

@@ -47,11 +47,6 @@ void rec_typarg(int argtype);
// Note that Intel compiler also defines _MSC_VER but has different warning ids
#if defined(__INTEL_COMPILER)
#pragma warning(disable:177 1786 1736)
#elif defined(__clang__)
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
#else
#else
#pragma warning(disable:4131 4244 4273 4267 4127)
#endif

View File

@@ -205,9 +205,6 @@ void Storage_BucketOfPersistent::Append(const Handle(Standard_Persistent)& sp)
Storage_BucketIterator::Storage_BucketIterator
(Storage_BucketOfPersistent* aBucketManager)
: myBucket(0), myCurrentBucket(0),
myCurrentBucketIndex(0), myCurrentIndex(0),
myBucketNumber(0), myMoreObject(Standard_False)
{
if (aBucketManager) {
myBucket = aBucketManager;
@@ -217,6 +214,7 @@ Storage_BucketIterator::Storage_BucketIterator
myCurrentIndex = 0;
myMoreObject = Standard_True;
}
else myMoreObject = Standard_False;
}
//=======================================================================

View File

@@ -34,7 +34,6 @@ class V3d_View;
class V3d_Viewer;
class ViewerTest_EventManager;
class TopoDS_Shape;
class WNT_WClass;
class ViewerTest
{
@@ -258,7 +257,7 @@ private:
//! Ctrl+MB2 for pan, etc) and keyboard shortcuts.
//! This method is relevant for MS Windows only and respectively
//! returns WNT_WClass handle.
static const Handle(WNT_WClass)& WClass();
static const Handle(Standard_Transient)& WClass();
};
#endif // _ViewerTest_HeaderFile

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