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

Compare commits

..

10 Commits

Author SHA1 Message Date
jfa
ec7f1db190 Do not rebuild wire if there are no necessary changes 2023-09-18 10:03:44 +01:00
jfa
3edc262d43 OCCT integration request 33328 2023-09-18 10:02:32 +01:00
knosulko
bfacb83607 0033156: Modeling Algorithms - Planar face creation problem
BRepLib_MakeFace::BRepLib_MakeFace: deleted degenerative edges from the input wire;
add test tests\mkface\mkplane\bug33156.
2023-04-19 16:31:24 +01:00
ddzama
61b0e8c5e3 0032934: Modelling Algorithms - BRepExtrema_DistShapeShape returns two solutions instead of one
distmini of two edges returns two solution points instead one.
Second unneeded solution point is the same as first.

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

PERFORM_C0

And second point found in this procedure.
Folowing code of

BRepExtrema_DistanceSS::Perform (variant for Edge/Edge)

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

Additionally, in the function

PERFORM_C0

an obvious error has fixed.
2023-04-19 16:31:05 +01:00
ifv
f8320ee51b 0033193: Modeling Algorithms - Regression: UnifySameDomain raises SIGSEGV
ShapeUpgrade_UnifySameDomain.cxx - method ReconstructMissedSeam is improved.

tests/bugs/heal/bug33193 - new test case added
2023-04-19 13:12:00 +01:00
ifv
fc54ce089b 0033170: Modeling Algorithms - Checking for canonical geometry: plane detection problems
GeomLib_IsPlanarSurface.cxx - using poles for checking BSpline, Bezier curves and surface changed
                              on checking by curve, surface points.

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

tests/cr/bugs/bug33170 - new test case added
2023-04-19 13:11:14 +01:00
jfa
89e09e4c18 Now proximity depends on the shapes order 2023-04-19 12:45:18 +01:00
knosulko
7c73277ec9 0033144: Modeling Algorithms - Wrong result of Shape Proximity
Added step of refinement the coarser of the two shapes meshes to produce two meshes with approximately the same density.
Added tests lowalgos/proximity.

Fixed accounting of parameters to adjust number of initial sample points
2023-04-19 12:35:53 +01:00
dpasukhi
185d29b92f 0033198: Using a third-party Draco to compile in DEBUG mode
Added new CMake variables to build using DRACO
Windows OS works with Debug and Release configuration DRACO
Linux works with Release configuration DRACO
2022-11-12 01:19:44 +03:00
smoskvin
2923ef0df8 fixed compilation by the genproj tool 2022-11-11 11:26:00 +03:00
27 changed files with 1068 additions and 261 deletions

View File

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

View File

@@ -370,6 +370,10 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
add_definitions (-DHAVE_GLES2)
endif()
if ("${CURRENT_CSF}" STREQUAL "${CSF_Draco}")
set (CURRENT_CSF "")
set (USED_DRACO 1)
endif()
set (LIBRARY_FROM_CACHE 0)
separate_arguments (CURRENT_CSF)
foreach (CSF_LIBRARY ${CURRENT_CSF})
@@ -397,7 +401,7 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endforeach()
endforeach()
if (NOT ${LIBRARY_FROM_CACHE})
if (NOT ${LIBRARY_FROM_CACHE} AND NOT "${CURRENT_CSF}" STREQUAL "")
# prepare a list from a string with whitespaces
separate_arguments (CURRENT_CSF)
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
@@ -408,6 +412,28 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endif()
endforeach()
if (USE_DRACO)
if (USED_DRACO)
set (USED_LIB_RELEASE ${3RDPARTY_DRACO_LIBRARY})
if (WIN32)
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY_DEBUG})
else()
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY})
endif()
set (USED_LIB_CONF)
if (EXISTS ${USED_LIB_DEBUG})
set (USED_LIB_CONF "$<$<CONFIG:DEBUG>:${USED_LIB_DEBUG}>;${USED_LIB_CONF}")
endif()
if (EXISTS ${USED_LIB_RELEASE})
set (USED_LIB_CONF "$<$<CONFIG:RELEASE>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
set (USED_LIB_CONF "$<$<CONFIG:RELWITHDEBINFO>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
endif()
if (DEFINED USED_LIB_CONF)
set_property (TARGET ${PROJECT_NAME} APPEND PROPERTY LINK_LIBRARIES "${USED_LIB_CONF}")
endif()
endif()
endif()
if (APPLE)
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
if (NOT ${IS_X11_FOUND} EQUAL -1)

View File

@@ -13,7 +13,7 @@
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// branch2
#include <Adaptor2d_Curve2d.hxx>
#include <Geom2d_BezierCurve.hxx>

View File

@@ -13,7 +13,7 @@
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// branch2
#include <Adaptor3d_Curve.hxx>
#include <Geom_BezierCurve.hxx>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -965,6 +965,9 @@ static void InternalSameParameter(const TopoDS_Shape& theSh, BRepTools_ReShape&
TopExp_Explorer ex2;
for(ex2.Init(curface,TopAbs_EDGE); ex2.More(); ex2.Next()){
const TopoDS_Edge& E = TopoDS::Edge(ex2.Current());
if (BRep_Tool::Degenerated(E))
continue;
TopoDS_Shape aNe = theReshaper.Value(E);
Standard_Real aNewEtol = -1;
GetEdgeTol(TopoDS::Edge(aNe), curface, aNewEtol);

View File

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

View File

@@ -4953,6 +4953,53 @@ Standard_Boolean BRepOffset_MakeOffset::IsPlanar()
if (aPlanarityChecker.IsPlanar())
{
gp_Pln aPln = aPlanarityChecker.Plan();
Standard_Real u1, u2, v1, v2, um, vm;
aSurf->Bounds(u1, u2, v1, v2);
Standard_Boolean isInf1 = Precision::IsInfinite(u1), isInf2 = Precision::IsInfinite(u2);
if (!isInf1 && !isInf2)
{
um = (u1 + u2) / 2.;
}
else if(isInf1 && !isInf2)
{
um = u2 - 1.;
}
else if(!isInf1 && isInf2)
{
um = u1 + 1.;
}
else //isInf1 && isInf2
{
um = 0.;
}
isInf1 = Precision::IsInfinite(v1), isInf2 = Precision::IsInfinite(v2);
if (!isInf1 && !isInf2)
{
vm = (v1 + v2) / 2.;
}
else if (isInf1 && !isInf2)
{
vm = v2 - 1.;
}
else if(!isInf1 && isInf2)
{
vm = v1 + 1.;
}
else //isInf1 && isInf2
{
vm = 0.;
}
gp_Pnt aP;
gp_Vec aD1, aD2;
aBAS.D1(um, vm, aP, aD1, aD2);
gp_Vec aNorm = aD1.Crossed(aD2);
gp_Dir aPlnNorm = aPln.Position().Direction();
if (aNorm.Dot(aPlnNorm) < 0.)
{
aPlnNorm.Reverse();
gp_Ax1 anAx(aPln.Position().Location(), aPlnNorm);
aPln.SetAxis(anAx);
}
Handle(Geom_Plane) aPlane = new Geom_Plane(aPln);
TopoDS_Face aPlanarFace;
aBB.MakeFace(aPlanarFace, aPlane, aTolForFace);

View File

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

View File

@@ -753,7 +753,25 @@ static void ReconstructMissedSeam(const TopTools_SequenceOfShape& theRemovedEdge
if ((theUperiod != 0. && aUdiff > theUperiod/2) ||
(theVperiod != 0. && aVdiff > theVperiod/2))
{
anEdge.Reverse();
if (aLastVertex.IsSame(theCurVertex) || (theUperiod != 0. && theVperiod != 0.))
{
anEdge.Reverse();
}
else
{
TopAbs_Orientation anOri = anEdge.Orientation();
anEdge.Orientation(TopAbs_FORWARD);
Handle(Geom2d_Curve) aPC1 = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
anEdge.Reverse();
Handle(Geom2d_Curve) aPC2 = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
anEdge.Reverse(); // again FORWARD
TopLoc_Location aLoc;
BRep_Builder aBB;
Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(theFrefFace, aLoc);
aBB.UpdateEdge(anEdge, aPC2, aPC1, aSurf, aLoc, aTol);
anEdge.Orientation(anOri);
}
aPC = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
aParam = (anEdge.Orientation() == TopAbs_FORWARD)? Param1 : Param2;
aPoint = aPC->Value(aParam);
@@ -1199,6 +1217,13 @@ static Standard_Boolean getCylinder(Handle(Geom_Surface)& theInSurface,
Handle(Geom_SurfaceOfRevolution) aRS =
Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface);
Handle(Geom_Curve) aBasis = aRS->BasisCurve();
while (aBasis->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) aTc =
Handle(Geom_TrimmedCurve)::DownCast(aBasis);
aBasis = aTc->BasisCurve();
}
if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) {
Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis);
gp_Dir aDir = aRS->Direction();
@@ -1218,6 +1243,13 @@ static Standard_Boolean getCylinder(Handle(Geom_Surface)& theInSurface,
Handle(Geom_SurfaceOfLinearExtrusion) aLES =
Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface);
Handle(Geom_Curve) aBasis = aLES->BasisCurve();
while (aBasis->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) aTc =
Handle(Geom_TrimmedCurve)::DownCast(aBasis);
aBasis = aTc->BasisCurve();
}
if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) {
Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis);
gp_Dir aDir = aLES->Direction();

View File

@@ -18,6 +18,7 @@
// paralleling with Intel TBB
#ifdef HAVE_TBB
#pragma comment (lib, "tbbmalloc.lib")
#include <tbb/scalable_allocator.h>
using namespace tbb;
#else

View File

@@ -34,7 +34,7 @@
// Primary definitions
#define OCC_VERSION_MAJOR 7
#define OCC_VERSION_MINOR 8
#define OCC_VERSION_MINOR 7
#define OCC_VERSION_MAINTENANCE 0
//! This macro must be commented in official release, and set to non-empty
@@ -42,12 +42,12 @@
//! - "dev" for development version between releases
//! - "beta..." or "rc..." for beta releases or release candidates
//! - "project..." for version containing project-specific fixes
#define OCC_VERSION_DEVELOPMENT "dev"
//#define OCC_VERSION_DEVELOPMENT "dev"
// Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.8
#define OCC_VERSION_STRING "7.8"
#define OCC_VERSION_COMPLETE "7.8.0"
#define OCC_VERSION 7.7
#define OCC_VERSION_STRING "7.7"
#define OCC_VERSION_COMPLETE "7.7.0"
//! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -9,6 +9,7 @@ TKShHealing
TKMesh
TKService
TKHLR
TKTopAlgo
CSF_TclLibs
CSF_TclTkLibs
CSF_XwLibs

19
tests/bugs/heal/bug33193 Normal file
View File

@@ -0,0 +1,19 @@
puts "========================================="
puts "0033193: Modeling Algorithms - Regression: UnifySameDomain raises SIGSEGV"
puts "========================================="
puts ""
restore [locate_data_file bug33193.brep] a
unifysamedom result a
checkshape result
checknbshapes result -t -solid 1 -shell 1 -face 152 -wire 202 -edge 411 -vertex 273
set tolres [checkmaxtol result]
if { ${tolres} > 1.26e-7} {
puts "Error: bad tolerance of result"
}

View File

@@ -0,0 +1,25 @@
puts "========"
puts "OCC32934"
puts "========"
puts ""
###############################################################################################
# BRepExtrema_DistShapeShape BRepExtrema_DistShapeShape returns two solutions instead of one.
###############################################################################################
pload ALL
restore [locate_data_file bug32934.brep] edges
explode edges E
distmini di edges_1 edges_2
if { ([isdraw di2]) } {
puts "Error : result of distmini is wrong"
} else {
checknbshapes di -vertex 1 -edge 0
}
distmini dii edges_2 edges_1
if { ([isdraw dii2]) } {
puts "Error : result of distmini is wrong"
} else {
checknbshapes dii -vertex 1 -edge 0
}

30
tests/cr/bugs/bug33170 Normal file
View File

@@ -0,0 +1,30 @@
puts "============"
puts "0033170: Modeling Algorithms - Checking for canonical geometry: plane detection problems"
puts "============"
puts ""
set ExpectGap 0.0051495320504590563
brestore [locate_data_file bug33170.brep] f
set log1 [getanasurf asurf1 f pln 0.006]
regexp {Gap = +([-0-9.+eE]+)} $log1 full gap1
if {[isdraw asurf1]} {
set log [dump asurf1]
if { [regexp {Plane} $log ] != 1 } {
puts "Error: surface is not a plane"
}
} else {
puts "Error: required surface is not got"
}
checkreal FoundGap1 $gap1 $ExpectGap 1.0e-9 0.0
#
set log2 [getanasurf asurf2 f pln 1.]
regexp {Gap = +([-0-9.+eE]+)} $log1 full gap2
if {[isdraw asurf2]} {
set log [dump asurf2]
if { [regexp {Plane} $log ] != 1 } {
puts "Error: surface is not a plane"
}
} else {
puts "Error: required surface is not got"
}
checkreal FoundGap2 $gap2 $ExpectGap 1.0e-9 0.0

View File

@@ -1,2 +1,3 @@
001 base
002 approx
003 bugs

View File

@@ -0,0 +1,29 @@
puts "============"
puts "0033144: Modeling Algorithms - Wrong result of Shape Proximity"
puts "==========="
puts ""
sphere s1 0 1 0 0 0 1 1
trimu s1 s1 0 pi
mkface fs1 s1
incmesh fs1 1e-3
plane p1 0 0 0 0 1 0
trim p1 p1 -1 1 -1 1
mkface f2 p1
incmesh f2 1e-3
set log [proximity fs1 f2 -value -profile]
regexp {Proximity value: ([0-9+-.eE]*)} $log full val;
set tol 1.e-2
set expected 2.0
regexp {Status of ProxPnt1 on ([A-Za-z0-9._-]*) : ([A-Za-z]*)} $log full val1 val2
set status1 ${val2}
set expected_status1 Middle
regexp {Status of ProxPnt2 on ([A-Za-z0-9._-]*) : ([A-Za-z]*)} $log full val1 val2
set status2 ${val2}
set expected_status2 Middle

View File

@@ -1,26 +1,23 @@
puts "============"
puts "0033017: Implement an algorithm to find a proximity between a pair of shapes"
puts "0033144: Modeling Algorithms - Wrong result of Shape Proximity"
puts "==========="
puts ""
plane p1 0 0 0 0 0 1
trim p1 p1 -1 1 -1 1
mkface f1 p1
incmesh f1 1.e-3
restore [locate_data_file bug33144_e1.brep] e1
restore [locate_data_file bug33144_e2.brep] e2
circle c 0 0 1 1
mkedge e1 c
incmesh e1 1.e-3
incmesh e1 1e-3
incmesh e2 1e-3
set log [proximity f1 e1 -value -profile]
set log [proximity e1 e2 -value -profile]
regexp {Proximity value: ([0-9+-.eE]*)} $log full val;
set tol 1.e-3
set expected 1.0
set expected 0.6996
regexp {Status of ProxPnt1 on ([A-Za-z0-9._-]*) : ([A-Za-z]*)} $log full val1 val2
set status1 ${val2}
set expected_status1 Border
set expected_status1 Middle
regexp {Status of ProxPnt2 on ([A-Za-z0-9._-]*) : ([A-Za-z]*)} $log full val1 val2
set status2 ${val2}

View File

@@ -0,0 +1,10 @@
puts "============="
puts "0033156: Modeling Algorithms - Planar face creation problem"
puts "============="
brestore [locate_data_file bug33156_face.brep] Face
explode Face W
#Face_1
mkplane result Face_1 1

View File

@@ -1,5 +1,5 @@
@echo off
rem test1
rem Helper script to run procedure of automatic upgrade of application code
rem on newer version of OCCT on Windows.
rem Running it requires that Tcl should be in the PATH